@gientech/modual 1.2.7 → 1.2.8

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 (312) hide show
  1. package/.editorconfig +38 -0
  2. package/.prettierignore +16 -0
  3. package/.prettierrc +17 -0
  4. package/README.md +129 -129
  5. package/USAGE.md +191 -0
  6. package/bash.exe.stackdump +40 -0
  7. package/components.json +21 -0
  8. package/dist/README.md +129 -0
  9. package/dist/assets/circle-alert-g2Y6zAjt.js +6 -0
  10. package/{assets → dist/assets}/database.svg +11 -11
  11. package/{assets → dist/assets}/database_add.svg +53 -53
  12. package/{assets → dist/assets}/database_connect.svg +66 -66
  13. package/{assets → dist/assets}/database_upload.svg +29 -29
  14. package/{assets → dist/assets}/defaultWeLogo.svg +14 -14
  15. package/dist/assets/index-97TKgPKE.js +1284 -0
  16. package/dist/assets/index-CEK88UzR.js +26 -0
  17. package/dist/assets/index-DIm7RgkM.js +1709 -0
  18. package/{assets/MySQL.svg → dist/assets/mysql.svg} +14 -14
  19. package/{assets/plus-fNg4vmeA.js → dist/assets/plus-omCUN0e3.js} +1 -1
  20. package/dist/assets/style.css +1 -0
  21. package/dist/assets/style3.css +1 -0
  22. package/{assets/x-tMUaBf0a.js → dist/assets/x-vPcWt3fC.js} +1 -1
  23. package/dist/chat.js +648 -0
  24. package/dist/database.js +20 -0
  25. package/dist/databaseId.js +11 -0
  26. package/{databaseTable.js → dist/databaseTable.js} +2 -2
  27. package/dist/modelManage.js +1 -0
  28. package/dist/package.json +56 -0
  29. package/dist/sensitive.js +1 -0
  30. package/{streamFilesReader.js → dist/streamFilesReader.js} +16 -16
  31. package/{worker → dist/worker}/pdf.worker.min.js +21 -21
  32. package/doc_assets/2.png +0 -0
  33. package/doc_assets/demo.md +27 -0
  34. package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +2 -0
  35. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +23699 -0
  36. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +1 -0
  37. package/doc_assets/demos/dist-app/index.html +14 -0
  38. package/doc_assets/demos/dist-app/vite.svg +1 -0
  39. package/doc_assets/images/1.png +0 -0
  40. package/doc_assets/images/3.png +0 -0
  41. package/doc_assets/images/component-screenshot.png +1 -0
  42. package/doc_assets/install.md +5 -0
  43. package/eslint.config.js +92 -0
  44. package/index.html +13 -0
  45. package/package.json +99 -56
  46. package/postcss.config.cjs +19 -0
  47. package/public/vite.svg +1 -0
  48. package/public/worker/pdf.worker.min.js +22 -0
  49. package/scripts/README.md +133 -0
  50. package/scripts/build-demo.js +88 -0
  51. package/scripts/demo-selector.js +216 -0
  52. package/scripts/dev-demo.js +76 -0
  53. package/scripts/preview-demo.js +130 -0
  54. package/scripts/run-demo.bat +34 -0
  55. package/src/assets/img/downArrow.png +0 -0
  56. package/src/assets/img/excel.png +0 -0
  57. package/src/assets/img/img.png +0 -0
  58. package/src/assets/img/pdf.png +0 -0
  59. package/src/assets/img/ppt.png +0 -0
  60. package/src/assets/img/txt.png +0 -0
  61. package/src/assets/img/word.png +0 -0
  62. package/src/assets/login/homeBg.png +0 -0
  63. package/src/assets/login/left.jpg +0 -0
  64. package/src/assets/login/logoImg.png +0 -0
  65. package/src/examples/LoginPage/index.tsx +18 -0
  66. package/src/examples/chat/index.tsx +140 -0
  67. package/src/examples/gientechStreamFilesReader/index.tsx +1016 -0
  68. package/src/examples/ragDatabaseDataPage/index.tsx +36 -0
  69. package/src/examples/ragDatabaseIdPage/index.tsx +44 -0
  70. package/src/examples/ragDatabasePage/index.tsx +36 -0
  71. package/src/examples/ragModelManagePage/index.tsx +37 -0
  72. package/src/examples/ragSearchPage/index.tsx +0 -0
  73. package/src/examples/ragSensitiveWordsPage/index.tsx +32 -0
  74. package/src/examples/streamFiles/index.tsx +384 -0
  75. package/src/lib_enter.ts +38 -0
  76. package/src/main.tsx +5 -0
  77. package/src/main.tsx.backup +5 -0
  78. package/src/modules/chat/Conversations/Item.tsx +167 -0
  79. package/src/modules/chat/Conversations/List.tsx +143 -0
  80. package/src/modules/chat/Conversations/groupByTime.ts +39 -0
  81. package/src/modules/chat/Conversations/index.tsx +212 -0
  82. package/src/modules/chat/constants.tsx +33 -0
  83. package/src/modules/chat/index.tsx +1837 -0
  84. package/src/modules/chat/types.ts +17 -0
  85. package/src/modules/database/CreateModal.tsx +398 -0
  86. package/src/modules/database/assets/Doris.png +0 -0
  87. package/src/modules/database/assets/PostgreSQL.png +0 -0
  88. package/src/modules/database/assets/SQLServer.png +0 -0
  89. package/src/modules/database/assets/database.svg +11 -0
  90. package/src/modules/database/assets/database_add.svg +53 -0
  91. package/src/modules/database/assets/database_connect.svg +66 -0
  92. package/src/modules/database/assets/database_upload.svg +29 -0
  93. package/src/modules/database/assets/empty.png +0 -0
  94. package/src/modules/database/assets/mysql.svg +14 -0
  95. package/src/modules/database/index.tsx +466 -0
  96. package/src/modules/database/server.ts +196 -0
  97. package/src/modules/databaseId/CustomCom.tsx +156 -0
  98. package/src/modules/databaseId/EditConfig.tsx +268 -0
  99. package/src/modules/databaseId/UploadDrawer.tsx +520 -0
  100. package/src/modules/databaseId/assets/aiOptimize.svg +10 -0
  101. package/src/modules/databaseId/assets/empty.png +0 -0
  102. package/src/modules/databaseId/assets/template.svg +6 -0
  103. package/src/modules/databaseId/assets/upload.svg +9 -0
  104. package/src/modules/databaseId/assets/useTemp.svg +6 -0
  105. package/src/modules/databaseId/index.tsx +734 -0
  106. package/src/modules/databaseId/server.ts +286 -0
  107. package/src/modules/databaseId/style.css +5 -0
  108. package/src/modules/databaseTable/EditRowDrawer.tsx +119 -0
  109. package/src/modules/databaseTable/index.tsx +357 -0
  110. package/src/modules/databaseTable/server.ts +180 -0
  111. package/src/modules/headlessChat/constants.tsx +32 -0
  112. package/src/modules/headlessChat/index.tsx +1065 -0
  113. package/src/modules/headlessChat/types.ts +23 -0
  114. package/src/modules/login/components/Login/LoginBox/index.tsx +102 -0
  115. package/src/modules/login/components/Login/RegisterBox/index.tsx +180 -0
  116. package/src/modules/login/components/Login/index.tsx +100 -0
  117. package/src/modules/login/index.tsx +106 -0
  118. package/src/modules/login/style.css +3 -0
  119. package/src/modules/login/useServices.ts +53 -0
  120. package/src/modules/login/utils.ts +42 -0
  121. package/src/modules/modelManage/ConfigDrawer.tsx +249 -0
  122. package/src/modules/modelManage/assets/empty.png +0 -0
  123. package/src/modules/modelManage/const.ts +50 -0
  124. package/src/modules/modelManage/index.tsx +439 -0
  125. package/src/modules/modelManage/server.ts +185 -0
  126. package/src/modules/search/assets/Icon-history.svg +8 -0
  127. package/src/modules/search/assets/answerAwartar.png +0 -0
  128. package/src/modules/search/assets/doc.png +0 -0
  129. package/src/modules/search/assets/genera.gif +0 -0
  130. package/src/modules/search/assets/icon-robot.svg +9 -0
  131. package/src/modules/search/assets/icon-search-bar.svg +14 -0
  132. package/src/modules/search/assets/icon-sub-title.svg +3 -0
  133. package/src/modules/search/assets/icon-title.svg +9 -0
  134. package/src/modules/search/assets/icon-zoomOut.svg +9 -0
  135. package/src/modules/search/assets/iconAi.svg +9 -0
  136. package/src/modules/search/assets/pdf.png +0 -0
  137. package/src/modules/search/assets/ppt.png +0 -0
  138. package/src/modules/search/assets/search.svg +3 -0
  139. package/src/modules/search/assets/selected.svg +4 -0
  140. package/src/modules/search/assets/txt.png +0 -0
  141. package/src/modules/search/assets/xls.png +0 -0
  142. package/src/modules/search/components/AssisSelect.tsx +137 -0
  143. package/src/modules/search/components/Editor/ChatViewEditor.tsx +261 -0
  144. package/src/modules/search/components/Editor/aichat.css +1 -0
  145. package/src/modules/search/components/Editor/constant.ts +13 -0
  146. package/src/modules/search/components/Editor/index.tsx +113 -0
  147. package/src/modules/search/components/Editor/plugins/autofomatRules.ts +332 -0
  148. package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +20 -0
  149. package/src/modules/search/components/Editor/plugins/createIndexes.tsx +38 -0
  150. package/src/modules/search/components/Editor/plugins/displayer.ts +298 -0
  151. package/src/modules/search/components/Editor/plugins/imageClick.tsx +32 -0
  152. package/src/modules/search/components/Editor/plugins/myplugin.tsx +98 -0
  153. package/src/modules/search/components/Editor/ui/avatar.tsx +19 -0
  154. package/src/modules/search/components/Editor/ui/blockquote-element.tsx +21 -0
  155. package/src/modules/search/components/Editor/ui/button.tsx +58 -0
  156. package/src/modules/search/components/Editor/ui/calendar.tsx +68 -0
  157. package/src/modules/search/components/Editor/ui/caption.tsx +46 -0
  158. package/src/modules/search/components/Editor/ui/checkbox.tsx +27 -0
  159. package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +188 -0
  160. package/src/modules/search/components/Editor/ui/code-block-element.css +434 -0
  161. package/src/modules/search/components/Editor/ui/code-block-element.tsx +39 -0
  162. package/src/modules/search/components/Editor/ui/code-leaf.tsx +24 -0
  163. package/src/modules/search/components/Editor/ui/code-line-element.tsx +10 -0
  164. package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +21 -0
  165. package/src/modules/search/components/Editor/ui/column-element.tsx +30 -0
  166. package/src/modules/search/components/Editor/ui/column-group-element.tsx +94 -0
  167. package/src/modules/search/components/Editor/ui/command.tsx +75 -0
  168. package/src/modules/search/components/Editor/ui/comment-avatar.tsx +22 -0
  169. package/src/modules/search/components/Editor/ui/comment-create-form.tsx +37 -0
  170. package/src/modules/search/components/Editor/ui/comment-item.tsx +74 -0
  171. package/src/modules/search/components/Editor/ui/comment-leaf.tsx +49 -0
  172. package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +42 -0
  173. package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +22 -0
  174. package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +32 -0
  175. package/src/modules/search/components/Editor/ui/comment-value.tsx +34 -0
  176. package/src/modules/search/components/Editor/ui/comments-popover.tsx +63 -0
  177. package/src/modules/search/components/Editor/ui/date-element.tsx +83 -0
  178. package/src/modules/search/components/Editor/ui/dialog.tsx +63 -0
  179. package/src/modules/search/components/Editor/ui/draggable.tsx +177 -0
  180. package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +180 -0
  181. package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +85 -0
  182. package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +28 -0
  183. package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +76 -0
  184. package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +8 -0
  185. package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +51 -0
  186. package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +77 -0
  187. package/src/modules/search/components/Editor/ui/heading-element.tsx +48 -0
  188. package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +17 -0
  189. package/src/modules/search/components/Editor/ui/hr-element.tsx +30 -0
  190. package/src/modules/search/components/Editor/ui/icons.tsx +267 -0
  191. package/src/modules/search/components/Editor/ui/image-element.tsx +74 -0
  192. package/src/modules/search/components/Editor/ui/inline-combobox.tsx +368 -0
  193. package/src/modules/search/components/Editor/ui/input.tsx +25 -0
  194. package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +218 -0
  195. package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +20 -0
  196. package/src/modules/search/components/Editor/ui/link-element.tsx +29 -0
  197. package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +161 -0
  198. package/src/modules/search/components/Editor/ui/list-element.tsx +30 -0
  199. package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +24 -0
  200. package/src/modules/search/components/Editor/ui/media-embed-element.tsx +133 -0
  201. package/src/modules/search/components/Editor/ui/media-popover.tsx +97 -0
  202. package/src/modules/search/components/Editor/ui/mention-element.tsx +43 -0
  203. package/src/modules/search/components/Editor/ui/mention-input-element.tsx +141 -0
  204. package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +93 -0
  205. package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +67 -0
  206. package/src/modules/search/components/Editor/ui/paragraph-element.tsx +4 -0
  207. package/src/modules/search/components/Editor/ui/placeholder.tsx +52 -0
  208. package/src/modules/search/components/Editor/ui/popover.tsx +32 -0
  209. package/src/modules/search/components/Editor/ui/resizable.tsx +66 -0
  210. package/src/modules/search/components/Editor/ui/separator.tsx +25 -0
  211. package/src/modules/search/components/Editor/ui/style.less +12 -0
  212. package/src/modules/search/components/Editor/ui/table-cell-element.tsx +143 -0
  213. package/src/modules/search/components/Editor/ui/table-element.tsx +243 -0
  214. package/src/modules/search/components/Editor/ui/table-row-element.tsx +22 -0
  215. package/src/modules/search/components/Editor/ui/tableValue.tsx +135 -0
  216. package/src/modules/search/components/Editor/ui/todo-list-element.tsx +43 -0
  217. package/src/modules/search/components/Editor/ui/toggle-element.tsx +31 -0
  218. package/src/modules/search/components/Editor/ui/toolbar.tsx +157 -0
  219. package/src/modules/search/components/Editor/ui/tooltip.tsx +65 -0
  220. package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +160 -0
  221. package/src/modules/search/components/Editor/ui/with-draggables.tsx +175 -0
  222. package/src/modules/search/components/FileList.tsx +287 -0
  223. package/src/modules/search/components/ImageGroupView/index.tsx +85 -0
  224. package/src/modules/search/components/ResultContent.tsx +232 -0
  225. package/src/modules/search/components/SearchInput.tsx +232 -0
  226. package/src/modules/search/components/SearchLanding.tsx +74 -0
  227. package/src/modules/search/components/SearchView.tsx +563 -0
  228. package/src/modules/search/components/SimpleEditor.tsx +158 -0
  229. package/src/modules/search/components/SimpleFileList.tsx +215 -0
  230. package/src/modules/search/index.tsx +10 -0
  231. package/src/modules/search/reademe.md +1 -0
  232. package/src/modules/search/servers/apis.tsx +19 -0
  233. package/src/modules/search/servers/index.ts +184 -0
  234. package/src/modules/search/style.less +503 -0
  235. package/src/modules/search/type.ts +22 -0
  236. package/src/modules/search/utils.ts +34 -0
  237. package/src/modules/sensitive/index.tsx +313 -0
  238. package/src/modules/sensitive/server.ts +122 -0
  239. package/src/modules/streamFilesReader/GientechStreamReader.tsx +1555 -0
  240. package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
  241. package/src/modules/streamFilesReader/components/Header/index.tsx +297 -0
  242. package/src/modules/streamFilesReader/index.tsx +3 -0
  243. package/src/style.css +6 -0
  244. package/src/type.d.ts +0 -0
  245. package/src/utils/commonFn.tsx +111 -0
  246. package/src/utils/gientechCommon/components/AppError.tsx +32 -0
  247. package/src/utils/gientechCommon/components/AppLoading.tsx +75 -0
  248. package/src/utils/gientechCommon/components/DeleteModal.tsx +75 -0
  249. package/src/utils/gientechCommon/components/DisplayError.tsx +33 -0
  250. package/src/utils/gientechCommon/components/DisplayLoading.tsx +38 -0
  251. package/src/utils/gientechCommon/components/FeedBackModal.tsx +310 -0
  252. package/src/utils/gientechCommon/components/FileCardCommon.tsx +82 -0
  253. package/src/utils/gientechCommon/components/FileManager/index.tsx +390 -0
  254. package/src/utils/gientechCommon/components/FileManager/style.css +5 -0
  255. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +296 -0
  256. package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +339 -0
  257. package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +245 -0
  258. package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +209 -0
  259. package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
  260. package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +148 -0
  261. package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +14 -0
  262. package/src/utils/gientechCommon/components/RenameModal.tsx +86 -0
  263. package/src/utils/gientechCommon/components/style.less +11 -0
  264. package/src/utils/gientechCommon/configs/commonConfig.ts +2 -0
  265. package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
  266. package/src/utils/gientechCommon/configs/stylesConfig.ts +142 -0
  267. package/src/utils/gientechCommon/hooks/AichatUseController.tsx +339 -0
  268. package/src/utils/gientechCommon/slate/converters/deserializers.ts +763 -0
  269. package/src/utils/gientechCommon/slate/converters/mockData.ts +232 -0
  270. package/src/utils/gientechCommon/slate/converters/slateConverters.ts +258 -0
  271. package/src/utils/gientechCommon/slate/richElements/index.tsx +499 -0
  272. package/src/utils/gientechCommon/utils/request.ts +37 -0
  273. package/src/utils/gientechCommon/utils/serverFn.ts +172 -0
  274. package/src/utils/index.tsx +126 -0
  275. package/src/utils/testconfigs/demologin/index.tsx +32 -0
  276. package/src/utils/testconfigs/index.ts +53 -0
  277. package/src/vite-env.d.ts +11 -0
  278. package/stats.html +4949 -0
  279. package/tailwind.config.js +170 -0
  280. package/tsconfig.app.json +30 -0
  281. package/tsconfig.app.tsbuildinfo +11 -0
  282. package/tsconfig.json +13 -0
  283. package/tsconfig.node.json +22 -0
  284. package/tsconfig.node.tsbuildinfo +1 -0
  285. package/vite.config.ts +178 -0
  286. package/workflows/release.yml +60 -0
  287. package/assets/index--DG-fVvc.js +0 -26
  288. package/assets/index-BfureYPx.js +0 -1505
  289. package/assets/index-CXwV5fAx.js +0 -1230
  290. package/assets/style.css +0 -1
  291. package/assets/style3.css +0 -1
  292. package/chat.js +0 -893
  293. package/database.js +0 -20
  294. package/databaseId.js +0 -21
  295. package/modelManage.js +0 -1
  296. package/sensitive.js +0 -1
  297. /package/{assets → dist/assets}/Doris.png +0 -0
  298. /package/{assets → dist/assets}/PostgreSQL.png +0 -0
  299. /package/{assets → dist/assets}/SQLServer.png +0 -0
  300. /package/{assets → dist/assets}/_commonjsHelpers-gnU0ypJ3.js +0 -0
  301. /package/{assets → dist/assets}/empty.png +0 -0
  302. /package/{assets → dist/assets}/index-CpW6Dhpp.js +0 -0
  303. /package/{assets → dist/assets}/style2.css +0 -0
  304. /package/{assets → dist/assets}/styled-components.browser.esm-DPkS13KC.js +0 -0
  305. /package/{chat.d.ts → dist/chat.d.ts} +0 -0
  306. /package/{database.d.ts → dist/database.d.ts} +0 -0
  307. /package/{databaseId.d.ts → dist/databaseId.d.ts} +0 -0
  308. /package/{databaseTable.d.ts → dist/databaseTable.d.ts} +0 -0
  309. /package/{modelManage.d.ts → dist/modelManage.d.ts} +0 -0
  310. /package/{sensitive.d.ts → dist/sensitive.d.ts} +0 -0
  311. /package/{streamFilesReader.d.ts → dist/streamFilesReader.d.ts} +0 -0
  312. /package/{vite.svg → dist/vite.svg} +0 -0
@@ -1,4 +1,4 @@
1
- var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in p?Vn(p,o,{enumerable:!0,configurable:!0,writable:!0,value:y}):p[o]=y;var se=(p,o,y)=>Yn(p,typeof o!="symbol"?o+"":o,y),ln=(p,o,y)=>o.has(p)||wn("Cannot "+y);var R=(p,o,y)=>(ln(p,o,"read from private field"),y?y.call(p):o.get(p)),Lt=(p,o,y)=>o.has(p)?wn("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(p):o.set(p,y),Bt=(p,o,y,f)=>(ln(p,o,"write to private field"),f?f.call(p,y):o.set(p,y),y),Mt=(p,o,y)=>(ln(p,o,"access private method"),y);var un=(p,o,y,f)=>({set _(_){Bt(p,o,_,y)},get _(){return R(p,o,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import m__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{d as dt$1}from"./assets/styled-components.browser.esm-DPkS13KC.js";import axios from"axios";import{a as getAugmentedNamespace}from"./assets/_commonjsHelpers-gnU0ypJ3.js";import{I as IL,x as xc}from"./assets/index-CXwV5fAx.js";import{c as createLucideIcon,C as ChevronRight}from"./assets/index--DG-fVvc.js";import{X}from"./assets/x-tMUaBf0a.js";import"react-dom";/**
1
+ var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in p?Vn(p,o,{enumerable:!0,configurable:!0,writable:!0,value:y}):p[o]=y;var se=(p,o,y)=>Yn(p,typeof o!="symbol"?o+"":o,y),ln=(p,o,y)=>o.has(p)||wn("Cannot "+y);var R=(p,o,y)=>(ln(p,o,"read from private field"),y?y.call(p):o.get(p)),Lt=(p,o,y)=>o.has(p)?wn("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(p):o.set(p,y),Bt=(p,o,y,f)=>(ln(p,o,"write to private field"),f?f.call(p,y):o.set(p,y),y),Mt=(p,o,y)=>(ln(p,o,"access private method"),y);var un=(p,o,y,f)=>({set _(_){Bt(p,o,_,y)},get _(){return R(p,o,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import c__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{d as dt$1}from"./assets/styled-components.browser.esm-DPkS13KC.js";import axios from"axios";import{a as getAugmentedNamespace}from"./assets/_commonjsHelpers-gnU0ypJ3.js";import{I as IL,x as xc}from"./assets/index-97TKgPKE.js";import{c as createLucideIcon,C as ChevronRight}from"./assets/index-CEK88UzR.js";import{X}from"./assets/x-vPcWt3fC.js";import"react-dom";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -39,7 +39,7 @@ var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in
39
39
  `)}return this.compiledGlyphs[b]=new Function("c","size",T.join(""))}return this.compiledGlyphs[b]=function(T,S){for(const v of w)v.cmd==="scale"&&(v.args=[S,-S]),T[v.cmd].apply(T,v.args)}}}o.FontFaceObject=W}),((p,o,y)=>{var _t,fn;Object.defineProperty(o,"__esModule",{value:!0}),o.CanvasGraphics=void 0;var f=y(8),_=y(1),Y=y(13),W=y(14),K=y(3);const M=16,b=100,w=4096,T=15,S=10,v=K.isNodeJS&&typeof Path2D>"u"?-1:1e3,c=16;function t(q,d){if(q._removeMirroring)throw new Error("Context is already forwarding operations.");q.__originalSave=q.save,q.__originalRestore=q.restore,q.__originalRotate=q.rotate,q.__originalScale=q.scale,q.__originalTranslate=q.translate,q.__originalTransform=q.transform,q.__originalSetTransform=q.setTransform,q.__originalResetTransform=q.resetTransform,q.__originalClip=q.clip,q.__originalMoveTo=q.moveTo,q.__originalLineTo=q.lineTo,q.__originalBezierCurveTo=q.bezierCurveTo,q.__originalRect=q.rect,q.__originalClosePath=q.closePath,q.__originalBeginPath=q.beginPath,q._removeMirroring=()=>{q.save=q.__originalSave,q.restore=q.__originalRestore,q.rotate=q.__originalRotate,q.scale=q.__originalScale,q.translate=q.__originalTranslate,q.transform=q.__originalTransform,q.setTransform=q.__originalSetTransform,q.resetTransform=q.__originalResetTransform,q.clip=q.__originalClip,q.moveTo=q.__originalMoveTo,q.lineTo=q.__originalLineTo,q.bezierCurveTo=q.__originalBezierCurveTo,q.rect=q.__originalRect,q.closePath=q.__originalClosePath,q.beginPath=q.__originalBeginPath,delete q._removeMirroring},q.save=function(){d.save(),this.__originalSave()},q.restore=function(){d.restore(),this.__originalRestore()},q.translate=function(P,j){d.translate(P,j),this.__originalTranslate(P,j)},q.scale=function(P,j){d.scale(P,j),this.__originalScale(P,j)},q.transform=function(P,j,U,$,s,h){d.transform(P,j,U,$,s,h),this.__originalTransform(P,j,U,$,s,h)},q.setTransform=function(P,j,U,$,s,h){d.setTransform(P,j,U,$,s,h),this.__originalSetTransform(P,j,U,$,s,h)},q.resetTransform=function(){d.resetTransform(),this.__originalResetTransform()},q.rotate=function(P){d.rotate(P),this.__originalRotate(P)},q.clip=function(P){d.clip(P),this.__originalClip(P)},q.moveTo=function(u,P){d.moveTo(u,P),this.__originalMoveTo(u,P)},q.lineTo=function(u,P){d.lineTo(u,P),this.__originalLineTo(u,P)},q.bezierCurveTo=function(u,P,j,U,$,s){d.bezierCurveTo(u,P,j,U,$,s),this.__originalBezierCurveTo(u,P,j,U,$,s)},q.rect=function(u,P,j,U){d.rect(u,P,j,U),this.__originalRect(u,P,j,U)},q.closePath=function(){d.closePath(),this.__originalClosePath()},q.beginPath=function(){d.beginPath(),this.__originalBeginPath()}}class r{constructor(d){this.canvasFactory=d,this.cache=Object.create(null)}getCanvas(d,u,P){let j;return this.cache[d]!==void 0?(j=this.cache[d],this.canvasFactory.reset(j,u,P)):(j=this.canvasFactory.create(u,P),this.cache[d]=j),j}delete(d){delete this.cache[d]}clear(){for(const d in this.cache){const u=this.cache[d];this.canvasFactory.destroy(u),delete this.cache[d]}}}function a(q,d,u,P,j,U,$,s,h,C){const[A,k,B,D,g,L]=(0,f.getCurrentTransform)(q);if(k===0&&B===0){const Q=$*A+g,vt=Math.round(Q),Tt=s*D+L,It=Math.round(Tt),kt=($+h)*A+g,Ht=Math.abs(Math.round(kt)-vt)||1,Wt=(s+C)*D+L,jt=Math.abs(Math.round(Wt)-It)||1;return q.setTransform(Math.sign(A),0,0,Math.sign(D),vt,It),q.drawImage(d,u,P,j,U,0,0,Ht,jt),q.setTransform(A,k,B,D,g,L),[Ht,jt]}if(A===0&&D===0){const Q=s*B+g,vt=Math.round(Q),Tt=$*k+L,It=Math.round(Tt),kt=(s+C)*B+g,Ht=Math.abs(Math.round(kt)-vt)||1,Wt=($+h)*k+L,jt=Math.abs(Math.round(Wt)-It)||1;return q.setTransform(0,Math.sign(k),Math.sign(B),0,vt,It),q.drawImage(d,u,P,j,U,0,0,jt,Ht),q.setTransform(A,k,B,D,g,L),[jt,Ht]}q.drawImage(d,u,P,j,U,$,s,h,C);const At=Math.hypot(A,k),H=Math.hypot(B,D);return[At*h,H*C]}function F(q){const{width:d,height:u}=q;if(d>v||u>v)return null;const P=1e3,j=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),U=d+1;let $=new Uint8Array(U*(u+1)),s,h,C;const A=d+7&-8;let k=new Uint8Array(A*u),B=0;for(const H of q.data){let Q=128;for(;Q>0;)k[B++]=H&Q?0:255,Q>>=1}let D=0;for(B=0,k[B]!==0&&($[0]=1,++D),h=1;h<d;h++)k[B]!==k[B+1]&&($[h]=k[B]?2:1,++D),B++;for(k[B]!==0&&($[h]=2,++D),s=1;s<u;s++){B=s*A,C=s*U,k[B-A]!==k[B]&&($[C]=k[B]?1:8,++D);let H=(k[B]?4:0)+(k[B-A]?8:0);for(h=1;h<d;h++)H=(H>>2)+(k[B+1]?4:0)+(k[B-A+1]?8:0),j[H]&&($[C+h]=j[H],++D),B++;if(k[B-A]!==k[B]&&($[C+h]=k[B]?2:4,++D),D>P)return null}for(B=A*(u-1),C=s*U,k[B]!==0&&($[C]=8,++D),h=1;h<d;h++)k[B]!==k[B+1]&&($[C+h]=k[B]?4:8,++D),B++;if(k[B]!==0&&($[C+h]=4,++D),D>P)return null;const g=new Int32Array([0,U,-1,0,-U,0,0,0,1]),L=new Path2D;for(s=0;D&&s<=u;s++){let H=s*U;const Q=H+d;for(;H<Q&&!$[H];)H++;if(H===Q)continue;L.moveTo(H%U,s);const vt=H;let Tt=$[H];do{const It=g[Tt];do H+=It;while(!$[H]);const kt=$[H];kt!==5&&kt!==10?(Tt=kt,$[H]=0):(Tt=kt&51*Tt>>4,$[H]&=Tt>>2|Tt<<2),L.lineTo(H%U,H/U|0),$[H]||--D}while(vt!==H);--s}return k=null,$=null,function(H){H.save(),H.scale(1/d,-1/u),H.translate(0,-u),H.fill(L),H.beginPath(),H.restore()}}class m{constructor(d,u){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=_.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=_.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=_.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps=null,this.startNewPathAndClipBox([0,0,d,u])}clone(){const d=Object.create(this);return d.clipBox=this.clipBox.slice(),d}setCurrentPoint(d,u){this.x=d,this.y=u}updatePathMinMax(d,u,P){[u,P]=_.Util.applyTransform([u,P],d),this.minX=Math.min(this.minX,u),this.minY=Math.min(this.minY,P),this.maxX=Math.max(this.maxX,u),this.maxY=Math.max(this.maxY,P)}updateRectMinMax(d,u){const P=_.Util.applyTransform(u,d),j=_.Util.applyTransform(u.slice(2),d);this.minX=Math.min(this.minX,P[0],j[0]),this.minY=Math.min(this.minY,P[1],j[1]),this.maxX=Math.max(this.maxX,P[0],j[0]),this.maxY=Math.max(this.maxY,P[1],j[1])}updateScalingPathMinMax(d,u){_.Util.scaleMinMax(d,u),this.minX=Math.min(this.minX,u[0]),this.maxX=Math.max(this.maxX,u[1]),this.minY=Math.min(this.minY,u[2]),this.maxY=Math.max(this.maxY,u[3])}updateCurvePathMinMax(d,u,P,j,U,$,s,h,C,A){const k=_.Util.bezierBoundingBox(u,P,j,U,$,s,h,C);if(A){A[0]=Math.min(A[0],k[0],k[2]),A[1]=Math.max(A[1],k[0],k[2]),A[2]=Math.min(A[2],k[1],k[3]),A[3]=Math.max(A[3],k[1],k[3]);return}this.updateRectMinMax(d,k)}getPathBoundingBox(d=Y.PathType.FILL,u=null){const P=[this.minX,this.minY,this.maxX,this.maxY];if(d===Y.PathType.STROKE){u||(0,_.unreachable)("Stroke bounding box must include transform.");const j=_.Util.singularValueDecompose2dScale(u),U=j[0]*this.lineWidth/2,$=j[1]*this.lineWidth/2;P[0]-=U,P[1]-=$,P[2]+=U,P[3]+=$}return P}updateClipFromPath(){const d=_.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(d||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(d){this.clipBox=d,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(d=Y.PathType.FILL,u=null){return _.Util.intersect(this.clipBox,this.getPathBoundingBox(d,u))}}function l(q,d,u=null){if(typeof ImageData<"u"&&d instanceof ImageData){q.putImageData(d,0,0);return}const P=d.height,j=d.width,U=P%c,$=(P-U)/c,s=U===0?$:$+1,h=q.createImageData(j,c);let C=0,A;const k=d.data,B=h.data;let D,g,L,At,H,Q,vt,Tt;if(u)switch(u.length){case 1:H=u[0],Q=u[0],vt=u[0],Tt=u[0];break;case 4:H=u[0],Q=u[1],vt=u[2],Tt=u[3];break}if(d.kind===_.ImageKind.GRAYSCALE_1BPP){const It=k.byteLength,kt=new Uint32Array(B.buffer,0,B.byteLength>>2),Ht=kt.length,Wt=j+7>>3;let jt=4294967295,Xt=_.FeatureTest.isLittleEndian?4278190080:255;for(Tt&&Tt[0]===255&&Tt[255]===0&&([jt,Xt]=[Xt,jt]),D=0;D<s;D++){for(L=D<$?c:U,A=0,g=0;g<L;g++){const Vt=It-C;let te=0;const Gt=Vt>Wt?j:Vt*8-7,Yt=Gt&-8;let Kt=0,Qt=0;for(;te<Yt;te+=8)Qt=k[C++],kt[A++]=Qt&128?jt:Xt,kt[A++]=Qt&64?jt:Xt,kt[A++]=Qt&32?jt:Xt,kt[A++]=Qt&16?jt:Xt,kt[A++]=Qt&8?jt:Xt,kt[A++]=Qt&4?jt:Xt,kt[A++]=Qt&2?jt:Xt,kt[A++]=Qt&1?jt:Xt;for(;te<Gt;te++)Kt===0&&(Qt=k[C++],Kt=128),kt[A++]=Qt&Kt?jt:Xt,Kt>>=1}for(;A<Ht;)kt[A++]=0;q.putImageData(h,0,D*c)}}else if(d.kind===_.ImageKind.RGBA_32BPP){const It=!!(H||Q||vt);for(g=0,At=j*c*4,D=0;D<$;D++){if(B.set(k.subarray(C,C+At)),C+=At,It)for(let kt=0;kt<At;kt+=4)H&&(B[kt+0]=H[B[kt+0]]),Q&&(B[kt+1]=Q[B[kt+1]]),vt&&(B[kt+2]=vt[B[kt+2]]);q.putImageData(h,0,g),g+=c}if(D<s){if(At=j*U*4,B.set(k.subarray(C,C+At)),It)for(let kt=0;kt<At;kt+=4)H&&(B[kt+0]=H[B[kt+0]]),Q&&(B[kt+1]=Q[B[kt+1]]),vt&&(B[kt+2]=vt[B[kt+2]]);q.putImageData(h,0,g)}}else if(d.kind===_.ImageKind.RGB_24BPP){const It=!!(H||Q||vt);for(L=c,At=j*L,D=0;D<s;D++){for(D>=$&&(L=U,At=j*L),A=0,g=At;g--;)B[A++]=k[C++],B[A++]=k[C++],B[A++]=k[C++],B[A++]=255;if(It)for(let kt=0;kt<A;kt+=4)H&&(B[kt+0]=H[B[kt+0]]),Q&&(B[kt+1]=Q[B[kt+1]]),vt&&(B[kt+2]=vt[B[kt+2]]);q.putImageData(h,0,D*c)}}else throw new Error(`bad image kind: ${d.kind}`)}function n(q,d){if(d.bitmap){q.drawImage(d.bitmap,0,0);return}const u=d.height,P=d.width,j=u%c,U=(u-j)/c,$=j===0?U:U+1,s=q.createImageData(P,c);let h=0;const C=d.data,A=s.data;for(let k=0;k<$;k++){const B=k<U?c:j;({srcPos:h}=(0,W.applyMaskImageData)({src:C,srcPos:h,dest:A,width:P,height:B})),q.putImageData(s,0,k*c)}}function i(q,d){const u=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let P=0,j=u.length;P<j;P++){const U=u[P];q[U]!==void 0&&(d[U]=q[U])}q.setLineDash!==void 0&&(d.setLineDash(q.getLineDash()),d.lineDashOffset=q.lineDashOffset)}function e(q,d){q.strokeStyle=q.fillStyle=d||"#000000",q.fillRule="nonzero",q.globalAlpha=1,q.lineWidth=1,q.lineCap="butt",q.lineJoin="miter",q.miterLimit=10,q.globalCompositeOperation="source-over",q.font="10px sans-serif",q.setLineDash!==void 0&&(q.setLineDash([]),q.lineDashOffset=0)}function E(q,d,u,P){const j=q.length;for(let U=3;U<j;U+=4){const $=q[U];if($===0)q[U-3]=d,q[U-2]=u,q[U-1]=P;else if($<255){const s=255-$;q[U-3]=q[U-3]*$+d*s>>8,q[U-2]=q[U-2]*$+u*s>>8,q[U-1]=q[U-1]*$+P*s>>8}}}function x(q,d,u){const P=q.length,j=1/255;for(let U=3;U<P;U+=4){const $=u?u[q[U]]:q[U];d[U]=d[U]*$*j|0}}function N(q,d,u){const P=q.length;for(let j=3;j<P;j+=4){const U=q[j-3]*77+q[j-2]*152+q[j-1]*28;d[j]=u?d[j]*u[U>>8]>>8:d[j]*U>>16}}function I(q,d,u,P,j,U,$,s,h,C,A){const k=!!U,B=k?U[0]:0,D=k?U[1]:0,g=k?U[2]:0;let L;j==="Luminosity"?L=N:L=x;const H=Math.min(P,Math.ceil(1048576/u));for(let Q=0;Q<P;Q+=H){const vt=Math.min(H,P-Q),Tt=q.getImageData(s-C,Q+(h-A),u,vt),It=d.getImageData(s,Q+h,u,vt);k&&E(Tt.data,B,D,g),L(Tt.data,It.data,$),d.putImageData(It,s,Q+h)}}function St(q,d,u,P){const j=P[0],U=P[1],$=P[2]-j,s=P[3]-U;$===0||s===0||(I(d.context,u,$,s,d.subtype,d.backdrop,d.transferMap,j,U,d.offsetX,d.offsetY),q.save(),q.globalAlpha=1,q.globalCompositeOperation="source-over",q.setTransform(1,0,0,1,0,0),q.drawImage(u.canvas,0,0),q.restore())}function Pt(q,d){const u=_.Util.singularValueDecompose2dScale(q);u[0]=Math.fround(u[0]),u[1]=Math.fround(u[1]);const P=Math.fround((globalThis.devicePixelRatio||1)*f.PixelsPerInch.PDF_TO_CSS_UNITS);return d!==void 0?d:u[0]<=P||u[1]<=P}const bt=["butt","round","square"],V=["miter","round","bevel"],O={},z={},Ot=class Ot{constructor(d,u,P,j,U,$,s,h){Lt(this,_t);this.ctx=d,this.current=new m(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=u,this.objs=P,this.canvasFactory=j,this.imageLayer=U,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=[],this.optionalContentConfig=$,this.cachedCanvases=new r(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=(h==null?void 0:h.background)||null,this.foregroundColor=(h==null?void 0:h.foreground)||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(d,u=null){return typeof d=="string"?d.startsWith("g_")?this.commonObjs.get(d):this.objs.get(d):u}beginDrawing({transform:d,viewport:u,transparency:P=!1,background:j=null}){const U=this.ctx.canvas.width,$=this.ctx.canvas.height,s=j||"#ffffff";if(this.ctx.save(),this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;const h=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;const C=this.backgroundColor=this.ctx.fillStyle;let A=!0,k=s;if(this.ctx.fillStyle=s,k=this.ctx.fillStyle,A=typeof k=="string"&&/^#[0-9A-Fa-f]{6}$/.test(k),h==="#000000"&&C==="#ffffff"||h===C||!A)this.foregroundColor=this.backgroundColor=null;else{const[B,D,g]=(0,f.getRGB)(k),L=H=>(H/=255,H<=.03928?H/12.92:((H+.055)/1.055)**2.4),At=Math.round(.2126*L(B)+.7152*L(D)+.0722*L(g));this.selectColor=(H,Q,vt)=>{const Tt=.2126*L(H)+.7152*L(Q)+.0722*L(vt);return Math.round(Tt)===At?C:h}}}if(this.ctx.fillStyle=this.backgroundColor||s,this.ctx.fillRect(0,0,U,$),this.ctx.restore(),P){const h=this.cachedCanvases.getCanvas("transparent",U,$);this.compositeCtx=this.ctx,this.transparentCanvas=h.canvas,this.ctx=h.context,this.ctx.save(),this.ctx.transform(...(0,f.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),e(this.ctx,this.foregroundColor),d&&(this.ctx.transform(...d),this.outputScaleX=d[0],this.outputScaleY=d[0]),this.ctx.transform(...u.transform),this.viewportScale=u.scale,this.baseTransform=(0,f.getCurrentTransform)(this.ctx),this.imageLayer&&((0,f.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(d,u,P,j){const U=d.argsArray,$=d.fnArray;let s=u||0;const h=U.length;if(h===s)return s;const C=h-s>S&&typeof P=="function",A=C?Date.now()+T:0;let k=0;const B=this.commonObjs,D=this.objs;let g;for(;;){if(j!==void 0&&s===j.nextBreakPoint)return j.breakIt(s,P),s;if(g=$[s],g!==_.OPS.dependency)this[g].apply(this,U[s]);else for(const L of U[s]){const At=L.startsWith("g_")?B:D;if(!At.has(L))return At.get(L,P),s}if(s++,s===h)return s;if(C&&++k>S){if(Date.now()>A)return P(),s;k=0}}}endDrawing(){Mt(this,_t,fn).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const d of this._cachedBitmapsMap.values()){for(const u of d.values())typeof HTMLCanvasElement<"u"&&u instanceof HTMLCanvasElement&&(u.width=u.height=0);d.clear()}this._cachedBitmapsMap.clear(),this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(d,u){const P=d.width,j=d.height;let U=Math.max(Math.hypot(u[0],u[1]),1),$=Math.max(Math.hypot(u[2],u[3]),1),s=P,h=j,C="prescale1",A,k;for(;U>2&&s>1||$>2&&h>1;){let B=s,D=h;U>2&&s>1&&(B=Math.ceil(s/2),U/=s/B),$>2&&h>1&&(D=Math.ceil(h/2),$/=h/D),A=this.cachedCanvases.getCanvas(C,B,D),k=A.context,k.clearRect(0,0,B,D),k.drawImage(d,0,0,s,h,0,0,B,D),d=A.canvas,s=B,h=D,C=C==="prescale1"?"prescale2":"prescale1"}return{img:d,paintWidth:s,paintHeight:h}}_createMaskCanvas(d){const u=this.ctx,{width:P,height:j}=d,U=this.current.fillColor,$=this.current.patternFill,s=(0,f.getCurrentTransform)(u);let h,C,A,k;if((d.bitmap||d.data)&&d.count>1){const Ht=d.bitmap||d.data.buffer,Wt=s.slice(0,4);C=JSON.stringify($?Wt:[Wt,U]),h=this._cachedBitmapsMap.get(Ht),h||(h=new Map,this._cachedBitmapsMap.set(Ht,h));const jt=h.get(C);if(jt&&!$){const Xt=Math.round(Math.min(s[0],s[2])+s[4]),Vt=Math.round(Math.min(s[1],s[3])+s[5]);return{canvas:jt,offsetX:Xt,offsetY:Vt}}A=jt}A||(k=this.cachedCanvases.getCanvas("maskCanvas",P,j),n(k.context,d));let B=_.Util.transform(s,[1/P,0,0,-1/j,0,0]);B=_.Util.transform(B,[1,0,0,1,0,-j]);const D=_.Util.applyTransform([0,0],B),g=_.Util.applyTransform([P,j],B),L=_.Util.normalizeRect([D[0],D[1],g[0],g[1]]),At=Math.round(L[2]-L[0])||1,H=Math.round(L[3]-L[1])||1,Q=this.cachedCanvases.getCanvas("fillCanvas",At,H),vt=Q.context,Tt=Math.min(D[0],g[0]),It=Math.min(D[1],g[1]);vt.translate(-Tt,-It),vt.transform(...B),A||(A=this._scaleImage(k.canvas,(0,f.getCurrentTransformInverse)(vt)),A=A.img,h&&$&&h.set(C,A)),vt.imageSmoothingEnabled=Pt((0,f.getCurrentTransform)(vt),d.interpolate),a(vt,A,0,0,A.width,A.height,0,0,P,j),vt.globalCompositeOperation="source-in";const kt=_.Util.transform((0,f.getCurrentTransformInverse)(vt),[1,0,0,1,-Tt,-It]);return vt.fillStyle=$?U.getPattern(u,this,kt,Y.PathType.FILL):U,vt.fillRect(0,0,P,j),h&&!$&&(this.cachedCanvases.delete("fillCanvas"),h.set(C,Q.canvas)),{canvas:Q.canvas,offsetX:Math.round(Tt),offsetY:Math.round(It)}}setLineWidth(d){d!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=d,this.ctx.lineWidth=d}setLineCap(d){this.ctx.lineCap=bt[d]}setLineJoin(d){this.ctx.lineJoin=V[d]}setMiterLimit(d){this.ctx.miterLimit=d}setDash(d,u){const P=this.ctx;P.setLineDash!==void 0&&(P.setLineDash(d),P.lineDashOffset=u)}setRenderingIntent(d){}setFlatness(d){}setGState(d){for(let u=0,P=d.length;u<P;u++){const j=d[u],U=j[0],$=j[1];switch(U){case"LW":this.setLineWidth($);break;case"LC":this.setLineCap($);break;case"LJ":this.setLineJoin($);break;case"ML":this.setMiterLimit($);break;case"D":this.setDash($[0],$[1]);break;case"RI":this.setRenderingIntent($);break;case"FL":this.setFlatness($);break;case"Font":this.setFont($[0],$[1]);break;case"CA":this.current.strokeAlpha=j[1];break;case"ca":this.current.fillAlpha=j[1],this.ctx.globalAlpha=j[1];break;case"BM":this.ctx.globalCompositeOperation=$;break;case"SMask":this.current.activeSMask=$?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=$}}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const d=this.inSMaskMode;this.current.activeSMask&&!d?this.beginSMaskMode():!this.current.activeSMask&&d&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const d=this.ctx.canvas.width,u=this.ctx.canvas.height,P="smaskGroupAt"+this.groupLevel,j=this.cachedCanvases.getCanvas(P,d,u);this.suspendedCtx=this.ctx,this.ctx=j.context;const U=this.ctx;U.setTransform(...(0,f.getCurrentTransform)(this.suspendedCtx)),i(this.suspendedCtx,U),t(U,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),i(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(d){if(!this.current.activeSMask)return;d?(d[0]=Math.floor(d[0]),d[1]=Math.floor(d[1]),d[2]=Math.ceil(d[2]),d[3]=Math.ceil(d[3])):d=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const u=this.current.activeSMask,P=this.suspendedCtx;St(P,u,this.ctx,d),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()}save(){this.inSMaskMode?(i(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const d=this.current;this.stateStack.push(d),this.current=d.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),i(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(d,u,P,j,U,$){this.ctx.transform(d,u,P,j,U,$),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(d,u,P){const j=this.ctx,U=this.current;let $=U.x,s=U.y,h,C;const A=(0,f.getCurrentTransform)(j),k=A[0]===0&&A[3]===0||A[1]===0&&A[2]===0,B=k?P.slice(0):null;for(let D=0,g=0,L=d.length;D<L;D++)switch(d[D]|0){case _.OPS.rectangle:$=u[g++],s=u[g++];const At=u[g++],H=u[g++],Q=$+At,vt=s+H;j.moveTo($,s),At===0||H===0?j.lineTo(Q,vt):(j.lineTo(Q,s),j.lineTo(Q,vt),j.lineTo($,vt)),k||U.updateRectMinMax(A,[$,s,Q,vt]),j.closePath();break;case _.OPS.moveTo:$=u[g++],s=u[g++],j.moveTo($,s),k||U.updatePathMinMax(A,$,s);break;case _.OPS.lineTo:$=u[g++],s=u[g++],j.lineTo($,s),k||U.updatePathMinMax(A,$,s);break;case _.OPS.curveTo:h=$,C=s,$=u[g+4],s=u[g+5],j.bezierCurveTo(u[g],u[g+1],u[g+2],u[g+3],$,s),U.updateCurvePathMinMax(A,h,C,u[g],u[g+1],u[g+2],u[g+3],$,s,B),g+=6;break;case _.OPS.curveTo2:h=$,C=s,j.bezierCurveTo($,s,u[g],u[g+1],u[g+2],u[g+3]),U.updateCurvePathMinMax(A,h,C,$,s,u[g],u[g+1],u[g+2],u[g+3],B),$=u[g+2],s=u[g+3],g+=4;break;case _.OPS.curveTo3:h=$,C=s,$=u[g+2],s=u[g+3],j.bezierCurveTo(u[g],u[g+1],$,s,$,s),U.updateCurvePathMinMax(A,h,C,u[g],u[g+1],$,s,$,s,B),g+=4;break;case _.OPS.closePath:j.closePath();break}k&&U.updateScalingPathMinMax(A,B),U.setCurrentPoint($,s)}closePath(){this.ctx.closePath()}stroke(d){d=typeof d<"u"?d:!0;const u=this.ctx,P=this.current.strokeColor;u.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof P=="object"&&(P!=null&&P.getPattern)?(u.save(),u.strokeStyle=P.getPattern(u,this,(0,f.getCurrentTransformInverse)(u),Y.PathType.STROKE),this.rescaleAndStroke(!1),u.restore()):this.rescaleAndStroke(!0)),d&&this.consumePath(this.current.getClippedPathBoundingBox()),u.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(d){d=typeof d<"u"?d:!0;const u=this.ctx,P=this.current.fillColor,j=this.current.patternFill;let U=!1;j&&(u.save(),u.fillStyle=P.getPattern(u,this,(0,f.getCurrentTransformInverse)(u),Y.PathType.FILL),U=!0);const $=this.current.getClippedPathBoundingBox();this.contentVisible&&$!==null&&(this.pendingEOFill?(u.fill("evenodd"),this.pendingEOFill=!1):u.fill()),U&&u.restore(),d&&this.consumePath($)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=O}eoClip(){this.pendingClip=z}beginText(){this.current.textMatrix=_.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const d=this.pendingTextPaths,u=this.ctx;if(d===void 0){u.beginPath();return}u.save(),u.beginPath();for(const P of d)u.setTransform(...P.transform),u.translate(P.x,P.y),P.addToPath(u,P.fontSize);u.restore(),u.clip(),u.beginPath(),delete this.pendingTextPaths}setCharSpacing(d){this.current.charSpacing=d}setWordSpacing(d){this.current.wordSpacing=d}setHScale(d){this.current.textHScale=d/100}setLeading(d){this.current.leading=-d}setFont(d,u){const P=this.commonObjs.get(d),j=this.current;if(!P)throw new Error(`Can't find font for ${d}`);if(j.fontMatrix=P.fontMatrix||_.FONT_IDENTITY_MATRIX,(j.fontMatrix[0]===0||j.fontMatrix[3]===0)&&(0,_.warn)("Invalid font matrix for font "+d),u<0?(u=-u,j.fontDirection=-1):j.fontDirection=1,this.current.font=P,this.current.fontSize=u,P.isType3Font)return;const U=P.loadedName||"sans-serif";let $="normal";P.black?$="900":P.bold&&($="bold");const s=P.italic?"italic":"normal",h=`"${U}", ${P.fallbackName}`;let C=u;u<M?C=M:u>b&&(C=b),this.current.fontSizeScale=u/C,this.ctx.font=`${s} ${$} ${C}px ${h}`}setTextRenderingMode(d){this.current.textRenderingMode=d}setTextRise(d){this.current.textRise=d}moveText(d,u){this.current.x=this.current.lineX+=d,this.current.y=this.current.lineY+=u}setLeadingMoveText(d,u){this.setLeading(-u),this.moveText(d,u)}setTextMatrix(d,u,P,j,U,$){this.current.textMatrix=[d,u,P,j,U,$],this.current.textMatrixScale=Math.hypot(d,u),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(d,u,P,j){const U=this.ctx,$=this.current,s=$.font,h=$.textRenderingMode,C=$.fontSize/$.fontSizeScale,A=h&_.TextRenderingMode.FILL_STROKE_MASK,k=!!(h&_.TextRenderingMode.ADD_TO_PATH_FLAG),B=$.patternFill&&!s.missingFile;let D;(s.disableFontFace||k||B)&&(D=s.getPathGenerator(this.commonObjs,d)),s.disableFontFace||B?(U.save(),U.translate(u,P),U.beginPath(),D(U,C),j&&U.setTransform(...j),(A===_.TextRenderingMode.FILL||A===_.TextRenderingMode.FILL_STROKE)&&U.fill(),(A===_.TextRenderingMode.STROKE||A===_.TextRenderingMode.FILL_STROKE)&&U.stroke(),U.restore()):((A===_.TextRenderingMode.FILL||A===_.TextRenderingMode.FILL_STROKE)&&U.fillText(d,u,P),(A===_.TextRenderingMode.STROKE||A===_.TextRenderingMode.FILL_STROKE)&&U.strokeText(d,u,P)),k&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,f.getCurrentTransform)(U),x:u,y:P,fontSize:C,addToPath:D})}get isFontSubpixelAAEnabled(){const{context:d}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);d.scale(1.5,1),d.fillText("I",0,10);const u=d.getImageData(0,0,10,10).data;let P=!1;for(let j=3;j<u.length;j+=4)if(u[j]>0&&u[j]<255){P=!0;break}return(0,_.shadow)(this,"isFontSubpixelAAEnabled",P)}showText(d){const u=this.current,P=u.font;if(P.isType3Font)return this.showType3Text(d);const j=u.fontSize;if(j===0)return;const U=this.ctx,$=u.fontSizeScale,s=u.charSpacing,h=u.wordSpacing,C=u.fontDirection,A=u.textHScale*C,k=d.length,B=P.vertical,D=B?1:-1,g=P.defaultVMetrics,L=j*u.fontMatrix[0],At=u.textRenderingMode===_.TextRenderingMode.FILL&&!P.disableFontFace&&!u.patternFill;U.save(),U.transform(...u.textMatrix),U.translate(u.x,u.y+u.textRise),C>0?U.scale(A,-1):U.scale(A,1);let H;if(u.patternFill){U.save();const kt=u.fillColor.getPattern(U,this,(0,f.getCurrentTransformInverse)(U),Y.PathType.FILL);H=(0,f.getCurrentTransform)(U),U.restore(),U.fillStyle=kt}let Q=u.lineWidth;const vt=u.textMatrixScale;if(vt===0||Q===0){const kt=u.textRenderingMode&_.TextRenderingMode.FILL_STROKE_MASK;(kt===_.TextRenderingMode.STROKE||kt===_.TextRenderingMode.FILL_STROKE)&&(Q=this.getSinglePixelWidth())}else Q/=vt;$!==1&&(U.scale($,$),Q/=$),U.lineWidth=Q;let Tt=0,It;for(It=0;It<k;++It){const kt=d[It];if(typeof kt=="number"){Tt+=D*kt*j/1e3;continue}let Ht=!1;const Wt=(kt.isSpace?h:0)+s,jt=kt.fontChar,Xt=kt.accent;let Vt,te,Gt=kt.width;if(B){const Kt=kt.vmetric||g,Qt=-(kt.vmetric?Kt[1]:Gt*.5)*L,le=Kt[2]*L;Gt=Kt?-Kt[0]:Gt,Vt=Qt/$,te=(Tt+le)/$}else Vt=Tt/$,te=0;if(P.remeasure&&Gt>0){const Kt=U.measureText(jt).width*1e3/j*$;if(Gt<Kt&&this.isFontSubpixelAAEnabled){const Qt=Gt/Kt;Ht=!0,U.save(),U.scale(Qt,1),Vt/=Qt}else Gt!==Kt&&(Vt+=(Gt-Kt)/2e3*j/$)}if(this.contentVisible&&(kt.isInFont||P.missingFile)){if(At&&!Xt)U.fillText(jt,Vt,te);else if(this.paintChar(jt,Vt,te,H),Xt){const Kt=Vt+j*Xt.offset.x/$,Qt=te-j*Xt.offset.y/$;this.paintChar(Xt.fontChar,Kt,Qt,H)}}let Yt;B?Yt=Gt*L-Wt*C:Yt=Gt*L+Wt*C,Tt+=Yt,Ht&&U.restore()}B?u.y-=Tt:u.x+=Tt*A,U.restore(),this.compose()}showType3Text(d){const u=this.ctx,P=this.current,j=P.font,U=P.fontSize,$=P.fontDirection,s=j.vertical?1:-1,h=P.charSpacing,C=P.wordSpacing,A=P.textHScale*$,k=P.fontMatrix||_.FONT_IDENTITY_MATRIX,B=d.length,D=P.textRenderingMode===_.TextRenderingMode.INVISIBLE;let g,L,At,H;if(!(D||U===0)){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,u.save(),u.transform(...P.textMatrix),u.translate(P.x,P.y),u.scale(A,$),g=0;g<B;++g){if(L=d[g],typeof L=="number"){H=s*L*U/1e3,this.ctx.translate(H,0),P.x+=H*A;continue}const Q=(L.isSpace?C:0)+h,vt=j.charProcOperatorList[L.operatorListId];if(!vt){(0,_.warn)(`Type3 character "${L.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=L,this.save(),u.scale(U,U),u.transform(...k),this.executeOperatorList(vt),this.restore()),At=_.Util.applyTransform([L.width,0],k)[0]*U+Q,u.translate(At,0),P.x+=At*A}u.restore(),this.processingType3=null}}setCharWidth(d,u){}setCharWidthAndBounds(d,u,P,j,U,$){this.ctx.rect(P,j,U-P,$-j),this.ctx.clip(),this.endPath()}getColorN_Pattern(d){let u;if(d[0]==="TilingPattern"){const P=d[1],j=this.baseTransform||(0,f.getCurrentTransform)(this.ctx),U={createCanvasGraphics:$=>new Ot($,this.commonObjs,this.objs,this.canvasFactory)};u=new Y.TilingPattern(d,P,this.ctx,U,j)}else u=this._getPattern(d[1],d[2]);return u}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(d,u,P){var U;const j=((U=this.selectColor)==null?void 0:U.call(this,d,u,P))||_.Util.makeHexColor(d,u,P);this.ctx.strokeStyle=j,this.current.strokeColor=j}setFillRGBColor(d,u,P){var U;const j=((U=this.selectColor)==null?void 0:U.call(this,d,u,P))||_.Util.makeHexColor(d,u,P);this.ctx.fillStyle=j,this.current.fillColor=j,this.current.patternFill=!1}_getPattern(d,u=null){let P;return this.cachedPatterns.has(d)?P=this.cachedPatterns.get(d):(P=(0,Y.getShadingPattern)(this.objs.get(d)),this.cachedPatterns.set(d,P)),u&&(P.matrix=u),P}shadingFill(d){if(!this.contentVisible)return;const u=this.ctx;this.save();const P=this._getPattern(d);u.fillStyle=P.getPattern(u,this,(0,f.getCurrentTransformInverse)(u),Y.PathType.SHADING);const j=(0,f.getCurrentTransformInverse)(u);if(j){const U=u.canvas,$=U.width,s=U.height,h=_.Util.applyTransform([0,0],j),C=_.Util.applyTransform([0,s],j),A=_.Util.applyTransform([$,0],j),k=_.Util.applyTransform([$,s],j),B=Math.min(h[0],C[0],A[0],k[0]),D=Math.min(h[1],C[1],A[1],k[1]),g=Math.max(h[0],C[0],A[0],k[0]),L=Math.max(h[1],C[1],A[1],k[1]);this.ctx.fillRect(B,D,g-B,L-D)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,_.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,_.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(d,u){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(d)&&d.length===6&&this.transform(...d),this.baseTransform=(0,f.getCurrentTransform)(this.ctx),u)){const P=u[2]-u[0],j=u[3]-u[1];this.ctx.rect(u[0],u[1],P,j),this.current.updateRectMinMax((0,f.getCurrentTransform)(this.ctx),u),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(d){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const u=this.ctx;d.isolated||(0,_.info)("TODO: Support non-isolated groups."),d.knockout&&(0,_.warn)("Knockout groups not supported.");const P=(0,f.getCurrentTransform)(u);if(d.matrix&&u.transform(...d.matrix),!d.bbox)throw new Error("Bounding box is required.");let j=_.Util.getAxialAlignedBoundingBox(d.bbox,(0,f.getCurrentTransform)(u));const U=[0,0,u.canvas.width,u.canvas.height];j=_.Util.intersect(j,U)||[0,0,0,0];const $=Math.floor(j[0]),s=Math.floor(j[1]);let h=Math.max(Math.ceil(j[2])-$,1),C=Math.max(Math.ceil(j[3])-s,1),A=1,k=1;h>w&&(A=h/w,h=w),C>w&&(k=C/w,C=w),this.current.startNewPathAndClipBox([0,0,h,C]);let B="groupAt"+this.groupLevel;d.smask&&(B+="_smask_"+this.smaskCounter++%2);const D=this.cachedCanvases.getCanvas(B,h,C),g=D.context;g.scale(1/A,1/k),g.translate(-$,-s),g.transform(...P),d.smask?this.smaskStack.push({canvas:D.canvas,context:g,offsetX:$,offsetY:s,scaleX:A,scaleY:k,subtype:d.smask.subtype,backdrop:d.smask.backdrop,transferMap:d.smask.transferMap||null,startTransformInverse:null}):(u.setTransform(1,0,0,1,0,0),u.translate($,s),u.scale(A,k),u.save()),i(u,g),this.ctx=g,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(u),this.groupLevel++}endGroup(d){if(!this.contentVisible)return;this.groupLevel--;const u=this.ctx,P=this.groupStack.pop();if(this.ctx=P,this.ctx.imageSmoothingEnabled=!1,d.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const j=(0,f.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...j);const U=_.Util.getAxialAlignedBoundingBox([0,0,u.canvas.width,u.canvas.height],j);this.ctx.drawImage(u.canvas,0,0),this.ctx.restore(),this.compose(U)}}beginAnnotation(d,u,P,j,U){if(Mt(this,_t,fn).call(this),e(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(u)&&u.length===4){const $=u[2]-u[0],s=u[3]-u[1];if(U&&this.annotationCanvasMap){P=P.slice(),P[4]-=u[0],P[5]-=u[1],u=u.slice(),u[0]=u[1]=0,u[2]=$,u[3]=s;const[h,C]=_.Util.singularValueDecompose2dScale((0,f.getCurrentTransform)(this.ctx)),{viewportScale:A}=this,k=Math.ceil($*this.outputScaleX*A),B=Math.ceil(s*this.outputScaleY*A);this.annotationCanvas=this.canvasFactory.create(k,B);const{canvas:D,context:g}=this.annotationCanvas;this.annotationCanvasMap.set(d,D),this.annotationCanvas.savedCtx=this.ctx,this.ctx=g,this.ctx.setTransform(h,0,0,-C,0,s*C),e(this.ctx,this.foregroundColor)}else e(this.ctx,this.foregroundColor),this.ctx.rect(u[0],u[1],$,s),this.ctx.clip(),this.endPath()}this.current=new m(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...P),this.transform(...j)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(d){if(!this.contentVisible)return;const u=d.count;d=this.getObject(d.data,d),d.count=u;const P=this.ctx,j=this.processingType3;if(j&&(j.compiled===void 0&&(j.compiled=F(d)),j.compiled)){j.compiled(P);return}const U=this._createMaskCanvas(d),$=U.canvas;P.save(),P.setTransform(1,0,0,1,0,0),P.drawImage($,U.offsetX,U.offsetY),P.restore(),this.compose()}paintImageMaskXObjectRepeat(d,u,P=0,j=0,U,$){if(!this.contentVisible)return;d=this.getObject(d.data,d);const s=this.ctx;s.save();const h=(0,f.getCurrentTransform)(s);s.transform(u,P,j,U,0,0);const C=this._createMaskCanvas(d);s.setTransform(1,0,0,1,0,0);for(let A=0,k=$.length;A<k;A+=2){const B=_.Util.transform(h,[u,P,j,U,$[A],$[A+1]]),[D,g]=_.Util.applyTransform([0,0],B);s.drawImage(C.canvas,D,g)}s.restore(),this.compose()}paintImageMaskXObjectGroup(d){if(!this.contentVisible)return;const u=this.ctx,P=this.current.fillColor,j=this.current.patternFill;for(const U of d){const{data:$,width:s,height:h,transform:C}=U,A=this.cachedCanvases.getCanvas("maskCanvas",s,h),k=A.context;k.save();const B=this.getObject($,U);n(k,B),k.globalCompositeOperation="source-in",k.fillStyle=j?P.getPattern(k,this,(0,f.getCurrentTransformInverse)(u),Y.PathType.FILL):P,k.fillRect(0,0,s,h),k.restore(),u.save(),u.transform(...C),u.scale(1,-1),a(u,A.canvas,0,0,s,h,0,-1,1,1),u.restore()}this.compose()}paintImageXObject(d){if(!this.contentVisible)return;const u=this.getObject(d);if(!u){(0,_.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(u)}paintImageXObjectRepeat(d,u,P,j){if(!this.contentVisible)return;const U=this.getObject(d);if(!U){(0,_.warn)("Dependent image isn't ready yet");return}const $=U.width,s=U.height,h=[];for(let C=0,A=j.length;C<A;C+=2)h.push({transform:[u,0,0,P,j[C],j[C+1]],x:0,y:0,w:$,h:s});this.paintInlineImageXObjectGroup(U,h)}paintInlineImageXObject(d){if(!this.contentVisible)return;const u=d.width,P=d.height,j=this.ctx;this.save(),j.scale(1/u,-1/P);let U;if(typeof HTMLElement=="function"&&d instanceof HTMLElement||!d.data)U=d;else{const C=this.cachedCanvases.getCanvas("inlineImage",u,P),A=C.context;l(A,d,this.current.transferMaps),U=C.canvas}const $=this._scaleImage(U,(0,f.getCurrentTransformInverse)(j));j.imageSmoothingEnabled=Pt((0,f.getCurrentTransform)(j),d.interpolate);const[s,h]=a(j,$.img,0,0,$.paintWidth,$.paintHeight,0,-P,u,P);if(this.imageLayer){const[C,A]=_.Util.applyTransform([0,-P],(0,f.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:d,left:C,top:A,width:s,height:h})}this.compose(),this.restore()}paintInlineImageXObjectGroup(d,u){if(!this.contentVisible)return;const P=this.ctx,j=d.width,U=d.height,$=this.cachedCanvases.getCanvas("inlineImage",j,U),s=$.context;l(s,d,this.current.transferMaps);for(const h of u){if(P.save(),P.transform(...h.transform),P.scale(1,-1),a(P,$.canvas,h.x,h.y,h.w,h.h,0,-1,1,1),this.imageLayer){const[C,A]=_.Util.applyTransform([h.x,h.y],(0,f.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:d,left:C,top:A,width:j,height:U})}P.restore()}this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(d){}markPointProps(d,u){}beginMarkedContent(d){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(d,u){d==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(u)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(d){const u=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(d);const P=this.ctx;this.pendingClip&&(u||(this.pendingClip===z?P.clip("evenodd"):P.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),P.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const d=(0,f.getCurrentTransform)(this.ctx);if(d[1]===0&&d[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(d[0]),Math.abs(d[3]));else{const u=Math.abs(d[0]*d[3]-d[2]*d[1]),P=Math.hypot(d[0],d[2]),j=Math.hypot(d[1],d[3]);this._cachedGetSinglePixelWidth=Math.max(P,j)/u}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:d}=this.current,u=(0,f.getCurrentTransform)(this.ctx);let P,j;if(u[1]===0&&u[2]===0){const U=Math.abs(u[0]),$=Math.abs(u[3]);if(d===0)P=1/U,j=1/$;else{const s=U*d,h=$*d;P=s<1?1/s:1,j=h<1?1/h:1}}else{const U=Math.abs(u[0]*u[3]-u[2]*u[1]),$=Math.hypot(u[0],u[1]),s=Math.hypot(u[2],u[3]);if(d===0)P=s/U,j=$/U;else{const h=d*U;P=s>h?s/h:1,j=$>h?$/h:1}}this._cachedScaleForStroking=[P,j]}return this._cachedScaleForStroking}rescaleAndStroke(d){const{ctx:u}=this,{lineWidth:P}=this.current,[j,U]=this.getScaleForStroking();if(u.lineWidth=P||1,j===1&&U===1){u.stroke();return}let $,s,h;d&&($=(0,f.getCurrentTransform)(u),s=u.getLineDash().slice(),h=u.lineDashOffset),u.scale(j,U);const C=Math.max(j,U);u.setLineDash(u.getLineDash().map(A=>A/C)),u.lineDashOffset/=C,u.stroke(),d&&(u.setTransform(...$),u.setLineDash(s),u.lineDashOffset=h)}isContentVisible(){for(let d=this.markedContentStack.length-1;d>=0;d--)if(!this.markedContentStack[d].visible)return!1;return!0}};_t=new WeakSet,fn=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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.transparentCanvas=null)};let G=Ot;o.CanvasGraphics=G;for(const q in _.OPS)G.prototype[q]!==void 0&&(G.prototype[_.OPS[q]]=G.prototype[q])}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TilingPattern=o.PathType=void 0,o.getShadingPattern=c;var f=y(1),_=y(8),Y=y(3);const W={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};o.PathType=W;function K(a,F){if(!F||Y.isNodeJS)return;const m=F[2]-F[0],l=F[3]-F[1],n=new Path2D;n.rect(F[0],F[1],m,l),a.clip(n)}class M{constructor(){this.constructor===M&&(0,f.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,f.unreachable)("Abstract method `getPattern` called.")}}class b extends M{constructor(F){super(),this._type=F[1],this._bbox=F[2],this._colorStops=F[3],this._p0=F[4],this._p1=F[5],this._r0=F[6],this._r1=F[7],this.matrix=null}_createGradient(F){let m;this._type==="axial"?m=F.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(m=F.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const l of this._colorStops)m.addColorStop(l[0],l[1]);return m}getPattern(F,m,l,n){let i;if(n===W.STROKE||n===W.FILL){const e=m.current.getClippedPathBoundingBox(n,(0,_.getCurrentTransform)(F))||[0,0,0,0],E=Math.ceil(e[2]-e[0])||1,x=Math.ceil(e[3]-e[1])||1,N=m.cachedCanvases.getCanvas("pattern",E,x,!0),I=N.context;I.clearRect(0,0,I.canvas.width,I.canvas.height),I.beginPath(),I.rect(0,0,I.canvas.width,I.canvas.height),I.translate(-e[0],-e[1]),l=f.Util.transform(l,[1,0,0,1,e[0],e[1]]),I.transform(...m.baseTransform),this.matrix&&I.transform(...this.matrix),K(I,this._bbox),I.fillStyle=this._createGradient(I),I.fill(),i=F.createPattern(N.canvas,"no-repeat");const St=new DOMMatrix(l);try{i.setTransform(St)}catch(Pt){(0,f.warn)(`RadialAxialShadingPattern.getPattern: "${Pt==null?void 0:Pt.message}".`)}}else K(F,this._bbox),i=this._createGradient(F);return i}}function w(a,F,m,l,n,i,e,E){const x=F.coords,N=F.colors,I=a.data,St=a.width*4;let Pt;x[m+1]>x[l+1]&&(Pt=m,m=l,l=Pt,Pt=i,i=e,e=Pt),x[l+1]>x[n+1]&&(Pt=l,l=n,n=Pt,Pt=e,e=E,E=Pt),x[m+1]>x[l+1]&&(Pt=m,m=l,l=Pt,Pt=i,i=e,e=Pt);const bt=(x[m]+F.offsetX)*F.scaleX,V=(x[m+1]+F.offsetY)*F.scaleY,O=(x[l]+F.offsetX)*F.scaleX,z=(x[l+1]+F.offsetY)*F.scaleY,G=(x[n]+F.offsetX)*F.scaleX,_t=(x[n+1]+F.offsetY)*F.scaleY;if(V>=_t)return;const wt=N[i],Ot=N[i+1],q=N[i+2],d=N[e],u=N[e+1],P=N[e+2],j=N[E],U=N[E+1],$=N[E+2],s=Math.round(V),h=Math.round(_t);let C,A,k,B,D,g,L,At;for(let H=s;H<=h;H++){if(H<z){let kt;H<V?kt=0:kt=(V-H)/(V-z),C=bt-(bt-O)*kt,A=wt-(wt-d)*kt,k=Ot-(Ot-u)*kt,B=q-(q-P)*kt}else{let kt;H>_t?kt=1:z===_t?kt=0:kt=(z-H)/(z-_t),C=O-(O-G)*kt,A=d-(d-j)*kt,k=u-(u-U)*kt,B=P-(P-$)*kt}let Q;H<V?Q=0:H>_t?Q=1:Q=(V-H)/(V-_t),D=bt-(bt-G)*Q,g=wt-(wt-j)*Q,L=Ot-(Ot-U)*Q,At=q-(q-$)*Q;const vt=Math.round(Math.min(C,D)),Tt=Math.round(Math.max(C,D));let It=St*H+vt*4;for(let kt=vt;kt<=Tt;kt++)Q=(C-kt)/(C-D),Q<0?Q=0:Q>1&&(Q=1),I[It++]=A-(A-g)*Q|0,I[It++]=k-(k-L)*Q|0,I[It++]=B-(B-At)*Q|0,I[It++]=255}}function T(a,F,m){const l=F.coords,n=F.colors;let i,e;switch(F.type){case"lattice":const E=F.verticesPerRow,x=Math.floor(l.length/E)-1,N=E-1;for(i=0;i<x;i++){let I=i*E;for(let St=0;St<N;St++,I++)w(a,m,l[I],l[I+1],l[I+E],n[I],n[I+1],n[I+E]),w(a,m,l[I+E+1],l[I+1],l[I+E],n[I+E+1],n[I+1],n[I+E])}break;case"triangles":for(i=0,e=l.length;i<e;i+=3)w(a,m,l[i],l[i+1],l[i+2],n[i],n[i+1],n[i+2]);break;default:throw new Error("illegal figure")}}class S extends M{constructor(F){super(),this._coords=F[2],this._colors=F[3],this._figures=F[4],this._bounds=F[5],this._bbox=F[7],this._background=F[8],this.matrix=null}_createMeshCanvas(F,m,l){const E=Math.floor(this._bounds[0]),x=Math.floor(this._bounds[1]),N=Math.ceil(this._bounds[2])-E,I=Math.ceil(this._bounds[3])-x,St=Math.min(Math.ceil(Math.abs(N*F[0]*1.1)),3e3),Pt=Math.min(Math.ceil(Math.abs(I*F[1]*1.1)),3e3),bt=N/St,V=I/Pt,O={coords:this._coords,colors:this._colors,offsetX:-E,offsetY:-x,scaleX:1/bt,scaleY:1/V},z=St+4,G=Pt+4,_t=l.getCanvas("mesh",z,G,!1),wt=_t.context,Ot=wt.createImageData(St,Pt);if(m){const d=Ot.data;for(let u=0,P=d.length;u<P;u+=4)d[u]=m[0],d[u+1]=m[1],d[u+2]=m[2],d[u+3]=255}for(const d of this._figures)T(Ot,d,O);return wt.putImageData(Ot,2,2),{canvas:_t.canvas,offsetX:E-2*bt,offsetY:x-2*V,scaleX:bt,scaleY:V}}getPattern(F,m,l,n){K(F,this._bbox);let i;if(n===W.SHADING)i=f.Util.singularValueDecompose2dScale((0,_.getCurrentTransform)(F));else if(i=f.Util.singularValueDecompose2dScale(m.baseTransform),this.matrix){const E=f.Util.singularValueDecompose2dScale(this.matrix);i=[i[0]*E[0],i[1]*E[1]]}const e=this._createMeshCanvas(i,n===W.SHADING?null:this._background,m.cachedCanvases);return n!==W.SHADING&&(F.setTransform(...m.baseTransform),this.matrix&&F.transform(...this.matrix)),F.translate(e.offsetX,e.offsetY),F.scale(e.scaleX,e.scaleY),F.createPattern(e.canvas,"no-repeat")}}class v extends M{getPattern(){return"hotpink"}}function c(a){switch(a[0]){case"RadialAxial":return new b(a);case"Mesh":return new S(a);case"Dummy":return new v}throw new Error(`Unknown IR type: ${a[0]}`)}const t={COLORED:1,UNCOLORED:2};class r{static get MAX_PATTERN_SIZE(){return(0,f.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(F,m,l,n,i){this.operatorList=F[2],this.matrix=F[3]||[1,0,0,1,0,0],this.bbox=F[4],this.xstep=F[5],this.ystep=F[6],this.paintType=F[7],this.tilingType=F[8],this.color=m,this.ctx=l,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(F){const m=this.operatorList,l=this.bbox,n=this.xstep,i=this.ystep,e=this.paintType,E=this.tilingType,x=this.color,N=this.canvasGraphicsFactory;(0,f.info)("TilingType: "+E);const I=l[0],St=l[1],Pt=l[2],bt=l[3],V=f.Util.singularValueDecompose2dScale(this.matrix),O=f.Util.singularValueDecompose2dScale(this.baseTransform),z=[V[0]*O[0],V[1]*O[1]],G=this.getSizeAndScale(n,this.ctx.canvas.width,z[0]),_t=this.getSizeAndScale(i,this.ctx.canvas.height,z[1]),wt=F.cachedCanvases.getCanvas("pattern",G.size,_t.size,!0),Ot=wt.context,q=N.createCanvasGraphics(Ot);q.groupLevel=F.groupLevel,this.setFillAndStrokeStyleToContext(q,e,x);let d=I,u=St,P=Pt,j=bt;return I<0&&(d=0,P+=Math.abs(I)),St<0&&(u=0,j+=Math.abs(St)),Ot.translate(-(G.scale*d),-(_t.scale*u)),q.transform(G.scale,0,0,_t.scale,0,0),Ot.save(),this.clipBbox(q,d,u,P,j),q.baseTransform=(0,_.getCurrentTransform)(q.ctx),q.executeOperatorList(m),q.endDrawing(),{canvas:wt.canvas,scaleX:G.scale,scaleY:_t.scale,offsetX:d,offsetY:u}}getSizeAndScale(F,m,l){F=Math.abs(F);const n=Math.max(r.MAX_PATTERN_SIZE,m);let i=Math.ceil(F*l);return i>=n?i=n:l=i/F,{scale:l,size:i}}clipBbox(F,m,l,n,i){const e=n-m,E=i-l;F.ctx.rect(m,l,e,E),F.current.updateRectMinMax((0,_.getCurrentTransform)(F.ctx),[m,l,n,i]),F.clip(),F.endPath()}setFillAndStrokeStyleToContext(F,m,l){const n=F.ctx,i=F.current;switch(m){case t.COLORED:const e=this.ctx;n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle,i.fillColor=e.fillStyle,i.strokeColor=e.strokeStyle;break;case t.UNCOLORED:const E=f.Util.makeHexColor(l[0],l[1],l[2]);n.fillStyle=E,n.strokeStyle=E,i.fillColor=E,i.strokeColor=E;break;default:throw new f.FormatError(`Unsupported paint type: ${m}`)}}getPattern(F,m,l,n){let i=l;n!==W.SHADING&&(i=f.Util.transform(i,m.baseTransform),this.matrix&&(i=f.Util.transform(i,this.matrix)));const e=this.createPatternCanvas(m);let E=new DOMMatrix(i);E=E.translate(e.offsetX,e.offsetY),E=E.scale(1/e.scaleX,1/e.scaleY);const x=F.createPattern(e.canvas,"repeat");try{x.setTransform(E)}catch(N){(0,f.warn)(`TilingPattern.getPattern: "${N==null?void 0:N.message}".`)}return x}}o.TilingPattern=r}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.applyMaskImageData=_;var f=y(1);function _({src:Y,srcPos:W=0,dest:K,destPos:M=0,width:b,height:w,inverseDecode:T=!1}){const S=f.FeatureTest.isLittleEndian?4278190080:255,[v,c]=T?[0,S]:[S,0],t=b>>3,r=b&7,a=Y.length;K=new Uint32Array(K.buffer);for(let F=0;F<w;F++){for(const l=W+t;W<l;W++){const n=W<a?Y[W]:255;K[M++]=n&128?c:v,K[M++]=n&64?c:v,K[M++]=n&32?c:v,K[M++]=n&16?c:v,K[M++]=n&8?c:v,K[M++]=n&4?c:v,K[M++]=n&2?c:v,K[M++]=n&1?c:v}if(r===0)continue;const m=W<a?Y[W++]:255;for(let l=0;l<r;l++)K[M++]=m&1<<7-l?c:v}return{srcPos:W,destPos:M}}}),((p,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.GlobalWorkerOptions=void 0;const y=Object.create(null);o.GlobalWorkerOptions=y,y.workerPort=y.workerPort===void 0?null:y.workerPort,y.workerSrc=y.workerSrc===void 0?"":y.workerSrc}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.MessageHandler=void 0;var f=y(1);const _={DATA:1,ERROR:2},Y={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function W(M){switch(M instanceof Error||typeof M=="object"&&M!==null||(0,f.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),M.name){case"AbortException":return new f.AbortException(M.message);case"MissingPDFException":return new f.MissingPDFException(M.message);case"PasswordException":return new f.PasswordException(M.message,M.code);case"UnexpectedResponseException":return new f.UnexpectedResponseException(M.message,M.status);case"UnknownErrorException":return new f.UnknownErrorException(M.message,M.details);default:return new f.UnknownErrorException(M.message,M.toString())}}class K{constructor(b,w,T){this.sourceName=b,this.targetName=w,this.comObj=T,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=S=>{const v=S.data;if(v.targetName!==this.sourceName)return;if(v.stream){this._processStreamMessage(v);return}if(v.callback){const t=v.callbackId,r=this.callbackCapabilities[t];if(!r)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],v.callback===_.DATA)r.resolve(v.data);else if(v.callback===_.ERROR)r.reject(W(v.reason));else throw new Error("Unexpected callback case");return}const c=this.actionHandler[v.action];if(!c)throw new Error(`Unknown action from worker: ${v.action}`);if(v.callbackId){const t=this.sourceName,r=v.sourceName;new Promise(function(a){a(c(v.data))}).then(function(a){T.postMessage({sourceName:t,targetName:r,callback:_.DATA,callbackId:v.callbackId,data:a})},function(a){T.postMessage({sourceName:t,targetName:r,callback:_.ERROR,callbackId:v.callbackId,reason:W(a)})});return}if(v.streamId){this._createStreamSink(v);return}c(v.data)},T.addEventListener("message",this._onComObjOnMessage)}on(b,w){const T=this.actionHandler;if(T[b])throw new Error(`There is already an actionName called "${b}"`);T[b]=w}send(b,w,T){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:b,data:w},T)}sendWithPromise(b,w,T){const S=this.callbackId++,v=(0,f.createPromiseCapability)();this.callbackCapabilities[S]=v;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:b,callbackId:S,data:w},T)}catch(c){v.reject(c)}return v.promise}sendWithStream(b,w,T,S){const v=this.streamId++,c=this.sourceName,t=this.targetName,r=this.comObj;return new ReadableStream({start:a=>{const F=(0,f.createPromiseCapability)();return this.streamControllers[v]={controller:a,startCall:F,pullCall:null,cancelCall:null,isClosed:!1},r.postMessage({sourceName:c,targetName:t,action:b,streamId:v,data:w,desiredSize:a.desiredSize},S),F.promise},pull:a=>{const F=(0,f.createPromiseCapability)();return this.streamControllers[v].pullCall=F,r.postMessage({sourceName:c,targetName:t,stream:Y.PULL,streamId:v,desiredSize:a.desiredSize}),F.promise},cancel:a=>{(0,f.assert)(a instanceof Error,"cancel must have a valid reason");const F=(0,f.createPromiseCapability)();return this.streamControllers[v].cancelCall=F,this.streamControllers[v].isClosed=!0,r.postMessage({sourceName:c,targetName:t,stream:Y.CANCEL,streamId:v,reason:W(a)}),F.promise}},T)}_createStreamSink(b){const w=b.streamId,T=this.sourceName,S=b.sourceName,v=this.comObj,c=this,t=this.actionHandler[b.action],r={enqueue(a,F=1,m){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=F,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,f.createPromiseCapability)(),this.ready=this.sinkCapability.promise),v.postMessage({sourceName:T,targetName:S,stream:Y.ENQUEUE,streamId:w,chunk:a},m)},close(){this.isCancelled||(this.isCancelled=!0,v.postMessage({sourceName:T,targetName:S,stream:Y.CLOSE,streamId:w}),delete c.streamSinks[w])},error(a){(0,f.assert)(a instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,v.postMessage({sourceName:T,targetName:S,stream:Y.ERROR,streamId:w,reason:W(a)}))},sinkCapability:(0,f.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:b.desiredSize,ready:null};r.sinkCapability.resolve(),r.ready=r.sinkCapability.promise,this.streamSinks[w]=r,new Promise(function(a){a(t(b.data,r))}).then(function(){v.postMessage({sourceName:T,targetName:S,stream:Y.START_COMPLETE,streamId:w,success:!0})},function(a){v.postMessage({sourceName:T,targetName:S,stream:Y.START_COMPLETE,streamId:w,reason:W(a)})})}_processStreamMessage(b){const w=b.streamId,T=this.sourceName,S=b.sourceName,v=this.comObj,c=this.streamControllers[w],t=this.streamSinks[w];switch(b.stream){case Y.START_COMPLETE:b.success?c.startCall.resolve():c.startCall.reject(W(b.reason));break;case Y.PULL_COMPLETE:b.success?c.pullCall.resolve():c.pullCall.reject(W(b.reason));break;case Y.PULL:if(!t){v.postMessage({sourceName:T,targetName:S,stream:Y.PULL_COMPLETE,streamId:w,success:!0});break}t.desiredSize<=0&&b.desiredSize>0&&t.sinkCapability.resolve(),t.desiredSize=b.desiredSize,new Promise(function(r){r(t.onPull&&t.onPull())}).then(function(){v.postMessage({sourceName:T,targetName:S,stream:Y.PULL_COMPLETE,streamId:w,success:!0})},function(r){v.postMessage({sourceName:T,targetName:S,stream:Y.PULL_COMPLETE,streamId:w,reason:W(r)})});break;case Y.ENQUEUE:if((0,f.assert)(c,"enqueue should have stream controller"),c.isClosed)break;c.controller.enqueue(b.chunk);break;case Y.CLOSE:if((0,f.assert)(c,"close should have stream controller"),c.isClosed)break;c.isClosed=!0,c.controller.close(),this._deleteStreamController(c,w);break;case Y.ERROR:(0,f.assert)(c,"error should have stream controller"),c.controller.error(W(b.reason)),this._deleteStreamController(c,w);break;case Y.CANCEL_COMPLETE:b.success?c.cancelCall.resolve():c.cancelCall.reject(W(b.reason)),this._deleteStreamController(c,w);break;case Y.CANCEL:if(!t)break;new Promise(function(r){r(t.onCancel&&t.onCancel(W(b.reason)))}).then(function(){v.postMessage({sourceName:T,targetName:S,stream:Y.CANCEL_COMPLETE,streamId:w,success:!0})},function(r){v.postMessage({sourceName:T,targetName:S,stream:Y.CANCEL_COMPLETE,streamId:w,reason:W(r)})}),t.sinkCapability.reject(W(b.reason)),t.isCancelled=!0,delete this.streamSinks[w];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(b,w){await Promise.allSettled([b.startCall&&b.startCall.promise,b.pullCall&&b.pullCall.promise,b.cancelCall&&b.cancelCall.promise]),delete this.streamControllers[w]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}o.MessageHandler=K}),((p,o,y)=>{var Y,W;Object.defineProperty(o,"__esModule",{value:!0}),o.Metadata=void 0;var f=y(1);class _{constructor({parsedData:M,rawData:b}){Lt(this,Y);Lt(this,W);Bt(this,Y,M),Bt(this,W,b)}getRaw(){return R(this,W)}get(M){return R(this,Y).get(M)??null}getAll(){return(0,f.objectFromMap)(R(this,Y))}has(M){return R(this,Y).has(M)}}Y=new WeakMap,W=new WeakMap,o.Metadata=_}),((p,o,y)=>{var K,M,b,w,T,S,pn;Object.defineProperty(o,"__esModule",{value:!0}),o.OptionalContentConfig=void 0;var f=y(1);const _=Symbol("INTERNAL");class Y{constructor(t,r){Lt(this,K,!0);this.name=t,this.intent=r}get visible(){return R(this,K)}_setVisible(t,r){t!==_&&(0,f.unreachable)("Internal method `_setVisible` called."),Bt(this,K,r)}}K=new WeakMap;class W{constructor(t){Lt(this,S);Lt(this,M,!0);Lt(this,b,new Map);Lt(this,w,null);Lt(this,T,null);if(this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,Bt(this,T,t.order);for(const r of t.groups)R(this,b).set(r.id,new Y(r.name,r.intent));if(t.baseState==="OFF")for(const r of R(this,b).values())r._setVisible(_,!1);for(const r of t.on)R(this,b).get(r)._setVisible(_,!0);for(const r of t.off)R(this,b).get(r)._setVisible(_,!1);Bt(this,w,new Map);for(const[r,a]of R(this,b))R(this,w).set(r,a.visible)}}isVisible(t){if(R(this,b).size===0)return!0;if(!t)return(0,f.warn)("Optional content group not defined."),!0;if(t.type==="OCG")return R(this,b).has(t.id)?R(this,b).get(t.id).visible:((0,f.warn)(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return Mt(this,S,pn).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(R(this,b).get(r).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(!R(this,b).get(r).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(!R(this,b).get(r).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(R(this,b).get(r).visible)return!1}return!0}return(0,f.warn)(`Unknown optional content policy ${t.policy}.`),!0}return(0,f.warn)(`Unknown group type ${t.type}.`),!0}setVisibility(t,r=!0){if(!R(this,b).has(t)){(0,f.warn)(`Optional content group not found: ${t}`);return}R(this,b).get(t)._setVisible(_,!!r),Bt(this,M,null)}get hasInitialVisibility(){if(R(this,M)!==null)return R(this,M);for(const[t,r]of R(this,b)){const a=R(this,w).get(t);if(r.visible!==a)return Bt(this,M,!1)}return Bt(this,M,!0)}getOrder(){return R(this,b).size?R(this,T)?R(this,T).slice():[...R(this,b).keys()]:null}getGroups(){return R(this,b).size>0?(0,f.objectFromMap)(R(this,b)):null}getGroup(t){return R(this,b).get(t)||null}}M=new WeakMap,b=new WeakMap,w=new WeakMap,T=new WeakMap,S=new WeakSet,pn=function(t){const r=t.length;if(r<2)return!0;const a=t[0];for(let F=1;F<r;F++){const m=t[F];let l;if(Array.isArray(m))l=Mt(this,S,pn).call(this,m);else if(R(this,b).has(m))l=R(this,b).get(m).visible;else return(0,f.warn)(`Optional content group not found: ${m}`),!0;switch(a){case"And":if(!l)return!1;break;case"Or":if(l)return!0;break;case"Not":return!l;default:return!0}}return a==="And"},o.OptionalContentConfig=W}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PDFDataTransportStream=void 0;var f=y(1),_=y(8);class Y{constructor(b,w){(0,f.assert)(w,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=b.progressiveDone||!1,this._contentDispositionFilename=b.contentDispositionFilename||null;const T=b.initialData;if((T==null?void 0:T.length)>0){const S=new Uint8Array(T).buffer;this._queuedChunks.push(S)}this._pdfDataRangeTransport=w,this._isStreamingSupported=!b.disableStream,this._isRangeSupported=!b.disableRange,this._contentLength=b.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((S,v)=>{this._onReceiveData({begin:S,chunk:v})}),this._pdfDataRangeTransport.addProgressListener((S,v)=>{this._onProgress({loaded:S,total:v})}),this._pdfDataRangeTransport.addProgressiveReadListener(S=>{this._onReceiveData({chunk:S})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData(b){const w=new Uint8Array(b.chunk).buffer;if(b.begin===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(w):this._queuedChunks.push(w);else{const T=this._rangeReaders.some(function(S){return S._begin!==b.begin?!1:(S._enqueue(w),!0)});(0,f.assert)(T,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var b;return((b=this._fullRequestReader)==null?void 0:b._loaded)??0}_onProgress(b){if(b.total===void 0){const w=this._rangeReaders[0];w!=null&&w.onProgress&&w.onProgress({loaded:b.loaded})}else{const w=this._fullRequestReader;w!=null&&w.onProgress&&w.onProgress({loaded:b.loaded,total:b.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(b){const w=this._rangeReaders.indexOf(b);w>=0&&this._rangeReaders.splice(w,1)}getFullReader(){(0,f.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const b=this._queuedChunks;return this._queuedChunks=null,new W(this,b,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(b,w){if(w<=this._progressiveDataLength)return null;const T=new K(this,b,w);return this._pdfDataRangeTransport.requestDataRange(b,w),this._rangeReaders.push(T),T}cancelAllRequests(b){this._fullRequestReader&&this._fullRequestReader.cancel(b);for(const w of this._rangeReaders.slice(0))w.cancel(b);this._pdfDataRangeTransport.abort()}}o.PDFDataTransportStream=Y;class W{constructor(b,w,T=!1,S=null){this._stream=b,this._done=T||!1,this._filename=(0,_.isPdfFile)(S)?S:null,this._queuedChunks=w||[],this._loaded=0;for(const v of this._queuedChunks)this._loaded+=v.byteLength;this._requests=[],this._headersReady=Promise.resolve(),b._fullRequestReader=this,this.onProgress=null}_enqueue(b){this._done||(this._requests.length>0?this._requests.shift().resolve({value:b,done:!1}):this._queuedChunks.push(b),this._loaded+=b.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const b=(0,f.createPromiseCapability)();return this._requests.push(b),b.promise}cancel(b){this._done=!0;for(const w of this._requests)w.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class K{constructor(b,w,T){this._stream=b,this._begin=w,this._end=T,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(b){if(!this._done){if(this._requests.length===0)this._queuedChunk=b;else{this._requests.shift().resolve({value:b,done:!1});for(const T of this._requests)T.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const w=this._queuedChunk;return this._queuedChunk=null,{value:w,done:!1}}if(this._done)return{value:void 0,done:!0};const b=(0,f.createPromiseCapability)();return this._requests.push(b),b.promise}cancel(b){this._done=!0;for(const w of this._requests)w.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((p,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.XfaText=void 0;class y{static textContent(_){const Y=[],W={items:Y,styles:Object.create(null)};function K(M){var T;if(!M)return;let b=null;const w=M.name;if(w==="#text")b=M.value;else if(y.shouldBuildText(w))(T=M==null?void 0:M.attributes)!=null&&T.textContent?b=M.attributes.textContent:M.value&&(b=M.value);else return;if(b!==null&&Y.push({str:b}),!!M.children)for(const S of M.children)K(S)}return K(_),W}static shouldBuildText(_){return!(_==="textarea"||_==="input"||_==="option"||_==="select")}}o.XfaText=y}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.NodeStandardFontDataFactory=o.NodeCanvasFactory=o.NodeCMapReaderFactory=void 0;var f=y(9);const _=function(M){return new Promise((b,w)=>{require$$5.readFile(M,(S,v)=>{if(S||!v){w(new Error(S));return}b(new Uint8Array(v))})})};class Y extends f.BaseCanvasFactory{_createCanvas(b,w){return require$$5.createCanvas(b,w)}}o.NodeCanvasFactory=Y;class W extends f.BaseCMapReaderFactory{_fetchData(b,w){return _(b).then(T=>({cMapData:T,compressionType:w}))}}o.NodeCMapReaderFactory=W;class K extends f.BaseStandardFontDataFactory{_fetchData(b){return _(b)}}o.NodeStandardFontDataFactory=K}),((p,o,y)=>{var M,b,w,T,S,v,c,t,r,gn,Mn,mn,On;Object.defineProperty(o,"__esModule",{value:!0}),o.AnnotationEditorLayer=void 0;var f=y(7),_=y(1),Y=y(23),W=y(24);const n=class n{constructor(e){Lt(this,r);Lt(this,M);Lt(this,b,!1);Lt(this,w,this.pointerup.bind(this));Lt(this,T,this.pointerdown.bind(this));Lt(this,S,new Map);Lt(this,v,!1);Lt(this,c,!1);Lt(this,t);n._initialized||(n._initialized=!0,Y.FreeTextEditor.initialize(e.l10n),W.InkEditor.initialize(e.l10n),e.uiManager.registerEditorTypes([Y.FreeTextEditor,W.InkEditor])),Bt(this,t,e.uiManager),this.annotationStorage=e.annotationStorage,this.pageIndex=e.pageIndex,this.div=e.div,Bt(this,M,e.accessibilityManager),R(this,t).addLayer(this)}updateToolbar(e){R(this,t).updateToolbar(e)}updateMode(e=R(this,t).getMode()){Mt(this,r,On).call(this),e===_.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),R(this,t).unselectAll()}addInkEditorIfNeeded(e){if(!e&&R(this,t).getMode()!==_.AnnotationEditorType.INK)return;if(!e){for(const x of R(this,S).values())if(x.isEmpty()){x.setInBackground();return}}Mt(this,r,mn).call(this,{offsetX:0,offsetY:0}).setInBackground()}setEditingState(e){R(this,t).setEditingState(e)}addCommands(e){R(this,t).addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of R(this,S).values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of R(this,S).values())e.disableEditing()}setActiveEditor(e){R(this,t).getActive()!==e&&R(this,t).setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",R(this,T)),this.div.addEventListener("pointerup",R(this,w))}disableClick(){this.div.removeEventListener("pointerdown",R(this,T)),this.div.removeEventListener("pointerup",R(this,w))}attach(e){R(this,S).set(e.id,e)}detach(e){var E;R(this,S).delete(e.id),(E=R(this,M))==null||E.removePointerInTextLayer(e.contentDiv)}remove(e){R(this,t).removeEditor(e),this.detach(e),this.annotationStorage.remove(e.id),e.div.style.display="none",setTimeout(()=>{e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&R(this,t).focusMainContainer()},0),R(this,c)||this.addInkEditorIfNeeded(!1)}add(e){if(Mt(this,r,gn).call(this,e),R(this,t).addEditor(e),this.attach(e),!e.isAttachedToDOM){const E=e.render();this.div.append(E),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),this.addToAnnotationStorage(e)}moveEditorInDOM(e){var E;(E=R(this,M))==null||E.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addToAnnotationStorage(e){!e.isEmpty()&&!this.annotationStorage.has(e.id)&&this.annotationStorage.setValue(e.id,e)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addANewEditor(e){const E=()=>{this.addOrRebuild(e)},x=()=>{e.remove()};this.addCommands({cmd:E,undo:x,mustExec:!0})}addUndoableEditor(e){const E=()=>{this.addOrRebuild(e)},x=()=>{e.remove()};this.addCommands({cmd:E,undo:x,mustExec:!1})}getNextId(){return R(this,t).getId()}deserialize(e){switch(e.annotationType){case _.AnnotationEditorType.FREETEXT:return Y.FreeTextEditor.deserialize(e,this);case _.AnnotationEditorType.INK:return W.InkEditor.deserialize(e,this)}return null}setSelected(e){R(this,t).setSelected(e)}toggleSelected(e){R(this,t).toggleSelected(e)}isSelected(e){return R(this,t).isSelected(e)}unselect(e){R(this,t).unselect(e)}pointerup(e){const E=f.KeyboardManager.platform.isMac;if(!(e.button!==0||e.ctrlKey&&E)&&e.target===this.div&&R(this,v)){if(Bt(this,v,!1),!R(this,b)){Bt(this,b,!0);return}Mt(this,r,mn).call(this,e)}}pointerdown(e){const E=f.KeyboardManager.platform.isMac;if(e.button!==0||e.ctrlKey&&E||e.target!==this.div)return;Bt(this,v,!0);const x=R(this,t).getActive();Bt(this,b,!x||x.isEmpty())}drop(e){const E=e.dataTransfer.getData("text/plain"),x=R(this,t).getEditor(E);if(!x)return;e.preventDefault(),e.dataTransfer.dropEffect="move",Mt(this,r,gn).call(this,x);const N=this.div.getBoundingClientRect(),I=e.clientX-N.x,St=e.clientY-N.y;x.translate(I-x.startX,St-x.startY),this.moveEditorInDOM(x),x.div.focus()}dragover(e){e.preventDefault()}destroy(){var e,E;((e=R(this,t).getActive())==null?void 0:e.parent)===this&&R(this,t).setActiveEditor(null);for(const x of R(this,S).values())(E=R(this,M))==null||E.removePointerInTextLayer(x.contentDiv),x.isAttachedToDOM=!1,x.div.remove(),x.parent=null;this.div=null,R(this,S).clear(),R(this,t).removeLayer(this)}render(e){this.viewport=e.viewport,(0,f.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const E of R(this,t).getEditors(this.pageIndex))this.add(E);this.updateMode()}update(e){this.viewport=e.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[e,E,x,N]=this.viewport.viewBox,I=x-e,St=N-E;return[I,St]}get viewportBaseDimensions(){const{width:e,height:E,rotation:x}=this.viewport;return x%180===0?[e,E]:[E,e]}setDimensions(){const{width:e,height:E,rotation:x}=this.viewport,N=x%180!==0,I=Math.floor(e)+"px",St=Math.floor(E)+"px";this.div.style.width=N?St:I,this.div.style.height=N?I:St,this.div.setAttribute("data-main-rotation",x)}};M=new WeakMap,b=new WeakMap,w=new WeakMap,T=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakMap,t=new WeakMap,r=new WeakSet,gn=function(e){var E;e.parent!==this&&(this.attach(e),e.pageIndex=this.pageIndex,(E=e.parent)==null||E.detach(e),e.parent=this,e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))},Mn=function(e){switch(R(this,t).getMode()){case _.AnnotationEditorType.FREETEXT:return new Y.FreeTextEditor(e);case _.AnnotationEditorType.INK:return new W.InkEditor(e)}return null},mn=function(e){const E=this.getNextId(),x=Mt(this,r,Mn).call(this,{parent:this,id:E,x:e.offsetX,y:e.offsetY});return x&&this.add(x),x},On=function(){Bt(this,c,!0);for(const e of R(this,S).values())e.isEmpty()&&e.remove();Bt(this,c,!1)},se(n,"_initialized",!1);let K=n;o.AnnotationEditorLayer=K}),((p,o,y)=>{var K,M,b,w,T,S,v,c,In,Ln,Bn,bn;Object.defineProperty(o,"__esModule",{value:!0}),o.FreeTextEditor=void 0;var f=y(1),_=y(7),Y=y(6);const m=class m extends Y.AnnotationEditor{constructor(i){super({...i,name:"freeTextEditor"});Lt(this,c);Lt(this,K,this.editorDivBlur.bind(this));Lt(this,M,this.editorDivFocus.bind(this));Lt(this,b,this.editorDivKeydown.bind(this));Lt(this,w);Lt(this,T,"");Lt(this,S,!1);Lt(this,v);Bt(this,w,i.color||m._defaultColor||Y.AnnotationEditor._defaultLineColor),Bt(this,v,i.fontSize||m._defaultFontSize)}static initialize(i){this._l10nPromise=new Map(["free_text_default_content","editor_free_text_aria_label"].map(E=>[E,i.get(E)]));const e=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(e.getPropertyValue("--freetext-padding"))}static updateDefaultParams(i,e){switch(i){case f.AnnotationEditorParamsType.FREETEXT_SIZE:m._defaultFontSize=e;break;case f.AnnotationEditorParamsType.FREETEXT_COLOR:m._defaultColor=e;break}}updateParams(i,e){switch(i){case f.AnnotationEditorParamsType.FREETEXT_SIZE:Mt(this,c,In).call(this,e);break;case f.AnnotationEditorParamsType.FREETEXT_COLOR:Mt(this,c,Ln).call(this,e);break}}static get defaultPropertiesToUpdate(){return[[f.AnnotationEditorParamsType.FREETEXT_SIZE,m._defaultFontSize],[f.AnnotationEditorParamsType.FREETEXT_COLOR,m._defaultColor||Y.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[f.AnnotationEditorParamsType.FREETEXT_SIZE,R(this,v)],[f.AnnotationEditorParamsType.FREETEXT_COLOR,R(this,w)]]}getInitialTranslation(){return[-m._internalPadding*this.parent.scaleFactor,-(m._internalPadding+R(this,v))*this.parent.scaleFactor]}rebuild(){super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(f.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",R(this,b)),this.editorDiv.addEventListener("focus",R(this,M)),this.editorDiv.addEventListener("blur",R(this,K)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.disableEditing(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",R(this,b)),this.editorDiv.removeEventListener("focus",R(this,M)),this.editorDiv.removeEventListener("blur",R(this,K)),this.div.focus(),this.isEditing=!1)}focusin(i){super.focusin(i),i.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus())}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent.setEditingState(!0),super.remove()}commit(){super.commit(),R(this,S)||(Bt(this,S,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),Bt(this,T,Mt(this,c,Bn).call(this).trimEnd()),Mt(this,c,bn).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(i){this.enableEditMode(),this.editorDiv.focus()}keydown(i){i.target===this.div&&i.key==="Enter"&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(i){m._keyboardManager.exec(this,i)}editorDivFocus(i){this.isEditing=!0}editorDivBlur(i){this.isEditing=!1}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let i,e;this.width&&(i=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),m._l10nPromise.get("editor_free_text_aria_label").then(x=>{var N;return(N=this.editorDiv)==null?void 0:N.setAttribute("aria-label",x)}),m._l10nPromise.get("free_text_default_content").then(x=>{var N;return(N=this.editorDiv)==null?void 0:N.setAttribute("default-content",x)}),this.editorDiv.contentEditable=!0;const{style:E}=this.editorDiv;if(E.fontSize=`calc(${R(this,v)}px * var(--scale-factor))`,E.color=R(this,w),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,_.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[x,N]=this.parent.viewportBaseDimensions;this.setAt(i*x,e*N,this.width*x,this.height*N);for(const I of R(this,T).split(`
40
40
  `)){const St=document.createElement("div");St.append(I?document.createTextNode(I):document.createElement("br")),this.editorDiv.append(St)}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(i,e){const E=super.deserialize(i,e);return Bt(E,v,i.fontSize),Bt(E,w,f.Util.makeHexColor(...i.color)),Bt(E,T,i.value),E}serialize(){if(this.isEmpty())return null;const i=m._internalPadding*this.parent.scaleFactor,e=this.getRect(i,i),E=Y.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:f.AnnotationEditorType.FREETEXT,color:E,fontSize:R(this,v),value:R(this,T),pageIndex:this.parent.pageIndex,rect:e,rotation:this.rotation}}};K=new WeakMap,M=new WeakMap,b=new WeakMap,w=new WeakMap,T=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakSet,In=function(i){const e=x=>{this.editorDiv.style.fontSize=`calc(${x}px * var(--scale-factor))`,this.translate(0,-(x-R(this,v))*this.parent.scaleFactor),Bt(this,v,x),Mt(this,c,bn).call(this)},E=R(this,v);this.parent.addCommands({cmd:()=>{e(i)},undo:()=>{e(E)},mustExec:!0,type:f.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},Ln=function(i){const e=R(this,w);this.parent.addCommands({cmd:()=>{Bt(this,w,i),this.editorDiv.style.color=i},undo:()=>{Bt(this,w,e),this.editorDiv.style.color=e},mustExec:!0,type:f.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Bn=function(){const i=this.editorDiv.getElementsByTagName("div");if(i.length===0)return this.editorDiv.innerText;const e=[];for(let E=0,x=i.length;E<x;E++){const I=i[E].firstChild;(I==null?void 0:I.nodeName)==="#text"?e.push(I.data):e.push("")}return e.join(`
41
41
  `)},bn=function(){const[i,e]=this.parent.viewportBaseDimensions,E=this.div.getBoundingClientRect();this.width=E.width/i,this.height=E.height/e},se(m,"_freeTextDefaultContent",""),se(m,"_l10nPromise"),se(m,"_internalPadding",0),se(m,"_defaultColor",null),se(m,"_defaultFontSize",10),se(m,"_keyboardManager",new _.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],m.prototype.commitOrRemove]])),se(m,"_type","freetext");let W=m;o.FreeTextEditor=W}),((p,o,y)=>{var b,w,T,S,v,c,t,r,a,F,m,l,n,i,e,Nn,jn,$n,Un,_n,Wn,qn,Hn,ce,An,tn,en,pe,yn,nn,d,En,zn,Xn,Gn,Cn,sn,ge,vn;Object.defineProperty(o,"__esModule",{value:!0}),o.InkEditor=void 0,Object.defineProperty(o,"fitCurve",{enumerable:!0,get:function(){return Y.fitCurve}});var f=y(1),_=y(6),Y=y(25),W=y(7);const K=16,A=class A extends _.AnnotationEditor{constructor(D){super({...D,name:"inkEditor"});Lt(this,e);Lt(this,b,0);Lt(this,w,0);Lt(this,T,0);Lt(this,S,this.canvasPointermove.bind(this));Lt(this,v,this.canvasPointerleave.bind(this));Lt(this,c,this.canvasPointerup.bind(this));Lt(this,t,this.canvasPointerdown.bind(this));Lt(this,r,!1);Lt(this,a,!1);Lt(this,F,null);Lt(this,m,null);Lt(this,l,0);Lt(this,n,0);Lt(this,i,null);this.color=D.color||null,this.thickness=D.thickness||null,this.opacity=D.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(D){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink_aria_label"].map(g=>[g,D.get(g)]))}static updateDefaultParams(D,g){switch(D){case f.AnnotationEditorParamsType.INK_THICKNESS:A._defaultThickness=g;break;case f.AnnotationEditorParamsType.INK_COLOR:A._defaultColor=g;break;case f.AnnotationEditorParamsType.INK_OPACITY:A._defaultOpacity=g/100;break}}updateParams(D,g){switch(D){case f.AnnotationEditorParamsType.INK_THICKNESS:Mt(this,e,Nn).call(this,g);break;case f.AnnotationEditorParamsType.INK_COLOR:Mt(this,e,jn).call(this,g);break;case f.AnnotationEditorParamsType.INK_OPACITY:Mt(this,e,$n).call(this,g);break}}static get defaultPropertiesToUpdate(){return[[f.AnnotationEditorParamsType.INK_THICKNESS,A._defaultThickness],[f.AnnotationEditorParamsType.INK_COLOR,A._defaultColor||_.AnnotationEditor._defaultLineColor],[f.AnnotationEditorParamsType.INK_OPACITY,Math.round(A._defaultOpacity*100)]]}get propertiesToUpdate(){return[[f.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||A._defaultThickness],[f.AnnotationEditorParamsType.INK_COLOR,this.color||A._defaultColor||_.AnnotationEditor._defaultLineColor],[f.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??A._defaultOpacity))]]}rebuild(){super.rebuild(),this.div!==null&&(this.canvas||(Mt(this,e,tn).call(this),Mt(this,e,en).call(this)),this.isAttachedToDOM||(this.parent.add(this),Mt(this,e,pe).call(this)),Mt(this,e,ge).call(this))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,R(this,m).disconnect(),Bt(this,m,null),super.remove())}enableEditMode(){R(this,r)||this.canvas===null||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",R(this,t)),this.canvas.addEventListener("pointerup",R(this,c)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",R(this,t)),this.canvas.removeEventListener("pointerup",R(this,c)))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){R(this,r)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),Bt(this,r,!0),this.div.classList.add("disabled"),Mt(this,e,ge).call(this,!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus())}focusin(D){super.focusin(D),this.enableEditMode()}canvasPointerdown(D){D.button!==0||!this.isInEditMode()||R(this,r)||(this.setInForeground(),D.type!=="mouse"&&this.div.focus(),D.stopPropagation(),this.canvas.addEventListener("pointerleave",R(this,v)),this.canvas.addEventListener("pointermove",R(this,S)),Mt(this,e,Wn).call(this,D.offsetX,D.offsetY))}canvasPointermove(D){D.stopPropagation(),Mt(this,e,qn).call(this,D.offsetX,D.offsetY)}canvasPointerup(D){D.button===0&&this.isInEditMode()&&this.currentPath.length!==0&&(D.stopPropagation(),Mt(this,e,An).call(this,D),this.setInBackground())}canvasPointerleave(D){Mt(this,e,An).call(this,D),this.setInBackground()}render(){if(this.div)return this.div;let D,g;this.width&&(D=this.x,g=this.y),super.render(),A._l10nPromise.get("editor_ink_aria_label").then(vt=>{var Tt;return(Tt=this.div)==null?void 0:Tt.setAttribute("aria-label",vt)});const[L,At,H,Q]=Mt(this,e,Un).call(this);if(this.setAt(L,At,0,0),this.setDims(H,Q),Mt(this,e,tn).call(this),this.width){const[vt,Tt]=this.parent.viewportBaseDimensions;this.setAt(D*vt,g*Tt,this.width*vt,this.height*Tt),Bt(this,a,!0),Mt(this,e,pe).call(this),this.setDims(this.width*vt,this.height*Tt),Mt(this,e,ce).call(this),Mt(this,e,vn).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return Mt(this,e,en).call(this),this.div}setDimensions(D,g){const L=Math.round(D),At=Math.round(g);if(R(this,l)===L&&R(this,n)===At)return;Bt(this,l,L),Bt(this,n,At),this.canvas.style.visibility="hidden",R(this,b)&&Math.abs(R(this,b)-D/g)>.01&&(g=Math.ceil(D/R(this,b)),this.setDims(D,g));const[H,Q]=this.parent.viewportBaseDimensions;this.width=D/H,this.height=g/Q,R(this,r)&&Mt(this,e,yn).call(this,D,g),Mt(this,e,pe).call(this),Mt(this,e,ce).call(this),this.canvas.style.visibility="visible"}static deserialize(D,g){var Ht,Wt;const L=super.deserialize(D,g);L.thickness=D.thickness,L.color=f.Util.makeHexColor(...D.color),L.opacity=D.opacity;const[At,H]=g.pageDimensions,Q=L.width*At,vt=L.height*H,Tt=g.scaleFactor,It=D.thickness/2;Bt(L,b,Q/vt),Bt(L,r,!0),Bt(L,l,Math.round(Q)),Bt(L,n,Math.round(vt));for(const{bezier:jt}of D.paths){const Xt=[];L.paths.push(Xt);let Vt=Tt*(jt[0]-It),te=Tt*(vt-jt[1]-It);for(let Yt=2,Kt=jt.length;Yt<Kt;Yt+=6){const Qt=Tt*(jt[Yt]-It),le=Tt*(vt-jt[Yt+1]-It),de=Tt*(jt[Yt+2]-It),he=Tt*(vt-jt[Yt+3]-It),Dt=Tt*(jt[Yt+4]-It),J=Tt*(vt-jt[Yt+5]-It);Xt.push([[Vt,te],[Qt,le],[de,he],[Dt,J]]),Vt=Dt,te=J}const Gt=Mt(this,d,En).call(this,Xt);L.bezierPath2D.push(Gt)}const kt=Mt(Ht=L,e,Cn).call(Ht);return Bt(L,T,Math.max(K,kt[2]-kt[0])),Bt(L,w,Math.max(K,kt[3]-kt[1])),Mt(Wt=L,e,yn).call(Wt,Q,vt),L}serialize(){if(this.isEmpty())return null;const D=this.getRect(0,0),g=this.rotation%180===0?D[3]-D[1]:D[2]-D[0],L=_.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:f.AnnotationEditorType.INK,color:L,thickness:this.thickness,opacity:this.opacity,paths:Mt(this,e,zn).call(this,this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,g),pageIndex:this.parent.pageIndex,rect:D,rotation:this.rotation}}};b=new WeakMap,w=new WeakMap,T=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakMap,t=new WeakMap,r=new WeakMap,a=new WeakMap,F=new WeakMap,m=new WeakMap,l=new WeakMap,n=new WeakMap,i=new WeakMap,e=new WeakSet,Nn=function(D){const g=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=D,Mt(this,e,ge).call(this)},undo:()=>{this.thickness=g,Mt(this,e,ge).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},jn=function(D){const g=this.color;this.parent.addCommands({cmd:()=>{this.color=D,Mt(this,e,ce).call(this)},undo:()=>{this.color=g,Mt(this,e,ce).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},$n=function(D){D/=100;const g=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=D,Mt(this,e,ce).call(this)},undo:()=>{this.opacity=g,Mt(this,e,ce).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Un=function(){const{width:D,height:g,rotation:L}=this.parent.viewport;switch(L){case 90:return[0,D,D,g];case 180:return[D,g,D,g];case 270:return[g,0,D,g];default:return[0,0,D,g]}},_n=function(){this.ctx.lineWidth=this.thickness*this.parent.scaleFactor/this.scaleFactor,this.ctx.lineCap="round",this.ctx.lineJoin="round",this.ctx.miterLimit=10,this.ctx.strokeStyle=`${this.color}${(0,W.opacityToHex)(this.opacity)}`},Wn=function(D,g){this.isEditing=!0,R(this,a)||(Bt(this,a,!0),Mt(this,e,pe).call(this),this.thickness||(this.thickness=A._defaultThickness),this.color||(this.color=A._defaultColor||_.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=A._defaultOpacity)),this.currentPath.push([D,g]),Bt(this,F,null),Mt(this,e,_n).call(this),this.ctx.beginPath(),this.ctx.moveTo(D,g),Bt(this,i,()=>{R(this,i)&&(R(this,F)&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):Mt(this,e,ce).call(this),this.ctx.lineTo(...R(this,F)),Bt(this,F,null),this.ctx.stroke()),window.requestAnimationFrame(R(this,i)))}),window.requestAnimationFrame(R(this,i))},qn=function(D,g){const[L,At]=this.currentPath.at(-1);D===L&&g===At||(this.currentPath.push([D,g]),Bt(this,F,[D,g]))},Hn=function(D,g){var It;this.ctx.closePath(),Bt(this,i,null),D=Math.min(Math.max(D,0),this.canvas.width),g=Math.min(Math.max(g,0),this.canvas.height);const[L,At]=this.currentPath.at(-1);(D!==L||g!==At)&&this.currentPath.push([D,g]);let H;if(this.currentPath.length!==1)H=(0,Y.fitCurve)(this.currentPath,30,null);else{const kt=[D,g];H=[[kt,kt.slice(),kt.slice(),kt]]}const Q=Mt(It=A,d,En).call(It,H);this.currentPath.length=0;const vt=()=>{this.paths.push(H),this.bezierPath2D.push(Q),this.rebuild()},Tt=()=>{this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(Mt(this,e,tn).call(this),Mt(this,e,en).call(this)),Mt(this,e,ge).call(this))};this.parent.addCommands({cmd:vt,undo:Tt,mustExec:!0})},ce=function(){if(this.isEmpty()){Mt(this,e,nn).call(this);return}Mt(this,e,_n).call(this);const{canvas:D,ctx:g}=this;g.setTransform(1,0,0,1,0,0),g.clearRect(0,0,D.width,D.height),Mt(this,e,nn).call(this);for(const L of this.bezierPath2D)g.stroke(L)},An=function(D){Mt(this,e,Hn).call(this,D.offsetX,D.offsetY),this.canvas.removeEventListener("pointerleave",R(this,v)),this.canvas.removeEventListener("pointermove",R(this,S)),this.parent.addToAnnotationStorage(this)},tn=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",A._l10nPromise.get("editor_ink_canvas_aria_label").then(D=>{var g;return(g=this.canvas)==null?void 0:g.setAttribute("aria-label",D)}),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},en=function(){Bt(this,m,new ResizeObserver(D=>{const g=D[0].contentRect;g.width&&g.height&&this.setDimensions(g.width,g.height)})),R(this,m).observe(this.div)},pe=function(){if(!R(this,a))return;const[D,g]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*D),this.canvas.height=Math.ceil(this.height*g),Mt(this,e,nn).call(this)},yn=function(D,g){const L=Mt(this,e,sn).call(this),At=(D-L)/R(this,T),H=(g-L)/R(this,w);this.scaleFactor=Math.min(At,H)},nn=function(){const D=Mt(this,e,sn).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+D,this.translationY*this.scaleFactor+D)},d=new WeakSet,En=function(D){const g=new Path2D;for(let L=0,At=D.length;L<At;L++){const[H,Q,vt,Tt]=D[L];L===0&&g.moveTo(...H),g.bezierCurveTo(Q[0],Q[1],vt[0],vt[1],Tt[0],Tt[1])}return g},zn=function(D,g,L,At){const Q=[],vt=this.thickness/2;let Tt,It;for(const kt of this.paths){Tt=[],It=[];for(let Ht=0,Wt=kt.length;Ht<Wt;Ht++){const[jt,Xt,Vt,te]=kt[Ht],Gt=D*(jt[0]+g)+vt,Yt=At-D*(jt[1]+L)-vt,Kt=D*(Xt[0]+g)+vt,Qt=At-D*(Xt[1]+L)-vt,le=D*(Vt[0]+g)+vt,de=At-D*(Vt[1]+L)-vt,he=D*(te[0]+g)+vt,Dt=At-D*(te[1]+L)-vt;Ht===0&&(Tt.push(Gt,Yt),It.push(Gt,Yt)),Tt.push(Kt,Qt,le,de,he,Dt),Mt(this,e,Xn).call(this,Gt,Yt,Kt,Qt,le,de,he,Dt,4,It)}Q.push({bezier:Tt,points:It})}return Q},Xn=function(D,g,L,At,H,Q,vt,Tt,It,kt){if(Mt(this,e,Gn).call(this,D,g,L,At,H,Q,vt,Tt)){kt.push(vt,Tt);return}for(let Ht=1;Ht<It-1;Ht++){const Wt=Ht/It,jt=1-Wt;let Xt=Wt*D+jt*L,Vt=Wt*g+jt*At,te=Wt*L+jt*H,Gt=Wt*At+jt*Q;const Yt=Wt*H+jt*vt,Kt=Wt*Q+jt*Tt;Xt=Wt*Xt+jt*te,Vt=Wt*Vt+jt*Gt,te=Wt*te+jt*Yt,Gt=Wt*Gt+jt*Kt,Xt=Wt*Xt+jt*te,Vt=Wt*Vt+jt*Gt,kt.push(Xt,Vt)}kt.push(vt,Tt)},Gn=function(D,g,L,At,H,Q,vt,Tt){const kt=(3*L-2*D-vt)**2,Ht=(3*At-2*g-Tt)**2,Wt=(3*H-D-2*vt)**2,jt=(3*Q-g-2*Tt)**2;return Math.max(kt,Wt)+Math.max(Ht,jt)<=10},Cn=function(){let D=1/0,g=-1/0,L=1/0,At=-1/0;for(const H of this.paths)for(const[Q,vt,Tt,It]of H){const kt=f.Util.bezierBoundingBox(...Q,...vt,...Tt,...It);D=Math.min(D,kt[0]),L=Math.min(L,kt[1]),g=Math.max(g,kt[2]),At=Math.max(At,kt[3])}return[D,L,g,At]},sn=function(){return R(this,r)?Math.ceil(this.thickness*this.parent.scaleFactor):0},ge=function(D=!1){if(this.isEmpty())return;if(!R(this,r)){Mt(this,e,ce).call(this);return}const g=Mt(this,e,Cn).call(this),L=Mt(this,e,sn).call(this);Bt(this,T,Math.max(K,g[2]-g[0])),Bt(this,w,Math.max(K,g[3]-g[1]));const At=Math.ceil(L+R(this,T)*this.scaleFactor),H=Math.ceil(L+R(this,w)*this.scaleFactor),[Q,vt]=this.parent.viewportBaseDimensions;this.width=At/Q,this.height=H/vt,Bt(this,b,At/H),Mt(this,e,vn).call(this);const Tt=this.translationX,It=this.translationY;this.translationX=-g[0],this.translationY=-g[1],Mt(this,e,pe).call(this),Mt(this,e,ce).call(this),Bt(this,l,At),Bt(this,n,H),this.setDims(At,H);const kt=D?L/this.scaleFactor/2:0;this.translate(Tt-this.translationX-kt,It-this.translationY-kt)},vn=function(){const{style:D}=this.div;R(this,b)>=1?(D.minHeight=`${K}px`,D.minWidth=`${Math.round(R(this,b)*K)}px`):(D.minWidth=`${K}px`,D.minHeight=`${Math.round(K/R(this,b))}px`)},Lt(A,d),se(A,"_defaultColor",null),se(A,"_defaultOpacity",1),se(A,"_defaultThickness",1),se(A,"_l10nPromise"),se(A,"_type","ink");let M=A;o.InkEditor=M}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.fitCurve=void 0;const f=y(26);o.fitCurve=f}),(p=>{function o(c,t,r){if(!Array.isArray(c))throw new TypeError("First argument should be an array");if(c.forEach(l=>{if(!Array.isArray(l)||l.some(n=>typeof n!="number")||l.length!==c[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")}),c=c.filter((l,n)=>n===0||!l.every((i,e)=>i===c[n-1][e])),c.length<2)return[];const a=c.length,F=T(c[1],c[0]),m=T(c[a-2],c[a-1]);return y(c,F,m,t,r)}function y(c,t,r,a,F){var l,n,i,e,E,x,N,I,St,Pt,bt,V,O;if(c.length===2)return V=S.vectorLen(S.subtract(c[0],c[1]))/3,l=[c[0],S.addArrays(c[0],S.mulItems(t,V)),S.addArrays(c[1],S.mulItems(r,V)),c[1]],[l];if(n=K(c),[l,e,x]=f(c,n,n,t,r,F),e===0||e<a)return[l];if(e<a*a)for(i=n,E=e,N=x,O=0;O<20;O++){if(i=Y(l,c,i),[l,e,x]=f(c,n,i,t,r,F),e<a)return[l];if(x===N){let z=e/E;if(z>.9999&&z<1.0001)break}E=e,N=x}return bt=[],I=S.subtract(c[x-1],c[x+1]),I.every(z=>z===0)&&(I=S.subtract(c[x-1],c[x]),[I[0],I[1]]=[-I[1],I[0]]),St=S.normalize(I),Pt=S.mulItems(St,-1),bt=bt.concat(y(c.slice(0,x+1),t,St,a,F)),bt=bt.concat(y(c.slice(x),Pt,r,a,F)),bt}function f(c,t,r,a,F,m){var l,n,i;return l=_(c,r,a,F),[n,i]=M(c,l,t),m&&m({bez:l,points:c,params:t,maxErr:n,maxPoint:i}),[l,n,i]}function _(c,t,r,a){var F,m,l,n,i,e,E,x,N,I,St,Pt,bt,V,O,z,G,_t=c[0],wt=c[c.length-1];for(F=[_t,null,null,wt],m=S.zeros_Xx2x2(t.length),bt=0,V=t.length;bt<V;bt++)z=t[bt],G=1-z,l=m[bt],l[0]=S.mulItems(r,3*z*(G*G)),l[1]=S.mulItems(a,3*G*(z*z));for(n=[[0,0],[0,0]],i=[0,0],bt=0,V=c.length;bt<V;bt++)z=t[bt],l=m[bt],n[0][0]+=S.dot(l[0],l[0]),n[0][1]+=S.dot(l[0],l[1]),n[1][0]+=S.dot(l[0],l[1]),n[1][1]+=S.dot(l[1],l[1]),O=S.subtract(c[bt],v.q([_t,_t,wt,wt],z)),i[0]+=S.dot(l[0],O),i[1]+=S.dot(l[1],O);return e=n[0][0]*n[1][1]-n[1][0]*n[0][1],E=n[0][0]*i[1]-n[1][0]*i[0],x=i[0]*n[1][1]-i[1]*n[0][1],N=e===0?0:x/e,I=e===0?0:E/e,Pt=S.vectorLen(S.subtract(_t,wt)),St=1e-6*Pt,N<St||I<St?(F[1]=S.addArrays(_t,S.mulItems(r,Pt/3)),F[2]=S.addArrays(wt,S.mulItems(a,Pt/3))):(F[1]=S.addArrays(_t,S.mulItems(r,N)),F[2]=S.addArrays(wt,S.mulItems(a,I))),F}function Y(c,t,r){return r.map((a,F)=>W(c,t[F],a))}function W(c,t,r){var a=S.subtract(v.q(c,r),t),F=v.qprime(c,r),m=S.mulMatrix(a,F),l=S.sum(S.squareItems(F))+2*S.mulMatrix(a,v.qprimeprime(c,r));return l===0?r:r-m/l}function K(c){var t=[],r,a,F;return c.forEach((m,l)=>{r=l?a+S.vectorLen(S.subtract(m,F)):0,t.push(r),a=r,F=m}),t=t.map(m=>m/a),t}function M(c,t,r){var a,F,m,l,n,i,e,E;F=0,m=Math.floor(c.length/2);const x=b(t,10);for(n=0,i=c.length;n<i;n++)e=c[n],E=w(t,r[n],x,10),l=S.subtract(v.q(t,E),e),a=l[0]*l[0]+l[1]*l[1],a>F&&(F=a,m=n);return[F,m]}var b=function(c,t){for(var r,a=[0],F=c[0],m=0,l=1;l<=t;l++)r=v.q(c,l/t),m+=S.vectorLen(S.subtract(r,F)),a.push(m),F=r;return a=a.map(n=>n/m),a};function w(c,t,r,a){if(t<0)return 0;if(t>1)return 1;for(var F,m,l,n,i,e=1;e<=a;e++)if(t<=r[e]){n=(e-1)/a,l=e/a,m=r[e-1],F=r[e],i=(t-m)/(F-m)*(l-n)+n;break}return i}function T(c,t){return S.normalize(S.subtract(c,t))}class S{static zeros_Xx2x2(t){for(var r=[];t--;)r.push([0,0]);return r}static mulItems(t,r){return t.map(a=>a*r)}static mulMatrix(t,r){return t.reduce((a,F,m)=>a+F*r[m],0)}static subtract(t,r){return t.map((a,F)=>a-r[F])}static addArrays(t,r){return t.map((a,F)=>a+r[F])}static addItems(t,r){return t.map(a=>a+r)}static sum(t){return t.reduce((r,a)=>r+a)}static dot(t,r){return S.mulMatrix(t,r)}static vectorLen(t){return Math.hypot(...t)}static divItems(t,r){return t.map(a=>a/r)}static squareItems(t){return t.map(r=>r*r)}static normalize(t){return this.divItems(t,this.vectorLen(t))}}class v{static q(t,r){var a=1-r,F=S.mulItems(t[0],a*a*a),m=S.mulItems(t[1],3*a*a*r),l=S.mulItems(t[2],3*a*r*r),n=S.mulItems(t[3],r*r*r);return S.addArrays(S.addArrays(F,m),S.addArrays(l,n))}static qprime(t,r){var a=1-r,F=S.mulItems(S.subtract(t[1],t[0]),3*a*a),m=S.mulItems(S.subtract(t[2],t[1]),6*a*r),l=S.mulItems(S.subtract(t[3],t[2]),3*r*r);return S.addArrays(S.addArrays(F,m),l)}static qprimeprime(t,r){return S.addArrays(S.mulItems(S.addArrays(S.subtract(t[2],S.mulItems(t[1],2)),t[0]),6*(1-r)),S.mulItems(S.addArrays(S.subtract(t[3],S.mulItems(t[2],2)),t[1]),6*r))}}p.exports=o,p.exports.fitCubic=y,p.exports.createTangent=T}),((p,o,y)=>{var d,Fn,Sn,xn;Object.defineProperty(o,"__esModule",{value:!0}),o.AnnotationLayer=void 0;var f=y(1),_=y(8),Y=y(5),W=y(28),K=y(29);const M=1e3,b=9,w=new WeakSet;function T($){return{width:$[2]-$[0],height:$[3]-$[1]}}class S{static create(s){switch(s.data.annotationType){case f.AnnotationType.LINK:return new c(s);case f.AnnotationType.TEXT:return new t(s);case f.AnnotationType.WIDGET:switch(s.data.fieldType){case"Tx":return new a(s);case"Btn":return s.data.radioButton?new m(s):s.data.checkBox?new F(s):new l(s);case"Ch":return new n(s)}return new r(s);case f.AnnotationType.POPUP:return new i(s);case f.AnnotationType.FREETEXT:return new E(s);case f.AnnotationType.LINE:return new x(s);case f.AnnotationType.SQUARE:return new N(s);case f.AnnotationType.CIRCLE:return new I(s);case f.AnnotationType.POLYLINE:return new St(s);case f.AnnotationType.CARET:return new bt(s);case f.AnnotationType.INK:return new V(s);case f.AnnotationType.POLYGON:return new Pt(s);case f.AnnotationType.HIGHLIGHT:return new O(s);case f.AnnotationType.UNDERLINE:return new z(s);case f.AnnotationType.SQUIGGLY:return new G(s);case f.AnnotationType.STRIKEOUT:return new _t(s);case f.AnnotationType.STAMP:return new wt(s);case f.AnnotationType.FILEATTACHMENT:return new Ot(s);default:return new v(s)}}}class v{constructor(s,{isRenderable:h=!1,ignoreBorder:C=!1,createQuadrilaterals:A=!1}={}){this.isRenderable=h,this.data=s.data,this.layer=s.layer,this.page=s.page,this.viewport=s.viewport,this.linkService=s.linkService,this.downloadManager=s.downloadManager,this.imageResourcesPath=s.imageResourcesPath,this.renderForms=s.renderForms,this.svgFactory=s.svgFactory,this.annotationStorage=s.annotationStorage,this.enableScripting=s.enableScripting,this.hasJSActions=s.hasJSActions,this._fieldObjects=s.fieldObjects,this._mouseState=s.mouseState,h&&(this.container=this._createContainer(C)),A&&(this.quadrilaterals=this._createQuadrilaterals(C))}_createContainer(s=!1){const h=this.data,C=this.page,A=this.viewport,k=document.createElement("section"),{width:B,height:D}=T(h.rect),[g,L,At,H]=A.viewBox,Q=At-g,vt=H-L;k.setAttribute("data-annotation-id",h.id);const Tt=f.Util.normalizeRect([h.rect[0],C.view[3]-h.rect[1]+C.view[1],h.rect[2],C.view[3]-h.rect[3]+C.view[1]]);if(!s&&h.borderStyle.width>0){k.style.borderWidth=`${h.borderStyle.width}px`;const kt=h.borderStyle.horizontalCornerRadius,Ht=h.borderStyle.verticalCornerRadius;if(kt>0||Ht>0){const jt=`calc(${kt}px * var(--scale-factor)) / calc(${Ht}px * var(--scale-factor))`;k.style.borderRadius=jt}else if(this instanceof m){const jt=`calc(${B}px * var(--scale-factor)) / calc(${D}px * var(--scale-factor))`;k.style.borderRadius=jt}switch(h.borderStyle.style){case f.AnnotationBorderStyleType.SOLID:k.style.borderStyle="solid";break;case f.AnnotationBorderStyleType.DASHED:k.style.borderStyle="dashed";break;case f.AnnotationBorderStyleType.BEVELED:(0,f.warn)("Unimplemented border style: beveled");break;case f.AnnotationBorderStyleType.INSET:(0,f.warn)("Unimplemented border style: inset");break;case f.AnnotationBorderStyleType.UNDERLINE:k.style.borderBottomStyle="solid";break}const Wt=h.borderColor||null;Wt?k.style.borderColor=f.Util.makeHexColor(Wt[0]|0,Wt[1]|0,Wt[2]|0):k.style.borderWidth=0}k.style.left=`${100*(Tt[0]-g)/Q}%`,k.style.top=`${100*(Tt[1]-L)/vt}%`;const{rotation:It}=h;return h.hasOwnCanvas||It===0?(k.style.width=`${100*B/Q}%`,k.style.height=`${100*D/vt}%`):this.setRotation(It,k),k}setRotation(s,h=this.container){const[C,A,k,B]=this.viewport.viewBox,D=k-C,g=B-A,{width:L,height:At}=T(this.data.rect);let H,Q;s%180===0?(H=100*L/D,Q=100*At/g):(H=100*At/D,Q=100*L/g),h.style.width=`${H}%`,h.style.height=`${Q}%`,h.setAttribute("data-main-rotation",(360-s)%360)}get _commonActions(){const s=(h,C,A)=>{const k=A.detail[h];A.target.style[C]=W.ColorConverters[`${k[0]}_HTML`](k.slice(1))};return(0,f.shadow)(this,"_commonActions",{display:h=>{const C=h.detail.display%2===1;this.container.style.visibility=C?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:C,print:h.detail.display===0||h.detail.display===3})},print:h=>{this.annotationStorage.setValue(this.data.id,{print:h.detail.print})},hidden:h=>{this.container.style.visibility=h.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:h.detail.hidden})},focus:h=>{setTimeout(()=>h.target.focus({preventScroll:!1}),0)},userName:h=>{h.target.title=h.detail.userName},readonly:h=>{h.detail.readonly?h.target.setAttribute("readonly",""):h.target.removeAttribute("readonly")},required:h=>{this._setRequired(h.target,h.detail.required)},bgColor:h=>{s("bgColor","backgroundColor",h)},fillColor:h=>{s("fillColor","backgroundColor",h)},fgColor:h=>{s("fgColor","color",h)},textColor:h=>{s("textColor","color",h)},borderColor:h=>{s("borderColor","borderColor",h)},strokeColor:h=>{s("strokeColor","borderColor",h)},rotation:h=>{const C=h.detail.rotation;this.setRotation(C),this.annotationStorage.setValue(this.data.id,{rotation:C})}})}_dispatchEventFromSandbox(s,h){const C=this._commonActions;for(const A of Object.keys(h.detail)){const k=s[A]||C[A];k&&k(h)}}_setDefaultPropertiesFromJS(s){if(!this.enableScripting)return;const h=this.annotationStorage.getRawValue(this.data.id);if(!h)return;const C=this._commonActions;for(const[A,k]of Object.entries(h)){const B=C[A];if(B){const D={detail:{[A]:k},target:s};B(D),delete h[A]}}}_createQuadrilaterals(s=!1){if(!this.data.quadPoints)return null;const h=[],C=this.data.rect;for(const A of this.data.quadPoints)this.data.rect=[A[2].x,A[2].y,A[1].x,A[1].y],h.push(this._createContainer(s));return this.data.rect=C,h}_createPopup(s,h){let C=this.container;this.quadrilaterals&&(s=s||this.quadrilaterals,C=this.quadrilaterals[0]),s||(s=document.createElement("div"),s.className="popupTriggerArea",C.append(s));const k=new e({container:C,trigger:s,color:h.color,titleObj:h.titleObj,modificationDate:h.modificationDate,contentsObj:h.contentsObj,richText:h.richText,hideWrapper:!0}).render();k.style.left="100%",C.append(k)}_renderQuadrilaterals(s){for(const h of this.quadrilaterals)h.className=s;return this.quadrilaterals}render(){(0,f.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(s,h=null){const C=[];if(this._fieldObjects){const A=this._fieldObjects[s];if(A)for(const{page:k,id:B,exportValues:D}of A){if(k===-1||B===h)continue;const g=typeof D=="string"?D:null,L=document.querySelector(`[data-element-id="${B}"]`);if(L&&!w.has(L)){(0,f.warn)(`_getElementsByName - element not allowed: ${B}`);continue}C.push({id:B,exportValue:g,domElement:L})}return C}for(const A of document.getElementsByName(s)){const{id:k,exportValue:B}=A;k!==h&&w.has(A)&&C.push({id:k,exportValue:B,domElement:A})}return C}static get platform(){const s=typeof navigator<"u"?navigator.platform:"";return(0,f.shadow)(this,"platform",{isWin:s.includes("Win"),isMac:s.includes("Mac")})}}class c extends v{constructor(s,h=null){super(s,{isRenderable:!0,ignoreBorder:!!(h!=null&&h.ignoreBorder),createQuadrilaterals:!0}),this.isTooltipOnly=s.data.isTooltipOnly}render(){const{data:s,linkService:h}=this,C=document.createElement("a");C.setAttribute("data-element-id",s.id);let A=!1;return s.url?(h.addLinkAttributes(C,s.url,s.newWindow),A=!0):s.action?(this._bindNamedAction(C,s.action),A=!0):s.dest?(this._bindLink(C,s.dest),A=!0):(s.actions&&(s.actions.Action||s.actions["Mouse Up"]||s.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(C,s),A=!0),s.resetForm?(this._bindResetFormAction(C,s.resetForm),A=!0):this.isTooltipOnly&&!A&&(this._bindLink(C,""),A=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((k,B)=>{const D=B===0?C:C.cloneNode();return k.append(D),k}):(this.container.className="linkAnnotation",A&&this.container.append(C),this.container)}_bindLink(s,h){s.href=this.linkService.getDestinationHash(h),s.onclick=()=>(h&&this.linkService.goToDestination(h),!1),(h||h==="")&&(s.className="internalLink")}_bindNamedAction(s,h){s.href=this.linkService.getAnchorUrl(""),s.onclick=()=>(this.linkService.executeNamedAction(h),!1),s.className="internalLink"}_bindJSAction(s,h){s.href=this.linkService.getAnchorUrl("");const C=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const A of Object.keys(h.actions)){const k=C.get(A);k&&(s[k]=()=>{var B;return(B=this.linkService.eventBus)==null||B.dispatch("dispatcheventinsandbox",{source:this,detail:{id:h.id,name:A}}),!1})}s.onclick||(s.onclick=()=>!1),s.className="internalLink"}_bindResetFormAction(s,h){const C=s.onclick;if(C||(s.href=this.linkService.getAnchorUrl("")),s.className="internalLink",!this._fieldObjects){(0,f.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),C||(s.onclick=()=>!1);return}s.onclick=()=>{var At;C&&C();const{fields:A,refs:k,include:B}=h,D=[];if(A.length!==0||k.length!==0){const H=new Set(k);for(const Q of A){const vt=this._fieldObjects[Q]||[];for(const{id:Tt}of vt)H.add(Tt)}for(const Q of Object.values(this._fieldObjects))for(const vt of Q)H.has(vt.id)===B&&D.push(vt)}else for(const H of Object.values(this._fieldObjects))D.push(...H);const g=this.annotationStorage,L=[];for(const H of D){const{id:Q}=H;switch(L.push(Q),H.type){case"text":{const Tt=H.defaultValue||"";g.setValue(Q,{value:Tt});break}case"checkbox":case"radiobutton":{const Tt=H.defaultValue===H.exportValues;g.setValue(Q,{value:Tt});break}case"combobox":case"listbox":{const Tt=H.defaultValue||"";g.setValue(Q,{value:Tt});break}default:continue}const vt=document.querySelector(`[data-element-id="${Q}"]`);if(vt){if(!w.has(vt)){(0,f.warn)(`_bindResetFormAction - element not allowed: ${Q}`);continue}}else continue;vt.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((At=this.linkService.eventBus)==null||At.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:L,name:"ResetForm"}})),!1}}}class t extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h})}render(){this.container.className="textAnnotation";const s=document.createElement("img");return s.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",s.alt="[{{type}} Annotation]",s.dataset.l10nId="text_annotation_type",s.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(s,this.data),this.container.append(s),this.container}}class r extends v{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(s){const{isWin:h,isMac:C}=v.platform;return h&&s.ctrlKey||C&&s.metaKey}_setEventListener(s,h,C,A){h.includes("mouse")?s.addEventListener(h,k=>{var B;(B=this.linkService.eventBus)==null||B.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:C,value:A(k),shift:k.shiftKey,modifier:this._getKeyModifier(k)}})}):s.addEventListener(h,k=>{var B;(B=this.linkService.eventBus)==null||B.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:C,value:A(k)}})})}_setEventListeners(s,h,C){var A;for(const[k,B]of h)(B==="Action"||(A=this.data.actions)!=null&&A[B])&&this._setEventListener(s,k,B,C)}_setBackgroundColor(s){const h=this.data.backgroundColor||null;s.style.backgroundColor=h===null?"transparent":f.Util.makeHexColor(h[0],h[1],h[2])}_setTextStyle(s){const h=["left","center","right"],{fontColor:C}=this.data.defaultAppearanceData,A=this.data.defaultAppearanceData.fontSize||b,k=s.style;let B;if(this.data.multiLine){const D=Math.abs(this.data.rect[3]-this.data.rect[1]),g=Math.round(D/(f.LINE_FACTOR*A))||1,L=D/g;B=Math.min(A,Math.round(L/f.LINE_FACTOR))}else{const D=Math.abs(this.data.rect[3]-this.data.rect[1]);B=Math.min(A,Math.round(D/f.LINE_FACTOR))}k.fontSize=`calc(${B}px * var(--scale-factor))`,k.color=f.Util.makeHexColor(C[0],C[1],C[2]),this.data.textAlignment!==null&&(k.textAlign=h[this.data.textAlignment])}_setRequired(s,h){h?s.setAttribute("required",!0):s.removeAttribute("required"),s.setAttribute("aria-required",h)}}class a extends r{constructor(s){const h=s.renderForms||!s.data.hasAppearance&&!!s.data.fieldValue;super(s,{isRenderable:h})}setPropertyOnSiblings(s,h,C,A){const k=this.annotationStorage;for(const B of this._getElementsByName(s.name,s.id))B.domElement&&(B.domElement[h]=C),k.setValue(B.id,{[A]:C})}render(){var A;const s=this.annotationStorage,h=this.data.id;this.container.className="textWidgetAnnotation";let C=null;if(this.renderForms){const k=s.getValue(h,{value:this.data.fieldValue});let B=k.formattedValue||k.value||"";const D=s.getValue(h,{charLimit:this.data.maxLen}).charLimit;D&&B.length>D&&(B=B.slice(0,D));const g={userValue:B,formattedValue:null,valueOnFocus:""};this.data.multiLine?(C=document.createElement("textarea"),C.textContent=B,this.data.doNotScroll&&(C.style.overflowY="hidden")):(C=document.createElement("input"),C.type="text",C.setAttribute("value",B),this.data.doNotScroll&&(C.style.overflowX="hidden")),w.add(C),C.setAttribute("data-element-id",h),C.disabled=this.data.readOnly,C.name=this.data.fieldName,C.tabIndex=M,this._setRequired(C,this.data.required),D&&(C.maxLength=D),C.addEventListener("input",At=>{s.setValue(h,{value:At.target.value}),this.setPropertyOnSiblings(C,"value",At.target.value,"value")}),C.addEventListener("resetform",At=>{const H=this.data.defaultFieldValue??"";C.value=g.userValue=H,g.formattedValue=null});let L=At=>{const{formattedValue:H}=g;H!=null&&(At.target.value=H),At.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){C.addEventListener("focus",H=>{g.userValue&&(H.target.value=g.userValue),g.valueOnFocus=H.target.value}),C.addEventListener("updatefromsandbox",H=>{const Q={value(vt){g.userValue=vt.detail.value??"",s.setValue(h,{value:g.userValue.toString()}),vt.target.value=g.userValue},formattedValue(vt){const{formattedValue:Tt}=vt.detail;g.formattedValue=Tt,Tt!=null&&vt.target!==document.activeElement&&(vt.target.value=Tt),s.setValue(h,{formattedValue:Tt})},selRange(vt){vt.target.setSelectionRange(...vt.detail.selRange)},charLimit:vt=>{var Ht;const{charLimit:Tt}=vt.detail,{target:It}=vt;if(Tt===0){It.removeAttribute("maxLength");return}It.setAttribute("maxLength",Tt);let kt=g.userValue;!kt||kt.length<=Tt||(kt=kt.slice(0,Tt),It.value=g.userValue=kt,s.setValue(h,{value:kt}),(Ht=this.linkService.eventBus)==null||Ht.dispatch("dispatcheventinsandbox",{source:this,detail:{id:h,name:"Keystroke",value:kt,willCommit:!0,commitKey:1,selStart:It.selectionStart,selEnd:It.selectionEnd}}))}};this._dispatchEventFromSandbox(Q,H)}),C.addEventListener("keydown",H=>{var Tt;let Q=-1;if(H.key==="Escape"?Q=0:H.key==="Enter"?Q=2:H.key==="Tab"&&(Q=3),Q===-1)return;const{value:vt}=H.target;g.valueOnFocus!==vt&&(g.userValue=vt,(Tt=this.linkService.eventBus)==null||Tt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:h,name:"Keystroke",value:vt,willCommit:!0,commitKey:Q,selStart:H.target.selectionStart,selEnd:H.target.selectionEnd}}))});const At=L;L=null,C.addEventListener("blur",H=>{var vt;const{value:Q}=H.target;g.userValue=Q,this._mouseState.isDown&&g.valueOnFocus!==Q&&((vt=this.linkService.eventBus)==null||vt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:h,name:"Keystroke",value:Q,willCommit:!0,commitKey:1,selStart:H.target.selectionStart,selEnd:H.target.selectionEnd}})),At(H)}),(A=this.data.actions)!=null&&A.Keystroke&&C.addEventListener("beforeinput",H=>{var jt;const{data:Q,target:vt}=H,{value:Tt,selectionStart:It,selectionEnd:kt}=vt;let Ht=It,Wt=kt;switch(H.inputType){case"deleteWordBackward":{const Xt=Tt.substring(0,It).match(/\w*[^\w]*$/);Xt&&(Ht-=Xt[0].length);break}case"deleteWordForward":{const Xt=Tt.substring(It).match(/^[^\w]*\w*/);Xt&&(Wt+=Xt[0].length);break}case"deleteContentBackward":It===kt&&(Ht-=1);break;case"deleteContentForward":It===kt&&(Wt+=1);break}H.preventDefault(),(jt=this.linkService.eventBus)==null||jt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:h,name:"Keystroke",value:Tt,change:Q||"",willCommit:!1,selStart:Ht,selEnd:Wt}})}),this._setEventListeners(C,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],H=>H.target.value)}if(L&&C.addEventListener("blur",L),this.data.comb){const H=(this.data.rect[2]-this.data.rect[0])/D;C.classList.add("comb"),C.style.letterSpacing=`calc(${H}px * var(--scale-factor) - 1ch)`}}else C=document.createElement("div"),C.textContent=this.data.fieldValue,C.style.verticalAlign="middle",C.style.display="table-cell";return this._setTextStyle(C),this._setBackgroundColor(C),this._setDefaultPropertiesFromJS(C),this.container.append(C),this.container}}class F extends r{constructor(s){super(s,{isRenderable:s.renderForms})}render(){const s=this.annotationStorage,h=this.data,C=h.id;let A=s.getValue(C,{value:h.exportValue===h.fieldValue}).value;typeof A=="string"&&(A=A!=="Off",s.setValue(C,{value:A})),this.container.className="buttonWidgetAnnotation checkBox";const k=document.createElement("input");return w.add(k),k.setAttribute("data-element-id",C),k.disabled=h.readOnly,this._setRequired(k,this.data.required),k.type="checkbox",k.name=h.fieldName,A&&k.setAttribute("checked",!0),k.setAttribute("exportValue",h.exportValue),k.tabIndex=M,k.addEventListener("change",B=>{const{name:D,checked:g}=B.target;for(const L of this._getElementsByName(D,C)){const At=g&&L.exportValue===h.exportValue;L.domElement&&(L.domElement.checked=At),s.setValue(L.id,{value:At})}s.setValue(C,{value:g})}),k.addEventListener("resetform",B=>{const D=h.defaultFieldValue||"Off";B.target.checked=D===h.exportValue}),this.enableScripting&&this.hasJSActions&&(k.addEventListener("updatefromsandbox",B=>{const D={value(g){g.target.checked=g.detail.value!=="Off",s.setValue(C,{value:g.target.checked})}};this._dispatchEventFromSandbox(D,B)}),this._setEventListeners(k,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],B=>B.target.checked)),this._setBackgroundColor(k),this._setDefaultPropertiesFromJS(k),this.container.append(k),this.container}}class m extends r{constructor(s){super(s,{isRenderable:s.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const s=this.annotationStorage,h=this.data,C=h.id;let A=s.getValue(C,{value:h.fieldValue===h.buttonValue}).value;typeof A=="string"&&(A=A!==h.buttonValue,s.setValue(C,{value:A}));const k=document.createElement("input");if(w.add(k),k.setAttribute("data-element-id",C),k.disabled=h.readOnly,this._setRequired(k,this.data.required),k.type="radio",k.name=h.fieldName,A&&k.setAttribute("checked",!0),k.tabIndex=M,k.addEventListener("change",B=>{const{name:D,checked:g}=B.target;for(const L of this._getElementsByName(D,C))s.setValue(L.id,{value:!1});s.setValue(C,{value:g})}),k.addEventListener("resetform",B=>{const D=h.defaultFieldValue;B.target.checked=D!=null&&D===h.buttonValue}),this.enableScripting&&this.hasJSActions){const B=h.buttonValue;k.addEventListener("updatefromsandbox",D=>{const g={value:L=>{const At=B===L.detail.value;for(const H of this._getElementsByName(L.target.name)){const Q=At&&H.id===C;H.domElement&&(H.domElement.checked=Q),s.setValue(H.id,{value:Q})}}};this._dispatchEventFromSandbox(g,D)}),this._setEventListeners(k,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],D=>D.target.checked)}return this._setBackgroundColor(k),this._setDefaultPropertiesFromJS(k),this.container.append(k),this.container}}class l extends c{constructor(s){super(s,{ignoreBorder:s.data.hasAppearance})}render(){const s=super.render();s.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(s.title=this.data.alternativeText);const h=s.lastChild;return this.enableScripting&&this.hasJSActions&&h&&(this._setDefaultPropertiesFromJS(h),h.addEventListener("updatefromsandbox",C=>{this._dispatchEventFromSandbox({},C)})),s}}class n extends r{constructor(s){super(s,{isRenderable:s.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const s=this.annotationStorage,h=this.data.id,C=s.getValue(h,{value:this.data.fieldValue}),A=document.createElement("select");w.add(A),A.setAttribute("data-element-id",h),A.disabled=this.data.readOnly,this._setRequired(A,this.data.required),A.name=this.data.fieldName,A.tabIndex=M;let k=this.data.combo&&this.data.options.length>0;this.data.combo||(A.size=this.data.options.length,this.data.multiSelect&&(A.multiple=!0)),A.addEventListener("resetform",L=>{const At=this.data.defaultFieldValue;for(const H of A.options)H.selected=H.value===At});for(const L of this.data.options){const At=document.createElement("option");At.textContent=L.displayValue,At.value=L.exportValue,C.value.includes(L.exportValue)&&(At.setAttribute("selected",!0),k=!1),A.append(At)}let B=null;if(k){const L=document.createElement("option");L.value=" ",L.setAttribute("hidden",!0),L.setAttribute("selected",!0),A.prepend(L),B=()=>{L.remove(),A.removeEventListener("input",B),B=null},A.addEventListener("input",B)}const D=(L,At)=>{const H=At?"value":"textContent",Q=L.target.options;return L.target.multiple?Array.prototype.filter.call(Q,vt=>vt.selected).map(vt=>vt[H]):Q.selectedIndex===-1?null:Q[Q.selectedIndex][H]},g=L=>{const At=L.target.options;return Array.prototype.map.call(At,H=>({displayValue:H.textContent,exportValue:H.value}))};return this.enableScripting&&this.hasJSActions?(A.addEventListener("updatefromsandbox",L=>{const At={value(H){B==null||B();const Q=H.detail.value,vt=new Set(Array.isArray(Q)?Q:[Q]);for(const Tt of A.options)Tt.selected=vt.has(Tt.value);s.setValue(h,{value:D(H,!0)})},multipleSelection(H){A.multiple=!0},remove(H){const Q=A.options,vt=H.detail.remove;Q[vt].selected=!1,A.remove(vt),Q.length>0&&Array.prototype.findIndex.call(Q,It=>It.selected)===-1&&(Q[0].selected=!0),s.setValue(h,{value:D(H,!0),items:g(H)})},clear(H){for(;A.length!==0;)A.remove(0);s.setValue(h,{value:null,items:[]})},insert(H){const{index:Q,displayValue:vt,exportValue:Tt}=H.detail.insert,It=A.children[Q],kt=document.createElement("option");kt.textContent=vt,kt.value=Tt,It?It.before(kt):A.append(kt),s.setValue(h,{value:D(H,!0),items:g(H)})},items(H){const{items:Q}=H.detail;for(;A.length!==0;)A.remove(0);for(const vt of Q){const{displayValue:Tt,exportValue:It}=vt,kt=document.createElement("option");kt.textContent=Tt,kt.value=It,A.append(kt)}A.options.length>0&&(A.options[0].selected=!0),s.setValue(h,{value:D(H,!0),items:g(H)})},indices(H){const Q=new Set(H.detail.indices);for(const vt of H.target.options)vt.selected=Q.has(vt.index);s.setValue(h,{value:D(H,!0)})},editable(H){H.target.disabled=!H.detail.editable}};this._dispatchEventFromSandbox(At,L)}),A.addEventListener("input",L=>{var Q;const At=D(L,!0),H=D(L,!1);s.setValue(h,{value:At}),(Q=this.linkService.eventBus)==null||Q.dispatch("dispatcheventinsandbox",{source:this,detail:{id:h,name:"Keystroke",value:H,changeEx:At,willCommit:!0,commitKey:1,keyDown:!1}})}),this._setEventListeners(A,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],L=>L.target.checked)):A.addEventListener("input",function(L){s.setValue(h,{value:D(L,!0)})}),this.data.combo&&this._setTextStyle(A),this._setBackgroundColor(A),this._setDefaultPropertiesFromJS(A),this.container.append(A),this.container}}class i extends v{constructor(s){var C,A,k;const h=!!((C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h})}render(){const s=["Line","Square","Circle","PolyLine","Polygon","Ink"];if(this.container.className="popupAnnotation",s.includes(this.data.parentType))return this.container;const h=`[data-annotation-id="${this.data.parentId}"]`,C=this.layer.querySelectorAll(h);if(C.length===0)return this.container;const A=new e({container:this.container,trigger:Array.from(C),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),k=this.page,B=f.Util.normalizeRect([this.data.parentRect[0],k.view[3]-this.data.parentRect[1]+k.view[1],this.data.parentRect[2],k.view[3]-this.data.parentRect[3]+k.view[1]]),D=B[0]+this.data.parentRect[2]-this.data.parentRect[0],g=B[1],[L,At,H,Q]=this.viewport.viewBox,vt=H-L,Tt=Q-At;return this.container.style.left=`${100*(D-L)/vt}%`,this.container.style.top=`${100*(g-At)/Tt}%`,this.container.append(A.render()),this.container}}class e{constructor(s){this.container=s.container,this.trigger=s.trigger,this.color=s.color,this.titleObj=s.titleObj,this.modificationDate=s.modificationDate,this.contentsObj=s.contentsObj,this.richText=s.richText,this.hideWrapper=s.hideWrapper||!1,this.pinned=!1}render(){var D,g;const h=document.createElement("div");h.className="popupWrapper",this.hideElement=this.hideWrapper?h:this.container,this.hideElement.hidden=!0;const C=document.createElement("div");C.className="popup";const A=this.color;if(A){const L=.7*(255-A[0])+A[0],At=.7*(255-A[1])+A[1],H=.7*(255-A[2])+A[2];C.style.backgroundColor=f.Util.makeHexColor(L|0,At|0,H|0)}const k=document.createElement("h1");k.dir=this.titleObj.dir,k.textContent=this.titleObj.str,C.append(k);const B=_.PDFDateString.toDateObject(this.modificationDate);if(B){const L=document.createElement("span");L.className="popupDate",L.textContent="{{date}}, {{time}}",L.dataset.l10nId="annotation_date_string",L.dataset.l10nArgs=JSON.stringify({date:B.toLocaleDateString(),time:B.toLocaleTimeString()}),C.append(L)}if((D=this.richText)!=null&&D.str&&(!((g=this.contentsObj)!=null&&g.str)||this.contentsObj.str===this.richText.str))K.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:C}),C.lastChild.className="richText popupContent";else{const L=this._formatContents(this.contentsObj);C.append(L)}Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const L of this.trigger)L.addEventListener("click",this._toggle.bind(this)),L.addEventListener("mouseover",this._show.bind(this,!1)),L.addEventListener("mouseout",this._hide.bind(this,!1));return C.addEventListener("click",this._hide.bind(this,!0)),h.append(C),h}_formatContents({str:s,dir:h}){const C=document.createElement("p");C.className="popupContent",C.dir=h;const A=s.split(/(?:\r\n?|\n)/);for(let k=0,B=A.length;k<B;++k){const D=A[k];C.append(document.createTextNode(D)),k<B-1&&C.append(document.createElement("br"))}return C}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(s=!1){s&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(s=!0){s&&(this.pinned=!1),!this.hideElement.hidden&&!this.pinned&&(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class E extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0}),this.textContent=s.data.textContent}render(){if(this.container.className="freeTextAnnotation",this.textContent){const s=document.createElement("div");s.className="annotationTextContent",s.setAttribute("role","comment");for(const h of this.textContent){const C=document.createElement("span");C.textContent=h,s.append(C)}this.container.append(s)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class x extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const s=this.data,{width:h,height:C}=T(s.rect),A=this.svgFactory.create(h,C,!0),k=this.svgFactory.createElement("svg:line");return k.setAttribute("x1",s.rect[2]-s.lineCoordinates[0]),k.setAttribute("y1",s.rect[3]-s.lineCoordinates[1]),k.setAttribute("x2",s.rect[2]-s.lineCoordinates[2]),k.setAttribute("y2",s.rect[3]-s.lineCoordinates[3]),k.setAttribute("stroke-width",s.borderStyle.width||1),k.setAttribute("stroke","transparent"),k.setAttribute("fill","transparent"),A.append(k),this.container.append(A),this._createPopup(k,s),this.container}}class N extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const s=this.data,{width:h,height:C}=T(s.rect),A=this.svgFactory.create(h,C,!0),k=s.borderStyle.width,B=this.svgFactory.createElement("svg:rect");return B.setAttribute("x",k/2),B.setAttribute("y",k/2),B.setAttribute("width",h-k),B.setAttribute("height",C-k),B.setAttribute("stroke-width",k||1),B.setAttribute("stroke","transparent"),B.setAttribute("fill","transparent"),A.append(B),this.container.append(A),this._createPopup(B,s),this.container}}class I extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const s=this.data,{width:h,height:C}=T(s.rect),A=this.svgFactory.create(h,C,!0),k=s.borderStyle.width,B=this.svgFactory.createElement("svg:ellipse");return B.setAttribute("cx",h/2),B.setAttribute("cy",C/2),B.setAttribute("rx",h/2-k/2),B.setAttribute("ry",C/2-k/2),B.setAttribute("stroke-width",k||1),B.setAttribute("stroke","transparent"),B.setAttribute("fill","transparent"),A.append(B),this.container.append(A),this._createPopup(B,s),this.container}}class St extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const s=this.data,{width:h,height:C}=T(s.rect),A=this.svgFactory.create(h,C,!0);let k=[];for(const D of s.vertices){const g=D.x-s.rect[0],L=s.rect[3]-D.y;k.push(g+","+L)}k=k.join(" ");const B=this.svgFactory.createElement(this.svgElementName);return B.setAttribute("points",k),B.setAttribute("stroke-width",s.borderStyle.width||1),B.setAttribute("stroke","transparent"),B.setAttribute("fill","transparent"),A.append(B),this.container.append(A),this._createPopup(B,s),this.container}}class Pt extends St{constructor(s){super(s),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class bt extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class V extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const s=this.data,{width:h,height:C}=T(s.rect),A=this.svgFactory.create(h,C,!0);for(const k of s.inkLists){let B=[];for(const g of k){const L=g.x-s.rect[0],At=s.rect[3]-g.y;B.push(`${L},${At}`)}B=B.join(" ");const D=this.svgFactory.createElement(this.svgElementName);D.setAttribute("points",B),D.setAttribute("stroke-width",s.borderStyle.width||1),D.setAttribute("stroke","transparent"),D.setAttribute("fill","transparent"),this._createPopup(D,s),A.append(D)}return this.container.append(A),this.container}}class O extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.className="highlightAnnotation",this.container)}}class z extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.className="underlineAnnotation",this.container)}}class G extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.className="squigglyAnnotation",this.container)}}class _t extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.className="strikeoutAnnotation",this.container)}}class wt extends v{constructor(s){var C,A,k;const h=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(A=s.data.contentsObj)!=null&&A.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:h,ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class Ot extends v{constructor(s){var A;super(s,{isRenderable:!0});const{filename:h,content:C}=this.data.file;this.filename=(0,_.getFilenameFromUrl)(h),this.content=C,(A=this.linkService.eventBus)==null||A.dispatch("fileattachmentannotation",{source:this,filename:h,content:C})}render(){var h,C;this.container.className="fileAttachmentAnnotation";const s=document.createElement("div");return s.className="popupTriggerArea",s.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&((h=this.data.titleObj)!=null&&h.str||(C=this.data.contentsObj)!=null&&C.str||this.data.richText)&&this._createPopup(s,this.data),this.container.append(s),this.container}_download(){var s;(s=this.downloadManager)==null||s.openOrDownloadData(this.container,this.content,this.filename)}}const U=class U{static render(s){var D,g;const{annotations:h,div:C,viewport:A,accessibilityManager:k}=s;Mt(this,d,Sn).call(this,C,A);let B=0;for(const L of h){if(L.annotationType!==f.AnnotationType.POPUP){const{width:H,height:Q}=T(L.rect);if(H<=0||Q<=0)continue}const At=S.create({data:L,layer:C,page:s.page,viewport:A,linkService:s.linkService,downloadManager:s.downloadManager,imageResourcesPath:s.imageResourcesPath||"",renderForms:s.renderForms!==!1,svgFactory:new _.DOMSVGFactory,annotationStorage:s.annotationStorage||new Y.AnnotationStorage,enableScripting:s.enableScripting,hasJSActions:s.hasJSActions,fieldObjects:s.fieldObjects,mouseState:s.mouseState||{isDown:!1}});if(At.isRenderable){const H=At.render();if(L.hidden&&(H.style.visibility="hidden"),Array.isArray(H))for(const Q of H)Q.style.zIndex=B++,Mt(D=U,d,Fn).call(D,Q,L.id,C,k);else H.style.zIndex=B++,At instanceof i?C.prepend(H):Mt(g=U,d,Fn).call(g,H,L.id,C,k)}}Mt(this,d,xn).call(this,C,s.annotationCanvasMap)}static update(s){const{annotationCanvasMap:h,div:C,viewport:A}=s;Mt(this,d,Sn).call(this,C,A),Mt(this,d,xn).call(this,C,h),C.hidden=!1}};d=new WeakSet,Fn=function(s,h,C,A){const k=s.firstChild||s;k.id=`${_.AnnotationPrefix}${h}`,C.append(s),A==null||A.moveElementInDOM(C,s,k,!1)},Sn=function(s,{width:h,height:C,rotation:A}){const{style:k}=s,B=A%180!==0,D=Math.floor(h)+"px",g=Math.floor(C)+"px";k.width=B?g:D,k.height=B?D:g,s.setAttribute("data-main-rotation",A)},xn=function(s,h){if(h){for(const[C,A]of h){const k=s.querySelector(`[data-annotation-id="${C}"]`);if(!k)continue;const{firstChild:B}=k;B?B.nodeName==="CANVAS"?B.replaceWith(A):B.before(A):k.append(A)}h.clear()}},Lt(U,d);let q=U;o.AnnotationLayer=q}),((p,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorConverters=void 0;function y(_){return Math.floor(Math.max(0,Math.min(1,_))*255).toString(16).padStart(2,"0")}class f{static CMYK_G([Y,W,K,M]){return["G",1-Math.min(1,.3*Y+.59*K+.11*W+M)]}static G_CMYK([Y]){return["CMYK",0,0,0,1-Y]}static G_RGB([Y]){return["RGB",Y,Y,Y]}static G_HTML([Y]){const W=y(Y);return`#${W}${W}${W}`}static RGB_G([Y,W,K]){return["G",.3*Y+.59*W+.11*K]}static RGB_HTML([Y,W,K]){const M=y(Y),b=y(W),w=y(K);return`#${M}${b}${w}`}static T_HTML(){return"#00000000"}static CMYK_RGB([Y,W,K,M]){return["RGB",1-Math.min(1,Y+M),1-Math.min(1,K+M),1-Math.min(1,W+M)]}static CMYK_HTML(Y){const W=this.CMYK_RGB(Y).slice(1);return this.RGB_HTML(W)}static RGB_CMYK([Y,W,K]){const M=1-Y,b=1-W,w=1-K,T=Math.min(M,b,w);return["CMYK",M,b,w,T]}}o.ColorConverters=f}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.XfaLayer=void 0;var f=y(20);class _{static setupStorage(W,K,M,b,w){const T=b.getValue(K,{value:null});switch(M.name){case"textarea":if(T.value!==null&&(W.textContent=T.value),w==="print")break;W.addEventListener("input",S=>{b.setValue(K,{value:S.target.value})});break;case"input":if(M.attributes.type==="radio"||M.attributes.type==="checkbox"){if(T.value===M.attributes.xfaOn?W.setAttribute("checked",!0):T.value===M.attributes.xfaOff&&W.removeAttribute("checked"),w==="print")break;W.addEventListener("change",S=>{b.setValue(K,{value:S.target.checked?S.target.getAttribute("xfaOn"):S.target.getAttribute("xfaOff")})})}else{if(T.value!==null&&W.setAttribute("value",T.value),w==="print")break;W.addEventListener("input",S=>{b.setValue(K,{value:S.target.value})})}break;case"select":if(T.value!==null)for(const S of M.children)S.attributes.value===T.value&&(S.attributes.selected=!0);W.addEventListener("input",S=>{const v=S.target.options,c=v.selectedIndex===-1?"":v[v.selectedIndex].value;b.setValue(K,{value:c})});break}}static setAttributes({html:W,element:K,storage:M=null,intent:b,linkService:w}){const{attributes:T}=K,S=W instanceof HTMLAnchorElement;T.type==="radio"&&(T.name=`${T.name}-${b}`);for(const[v,c]of Object.entries(T))if(c!=null)switch(v){case"class":c.length&&W.setAttribute(v,c.join(" "));break;case"dataId":break;case"id":W.setAttribute("data-element-id",c);break;case"style":Object.assign(W.style,c);break;case"textContent":W.textContent=c;break;default:(!S||v!=="href"&&v!=="newWindow")&&W.setAttribute(v,c)}S&&w.addLinkAttributes(W,T.href,T.newWindow),M&&T.dataId&&this.setupStorage(W,T.dataId,K,M)}static render(W){var t;const K=W.annotationStorage,M=W.linkService,b=W.xfaHtml,w=W.intent||"display",T=document.createElement(b.name);b.attributes&&this.setAttributes({html:T,element:b,intent:w,linkService:M});const S=[[b,-1,T]],v=W.div;if(v.append(T),W.viewport){const r=`matrix(${W.viewport.transform.join(",")})`;v.style.transform=r}w!=="richText"&&v.setAttribute("class","xfaLayer xfaFont");const c=[];for(;S.length>0;){const[r,a,F]=S.at(-1);if(a+1===r.children.length){S.pop();continue}const m=r.children[++S.at(-1)[1]];if(m===null)continue;const{name:l}=m;if(l==="#text"){const i=document.createTextNode(m.value);c.push(i),F.append(i);continue}let n;if((t=m==null?void 0:m.attributes)!=null&&t.xmlns?n=document.createElementNS(m.attributes.xmlns,l):n=document.createElement(l),F.append(n),m.attributes&&this.setAttributes({html:n,element:m,storage:K,intent:w,linkService:M}),m.children&&m.children.length>0)S.push([m,-1,n]);else if(m.value){const i=document.createTextNode(m.value);f.XfaText.shouldBuildText(l)&&c.push(i),n.append(i)}}for(const r of v.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))r.setAttribute("readOnly",!0);return{textDivs:c}}static update(W){const K=`matrix(${W.viewport.transform.join(",")})`;W.div.style.transform=K,W.div.hidden=!1}}o.XfaLayer=_}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TextLayerRenderTask=void 0,o.renderTextLayer=F;var f=y(1),_=y(8);const Y=1e5,W=30,K=.8,M=new Map,b=/^\s+$/g;function w(m,l){const n=M.get(m);if(n)return n;l.save(),l.font=`${W}px ${m}`;const i=l.measureText("");let e=i.fontBoundingBoxAscent,E=Math.abs(i.fontBoundingBoxDescent);if(e){l.restore();const N=e/(e+E);return M.set(m,N),N}l.strokeStyle="red",l.clearRect(0,0,W,W),l.strokeText("g",0,0);let x=l.getImageData(0,0,W,W).data;E=0;for(let N=x.length-1-3;N>=0;N-=4)if(x[N]>0){E=Math.ceil(N/4/W);break}l.clearRect(0,0,W,W),l.strokeText("A",0,W),x=l.getImageData(0,0,W,W).data,e=0;for(let N=0,I=x.length;N<I;N+=4)if(x[N]>0){e=W-Math.floor(N/4/W);break}if(l.restore(),e){const N=e/(e+E);return M.set(m,N),N}return M.set(m,K),K}function T(m,l,n,i){const e=document.createElement("span"),E=m._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:l.str!=="",hasEOL:l.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1,fontSize:0}:{angle:0,canvasWidth:0,hasText:l.str!=="",hasEOL:l.hasEOL,fontSize:0};m._textDivs.push(e);const x=f.Util.transform(m._viewport.transform,l.transform);let N=Math.atan2(x[1],x[0]);const I=n[l.fontName];I.vertical&&(N+=Math.PI/2);const St=Math.hypot(x[2],x[3]),Pt=St*w(I.fontFamily,i);let bt,V;N===0?(bt=x[4],V=x[5]-Pt):(bt=x[4]+Pt*Math.sin(N),V=x[5]-Pt*Math.cos(N)),e.style.left=`${bt}px`,e.style.top=`${V}px`,e.style.fontSize=`${St}px`,e.style.fontFamily=I.fontFamily,E.fontSize=St,e.setAttribute("role","presentation"),e.textContent=l.str,e.dir=l.dir,m._fontInspectorEnabled&&(e.dataset.fontName=l.fontName),N!==0&&(E.angle=N*(180/Math.PI));let O=!1;if(l.str.length>1||m._enhanceTextSelection&&b.test(l.str))O=!0;else if(l.str!==" "&&l.transform[0]!==l.transform[3]){const z=Math.abs(l.transform[0]),G=Math.abs(l.transform[3]);z!==G&&Math.max(z,G)/Math.min(z,G)>1.5&&(O=!0)}if(O&&(I.vertical?E.canvasWidth=l.height*m._viewport.scale:E.canvasWidth=l.width*m._viewport.scale),m._textDivProperties.set(e,E),m._textContentStream&&m._layoutText(e),m._enhanceTextSelection&&E.hasText){let z=1,G=0;N!==0&&(z=Math.cos(N),G=Math.sin(N));const _t=(I.vertical?l.height:l.width)*m._viewport.scale,wt=St;let Ot,q;N!==0?(Ot=[z,G,-G,z,bt,V],q=f.Util.getAxialAlignedBoundingBox([0,0,_t,wt],Ot)):q=[bt,V,bt+_t,V+wt],m._bounds.push({left:q[0],top:q[1],right:q[2],bottom:q[3],div:e,size:[_t,wt],m:Ot})}}function S(m){if(m._canceled)return;const l=m._textDivs,n=m._capability,i=l.length;if(i>Y){m._renderingDone=!0,n.resolve();return}if(!m._textContentStream)for(let e=0;e<i;e++)m._layoutText(l[e]);m._renderingDone=!0,n.resolve()}function v(m,l,n){let i=0;for(let e=0;e<n;e++){const E=m[l++];E>0&&(i=i?Math.min(E,i):E)}return i}function c(m){const l=m._bounds,n=m._viewport,i=t(n.width,n.height,l);for(let e=0;e<i.length;e++){const E=l[e].div,x=m._textDivProperties.get(E);if(x.angle===0){x.paddingLeft=l[e].left-i[e].left,x.paddingTop=l[e].top-i[e].top,x.paddingRight=i[e].right-l[e].right,x.paddingBottom=i[e].bottom-l[e].bottom,m._textDivProperties.set(E,x);continue}const N=i[e],I=l[e],St=I.m,Pt=St[0],bt=St[1],V=[[0,0],[0,I.size[1]],[I.size[0],0],I.size],O=new Float64Array(64);for(let G=0,_t=V.length;G<_t;G++){const wt=f.Util.applyTransform(V[G],St);O[G+0]=Pt&&(N.left-wt[0])/Pt,O[G+4]=bt&&(N.top-wt[1])/bt,O[G+8]=Pt&&(N.right-wt[0])/Pt,O[G+12]=bt&&(N.bottom-wt[1])/bt,O[G+16]=bt&&(N.left-wt[0])/-bt,O[G+20]=Pt&&(N.top-wt[1])/Pt,O[G+24]=bt&&(N.right-wt[0])/-bt,O[G+28]=Pt&&(N.bottom-wt[1])/Pt,O[G+32]=Pt&&(N.left-wt[0])/-Pt,O[G+36]=bt&&(N.top-wt[1])/-bt,O[G+40]=Pt&&(N.right-wt[0])/-Pt,O[G+44]=bt&&(N.bottom-wt[1])/-bt,O[G+48]=bt&&(N.left-wt[0])/bt,O[G+52]=Pt&&(N.top-wt[1])/-Pt,O[G+56]=bt&&(N.right-wt[0])/bt,O[G+60]=Pt&&(N.bottom-wt[1])/-Pt}const z=1+Math.min(Math.abs(Pt),Math.abs(bt));x.paddingLeft=v(O,32,16)/z,x.paddingTop=v(O,48,16)/z,x.paddingRight=v(O,0,16)/z,x.paddingBottom=v(O,16,16)/z,m._textDivProperties.set(E,x)}}function t(m,l,n){const i=n.map(function(E,x){return{x1:E.left,y1:E.top,x2:E.right,y2:E.bottom,index:x,x1New:void 0,x2New:void 0}});r(m,i);const e=new Array(n.length);for(const E of i){const x=E.index;e[x]={left:E.x1New,top:0,right:E.x2New,bottom:0}}n.map(function(E,x){const N=e[x],I=i[x];I.x1=E.top,I.y1=m-N.right,I.x2=E.bottom,I.y2=m-N.left,I.index=x,I.x1New=void 0,I.x2New=void 0}),r(l,i);for(const E of i){const x=E.index;e[x].top=E.x1New,e[x].bottom=E.x2New}return e}function r(m,l){l.sort(function(e,E){return e.x1-E.x1||e.index-E.index});const i=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const e of l){let E=0;for(;E<i.length&&i[E].end<=e.y1;)E++;let x=i.length-1;for(;x>=0&&i[x].start>=e.y2;)x--;let N,I,St,Pt,bt=-1/0;for(St=E;St<=x;St++){N=i[St],I=N.boundary;let z;I.x2>e.x1?z=I.index>e.index?I.x1New:e.x1:I.x2New===void 0?z=(I.x2+e.x1)/2:z=I.x2New,z>bt&&(bt=z)}for(e.x1New=bt,St=E;St<=x;St++)N=i[St],I=N.boundary,I.x2New===void 0?I.x2>e.x1?I.index>e.index&&(I.x2New=I.x2):I.x2New=bt:I.x2New>bt&&(I.x2New=Math.max(bt,I.x2));const V=[];let O=null;for(St=E;St<=x;St++){N=i[St],I=N.boundary;const z=I.x2>e.x2?I:e;O===z?V.at(-1).end=N.end:(V.push({start:N.start,end:N.end,boundary:z}),O=z)}for(i[E].start<e.y1&&(V[0].start=e.y1,V.unshift({start:i[E].start,end:e.y1,boundary:i[E].boundary})),e.y2<i[x].end&&(V.at(-1).end=e.y2,V.push({start:e.y2,end:i[x].end,boundary:i[x].boundary})),St=E;St<=x;St++){if(N=i[St],I=N.boundary,I.x2New!==void 0)continue;let z=!1;for(Pt=E-1;!z&&Pt>=0&&i[Pt].start>=I.y1;Pt--)z=i[Pt].boundary===I;for(Pt=x+1;!z&&Pt<i.length&&i[Pt].end<=I.y2;Pt++)z=i[Pt].boundary===I;for(Pt=0;!z&&Pt<V.length;Pt++)z=V[Pt].boundary===I;z||(I.x2New=bt)}Array.prototype.splice.apply(i,[E,x-E+1,...V])}for(const e of i){const E=e.boundary;E.x2New===void 0&&(E.x2New=Math.max(m,E.x2))}}class a{constructor({textContent:l,textContentStream:n,container:i,viewport:e,textDivs:E,textContentItemsStr:x,enhanceTextSelection:N}){var I;N&&(0,_.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=l,this._textContentStream=n,this._container=i,this._document=i.ownerDocument,this._viewport=e,this._textDivs=E||[],this._textContentItemsStr=x||[],this._enhanceTextSelection=!!N,this._fontInspectorEnabled=!!((I=globalThis.FontInspector)!=null&&I.enabled),this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,f.createPromiseCapability)(),this._renderTimer=null,this._bounds=[],this._devicePixelRatio=globalThis.devicePixelRatio||1,this._capability.promise.finally(()=>{this._enhanceTextSelection||(this._textDivProperties=null),this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new f.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._renderTimer!==null&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(l,n){for(let i=0,e=l.length;i<e;i++){if(l[i].str===void 0){if(l[i].type==="beginMarkedContentProps"||l[i].type==="beginMarkedContent"){const E=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),l[i].id!==null&&this._container.setAttribute("id",`${l[i].id}`),E.append(this._container)}else l[i].type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(l[i].str),T(this,l[i],n,this._layoutTextCtx)}}_layoutText(l){const n=this._textDivProperties.get(l);let i="";if(n.canvasWidth!==0&&n.hasText){const{fontFamily:e}=l.style,{fontSize:E}=n;(E!==this._layoutTextLastFontSize||e!==this._layoutTextLastFontFamily)&&(this._layoutTextCtx.font=`${E*this._devicePixelRatio}px ${e}`,this._layoutTextLastFontSize=E,this._layoutTextLastFontFamily=e);const{width:x}=this._layoutTextCtx.measureText(l.textContent);if(x>0){const N=this._devicePixelRatio*n.canvasWidth/x;this._enhanceTextSelection&&(n.scale=N),i=`scaleX(${N})`}}if(n.angle!==0&&(i=`rotate(${n.angle}deg) ${i}`),i.length>0&&(this._enhanceTextSelection&&(n.originalTransform=i),l.style.transform=i),n.hasText&&this._container.append(l),n.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this._container.append(e)}}_render(l=0){const n=(0,f.createPromiseCapability)();let i=Object.create(null);const e=this._document.createElement("canvas");if(e.height=e.width=W,this._layoutTextCtx=e.getContext("2d",{alpha:!1}),this._textContent){const E=this._textContent.items,x=this._textContent.styles;this._processItems(E,x),n.resolve()}else if(this._textContentStream){const E=()=>{this._reader.read().then(({value:x,done:N})=>{if(N){n.resolve();return}Object.assign(i,x.styles),this._processItems(x.items,i),E()},n.reject)};this._reader=this._textContentStream.getReader(),E()}else throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');n.promise.then(()=>{i=null,l?this._renderTimer=setTimeout(()=>{S(this),this._renderTimer=null},l):S(this)},this._capability.reject)}expandTextDivs(l=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;this._bounds!==null&&(c(this),this._bounds=null);const n=[],i=[];for(let e=0,E=this._textDivs.length;e<E;e++){const x=this._textDivs[e],N=this._textDivProperties.get(x);N.hasText&&(l?(n.length=0,i.length=0,N.originalTransform&&n.push(N.originalTransform),N.paddingTop>0?(i.push(`${N.paddingTop}px`),n.push(`translateY(${-N.paddingTop}px)`)):i.push(0),N.paddingRight>0?i.push(`${N.paddingRight/N.scale}px`):i.push(0),N.paddingBottom>0?i.push(`${N.paddingBottom}px`):i.push(0),N.paddingLeft>0?(i.push(`${N.paddingLeft/N.scale}px`),n.push(`translateX(${-N.paddingLeft/N.scale}px)`)):i.push(0),x.style.padding=i.join(" "),n.length&&(x.style.transform=n.join(" "))):(x.style.padding=null,x.style.transform=N.originalTransform))}}}o.TextLayerRenderTask=a;function F(m){const l=new a({textContent:m.textContent,textContentStream:m.textContentStream,container:m.container,viewport:m.viewport,textDivs:m.textDivs,textContentItemsStr:m.textContentItemsStr,enhanceTextSelection:m.enhanceTextSelection});return l._render(m.timeout),l}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SVGGraphics=void 0;var f=y(8),_=y(1),Y=y(3);let W=class{constructor(){(0,_.unreachable)("Not implemented: SVGGraphics")}};o.SVGGraphics=W;{let t=function(n){let i=[];const e=[];for(const E of n){if(E.fn==="save"){i.push({fnId:92,fn:"group",items:[]}),e.push(i),i=i.at(-1).items;continue}E.fn==="restore"?i=e.pop():i.push(E)}return i},r=function(n){if(Number.isInteger(n))return n.toString();const i=n.toFixed(10);let e=i.length-1;if(i[e]!=="0")return i;do e--;while(i[e]==="0");return i.substring(0,i[e]==="."?e:e+1)},a=function(n){if(n[4]===0&&n[5]===0){if(n[1]===0&&n[2]===0)return n[0]===1&&n[3]===1?"":`scale(${r(n[0])} ${r(n[3])})`;if(n[0]===n[3]&&n[1]===-n[2]){const i=Math.acos(n[0])*180/Math.PI;return`rotate(${r(i)})`}}else if(n[0]===1&&n[1]===0&&n[2]===0&&n[3]===1)return`translate(${r(n[4])} ${r(n[5])})`;return`matrix(${r(n[0])} ${r(n[1])} ${r(n[2])} ${r(n[3])} ${r(n[4])} ${r(n[5])})`};const K={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},M="http://www.w3.org/XML/1998/namespace",b="http://www.w3.org/1999/xlink",w=["butt","round","square"],T=["miter","round","bevel"],S=function(n,i="",e=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!e)return URL.createObjectURL(new Blob([n],{type:i}));const E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let x=`data:${i};base64,`;for(let N=0,I=n.length;N<I;N+=3){const St=n[N]&255,Pt=n[N+1]&255,bt=n[N+2]&255,V=St>>2,O=(St&3)<<4|Pt>>4,z=N+1<I?(Pt&15)<<2|bt>>6:64,G=N+2<I?bt&63:64;x+=E[V]+E[O]+E[z]+E[G]}return x},v=(function(){const n=new Uint8Array([137,80,78,71,13,10,26,10]),i=12,e=new Int32Array(256);for(let bt=0;bt<256;bt++){let V=bt;for(let O=0;O<8;O++)V&1?V=3988292384^V>>1&2147483647:V=V>>1&2147483647;e[bt]=V}function E(bt,V,O){let z=-1;for(let G=V;G<O;G++){const _t=(z^bt[G])&255,wt=e[_t];z=z>>>8^wt}return z^-1}function x(bt,V,O,z){let G=z;const _t=V.length;O[G]=_t>>24&255,O[G+1]=_t>>16&255,O[G+2]=_t>>8&255,O[G+3]=_t&255,G+=4,O[G]=bt.charCodeAt(0)&255,O[G+1]=bt.charCodeAt(1)&255,O[G+2]=bt.charCodeAt(2)&255,O[G+3]=bt.charCodeAt(3)&255,G+=4,O.set(V,G),G+=V.length;const wt=E(O,z+4,G);O[G]=wt>>24&255,O[G+1]=wt>>16&255,O[G+2]=wt>>8&255,O[G+3]=wt&255}function N(bt,V,O){let z=1,G=0;for(let _t=V;_t<O;++_t)z=(z+(bt[_t]&255))%65521,G=(G+z)%65521;return G<<16|z}function I(bt){if(!Y.isNodeJS)return St(bt);try{let V;parseInt(process.versions.node)>=8?V=bt:V=Buffer.from(bt);const O=require$$5.deflateSync(V,{level:9});return O instanceof Uint8Array?O:new Uint8Array(O)}catch(V){(0,_.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+V)}return St(bt)}function St(bt){let V=bt.length;const O=65535,z=Math.ceil(V/O),G=new Uint8Array(2+V+z*5+4);let _t=0;G[_t++]=120,G[_t++]=156;let wt=0;for(;V>O;)G[_t++]=0,G[_t++]=255,G[_t++]=255,G[_t++]=0,G[_t++]=0,G.set(bt.subarray(wt,wt+O),_t),_t+=O,wt+=O,V-=O;G[_t++]=1,G[_t++]=V&255,G[_t++]=V>>8&255,G[_t++]=~V&65535&255,G[_t++]=(~V&65535)>>8&255,G.set(bt.subarray(wt),_t),_t+=bt.length-wt;const Ot=N(bt,0,bt.length);return G[_t++]=Ot>>24&255,G[_t++]=Ot>>16&255,G[_t++]=Ot>>8&255,G[_t++]=Ot&255,G}function Pt(bt,V,O,z){const G=bt.width,_t=bt.height;let wt,Ot,q;const d=bt.data;switch(V){case _.ImageKind.GRAYSCALE_1BPP:Ot=0,wt=1,q=G+7>>3;break;case _.ImageKind.RGB_24BPP:Ot=2,wt=8,q=G*3;break;case _.ImageKind.RGBA_32BPP:Ot=6,wt=8,q=G*4;break;default:throw new Error("invalid format")}const u=new Uint8Array((1+q)*_t);let P=0,j=0;for(let A=0;A<_t;++A)u[P++]=0,u.set(d.subarray(j,j+q),P),j+=q,P+=q;if(V===_.ImageKind.GRAYSCALE_1BPP&&z){P=0;for(let A=0;A<_t;A++){P++;for(let k=0;k<q;k++)u[P++]^=255}}const U=new Uint8Array([G>>24&255,G>>16&255,G>>8&255,G&255,_t>>24&255,_t>>16&255,_t>>8&255,_t&255,wt,Ot,0,0,0]),$=I(u),s=n.length+i*3+U.length+$.length,h=new Uint8Array(s);let C=0;return h.set(n,C),C+=n.length,x("IHDR",U,h,C),C+=i+U.length,x("IDATA",$,h,C),C+=i+$.length,x("IEND",new Uint8Array(0),h,C),S(h,"image/png",O)}return function(V,O,z){const G=V.kind===void 0?_.ImageKind.GRAYSCALE_1BPP:V.kind;return Pt(V,G,O,z)}})();class c{constructor(){this.fontSizeScale=1,this.fontWeight=K.fontWeight,this.fontSize=0,this.textMatrix=_.IDENTITY_MATRIX,this.fontMatrix=_.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=_.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=K.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(i,e){this.x=i,this.y=e}}let F=0,m=0,l=0;o.SVGGraphics=W=class{constructor(n,i,e=!1){(0,f.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new f.DOMSVGFactory,this.current=new c,this.transformMatrix=_.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=n,this.objs=i,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!e,this._operatorIdMapping=[];for(const E in _.OPS)this._operatorIdMapping[_.OPS[E]]=E}save(){this.transformStack.push(this.transformMatrix);const n=this.current;this.extraStack.push(n),this.current=n.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(n){this.save(),this.executeOpTree(n),this.restore()}loadDependencies(n){const i=n.fnArray,e=n.argsArray;for(let E=0,x=i.length;E<x;E++)if(i[E]===_.OPS.dependency)for(const N of e[E]){const I=N.startsWith("g_")?this.commonObjs:this.objs,St=new Promise(Pt=>{I.get(N,Pt)});this.current.dependencies.push(St)}return Promise.all(this.current.dependencies)}transform(n,i,e,E,x,N){const I=[n,i,e,E,x,N];this.transformMatrix=_.Util.transform(this.transformMatrix,I),this.tgrp=null}getSVG(n,i){this.viewport=i;const e=this._initialize(i);return this.loadDependencies(n).then(()=>(this.transformMatrix=_.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(n)),e))}convertOpList(n){const i=this._operatorIdMapping,e=n.argsArray,E=n.fnArray,x=[];for(let N=0,I=E.length;N<I;N++){const St=E[N];x.push({fnId:St,fn:i[St],args:e[N]})}return t(x)}executeOpTree(n){for(const i of n){const e=i.fn,E=i.fnId,x=i.args;switch(E|0){case _.OPS.beginText:this.beginText();break;case _.OPS.dependency:break;case _.OPS.setLeading:this.setLeading(x);break;case _.OPS.setLeadingMoveText:this.setLeadingMoveText(x[0],x[1]);break;case _.OPS.setFont:this.setFont(x);break;case _.OPS.showText:this.showText(x[0]);break;case _.OPS.showSpacedText:this.showText(x[0]);break;case _.OPS.endText:this.endText();break;case _.OPS.moveText:this.moveText(x[0],x[1]);break;case _.OPS.setCharSpacing:this.setCharSpacing(x[0]);break;case _.OPS.setWordSpacing:this.setWordSpacing(x[0]);break;case _.OPS.setHScale:this.setHScale(x[0]);break;case _.OPS.setTextMatrix:this.setTextMatrix(x[0],x[1],x[2],x[3],x[4],x[5]);break;case _.OPS.setTextRise:this.setTextRise(x[0]);break;case _.OPS.setTextRenderingMode:this.setTextRenderingMode(x[0]);break;case _.OPS.setLineWidth:this.setLineWidth(x[0]);break;case _.OPS.setLineJoin:this.setLineJoin(x[0]);break;case _.OPS.setLineCap:this.setLineCap(x[0]);break;case _.OPS.setMiterLimit:this.setMiterLimit(x[0]);break;case _.OPS.setFillRGBColor:this.setFillRGBColor(x[0],x[1],x[2]);break;case _.OPS.setStrokeRGBColor:this.setStrokeRGBColor(x[0],x[1],x[2]);break;case _.OPS.setStrokeColorN:this.setStrokeColorN(x);break;case _.OPS.setFillColorN:this.setFillColorN(x);break;case _.OPS.shadingFill:this.shadingFill(x[0]);break;case _.OPS.setDash:this.setDash(x[0],x[1]);break;case _.OPS.setRenderingIntent:this.setRenderingIntent(x[0]);break;case _.OPS.setFlatness:this.setFlatness(x[0]);break;case _.OPS.setGState:this.setGState(x[0]);break;case _.OPS.fill:this.fill();break;case _.OPS.eoFill:this.eoFill();break;case _.OPS.stroke:this.stroke();break;case _.OPS.fillStroke:this.fillStroke();break;case _.OPS.eoFillStroke:this.eoFillStroke();break;case _.OPS.clip:this.clip("nonzero");break;case _.OPS.eoClip:this.clip("evenodd");break;case _.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case _.OPS.paintImageXObject:this.paintImageXObject(x[0]);break;case _.OPS.paintInlineImageXObject:this.paintInlineImageXObject(x[0]);break;case _.OPS.paintImageMaskXObject:this.paintImageMaskXObject(x[0]);break;case _.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(x[0],x[1]);break;case _.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case _.OPS.closePath:this.closePath();break;case _.OPS.closeStroke:this.closeStroke();break;case _.OPS.closeFillStroke:this.closeFillStroke();break;case _.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case _.OPS.nextLine:this.nextLine();break;case _.OPS.transform:this.transform(x[0],x[1],x[2],x[3],x[4],x[5]);break;case _.OPS.constructPath:this.constructPath(x[0],x[1]);break;case _.OPS.endPath:this.endPath();break;case 92:this.group(i.items);break;default:(0,_.warn)(`Unimplemented operator ${e}`);break}}}setWordSpacing(n){this.current.wordSpacing=n}setCharSpacing(n){this.current.charSpacing=n}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(n,i,e,E,x,N){const I=this.current;I.textMatrix=I.lineMatrix=[n,i,e,E,x,N],I.textMatrixScale=Math.hypot(n,i),I.x=I.lineX=0,I.y=I.lineY=0,I.xcoords=[],I.ycoords=[],I.tspan=this.svgFactory.createElement("svg:tspan"),I.tspan.setAttributeNS(null,"font-family",I.fontFamily),I.tspan.setAttributeNS(null,"font-size",`${r(I.fontSize)}px`),I.tspan.setAttributeNS(null,"y",r(-I.y)),I.txtElement=this.svgFactory.createElement("svg:text"),I.txtElement.append(I.tspan)}beginText(){const n=this.current;n.x=n.lineX=0,n.y=n.lineY=0,n.textMatrix=_.IDENTITY_MATRIX,n.lineMatrix=_.IDENTITY_MATRIX,n.textMatrixScale=1,n.tspan=this.svgFactory.createElement("svg:tspan"),n.txtElement=this.svgFactory.createElement("svg:text"),n.txtgrp=this.svgFactory.createElement("svg:g"),n.xcoords=[],n.ycoords=[]}moveText(n,i){const e=this.current;e.x=e.lineX+=n,e.y=e.lineY+=i,e.xcoords=[],e.ycoords=[],e.tspan=this.svgFactory.createElement("svg:tspan"),e.tspan.setAttributeNS(null,"font-family",e.fontFamily),e.tspan.setAttributeNS(null,"font-size",`${r(e.fontSize)}px`),e.tspan.setAttributeNS(null,"y",r(-e.y))}showText(n){const i=this.current,e=i.font,E=i.fontSize;if(E===0)return;const x=i.fontSizeScale,N=i.charSpacing,I=i.wordSpacing,St=i.fontDirection,Pt=i.textHScale*St,bt=e.vertical,V=bt?1:-1,O=e.defaultVMetrics,z=E*i.fontMatrix[0];let G=0;for(const Ot of n){if(Ot===null){G+=St*I;continue}else if(typeof Ot=="number"){G+=V*Ot*E/1e3;continue}const q=(Ot.isSpace?I:0)+N,d=Ot.fontChar;let u,P,j=Ot.width;if(bt){let $;const s=Ot.vmetric||O;$=Ot.vmetric?s[1]:j*.5,$=-$*z;const h=s[2]*z;j=s?-s[0]:j,u=$/x,P=(G+h)/x}else u=G/x,P=0;(Ot.isInFont||e.missingFile)&&(i.xcoords.push(i.x+u),bt&&i.ycoords.push(-i.y+P),i.tspan.textContent+=d);let U;bt?U=j*z-q*St:U=j*z+q*St,G+=U}i.tspan.setAttributeNS(null,"x",i.xcoords.map(r).join(" ")),bt?i.tspan.setAttributeNS(null,"y",i.ycoords.map(r).join(" ")):i.tspan.setAttributeNS(null,"y",r(-i.y)),bt?i.y-=G:i.x+=G*Pt,i.tspan.setAttributeNS(null,"font-family",i.fontFamily),i.tspan.setAttributeNS(null,"font-size",`${r(i.fontSize)}px`),i.fontStyle!==K.fontStyle&&i.tspan.setAttributeNS(null,"font-style",i.fontStyle),i.fontWeight!==K.fontWeight&&i.tspan.setAttributeNS(null,"font-weight",i.fontWeight);const _t=i.textRenderingMode&_.TextRenderingMode.FILL_STROKE_MASK;if(_t===_.TextRenderingMode.FILL||_t===_.TextRenderingMode.FILL_STROKE?(i.fillColor!==K.fillColor&&i.tspan.setAttributeNS(null,"fill",i.fillColor),i.fillAlpha<1&&i.tspan.setAttributeNS(null,"fill-opacity",i.fillAlpha)):i.textRenderingMode===_.TextRenderingMode.ADD_TO_PATH?i.tspan.setAttributeNS(null,"fill","transparent"):i.tspan.setAttributeNS(null,"fill","none"),_t===_.TextRenderingMode.STROKE||_t===_.TextRenderingMode.FILL_STROKE){const Ot=1/(i.textMatrixScale||1);this._setStrokeAttributes(i.tspan,Ot)}let wt=i.textMatrix;i.textRise!==0&&(wt=wt.slice(),wt[5]+=i.textRise),i.txtElement.setAttributeNS(null,"transform",`${a(wt)} scale(${r(Pt)}, -1)`),i.txtElement.setAttributeNS(M,"xml:space","preserve"),i.txtElement.append(i.tspan),i.txtgrp.append(i.txtElement),this._ensureTransformGroup().append(i.txtElement)}setLeadingMoveText(n,i){this.setLeading(-i),this.moveText(n,i)}addFontStyle(n){if(!n.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const i=S(n.data,n.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${n.loadedName}"; src: url(${i}); }
42
- `}setFont(n){const i=this.current,e=this.commonObjs.get(n[0]);let E=n[1];i.font=e,this.embedFonts&&!e.missingFile&&!this.embeddedFonts[e.loadedName]&&(this.addFontStyle(e),this.embeddedFonts[e.loadedName]=e),i.fontMatrix=e.fontMatrix||_.FONT_IDENTITY_MATRIX;let x="normal";e.black?x="900":e.bold&&(x="bold");const N=e.italic?"italic":"normal";E<0?(E=-E,i.fontDirection=-1):i.fontDirection=1,i.fontSize=E,i.fontFamily=e.loadedName,i.fontWeight=x,i.fontStyle=N,i.tspan=this.svgFactory.createElement("svg:tspan"),i.tspan.setAttributeNS(null,"y",r(-i.y)),i.xcoords=[],i.ycoords=[]}endText(){var i;const n=this.current;n.textRenderingMode&_.TextRenderingMode.ADD_TO_PATH_FLAG&&((i=n.txtElement)!=null&&i.hasChildNodes())&&(n.element=n.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(n){n>0&&(this.current.lineWidth=n)}setLineCap(n){this.current.lineCap=w[n]}setLineJoin(n){this.current.lineJoin=T[n]}setMiterLimit(n){this.current.miterLimit=n}setStrokeAlpha(n){this.current.strokeAlpha=n}setStrokeRGBColor(n,i,e){this.current.strokeColor=_.Util.makeHexColor(n,i,e)}setFillAlpha(n){this.current.fillAlpha=n}setFillRGBColor(n,i,e){this.current.fillColor=_.Util.makeHexColor(n,i,e),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(n){this.current.strokeColor=this._makeColorN_Pattern(n)}setFillColorN(n){this.current.fillColor=this._makeColorN_Pattern(n)}shadingFill(n){const i=this.viewport.width,e=this.viewport.height,E=_.Util.inverseTransform(this.transformMatrix),x=_.Util.applyTransform([0,0],E),N=_.Util.applyTransform([0,e],E),I=_.Util.applyTransform([i,0],E),St=_.Util.applyTransform([i,e],E),Pt=Math.min(x[0],N[0],I[0],St[0]),bt=Math.min(x[1],N[1],I[1],St[1]),V=Math.max(x[0],N[0],I[0],St[0]),O=Math.max(x[1],N[1],I[1],St[1]),z=this.svgFactory.createElement("svg:rect");z.setAttributeNS(null,"x",Pt),z.setAttributeNS(null,"y",bt),z.setAttributeNS(null,"width",V-Pt),z.setAttributeNS(null,"height",O-bt),z.setAttributeNS(null,"fill",this._makeShadingPattern(n)),this.current.fillAlpha<1&&z.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(z)}_makeColorN_Pattern(n){return n[0]==="TilingPattern"?this._makeTilingPattern(n):this._makeShadingPattern(n)}_makeTilingPattern(n){const i=n[1],e=n[2],E=n[3]||_.IDENTITY_MATRIX,[x,N,I,St]=n[4],Pt=n[5],bt=n[6],V=n[7],O=`shading${l++}`,[z,G,_t,wt]=_.Util.normalizeRect([..._.Util.applyTransform([x,N],E),..._.Util.applyTransform([I,St],E)]),[Ot,q]=_.Util.singularValueDecompose2dScale(E),d=Pt*Ot,u=bt*q,P=this.svgFactory.createElement("svg:pattern");P.setAttributeNS(null,"id",O),P.setAttributeNS(null,"patternUnits","userSpaceOnUse"),P.setAttributeNS(null,"width",d),P.setAttributeNS(null,"height",u),P.setAttributeNS(null,"x",`${z}`),P.setAttributeNS(null,"y",`${G}`);const j=this.svg,U=this.transformMatrix,$=this.current.fillColor,s=this.current.strokeColor,h=this.svgFactory.create(_t-z,wt-G);if(this.svg=h,this.transformMatrix=E,V===2){const C=_.Util.makeHexColor(...i);this.current.fillColor=C,this.current.strokeColor=C}return this.executeOpTree(this.convertOpList(e)),this.svg=j,this.transformMatrix=U,this.current.fillColor=$,this.current.strokeColor=s,P.append(h.childNodes[0]),this.defs.append(P),`url(#${O})`}_makeShadingPattern(n){switch(typeof n=="string"&&(n=this.objs.get(n)),n[0]){case"RadialAxial":const i=`shading${l++}`,e=n[3];let E;switch(n[1]){case"axial":const x=n[4],N=n[5];E=this.svgFactory.createElement("svg:linearGradient"),E.setAttributeNS(null,"id",i),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"x1",x[0]),E.setAttributeNS(null,"y1",x[1]),E.setAttributeNS(null,"x2",N[0]),E.setAttributeNS(null,"y2",N[1]);break;case"radial":const I=n[4],St=n[5],Pt=n[6],bt=n[7];E=this.svgFactory.createElement("svg:radialGradient"),E.setAttributeNS(null,"id",i),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"cx",St[0]),E.setAttributeNS(null,"cy",St[1]),E.setAttributeNS(null,"r",bt),E.setAttributeNS(null,"fx",I[0]),E.setAttributeNS(null,"fy",I[1]),E.setAttributeNS(null,"fr",Pt);break;default:throw new Error(`Unknown RadialAxial type: ${n[1]}`)}for(const x of e){const N=this.svgFactory.createElement("svg:stop");N.setAttributeNS(null,"offset",x[0]),N.setAttributeNS(null,"stop-color",x[1]),E.append(N)}return this.defs.append(E),`url(#${i})`;case"Mesh":return(0,_.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${n[0]}`)}}setDash(n,i){this.current.dashArray=n,this.current.dashPhase=i}constructPath(n,i){const e=this.current;let E=e.x,x=e.y,N=[],I=0;for(const St of n)switch(St|0){case _.OPS.rectangle:E=i[I++],x=i[I++];const Pt=i[I++],bt=i[I++],V=E+Pt,O=x+bt;N.push("M",r(E),r(x),"L",r(V),r(x),"L",r(V),r(O),"L",r(E),r(O),"Z");break;case _.OPS.moveTo:E=i[I++],x=i[I++],N.push("M",r(E),r(x));break;case _.OPS.lineTo:E=i[I++],x=i[I++],N.push("L",r(E),r(x));break;case _.OPS.curveTo:E=i[I+4],x=i[I+5],N.push("C",r(i[I]),r(i[I+1]),r(i[I+2]),r(i[I+3]),r(E),r(x)),I+=6;break;case _.OPS.curveTo2:N.push("C",r(E),r(x),r(i[I]),r(i[I+1]),r(i[I+2]),r(i[I+3])),E=i[I+2],x=i[I+3],I+=4;break;case _.OPS.curveTo3:E=i[I+2],x=i[I+3],N.push("C",r(i[I]),r(i[I+1]),r(E),r(x),r(E),r(x)),I+=4;break;case _.OPS.closePath:N.push("Z");break}N=N.join(" "),e.path&&n.length>0&&n[0]!==_.OPS.rectangle&&n[0]!==_.OPS.moveTo?N=e.path.getAttributeNS(null,"d")+N:(e.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(e.path)),e.path.setAttributeNS(null,"d",N),e.path.setAttributeNS(null,"fill","none"),e.element=e.path,e.setCurrentPoint(E,x)}endPath(){const n=this.current;if(n.path=null,!this.pendingClip)return;if(!n.element){this.pendingClip=null;return}const i=`clippath${F++}`,e=this.svgFactory.createElement("svg:clipPath");e.setAttributeNS(null,"id",i),e.setAttributeNS(null,"transform",a(this.transformMatrix));const E=n.element.cloneNode(!0);if(this.pendingClip==="evenodd"?E.setAttributeNS(null,"clip-rule","evenodd"):E.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,e.append(E),this.defs.append(e),n.activeClipUrl){n.clipGroup=null;for(const x of this.extraStack)x.clipGroup=null;e.setAttributeNS(null,"clip-path",n.activeClipUrl)}n.activeClipUrl=`url(#${i})`,this.tgrp=null}clip(n){this.pendingClip=n}closePath(){const n=this.current;if(n.path){const i=`${n.path.getAttributeNS(null,"d")}Z`;n.path.setAttributeNS(null,"d",i)}}setLeading(n){this.current.leading=-n}setTextRise(n){this.current.textRise=n}setTextRenderingMode(n){this.current.textRenderingMode=n}setHScale(n){this.current.textHScale=n/100}setRenderingIntent(n){}setFlatness(n){}setGState(n){for(const[i,e]of n)switch(i){case"LW":this.setLineWidth(e);break;case"LC":this.setLineCap(e);break;case"LJ":this.setLineJoin(e);break;case"ML":this.setMiterLimit(e);break;case"D":this.setDash(e[0],e[1]);break;case"RI":this.setRenderingIntent(e);break;case"FL":this.setFlatness(e);break;case"Font":this.setFont(e);break;case"CA":this.setStrokeAlpha(e);break;case"ca":this.setFillAlpha(e);break;default:(0,_.warn)(`Unimplemented graphic state operator ${i}`);break}}fill(){const n=this.current;n.element&&(n.element.setAttributeNS(null,"fill",n.fillColor),n.element.setAttributeNS(null,"fill-opacity",n.fillAlpha),this.endPath())}stroke(){const n=this.current;n.element&&(this._setStrokeAttributes(n.element),n.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(n,i=1){const e=this.current;let E=e.dashArray;i!==1&&E.length>0&&(E=E.map(function(x){return i*x})),n.setAttributeNS(null,"stroke",e.strokeColor),n.setAttributeNS(null,"stroke-opacity",e.strokeAlpha),n.setAttributeNS(null,"stroke-miterlimit",r(e.miterLimit)),n.setAttributeNS(null,"stroke-linecap",e.lineCap),n.setAttributeNS(null,"stroke-linejoin",e.lineJoin),n.setAttributeNS(null,"stroke-width",r(i*e.lineWidth)+"px"),n.setAttributeNS(null,"stroke-dasharray",E.map(r).join(" ")),n.setAttributeNS(null,"stroke-dashoffset",r(i*e.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x","0"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","1px"),n.setAttributeNS(null,"height","1px"),n.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(n)}paintImageXObject(n){const i=n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n);if(!i){(0,_.warn)(`Dependent image with object ID ${n} is not ready yet`);return}this.paintInlineImageXObject(i)}paintInlineImageXObject(n,i){const e=n.width,E=n.height,x=v(n,this.forceDataSchema,!!i),N=this.svgFactory.createElement("svg:rect");N.setAttributeNS(null,"x","0"),N.setAttributeNS(null,"y","0"),N.setAttributeNS(null,"width",r(e)),N.setAttributeNS(null,"height",r(E)),this.current.element=N,this.clip("nonzero");const I=this.svgFactory.createElement("svg:image");I.setAttributeNS(b,"xlink:href",x),I.setAttributeNS(null,"x","0"),I.setAttributeNS(null,"y",r(-E)),I.setAttributeNS(null,"width",r(e)+"px"),I.setAttributeNS(null,"height",r(E)+"px"),I.setAttributeNS(null,"transform",`scale(${r(1/e)} ${r(-1/E)})`),i?i.append(I):this._ensureTransformGroup().append(I)}paintImageMaskXObject(n){const i=this.current,e=n.width,E=n.height,x=i.fillColor;i.maskId=`mask${m++}`;const N=this.svgFactory.createElement("svg:mask");N.setAttributeNS(null,"id",i.maskId);const I=this.svgFactory.createElement("svg:rect");I.setAttributeNS(null,"x","0"),I.setAttributeNS(null,"y","0"),I.setAttributeNS(null,"width",r(e)),I.setAttributeNS(null,"height",r(E)),I.setAttributeNS(null,"fill",x),I.setAttributeNS(null,"mask",`url(#${i.maskId})`),this.defs.append(N),this._ensureTransformGroup().append(I),this.paintInlineImageXObject(n,N)}paintFormXObjectBegin(n,i){if(Array.isArray(n)&&n.length===6&&this.transform(n[0],n[1],n[2],n[3],n[4],n[5]),i){const e=i[2]-i[0],E=i[3]-i[1],x=this.svgFactory.createElement("svg:rect");x.setAttributeNS(null,"x",i[0]),x.setAttributeNS(null,"y",i[1]),x.setAttributeNS(null,"width",r(e)),x.setAttributeNS(null,"height",r(E)),this.current.element=x,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(n){const i=this.svgFactory.create(n.width,n.height),e=this.svgFactory.createElement("svg:defs");i.append(e),this.defs=e;const E=this.svgFactory.createElement("svg:g");return E.setAttributeNS(null,"transform",a(n.transform)),i.append(E),this.svg=E,i}_ensureClipGroup(){if(!this.current.clipGroup){const n=this.svgFactory.createElement("svg:g");n.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(n),this.current.clipGroup=n}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",a(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PDFNodeStream=void 0;var f=y(1),_=y(33);const Y=require$$5,W=require$$5,K=require$$5,M=require$$5,b=/^file:\/\/\/[a-zA-Z]:\//;function w(m){const l=M.parse(m);return l.protocol==="file:"||l.host?l:/^[a-z]:[/\\]/i.test(m)?M.parse(`file:///${m}`):(l.host||(l.protocol="file:"),l)}class T{constructor(l){this.source=l,this.url=w(l.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&l.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new a(this):new t(this),this._fullRequestReader}getRangeReader(l,n){if(n<=this._progressiveDataLength)return null;const i=this.isFsUrl?new F(this,l,n):new r(this,l,n);return this._rangeRequestReaders.push(i),i}cancelAllRequests(l){this._fullRequestReader&&this._fullRequestReader.cancel(l);for(const n of this._rangeRequestReaders.slice(0))n.cancel(l)}}o.PDFNodeStream=T;class S{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null;const n=l.source;this._contentLength=n.length,this._loaded=0,this._filename=null,this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)(),this._headersCapability=(0,f.createPromiseCapability)()}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const l=this._readableStream.read();return l===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=l.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(l).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",n=>{this._error(n)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new f.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class v{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)();const n=l.source;this._isStreamingSupported=!n.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const l=this._readableStream.read();return l===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=l.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(l).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",n=>{this._error(n)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function c(m,l){return{protocol:m.protocol,auth:m.auth,host:m.hostname,port:m.port,path:m.path,method:"GET",headers:l}}class t extends S{constructor(l){super(l);const n=i=>{if(i.statusCode===404){const N=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=N,this._headersCapability.reject(N);return}this._headersCapability.resolve(),this._setReadableStream(i);const e=N=>this._readableStream.headers[N.toLowerCase()],{allowRangeRequests:E,suggestedLength:x}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:l.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=E,this._contentLength=x||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(e)};this._request=null,this._url.protocol==="http:"?this._request=W.request(c(this._url,l.httpHeaders),n):this._request=K.request(c(this._url,l.httpHeaders),n),this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class r extends v{constructor(l,n,i){super(l),this._httpHeaders={};for(const E in l.httpHeaders){const x=l.httpHeaders[E];typeof x>"u"||(this._httpHeaders[E]=x)}this._httpHeaders.Range=`bytes=${n}-${i-1}`;const e=E=>{if(E.statusCode===404){const x=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=x;return}this._setReadableStream(E)};this._request=null,this._url.protocol==="http:"?this._request=W.request(c(this._url,this._httpHeaders),e):this._request=K.request(c(this._url,this._httpHeaders),e),this._request.on("error",E=>{this._storedError=E}),this._request.end()}}class a extends S{constructor(l){super(l);let n=decodeURIComponent(this._url.path);b.test(this._url.href)&&(n=n.replace(/^\//,"")),Y.lstat(n,(i,e)=>{if(i){i.code==="ENOENT"&&(i=new f.MissingPDFException(`Missing PDF "${n}".`)),this._storedError=i,this._headersCapability.reject(i);return}this._contentLength=e.size,this._setReadableStream(Y.createReadStream(n)),this._headersCapability.resolve()})}}class F extends v{constructor(l,n,i){super(l);let e=decodeURIComponent(this._url.path);b.test(this._url.href)&&(e=e.replace(/^\//,"")),this._setReadableStream(Y.createReadStream(e,{start:n,end:i-1}))}}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createResponseStatusError=M,o.extractFilenameFromHeader=K,o.validateRangeRequestCapabilities=W,o.validateResponseStatus=b;var f=y(1),_=y(34),Y=y(8);function W({getResponseHeader:w,isHttp:T,rangeChunkSize:S,disableRange:v}){const c={allowRangeRequests:!1,suggestedLength:void 0},t=parseInt(w("Content-Length"),10);return!Number.isInteger(t)||(c.suggestedLength=t,t<=2*S)||v||!T||w("Accept-Ranges")!=="bytes"||(w("Content-Encoding")||"identity")!=="identity"||(c.allowRangeRequests=!0),c}function K(w){const T=w("Content-Disposition");if(T){let S=(0,_.getFilenameFromContentDispositionHeader)(T);if(S.includes("%"))try{S=decodeURIComponent(S)}catch{}if((0,Y.isPdfFile)(S))return S}return null}function M(w,T){return w===404||w===0&&T.startsWith("file:")?new f.MissingPDFException('Missing PDF "'+T+'".'):new f.UnexpectedResponseException(`Unexpected server response (${w}) while retrieving PDF "${T}".`,w)}function b(w){return w===200||w===206}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getFilenameFromContentDispositionHeader=_;var f=y(1);function _(Y){let W=!0,K=M("filename\\*","i").exec(Y);if(K){K=K[1];let t=S(K);return t=unescape(t),t=v(t),t=c(t),w(t)}if(K=T(Y),K){const t=c(K);return w(t)}if(K=M("filename","i").exec(Y),K){K=K[1];let t=S(K);return t=c(t),w(t)}function M(t,r){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',r)}function b(t,r){if(t){if(!/^[\x00-\xFF]+$/.test(r))return r;try{const a=new TextDecoder(t,{fatal:!0}),F=(0,f.stringToBytes)(r);r=a.decode(F),W=!1}catch{}}return r}function w(t){return W&&/[\x80-\xff]/.test(t)&&(t=b("utf-8",t),W&&(t=b("iso-8859-1",t))),t}function T(t){const r=[];let a;const F=M("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(a=F.exec(t))!==null;){let[,l,n,i]=a;if(l=parseInt(l,10),l in r){if(l===0)break;continue}r[l]=[n,i]}const m=[];for(let l=0;l<r.length&&l in r;++l){let[n,i]=r[l];i=S(i),n&&(i=unescape(i),l===0&&(i=v(i))),m.push(i)}return m.join("")}function S(t){if(t.startsWith('"')){const r=t.slice(1).split('\\"');for(let a=0;a<r.length;++a){const F=r[a].indexOf('"');F!==-1&&(r[a]=r[a].slice(0,F),r.length=a+1),r[a]=r[a].replace(/\\(.)/g,"$1")}t=r.join('"')}return t}function v(t){const r=t.indexOf("'");if(r===-1)return t;const a=t.slice(0,r),m=t.slice(r+1).replace(/^[^']*'/,"");return b(a,m)}function c(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(r,a,F,m){if(F==="q"||F==="Q")return m=m.replace(/_/g," "),m=m.replace(/=([0-9a-fA-F]{2})/g,function(l,n){return String.fromCharCode(parseInt(n,16))}),b(a,m);try{m=atob(m)}catch{}return b(a,m)})}return""}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PDFNetworkStream=void 0;var f=y(1),_=y(33);const Y=200,W=206;function K(S){const v=S.response;return typeof v!="string"?v:(0,f.stringToBytes)(v).buffer}class M{constructor(v,c={}){this.url=v,this.isHttp=/^https?:/i.test(v),this.httpHeaders=this.isHttp&&c.httpHeaders||Object.create(null),this.withCredentials=c.withCredentials||!1,this.getXhr=c.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(v,c,t){const r={begin:v,end:c};for(const a in t)r[a]=t[a];return this.request(r)}requestFull(v){return this.request(v)}request(v){const c=this.getXhr(),t=this.currXhrId++,r=this.pendingRequests[t]={xhr:c};c.open("GET",this.url),c.withCredentials=this.withCredentials;for(const a in this.httpHeaders){const F=this.httpHeaders[a];typeof F>"u"||c.setRequestHeader(a,F)}return this.isHttp&&"begin"in v&&"end"in v?(c.setRequestHeader("Range",`bytes=${v.begin}-${v.end-1}`),r.expectedStatus=W):r.expectedStatus=Y,c.responseType="arraybuffer",v.onError&&(c.onerror=function(a){v.onError(c.status)}),c.onreadystatechange=this.onStateChange.bind(this,t),c.onprogress=this.onProgress.bind(this,t),r.onHeadersReceived=v.onHeadersReceived,r.onDone=v.onDone,r.onError=v.onError,r.onProgress=v.onProgress,c.send(null),t}onProgress(v,c){var r;const t=this.pendingRequests[v];t&&((r=t.onProgress)==null||r.call(t,c))}onStateChange(v,c){var l,n,i;const t=this.pendingRequests[v];if(!t)return;const r=t.xhr;if(r.readyState>=2&&t.onHeadersReceived&&(t.onHeadersReceived(),delete t.onHeadersReceived),r.readyState!==4||!(v in this.pendingRequests))return;if(delete this.pendingRequests[v],r.status===0&&this.isHttp){(l=t.onError)==null||l.call(t,r.status);return}const a=r.status||Y;if(!(a===Y&&t.expectedStatus===W)&&a!==t.expectedStatus){(n=t.onError)==null||n.call(t,r.status);return}const m=K(r);if(a===W){const e=r.getResponseHeader("Content-Range"),E=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t.onDone({begin:parseInt(E[1],10),chunk:m})}else m?t.onDone({begin:0,chunk:m}):(i=t.onError)==null||i.call(t,r.status)}getRequestXhr(v){return this.pendingRequests[v].xhr}isPendingRequest(v){return v in this.pendingRequests}abortRequest(v){const c=this.pendingRequests[v].xhr;delete this.pendingRequests[v],c.abort()}}class b{constructor(v){this._source=v,this._manager=new M(v.url,{httpHeaders:v.httpHeaders,withCredentials:v.withCredentials}),this._rangeChunkSize=v.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(v){const c=this._rangeRequestReaders.indexOf(v);c>=0&&this._rangeRequestReaders.splice(c,1)}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new w(this._manager,this._source),this._fullRequestReader}getRangeReader(v,c){const t=new T(this._manager,v,c);return t.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(t),t}cancelAllRequests(v){var c;(c=this._fullRequestReader)==null||c.cancel(v);for(const t of this._rangeRequestReaders.slice(0))t.cancel(v)}}o.PDFNetworkStream=b;class w{constructor(v,c){this._manager=v;const t={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=c.url,this._fullRequestId=v.requestFull(t),this._headersReceivedCapability=(0,f.createPromiseCapability)(),this._disableRange=c.disableRange||!1,this._contentLength=c.length,this._rangeChunkSize=c.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const v=this._fullRequestId,c=this._manager.getRequestXhr(v),t=F=>c.getResponseHeader(F),{allowRangeRequests:r,suggestedLength:a}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),this._isRangeSupported&&this._manager.abortRequest(v),this._headersReceivedCapability.resolve()}_onDone(v){if(v&&(this._requests.length>0?this._requests.shift().resolve({value:v.chunk,done:!1}):this._cachedChunks.push(v.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(v){this._storedError=(0,_.createResponseStatusError)(v,this._url),this._headersReceivedCapability.reject(this._storedError);for(const c of this._requests)c.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(v){var c;(c=this.onProgress)==null||c.call(this,{loaded:v.loaded,total:v.lengthComputable?v.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(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 v=(0,f.createPromiseCapability)();return this._requests.push(v),v.promise}cancel(v){this._done=!0,this._headersReceivedCapability.reject(v);for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class T{constructor(v,c,t){this._manager=v;const r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=v.url,this._requestId=v.requestRange(c,t,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var v;(v=this.onClosed)==null||v.call(this,this)}_onDone(v){const c=v.chunk;this._requests.length>0?this._requests.shift().resolve({value:c,done:!1}):this._queuedChunk=c,this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(v){this._storedError=(0,_.createResponseStatusError)(v,this._url);for(const c of this._requests)c.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(v){var c;this.isStreamingSupported||(c=this.onProgress)==null||c.call(this,{loaded:v.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const c=this._queuedChunk;return this._queuedChunk=null,{value:c,done:!1}}if(this._done)return{value:void 0,done:!0};const v=(0,f.createPromiseCapability)();return this._requests.push(v),v.promise}cancel(v){this._done=!0;for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PDFFetchStream=void 0;var f=y(1),_=y(33);function Y(w,T,S){return{method:"GET",headers:w,signal:S.signal,mode:"cors",credentials:T?"include":"same-origin",redirect:"follow"}}function W(w){const T=new Headers;for(const S in w){const v=w[S];typeof v>"u"||T.append(S,v)}return T}class K{constructor(T){this.source=T,this.isHttp=/^https?:/i.test(T.url),this.httpHeaders=this.isHttp&&T.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var T;return((T=this._fullRequestReader)==null?void 0:T._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new M(this),this._fullRequestReader}getRangeReader(T,S){if(S<=this._progressiveDataLength)return null;const v=new b(this,T,S);return this._rangeRequestReaders.push(v),v}cancelAllRequests(T){this._fullRequestReader&&this._fullRequestReader.cancel(T);for(const S of this._rangeRequestReaders.slice(0))S.cancel(T)}}o.PDFFetchStream=K;class M{constructor(T){this._stream=T,this._reader=null,this._loaded=0,this._filename=null;const S=T.source;this._withCredentials=S.withCredentials||!1,this._contentLength=S.length,this._headersCapability=(0,f.createPromiseCapability)(),this._disableRange=S.disableRange||!1,this._rangeChunkSize=S.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!S.disableStream,this._isRangeSupported=!S.disableRange,this._headers=W(this._stream.httpHeaders);const v=S.url;fetch(v,Y(this._headers,this._withCredentials,this._abortController)).then(c=>{if(!(0,_.validateResponseStatus)(c.status))throw(0,_.createResponseStatusError)(c.status,v);this._reader=c.body.getReader(),this._headersCapability.resolve();const t=F=>c.headers.get(F),{allowRangeRequests:r,suggestedLength:a}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new f.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}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(){await this._headersCapability.promise;const{value:T,done:S}=await this._reader.read();return S?{value:T,done:S}:(this._loaded+=T.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(T).buffer,done:!1})}cancel(T){this._reader&&this._reader.cancel(T),this._abortController.abort()}}class b{constructor(T,S,v){this._stream=T,this._reader=null,this._loaded=0;const c=T.source;this._withCredentials=c.withCredentials||!1,this._readCapability=(0,f.createPromiseCapability)(),this._isStreamingSupported=!c.disableStream,this._abortController=new AbortController,this._headers=W(this._stream.httpHeaders),this._headers.append("Range",`bytes=${S}-${v-1}`);const t=c.url;fetch(t,Y(this._headers,this._withCredentials,this._abortController)).then(r=>{if(!(0,_.validateResponseStatus)(r.status))throw(0,_.createResponseStatusError)(r.status,t);this._readCapability.resolve(),this._reader=r.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:T,done:S}=await this._reader.read();return S?{value:T,done:S}:(this._loaded+=T.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(T).buffer,done:!1})}cancel(T){this._reader&&this._reader.cancel(T),this._abortController.abort()}}})],__webpack_module_cache__={};function __w_pdfjs_require__(p){var o=__webpack_module_cache__[p];if(o!==void 0)return o.exports;var y=__webpack_module_cache__[p]={exports:{}};return __webpack_modules__[p](y,y.exports,__w_pdfjs_require__),y.exports}var __webpack_exports__={};return(()=>{var p=__webpack_exports__;Object.defineProperty(p,"__esModule",{value:!0}),Object.defineProperty(p,"AnnotationEditorLayer",{enumerable:!0,get:function(){return _.AnnotationEditorLayer}}),Object.defineProperty(p,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return o.AnnotationEditorParamsType}}),Object.defineProperty(p,"AnnotationEditorType",{enumerable:!0,get:function(){return o.AnnotationEditorType}}),Object.defineProperty(p,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return Y.AnnotationEditorUIManager}}),Object.defineProperty(p,"AnnotationLayer",{enumerable:!0,get:function(){return W.AnnotationLayer}}),Object.defineProperty(p,"AnnotationMode",{enumerable:!0,get:function(){return o.AnnotationMode}}),Object.defineProperty(p,"CMapCompressionType",{enumerable:!0,get:function(){return o.CMapCompressionType}}),Object.defineProperty(p,"GlobalWorkerOptions",{enumerable:!0,get:function(){return K.GlobalWorkerOptions}}),Object.defineProperty(p,"InvalidPDFException",{enumerable:!0,get:function(){return o.InvalidPDFException}}),Object.defineProperty(p,"LoopbackPort",{enumerable:!0,get:function(){return y.LoopbackPort}}),Object.defineProperty(p,"MissingPDFException",{enumerable:!0,get:function(){return o.MissingPDFException}}),Object.defineProperty(p,"OPS",{enumerable:!0,get:function(){return o.OPS}}),Object.defineProperty(p,"PDFDataRangeTransport",{enumerable:!0,get:function(){return y.PDFDataRangeTransport}}),Object.defineProperty(p,"PDFDateString",{enumerable:!0,get:function(){return f.PDFDateString}}),Object.defineProperty(p,"PDFWorker",{enumerable:!0,get:function(){return y.PDFWorker}}),Object.defineProperty(p,"PasswordResponses",{enumerable:!0,get:function(){return o.PasswordResponses}}),Object.defineProperty(p,"PermissionFlag",{enumerable:!0,get:function(){return o.PermissionFlag}}),Object.defineProperty(p,"PixelsPerInch",{enumerable:!0,get:function(){return f.PixelsPerInch}}),Object.defineProperty(p,"RenderingCancelledException",{enumerable:!0,get:function(){return f.RenderingCancelledException}}),Object.defineProperty(p,"SVGGraphics",{enumerable:!0,get:function(){return w.SVGGraphics}}),Object.defineProperty(p,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return o.UNSUPPORTED_FEATURES}}),Object.defineProperty(p,"UnexpectedResponseException",{enumerable:!0,get:function(){return o.UnexpectedResponseException}}),Object.defineProperty(p,"Util",{enumerable:!0,get:function(){return o.Util}}),Object.defineProperty(p,"VerbosityLevel",{enumerable:!0,get:function(){return o.VerbosityLevel}}),Object.defineProperty(p,"XfaLayer",{enumerable:!0,get:function(){return T.XfaLayer}}),Object.defineProperty(p,"build",{enumerable:!0,get:function(){return y.build}}),Object.defineProperty(p,"createPromiseCapability",{enumerable:!0,get:function(){return o.createPromiseCapability}}),Object.defineProperty(p,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return o.createValidAbsoluteUrl}}),Object.defineProperty(p,"getDocument",{enumerable:!0,get:function(){return y.getDocument}}),Object.defineProperty(p,"getFilenameFromUrl",{enumerable:!0,get:function(){return f.getFilenameFromUrl}}),Object.defineProperty(p,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return f.getPdfFilenameFromUrl}}),Object.defineProperty(p,"getXfaPageViewport",{enumerable:!0,get:function(){return f.getXfaPageViewport}}),Object.defineProperty(p,"isPdfFile",{enumerable:!0,get:function(){return f.isPdfFile}}),Object.defineProperty(p,"loadScript",{enumerable:!0,get:function(){return f.loadScript}}),Object.defineProperty(p,"renderTextLayer",{enumerable:!0,get:function(){return b.renderTextLayer}}),Object.defineProperty(p,"shadow",{enumerable:!0,get:function(){return o.shadow}}),Object.defineProperty(p,"version",{enumerable:!0,get:function(){return y.version}});var o=__w_pdfjs_require__(1),y=__w_pdfjs_require__(4),f=__w_pdfjs_require__(8),_=__w_pdfjs_require__(22),Y=__w_pdfjs_require__(7),W=__w_pdfjs_require__(27),K=__w_pdfjs_require__(15),M=__w_pdfjs_require__(3),b=__w_pdfjs_require__(30),w=__w_pdfjs_require__(31),T=__w_pdfjs_require__(29);if(M.isNodeJS){const{PDFNodeStream:S}=__w_pdfjs_require__(32);(0,y.setPDFNetworkStreamFactory)(v=>new S(v))}else{const{PDFNetworkStream:S}=__w_pdfjs_require__(35),{PDFFetchStream:v}=__w_pdfjs_require__(36);(0,y.setPDFNetworkStreamFactory)(c=>(0,f.isValidFetchUrl)(c.url)?new v(c):new S(c))}})(),__webpack_exports__})())})(pdf)),pdf.exports}var pdfExports=requirePdf();const Be="#FFEB3B",ke=()=>`annotation_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,Ae=({pageNumber:p,scale:o,isAnnotating:y,annotations:f=[],onAnnotationAdd:_,onAnnotationDelete:Y,readOnly:W=!1})=>{const K=useRef(null),[M,b]=useState(!1),[w,T]=useState({x:0,y:0}),[S,v]=useState(null),[c,t]=useState(null),r=useCallback(l=>{if(!y||!K.current)return;const n=K.current.getBoundingClientRect(),i=(l.clientX-n.left)/n.width,e=(l.clientY-n.top)/n.height;console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:",{clientX:l.clientX,clientY:l.clientY,rect:n,x:i,y:e,scale:o}),b(!0),T({x:i,y:e})},[y,o]),a=useCallback(l=>{if(!M||!K.current)return;const n=K.current.getBoundingClientRect(),i=(l.clientX-n.left)/n.width,e=(l.clientY-n.top)/n.height;v({x:Math.min(w.x,i),y:Math.min(w.y,e),width:Math.abs(i-w.x),height:Math.abs(e-w.y)})},[M,w,o]),F=useCallback(()=>{if(!M||!S)return;if(b(!1),S.width<5||S.height<5){v(null);return}const l={id:ke(),pageNumber:p,...S,content:"",color:Be};_==null||_(l),v(null)},[M,S,p,_]),m=useCallback(l=>{t(c===l?null:l)},[c]);return useCallback((l,n)=>{const i={...l,content:n};_==null||_(i)},[_]),useCallback(l=>{Y==null||Y(l),t(null)},[Y]),console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:",{pageNumber:p,annotations:f.length,currentPageAnnotationsCount:f.filter(l=>l.pageNumber===p).length,currentPageAnnotations:f.filter(l=>l.pageNumber===p)}),m__default.createElement("div",{ref:K,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10,pointerEvents:"auto"},onMouseDown:r,onMouseMove:a,onMouseUp:F,onMouseLeave:F},S&&m__default.createElement("div",{className:"absolute border-2 border-yellow-400 bg-yellow-100/30",style:{left:`${S.x*100}%`,top:`${S.y*100}%`,width:`${S.width*100}%`,height:`${S.height*100}%`}}),f.filter(l=>l.pageNumber===p).map(l=>(console.log("\u6E32\u67D3\u6807\u6CE8:",l.id,`\u4F4D\u7F6E: ${l.x*100}%, ${l.y*100}%`),m__default.createElement("div",{key:l.id,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0}},m__default.createElement("div",{className:"border border-solid",style:{position:"absolute",left:`${l.x*100}%`,top:`${l.y*100}%`,width:`${l.width*100}%`,height:`${l.height*100}%`,borderWidth:"2px",borderColor:`${l.color}`,backgroundColor:`${l.color}4D`,zIndex:1e3},onClick:()=>m(l.id)})))))},$e=()=>{try{if(xe())console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:",yt());else{const p="/worker/pdf.worker.min.js";console.log("\u6B63\u5728\u6CE8\u518CPDF Worker\uFF0C\u8DEF\u5F84:",p,"\u73AF\u5883:","\u751F\u4EA7"),De(p)}}catch(p){console.warn("PDF Worker \u81EA\u52A8\u6CE8\u518C\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6CE8\u518C:",p)}};$e();const Pe={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},_e=dt$1.div`
42
+ `}setFont(n){const i=this.current,e=this.commonObjs.get(n[0]);let E=n[1];i.font=e,this.embedFonts&&!e.missingFile&&!this.embeddedFonts[e.loadedName]&&(this.addFontStyle(e),this.embeddedFonts[e.loadedName]=e),i.fontMatrix=e.fontMatrix||_.FONT_IDENTITY_MATRIX;let x="normal";e.black?x="900":e.bold&&(x="bold");const N=e.italic?"italic":"normal";E<0?(E=-E,i.fontDirection=-1):i.fontDirection=1,i.fontSize=E,i.fontFamily=e.loadedName,i.fontWeight=x,i.fontStyle=N,i.tspan=this.svgFactory.createElement("svg:tspan"),i.tspan.setAttributeNS(null,"y",r(-i.y)),i.xcoords=[],i.ycoords=[]}endText(){var i;const n=this.current;n.textRenderingMode&_.TextRenderingMode.ADD_TO_PATH_FLAG&&((i=n.txtElement)!=null&&i.hasChildNodes())&&(n.element=n.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(n){n>0&&(this.current.lineWidth=n)}setLineCap(n){this.current.lineCap=w[n]}setLineJoin(n){this.current.lineJoin=T[n]}setMiterLimit(n){this.current.miterLimit=n}setStrokeAlpha(n){this.current.strokeAlpha=n}setStrokeRGBColor(n,i,e){this.current.strokeColor=_.Util.makeHexColor(n,i,e)}setFillAlpha(n){this.current.fillAlpha=n}setFillRGBColor(n,i,e){this.current.fillColor=_.Util.makeHexColor(n,i,e),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(n){this.current.strokeColor=this._makeColorN_Pattern(n)}setFillColorN(n){this.current.fillColor=this._makeColorN_Pattern(n)}shadingFill(n){const i=this.viewport.width,e=this.viewport.height,E=_.Util.inverseTransform(this.transformMatrix),x=_.Util.applyTransform([0,0],E),N=_.Util.applyTransform([0,e],E),I=_.Util.applyTransform([i,0],E),St=_.Util.applyTransform([i,e],E),Pt=Math.min(x[0],N[0],I[0],St[0]),bt=Math.min(x[1],N[1],I[1],St[1]),V=Math.max(x[0],N[0],I[0],St[0]),O=Math.max(x[1],N[1],I[1],St[1]),z=this.svgFactory.createElement("svg:rect");z.setAttributeNS(null,"x",Pt),z.setAttributeNS(null,"y",bt),z.setAttributeNS(null,"width",V-Pt),z.setAttributeNS(null,"height",O-bt),z.setAttributeNS(null,"fill",this._makeShadingPattern(n)),this.current.fillAlpha<1&&z.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(z)}_makeColorN_Pattern(n){return n[0]==="TilingPattern"?this._makeTilingPattern(n):this._makeShadingPattern(n)}_makeTilingPattern(n){const i=n[1],e=n[2],E=n[3]||_.IDENTITY_MATRIX,[x,N,I,St]=n[4],Pt=n[5],bt=n[6],V=n[7],O=`shading${l++}`,[z,G,_t,wt]=_.Util.normalizeRect([..._.Util.applyTransform([x,N],E),..._.Util.applyTransform([I,St],E)]),[Ot,q]=_.Util.singularValueDecompose2dScale(E),d=Pt*Ot,u=bt*q,P=this.svgFactory.createElement("svg:pattern");P.setAttributeNS(null,"id",O),P.setAttributeNS(null,"patternUnits","userSpaceOnUse"),P.setAttributeNS(null,"width",d),P.setAttributeNS(null,"height",u),P.setAttributeNS(null,"x",`${z}`),P.setAttributeNS(null,"y",`${G}`);const j=this.svg,U=this.transformMatrix,$=this.current.fillColor,s=this.current.strokeColor,h=this.svgFactory.create(_t-z,wt-G);if(this.svg=h,this.transformMatrix=E,V===2){const C=_.Util.makeHexColor(...i);this.current.fillColor=C,this.current.strokeColor=C}return this.executeOpTree(this.convertOpList(e)),this.svg=j,this.transformMatrix=U,this.current.fillColor=$,this.current.strokeColor=s,P.append(h.childNodes[0]),this.defs.append(P),`url(#${O})`}_makeShadingPattern(n){switch(typeof n=="string"&&(n=this.objs.get(n)),n[0]){case"RadialAxial":const i=`shading${l++}`,e=n[3];let E;switch(n[1]){case"axial":const x=n[4],N=n[5];E=this.svgFactory.createElement("svg:linearGradient"),E.setAttributeNS(null,"id",i),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"x1",x[0]),E.setAttributeNS(null,"y1",x[1]),E.setAttributeNS(null,"x2",N[0]),E.setAttributeNS(null,"y2",N[1]);break;case"radial":const I=n[4],St=n[5],Pt=n[6],bt=n[7];E=this.svgFactory.createElement("svg:radialGradient"),E.setAttributeNS(null,"id",i),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"cx",St[0]),E.setAttributeNS(null,"cy",St[1]),E.setAttributeNS(null,"r",bt),E.setAttributeNS(null,"fx",I[0]),E.setAttributeNS(null,"fy",I[1]),E.setAttributeNS(null,"fr",Pt);break;default:throw new Error(`Unknown RadialAxial type: ${n[1]}`)}for(const x of e){const N=this.svgFactory.createElement("svg:stop");N.setAttributeNS(null,"offset",x[0]),N.setAttributeNS(null,"stop-color",x[1]),E.append(N)}return this.defs.append(E),`url(#${i})`;case"Mesh":return(0,_.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${n[0]}`)}}setDash(n,i){this.current.dashArray=n,this.current.dashPhase=i}constructPath(n,i){const e=this.current;let E=e.x,x=e.y,N=[],I=0;for(const St of n)switch(St|0){case _.OPS.rectangle:E=i[I++],x=i[I++];const Pt=i[I++],bt=i[I++],V=E+Pt,O=x+bt;N.push("M",r(E),r(x),"L",r(V),r(x),"L",r(V),r(O),"L",r(E),r(O),"Z");break;case _.OPS.moveTo:E=i[I++],x=i[I++],N.push("M",r(E),r(x));break;case _.OPS.lineTo:E=i[I++],x=i[I++],N.push("L",r(E),r(x));break;case _.OPS.curveTo:E=i[I+4],x=i[I+5],N.push("C",r(i[I]),r(i[I+1]),r(i[I+2]),r(i[I+3]),r(E),r(x)),I+=6;break;case _.OPS.curveTo2:N.push("C",r(E),r(x),r(i[I]),r(i[I+1]),r(i[I+2]),r(i[I+3])),E=i[I+2],x=i[I+3],I+=4;break;case _.OPS.curveTo3:E=i[I+2],x=i[I+3],N.push("C",r(i[I]),r(i[I+1]),r(E),r(x),r(E),r(x)),I+=4;break;case _.OPS.closePath:N.push("Z");break}N=N.join(" "),e.path&&n.length>0&&n[0]!==_.OPS.rectangle&&n[0]!==_.OPS.moveTo?N=e.path.getAttributeNS(null,"d")+N:(e.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(e.path)),e.path.setAttributeNS(null,"d",N),e.path.setAttributeNS(null,"fill","none"),e.element=e.path,e.setCurrentPoint(E,x)}endPath(){const n=this.current;if(n.path=null,!this.pendingClip)return;if(!n.element){this.pendingClip=null;return}const i=`clippath${F++}`,e=this.svgFactory.createElement("svg:clipPath");e.setAttributeNS(null,"id",i),e.setAttributeNS(null,"transform",a(this.transformMatrix));const E=n.element.cloneNode(!0);if(this.pendingClip==="evenodd"?E.setAttributeNS(null,"clip-rule","evenodd"):E.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,e.append(E),this.defs.append(e),n.activeClipUrl){n.clipGroup=null;for(const x of this.extraStack)x.clipGroup=null;e.setAttributeNS(null,"clip-path",n.activeClipUrl)}n.activeClipUrl=`url(#${i})`,this.tgrp=null}clip(n){this.pendingClip=n}closePath(){const n=this.current;if(n.path){const i=`${n.path.getAttributeNS(null,"d")}Z`;n.path.setAttributeNS(null,"d",i)}}setLeading(n){this.current.leading=-n}setTextRise(n){this.current.textRise=n}setTextRenderingMode(n){this.current.textRenderingMode=n}setHScale(n){this.current.textHScale=n/100}setRenderingIntent(n){}setFlatness(n){}setGState(n){for(const[i,e]of n)switch(i){case"LW":this.setLineWidth(e);break;case"LC":this.setLineCap(e);break;case"LJ":this.setLineJoin(e);break;case"ML":this.setMiterLimit(e);break;case"D":this.setDash(e[0],e[1]);break;case"RI":this.setRenderingIntent(e);break;case"FL":this.setFlatness(e);break;case"Font":this.setFont(e);break;case"CA":this.setStrokeAlpha(e);break;case"ca":this.setFillAlpha(e);break;default:(0,_.warn)(`Unimplemented graphic state operator ${i}`);break}}fill(){const n=this.current;n.element&&(n.element.setAttributeNS(null,"fill",n.fillColor),n.element.setAttributeNS(null,"fill-opacity",n.fillAlpha),this.endPath())}stroke(){const n=this.current;n.element&&(this._setStrokeAttributes(n.element),n.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(n,i=1){const e=this.current;let E=e.dashArray;i!==1&&E.length>0&&(E=E.map(function(x){return i*x})),n.setAttributeNS(null,"stroke",e.strokeColor),n.setAttributeNS(null,"stroke-opacity",e.strokeAlpha),n.setAttributeNS(null,"stroke-miterlimit",r(e.miterLimit)),n.setAttributeNS(null,"stroke-linecap",e.lineCap),n.setAttributeNS(null,"stroke-linejoin",e.lineJoin),n.setAttributeNS(null,"stroke-width",r(i*e.lineWidth)+"px"),n.setAttributeNS(null,"stroke-dasharray",E.map(r).join(" ")),n.setAttributeNS(null,"stroke-dashoffset",r(i*e.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x","0"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","1px"),n.setAttributeNS(null,"height","1px"),n.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(n)}paintImageXObject(n){const i=n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n);if(!i){(0,_.warn)(`Dependent image with object ID ${n} is not ready yet`);return}this.paintInlineImageXObject(i)}paintInlineImageXObject(n,i){const e=n.width,E=n.height,x=v(n,this.forceDataSchema,!!i),N=this.svgFactory.createElement("svg:rect");N.setAttributeNS(null,"x","0"),N.setAttributeNS(null,"y","0"),N.setAttributeNS(null,"width",r(e)),N.setAttributeNS(null,"height",r(E)),this.current.element=N,this.clip("nonzero");const I=this.svgFactory.createElement("svg:image");I.setAttributeNS(b,"xlink:href",x),I.setAttributeNS(null,"x","0"),I.setAttributeNS(null,"y",r(-E)),I.setAttributeNS(null,"width",r(e)+"px"),I.setAttributeNS(null,"height",r(E)+"px"),I.setAttributeNS(null,"transform",`scale(${r(1/e)} ${r(-1/E)})`),i?i.append(I):this._ensureTransformGroup().append(I)}paintImageMaskXObject(n){const i=this.current,e=n.width,E=n.height,x=i.fillColor;i.maskId=`mask${m++}`;const N=this.svgFactory.createElement("svg:mask");N.setAttributeNS(null,"id",i.maskId);const I=this.svgFactory.createElement("svg:rect");I.setAttributeNS(null,"x","0"),I.setAttributeNS(null,"y","0"),I.setAttributeNS(null,"width",r(e)),I.setAttributeNS(null,"height",r(E)),I.setAttributeNS(null,"fill",x),I.setAttributeNS(null,"mask",`url(#${i.maskId})`),this.defs.append(N),this._ensureTransformGroup().append(I),this.paintInlineImageXObject(n,N)}paintFormXObjectBegin(n,i){if(Array.isArray(n)&&n.length===6&&this.transform(n[0],n[1],n[2],n[3],n[4],n[5]),i){const e=i[2]-i[0],E=i[3]-i[1],x=this.svgFactory.createElement("svg:rect");x.setAttributeNS(null,"x",i[0]),x.setAttributeNS(null,"y",i[1]),x.setAttributeNS(null,"width",r(e)),x.setAttributeNS(null,"height",r(E)),this.current.element=x,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(n){const i=this.svgFactory.create(n.width,n.height),e=this.svgFactory.createElement("svg:defs");i.append(e),this.defs=e;const E=this.svgFactory.createElement("svg:g");return E.setAttributeNS(null,"transform",a(n.transform)),i.append(E),this.svg=E,i}_ensureClipGroup(){if(!this.current.clipGroup){const n=this.svgFactory.createElement("svg:g");n.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(n),this.current.clipGroup=n}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",a(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PDFNodeStream=void 0;var f=y(1),_=y(33);const Y=require$$5,W=require$$5,K=require$$5,M=require$$5,b=/^file:\/\/\/[a-zA-Z]:\//;function w(m){const l=M.parse(m);return l.protocol==="file:"||l.host?l:/^[a-z]:[/\\]/i.test(m)?M.parse(`file:///${m}`):(l.host||(l.protocol="file:"),l)}class T{constructor(l){this.source=l,this.url=w(l.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&l.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new a(this):new t(this),this._fullRequestReader}getRangeReader(l,n){if(n<=this._progressiveDataLength)return null;const i=this.isFsUrl?new F(this,l,n):new r(this,l,n);return this._rangeRequestReaders.push(i),i}cancelAllRequests(l){this._fullRequestReader&&this._fullRequestReader.cancel(l);for(const n of this._rangeRequestReaders.slice(0))n.cancel(l)}}o.PDFNodeStream=T;class S{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null;const n=l.source;this._contentLength=n.length,this._loaded=0,this._filename=null,this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)(),this._headersCapability=(0,f.createPromiseCapability)()}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const l=this._readableStream.read();return l===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=l.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(l).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",n=>{this._error(n)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new f.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class v{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)();const n=l.source;this._isStreamingSupported=!n.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const l=this._readableStream.read();return l===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=l.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(l).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",n=>{this._error(n)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function c(m,l){return{protocol:m.protocol,auth:m.auth,host:m.hostname,port:m.port,path:m.path,method:"GET",headers:l}}class t extends S{constructor(l){super(l);const n=i=>{if(i.statusCode===404){const N=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=N,this._headersCapability.reject(N);return}this._headersCapability.resolve(),this._setReadableStream(i);const e=N=>this._readableStream.headers[N.toLowerCase()],{allowRangeRequests:E,suggestedLength:x}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:l.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=E,this._contentLength=x||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(e)};this._request=null,this._url.protocol==="http:"?this._request=W.request(c(this._url,l.httpHeaders),n):this._request=K.request(c(this._url,l.httpHeaders),n),this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class r extends v{constructor(l,n,i){super(l),this._httpHeaders={};for(const E in l.httpHeaders){const x=l.httpHeaders[E];typeof x>"u"||(this._httpHeaders[E]=x)}this._httpHeaders.Range=`bytes=${n}-${i-1}`;const e=E=>{if(E.statusCode===404){const x=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=x;return}this._setReadableStream(E)};this._request=null,this._url.protocol==="http:"?this._request=W.request(c(this._url,this._httpHeaders),e):this._request=K.request(c(this._url,this._httpHeaders),e),this._request.on("error",E=>{this._storedError=E}),this._request.end()}}class a extends S{constructor(l){super(l);let n=decodeURIComponent(this._url.path);b.test(this._url.href)&&(n=n.replace(/^\//,"")),Y.lstat(n,(i,e)=>{if(i){i.code==="ENOENT"&&(i=new f.MissingPDFException(`Missing PDF "${n}".`)),this._storedError=i,this._headersCapability.reject(i);return}this._contentLength=e.size,this._setReadableStream(Y.createReadStream(n)),this._headersCapability.resolve()})}}class F extends v{constructor(l,n,i){super(l);let e=decodeURIComponent(this._url.path);b.test(this._url.href)&&(e=e.replace(/^\//,"")),this._setReadableStream(Y.createReadStream(e,{start:n,end:i-1}))}}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createResponseStatusError=M,o.extractFilenameFromHeader=K,o.validateRangeRequestCapabilities=W,o.validateResponseStatus=b;var f=y(1),_=y(34),Y=y(8);function W({getResponseHeader:w,isHttp:T,rangeChunkSize:S,disableRange:v}){const c={allowRangeRequests:!1,suggestedLength:void 0},t=parseInt(w("Content-Length"),10);return!Number.isInteger(t)||(c.suggestedLength=t,t<=2*S)||v||!T||w("Accept-Ranges")!=="bytes"||(w("Content-Encoding")||"identity")!=="identity"||(c.allowRangeRequests=!0),c}function K(w){const T=w("Content-Disposition");if(T){let S=(0,_.getFilenameFromContentDispositionHeader)(T);if(S.includes("%"))try{S=decodeURIComponent(S)}catch{}if((0,Y.isPdfFile)(S))return S}return null}function M(w,T){return w===404||w===0&&T.startsWith("file:")?new f.MissingPDFException('Missing PDF "'+T+'".'):new f.UnexpectedResponseException(`Unexpected server response (${w}) while retrieving PDF "${T}".`,w)}function b(w){return w===200||w===206}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getFilenameFromContentDispositionHeader=_;var f=y(1);function _(Y){let W=!0,K=M("filename\\*","i").exec(Y);if(K){K=K[1];let t=S(K);return t=unescape(t),t=v(t),t=c(t),w(t)}if(K=T(Y),K){const t=c(K);return w(t)}if(K=M("filename","i").exec(Y),K){K=K[1];let t=S(K);return t=c(t),w(t)}function M(t,r){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',r)}function b(t,r){if(t){if(!/^[\x00-\xFF]+$/.test(r))return r;try{const a=new TextDecoder(t,{fatal:!0}),F=(0,f.stringToBytes)(r);r=a.decode(F),W=!1}catch{}}return r}function w(t){return W&&/[\x80-\xff]/.test(t)&&(t=b("utf-8",t),W&&(t=b("iso-8859-1",t))),t}function T(t){const r=[];let a;const F=M("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(a=F.exec(t))!==null;){let[,l,n,i]=a;if(l=parseInt(l,10),l in r){if(l===0)break;continue}r[l]=[n,i]}const m=[];for(let l=0;l<r.length&&l in r;++l){let[n,i]=r[l];i=S(i),n&&(i=unescape(i),l===0&&(i=v(i))),m.push(i)}return m.join("")}function S(t){if(t.startsWith('"')){const r=t.slice(1).split('\\"');for(let a=0;a<r.length;++a){const F=r[a].indexOf('"');F!==-1&&(r[a]=r[a].slice(0,F),r.length=a+1),r[a]=r[a].replace(/\\(.)/g,"$1")}t=r.join('"')}return t}function v(t){const r=t.indexOf("'");if(r===-1)return t;const a=t.slice(0,r),m=t.slice(r+1).replace(/^[^']*'/,"");return b(a,m)}function c(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(r,a,F,m){if(F==="q"||F==="Q")return m=m.replace(/_/g," "),m=m.replace(/=([0-9a-fA-F]{2})/g,function(l,n){return String.fromCharCode(parseInt(n,16))}),b(a,m);try{m=atob(m)}catch{}return b(a,m)})}return""}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PDFNetworkStream=void 0;var f=y(1),_=y(33);const Y=200,W=206;function K(S){const v=S.response;return typeof v!="string"?v:(0,f.stringToBytes)(v).buffer}class M{constructor(v,c={}){this.url=v,this.isHttp=/^https?:/i.test(v),this.httpHeaders=this.isHttp&&c.httpHeaders||Object.create(null),this.withCredentials=c.withCredentials||!1,this.getXhr=c.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(v,c,t){const r={begin:v,end:c};for(const a in t)r[a]=t[a];return this.request(r)}requestFull(v){return this.request(v)}request(v){const c=this.getXhr(),t=this.currXhrId++,r=this.pendingRequests[t]={xhr:c};c.open("GET",this.url),c.withCredentials=this.withCredentials;for(const a in this.httpHeaders){const F=this.httpHeaders[a];typeof F>"u"||c.setRequestHeader(a,F)}return this.isHttp&&"begin"in v&&"end"in v?(c.setRequestHeader("Range",`bytes=${v.begin}-${v.end-1}`),r.expectedStatus=W):r.expectedStatus=Y,c.responseType="arraybuffer",v.onError&&(c.onerror=function(a){v.onError(c.status)}),c.onreadystatechange=this.onStateChange.bind(this,t),c.onprogress=this.onProgress.bind(this,t),r.onHeadersReceived=v.onHeadersReceived,r.onDone=v.onDone,r.onError=v.onError,r.onProgress=v.onProgress,c.send(null),t}onProgress(v,c){var r;const t=this.pendingRequests[v];t&&((r=t.onProgress)==null||r.call(t,c))}onStateChange(v,c){var l,n,i;const t=this.pendingRequests[v];if(!t)return;const r=t.xhr;if(r.readyState>=2&&t.onHeadersReceived&&(t.onHeadersReceived(),delete t.onHeadersReceived),r.readyState!==4||!(v in this.pendingRequests))return;if(delete this.pendingRequests[v],r.status===0&&this.isHttp){(l=t.onError)==null||l.call(t,r.status);return}const a=r.status||Y;if(!(a===Y&&t.expectedStatus===W)&&a!==t.expectedStatus){(n=t.onError)==null||n.call(t,r.status);return}const m=K(r);if(a===W){const e=r.getResponseHeader("Content-Range"),E=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t.onDone({begin:parseInt(E[1],10),chunk:m})}else m?t.onDone({begin:0,chunk:m}):(i=t.onError)==null||i.call(t,r.status)}getRequestXhr(v){return this.pendingRequests[v].xhr}isPendingRequest(v){return v in this.pendingRequests}abortRequest(v){const c=this.pendingRequests[v].xhr;delete this.pendingRequests[v],c.abort()}}class b{constructor(v){this._source=v,this._manager=new M(v.url,{httpHeaders:v.httpHeaders,withCredentials:v.withCredentials}),this._rangeChunkSize=v.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(v){const c=this._rangeRequestReaders.indexOf(v);c>=0&&this._rangeRequestReaders.splice(c,1)}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new w(this._manager,this._source),this._fullRequestReader}getRangeReader(v,c){const t=new T(this._manager,v,c);return t.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(t),t}cancelAllRequests(v){var c;(c=this._fullRequestReader)==null||c.cancel(v);for(const t of this._rangeRequestReaders.slice(0))t.cancel(v)}}o.PDFNetworkStream=b;class w{constructor(v,c){this._manager=v;const t={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=c.url,this._fullRequestId=v.requestFull(t),this._headersReceivedCapability=(0,f.createPromiseCapability)(),this._disableRange=c.disableRange||!1,this._contentLength=c.length,this._rangeChunkSize=c.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const v=this._fullRequestId,c=this._manager.getRequestXhr(v),t=F=>c.getResponseHeader(F),{allowRangeRequests:r,suggestedLength:a}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),this._isRangeSupported&&this._manager.abortRequest(v),this._headersReceivedCapability.resolve()}_onDone(v){if(v&&(this._requests.length>0?this._requests.shift().resolve({value:v.chunk,done:!1}):this._cachedChunks.push(v.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(v){this._storedError=(0,_.createResponseStatusError)(v,this._url),this._headersReceivedCapability.reject(this._storedError);for(const c of this._requests)c.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(v){var c;(c=this.onProgress)==null||c.call(this,{loaded:v.loaded,total:v.lengthComputable?v.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(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 v=(0,f.createPromiseCapability)();return this._requests.push(v),v.promise}cancel(v){this._done=!0,this._headersReceivedCapability.reject(v);for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class T{constructor(v,c,t){this._manager=v;const r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=v.url,this._requestId=v.requestRange(c,t,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var v;(v=this.onClosed)==null||v.call(this,this)}_onDone(v){const c=v.chunk;this._requests.length>0?this._requests.shift().resolve({value:c,done:!1}):this._queuedChunk=c,this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(v){this._storedError=(0,_.createResponseStatusError)(v,this._url);for(const c of this._requests)c.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(v){var c;this.isStreamingSupported||(c=this.onProgress)==null||c.call(this,{loaded:v.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const c=this._queuedChunk;return this._queuedChunk=null,{value:c,done:!1}}if(this._done)return{value:void 0,done:!0};const v=(0,f.createPromiseCapability)();return this._requests.push(v),v.promise}cancel(v){this._done=!0;for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((p,o,y)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PDFFetchStream=void 0;var f=y(1),_=y(33);function Y(w,T,S){return{method:"GET",headers:w,signal:S.signal,mode:"cors",credentials:T?"include":"same-origin",redirect:"follow"}}function W(w){const T=new Headers;for(const S in w){const v=w[S];typeof v>"u"||T.append(S,v)}return T}class K{constructor(T){this.source=T,this.isHttp=/^https?:/i.test(T.url),this.httpHeaders=this.isHttp&&T.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var T;return((T=this._fullRequestReader)==null?void 0:T._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new M(this),this._fullRequestReader}getRangeReader(T,S){if(S<=this._progressiveDataLength)return null;const v=new b(this,T,S);return this._rangeRequestReaders.push(v),v}cancelAllRequests(T){this._fullRequestReader&&this._fullRequestReader.cancel(T);for(const S of this._rangeRequestReaders.slice(0))S.cancel(T)}}o.PDFFetchStream=K;class M{constructor(T){this._stream=T,this._reader=null,this._loaded=0,this._filename=null;const S=T.source;this._withCredentials=S.withCredentials||!1,this._contentLength=S.length,this._headersCapability=(0,f.createPromiseCapability)(),this._disableRange=S.disableRange||!1,this._rangeChunkSize=S.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!S.disableStream,this._isRangeSupported=!S.disableRange,this._headers=W(this._stream.httpHeaders);const v=S.url;fetch(v,Y(this._headers,this._withCredentials,this._abortController)).then(c=>{if(!(0,_.validateResponseStatus)(c.status))throw(0,_.createResponseStatusError)(c.status,v);this._reader=c.body.getReader(),this._headersCapability.resolve();const t=F=>c.headers.get(F),{allowRangeRequests:r,suggestedLength:a}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new f.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}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(){await this._headersCapability.promise;const{value:T,done:S}=await this._reader.read();return S?{value:T,done:S}:(this._loaded+=T.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(T).buffer,done:!1})}cancel(T){this._reader&&this._reader.cancel(T),this._abortController.abort()}}class b{constructor(T,S,v){this._stream=T,this._reader=null,this._loaded=0;const c=T.source;this._withCredentials=c.withCredentials||!1,this._readCapability=(0,f.createPromiseCapability)(),this._isStreamingSupported=!c.disableStream,this._abortController=new AbortController,this._headers=W(this._stream.httpHeaders),this._headers.append("Range",`bytes=${S}-${v-1}`);const t=c.url;fetch(t,Y(this._headers,this._withCredentials,this._abortController)).then(r=>{if(!(0,_.validateResponseStatus)(r.status))throw(0,_.createResponseStatusError)(r.status,t);this._readCapability.resolve(),this._reader=r.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:T,done:S}=await this._reader.read();return S?{value:T,done:S}:(this._loaded+=T.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(T).buffer,done:!1})}cancel(T){this._reader&&this._reader.cancel(T),this._abortController.abort()}}})],__webpack_module_cache__={};function __w_pdfjs_require__(p){var o=__webpack_module_cache__[p];if(o!==void 0)return o.exports;var y=__webpack_module_cache__[p]={exports:{}};return __webpack_modules__[p](y,y.exports,__w_pdfjs_require__),y.exports}var __webpack_exports__={};return(()=>{var p=__webpack_exports__;Object.defineProperty(p,"__esModule",{value:!0}),Object.defineProperty(p,"AnnotationEditorLayer",{enumerable:!0,get:function(){return _.AnnotationEditorLayer}}),Object.defineProperty(p,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return o.AnnotationEditorParamsType}}),Object.defineProperty(p,"AnnotationEditorType",{enumerable:!0,get:function(){return o.AnnotationEditorType}}),Object.defineProperty(p,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return Y.AnnotationEditorUIManager}}),Object.defineProperty(p,"AnnotationLayer",{enumerable:!0,get:function(){return W.AnnotationLayer}}),Object.defineProperty(p,"AnnotationMode",{enumerable:!0,get:function(){return o.AnnotationMode}}),Object.defineProperty(p,"CMapCompressionType",{enumerable:!0,get:function(){return o.CMapCompressionType}}),Object.defineProperty(p,"GlobalWorkerOptions",{enumerable:!0,get:function(){return K.GlobalWorkerOptions}}),Object.defineProperty(p,"InvalidPDFException",{enumerable:!0,get:function(){return o.InvalidPDFException}}),Object.defineProperty(p,"LoopbackPort",{enumerable:!0,get:function(){return y.LoopbackPort}}),Object.defineProperty(p,"MissingPDFException",{enumerable:!0,get:function(){return o.MissingPDFException}}),Object.defineProperty(p,"OPS",{enumerable:!0,get:function(){return o.OPS}}),Object.defineProperty(p,"PDFDataRangeTransport",{enumerable:!0,get:function(){return y.PDFDataRangeTransport}}),Object.defineProperty(p,"PDFDateString",{enumerable:!0,get:function(){return f.PDFDateString}}),Object.defineProperty(p,"PDFWorker",{enumerable:!0,get:function(){return y.PDFWorker}}),Object.defineProperty(p,"PasswordResponses",{enumerable:!0,get:function(){return o.PasswordResponses}}),Object.defineProperty(p,"PermissionFlag",{enumerable:!0,get:function(){return o.PermissionFlag}}),Object.defineProperty(p,"PixelsPerInch",{enumerable:!0,get:function(){return f.PixelsPerInch}}),Object.defineProperty(p,"RenderingCancelledException",{enumerable:!0,get:function(){return f.RenderingCancelledException}}),Object.defineProperty(p,"SVGGraphics",{enumerable:!0,get:function(){return w.SVGGraphics}}),Object.defineProperty(p,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return o.UNSUPPORTED_FEATURES}}),Object.defineProperty(p,"UnexpectedResponseException",{enumerable:!0,get:function(){return o.UnexpectedResponseException}}),Object.defineProperty(p,"Util",{enumerable:!0,get:function(){return o.Util}}),Object.defineProperty(p,"VerbosityLevel",{enumerable:!0,get:function(){return o.VerbosityLevel}}),Object.defineProperty(p,"XfaLayer",{enumerable:!0,get:function(){return T.XfaLayer}}),Object.defineProperty(p,"build",{enumerable:!0,get:function(){return y.build}}),Object.defineProperty(p,"createPromiseCapability",{enumerable:!0,get:function(){return o.createPromiseCapability}}),Object.defineProperty(p,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return o.createValidAbsoluteUrl}}),Object.defineProperty(p,"getDocument",{enumerable:!0,get:function(){return y.getDocument}}),Object.defineProperty(p,"getFilenameFromUrl",{enumerable:!0,get:function(){return f.getFilenameFromUrl}}),Object.defineProperty(p,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return f.getPdfFilenameFromUrl}}),Object.defineProperty(p,"getXfaPageViewport",{enumerable:!0,get:function(){return f.getXfaPageViewport}}),Object.defineProperty(p,"isPdfFile",{enumerable:!0,get:function(){return f.isPdfFile}}),Object.defineProperty(p,"loadScript",{enumerable:!0,get:function(){return f.loadScript}}),Object.defineProperty(p,"renderTextLayer",{enumerable:!0,get:function(){return b.renderTextLayer}}),Object.defineProperty(p,"shadow",{enumerable:!0,get:function(){return o.shadow}}),Object.defineProperty(p,"version",{enumerable:!0,get:function(){return y.version}});var o=__w_pdfjs_require__(1),y=__w_pdfjs_require__(4),f=__w_pdfjs_require__(8),_=__w_pdfjs_require__(22),Y=__w_pdfjs_require__(7),W=__w_pdfjs_require__(27),K=__w_pdfjs_require__(15),M=__w_pdfjs_require__(3),b=__w_pdfjs_require__(30),w=__w_pdfjs_require__(31),T=__w_pdfjs_require__(29);if(M.isNodeJS){const{PDFNodeStream:S}=__w_pdfjs_require__(32);(0,y.setPDFNetworkStreamFactory)(v=>new S(v))}else{const{PDFNetworkStream:S}=__w_pdfjs_require__(35),{PDFFetchStream:v}=__w_pdfjs_require__(36);(0,y.setPDFNetworkStreamFactory)(c=>(0,f.isValidFetchUrl)(c.url)?new v(c):new S(c))}})(),__webpack_exports__})())})(pdf)),pdf.exports}var pdfExports=requirePdf();const Be="#FFEB3B",ke=()=>`annotation_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,Ae=({pageNumber:p,scale:o,isAnnotating:y,annotations:f=[],onAnnotationAdd:_,onAnnotationDelete:Y,readOnly:W=!1})=>{const K=useRef(null),[M,b]=useState(!1),[w,T]=useState({x:0,y:0}),[S,v]=useState(null),[c,t]=useState(null),r=useCallback(l=>{if(!y||!K.current)return;const n=K.current.getBoundingClientRect(),i=(l.clientX-n.left)/n.width,e=(l.clientY-n.top)/n.height;console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:",{clientX:l.clientX,clientY:l.clientY,rect:n,x:i,y:e,scale:o}),b(!0),T({x:i,y:e})},[y,o]),a=useCallback(l=>{if(!M||!K.current)return;const n=K.current.getBoundingClientRect(),i=(l.clientX-n.left)/n.width,e=(l.clientY-n.top)/n.height;v({x:Math.min(w.x,i),y:Math.min(w.y,e),width:Math.abs(i-w.x),height:Math.abs(e-w.y)})},[M,w,o]),F=useCallback(()=>{if(!M||!S)return;if(b(!1),S.width<5||S.height<5){v(null);return}const l={id:ke(),pageNumber:p,...S,content:"",color:Be};_==null||_(l),v(null)},[M,S,p,_]),m=useCallback(l=>{t(c===l?null:l)},[c]);return useCallback((l,n)=>{const i={...l,content:n};_==null||_(i)},[_]),useCallback(l=>{Y==null||Y(l),t(null)},[Y]),console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:",{pageNumber:p,annotations:f.length,currentPageAnnotationsCount:f.filter(l=>l.pageNumber===p).length,currentPageAnnotations:f.filter(l=>l.pageNumber===p)}),c__default.createElement("div",{ref:K,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10,pointerEvents:"auto"},onMouseDown:r,onMouseMove:a,onMouseUp:F,onMouseLeave:F},S&&c__default.createElement("div",{className:"absolute border-2 border-yellow-400 bg-yellow-100/30",style:{left:`${S.x*100}%`,top:`${S.y*100}%`,width:`${S.width*100}%`,height:`${S.height*100}%`}}),f.filter(l=>l.pageNumber===p).map(l=>(console.log("\u6E32\u67D3\u6807\u6CE8:",l.id,`\u4F4D\u7F6E: ${l.x*100}%, ${l.y*100}%`),c__default.createElement("div",{key:l.id,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0}},c__default.createElement("div",{className:"border border-solid",style:{position:"absolute",left:`${l.x*100}%`,top:`${l.y*100}%`,width:`${l.width*100}%`,height:`${l.height*100}%`,borderWidth:"2px",borderColor:`${l.color}`,backgroundColor:`${l.color}4D`,zIndex:1e3},onClick:()=>m(l.id)})))))},$e=()=>{try{if(xe())console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:",yt());else{const p="/worker/pdf.worker.min.js";console.log("\u6B63\u5728\u6CE8\u518CPDF Worker\uFF0C\u8DEF\u5F84:",p,"\u73AF\u5883:","\u751F\u4EA7"),De(p)}}catch(p){console.warn("PDF Worker \u81EA\u52A8\u6CE8\u518C\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6CE8\u518C:",p)}};$e();const Pe={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},_e=dt$1.div`
43
43
  display: flex;
44
44
  align-items: center;
45
45
  justify-content: center;
@@ -54,7 +54,7 @@ var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in
54
54
  color: ${p=>p.$theme.colors.error};
55
55
  font-size: 14px;
56
56
  text-align: center;
57
- `,Re=({pdfDocument:p,currentPage:o,pdfStartPage:y=1,scale:f,annotations:_,isAnnotating:Y,isSlidesMode:W=!1,onPageChange:K,onScaleChange:M,onAnnotationChange:b,onAnnotationDelete:w,styles:T})=>{const[S,v]=useState(!1),[c,t]=useState(null),[r,a]=useState(0),[F,m]=useState(0),[l,n]=useState(!1),[i,e]=useState(!0),E=(T==null?void 0:T.theme)||Pe,x=useRef(null),N=useRef(null),I=useRef(!1),St=useRef(null),Pt=useCallback(V=>{if(!N.current||!i||!M)return null;const O=N.current,z=O.offsetWidth-40,G=O.offsetHeight-40,_t=z/V.width,wt=G/V.height,Ot=Math.min(_t,wt,1),q=Math.max(.3,Math.min(1,Ot));return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:",{containerWidth:z,containerHeight:G,viewportWidth:V.width,viewportHeight:V.height,scaleX:_t,scaleY:wt,autoScale:Ot,finalScale:q}),q},[i,M]),bt=useCallback(async()=>{if(!(!p||!x.current)){if(I.current||St.current===o){console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");return}try{St.current=o,I.current=!0;const V=o-y+1;if(console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${y}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${o}, \u76F8\u5BF9\u9875\u7801=${V}`),V<1||V>p.numPages)throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${V}, PDF\u603B\u9875\u6570=${p.numPages}`),new Error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${o}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${p.numPages}\u9875`);const O=await p.getPage(V),z=x.current,G=z.getContext("2d");console.log("\u5F53\u524Dscale\u503C:",f);const _t=O.getViewport({scale:1});if(console.log("viewport\u5C3A\u5BF8:",_t.width,"x",_t.height),i&&e(!1),z.width=_t.width,z.height=_t.height,await O.render({canvasContext:G,viewport:_t}).promise,console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:",z.width,"x",z.height),N.current){const wt=N.current;console.log("\u5BB9\u5668\u5C3A\u5BF8:",wt.offsetWidth,"x",wt.offsetHeight),console.log("Canvas\u663E\u793A\u5C3A\u5BF8:",z.offsetWidth,"x",z.offsetHeight)}}catch(V){console.error("PDF\u6E32\u67D3\u5931\u8D25:",V)}finally{I.current=!1}}},[p,f,y,Pt,M,o]);return useEffect(()=>{p&&o&&y&&(console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:","pdfStartPage:"+y,"currentPage:"+o,"pdfDocument:",p),bt())},[o,p,y]),useEffect(()=>{p&&o&&bt()},[f,p,o]),S?m__default.createElement("div",{className:"flex justify-center items-center min-h-full"},m__default.createElement(_e,{$theme:E},"\u52A0\u8F7D\u4E2D...")):c?m__default.createElement("div",{className:"flex justify-center items-center min-h-full"},m__default.createElement(Te,{$theme:E},m__default.createElement("div",null,m__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),m__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},c)))):m__default.createElement("div",{ref:N,className:"bg-gray-100",style:{display:W?"block":"flex",justifyContent:W?"initial":"center",alignItems:W?"initial":"flex-start",padding:"20px",minHeight:"100%",width:"100%",overflow:"visible"}},S?m__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20"},m__default.createElement("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900"}),m__default.createElement("div",{className:"text-xs text-gray-600"},"PDF\u52A0\u8F7D\u4E2D...")):c?m__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20 text-red-500"},m__default.createElement("div",null,"\u6E32\u67D3\u9519\u8BEF"),m__default.createElement("div",{className:"text-xs"},c)):m__default.createElement("div",{className:"flex justify-center items-start"},m__default.createElement("div",{className:"relative",style:{transform:`scale(${f})`,transformOrigin:"center",display:"inline-block"}},m__default.createElement("canvas",{ref:x,className:"shadow-lg bg-white border border-gray-300",style:{display:"block"}}),m__default.createElement(Ae,{pageNumber:o,scale:f,isAnnotating:Y,annotations:_,onAnnotationAdd:b,onAnnotationDelete:w,readOnly:!Y}))))},Ne=dt$1.div`
57
+ `,Re=({pdfDocument:p,currentPage:o,pdfStartPage:y=1,scale:f,annotations:_,isAnnotating:Y,isSlidesMode:W=!1,onPageChange:K,onScaleChange:M,onAnnotationChange:b,onAnnotationDelete:w,styles:T})=>{const[S,v]=useState(!1),[c,t]=useState(null),[r,a]=useState(0),[F,m]=useState(0),[l,n]=useState(!1),[i,e]=useState(!0),E=(T==null?void 0:T.theme)||Pe,x=useRef(null),N=useRef(null),I=useRef(!1),St=useRef(null),Pt=useCallback(V=>{if(!N.current||!i||!M)return null;const O=N.current,z=O.offsetWidth-40,G=O.offsetHeight-40,_t=z/V.width,wt=G/V.height,Ot=Math.min(_t,wt,1),q=Math.max(.3,Math.min(1,Ot));return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:",{containerWidth:z,containerHeight:G,viewportWidth:V.width,viewportHeight:V.height,scaleX:_t,scaleY:wt,autoScale:Ot,finalScale:q}),q},[i,M]),bt=useCallback(async()=>{if(!(!p||!x.current)){if(I.current||St.current===o){console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");return}try{St.current=o,I.current=!0;const V=o-y+1;if(console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${y}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${o}, \u76F8\u5BF9\u9875\u7801=${V}`),V<1||V>p.numPages)throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${V}, PDF\u603B\u9875\u6570=${p.numPages}`),new Error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${o}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${p.numPages}\u9875`);const O=await p.getPage(V),z=x.current,G=z.getContext("2d");console.log("\u5F53\u524Dscale\u503C:",f);const _t=O.getViewport({scale:1});if(console.log("viewport\u5C3A\u5BF8:",_t.width,"x",_t.height),i&&e(!1),z.width=_t.width,z.height=_t.height,await O.render({canvasContext:G,viewport:_t}).promise,console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:",z.width,"x",z.height),N.current){const wt=N.current;console.log("\u5BB9\u5668\u5C3A\u5BF8:",wt.offsetWidth,"x",wt.offsetHeight),console.log("Canvas\u663E\u793A\u5C3A\u5BF8:",z.offsetWidth,"x",z.offsetHeight)}}catch(V){console.error("PDF\u6E32\u67D3\u5931\u8D25:",V)}finally{I.current=!1}}},[p,f,y,Pt,M,o]);return useEffect(()=>{p&&o&&y&&(console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:","pdfStartPage:"+y,"currentPage:"+o,"pdfDocument:",p),bt())},[o,p,y]),useEffect(()=>{p&&o&&bt()},[f,p,o]),S?c__default.createElement("div",{className:"flex justify-center items-center min-h-full"},c__default.createElement(_e,{$theme:E},"\u52A0\u8F7D\u4E2D...")):c?c__default.createElement("div",{className:"flex justify-center items-center min-h-full"},c__default.createElement(Te,{$theme:E},c__default.createElement("div",null,c__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),c__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},c)))):c__default.createElement("div",{ref:N,className:"bg-gray-100",style:{display:W?"block":"flex",justifyContent:W?"initial":"center",alignItems:W?"initial":"flex-start",padding:"20px",minHeight:"100%",width:"100%",overflow:"visible"}},S?c__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20"},c__default.createElement("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900"}),c__default.createElement("div",{className:"text-xs text-gray-600"},"PDF\u52A0\u8F7D\u4E2D...")):c?c__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20 text-red-500"},c__default.createElement("div",null,"\u6E32\u67D3\u9519\u8BEF"),c__default.createElement("div",{className:"text-xs"},c)):c__default.createElement("div",{className:"flex justify-center items-start"},c__default.createElement("div",{className:"relative",style:{transform:`scale(${f})`,transformOrigin:"center",display:"inline-block"}},c__default.createElement("canvas",{ref:x,className:"shadow-lg bg-white border border-gray-300",style:{display:"block"}}),c__default.createElement(Ae,{pageNumber:o,scale:f,isAnnotating:Y,annotations:_,onAnnotationAdd:b,onAnnotationDelete:w,readOnly:!Y}))))},Ne=dt$1.div`
58
58
  flex: 1;
59
59
  background: ${p=>p.$theme.colors.background};
60
60
  position: relative;
@@ -162,24 +162,24 @@ var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in
162
162
  .markdown-scrollbar::-webkit-scrollbar-thumb:hover {
163
163
  background: #a9a9a;
164
164
  }
165
- `,Me={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},We=p=>{if(console.log("=== detectFileType \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",p),!p)return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"),"unknown";const o=p.fileName||"",y=p.fileType||"",f=p.content;return console.log("\u68C0\u6D4B\u53C2\u6570:",{fileName:o,fileType:y,content:f}),y==="pdf"||y==="pdf_slides"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),y):y==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):y==="markdown_table"?(console.log("\u68C0\u6D4B\u5230Markdown\u8868\u683C\u6587\u4EF6"),"markdown_table"):y==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):y==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):y==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):o.toLowerCase().endsWith(".pdf")||(f==null?void 0:f.type)==="pdf"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),"pdf"):o.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||(f==null?void 0:f.type)==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):o.toLowerCase().endsWith(".md")||(f==null?void 0:f.type)==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):o.toLowerCase().match(/\.(html|htm)$/)||(f==null?void 0:f.type)==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):o.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||(f==null?void 0:f.type)==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):(console.log("\u672A\u8BC6\u522B\u7684\u6587\u4EF6\u7C7B\u578B\uFF0C\u8FD4\u56DE unknown"),"unknown")},Ie=(p,o,y=!1)=>{var f,_,Y,W,K,M,b;console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:","pdfStartPage:"+p.pdfStartPage,"currentPage:"+o.currentPage),console.log("=== renderPdfContent \u5F00\u59CB ==="),console.log("PDF\u6570\u636E:",p),console.log("PDF\u6587\u6863:",(f=p.content)==null?void 0:f.document),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof((_=p.content)==null?void 0:_.document)),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:",((Y=p.content)==null?void 0:Y.document)===null),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:",((W=p.content)==null?void 0:W.document)===void 0),console.log("PDF\u6587\u6863\u65B9\u6CD5:",(K=p.content)!=null&&K.document?Object.getOwnPropertyNames(Object.getPrototypeOf(p.content.document)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u5C5E\u6027:",(M=p.content)!=null&&M.document?Object.keys(p.content.document):"\u65E0\u6587\u6863");const w=p.pdfStartPage||1;console.log("PDF\u8D77\u59CB\u9875:",w);const T=(o.annotationData||[]).filter(c=>"pageNumber"in c&&"x"in c&&"y"in c);console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="),console.log("\u539F\u59CBannotationData:",o.annotationData),console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:",T);const S=y?.82:1,v=o.initialZoom||o.scale||S;return m__default.createElement(Re,{pdfDocument:((b=p.content)==null?void 0:b.document)||null,currentPage:o.currentPage||1,pdfStartPage:w,scale:v,annotations:T,isAnnotating:!1,isSlidesMode:y,onPageChange:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"pageChange",{pageNumber:c})}:void 0,onScaleChange:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"scaleChange",{scale:c})}:void 0,onAnnotationChange:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"annotationChange",{annotation:c})}:void 0,onAnnotationDelete:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"annotationDelete",{annotationId:c})}:void 0,styles:o.styles})},je=(p,o)=>{var y,f,_,Y,W,K,M,b,w,T,S,v,c,t;console.log("=== Fviewer renderImageContent ==="),console.log("data:",p),console.log("data.content:",p.content),console.log("data.content?.url:",(y=p.content)==null?void 0:y.url),console.log("rotation:",o.rotation);const r=((f=p.content)==null?void 0:f.url)||p.content,[a,F]=useState(!0),[m,l]=useState(!1),n=()=>{console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:",r),F(!1),l(!1)},i=()=>{console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",r),F(!1),l(!0)};return m__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",padding:"20px",overflow:"auto",position:"relative",backgroundColor:"#272727"}},a&&m__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",zIndex:1}},m__default.createElement("div",{style:{width:"32px",height:"32px",border:`3px solid ${((W=(Y=(_=o.styles)==null?void 0:_.theme)==null?void 0:Y.colors)==null?void 0:W.border)||"#dee2e6"}`,borderTop:`3px solid ${((b=(M=(K=o.styles)==null?void 0:K.theme)==null?void 0:M.colors)==null?void 0:b.primary)||"#007bff"}`,borderRadius:"50%",animation:"spin 1s linear infinite"}}),m__default.createElement("div",{style:{fontSize:"12px",color:((S=(T=(w=o.styles)==null?void 0:w.theme)==null?void 0:T.colors)==null?void 0:S.text)||"#343a40"}},"\u56FE\u7247\u52A0\u8F7D\u4E2D...")),m&&m__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",zIndex:1}},m__default.createElement("div",{style:{fontSize:"14px",color:((t=(c=(v=o.styles)==null?void 0:v.theme)==null?void 0:c.colors)==null?void 0:t.error)||"#dc3545"}},"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")),m__default.createElement("img",{src:r,alt:p.fileName||"\u56FE\u7247",onLoad:n,onError:i,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",transform:`scale(${o.scale||1}) rotate(${o.rotation||0}deg)`,opacity:a?0:1,transition:"opacity 0.3s ease-in-out, transform 0.2s ease-in-out"}}),m__default.createElement("style",null,`
165
+ `,Me={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},We=p=>{if(console.log("=== detectFileType \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",p),!p)return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"),"unknown";const o=p.fileName||"",y=p.fileType||"",f=p.content;return console.log("\u68C0\u6D4B\u53C2\u6570:",{fileName:o,fileType:y,content:f}),y==="pdf"||y==="pdf_slides"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),y):y==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):y==="markdown_table"?(console.log("\u68C0\u6D4B\u5230Markdown\u8868\u683C\u6587\u4EF6"),"markdown_table"):y==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):y==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):y==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):o.toLowerCase().endsWith(".pdf")||(f==null?void 0:f.type)==="pdf"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),"pdf"):o.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||(f==null?void 0:f.type)==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):o.toLowerCase().endsWith(".md")||(f==null?void 0:f.type)==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):o.toLowerCase().match(/\.(html|htm)$/)||(f==null?void 0:f.type)==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):o.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||(f==null?void 0:f.type)==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):(console.log("\u672A\u8BC6\u522B\u7684\u6587\u4EF6\u7C7B\u578B\uFF0C\u8FD4\u56DE unknown"),"unknown")},Ie=(p,o,y=!1)=>{var f,_,Y,W,K,M,b;console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:","pdfStartPage:"+p.pdfStartPage,"currentPage:"+o.currentPage),console.log("=== renderPdfContent \u5F00\u59CB ==="),console.log("PDF\u6570\u636E:",p),console.log("PDF\u6587\u6863:",(f=p.content)==null?void 0:f.document),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof((_=p.content)==null?void 0:_.document)),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:",((Y=p.content)==null?void 0:Y.document)===null),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:",((W=p.content)==null?void 0:W.document)===void 0),console.log("PDF\u6587\u6863\u65B9\u6CD5:",(K=p.content)!=null&&K.document?Object.getOwnPropertyNames(Object.getPrototypeOf(p.content.document)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u5C5E\u6027:",(M=p.content)!=null&&M.document?Object.keys(p.content.document):"\u65E0\u6587\u6863");const w=p.pdfStartPage||1;console.log("PDF\u8D77\u59CB\u9875:",w);const T=(o.annotationData||[]).filter(c=>"pageNumber"in c&&"x"in c&&"y"in c);console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="),console.log("\u539F\u59CBannotationData:",o.annotationData),console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:",T);const S=y?.82:1,v=o.initialZoom||o.scale||S;return c__default.createElement(Re,{pdfDocument:((b=p.content)==null?void 0:b.document)||null,currentPage:o.currentPage||1,pdfStartPage:w,scale:v,annotations:T,isAnnotating:!1,isSlidesMode:y,onPageChange:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"pageChange",{pageNumber:c})}:void 0,onScaleChange:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"scaleChange",{scale:c})}:void 0,onAnnotationChange:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"annotationChange",{annotation:c})}:void 0,onAnnotationDelete:o.eventsEmit?c=>{var t;return(t=o.eventsEmit)==null?void 0:t.call(o,"annotationDelete",{annotationId:c})}:void 0,styles:o.styles})},je=(p,o)=>{var y,f,_,Y,W,K,M,b,w,T,S,v,c,t;console.log("=== Fviewer renderImageContent ==="),console.log("data:",p),console.log("data.content:",p.content),console.log("data.content?.url:",(y=p.content)==null?void 0:y.url),console.log("rotation:",o.rotation);const r=((f=p.content)==null?void 0:f.url)||p.content,[a,F]=useState(!0),[m,l]=useState(!1),n=()=>{console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:",r),F(!1),l(!1)},i=()=>{console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",r),F(!1),l(!0)};return c__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",padding:"20px",overflow:"auto",position:"relative",backgroundColor:"#272727"}},a&&c__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",zIndex:1}},c__default.createElement("div",{style:{width:"32px",height:"32px",border:`3px solid ${((W=(Y=(_=o.styles)==null?void 0:_.theme)==null?void 0:Y.colors)==null?void 0:W.border)||"#dee2e6"}`,borderTop:`3px solid ${((b=(M=(K=o.styles)==null?void 0:K.theme)==null?void 0:M.colors)==null?void 0:b.primary)||"#007bff"}`,borderRadius:"50%",animation:"spin 1s linear infinite"}}),c__default.createElement("div",{style:{fontSize:"12px",color:((S=(T=(w=o.styles)==null?void 0:w.theme)==null?void 0:T.colors)==null?void 0:S.text)||"#343a40"}},"\u56FE\u7247\u52A0\u8F7D\u4E2D...")),m&&c__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",zIndex:1}},c__default.createElement("div",{style:{fontSize:"14px",color:((t=(c=(v=o.styles)==null?void 0:v.theme)==null?void 0:c.colors)==null?void 0:t.error)||"#dc3545"}},"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")),c__default.createElement("img",{src:r,alt:p.fileName||"\u56FE\u7247",onLoad:n,onError:i,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",transform:`scale(${o.scale||1}) rotate(${o.rotation||0}deg)`,opacity:a?0:1,transition:"opacity 0.3s ease-in-out, transform 0.2s ease-in-out"}}),c__default.createElement("style",null,`
166
166
  @keyframes spin {
167
167
  0% { transform: rotate(0deg); }
168
168
  100% { transform: rotate(360deg); }
169
169
  }
170
- `))},Oe=(p,o)=>{var y,f,_,Y,W;console.log("=== Fviewer renderTextContent ==="),console.log("data:",p),console.log("data.content:",p.content);let K="";typeof p.content=="string"?K=p.content:(y=p.content)!=null&&y.text?K=p.content.text:(f=p.content)!=null&&f.content&&(K=p.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",K);const M=useRef(null),b=useRef(null);return useEffect(()=>{if(M.current&&b.current&&K){const w=setTimeout(()=>{var T;const S=((T=M.current)==null?void 0:T.scrollHeight)||0,v=Math.max(S+80,200);b.current&&(b.current.style.minHeight=`${v}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",v))},100);return()=>clearTimeout(w)}},[K]),m__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},m__default.createElement("div",{ref:b,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${o.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},m__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},m__default.createElement(IL,{dataSource:{type:xc.TEXT,content:K},size:"md",theme:{primaryColor:((W=(Y=(_=o.styles)==null?void 0:_.theme)==null?void 0:Y.colors)==null?void 0:W.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible"}})),m__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},He=({data:p,parentProps:o,isTableMode:y=!1})=>{var f,_,Y,W,K,M,b,w,T,S,v,c;const t=useRef(null),r=useRef(null),a=useRef(null),F=useRef(!1);useRef(0),useRef(null);const[m]=useState(!1),l=(V,O)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:V,scrollHeight:O}),o.eventsEmit&&o.eventsEmit("markdown_scroll",{scrollTop:V,scrollHeight:O})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),o.eventsEmit&&o.eventsEmit("markdown_scroll_to_top")},i=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),o.eventsEmit&&o.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=V=>{var O,z;try{if(!y)return;const G=typeof p.content=="string"?p.content:((O=p.content)==null?void 0:O.content)||"";if(!G||I.length===0)return;const _t=JSON.stringify(I.map(Ot=>({o:Ot.offsets,c:Ot.color}))),wt=`${G.length}:${G.substring(0,64)}:${G.substring(G.length-64)}|${_t}`;if(((z=V.dataset)==null?void 0:z.tableAnnoRuntimeSig)===wt)return;setTimeout(()=>{Pt(),V.dataset&&(V.dataset.tableAnnoRuntimeSig=wt)},50)}catch(G){console.warn("[MarkdownRendered] apply failed",G)}};const E=m__default.useCallback(V=>{var O;return(O=e.current)==null?void 0:O.call(e,V)},[]),x=useCallback(()=>{var V;if(!m||!t.current)return;const O=window.getSelection();if(!O||O.isCollapsed)return;const z=O.getRangeAt(0),G=z.toString().trim();if(!G)return;const _t=t.current;let wt=0,Ot=0;const q=document.createTreeWalker(_t,NodeFilter.SHOW_TEXT,{acceptNode:P=>{var j;return(j=P.parentElement)!=null&&j.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let d=q.nextNode();for(;d;){if(d===z.startContainer){Ot=wt+z.startOffset;break}wt+=((V=d.textContent)==null?void 0:V.length)||0,d=q.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:G,startOffset:Ot,charCount:wt,container:z.startContainer.textContent});const u={id:`md-anno-${Date.now()}`,start:Ot,end:Ot+G.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",u),o.eventsEmit&&o.eventsEmit("md_annotation_add",u),O.removeAllRanges()},[m,o.eventsEmit]),N=y?[]:(o.annotationData||[]).filter(V=>"start"in V&&"end"in V&&!("pageNumber"in V)),I=y?(o.annotationData||[]).filter(V=>"offsets"in V&&Array.isArray(V.offsets)):[],St=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const V=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",V.length),V.length>0&&V.forEach(O=>{const z=O.parentNode;z&&z.replaceChild(document.createTextNode(O.textContent||""),O)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),Pt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",I),!t.current||!I.length){console.log("\u8868\u683C\u6807\u6CE8\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u9000\u51FA");return}const V=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",V.length),V.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}F.current=!0,I.forEach((O,z)=>{const G=O.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",O),!Array.isArray(G)||!G.length||!Array.isArray(G[0])||G[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",O);return}G.forEach((_t,wt)=>{const[Ot,q]=_t;if(typeof Ot!="number"||typeof q!="number"){console.warn("[TableAnnotation] offset is not [number, number]",_t);return}V.forEach((d,u)=>{var P,j,U;let $;const s=d.tBodies&&d.tBodies.length>0?Array.from(d.tBodies[0].rows):[];if(s.length>0)$=s[Ot];else{const k=((j=(P=d.tHead)==null?void 0:P.rows)==null?void 0:j.length)||0;$=Array.from(d.rows)[Ot+k]}if(!$){console.warn("[TableAnnotation] row out of range",{row:Ot,tableIndex:u});return}const h=(U=$.cells)==null?void 0:U[q];if(!h){console.warn("[TableAnnotation] cell is undefined",{row:Ot,col:q,tableIndex:u});return}const C=O.color||"rgba(255, 229, 153, 0.5)",A=getComputedStyle(h).backgroundColor;h.getAttribute("data-table-annotated")==="1"&&(A===C||h.style.backgroundColor===C)||(h.style.setProperty("background",C,"important"),h.style.setProperty("background-color",C,"important"),h.setAttribute("data-table-annotated","1")),O.content&&(h.title=O.content),wt===0&&z===0&&setTimeout(()=>{h.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{F.current=!1})},[I]),bt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!N.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}r.current&&clearTimeout(r.current);const V=()=>{var O;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const z=(O=t.current)==null?void 0:O.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(z==null?void 0:z.length)||0),z==null||z.forEach(u=>{const P=u.parentNode;P&&P.replaceChild(document.createTextNode(u.textContent||""),u)});const G=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:u=>{var P;return(P=u.parentElement)!=null&&P.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),_t=[];let wt;for(;wt=G.nextNode();)_t.push(wt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",_t.length),_t.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),r.current=setTimeout(()=>{V()},200);return}let Ot=0;const q=_t.map(u=>{var P;const j=Ot;return Ot+=((P=u.textContent)==null?void 0:P.length)||0,{node:u,start:j,end:Ot,text:u.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",q),console.log("\u603B\u6587\u672C\u957F\u5EA6:",Ot);const d=[...N].sort((u,P)=>P.start-u.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",d),d.forEach(u=>{const{start:P,end:j,color:U}=u;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:u,nodePositions:q});const $=q.filter(s=>P<s.end&&j>s.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",$.length),$.forEach(({node:s,start:h})=>{var C,A,k,B,D,g;const L=Math.max(0,P-h),At=Math.min(((C=s.textContent)==null?void 0:C.length)||0,j-h);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:L,localEnd:At,nodeTextLength:(A=s.textContent)==null?void 0:A.length}),L>=At){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const H=((k=s.textContent)==null?void 0:k.slice(0,L))||"",Q=((B=s.textContent)==null?void 0:B.slice(L,At))||"",vt=((D=s.textContent)==null?void 0:D.slice(At))||"";console.log("\u5206\u5272\u6587\u672C:",{before:H,annotatedText:Q,after:vt});const Tt=document.createElement("span");Tt.className="md-annotation",Tt.style.backgroundColor=U||"#FFE599",Tt.textContent=Q;const It=document.createDocumentFragment();H&&It.appendChild(document.createTextNode(H)),It.appendChild(Tt),vt&&It.appendChild(document.createTextNode(vt)),(g=s.parentNode)==null||g.replaceChild(It,s),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",Q)})})};r.current=setTimeout(()=>{V()},100)},[N]);return useEffect(()=>{var V;if(y){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const O=typeof p.content=="string"?p.content:((V=p.content)==null?void 0:V.content)||"";if(!O||typeof O!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",y),console.log("mdAnnotations:",N),console.log("tableAnnotations:",I),console.log("data.content:",p.content),console.log("\u5B9E\u9645\u5185\u5BB9:",O),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(y||St(),!y&&N.length>0){bt();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[y,I,N]),useEffect(()=>{if(!y)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,y]),useEffect(()=>{var V;const O=typeof p.content=="string"?p.content:((V=p.content)==null?void 0:V.content)||"";if(!O||typeof O!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",y),console.log("\u5185\u5BB9\u957F\u5EA6:",O.length||0),typeof O=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",O.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",O.substring(O.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof O),console.log("\u5185\u5BB9\u503C:",O)),console.log("\u6807\u6CE8\u6570\u636E:",N),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",I)},[N,I,y]),useEffect(()=>{if(y&&t.current){const V=setTimeout(()=>{var O;const z=(O=t.current)==null?void 0:O.querySelectorAll("table");z&&z.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",z.length),z.forEach((G,_t)=>{if(G instanceof HTMLTableElement){G.style.width="100%",G.style.minWidth="100%",G.style.tableLayout="auto";const wt=G.closest(".markdown-table-mode");wt&&wt instanceof HTMLElement&&(wt.style.width="100%",wt.style.overflowX="auto"),console.log(`\u8868\u683C ${_t+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(V)}},[y,p.content]),useEffect(()=>()=>{r.current&&clearTimeout(r.current),a.current&&(a.current.disconnect(),a.current=null)},[]),m__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${y?"markdown-table-mode":""}`},m__default.createElement("style",null,Se),m__default.createElement("div",{ref:t},m__default.createElement(IL,{dataSource:{type:xc.MARKDOWN,content:(()=>{var V,O;return typeof p.content=="string"?p.content:(V=p.content)!=null&&V.text?p.content.text:(O=p.content)!=null&&O.content?p.content.content:""})()},size:"md",onScroll:y?void 0:l,onScrollToTop:y?void 0:n,onScrollToBottom:y?void 0:i,onRendered:E,theme:{primaryColor:((Y=(_=(f=o.styles)==null?void 0:f.theme)==null?void 0:_.colors)==null?void 0:Y.primary)||"#007bff",backgroundColor:((M=(K=(W=o.styles)==null?void 0:W.theme)==null?void 0:K.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((T=(w=(b=o.styles)==null?void 0:b.theme)==null?void 0:w.colors)==null?void 0:T.text)||"#343a40",borderColor:((c=(v=(S=o.styles)==null?void 0:S.theme)==null?void 0:v.colors)==null?void 0:c.border)||"#dee2e6",borderRadius:y?"0px":"8px",padding:y?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:y?"visible":"scroll"}})))},Ze=({markdown:p,onRendered:o,tableAnnotations:y=[]})=>{const f=useRef(null),_=W=>{const K=W.split(/\r?\n/).filter(S=>S.trim().length>0);let M=-1;for(let S=0;S<K.length-1;S++){const v=K[S].trim(),c=K[S+1].trim();if(v.startsWith("|")&&v.endsWith("|")&&c.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=S;break}}if(M===-1)return null;const b=K[M].split("|").slice(1,-1).map(S=>S.trim()),w=[];for(let S=M+2;S<K.length;S++){const v=K[S].trim();if(!v.startsWith("|")||!v.endsWith("|"))break;w.push(v)}const T=w.map(S=>S.split("|").slice(1,-1).map(v=>v.trim()));return{headers:b,rows:T}},Y=m__default.useMemo(()=>_(p),[p]);return useEffect(()=>{const W=()=>{try{if(!f.current||!y.length)return;const M=f.current.querySelectorAll("table");if(!M||M.length===0)return;y.forEach((b,w)=>{(b.offsets||[]).forEach((T,S)=>{const[v,c]=T;M.forEach(t=>{var r,a,F;const m=t.tBodies&&t.tBodies.length>0?Array.from(t.tBodies[0].rows):[];let l;if(m.length>0)l=m[v];else{const e=((a=(r=t.tHead)==null?void 0:r.rows)==null?void 0:a.length)||0;l=Array.from(t.rows)[v+e]}if(!l)return;const n=(F=l.cells)==null?void 0:F[c];if(!n)return;const i=b.color||"rgba(255, 229, 153, 0.5)";n.getAttribute("data-table-annotated")==="1"||(n.style.setProperty("background",i,"important"),n.style.setProperty("background-color",i,"important"),n.setAttribute("data-table-annotated","1"),b.content&&(n.title=b.content)),w===0&&S===0&&setTimeout(()=>n.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},K=requestAnimationFrame(()=>{W(),o&&o()});return()=>cancelAnimationFrame(K)},[p,y,o]),Y?m__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},m__default.createElement("style",null,`
170
+ `))},Oe=(p,o)=>{var y,f,_,Y,W;console.log("=== Fviewer renderTextContent ==="),console.log("data:",p),console.log("data.content:",p.content);let K="";typeof p.content=="string"?K=p.content:(y=p.content)!=null&&y.text?K=p.content.text:(f=p.content)!=null&&f.content&&(K=p.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",K);const M=useRef(null),b=useRef(null);return useEffect(()=>{if(M.current&&b.current&&K){const w=setTimeout(()=>{var T;const S=((T=M.current)==null?void 0:T.scrollHeight)||0,v=Math.max(S+80,200);b.current&&(b.current.style.minHeight=`${v}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",v))},100);return()=>clearTimeout(w)}},[K]),c__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},c__default.createElement("div",{ref:b,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${o.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},c__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},c__default.createElement(IL,{dataSource:{type:xc.TEXT,content:K},size:"md",theme:{primaryColor:((W=(Y=(_=o.styles)==null?void 0:_.theme)==null?void 0:Y.colors)==null?void 0:W.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible"}})),c__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},He=({data:p,parentProps:o,isTableMode:y=!1})=>{var f,_,Y,W,K,M,b,w,T,S,v,c;const t=useRef(null),r=useRef(null),a=useRef(null),F=useRef(!1);useRef(0),useRef(null);const[m]=useState(!1),l=(V,O)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:V,scrollHeight:O}),o.eventsEmit&&o.eventsEmit("markdown_scroll",{scrollTop:V,scrollHeight:O})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),o.eventsEmit&&o.eventsEmit("markdown_scroll_to_top")},i=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),o.eventsEmit&&o.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=V=>{var O,z;try{if(!y)return;const G=typeof p.content=="string"?p.content:((O=p.content)==null?void 0:O.content)||"";if(!G||I.length===0)return;const _t=JSON.stringify(I.map(Ot=>({o:Ot.offsets,c:Ot.color}))),wt=`${G.length}:${G.substring(0,64)}:${G.substring(G.length-64)}|${_t}`;if(((z=V.dataset)==null?void 0:z.tableAnnoRuntimeSig)===wt)return;setTimeout(()=>{Pt(),V.dataset&&(V.dataset.tableAnnoRuntimeSig=wt)},50)}catch(G){console.warn("[MarkdownRendered] apply failed",G)}};const E=c__default.useCallback(V=>{var O;return(O=e.current)==null?void 0:O.call(e,V)},[]),x=useCallback(()=>{var V;if(!m||!t.current)return;const O=window.getSelection();if(!O||O.isCollapsed)return;const z=O.getRangeAt(0),G=z.toString().trim();if(!G)return;const _t=t.current;let wt=0,Ot=0;const q=document.createTreeWalker(_t,NodeFilter.SHOW_TEXT,{acceptNode:P=>{var j;return(j=P.parentElement)!=null&&j.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let d=q.nextNode();for(;d;){if(d===z.startContainer){Ot=wt+z.startOffset;break}wt+=((V=d.textContent)==null?void 0:V.length)||0,d=q.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:G,startOffset:Ot,charCount:wt,container:z.startContainer.textContent});const u={id:`md-anno-${Date.now()}`,start:Ot,end:Ot+G.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",u),o.eventsEmit&&o.eventsEmit("md_annotation_add",u),O.removeAllRanges()},[m,o.eventsEmit]),N=y?[]:(o.annotationData||[]).filter(V=>"start"in V&&"end"in V&&!("pageNumber"in V)),I=y?(o.annotationData||[]).filter(V=>"offsets"in V&&Array.isArray(V.offsets)):[],St=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const V=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",V.length),V.length>0&&V.forEach(O=>{const z=O.parentNode;z&&z.replaceChild(document.createTextNode(O.textContent||""),O)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),Pt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",I),!t.current||!I.length){console.log("\u8868\u683C\u6807\u6CE8\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u9000\u51FA");return}const V=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",V.length),V.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}F.current=!0,I.forEach((O,z)=>{const G=O.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",O),!Array.isArray(G)||!G.length||!Array.isArray(G[0])||G[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",O);return}G.forEach((_t,wt)=>{const[Ot,q]=_t;if(typeof Ot!="number"||typeof q!="number"){console.warn("[TableAnnotation] offset is not [number, number]",_t);return}V.forEach((d,u)=>{var P,j,U;let $;const s=d.tBodies&&d.tBodies.length>0?Array.from(d.tBodies[0].rows):[];if(s.length>0)$=s[Ot];else{const k=((j=(P=d.tHead)==null?void 0:P.rows)==null?void 0:j.length)||0;$=Array.from(d.rows)[Ot+k]}if(!$){console.warn("[TableAnnotation] row out of range",{row:Ot,tableIndex:u});return}const h=(U=$.cells)==null?void 0:U[q];if(!h){console.warn("[TableAnnotation] cell is undefined",{row:Ot,col:q,tableIndex:u});return}const C=O.color||"rgba(255, 229, 153, 0.5)",A=getComputedStyle(h).backgroundColor;h.getAttribute("data-table-annotated")==="1"&&(A===C||h.style.backgroundColor===C)||(h.style.setProperty("background",C,"important"),h.style.setProperty("background-color",C,"important"),h.setAttribute("data-table-annotated","1")),O.content&&(h.title=O.content),wt===0&&z===0&&setTimeout(()=>{h.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{F.current=!1})},[I]),bt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!N.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}r.current&&clearTimeout(r.current);const V=()=>{var O;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const z=(O=t.current)==null?void 0:O.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(z==null?void 0:z.length)||0),z==null||z.forEach(u=>{const P=u.parentNode;P&&P.replaceChild(document.createTextNode(u.textContent||""),u)});const G=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:u=>{var P;return(P=u.parentElement)!=null&&P.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),_t=[];let wt;for(;wt=G.nextNode();)_t.push(wt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",_t.length),_t.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),r.current=setTimeout(()=>{V()},200);return}let Ot=0;const q=_t.map(u=>{var P;const j=Ot;return Ot+=((P=u.textContent)==null?void 0:P.length)||0,{node:u,start:j,end:Ot,text:u.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",q),console.log("\u603B\u6587\u672C\u957F\u5EA6:",Ot);const d=[...N].sort((u,P)=>P.start-u.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",d),d.forEach(u=>{const{start:P,end:j,color:U}=u;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:u,nodePositions:q});const $=q.filter(s=>P<s.end&&j>s.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",$.length),$.forEach(({node:s,start:h})=>{var C,A,k,B,D,g;const L=Math.max(0,P-h),At=Math.min(((C=s.textContent)==null?void 0:C.length)||0,j-h);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:L,localEnd:At,nodeTextLength:(A=s.textContent)==null?void 0:A.length}),L>=At){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const H=((k=s.textContent)==null?void 0:k.slice(0,L))||"",Q=((B=s.textContent)==null?void 0:B.slice(L,At))||"",vt=((D=s.textContent)==null?void 0:D.slice(At))||"";console.log("\u5206\u5272\u6587\u672C:",{before:H,annotatedText:Q,after:vt});const Tt=document.createElement("span");Tt.className="md-annotation",Tt.style.backgroundColor=U||"#FFE599",Tt.textContent=Q;const It=document.createDocumentFragment();H&&It.appendChild(document.createTextNode(H)),It.appendChild(Tt),vt&&It.appendChild(document.createTextNode(vt)),(g=s.parentNode)==null||g.replaceChild(It,s),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",Q)})})};r.current=setTimeout(()=>{V()},100)},[N]);return useEffect(()=>{var V;if(y){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const O=typeof p.content=="string"?p.content:((V=p.content)==null?void 0:V.content)||"";if(!O||typeof O!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",y),console.log("mdAnnotations:",N),console.log("tableAnnotations:",I),console.log("data.content:",p.content),console.log("\u5B9E\u9645\u5185\u5BB9:",O),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(y||St(),!y&&N.length>0){bt();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[y,I,N]),useEffect(()=>{if(!y)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,y]),useEffect(()=>{var V;const O=typeof p.content=="string"?p.content:((V=p.content)==null?void 0:V.content)||"";if(!O||typeof O!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",y),console.log("\u5185\u5BB9\u957F\u5EA6:",O.length||0),typeof O=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",O.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",O.substring(O.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof O),console.log("\u5185\u5BB9\u503C:",O)),console.log("\u6807\u6CE8\u6570\u636E:",N),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",I)},[N,I,y]),useEffect(()=>{if(y&&t.current){const V=setTimeout(()=>{var O;const z=(O=t.current)==null?void 0:O.querySelectorAll("table");z&&z.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",z.length),z.forEach((G,_t)=>{if(G instanceof HTMLTableElement){G.style.width="100%",G.style.minWidth="100%",G.style.tableLayout="auto";const wt=G.closest(".markdown-table-mode");wt&&wt instanceof HTMLElement&&(wt.style.width="100%",wt.style.overflowX="auto"),console.log(`\u8868\u683C ${_t+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(V)}},[y,p.content]),useEffect(()=>()=>{r.current&&clearTimeout(r.current),a.current&&(a.current.disconnect(),a.current=null)},[]),c__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${y?"markdown-table-mode":""}`},c__default.createElement("style",null,Se),c__default.createElement("div",{ref:t},c__default.createElement(IL,{dataSource:{type:xc.MARKDOWN,content:(()=>{var V,O;return typeof p.content=="string"?p.content:(V=p.content)!=null&&V.text?p.content.text:(O=p.content)!=null&&O.content?p.content.content:""})()},size:"md",onScroll:y?void 0:l,onScrollToTop:y?void 0:n,onScrollToBottom:y?void 0:i,onRendered:E,theme:{primaryColor:((Y=(_=(f=o.styles)==null?void 0:f.theme)==null?void 0:_.colors)==null?void 0:Y.primary)||"#007bff",backgroundColor:((M=(K=(W=o.styles)==null?void 0:W.theme)==null?void 0:K.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((T=(w=(b=o.styles)==null?void 0:b.theme)==null?void 0:w.colors)==null?void 0:T.text)||"#343a40",borderColor:((c=(v=(S=o.styles)==null?void 0:S.theme)==null?void 0:v.colors)==null?void 0:c.border)||"#dee2e6",borderRadius:y?"0px":"8px",padding:y?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:y?"visible":"scroll"}})))},Ze=({markdown:p,onRendered:o,tableAnnotations:y=[]})=>{const f=useRef(null),_=W=>{const K=W.split(/\r?\n/).filter(S=>S.trim().length>0);let M=-1;for(let S=0;S<K.length-1;S++){const v=K[S].trim(),c=K[S+1].trim();if(v.startsWith("|")&&v.endsWith("|")&&c.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=S;break}}if(M===-1)return null;const b=K[M].split("|").slice(1,-1).map(S=>S.trim()),w=[];for(let S=M+2;S<K.length;S++){const v=K[S].trim();if(!v.startsWith("|")||!v.endsWith("|"))break;w.push(v)}const T=w.map(S=>S.split("|").slice(1,-1).map(v=>v.trim()));return{headers:b,rows:T}},Y=c__default.useMemo(()=>_(p),[p]);return useEffect(()=>{const W=()=>{try{if(!f.current||!y.length)return;const M=f.current.querySelectorAll("table");if(!M||M.length===0)return;y.forEach((b,w)=>{(b.offsets||[]).forEach((T,S)=>{const[v,c]=T;M.forEach(t=>{var r,a,F;const m=t.tBodies&&t.tBodies.length>0?Array.from(t.tBodies[0].rows):[];let l;if(m.length>0)l=m[v];else{const e=((a=(r=t.tHead)==null?void 0:r.rows)==null?void 0:a.length)||0;l=Array.from(t.rows)[v+e]}if(!l)return;const n=(F=l.cells)==null?void 0:F[c];if(!n)return;const i=b.color||"rgba(255, 229, 153, 0.5)";n.getAttribute("data-table-annotated")==="1"||(n.style.setProperty("background",i,"important"),n.style.setProperty("background-color",i,"important"),n.setAttribute("data-table-annotated","1"),b.content&&(n.title=b.content)),w===0&&S===0&&setTimeout(()=>n.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},K=requestAnimationFrame(()=>{W(),o&&o()});return()=>cancelAnimationFrame(K)},[p,y,o]),Y?c__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},c__default.createElement("style",null,`
171
171
  .z-mdtbl-wrapper { overflow: auto; position: relative; }
172
- .z-mdtbl { border-collapse: separate; border-spacing: 0; background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
173
- .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: #111827; }
174
- .z-mdtbl th { background: #ffffff; font-weight: 600; color: #111827; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
175
- .z-mdtbl tbody tr:nth-child(odd) { background: #fbfdff; }
176
- .z-mdtbl tbody tr:hover { background: #f3f4f6; }
172
+ .z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
173
+ .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
174
+ .z-mdtbl th { background: transparent; font-weight: 600; color: inherit; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
175
+ .z-mdtbl tbody tr:nth-child(odd) { background: transparent; }
176
+ .z-mdtbl tbody tr:hover { background: transparent; }
177
177
  .z-mdtbl td, .z-mdtbl th { white-space: nowrap; }
178
178
  .z-mdtbl thead tr:first-child th:first-child { border-top-left-radius: 8px; }
179
179
  .z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
180
180
  .z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
181
181
  .z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
182
- `),m__default.createElement("table",{className:"z-mdtbl"},m__default.createElement("thead",null,m__default.createElement("tr",null,Y.headers.map((W,K)=>m__default.createElement("th",{key:K},W)))),m__default.createElement("tbody",null,Y.rows.map((W,K)=>m__default.createElement("tr",{key:K},W.map((M,b)=>m__default.createElement("td",{key:b},M))))))):m__default.createElement("div",{ref:f,style:{padding:"8px"}},"\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C")},Xe=(p,o)=>{var y,f;console.log("=== Fviewer renderHtmlContent ==="),console.log("data:",p),console.log("data.content:",p.content);let _="";return typeof p.content=="string"?_=p.content:(y=p.content)!=null&&y.text?_=p.content.text:(f=p.content)!=null&&f.content&&(_=p.content.content),console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:",_),m__default.createElement("div",{style:{height:"100%",overflow:"auto",position:"relative"}},m__default.createElement("iframe",{srcDoc:_,style:{width:"100%",height:"100%",border:"none",background:"white"},title:"HTML Preview",sandbox:"allow-same-origin allow-scripts"}))},qe=(p,o)=>m__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",color:"#666"}},m__default.createElement("div",null,m__default.createElement("div",null,"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"),m__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},p.fileName||"\u672A\u77E5\u6587\u4EF6"))),Ue=({data:p,annotationData:o=[],totalPage:y=0,currentPage:f=1,scale:_,rotation:Y=0,eventsEmit:W,styles:K,tools:M={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0},customComponents:b,className:w,contentClass:T})=>{var S,v,c,t;const r=(K==null?void 0:K.theme)||Me,[a,F]=useState(!1),[m]=useState("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."),[l,n]=useState(null);console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="),console.log("Fviewer data:",p),console.log("Fviewer data.content:",p==null?void 0:p.content),console.log("Fviewer data.content.document:",(S=p==null?void 0:p.content)==null?void 0:S.document),console.log("Fviewer data.content.document\u7C7B\u578B:",typeof((v=p==null?void 0:p.content)==null?void 0:v.document)),console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:",((c=p==null?void 0:p.content)==null?void 0:c.document)===null),console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:",((t=p==null?void 0:p.content)==null?void 0:t.document)===void 0),console.log("Fviewer currentPage:",f),console.log("Fviewer scale:",_);const i=useRef(null),e=useRef(null),E=useRef(0);E.current+=1,console.log("[Fviewer] render count:",E.current);const x=We(p);console.log("=== Fviewer \u7EC4\u4EF6 ==="),console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:",x),console.log("\u5B8C\u6574\u6570\u636E:",p);const N=()=>{var I;switch(console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:",x),x){case"pdf":case"pdf_slides":return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",x,"pdfStartPage:"+p.pdfStartPage,"currentPage:"+f),Ie(p,{data:p,annotationData:o,totalPage:y,currentPage:f,scale:_,eventsEmit:W,styles:K,tools:M,className:w,contentClass:T},x==="pdf_slides");case"image":return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),je(p,{scale:_,rotation:Y,styles:K});case"text":return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),Oe(p,{scale:_,styles:K});case"markdown":case"markdown_table":if(console.log("\u6E32\u67D3Markdown\u5185\u5BB9:",x),x==="markdown_table"){const St=typeof p.content=="string"?p.content:((I=p.content)==null?void 0:I.content)||"",Pt=(o||[]).filter(bt=>"offsets"in bt&&Array.isArray(bt.offsets));return m__default.createElement(Ze,{markdown:St,tableAnnotations:Pt})}return m__default.createElement(He,{data:p,parentProps:{data:p,annotationData:o,eventsEmit:W,styles:K,tools:M,className:w,contentClass:T},isTableMode:!1});case"html":return console.log("\u6E32\u67D3HTML\u5185\u5BB9"),Xe(p);default:return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"),qe(p)}};return m__default.useEffect(()=>{const I=i.current,St=e.current,Pt=I!==p,bt=St!==(p?p.content:void 0);console.log("[Fviewer useEffect:data] triggered",{dataChanged:Pt,contentChanged:bt,hasData:!!p,hasContent:!!(p!=null&&p.content),isLoadingBefore:a}),i.current=p,e.current=p?p.content:void 0},[p==null?void 0:p.content]),m__default.useEffect(()=>{l&&F(!1)},[l]),m__default.useEffect(()=>{console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="),console.log("annotationData:",o),console.log("annotationData \u957F\u5EA6:",(o==null?void 0:o.length)||0),console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:",x)},[o,x]),m__default.createElement(Ne,{$theme:r,className:T},a?b!=null&&b.LoadingComponent?m__default.createElement(b.LoadingComponent,{status:m,theme:r}):m__default.createElement(Le,{$theme:r},m):l?b!=null&&b.ErrorComponent?m__default.createElement(b.ErrorComponent,{error:l,theme:r}):m__default.createElement(ze,{$theme:r},m__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),m__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},l)):N())};/**
182
+ `),c__default.createElement("table",{className:"z-mdtbl"},c__default.createElement("thead",null,c__default.createElement("tr",null,Y.headers.map((W,K)=>c__default.createElement("th",{key:K},W)))),c__default.createElement("tbody",null,Y.rows.map((W,K)=>c__default.createElement("tr",{key:K},W.map((M,b)=>c__default.createElement("td",{key:b},M))))))):c__default.createElement("div",{ref:f,style:{padding:"8px"}},"\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C")},Xe=(p,o)=>{var y,f;console.log("=== Fviewer renderHtmlContent ==="),console.log("data:",p),console.log("data.content:",p.content);let _="";return typeof p.content=="string"?_=p.content:(y=p.content)!=null&&y.text?_=p.content.text:(f=p.content)!=null&&f.content&&(_=p.content.content),console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:",_),c__default.createElement("div",{style:{height:"100%",overflow:"auto",position:"relative"}},c__default.createElement("iframe",{srcDoc:_,style:{width:"100%",height:"100%",border:"none",background:"white"},title:"HTML Preview",sandbox:"allow-same-origin allow-scripts"}))},qe=(p,o)=>c__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",color:"#666"}},c__default.createElement("div",null,c__default.createElement("div",null,"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"),c__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},p.fileName||"\u672A\u77E5\u6587\u4EF6"))),Ue=({data:p,annotationData:o=[],totalPage:y=0,currentPage:f=1,scale:_,rotation:Y=0,eventsEmit:W,styles:K,tools:M={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0},customComponents:b,className:w,contentClass:T})=>{var S,v,c,t;const r=(K==null?void 0:K.theme)||Me,[a,F]=useState(!1),[m]=useState("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."),[l,n]=useState(null);console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="),console.log("Fviewer data:",p),console.log("Fviewer data.content:",p==null?void 0:p.content),console.log("Fviewer data.content.document:",(S=p==null?void 0:p.content)==null?void 0:S.document),console.log("Fviewer data.content.document\u7C7B\u578B:",typeof((v=p==null?void 0:p.content)==null?void 0:v.document)),console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:",((c=p==null?void 0:p.content)==null?void 0:c.document)===null),console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:",((t=p==null?void 0:p.content)==null?void 0:t.document)===void 0),console.log("Fviewer currentPage:",f),console.log("Fviewer scale:",_);const i=useRef(null),e=useRef(null),E=useRef(0);E.current+=1,console.log("[Fviewer] render count:",E.current);const x=We(p);console.log("=== Fviewer \u7EC4\u4EF6 ==="),console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:",x),console.log("\u5B8C\u6574\u6570\u636E:",p);const N=()=>{var I;switch(console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:",x),x){case"pdf":case"pdf_slides":return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",x,"pdfStartPage:"+p.pdfStartPage,"currentPage:"+f),Ie(p,{data:p,annotationData:o,totalPage:y,currentPage:f,scale:_,eventsEmit:W,styles:K,tools:M,className:w,contentClass:T},x==="pdf_slides");case"image":return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),je(p,{scale:_,rotation:Y,styles:K});case"text":return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),Oe(p,{scale:_,styles:K});case"markdown":case"markdown_table":if(console.log("\u6E32\u67D3Markdown\u5185\u5BB9:",x),x==="markdown_table"){const St=typeof p.content=="string"?p.content:((I=p.content)==null?void 0:I.content)||"",Pt=(o||[]).filter(bt=>"offsets"in bt&&Array.isArray(bt.offsets));return c__default.createElement(Ze,{markdown:St,tableAnnotations:Pt})}return c__default.createElement(He,{data:p,parentProps:{data:p,annotationData:o,eventsEmit:W,styles:K,tools:M,className:w,contentClass:T},isTableMode:!1});case"html":return console.log("\u6E32\u67D3HTML\u5185\u5BB9"),Xe(p);default:return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"),qe(p)}};return c__default.useEffect(()=>{const I=i.current,St=e.current,Pt=I!==p,bt=St!==(p?p.content:void 0);console.log("[Fviewer useEffect:data] triggered",{dataChanged:Pt,contentChanged:bt,hasData:!!p,hasContent:!!(p!=null&&p.content),isLoadingBefore:a}),i.current=p,e.current=p?p.content:void 0},[p==null?void 0:p.content]),c__default.useEffect(()=>{l&&F(!1)},[l]),c__default.useEffect(()=>{console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="),console.log("annotationData:",o),console.log("annotationData \u957F\u5EA6:",(o==null?void 0:o.length)||0),console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:",x)},[o,x]),c__default.createElement(Ne,{$theme:r,className:T},a?b!=null&&b.LoadingComponent?c__default.createElement(b.LoadingComponent,{status:m,theme:r}):c__default.createElement(Le,{$theme:r},m):l?b!=null&&b.ErrorComponent?c__default.createElement(b.ErrorComponent,{error:l,theme:r}):c__default.createElement(ze,{$theme:r},c__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),c__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},l)):N())};/**
183
183
  * @license lucide-react v0.456.0 - ISC
184
184
  *
185
185
  * This source code is licensed under the ISC license.
@@ -253,20 +253,20 @@ var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in
253
253
  border-bottom: 1px solid ${p=>p.$theme.colors.border};
254
254
  background: ${p=>p.$theme.colors.background};
255
255
  min-height: 52px;
256
- `,st=dt$1.div`
256
+ `,at=dt$1.div`
257
257
  display: flex;
258
258
  align-items: center;
259
259
  gap: 8px;
260
260
  flex: 1;
261
261
  min-width: 0;
262
- `,it=dt$1.div`
262
+ `,st=dt$1.div`
263
263
  font-size: 14px;
264
264
  font-weight: 500;
265
265
  color: ${p=>p.$theme.colors.text};
266
266
  white-space: nowrap;
267
267
  overflow: hidden;
268
268
  text-overflow: ellipsis;
269
- `,at=dt$1.div`
269
+ `,it=dt$1.div`
270
270
  font-size: 12px;
271
271
  color: ${p=>p.$theme.colors.disabledText};
272
272
  white-space: nowrap;
@@ -307,7 +307,7 @@ var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in
307
307
  color: ${p=>p.$theme.colors.disabledText};
308
308
  min-width: 40px;
309
309
  text-align: center;
310
- `,mt={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}};m__default.memo(({fileName:p="\u672A\u77E5\u6587\u4EF6",currentPage:o=1,totalPage:y=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:Y,onNextPage:W,onZoomIn:K,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:T,onRotateRight:S,onClose:v,scale:c=1,isAnnotating:t=!1,className:r})=>{const a=(_==null?void 0:_.theme)||mt;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",o,"totalPage:",y),m__default.createElement(lt,{$theme:a,className:r},m__default.createElement(st,{$theme:a},m__default.createElement(it,{$theme:a},p)),m__default.createElement(ct,{$theme:a},f.navigation&&m__default.createElement(m__default.Fragment,null,m__default.createElement(ne,{$theme:a,onClick:Y,disabled:o<=1,title:"\u4E0A\u4E00\u9875"},m__default.createElement(Je,{size:16})),y>0&&m__default.createElement(at,{$theme:a},o," / ",y),m__default.createElement(ne,{$theme:a,onClick:W,disabled:!y||o>=y,title:"\u4E0B\u4E00\u9875"},m__default.createElement(Ke,{size:16}))),f.zoom&&m__default.createElement(m__default.Fragment,null,m__default.createElement(ne,{$theme:a,onClick:M,disabled:c<=.3,title:"\u7F29\u5C0F"},m__default.createElement(rt,{size:16})),m__default.createElement(dt,{$theme:a},Math.round(c*100),"%"),m__default.createElement(ne,{$theme:a,onClick:K,disabled:c>=3,title:"\u653E\u5927"},m__default.createElement(ut,{size:16}))),f.annotation&&m__default.createElement(ne,{$theme:a,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8"},m__default.createElement(et,{size:16})),f.download&&m__default.createElement(ne,{$theme:a,onClick:w,title:"\u4E0B\u8F7D"},m__default.createElement(Qe,{size:16})),f.rotate&&m__default.createElement(m__default.Fragment,null,m__default.createElement(ne,{$theme:a,onClick:T,title:"\u5411\u5DE6\u65CB\u8F6C"},m__default.createElement(tt,{size:16})),m__default.createElement(ne,{$theme:a,onClick:S,title:"\u5411\u53F3\u65CB\u8F6C"},m__default.createElement(ot,{size:16}))),f.close&&m__default.createElement(ne,{$theme:a,onClick:v,title:"\u5173\u95ED"},m__default.createElement(nt,{size:16}))))});const gt=()=>{try{if(xe()){console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");return}const p="/worker/pdf.worker.min.js";De(p),console.log("PDF Worker \u5DF2\u901A\u8FC7\u7EDF\u4E00\u51FD\u6570\u6CE8\u518C:",p)}catch(p){throw console.error("PDF Worker \u6CE8\u518C\u5931\u8D25:",p),p}},be=(p,o,y)=>{if(!p&&!o)return"unknown";const f=p||"",_=o||"";return f.toLowerCase().endsWith(".pdf")||_==="pdf"?"pdf":f.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||_==="image"?"image":f.toLowerCase().endsWith(".md")||_==="markdown"?_==="markdown_table"?"markdown_table":"markdown":f.toLowerCase().match(/\.(html|htm)$/)||_==="html"?"html":f.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||_==="text"?"text":"unknown"},ft=async(p,o={})=>{console.log("=== parsePdfFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof p,options:o});try{gt();let y;if(typeof p=="string"){console.log("\u4ECEURL\u52A0\u8F7DPDF:",p);const Y=pdfExports.getDocument({url:p,httpHeaders:o.token?{Authorization:o.token}:void 0});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",Y),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof Y),console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(Y))),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:",Object.keys(Y)),y=await Y.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",y),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof y),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(y))),console.log("PDF\u6587\u6863\u5C5E\u6027:",Object.keys(y))}else{console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");const Y=pdfExports.getDocument({data:p});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",Y),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof Y),y=await Y.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",y),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof y)}const f=y.numPages;console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:",f),console.log("PDF\u6307\u7EB9:",y.fingerprints),console.log("PDF\u4F20\u8F93\u5BF9\u8C61:",y._transport);const _={type:"pdf",content:{type:"pdf",document:y,totalPages:f},fileName:o.fileName,fileType:"pdf",totalPages:f};return console.log("=== \u89E3\u6790\u7ED3\u679C\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u89E3\u6790\u7ED3\u679C:",_),console.log("\u89E3\u6790\u7ED3\u679C\u7C7B\u578B:",typeof _),console.log("\u89E3\u6790\u7ED3\u679C\u5C5E\u6027:",Object.keys(_)),console.log("\u5185\u5BB9\u5BF9\u8C61:",_.content),console.log("\u6587\u6863\u5BF9\u8C61:",_.content.document),_}catch(y){console.error("PDF\u89E3\u6790\u5931\u8D25:",y),console.error("\u9519\u8BEF\u8BE6\u60C5:",{message:y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF",stack:y instanceof Error?y.stack:void 0,name:y instanceof Error?y.name:void 0,url:typeof p=="string"?p:"ArrayBuffer",options:o});let f="PDF\u89E3\u6790\u5931\u8D25";return y instanceof Error&&(y.message.includes("Invalid PDF structure")?f="PDF\u6587\u4EF6\u7ED3\u6784\u65E0\u6548\uFF0C\u53EF\u80FD\u6587\u4EF6\u635F\u574F\u6216\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u4EF6":y.message.includes("Failed to fetch")?f="PDF\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u548C\u6587\u4EF6URL":y.message.includes("Worker")?f="PDF\u89E3\u6790\u5668\u521D\u59CB\u5316\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u8BD5":f=`PDF\u89E3\u6790\u5931\u8D25: ${y.message}`),{type:"pdf",content:null,fileName:o.fileName,fileType:"pdf",error:f}}},Et=async(p,o={})=>{console.log("=== parseImageFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof p,options:o});try{let y;if(typeof p=="string")console.log("\u4ECEURL\u52A0\u8F7D\u56FE\u7247:",p),y=p;else{console.log("\u4ECEArrayBuffer\u52A0\u8F7D\u56FE\u7247");const _=new Blob([p]);y=URL.createObjectURL(_)}console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:",y),await new Promise((_,Y)=>{const W=new Image;W.onload=()=>{console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",y),console.log("\u56FE\u7247\u5C3A\u5BF8:",W.width,"x",W.height),_()},W.onerror=()=>{console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",y),Y(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))};const K=setTimeout(()=>{Y(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"))},1e4);W.onload=()=>{clearTimeout(K),console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",y),console.log("\u56FE\u7247\u5C3A\u5BF8:",W.width,"x",W.height),_()},W.onerror=()=>{clearTimeout(K),console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",y),Y(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))},W.src=y});const f={type:"image",content:{type:"image",url:y},fileName:o.fileName,fileType:"image"};return console.log("=== parseImageFile \u7ED3\u679C ==="),console.log("result:",f),f}catch(y){return console.error("\u56FE\u7247\u89E3\u6790\u5931\u8D25:",y),{type:"image",content:null,fileName:o.fileName,fileType:"image",error:`\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},ht=async(p,o={})=>{try{let y;if(typeof p=="string"){const f=await fetch(p,{headers:o.token?{Authorization:o.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);y=await f.text()}else y=new TextDecoder("utf-8").decode(p);return{type:"text",content:{type:"text",text:y},fileName:o.fileName,fileType:"text"}}catch(y){return{type:"text",content:null,fileName:o.fileName,fileType:"text",error:`\u6587\u672C\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Ft=async(p,o={})=>{try{let y;if(typeof p=="string"){const f=await fetch(p,{headers:o.token?{Authorization:o.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);y=await f.text()}else y=new TextDecoder("utf-8").decode(p);return{type:"markdown",content:{type:"markdown",text:y},fileName:o.fileName,fileType:"markdown"}}catch(y){return{type:"markdown",content:null,fileName:o.fileName,fileType:"markdown",error:`Markdown\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},pt=async(p,o={})=>{console.log("=== parseHtmlFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof p,options:o});try{let y;if(typeof p=="string"){console.log("\u4ECEURL\u52A0\u8F7DHTML:",p);const _=await fetch(p,{headers:o.token?{Authorization:o.token}:void 0});if(console.log("HTTP\u54CD\u5E94\u72B6\u6001:",_.status,_.statusText),!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);y=await _.text(),console.log("HTML\u5185\u5BB9\u957F\u5EA6:",y.length),console.log("HTML\u5185\u5BB9\u524D500\u5B57\u7B26:",y.substring(0,500))}else console.log("\u4ECEArrayBuffer\u52A0\u8F7DHTML"),y=new TextDecoder("utf-8").decode(p);const f={type:"html",content:{type:"html",text:y},fileName:o.fileName,fileType:"html"};return console.log("=== parseHtmlFile \u7ED3\u679C ==="),console.log("result:",f),console.log("result.content.text \u957F\u5EA6:",f.content.text.length),console.log("result.content.text \u524D200\u5B57\u7B26:",f.content.text.substring(0,200)),f}catch(y){return console.error("HTML\u89E3\u6790\u5931\u8D25:",y),{type:"html",content:null,fileName:o.fileName,fileType:"html",error:`HTML\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Ct=async(p,o={})=>{switch(be(o.fileName,o.fileType)){case"pdf":return await ft(p,o);case"image":return await Et(p,o);case"text":return await ht(p,o);case"markdown":case"markdown_table":return await Ft(p,o);case"html":return await pt(p,o);default:return{type:"unknown",content:null,fileName:o.fileName,fileType:o.fileType,error:"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"}}};dt$1.div`
310
+ `,mt={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}};c__default.memo(({fileName:p="\u672A\u77E5\u6587\u4EF6",currentPage:o=1,totalPage:y=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:Y,onNextPage:W,onZoomIn:K,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:T,onRotateRight:S,onClose:v,scale:c=1,isAnnotating:t=!1,className:r})=>{const a=(_==null?void 0:_.theme)||mt;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",o,"totalPage:",y),c__default.createElement(lt,{$theme:a,className:r},c__default.createElement(at,{$theme:a},c__default.createElement(st,{$theme:a},p)),c__default.createElement(ct,{$theme:a},f.navigation&&c__default.createElement(c__default.Fragment,null,c__default.createElement(ne,{$theme:a,onClick:Y,disabled:o<=1,title:"\u4E0A\u4E00\u9875"},c__default.createElement(Je,{size:16})),y>0&&c__default.createElement(it,{$theme:a},o," / ",y),c__default.createElement(ne,{$theme:a,onClick:W,disabled:!y||o>=y,title:"\u4E0B\u4E00\u9875"},c__default.createElement(Ke,{size:16}))),f.zoom&&c__default.createElement(c__default.Fragment,null,c__default.createElement(ne,{$theme:a,onClick:M,disabled:c<=.3,title:"\u7F29\u5C0F"},c__default.createElement(rt,{size:16})),c__default.createElement(dt,{$theme:a},Math.round(c*100),"%"),c__default.createElement(ne,{$theme:a,onClick:K,disabled:c>=3,title:"\u653E\u5927"},c__default.createElement(ut,{size:16}))),f.annotation&&c__default.createElement(ne,{$theme:a,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8"},c__default.createElement(et,{size:16})),f.download&&c__default.createElement(ne,{$theme:a,onClick:w,title:"\u4E0B\u8F7D"},c__default.createElement(Qe,{size:16})),f.rotate&&c__default.createElement(c__default.Fragment,null,c__default.createElement(ne,{$theme:a,onClick:T,title:"\u5411\u5DE6\u65CB\u8F6C"},c__default.createElement(tt,{size:16})),c__default.createElement(ne,{$theme:a,onClick:S,title:"\u5411\u53F3\u65CB\u8F6C"},c__default.createElement(ot,{size:16}))),f.close&&c__default.createElement(ne,{$theme:a,onClick:v,title:"\u5173\u95ED"},c__default.createElement(nt,{size:16}))))});const gt=()=>{try{if(xe()){console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");return}const p="/worker/pdf.worker.min.js";De(p),console.log("PDF Worker \u5DF2\u901A\u8FC7\u7EDF\u4E00\u51FD\u6570\u6CE8\u518C:",p)}catch(p){throw console.error("PDF Worker \u6CE8\u518C\u5931\u8D25:",p),p}},be=(p,o,y)=>{if(!p&&!o)return"unknown";const f=p||"",_=o||"";return f.toLowerCase().endsWith(".pdf")||_==="pdf"?"pdf":f.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||_==="image"?"image":f.toLowerCase().endsWith(".md")||_==="markdown"?_==="markdown_table"?"markdown_table":"markdown":f.toLowerCase().match(/\.(html|htm)$/)||_==="html"?"html":f.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||_==="text"?"text":"unknown"},ft=async(p,o={})=>{console.log("=== parsePdfFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof p,options:o});try{gt();let y;if(typeof p=="string"){console.log("\u4ECEURL\u52A0\u8F7DPDF:",p);const Y=pdfExports.getDocument({url:p,httpHeaders:o.token?{Authorization:o.token}:void 0});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",Y),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof Y),console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(Y))),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:",Object.keys(Y)),y=await Y.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",y),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof y),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(y))),console.log("PDF\u6587\u6863\u5C5E\u6027:",Object.keys(y))}else{console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");const Y=pdfExports.getDocument({data:p});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",Y),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof Y),y=await Y.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",y),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof y)}const f=y.numPages;console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:",f),console.log("PDF\u6307\u7EB9:",y.fingerprints),console.log("PDF\u4F20\u8F93\u5BF9\u8C61:",y._transport);const _={type:"pdf",content:{type:"pdf",document:y,totalPages:f},fileName:o.fileName,fileType:"pdf",totalPages:f};return console.log("=== \u89E3\u6790\u7ED3\u679C\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u89E3\u6790\u7ED3\u679C:",_),console.log("\u89E3\u6790\u7ED3\u679C\u7C7B\u578B:",typeof _),console.log("\u89E3\u6790\u7ED3\u679C\u5C5E\u6027:",Object.keys(_)),console.log("\u5185\u5BB9\u5BF9\u8C61:",_.content),console.log("\u6587\u6863\u5BF9\u8C61:",_.content.document),_}catch(y){console.error("PDF\u89E3\u6790\u5931\u8D25:",y),console.error("\u9519\u8BEF\u8BE6\u60C5:",{message:y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF",stack:y instanceof Error?y.stack:void 0,name:y instanceof Error?y.name:void 0,url:typeof p=="string"?p:"ArrayBuffer",options:o});let f="PDF\u89E3\u6790\u5931\u8D25";return y instanceof Error&&(y.message.includes("Invalid PDF structure")?f="PDF\u6587\u4EF6\u7ED3\u6784\u65E0\u6548\uFF0C\u53EF\u80FD\u6587\u4EF6\u635F\u574F\u6216\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u4EF6":y.message.includes("Failed to fetch")?f="PDF\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u548C\u6587\u4EF6URL":y.message.includes("Worker")?f="PDF\u89E3\u6790\u5668\u521D\u59CB\u5316\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u8BD5":f=`PDF\u89E3\u6790\u5931\u8D25: ${y.message}`),{type:"pdf",content:null,fileName:o.fileName,fileType:"pdf",error:f}}},Et=async(p,o={})=>{console.log("=== parseImageFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof p,options:o});try{let y;if(typeof p=="string")console.log("\u4ECEURL\u52A0\u8F7D\u56FE\u7247:",p),y=p;else{console.log("\u4ECEArrayBuffer\u52A0\u8F7D\u56FE\u7247");const _=new Blob([p]);y=URL.createObjectURL(_)}console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:",y),await new Promise((_,Y)=>{const W=new Image;W.onload=()=>{console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",y),console.log("\u56FE\u7247\u5C3A\u5BF8:",W.width,"x",W.height),_()},W.onerror=()=>{console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",y),Y(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))};const K=setTimeout(()=>{Y(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"))},1e4);W.onload=()=>{clearTimeout(K),console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",y),console.log("\u56FE\u7247\u5C3A\u5BF8:",W.width,"x",W.height),_()},W.onerror=()=>{clearTimeout(K),console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",y),Y(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))},W.src=y});const f={type:"image",content:{type:"image",url:y},fileName:o.fileName,fileType:"image"};return console.log("=== parseImageFile \u7ED3\u679C ==="),console.log("result:",f),f}catch(y){return console.error("\u56FE\u7247\u89E3\u6790\u5931\u8D25:",y),{type:"image",content:null,fileName:o.fileName,fileType:"image",error:`\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},ht=async(p,o={})=>{try{let y;if(typeof p=="string"){const f=await fetch(p,{headers:o.token?{Authorization:o.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);y=await f.text()}else y=new TextDecoder("utf-8").decode(p);return{type:"text",content:{type:"text",text:y},fileName:o.fileName,fileType:"text"}}catch(y){return{type:"text",content:null,fileName:o.fileName,fileType:"text",error:`\u6587\u672C\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Ft=async(p,o={})=>{try{let y;if(typeof p=="string"){const f=await fetch(p,{headers:o.token?{Authorization:o.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);y=await f.text()}else y=new TextDecoder("utf-8").decode(p);return{type:"markdown",content:{type:"markdown",text:y},fileName:o.fileName,fileType:"markdown"}}catch(y){return{type:"markdown",content:null,fileName:o.fileName,fileType:"markdown",error:`Markdown\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},pt=async(p,o={})=>{console.log("=== parseHtmlFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof p,options:o});try{let y;if(typeof p=="string"){console.log("\u4ECEURL\u52A0\u8F7DHTML:",p);const _=await fetch(p,{headers:o.token?{Authorization:o.token}:void 0});if(console.log("HTTP\u54CD\u5E94\u72B6\u6001:",_.status,_.statusText),!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);y=await _.text(),console.log("HTML\u5185\u5BB9\u957F\u5EA6:",y.length),console.log("HTML\u5185\u5BB9\u524D500\u5B57\u7B26:",y.substring(0,500))}else console.log("\u4ECEArrayBuffer\u52A0\u8F7DHTML"),y=new TextDecoder("utf-8").decode(p);const f={type:"html",content:{type:"html",text:y},fileName:o.fileName,fileType:"html"};return console.log("=== parseHtmlFile \u7ED3\u679C ==="),console.log("result:",f),console.log("result.content.text \u957F\u5EA6:",f.content.text.length),console.log("result.content.text \u524D200\u5B57\u7B26:",f.content.text.substring(0,200)),f}catch(y){return console.error("HTML\u89E3\u6790\u5931\u8D25:",y),{type:"html",content:null,fileName:o.fileName,fileType:"html",error:`HTML\u89E3\u6790\u5931\u8D25: ${y instanceof Error?y.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Ct=async(p,o={})=>{switch(be(o.fileName,o.fileType)){case"pdf":return await ft(p,o);case"image":return await Et(p,o);case"text":return await ht(p,o);case"markdown":case"markdown_table":return await Ft(p,o);case"html":return await pt(p,o);default:return{type:"unknown",content:null,fileName:o.fileName,fileType:o.fileType,error:"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"}}};dt$1.div`
311
311
  display: flex;
312
312
  flex-direction: column;
313
313
  height: 100%;
@@ -390,7 +390,7 @@ var Vn=Object.defineProperty;var wn=p=>{throw TypeError(p)};var Yn=(p,o,y)=>o in
390
390
  color: ${p=>p.$theme.colors.disabledText};
391
391
  min-width: 40px;
392
392
  text-align: center;
393
- `,defaultTheme$1={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},Header=m__default.memo(({fileName:p="\u672A\u77E5\u6587\u4EF6",currentPage:o=1,totalPage:y=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:Y,onNextPage:W,onZoomIn:K,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:T,onRotateRight:S,onClose:v,scale:c=1,isAnnotating:t=!1,className:r})=>{const a=(_==null?void 0:_.theme)||defaultTheme$1;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",o,"totalPage:",y),jsxs(HeaderContainer,{$theme:a,className:r,children:[jsx(FileInfo,{$theme:a,children:jsx(FileName,{$theme:a,children:p})}),jsxs(ToolBar,{$theme:a,children:[f.navigation&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:a,onClick:Y,disabled:o<=1,title:"\u4E0A\u4E00\u9875",children:jsx(ChevronLeft,{size:16})}),y>0&&jsxs(PageInfo,{$theme:a,children:[o," / ",y]}),jsx(ToolButton,{$theme:a,onClick:W,disabled:!y||o>=y,title:"\u4E0B\u4E00\u9875",children:jsx(ChevronRight,{size:16})})]}),f.zoom&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:a,onClick:M,disabled:c<=.3,title:"\u7F29\u5C0F",children:jsx(ZoomOut,{size:16})}),jsxs(ZoomInfo,{$theme:a,children:[Math.round(c*100),"%"]}),jsx(ToolButton,{$theme:a,onClick:K,disabled:c>=3,title:"\u653E\u5927",children:jsx(ZoomIn,{size:16})})]}),f.annotation&&jsx(ToolButton,{$theme:a,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8",children:jsx(Pencil,{size:16})}),f.download&&jsx(ToolButton,{$theme:a,onClick:w,title:"\u4E0B\u8F7D",children:jsx(Download,{size:16})}),f.rotate&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:a,onClick:T,title:"\u5411\u5DE6\u65CB\u8F6C",children:jsx(RotateCcw,{size:16})}),jsx(ToolButton,{$theme:a,onClick:S,title:"\u5411\u53F3\u65CB\u8F6C",children:jsx(RotateCw,{size:16})})]}),f.close&&jsx(ToolButton,{$theme:a,onClick:v,title:"\u5173\u95ED",children:jsx(X,{size:16})})]})]})}),ReaderContainer=dt$1.div`
393
+ `,defaultTheme$1={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},Header=c__default.memo(({fileName:p="\u672A\u77E5\u6587\u4EF6",currentPage:o=1,totalPage:y=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:Y,onNextPage:W,onZoomIn:K,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:T,onRotateRight:S,onClose:v,scale:c=1,isAnnotating:t=!1,className:r})=>{const a=(_==null?void 0:_.theme)||defaultTheme$1;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",o,"totalPage:",y),jsxs(HeaderContainer,{$theme:a,className:r,children:[jsx(FileInfo,{$theme:a,children:jsx(FileName,{$theme:a,children:p})}),jsxs(ToolBar,{$theme:a,children:[f.navigation&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:a,onClick:Y,disabled:o<=1,title:"\u4E0A\u4E00\u9875",children:jsx(ChevronLeft,{size:16})}),y>0&&jsxs(PageInfo,{$theme:a,children:[o," / ",y]}),jsx(ToolButton,{$theme:a,onClick:W,disabled:!y||o>=y,title:"\u4E0B\u4E00\u9875",children:jsx(ChevronRight,{size:16})})]}),f.zoom&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:a,onClick:M,disabled:c<=.3,title:"\u7F29\u5C0F",children:jsx(ZoomOut,{size:16})}),jsxs(ZoomInfo,{$theme:a,children:[Math.round(c*100),"%"]}),jsx(ToolButton,{$theme:a,onClick:K,disabled:c>=3,title:"\u653E\u5927",children:jsx(ZoomIn,{size:16})})]}),f.annotation&&jsx(ToolButton,{$theme:a,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8",children:jsx(Pencil,{size:16})}),f.download&&jsx(ToolButton,{$theme:a,onClick:w,title:"\u4E0B\u8F7D",children:jsx(Download,{size:16})}),f.rotate&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:a,onClick:T,title:"\u5411\u5DE6\u65CB\u8F6C",children:jsx(RotateCcw,{size:16})}),jsx(ToolButton,{$theme:a,onClick:S,title:"\u5411\u53F3\u65CB\u8F6C",children:jsx(RotateCw,{size:16})})]}),f.close&&jsx(ToolButton,{$theme:a,onClick:v,title:"\u5173\u95ED",children:jsx(X,{size:16})})]})]})}),ReaderContainer=dt$1.div`
394
394
  display: flex;
395
395
  flex-direction: column;
396
396
  height: 100%;