@jean-is/render 0.8.0-rba68a676ffad → 0.8.0-rede3e4e8e9a5

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 (1421) hide show
  1. package/brand.js +3 -1
  2. package/caps/charts/charts.css +5 -2
  3. package/caps/charts/charts.js +45 -24
  4. package/caps/charts/option.js +11 -1
  5. package/caps/files/midi.js +1 -1
  6. package/caps/files/office.js +4 -4
  7. package/caps/games/file.js +56 -0
  8. package/caps/games/frame.css +22 -0
  9. package/caps/games/guard.js +86 -0
  10. package/caps/games/page.js +52 -0
  11. package/caps/games/shell.js +260 -0
  12. package/caps/interactive/apps.js +23 -8
  13. package/caps/interactive/diagram.js +96 -22
  14. package/caps/interactive/interactive.css +22 -6
  15. package/caps/interactive/interactive.js +25 -10
  16. package/caps/interactive/live.js +96 -0
  17. package/caps/interactive/map.js +22 -2
  18. package/caps/interactive/mode.js +9 -6
  19. package/caps/interactive/page-diagram.js +6 -2
  20. package/caps/interactive/parts.js +124 -0
  21. package/caps/interactive/view-parts.js +209 -0
  22. package/caps/layouts/layouts.css +12 -12
  23. package/caps/layouts/layouts.js +25 -17
  24. package/caps/layouts/shapes.js +1 -1
  25. package/caps/made/formats.js +84 -46
  26. package/caps/made/paper.js +142 -0
  27. package/caps/math/math.js +2 -2
  28. package/caps/scores/scores.css +10 -4
  29. package/caps/scores/scores.js +99 -51
  30. package/caps/share/view.js +1 -1
  31. package/caps/skills/directory.js +6 -3
  32. package/caps/skills/sources.js +4 -2
  33. package/caps/slides/edit.js +2 -2
  34. package/caps/slides/kit-page.css +8 -2
  35. package/caps/slides/kit-page.js +47 -38
  36. package/caps/slides/kit-sample.js +36 -0
  37. package/caps/slides/kit-slot.js +10 -0
  38. package/caps/slides/kit.js +3 -0
  39. package/caps/slides/save.js +24 -58
  40. package/caps/slides/slides.css +9 -9
  41. package/caps/slides/slides.js +24 -24
  42. package/caps/tables/formula.js +133 -0
  43. package/core/conversations.js +151 -0
  44. package/core/deferred.js +36 -16
  45. package/core/events.js +1 -1
  46. package/core/files.js +9 -3
  47. package/core/fs.js +3 -11
  48. package/core/hooks.js +2 -2
  49. package/core/i18n.js +1 -1
  50. package/core/llm.js +34 -45
  51. package/core/loop.js +15 -17
  52. package/core/oauth.js +31 -0
  53. package/core/search.js +1 -1
  54. package/core/settings.js +12 -11
  55. package/core/skills.js +3 -3
  56. package/core/vertex.js +37 -0
  57. package/locales/am.json +19 -3
  58. package/locales/approvals/am.json +2 -1
  59. package/locales/approvals/ar.json +2 -1
  60. package/locales/approvals/bg.json +2 -1
  61. package/locales/approvals/bn.json +2 -1
  62. package/locales/approvals/br.json +2 -1
  63. package/locales/approvals/co.json +2 -1
  64. package/locales/approvals/cs.json +2 -1
  65. package/locales/approvals/da.json +2 -1
  66. package/locales/approvals/de.json +2 -1
  67. package/locales/approvals/el.json +2 -1
  68. package/locales/approvals/en.json +2 -1
  69. package/locales/approvals/es.json +2 -1
  70. package/locales/approvals/fa.json +2 -1
  71. package/locales/approvals/fi.json +2 -1
  72. package/locales/approvals/fr-CA.json +2 -1
  73. package/locales/approvals/fr.json +2 -1
  74. package/locales/approvals/ha.json +2 -1
  75. package/locales/approvals/he.json +2 -1
  76. package/locales/approvals/hi.json +2 -1
  77. package/locales/approvals/hr.json +2 -1
  78. package/locales/approvals/hu.json +2 -1
  79. package/locales/approvals/id.json +2 -1
  80. package/locales/approvals/it.json +2 -1
  81. package/locales/approvals/ja.json +2 -1
  82. package/locales/approvals/ko.json +2 -1
  83. package/locales/approvals/mr.json +2 -1
  84. package/locales/approvals/ms.json +2 -1
  85. package/locales/approvals/nl.json +2 -1
  86. package/locales/approvals/pl.json +2 -1
  87. package/locales/approvals/pt.json +2 -1
  88. package/locales/approvals/ro.json +2 -1
  89. package/locales/approvals/ru.json +2 -1
  90. package/locales/approvals/sk.json +2 -1
  91. package/locales/approvals/sv.json +2 -1
  92. package/locales/approvals/sw.json +2 -1
  93. package/locales/approvals/ta.json +2 -1
  94. package/locales/approvals/te.json +2 -1
  95. package/locales/approvals/th.json +2 -1
  96. package/locales/approvals/tl.json +2 -1
  97. package/locales/approvals/tr.json +2 -1
  98. package/locales/approvals/uk.json +2 -1
  99. package/locales/approvals/ur.json +2 -1
  100. package/locales/approvals/vi.json +2 -1
  101. package/locales/approvals/yo.json +2 -1
  102. package/locales/approvals/zh-Hans.json +2 -1
  103. package/locales/approvals/zh-Hant.json +2 -1
  104. package/locales/ar.json +23 -3
  105. package/locales/bg.json +19 -3
  106. package/locales/bn.json +19 -3
  107. package/locales/br.json +22 -3
  108. package/locales/brains/am.json +6 -3
  109. package/locales/brains/ar.json +6 -3
  110. package/locales/brains/bg.json +6 -3
  111. package/locales/brains/bn.json +6 -3
  112. package/locales/brains/br.json +6 -3
  113. package/locales/brains/co.json +6 -3
  114. package/locales/brains/cs.json +6 -3
  115. package/locales/brains/da.json +6 -3
  116. package/locales/brains/de.json +6 -3
  117. package/locales/brains/el.json +6 -3
  118. package/locales/brains/en.json +6 -3
  119. package/locales/brains/es.json +6 -3
  120. package/locales/brains/fa.json +6 -3
  121. package/locales/brains/fi.json +6 -3
  122. package/locales/brains/fr-CA.json +6 -3
  123. package/locales/brains/fr.json +6 -3
  124. package/locales/brains/ha.json +6 -3
  125. package/locales/brains/he.json +6 -3
  126. package/locales/brains/hi.json +6 -3
  127. package/locales/brains/hr.json +6 -3
  128. package/locales/brains/hu.json +6 -3
  129. package/locales/brains/id.json +6 -3
  130. package/locales/brains/it.json +6 -3
  131. package/locales/brains/ja.json +6 -3
  132. package/locales/brains/ko.json +6 -3
  133. package/locales/brains/mr.json +6 -3
  134. package/locales/brains/ms.json +6 -3
  135. package/locales/brains/nl.json +6 -3
  136. package/locales/brains/pl.json +6 -3
  137. package/locales/brains/pt.json +6 -3
  138. package/locales/brains/ro.json +6 -3
  139. package/locales/brains/ru.json +6 -3
  140. package/locales/brains/sk.json +6 -3
  141. package/locales/brains/sv.json +6 -3
  142. package/locales/brains/sw.json +6 -3
  143. package/locales/brains/ta.json +6 -3
  144. package/locales/brains/te.json +6 -3
  145. package/locales/brains/th.json +6 -3
  146. package/locales/brains/tl.json +6 -3
  147. package/locales/brains/tr.json +6 -3
  148. package/locales/brains/uk.json +6 -3
  149. package/locales/brains/ur.json +6 -3
  150. package/locales/brains/vi.json +6 -3
  151. package/locales/brains/yo.json +6 -3
  152. package/locales/brains/zh-Hans.json +6 -3
  153. package/locales/brains/zh-Hant.json +6 -3
  154. package/locales/camera/am.json +20 -0
  155. package/locales/camera/ar.json +20 -0
  156. package/locales/camera/bg.json +20 -0
  157. package/locales/camera/bn.json +20 -0
  158. package/locales/camera/br.json +20 -0
  159. package/locales/camera/co.json +20 -0
  160. package/locales/camera/cs.json +20 -0
  161. package/locales/camera/da.json +20 -0
  162. package/locales/camera/de.json +20 -0
  163. package/locales/camera/el.json +20 -0
  164. package/locales/camera/en.json +20 -0
  165. package/locales/camera/es.json +20 -0
  166. package/locales/camera/fa.json +20 -0
  167. package/locales/camera/fi.json +20 -0
  168. package/locales/camera/fr-CA.json +20 -0
  169. package/locales/camera/fr.json +20 -0
  170. package/locales/camera/ha.json +20 -0
  171. package/locales/camera/he.json +20 -0
  172. package/locales/camera/hi.json +20 -0
  173. package/locales/camera/hr.json +20 -0
  174. package/locales/camera/hu.json +20 -0
  175. package/locales/camera/id.json +20 -0
  176. package/locales/camera/it.json +20 -0
  177. package/locales/camera/ja.json +20 -0
  178. package/locales/camera/ko.json +20 -0
  179. package/locales/camera/mr.json +20 -0
  180. package/locales/camera/ms.json +20 -0
  181. package/locales/camera/nl.json +20 -0
  182. package/locales/camera/pl.json +20 -0
  183. package/locales/camera/pt.json +20 -0
  184. package/locales/camera/ro.json +20 -0
  185. package/locales/camera/ru.json +20 -0
  186. package/locales/camera/sk.json +20 -0
  187. package/locales/camera/sv.json +20 -0
  188. package/locales/camera/sw.json +20 -0
  189. package/locales/camera/ta.json +20 -0
  190. package/locales/camera/te.json +20 -0
  191. package/locales/camera/th.json +20 -0
  192. package/locales/camera/tl.json +20 -0
  193. package/locales/camera/tr.json +20 -0
  194. package/locales/camera/uk.json +20 -0
  195. package/locales/camera/ur.json +20 -0
  196. package/locales/camera/vi.json +20 -0
  197. package/locales/camera/yo.json +20 -0
  198. package/locales/camera/zh-Hans.json +20 -0
  199. package/locales/camera/zh-Hant.json +20 -0
  200. package/locales/charts/am.json +2 -0
  201. package/locales/charts/ar.json +2 -0
  202. package/locales/charts/bg.json +2 -0
  203. package/locales/charts/bn.json +2 -0
  204. package/locales/charts/br.json +2 -0
  205. package/locales/charts/co.json +2 -0
  206. package/locales/charts/cs.json +2 -0
  207. package/locales/charts/da.json +2 -0
  208. package/locales/charts/de.json +2 -0
  209. package/locales/charts/el.json +2 -0
  210. package/locales/charts/en.json +2 -0
  211. package/locales/charts/es.json +2 -0
  212. package/locales/charts/fa.json +2 -0
  213. package/locales/charts/fi.json +2 -0
  214. package/locales/charts/fr-CA.json +2 -0
  215. package/locales/charts/fr.json +2 -0
  216. package/locales/charts/ha.json +2 -0
  217. package/locales/charts/he.json +2 -0
  218. package/locales/charts/hi.json +2 -0
  219. package/locales/charts/hr.json +2 -0
  220. package/locales/charts/hu.json +2 -0
  221. package/locales/charts/id.json +2 -0
  222. package/locales/charts/it.json +2 -0
  223. package/locales/charts/ja.json +2 -0
  224. package/locales/charts/ko.json +2 -0
  225. package/locales/charts/mr.json +2 -0
  226. package/locales/charts/ms.json +2 -0
  227. package/locales/charts/nl.json +2 -0
  228. package/locales/charts/pl.json +2 -0
  229. package/locales/charts/pt.json +2 -0
  230. package/locales/charts/ro.json +2 -0
  231. package/locales/charts/ru.json +2 -0
  232. package/locales/charts/sk.json +2 -0
  233. package/locales/charts/sv.json +2 -0
  234. package/locales/charts/sw.json +2 -0
  235. package/locales/charts/ta.json +2 -0
  236. package/locales/charts/te.json +2 -0
  237. package/locales/charts/th.json +2 -0
  238. package/locales/charts/tl.json +2 -0
  239. package/locales/charts/tr.json +2 -0
  240. package/locales/charts/uk.json +2 -0
  241. package/locales/charts/ur.json +2 -0
  242. package/locales/charts/vi.json +2 -0
  243. package/locales/charts/yo.json +2 -0
  244. package/locales/charts/zh-Hans.json +2 -0
  245. package/locales/charts/zh-Hant.json +2 -0
  246. package/locales/co.json +20 -3
  247. package/locales/creations/am.json +4 -0
  248. package/locales/creations/ar.json +4 -0
  249. package/locales/creations/bg.json +4 -0
  250. package/locales/creations/bn.json +4 -0
  251. package/locales/creations/br.json +4 -0
  252. package/locales/creations/co.json +4 -0
  253. package/locales/creations/cs.json +4 -0
  254. package/locales/creations/da.json +4 -0
  255. package/locales/creations/de.json +4 -0
  256. package/locales/creations/el.json +4 -0
  257. package/locales/creations/en.json +4 -0
  258. package/locales/creations/es.json +4 -0
  259. package/locales/creations/fa.json +4 -0
  260. package/locales/creations/fi.json +4 -0
  261. package/locales/creations/fr-CA.json +4 -0
  262. package/locales/creations/fr.json +4 -0
  263. package/locales/creations/ha.json +4 -0
  264. package/locales/creations/he.json +4 -0
  265. package/locales/creations/hi.json +4 -0
  266. package/locales/creations/hr.json +4 -0
  267. package/locales/creations/hu.json +4 -0
  268. package/locales/creations/id.json +4 -0
  269. package/locales/creations/it.json +4 -0
  270. package/locales/creations/ja.json +4 -0
  271. package/locales/creations/ko.json +4 -0
  272. package/locales/creations/mr.json +4 -0
  273. package/locales/creations/ms.json +4 -0
  274. package/locales/creations/nl.json +4 -0
  275. package/locales/creations/pl.json +4 -0
  276. package/locales/creations/pt.json +4 -0
  277. package/locales/creations/ro.json +4 -0
  278. package/locales/creations/ru.json +4 -0
  279. package/locales/creations/sk.json +4 -0
  280. package/locales/creations/sv.json +4 -0
  281. package/locales/creations/sw.json +4 -0
  282. package/locales/creations/ta.json +4 -0
  283. package/locales/creations/te.json +4 -0
  284. package/locales/creations/th.json +4 -0
  285. package/locales/creations/tl.json +4 -0
  286. package/locales/creations/tr.json +4 -0
  287. package/locales/creations/uk.json +4 -0
  288. package/locales/creations/ur.json +4 -0
  289. package/locales/creations/vi.json +4 -0
  290. package/locales/creations/yo.json +4 -0
  291. package/locales/creations/zh-Hans.json +4 -0
  292. package/locales/creations/zh-Hant.json +4 -0
  293. package/locales/cs.json +21 -3
  294. package/locales/da.json +19 -3
  295. package/locales/de.json +19 -3
  296. package/locales/designs/am.json +0 -14
  297. package/locales/designs/ar.json +0 -14
  298. package/locales/designs/bg.json +0 -14
  299. package/locales/designs/bn.json +0 -14
  300. package/locales/designs/br.json +0 -14
  301. package/locales/designs/co.json +0 -14
  302. package/locales/designs/cs.json +0 -14
  303. package/locales/designs/da.json +0 -14
  304. package/locales/designs/de.json +0 -14
  305. package/locales/designs/el.json +0 -14
  306. package/locales/designs/en.json +0 -14
  307. package/locales/designs/es.json +0 -14
  308. package/locales/designs/fa.json +0 -14
  309. package/locales/designs/fi.json +0 -14
  310. package/locales/designs/fr-CA.json +0 -14
  311. package/locales/designs/fr.json +0 -14
  312. package/locales/designs/ha.json +0 -14
  313. package/locales/designs/he.json +0 -14
  314. package/locales/designs/hi.json +0 -14
  315. package/locales/designs/hr.json +0 -14
  316. package/locales/designs/hu.json +0 -14
  317. package/locales/designs/id.json +0 -14
  318. package/locales/designs/it.json +0 -14
  319. package/locales/designs/ja.json +0 -14
  320. package/locales/designs/ko.json +0 -14
  321. package/locales/designs/mr.json +0 -14
  322. package/locales/designs/ms.json +0 -14
  323. package/locales/designs/nl.json +0 -14
  324. package/locales/designs/pl.json +0 -14
  325. package/locales/designs/pt.json +0 -14
  326. package/locales/designs/ro.json +0 -14
  327. package/locales/designs/ru.json +0 -14
  328. package/locales/designs/sk.json +0 -14
  329. package/locales/designs/sv.json +0 -14
  330. package/locales/designs/sw.json +0 -14
  331. package/locales/designs/ta.json +0 -14
  332. package/locales/designs/te.json +0 -14
  333. package/locales/designs/th.json +0 -14
  334. package/locales/designs/tl.json +0 -14
  335. package/locales/designs/tr.json +0 -14
  336. package/locales/designs/uk.json +0 -14
  337. package/locales/designs/ur.json +0 -14
  338. package/locales/designs/vi.json +0 -14
  339. package/locales/designs/yo.json +0 -14
  340. package/locales/designs/zh-Hans.json +0 -14
  341. package/locales/designs/zh-Hant.json +0 -14
  342. package/locales/dialogs/am.json +7 -0
  343. package/locales/dialogs/ar.json +7 -0
  344. package/locales/dialogs/bg.json +7 -0
  345. package/locales/dialogs/bn.json +7 -0
  346. package/locales/dialogs/br.json +7 -0
  347. package/locales/dialogs/co.json +7 -0
  348. package/locales/dialogs/cs.json +7 -0
  349. package/locales/dialogs/da.json +7 -0
  350. package/locales/dialogs/de.json +7 -0
  351. package/locales/dialogs/el.json +7 -0
  352. package/locales/dialogs/en.json +7 -0
  353. package/locales/dialogs/es.json +7 -0
  354. package/locales/dialogs/fa.json +7 -0
  355. package/locales/dialogs/fi.json +7 -0
  356. package/locales/dialogs/fr-CA.json +9 -2
  357. package/locales/dialogs/fr.json +9 -2
  358. package/locales/dialogs/ha.json +7 -0
  359. package/locales/dialogs/he.json +7 -0
  360. package/locales/dialogs/hi.json +7 -0
  361. package/locales/dialogs/hr.json +7 -0
  362. package/locales/dialogs/hu.json +7 -0
  363. package/locales/dialogs/id.json +7 -0
  364. package/locales/dialogs/it.json +7 -0
  365. package/locales/dialogs/ja.json +7 -0
  366. package/locales/dialogs/ko.json +7 -0
  367. package/locales/dialogs/mr.json +7 -0
  368. package/locales/dialogs/ms.json +7 -0
  369. package/locales/dialogs/nl.json +7 -0
  370. package/locales/dialogs/pl.json +7 -0
  371. package/locales/dialogs/pt.json +7 -0
  372. package/locales/dialogs/ro.json +7 -0
  373. package/locales/dialogs/ru.json +7 -0
  374. package/locales/dialogs/sk.json +7 -0
  375. package/locales/dialogs/sv.json +7 -0
  376. package/locales/dialogs/sw.json +7 -0
  377. package/locales/dialogs/ta.json +7 -0
  378. package/locales/dialogs/te.json +7 -0
  379. package/locales/dialogs/th.json +7 -0
  380. package/locales/dialogs/tl.json +7 -0
  381. package/locales/dialogs/tr.json +7 -0
  382. package/locales/dialogs/uk.json +7 -0
  383. package/locales/dialogs/ur.json +7 -0
  384. package/locales/dialogs/vi.json +7 -0
  385. package/locales/dialogs/yo.json +7 -0
  386. package/locales/dialogs/zh-Hans.json +7 -0
  387. package/locales/dialogs/zh-Hant.json +7 -0
  388. package/locales/documents/am.json +6 -0
  389. package/locales/documents/ar.json +6 -0
  390. package/locales/documents/bg.json +6 -0
  391. package/locales/documents/bn.json +6 -0
  392. package/locales/documents/br.json +6 -0
  393. package/locales/documents/co.json +6 -0
  394. package/locales/documents/cs.json +6 -0
  395. package/locales/documents/da.json +6 -0
  396. package/locales/documents/de.json +6 -0
  397. package/locales/documents/el.json +6 -0
  398. package/locales/documents/en.json +6 -0
  399. package/locales/documents/es.json +6 -0
  400. package/locales/documents/fa.json +6 -0
  401. package/locales/documents/fi.json +6 -0
  402. package/locales/documents/fr-CA.json +6 -0
  403. package/locales/documents/fr.json +6 -0
  404. package/locales/documents/ha.json +6 -0
  405. package/locales/documents/he.json +6 -0
  406. package/locales/documents/hi.json +6 -0
  407. package/locales/documents/hr.json +6 -0
  408. package/locales/documents/hu.json +6 -0
  409. package/locales/documents/id.json +6 -0
  410. package/locales/documents/it.json +6 -0
  411. package/locales/documents/ja.json +6 -0
  412. package/locales/documents/ko.json +6 -0
  413. package/locales/documents/mr.json +6 -0
  414. package/locales/documents/ms.json +6 -0
  415. package/locales/documents/nl.json +6 -0
  416. package/locales/documents/pl.json +6 -0
  417. package/locales/documents/pt.json +6 -0
  418. package/locales/documents/ro.json +6 -0
  419. package/locales/documents/ru.json +6 -0
  420. package/locales/documents/sk.json +6 -0
  421. package/locales/documents/sv.json +6 -0
  422. package/locales/documents/sw.json +6 -0
  423. package/locales/documents/ta.json +6 -0
  424. package/locales/documents/te.json +6 -0
  425. package/locales/documents/th.json +6 -0
  426. package/locales/documents/tl.json +6 -0
  427. package/locales/documents/tr.json +6 -0
  428. package/locales/documents/uk.json +6 -0
  429. package/locales/documents/ur.json +6 -0
  430. package/locales/documents/vi.json +6 -0
  431. package/locales/documents/yo.json +6 -0
  432. package/locales/documents/zh-Hans.json +6 -0
  433. package/locales/documents/zh-Hant.json +6 -0
  434. package/locales/el.json +19 -3
  435. package/locales/en.json +19 -3
  436. package/locales/enterprise/am.json +29 -1
  437. package/locales/enterprise/ar.json +29 -1
  438. package/locales/enterprise/bg.json +29 -1
  439. package/locales/enterprise/bn.json +29 -1
  440. package/locales/enterprise/br.json +29 -1
  441. package/locales/enterprise/co.json +29 -1
  442. package/locales/enterprise/cs.json +29 -1
  443. package/locales/enterprise/da.json +29 -1
  444. package/locales/enterprise/de.json +29 -1
  445. package/locales/enterprise/el.json +29 -1
  446. package/locales/enterprise/en.json +29 -1
  447. package/locales/enterprise/es.json +29 -1
  448. package/locales/enterprise/fa.json +29 -1
  449. package/locales/enterprise/fi.json +29 -1
  450. package/locales/enterprise/fr-CA.json +29 -1
  451. package/locales/enterprise/fr.json +29 -1
  452. package/locales/enterprise/ha.json +29 -1
  453. package/locales/enterprise/he.json +29 -1
  454. package/locales/enterprise/hi.json +29 -1
  455. package/locales/enterprise/hr.json +29 -1
  456. package/locales/enterprise/hu.json +29 -1
  457. package/locales/enterprise/id.json +29 -1
  458. package/locales/enterprise/it.json +29 -1
  459. package/locales/enterprise/ja.json +29 -1
  460. package/locales/enterprise/ko.json +29 -1
  461. package/locales/enterprise/mr.json +29 -1
  462. package/locales/enterprise/ms.json +29 -1
  463. package/locales/enterprise/nl.json +29 -1
  464. package/locales/enterprise/pl.json +29 -1
  465. package/locales/enterprise/pt.json +29 -1
  466. package/locales/enterprise/ro.json +29 -1
  467. package/locales/enterprise/ru.json +29 -1
  468. package/locales/enterprise/sk.json +29 -1
  469. package/locales/enterprise/sv.json +29 -1
  470. package/locales/enterprise/sw.json +29 -1
  471. package/locales/enterprise/ta.json +29 -1
  472. package/locales/enterprise/te.json +29 -1
  473. package/locales/enterprise/th.json +29 -1
  474. package/locales/enterprise/tl.json +29 -1
  475. package/locales/enterprise/tr.json +29 -1
  476. package/locales/enterprise/uk.json +29 -1
  477. package/locales/enterprise/ur.json +29 -1
  478. package/locales/enterprise/vi.json +29 -1
  479. package/locales/enterprise/yo.json +29 -1
  480. package/locales/enterprise/zh-Hans.json +29 -1
  481. package/locales/enterprise/zh-Hant.json +29 -1
  482. package/locales/es.json +20 -3
  483. package/locales/fa.json +19 -3
  484. package/locales/fi.json +19 -3
  485. package/locales/fr-CA.json +21 -4
  486. package/locales/fr.json +21 -4
  487. package/locales/games/am.json +16 -0
  488. package/locales/games/ar.json +16 -0
  489. package/locales/games/bg.json +16 -0
  490. package/locales/games/bn.json +16 -0
  491. package/locales/games/br.json +16 -0
  492. package/locales/games/co.json +16 -0
  493. package/locales/games/cs.json +16 -0
  494. package/locales/games/da.json +16 -0
  495. package/locales/games/de.json +16 -0
  496. package/locales/games/el.json +16 -0
  497. package/locales/games/en.json +16 -0
  498. package/locales/games/es.json +16 -0
  499. package/locales/games/fa.json +16 -0
  500. package/locales/games/fi.json +16 -0
  501. package/locales/games/fr-CA.json +16 -0
  502. package/locales/games/fr.json +16 -0
  503. package/locales/games/ha.json +16 -0
  504. package/locales/games/he.json +16 -0
  505. package/locales/games/hi.json +16 -0
  506. package/locales/games/hr.json +16 -0
  507. package/locales/games/hu.json +16 -0
  508. package/locales/games/id.json +16 -0
  509. package/locales/games/it.json +16 -0
  510. package/locales/games/ja.json +16 -0
  511. package/locales/games/ko.json +16 -0
  512. package/locales/games/mr.json +16 -0
  513. package/locales/games/ms.json +16 -0
  514. package/locales/games/nl.json +16 -0
  515. package/locales/games/pl.json +16 -0
  516. package/locales/games/pt.json +16 -0
  517. package/locales/games/ro.json +16 -0
  518. package/locales/games/ru.json +16 -0
  519. package/locales/games/sk.json +16 -0
  520. package/locales/games/sv.json +16 -0
  521. package/locales/games/sw.json +16 -0
  522. package/locales/games/ta.json +16 -0
  523. package/locales/games/te.json +16 -0
  524. package/locales/games/th.json +16 -0
  525. package/locales/games/tl.json +16 -0
  526. package/locales/games/tr.json +16 -0
  527. package/locales/games/uk.json +16 -0
  528. package/locales/games/ur.json +16 -0
  529. package/locales/games/vi.json +16 -0
  530. package/locales/games/yo.json +16 -0
  531. package/locales/games/zh-Hans.json +16 -0
  532. package/locales/games/zh-Hant.json +16 -0
  533. package/locales/ha.json +19 -3
  534. package/locales/he.json +20 -3
  535. package/locales/hi.json +19 -3
  536. package/locales/hr.json +20 -3
  537. package/locales/hu.json +19 -3
  538. package/locales/id.json +18 -3
  539. package/locales/interactive/am.json +11 -2
  540. package/locales/interactive/ar.json +11 -2
  541. package/locales/interactive/bg.json +11 -2
  542. package/locales/interactive/bn.json +11 -2
  543. package/locales/interactive/br.json +11 -2
  544. package/locales/interactive/co.json +11 -2
  545. package/locales/interactive/cs.json +11 -2
  546. package/locales/interactive/da.json +11 -2
  547. package/locales/interactive/de.json +11 -2
  548. package/locales/interactive/el.json +11 -2
  549. package/locales/interactive/en.json +11 -2
  550. package/locales/interactive/es.json +11 -2
  551. package/locales/interactive/fa.json +11 -2
  552. package/locales/interactive/fi.json +11 -2
  553. package/locales/interactive/fr-CA.json +11 -2
  554. package/locales/interactive/fr.json +11 -2
  555. package/locales/interactive/ha.json +11 -2
  556. package/locales/interactive/he.json +11 -2
  557. package/locales/interactive/hi.json +11 -2
  558. package/locales/interactive/hr.json +11 -2
  559. package/locales/interactive/hu.json +11 -2
  560. package/locales/interactive/id.json +11 -2
  561. package/locales/interactive/it.json +11 -2
  562. package/locales/interactive/ja.json +11 -2
  563. package/locales/interactive/ko.json +11 -2
  564. package/locales/interactive/mr.json +11 -2
  565. package/locales/interactive/ms.json +11 -2
  566. package/locales/interactive/nl.json +11 -2
  567. package/locales/interactive/pl.json +11 -2
  568. package/locales/interactive/pt.json +11 -2
  569. package/locales/interactive/ro.json +11 -2
  570. package/locales/interactive/ru.json +11 -2
  571. package/locales/interactive/sk.json +11 -2
  572. package/locales/interactive/sv.json +11 -2
  573. package/locales/interactive/sw.json +11 -2
  574. package/locales/interactive/ta.json +11 -2
  575. package/locales/interactive/te.json +11 -2
  576. package/locales/interactive/th.json +11 -2
  577. package/locales/interactive/tl.json +11 -2
  578. package/locales/interactive/tr.json +11 -2
  579. package/locales/interactive/uk.json +11 -2
  580. package/locales/interactive/ur.json +11 -2
  581. package/locales/interactive/vi.json +11 -2
  582. package/locales/interactive/yo.json +11 -2
  583. package/locales/interactive/zh-Hans.json +11 -2
  584. package/locales/interactive/zh-Hant.json +11 -2
  585. package/locales/it.json +20 -3
  586. package/locales/ja.json +18 -3
  587. package/locales/ko.json +18 -3
  588. package/locales/lock/am.json +6 -3
  589. package/locales/lock/ar.json +6 -3
  590. package/locales/lock/bg.json +6 -3
  591. package/locales/lock/bn.json +6 -3
  592. package/locales/lock/br.json +6 -3
  593. package/locales/lock/co.json +6 -3
  594. package/locales/lock/cs.json +6 -3
  595. package/locales/lock/da.json +6 -3
  596. package/locales/lock/de.json +6 -3
  597. package/locales/lock/el.json +6 -3
  598. package/locales/lock/en.json +6 -3
  599. package/locales/lock/es.json +6 -3
  600. package/locales/lock/fa.json +6 -3
  601. package/locales/lock/fi.json +6 -3
  602. package/locales/lock/fr-CA.json +6 -3
  603. package/locales/lock/fr.json +6 -3
  604. package/locales/lock/ha.json +6 -3
  605. package/locales/lock/he.json +6 -3
  606. package/locales/lock/hi.json +6 -3
  607. package/locales/lock/hr.json +6 -3
  608. package/locales/lock/hu.json +6 -3
  609. package/locales/lock/id.json +6 -3
  610. package/locales/lock/it.json +6 -3
  611. package/locales/lock/ja.json +6 -3
  612. package/locales/lock/ko.json +6 -3
  613. package/locales/lock/mr.json +6 -3
  614. package/locales/lock/ms.json +6 -3
  615. package/locales/lock/nl.json +6 -3
  616. package/locales/lock/pl.json +6 -3
  617. package/locales/lock/pt.json +6 -3
  618. package/locales/lock/ro.json +6 -3
  619. package/locales/lock/ru.json +6 -3
  620. package/locales/lock/sk.json +6 -3
  621. package/locales/lock/sv.json +6 -3
  622. package/locales/lock/sw.json +6 -3
  623. package/locales/lock/ta.json +6 -3
  624. package/locales/lock/te.json +6 -3
  625. package/locales/lock/th.json +6 -3
  626. package/locales/lock/tl.json +6 -3
  627. package/locales/lock/tr.json +6 -3
  628. package/locales/lock/uk.json +6 -3
  629. package/locales/lock/ur.json +6 -3
  630. package/locales/lock/vi.json +6 -3
  631. package/locales/lock/yo.json +6 -3
  632. package/locales/lock/zh-Hans.json +6 -3
  633. package/locales/lock/zh-Hant.json +6 -3
  634. package/locales/look/am.json +5 -0
  635. package/locales/look/ar.json +5 -0
  636. package/locales/look/bg.json +5 -0
  637. package/locales/look/bn.json +5 -0
  638. package/locales/look/br.json +5 -0
  639. package/locales/look/co.json +5 -0
  640. package/locales/look/cs.json +5 -0
  641. package/locales/look/da.json +5 -0
  642. package/locales/look/de.json +5 -0
  643. package/locales/look/el.json +5 -0
  644. package/locales/look/en.json +5 -0
  645. package/locales/look/es.json +5 -0
  646. package/locales/look/fa.json +5 -0
  647. package/locales/look/fi.json +5 -0
  648. package/locales/look/fr-CA.json +5 -0
  649. package/locales/look/fr.json +5 -0
  650. package/locales/look/ha.json +5 -0
  651. package/locales/look/he.json +5 -0
  652. package/locales/look/hi.json +5 -0
  653. package/locales/look/hr.json +5 -0
  654. package/locales/look/hu.json +5 -0
  655. package/locales/look/id.json +5 -0
  656. package/locales/look/it.json +5 -0
  657. package/locales/look/ja.json +5 -0
  658. package/locales/look/ko.json +5 -0
  659. package/locales/look/mr.json +5 -0
  660. package/locales/look/ms.json +5 -0
  661. package/locales/look/nl.json +5 -0
  662. package/locales/look/pl.json +5 -0
  663. package/locales/look/pt.json +5 -0
  664. package/locales/look/ro.json +5 -0
  665. package/locales/look/ru.json +5 -0
  666. package/locales/look/sk.json +5 -0
  667. package/locales/look/sv.json +5 -0
  668. package/locales/look/sw.json +5 -0
  669. package/locales/look/ta.json +5 -0
  670. package/locales/look/te.json +5 -0
  671. package/locales/look/th.json +5 -0
  672. package/locales/look/tl.json +5 -0
  673. package/locales/look/tr.json +5 -0
  674. package/locales/look/uk.json +5 -0
  675. package/locales/look/ur.json +5 -0
  676. package/locales/look/vi.json +5 -0
  677. package/locales/look/yo.json +5 -0
  678. package/locales/look/zh-Hans.json +5 -0
  679. package/locales/look/zh-Hant.json +5 -0
  680. package/locales/made/am.json +6 -1
  681. package/locales/made/ar.json +6 -1
  682. package/locales/made/bg.json +6 -1
  683. package/locales/made/bn.json +6 -1
  684. package/locales/made/br.json +6 -1
  685. package/locales/made/co.json +6 -1
  686. package/locales/made/cs.json +6 -1
  687. package/locales/made/da.json +6 -1
  688. package/locales/made/de.json +6 -1
  689. package/locales/made/el.json +6 -1
  690. package/locales/made/en.json +6 -1
  691. package/locales/made/es.json +6 -1
  692. package/locales/made/fa.json +6 -1
  693. package/locales/made/fi.json +6 -1
  694. package/locales/made/fr-CA.json +6 -1
  695. package/locales/made/fr.json +6 -1
  696. package/locales/made/ha.json +6 -1
  697. package/locales/made/he.json +6 -1
  698. package/locales/made/hi.json +6 -1
  699. package/locales/made/hr.json +6 -1
  700. package/locales/made/hu.json +6 -1
  701. package/locales/made/id.json +6 -1
  702. package/locales/made/it.json +6 -1
  703. package/locales/made/ja.json +6 -1
  704. package/locales/made/ko.json +6 -1
  705. package/locales/made/mr.json +6 -1
  706. package/locales/made/ms.json +6 -1
  707. package/locales/made/nl.json +6 -1
  708. package/locales/made/pl.json +6 -1
  709. package/locales/made/pt.json +6 -1
  710. package/locales/made/ro.json +6 -1
  711. package/locales/made/ru.json +6 -1
  712. package/locales/made/sk.json +6 -1
  713. package/locales/made/sv.json +6 -1
  714. package/locales/made/sw.json +6 -1
  715. package/locales/made/ta.json +6 -1
  716. package/locales/made/te.json +6 -1
  717. package/locales/made/th.json +6 -1
  718. package/locales/made/tl.json +6 -1
  719. package/locales/made/tr.json +6 -1
  720. package/locales/made/uk.json +6 -1
  721. package/locales/made/ur.json +6 -1
  722. package/locales/made/vi.json +6 -1
  723. package/locales/made/yo.json +6 -1
  724. package/locales/made/zh-Hans.json +6 -1
  725. package/locales/made/zh-Hant.json +6 -1
  726. package/locales/mr.json +19 -3
  727. package/locales/ms.json +18 -3
  728. package/locales/nl.json +19 -3
  729. package/locales/out/am.json +13 -0
  730. package/locales/out/ar.json +13 -0
  731. package/locales/out/bg.json +13 -0
  732. package/locales/out/bn.json +13 -0
  733. package/locales/out/br.json +13 -0
  734. package/locales/out/co.json +13 -0
  735. package/locales/out/cs.json +13 -0
  736. package/locales/out/da.json +13 -0
  737. package/locales/out/de.json +13 -0
  738. package/locales/out/el.json +13 -0
  739. package/locales/out/en.json +13 -0
  740. package/locales/out/es.json +13 -0
  741. package/locales/out/fa.json +13 -0
  742. package/locales/out/fi.json +13 -0
  743. package/locales/out/fr-CA.json +13 -0
  744. package/locales/out/fr.json +13 -0
  745. package/locales/out/ha.json +13 -0
  746. package/locales/out/he.json +13 -0
  747. package/locales/out/hi.json +13 -0
  748. package/locales/out/hr.json +13 -0
  749. package/locales/out/hu.json +13 -0
  750. package/locales/out/id.json +13 -0
  751. package/locales/out/it.json +13 -0
  752. package/locales/out/ja.json +13 -0
  753. package/locales/out/ko.json +13 -0
  754. package/locales/out/mr.json +13 -0
  755. package/locales/out/ms.json +13 -0
  756. package/locales/out/nl.json +13 -0
  757. package/locales/out/pl.json +13 -0
  758. package/locales/out/pt.json +13 -0
  759. package/locales/out/ro.json +13 -0
  760. package/locales/out/ru.json +13 -0
  761. package/locales/out/sk.json +13 -0
  762. package/locales/out/sv.json +13 -0
  763. package/locales/out/sw.json +13 -0
  764. package/locales/out/ta.json +13 -0
  765. package/locales/out/te.json +13 -0
  766. package/locales/out/th.json +13 -0
  767. package/locales/out/tl.json +13 -0
  768. package/locales/out/tr.json +13 -0
  769. package/locales/out/uk.json +13 -0
  770. package/locales/out/ur.json +13 -0
  771. package/locales/out/vi.json +13 -0
  772. package/locales/out/yo.json +13 -0
  773. package/locales/out/zh-Hans.json +13 -0
  774. package/locales/out/zh-Hant.json +13 -0
  775. package/locales/pl.json +21 -3
  776. package/locales/profiles/am.json +5 -0
  777. package/locales/profiles/ar.json +5 -0
  778. package/locales/profiles/bg.json +5 -0
  779. package/locales/profiles/bn.json +5 -0
  780. package/locales/profiles/br.json +5 -0
  781. package/locales/profiles/co.json +5 -0
  782. package/locales/profiles/cs.json +5 -0
  783. package/locales/profiles/da.json +5 -0
  784. package/locales/profiles/de.json +5 -0
  785. package/locales/profiles/el.json +5 -0
  786. package/locales/profiles/en.json +5 -0
  787. package/locales/profiles/es.json +5 -0
  788. package/locales/profiles/fa.json +5 -0
  789. package/locales/profiles/fi.json +5 -0
  790. package/locales/profiles/fr-CA.json +5 -0
  791. package/locales/profiles/fr.json +5 -0
  792. package/locales/profiles/ha.json +5 -0
  793. package/locales/profiles/he.json +5 -0
  794. package/locales/profiles/hi.json +5 -0
  795. package/locales/profiles/hr.json +5 -0
  796. package/locales/profiles/hu.json +5 -0
  797. package/locales/profiles/id.json +5 -0
  798. package/locales/profiles/it.json +5 -0
  799. package/locales/profiles/ja.json +5 -0
  800. package/locales/profiles/ko.json +5 -0
  801. package/locales/profiles/mr.json +5 -0
  802. package/locales/profiles/ms.json +5 -0
  803. package/locales/profiles/nl.json +5 -0
  804. package/locales/profiles/pl.json +5 -0
  805. package/locales/profiles/pt.json +5 -0
  806. package/locales/profiles/ro.json +5 -0
  807. package/locales/profiles/ru.json +5 -0
  808. package/locales/profiles/sk.json +5 -0
  809. package/locales/profiles/sv.json +5 -0
  810. package/locales/profiles/sw.json +5 -0
  811. package/locales/profiles/ta.json +5 -0
  812. package/locales/profiles/te.json +5 -0
  813. package/locales/profiles/th.json +5 -0
  814. package/locales/profiles/tl.json +5 -0
  815. package/locales/profiles/tr.json +5 -0
  816. package/locales/profiles/uk.json +5 -0
  817. package/locales/profiles/ur.json +5 -0
  818. package/locales/profiles/vi.json +5 -0
  819. package/locales/profiles/yo.json +5 -0
  820. package/locales/profiles/zh-Hans.json +5 -0
  821. package/locales/profiles/zh-Hant.json +5 -0
  822. package/locales/pt.json +20 -3
  823. package/locales/ro.json +20 -3
  824. package/locales/routines/am.json +9 -0
  825. package/locales/routines/ar.json +9 -0
  826. package/locales/routines/bg.json +9 -0
  827. package/locales/routines/bn.json +9 -0
  828. package/locales/routines/br.json +9 -0
  829. package/locales/routines/co.json +9 -0
  830. package/locales/routines/cs.json +9 -0
  831. package/locales/routines/da.json +9 -0
  832. package/locales/routines/de.json +9 -0
  833. package/locales/routines/el.json +9 -0
  834. package/locales/routines/en.json +9 -0
  835. package/locales/routines/es.json +9 -0
  836. package/locales/routines/fa.json +9 -0
  837. package/locales/routines/fi.json +9 -0
  838. package/locales/routines/fr-CA.json +9 -0
  839. package/locales/routines/fr.json +9 -0
  840. package/locales/routines/ha.json +9 -0
  841. package/locales/routines/he.json +9 -0
  842. package/locales/routines/hi.json +9 -0
  843. package/locales/routines/hr.json +9 -0
  844. package/locales/routines/hu.json +9 -0
  845. package/locales/routines/id.json +9 -0
  846. package/locales/routines/it.json +9 -0
  847. package/locales/routines/ja.json +9 -0
  848. package/locales/routines/ko.json +9 -0
  849. package/locales/routines/mr.json +9 -0
  850. package/locales/routines/ms.json +9 -0
  851. package/locales/routines/nl.json +9 -0
  852. package/locales/routines/pl.json +9 -0
  853. package/locales/routines/pt.json +9 -0
  854. package/locales/routines/ro.json +9 -0
  855. package/locales/routines/ru.json +9 -0
  856. package/locales/routines/sk.json +9 -0
  857. package/locales/routines/sv.json +9 -0
  858. package/locales/routines/sw.json +9 -0
  859. package/locales/routines/ta.json +9 -0
  860. package/locales/routines/te.json +9 -0
  861. package/locales/routines/th.json +9 -0
  862. package/locales/routines/tl.json +9 -0
  863. package/locales/routines/tr.json +9 -0
  864. package/locales/routines/uk.json +9 -0
  865. package/locales/routines/ur.json +9 -0
  866. package/locales/routines/vi.json +9 -0
  867. package/locales/routines/yo.json +9 -0
  868. package/locales/routines/zh-Hans.json +9 -0
  869. package/locales/routines/zh-Hant.json +9 -0
  870. package/locales/ru.json +21 -3
  871. package/locales/scores/am.json +5 -1
  872. package/locales/scores/ar.json +5 -1
  873. package/locales/scores/bg.json +5 -1
  874. package/locales/scores/bn.json +5 -1
  875. package/locales/scores/br.json +5 -1
  876. package/locales/scores/co.json +5 -1
  877. package/locales/scores/cs.json +5 -1
  878. package/locales/scores/da.json +5 -1
  879. package/locales/scores/de.json +5 -1
  880. package/locales/scores/el.json +5 -1
  881. package/locales/scores/en.json +5 -1
  882. package/locales/scores/es.json +5 -1
  883. package/locales/scores/fa.json +5 -1
  884. package/locales/scores/fi.json +5 -1
  885. package/locales/scores/fr-CA.json +5 -1
  886. package/locales/scores/fr.json +5 -1
  887. package/locales/scores/ha.json +5 -1
  888. package/locales/scores/he.json +5 -1
  889. package/locales/scores/hi.json +5 -1
  890. package/locales/scores/hr.json +5 -1
  891. package/locales/scores/hu.json +5 -1
  892. package/locales/scores/id.json +5 -1
  893. package/locales/scores/it.json +5 -1
  894. package/locales/scores/ja.json +5 -1
  895. package/locales/scores/ko.json +5 -1
  896. package/locales/scores/mr.json +5 -1
  897. package/locales/scores/ms.json +5 -1
  898. package/locales/scores/nl.json +5 -1
  899. package/locales/scores/pl.json +5 -1
  900. package/locales/scores/pt.json +5 -1
  901. package/locales/scores/ro.json +5 -1
  902. package/locales/scores/ru.json +5 -1
  903. package/locales/scores/sk.json +5 -1
  904. package/locales/scores/sv.json +5 -1
  905. package/locales/scores/sw.json +5 -1
  906. package/locales/scores/ta.json +5 -1
  907. package/locales/scores/te.json +5 -1
  908. package/locales/scores/th.json +5 -1
  909. package/locales/scores/tl.json +5 -1
  910. package/locales/scores/tr.json +5 -1
  911. package/locales/scores/uk.json +5 -1
  912. package/locales/scores/ur.json +5 -1
  913. package/locales/scores/vi.json +5 -1
  914. package/locales/scores/yo.json +5 -1
  915. package/locales/scores/zh-Hans.json +5 -1
  916. package/locales/scores/zh-Hant.json +5 -1
  917. package/locales/search/am.json +10 -1
  918. package/locales/search/ar.json +10 -1
  919. package/locales/search/bg.json +10 -1
  920. package/locales/search/bn.json +10 -1
  921. package/locales/search/br.json +10 -1
  922. package/locales/search/co.json +10 -1
  923. package/locales/search/cs.json +10 -1
  924. package/locales/search/da.json +10 -1
  925. package/locales/search/de.json +10 -1
  926. package/locales/search/el.json +10 -1
  927. package/locales/search/en.json +10 -1
  928. package/locales/search/es.json +10 -1
  929. package/locales/search/fa.json +10 -1
  930. package/locales/search/fi.json +10 -1
  931. package/locales/search/fr-CA.json +10 -1
  932. package/locales/search/fr.json +10 -1
  933. package/locales/search/ha.json +10 -1
  934. package/locales/search/he.json +10 -1
  935. package/locales/search/hi.json +10 -1
  936. package/locales/search/hr.json +10 -1
  937. package/locales/search/hu.json +10 -1
  938. package/locales/search/id.json +10 -1
  939. package/locales/search/it.json +10 -1
  940. package/locales/search/ja.json +10 -1
  941. package/locales/search/ko.json +10 -1
  942. package/locales/search/mr.json +10 -1
  943. package/locales/search/ms.json +10 -1
  944. package/locales/search/nl.json +10 -1
  945. package/locales/search/pl.json +10 -1
  946. package/locales/search/pt.json +10 -1
  947. package/locales/search/ro.json +10 -1
  948. package/locales/search/ru.json +10 -1
  949. package/locales/search/sk.json +10 -1
  950. package/locales/search/sv.json +10 -1
  951. package/locales/search/sw.json +10 -1
  952. package/locales/search/ta.json +10 -1
  953. package/locales/search/te.json +10 -1
  954. package/locales/search/th.json +10 -1
  955. package/locales/search/tl.json +10 -1
  956. package/locales/search/tr.json +10 -1
  957. package/locales/search/uk.json +10 -1
  958. package/locales/search/ur.json +10 -1
  959. package/locales/search/vi.json +10 -1
  960. package/locales/search/yo.json +10 -1
  961. package/locales/search/zh-Hans.json +10 -1
  962. package/locales/search/zh-Hant.json +10 -1
  963. package/locales/signin/am.json +3 -1
  964. package/locales/signin/ar.json +3 -1
  965. package/locales/signin/bg.json +3 -1
  966. package/locales/signin/bn.json +3 -1
  967. package/locales/signin/br.json +3 -1
  968. package/locales/signin/co.json +3 -1
  969. package/locales/signin/cs.json +3 -1
  970. package/locales/signin/da.json +3 -1
  971. package/locales/signin/de.json +3 -1
  972. package/locales/signin/el.json +3 -1
  973. package/locales/signin/en.json +3 -1
  974. package/locales/signin/es.json +3 -1
  975. package/locales/signin/fa.json +3 -1
  976. package/locales/signin/fi.json +3 -1
  977. package/locales/signin/fr-CA.json +3 -1
  978. package/locales/signin/fr.json +3 -1
  979. package/locales/signin/ha.json +3 -1
  980. package/locales/signin/he.json +3 -1
  981. package/locales/signin/hi.json +3 -1
  982. package/locales/signin/hr.json +3 -1
  983. package/locales/signin/hu.json +3 -1
  984. package/locales/signin/id.json +3 -1
  985. package/locales/signin/it.json +3 -1
  986. package/locales/signin/ja.json +3 -1
  987. package/locales/signin/ko.json +3 -1
  988. package/locales/signin/mr.json +3 -1
  989. package/locales/signin/ms.json +3 -1
  990. package/locales/signin/nl.json +3 -1
  991. package/locales/signin/pl.json +3 -1
  992. package/locales/signin/pt.json +3 -1
  993. package/locales/signin/ro.json +3 -1
  994. package/locales/signin/ru.json +3 -1
  995. package/locales/signin/sk.json +3 -1
  996. package/locales/signin/sv.json +3 -1
  997. package/locales/signin/sw.json +3 -1
  998. package/locales/signin/ta.json +3 -1
  999. package/locales/signin/te.json +3 -1
  1000. package/locales/signin/th.json +3 -1
  1001. package/locales/signin/tl.json +3 -1
  1002. package/locales/signin/tr.json +3 -1
  1003. package/locales/signin/uk.json +3 -1
  1004. package/locales/signin/ur.json +3 -1
  1005. package/locales/signin/vi.json +3 -1
  1006. package/locales/signin/yo.json +3 -1
  1007. package/locales/signin/zh-Hans.json +3 -1
  1008. package/locales/signin/zh-Hant.json +3 -1
  1009. package/locales/sk.json +21 -3
  1010. package/locales/slides/am.json +16 -11
  1011. package/locales/slides/ar.json +16 -11
  1012. package/locales/slides/bg.json +16 -11
  1013. package/locales/slides/bn.json +16 -11
  1014. package/locales/slides/br.json +16 -11
  1015. package/locales/slides/co.json +16 -11
  1016. package/locales/slides/cs.json +16 -11
  1017. package/locales/slides/da.json +16 -11
  1018. package/locales/slides/de.json +16 -11
  1019. package/locales/slides/el.json +16 -11
  1020. package/locales/slides/en.json +16 -11
  1021. package/locales/slides/es.json +16 -11
  1022. package/locales/slides/fa.json +16 -11
  1023. package/locales/slides/fi.json +16 -11
  1024. package/locales/slides/fr-CA.json +16 -11
  1025. package/locales/slides/fr.json +16 -11
  1026. package/locales/slides/ha.json +16 -11
  1027. package/locales/slides/he.json +16 -11
  1028. package/locales/slides/hi.json +16 -11
  1029. package/locales/slides/hr.json +16 -11
  1030. package/locales/slides/hu.json +16 -11
  1031. package/locales/slides/id.json +16 -11
  1032. package/locales/slides/it.json +16 -11
  1033. package/locales/slides/ja.json +16 -11
  1034. package/locales/slides/ko.json +16 -11
  1035. package/locales/slides/mr.json +16 -11
  1036. package/locales/slides/ms.json +16 -11
  1037. package/locales/slides/nl.json +16 -11
  1038. package/locales/slides/pl.json +16 -11
  1039. package/locales/slides/pt.json +16 -11
  1040. package/locales/slides/ro.json +16 -11
  1041. package/locales/slides/ru.json +16 -11
  1042. package/locales/slides/sk.json +16 -11
  1043. package/locales/slides/sv.json +16 -11
  1044. package/locales/slides/sw.json +16 -11
  1045. package/locales/slides/ta.json +16 -11
  1046. package/locales/slides/te.json +16 -11
  1047. package/locales/slides/th.json +16 -11
  1048. package/locales/slides/tl.json +16 -11
  1049. package/locales/slides/tr.json +16 -11
  1050. package/locales/slides/uk.json +16 -11
  1051. package/locales/slides/ur.json +16 -11
  1052. package/locales/slides/vi.json +16 -11
  1053. package/locales/slides/yo.json +16 -11
  1054. package/locales/slides/zh-Hans.json +16 -11
  1055. package/locales/slides/zh-Hant.json +16 -11
  1056. package/locales/sv.json +19 -3
  1057. package/locales/sw.json +19 -3
  1058. package/locales/sync/am.json +1 -0
  1059. package/locales/sync/ar.json +1 -0
  1060. package/locales/sync/bg.json +1 -0
  1061. package/locales/sync/bn.json +1 -0
  1062. package/locales/sync/br.json +1 -0
  1063. package/locales/sync/co.json +1 -0
  1064. package/locales/sync/cs.json +1 -0
  1065. package/locales/sync/da.json +1 -0
  1066. package/locales/sync/de.json +1 -0
  1067. package/locales/sync/el.json +1 -0
  1068. package/locales/sync/en.json +1 -0
  1069. package/locales/sync/es.json +1 -0
  1070. package/locales/sync/fa.json +1 -0
  1071. package/locales/sync/fi.json +1 -0
  1072. package/locales/sync/fr-CA.json +1 -0
  1073. package/locales/sync/fr.json +1 -0
  1074. package/locales/sync/ha.json +1 -0
  1075. package/locales/sync/he.json +1 -0
  1076. package/locales/sync/hi.json +1 -0
  1077. package/locales/sync/hr.json +1 -0
  1078. package/locales/sync/hu.json +1 -0
  1079. package/locales/sync/id.json +1 -0
  1080. package/locales/sync/it.json +1 -0
  1081. package/locales/sync/ja.json +1 -0
  1082. package/locales/sync/ko.json +1 -0
  1083. package/locales/sync/mr.json +1 -0
  1084. package/locales/sync/ms.json +1 -0
  1085. package/locales/sync/nl.json +1 -0
  1086. package/locales/sync/pl.json +1 -0
  1087. package/locales/sync/pt.json +1 -0
  1088. package/locales/sync/ro.json +1 -0
  1089. package/locales/sync/ru.json +1 -0
  1090. package/locales/sync/sk.json +1 -0
  1091. package/locales/sync/sv.json +1 -0
  1092. package/locales/sync/sw.json +1 -0
  1093. package/locales/sync/ta.json +1 -0
  1094. package/locales/sync/te.json +1 -0
  1095. package/locales/sync/th.json +1 -0
  1096. package/locales/sync/tl.json +1 -0
  1097. package/locales/sync/tr.json +1 -0
  1098. package/locales/sync/uk.json +1 -0
  1099. package/locales/sync/ur.json +1 -0
  1100. package/locales/sync/vi.json +1 -0
  1101. package/locales/sync/yo.json +1 -0
  1102. package/locales/sync/zh-Hans.json +1 -0
  1103. package/locales/sync/zh-Hant.json +1 -0
  1104. package/locales/ta.json +19 -3
  1105. package/locales/tables/am.json +27 -2
  1106. package/locales/tables/ar.json +35 -2
  1107. package/locales/tables/bg.json +27 -2
  1108. package/locales/tables/bn.json +27 -2
  1109. package/locales/tables/br.json +33 -2
  1110. package/locales/tables/co.json +29 -2
  1111. package/locales/tables/cs.json +33 -4
  1112. package/locales/tables/da.json +27 -2
  1113. package/locales/tables/de.json +27 -2
  1114. package/locales/tables/el.json +27 -2
  1115. package/locales/tables/en.json +27 -2
  1116. package/locales/tables/es.json +29 -2
  1117. package/locales/tables/fa.json +27 -2
  1118. package/locales/tables/fi.json +27 -2
  1119. package/locales/tables/fr-CA.json +29 -2
  1120. package/locales/tables/fr.json +29 -2
  1121. package/locales/tables/ha.json +27 -2
  1122. package/locales/tables/he.json +31 -4
  1123. package/locales/tables/hi.json +27 -2
  1124. package/locales/tables/hr.json +29 -2
  1125. package/locales/tables/hu.json +27 -2
  1126. package/locales/tables/id.json +25 -2
  1127. package/locales/tables/it.json +29 -2
  1128. package/locales/tables/ja.json +25 -2
  1129. package/locales/tables/ko.json +25 -2
  1130. package/locales/tables/mr.json +27 -2
  1131. package/locales/tables/ms.json +25 -2
  1132. package/locales/tables/nl.json +27 -2
  1133. package/locales/tables/pl.json +31 -2
  1134. package/locales/tables/pt.json +29 -2
  1135. package/locales/tables/ro.json +29 -2
  1136. package/locales/tables/ru.json +31 -2
  1137. package/locales/tables/sk.json +33 -4
  1138. package/locales/tables/sv.json +29 -4
  1139. package/locales/tables/sw.json +27 -2
  1140. package/locales/tables/ta.json +27 -2
  1141. package/locales/tables/te.json +29 -4
  1142. package/locales/tables/th.json +25 -2
  1143. package/locales/tables/tl.json +29 -4
  1144. package/locales/tables/tr.json +27 -2
  1145. package/locales/tables/uk.json +31 -2
  1146. package/locales/tables/ur.json +27 -2
  1147. package/locales/tables/vi.json +27 -4
  1148. package/locales/tables/yo.json +27 -4
  1149. package/locales/tables/zh-Hans.json +27 -4
  1150. package/locales/tables/zh-Hant.json +27 -4
  1151. package/locales/te.json +19 -3
  1152. package/locales/th.json +18 -3
  1153. package/locales/tl.json +19 -3
  1154. package/locales/tr.json +19 -3
  1155. package/locales/uk.json +21 -3
  1156. package/locales/ur.json +19 -3
  1157. package/locales/vi.json +18 -3
  1158. package/locales/yo.json +18 -3
  1159. package/locales/zh-Hans.json +18 -3
  1160. package/locales/zh-Hant.json +18 -3
  1161. package/package.json +5 -1
  1162. package/ui/caps.js +9 -4
  1163. package/ui/csp.js +1 -1
  1164. package/ui/export.js +10 -4
  1165. package/ui/icons.js +2 -1
  1166. package/ui/kit.js +44 -10
  1167. package/ui/language.js +172 -0
  1168. package/ui/looks/classic.css +3 -2
  1169. package/ui/looks/human.css +7 -9
  1170. package/ui/looks/mail.css +1 -1
  1171. package/ui/looks/minimal.css +1 -1
  1172. package/ui/looks.js +1 -1
  1173. package/ui/markdown.js +17 -6
  1174. package/ui/model.js +6 -0
  1175. package/ui/reader-state.js +1 -1
  1176. package/ui/review.js +1 -1
  1177. package/ui/save.js +16 -0
  1178. package/ui/seal.js +5 -4
  1179. package/ui/sheet.js +21 -2
  1180. package/ui/style.css +54 -32
  1181. package/ui/touches.js +4 -1
  1182. package/ui/view.css +1 -1
  1183. package/ui/view.js +10 -8
  1184. package/vendor/LICENSES/babylonjs-core.txt +2 -0
  1185. package/vendor/LICENSES/eventemitter3.txt +21 -0
  1186. package/vendor/LICENSES/maplibre-gl.txt +1 -1
  1187. package/vendor/LICENSES/phaser.txt +20 -0
  1188. package/vendor/LICENSES/zzfx.txt +21 -0
  1189. package/vendor/abcjs/abcjs.mjs +2 -2
  1190. package/vendor/babylon/babylon.mjs +8122 -0
  1191. package/vendor/deck/deck.css +2 -2
  1192. package/vendor/deck/deck.mjs +37 -37
  1193. package/vendor/deck/pptx.mjs +1 -1
  1194. package/vendor/maplibre/maplibre-gl-worker.js +3 -3
  1195. package/vendor/maplibre/maplibre-gl.css +1 -1
  1196. package/vendor/maplibre/maplibre-gl.mjs +37 -37
  1197. package/vendor/marked.esm.js +40 -38
  1198. package/vendor/ooxml/abort-JztSoyw2.js +8 -0
  1199. package/vendor/ooxml/{hyperlink-Cxzhet30.js → bounded-raw-part-cache-B8t03tSP.js} +4460 -7080
  1200. package/vendor/ooxml/bundled-asset-url-BMJ8vNHP.js +13 -0
  1201. package/vendor/ooxml/canvas-viewer-mechanics-DI38gHNV.js +653 -0
  1202. package/vendor/ooxml/cfb-guard-BIaHdonq.js +516 -0
  1203. package/vendor/ooxml/{chunk-DmhlhrBa.js → chunk-D5OxutzX.js} +0 -2
  1204. package/vendor/ooxml/comment-overlay-controller-Crm5Syhx.js +974 -0
  1205. package/vendor/ooxml/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-BfEPgl5r.js} +5 -7
  1206. package/vendor/ooxml/comment-ui-runtime-BtP_TpvT.js +2 -0
  1207. package/vendor/ooxml/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-hfewTmVJ.js} +5 -7
  1208. package/vendor/ooxml/delimited-text-worker-host-RwvuSsP2.js +21 -0
  1209. package/vendor/ooxml/document-model-source-BUTSwkyP.js +247 -0
  1210. package/vendor/ooxml/document-pull-client-C_D779tO.js +36230 -0
  1211. package/vendor/ooxml/docx-BfLZeiwa.js +3509 -0
  1212. package/vendor/ooxml/docx.mjs +7 -7
  1213. package/vendor/ooxml/docx_parser_bg.wasm +0 -0
  1214. package/vendor/ooxml/drawingml-shape-BcXkRayC.js +306 -0
  1215. package/vendor/ooxml/duotone-BI7CoghW.js +122 -0
  1216. package/vendor/ooxml/emf-DgUBx9BU.js +1788 -0
  1217. package/vendor/ooxml/font-preload-demand-B6HPFxDp.js +2052 -0
  1218. package/vendor/ooxml/graph.json +1 -1
  1219. package/vendor/ooxml/grid-geometry-CqTDvpDr.js +379 -0
  1220. package/vendor/ooxml/host-layout-Cz_lCuTZ.js +55 -0
  1221. package/vendor/ooxml/line-distribute-DR9Qwd3u.js +2783 -0
  1222. package/vendor/ooxml/{mathjax-DoyWZbSp.js → mathjax-DvwccQ8e.js} +0 -2
  1223. package/vendor/ooxml/model-source-COXegBNA.js +177 -0
  1224. package/vendor/ooxml/{pixel-budget-9P63Bsk5.js → pixel-budget-DI82Hn3R.js} +13 -12
  1225. package/vendor/ooxml/plot-area-frame-D3JtHvov.js +41645 -0
  1226. package/vendor/ooxml/pptx-CfCiVlNB.js +2888 -0
  1227. package/vendor/ooxml/pptx.mjs +8 -7
  1228. package/vendor/ooxml/pptx_parser_bg.wasm +0 -0
  1229. package/vendor/ooxml/presentation-model-source-DL6duh5l.js +75 -0
  1230. package/vendor/ooxml/raster-target-Ca3tyA0L.js +40 -0
  1231. package/vendor/ooxml/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-B06YO2zk.js} +0 -4
  1232. package/vendor/ooxml/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-Ee9Y6vPg.js} +0 -2
  1233. package/vendor/ooxml/renderer-IFuBkPvF.js +5197 -0
  1234. package/vendor/ooxml/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-BuTx2FWJ.js} +0 -2
  1235. package/vendor/ooxml/renderer-xdugdcMd.js +5769 -0
  1236. package/vendor/ooxml/resource-measurement-D2bu0Qfx.js +756 -0
  1237. package/vendor/ooxml/slide-pull-client-BUuJQQVE.js +6431 -0
  1238. package/vendor/ooxml/three-d-ByHGsYrX.js +868 -0
  1239. package/vendor/ooxml/tiff-contract-DEd8CGuz.js +48 -0
  1240. package/vendor/ooxml/{visible-index-BgiHEc1z.js → visible-index-vN-4BNn7.js} +0 -2
  1241. package/vendor/ooxml/workbook-model-source-DBfVsWj7.js +92 -0
  1242. package/vendor/ooxml/worker-source-C29EQNUj.js +18 -0
  1243. package/vendor/ooxml/worker-source-D3NwPe6l.js +18 -0
  1244. package/vendor/ooxml/worker-source-ZQE9C1j6.js +18 -0
  1245. package/vendor/ooxml/worksheet-pull-client-Du0MuIro.js +565 -0
  1246. package/vendor/ooxml/xlsx-CCMRAxPB.js +5812 -0
  1247. package/vendor/ooxml/xlsx.mjs +8 -7
  1248. package/vendor/ooxml/xlsx_parser_bg.wasm +0 -0
  1249. package/vendor/pele/chunks/2CHDFZHC.js +1 -0
  1250. package/vendor/pele/chunks/{GAP5KXLD.js → 2S3JPEOY.js} +1 -1
  1251. package/vendor/pele/chunks/2U463FD2.js +11 -0
  1252. package/vendor/pele/chunks/3OKCTCH7.js +1 -0
  1253. package/vendor/pele/chunks/42UK3TL6.js +8 -0
  1254. package/vendor/pele/chunks/43YPWK3Q.js +1 -0
  1255. package/vendor/pele/chunks/45MVAN6X.js +1 -0
  1256. package/vendor/pele/chunks/46GJKBLZ.js +1 -0
  1257. package/vendor/pele/chunks/4WR52FRP.js +4 -0
  1258. package/vendor/pele/chunks/63WH7YNF.js +1 -0
  1259. package/vendor/pele/chunks/{2TH3V34D.js → 673H7YBG.js} +1 -1
  1260. package/vendor/pele/chunks/6DDU7VKX.js +1 -0
  1261. package/vendor/pele/chunks/{3MKGV5HX.js → 6Y6FML25.js} +1 -1
  1262. package/vendor/pele/chunks/{4AG6A4TK.js → 7HQPULDG.js} +1 -1
  1263. package/vendor/pele/chunks/7N3VAIG2.js +2 -0
  1264. package/vendor/pele/chunks/{QFOMM5LR.js → 7NY54ILO.js} +1 -1
  1265. package/vendor/pele/chunks/{VHJMZXCQ.js → BJNHMTN6.js} +1 -1
  1266. package/vendor/pele/chunks/{6PEWY3TN.js → BK7N5KMP.js} +1 -1
  1267. package/vendor/pele/chunks/CLQLV5VT.js +1 -0
  1268. package/vendor/pele/chunks/CUSPXG5M.js +1 -0
  1269. package/vendor/pele/chunks/D3L7O4X2.js +1 -0
  1270. package/vendor/pele/chunks/{D4V2MWCI.js → D5TW5CPZ.js} +1 -1
  1271. package/vendor/pele/chunks/DDVFZY3L.js +7 -0
  1272. package/vendor/pele/chunks/{3S2YGJBL.js → DO6ND2WD.js} +5 -5
  1273. package/vendor/pele/chunks/EGADTWYV.js +1 -0
  1274. package/vendor/pele/chunks/EI4VGK5C.js +4 -0
  1275. package/vendor/pele/chunks/EOJSJZXM.js +1 -0
  1276. package/vendor/pele/chunks/F4O23KYR.js +5 -0
  1277. package/vendor/pele/chunks/G2OEIG6X.js +1 -0
  1278. package/vendor/pele/chunks/GER2CN75.js +2 -0
  1279. package/vendor/pele/chunks/{RGVCULFG.js → GP5YUCAR.js} +1 -1
  1280. package/vendor/pele/chunks/GXJ2T77W.js +1 -0
  1281. package/vendor/pele/chunks/HX3UMAK7.js +1 -0
  1282. package/vendor/pele/chunks/IU7WZTP6.js +4 -0
  1283. package/vendor/pele/chunks/J3JF2HV4.js +12 -0
  1284. package/vendor/pele/chunks/J5J2NR2G.js +1 -0
  1285. package/vendor/pele/chunks/JRCWTJEL.js +1 -0
  1286. package/vendor/pele/chunks/{M7II5KMO.js → K2ZHGJKH.js} +1 -1
  1287. package/vendor/pele/chunks/{E3FWOBN4.js → KHUP5TOH.js} +3 -3
  1288. package/vendor/pele/chunks/L74FQTH5.js +1 -0
  1289. package/vendor/pele/chunks/LAV4ZXOS.js +1 -0
  1290. package/vendor/pele/chunks/LBIZYCRR.js +1 -0
  1291. package/vendor/pele/chunks/LFFXNLRS.js +1 -0
  1292. package/vendor/pele/chunks/LJ44NU43.js +3 -0
  1293. package/vendor/pele/chunks/LLLWOAQD.js +1 -0
  1294. package/vendor/pele/chunks/LTY5LMQH.js +5 -0
  1295. package/vendor/pele/chunks/LTYQZ5U5.js +1 -0
  1296. package/vendor/pele/chunks/MJBOF5Q6.js +2 -0
  1297. package/vendor/pele/chunks/NDSCUZ25.js +1 -0
  1298. package/vendor/pele/chunks/NMN3IKWL.js +1 -0
  1299. package/vendor/pele/chunks/NMUA3R2D.js +1 -0
  1300. package/vendor/pele/chunks/NY5A6PPW.js +1 -0
  1301. package/vendor/pele/chunks/O3ACPFEJ.js +8 -0
  1302. package/vendor/pele/chunks/{A6VFOGAO.js → O4MQT6AV.js} +1 -1
  1303. package/vendor/pele/chunks/{DUZNPW7S.js → OHJ2EJXK.js} +1 -1
  1304. package/vendor/pele/chunks/OU2GIT2H.js +1 -0
  1305. package/vendor/pele/chunks/{E65FQMJL.js → PDMLSE6I.js} +1 -1
  1306. package/vendor/pele/chunks/PJ7X32S5.js +1 -0
  1307. package/vendor/pele/chunks/RLLQ44NJ.js +1 -0
  1308. package/vendor/pele/chunks/S6DWMCK5.js +1 -0
  1309. package/vendor/pele/chunks/STIOTUT7.js +1 -0
  1310. package/vendor/pele/chunks/{UO52YEYL.js → SXSLPWUD.js} +1 -1
  1311. package/vendor/pele/chunks/TBJXKAT4.js +3 -0
  1312. package/vendor/pele/chunks/TIVX74RS.js +2 -0
  1313. package/vendor/pele/chunks/{KIF544NL.js → TK23BXEA.js} +1 -1
  1314. package/vendor/pele/chunks/{STAXBNH4.js → TR4WJQGX.js} +1 -1
  1315. package/vendor/pele/chunks/UWRPUF3N.js +1 -0
  1316. package/vendor/pele/chunks/VMTWYMKQ.js +2 -0
  1317. package/vendor/pele/chunks/VSWIZJ7B.js +1 -0
  1318. package/vendor/pele/chunks/{STMK7JZH.js → W2WY5CQX.js} +2 -2
  1319. package/vendor/pele/chunks/W77N5H3K.js +2 -0
  1320. package/vendor/pele/chunks/WM7NR6YK.js +1 -0
  1321. package/vendor/pele/chunks/WSTWNLCU.js +4 -0
  1322. package/vendor/pele/chunks/WXKV2YEK.js +1 -0
  1323. package/vendor/pele/chunks/XQ5S3AI3.js +13 -0
  1324. package/vendor/pele/chunks/YNX532HU.js +1 -0
  1325. package/vendor/pele/chunks/{DHKBVIA3.js → YUPSMAUO.js} +1 -1
  1326. package/vendor/pele/chunks/{IHVFDU4A.js → YWXUFHC7.js} +7 -7
  1327. package/vendor/pele/chunks/Z3ZRV7NH.js +2 -0
  1328. package/vendor/pele/chunks/ZFRCZTLK.js +1 -0
  1329. package/vendor/pele/chunks/ZZDR4CN3.js +1 -0
  1330. package/vendor/pele/lazy.js +1 -1
  1331. package/vendor/phaser/phaser.mjs +1 -0
  1332. package/vendor/signals-core.mjs +1 -1
  1333. package/vendor/spessasynth/fflate.mjs +1 -0
  1334. package/vendor/spessasynth/spessasynth.mjs +37033 -15099
  1335. package/vendor/temml/temml.mjs +1 -1
  1336. package/vendor/zzfx/zzfx.mjs +1 -0
  1337. package/ui/acts.js +0 -12
  1338. package/vendor/ooxml/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  1339. package/vendor/ooxml/canvas-viewer-mechanics-DbLz0rYW.js +0 -1384
  1340. package/vendor/ooxml/cjk-fallback-bLI3z70h.js +0 -46
  1341. package/vendor/ooxml/comment-occurrence-C8Y2uoVr.js +0 -6
  1342. package/vendor/ooxml/comment-ui-runtime-BsK8pmUT.js +0 -2
  1343. package/vendor/ooxml/comments-Diid5ujN.js +0 -246
  1344. package/vendor/ooxml/delimited-text-worker-host-BVY-Ecni.js +0 -25
  1345. package/vendor/ooxml/document-pull-client-B9PTM-pL.js +0 -27280
  1346. package/vendor/ooxml/docx-BF9WXrYH.js +0 -3101
  1347. package/vendor/ooxml/dom-interaction-boundary-Cnm8DSBN.js +0 -223
  1348. package/vendor/ooxml/highlight-rect-C5hkRqUr.js +0 -13
  1349. package/vendor/ooxml/line-distribute-D1WNHKz_.js +0 -1023
  1350. package/vendor/ooxml/line-metrics-B60C86uh.js +0 -60
  1351. package/vendor/ooxml/plot-area-frame-DLTYKHNP.js +0 -4354
  1352. package/vendor/ooxml/pptx-DkyYBYoL.js +0 -3063
  1353. package/vendor/ooxml/raster-target-ojDdQizC.js +0 -91
  1354. package/vendor/ooxml/renderer-B4GZb5We.js +0 -6492
  1355. package/vendor/ooxml/resource-measurement-SHQCbkh2.js +0 -150
  1356. package/vendor/ooxml/slide-pull-client-DiPnm240.js +0 -6253
  1357. package/vendor/ooxml/source-key-DIJG8BA0.js +0 -42
  1358. package/vendor/ooxml/three-d-DJBl8g8M.js +0 -1162
  1359. package/vendor/ooxml/transfer-p6iCC2R7.js +0 -6
  1360. package/vendor/ooxml/units-BzZ0gAxs.js +0 -4
  1361. package/vendor/ooxml/worksheet-pull-client-BM8ywvbu.js +0 -458
  1362. package/vendor/ooxml/xlsx-C9NVjgaV.js +0 -8482
  1363. package/vendor/pele/chunks/23I4SOAX.js +0 -1
  1364. package/vendor/pele/chunks/25ITEZ43.js +0 -2
  1365. package/vendor/pele/chunks/26H2HVXD.js +0 -1
  1366. package/vendor/pele/chunks/2IZ5MNOH.js +0 -1
  1367. package/vendor/pele/chunks/2P3CZEXH.js +0 -1
  1368. package/vendor/pele/chunks/3E5HRNYT.js +0 -1
  1369. package/vendor/pele/chunks/3JIRLDUO.js +0 -1
  1370. package/vendor/pele/chunks/5MJ3UKSG.js +0 -1
  1371. package/vendor/pele/chunks/63N73SV4.js +0 -1
  1372. package/vendor/pele/chunks/A255FCTW.js +0 -1
  1373. package/vendor/pele/chunks/AM43MQ64.js +0 -1
  1374. package/vendor/pele/chunks/AOZTNTMC.js +0 -1
  1375. package/vendor/pele/chunks/AQNLM6KG.js +0 -1
  1376. package/vendor/pele/chunks/BNU2RHQB.js +0 -1
  1377. package/vendor/pele/chunks/C5HTQT3I.js +0 -4
  1378. package/vendor/pele/chunks/CPKRWH5G.js +0 -1
  1379. package/vendor/pele/chunks/CPRVZL76.js +0 -11
  1380. package/vendor/pele/chunks/CUVCMPQX.js +0 -1
  1381. package/vendor/pele/chunks/D6K5RLPD.js +0 -5
  1382. package/vendor/pele/chunks/EENBF6R3.js +0 -5
  1383. package/vendor/pele/chunks/G3OATVW2.js +0 -1
  1384. package/vendor/pele/chunks/GFBBR3DD.js +0 -13
  1385. package/vendor/pele/chunks/IV52FOAS.js +0 -1
  1386. package/vendor/pele/chunks/JTJEEBDN.js +0 -1
  1387. package/vendor/pele/chunks/JX3HYMZ6.js +0 -8
  1388. package/vendor/pele/chunks/K3TAFXGN.js +0 -3
  1389. package/vendor/pele/chunks/K7FUICZ3.js +0 -1
  1390. package/vendor/pele/chunks/LHH2HHRB.js +0 -1
  1391. package/vendor/pele/chunks/LT5IS45C.js +0 -2
  1392. package/vendor/pele/chunks/MSPQPZZY.js +0 -1
  1393. package/vendor/pele/chunks/NY2EJWPH.js +0 -2
  1394. package/vendor/pele/chunks/OB6ZFVKF.js +0 -1
  1395. package/vendor/pele/chunks/OJBDHQO2.js +0 -4
  1396. package/vendor/pele/chunks/PLTZDMI2.js +0 -1
  1397. package/vendor/pele/chunks/R7EPXMMD.js +0 -1
  1398. package/vendor/pele/chunks/S4GSSVLN.js +0 -3
  1399. package/vendor/pele/chunks/SPBWZ4VS.js +0 -1
  1400. package/vendor/pele/chunks/SR7OOV3Q.js +0 -1
  1401. package/vendor/pele/chunks/STXEMZPJ.js +0 -2
  1402. package/vendor/pele/chunks/SXFARSFO.js +0 -1
  1403. package/vendor/pele/chunks/TC77ISAL.js +0 -1
  1404. package/vendor/pele/chunks/TXE3YXUM.js +0 -2
  1405. package/vendor/pele/chunks/TYIQQHVC.js +0 -1
  1406. package/vendor/pele/chunks/TZUXETIT.js +0 -1
  1407. package/vendor/pele/chunks/U7N72BGE.js +0 -1
  1408. package/vendor/pele/chunks/UFPIB6EZ.js +0 -1
  1409. package/vendor/pele/chunks/V52Z4AG3.js +0 -4
  1410. package/vendor/pele/chunks/VBDLARNP.js +0 -4
  1411. package/vendor/pele/chunks/VIK3ONSK.js +0 -1
  1412. package/vendor/pele/chunks/VPGC3RUM.js +0 -7
  1413. package/vendor/pele/chunks/VVVO4ZVP.js +0 -1
  1414. package/vendor/pele/chunks/WRGXZO53.js +0 -1
  1415. package/vendor/pele/chunks/X5SG7MGC.js +0 -1
  1416. package/vendor/pele/chunks/XXYPNCD5.js +0 -1
  1417. package/vendor/pele/chunks/XZO3CX7R.js +0 -12
  1418. package/vendor/pele/chunks/YZBJM2QT.js +0 -2
  1419. package/vendor/pele/chunks/YZHV477W.js +0 -2
  1420. package/vendor/pele/chunks/Z6WRYFJC.js +0 -1
  1421. package/vendor/pele/chunks/ZI2QNEGF.js +0 -8
@@ -0,0 +1,3509 @@
1
+ import { t as e } from "ooxml/chunk-D5OxutzX.js";
2
+ import { _o as t, ja as n, vo as r, yo as i } from "ooxml/plot-area-frame-D3JtHvov.js";
3
+ import { n as a, t as o } from "ooxml/cfb-guard-BIaHdonq.js";
4
+ import { Dn as s, En as c, H as l, M as u, N as d, On as f, V as p, Xt as m, Y as h, Yt as g, hn as _, j as v, lt as y, mt as b, ot as x, qt as S, t as ee, u as C } from "ooxml/bounded-raw-part-cache-B8t03tSP.js";
5
+ import { A as te, C as w, D as ne, E as T, M as re, N as ie, P as E, S as ae, T as D, _ as oe, a as se, b as ce, c as le, d as ue, f as de, g as fe, h as pe, i as me, j as he, k as ge, l as _e, m as ve, n as ye, o as be, p as xe, r as Se, t as Ce, u as we, v as Te, w as Ee, x as De, y as Oe } from "ooxml/comment-overlay-controller-Crm5Syhx.js";
6
+ import { A as ke, B as Ae, C as je, D as O, E as Me, F as Ne, I as Pe, L as k, M as Fe, N as A, O as Ie, P as Le, R as Re, S as ze, T as Be, V as j, _ as Ve, a as He, b as Ue, c as We, f as Ge, h as Ke, j as M, k as qe, l as Je, m as Ye, n as Xe, o as Ze, p as Qe, s as $e, t as et, u as tt, v as nt, w as rt, x as it, y as N, z as at } from "ooxml/document-pull-client-C_D779tO.js";
7
+ import { f as ot, u as st } from "ooxml/pixel-budget-DI82Hn3R.js";
8
+ import { i as ct, t as lt } from "ooxml/tiff-contract-DEd8CGuz.js";
9
+ import { D as ut, E as dt, T as ft, a as pt, b as mt, c as ht, d as gt, f as _t, i as vt, l as yt, n as bt, o as xt, p as St, r as Ct, s as wt, t as Tt, u as Et, v as Dt, w as Ot, x as kt, y as At } from "ooxml/canvas-viewer-mechanics-DI38gHNV.js";
10
+ import { n as jt } from "ooxml/renderer-module-contract-BuTx2FWJ.js";
11
+ var P = (e) => (e.charCodeAt(0) << 24 >>> 0 | e.charCodeAt(1) << 16 | e.charCodeAt(2) << 8 | e.charCodeAt(3)) >>> 0, Mt = P("ttcf"), Nt = P("OTTO"), Pt = P("true"), Ft = P("typ1"), It = P("head"), Lt = P("hhea"), Rt = P("OS/2"), zt = P("cmap"), Bt = P("fvar"), F = [
12
+ [4352, 4607],
13
+ [11904, 12287],
14
+ [12352, 12543],
15
+ [12544, 12591],
16
+ [12592, 12687],
17
+ [12704, 12735],
18
+ [12784, 12799],
19
+ [13312, 19903],
20
+ [19968, 40959],
21
+ [40960, 42191],
22
+ [43360, 43391],
23
+ [44032, 55203],
24
+ [63744, 64255],
25
+ [131072, 205743]
26
+ ];
27
+ function I(e, t, n) {
28
+ return Number.isSafeInteger(t) && Number.isSafeInteger(n) && t >= 0 && n >= 0 && t <= e - n;
29
+ }
30
+ function Vt(e, t, n) {
31
+ if (n < 16) return !1;
32
+ let r = e.getUint16(t + 2);
33
+ if (r < 16 || r > n) return !1;
34
+ let i = e.getUint16(t + 6);
35
+ if (i === 0 || i % 2 != 0) return !1;
36
+ let a = i / 2, o = t + 14, s = o + a * 2 + 2, c = s + a * 2, l = c + a * 2;
37
+ if (l + a * 2 > t + r) return !1;
38
+ let u = -1;
39
+ for (let t = 0; t < a; t++) {
40
+ let n = e.getUint16(s + t * 2), r = e.getUint16(o + t * 2);
41
+ if (n > r || n <= u) return !1;
42
+ u = r;
43
+ }
44
+ for (let n = 0; n < a; n++) {
45
+ let i = e.getUint16(s + n * 2), a = e.getUint16(o + n * 2), u = e.getInt16(c + n * 2), d = l + n * 2, f = e.getUint16(d);
46
+ for (let [n, o] of F) {
47
+ let s = Math.max(i, n), c = Math.min(a, o);
48
+ if (!(s > c)) {
49
+ if (f === 0) {
50
+ if (s < c || s + u & 65535) return !0;
51
+ continue;
52
+ }
53
+ for (let n = s; n <= c; n++) {
54
+ let a = d + f + (n - i) * 2;
55
+ if (a + 2 > t + r) break;
56
+ let o = e.getUint16(a);
57
+ if (o !== 0 && o + u & 65535) return !0;
58
+ }
59
+ }
60
+ }
61
+ }
62
+ return !1;
63
+ }
64
+ function Ht(e, t, n, r) {
65
+ if (n < 16) return !1;
66
+ let i = e.getUint32(t + 4), a = e.getUint32(t + 12);
67
+ if (i < 16 || i > n || a > (i - 16) / 12) return !1;
68
+ let o = -1;
69
+ for (let n = 0; n < a; n++) {
70
+ let i = t + 16 + n * 12, a = e.getUint32(i), s = e.getUint32(i + 4), c = e.getUint32(i + 8);
71
+ if (a > s || s > 1114111 || a <= o) return !1;
72
+ if (o = s, a > F[F.length - 1][1]) break;
73
+ for (let [e, t] of F) {
74
+ let n = Math.max(a, e), i = Math.min(s, t);
75
+ if (!(n > i)) {
76
+ if (r) {
77
+ if (c !== 0) return !0;
78
+ } else if (n < i || c + (n - a) !== 0) return !0;
79
+ }
80
+ }
81
+ }
82
+ return !1;
83
+ }
84
+ function Ut(e, t) {
85
+ if (!t || t.length < 4) return !1;
86
+ let n = e.getUint16(t.offset + 2);
87
+ if (4 + n * 8 > t.length) return !1;
88
+ for (let r = 0; r < n; r++) {
89
+ let n = t.offset + 4 + r * 8, i = e.getUint16(n), a = e.getUint16(n + 2);
90
+ if (i !== 0 && !(i === 3 && (a === 1 || a === 10))) continue;
91
+ let o = e.getUint32(n + 4);
92
+ if (o > t.length - 2) continue;
93
+ let s = t.offset + o, c = t.length - o, l = e.getUint16(s);
94
+ if (l === 4 && Vt(e, s, c) || l === 12 && Ht(e, s, c, !1) || l === 13 && Ht(e, s, c, !0)) return !0;
95
+ }
96
+ return !1;
97
+ }
98
+ var Wt = 32768, Gt = 4096, Kt = 8, qt = 262144;
99
+ function Jt(e, t, n, r) {
100
+ if (n < 16) return null;
101
+ let i = e.getUint16(t + 2);
102
+ if (i < 16 || i > n) return null;
103
+ let a = e.getUint16(t + 6);
104
+ if (a === 0 || a % 2 != 0) return null;
105
+ let o = a / 2, s = t + 14, c = s + o * 2 + 2, l = c + o * 2, u = l + o * 2;
106
+ if (u + o * 2 > t + i) return null;
107
+ let d = [], f = -1, p = -1, m = (e) => {
108
+ d.length > 0 && p + 1 === e ? (p = e, d[d.length - 1] = [f, p]) : (f = p = e, d.push([e, e]));
109
+ }, h = -1;
110
+ for (let n = 0; n < o; n++) {
111
+ let a = e.getUint16(c + n * 2), o = e.getUint16(s + n * 2);
112
+ if (a > o || a <= h) return null;
113
+ h = o;
114
+ let f = e.getInt16(l + n * 2), p = u + n * 2, g = e.getUint16(p);
115
+ for (let n = a; n <= o && n < 65535; n++) if (--r.remaining < 0 || ((g === 0 ? n + f & 65535 : (() => {
116
+ let r = p + g + (n - a) * 2;
117
+ if (r + 2 > t + i) return 0;
118
+ let o = e.getUint16(r);
119
+ return o === 0 ? 0 : o + f & 65535;
120
+ })()) !== 0 && m(n), d.length > Wt)) return null;
121
+ }
122
+ return d;
123
+ }
124
+ function Yt(e, t, n, r, i) {
125
+ if (n < 16) return null;
126
+ let a = e.getUint32(t + 4), o = e.getUint32(t + 12);
127
+ if (a < 16 || a > n || o > (a - 16) / 12 || o > Wt) return null;
128
+ let s = [], c = -1;
129
+ for (let n = 0; n < o; n++) {
130
+ if (--i.remaining < 0) return null;
131
+ let a = t + 16 + n * 12, o = e.getUint32(a), l = e.getUint32(a + 4), u = e.getUint32(a + 8);
132
+ if (o > l || l > 1114111 || o <= c) return null;
133
+ if (c = l, r) u !== 0 && s.push([o, l]);
134
+ else {
135
+ let e = u === 0 ? o + 1 : o;
136
+ e <= l && s.push([e, l]);
137
+ }
138
+ }
139
+ return s;
140
+ }
141
+ function Xt(e, t) {
142
+ if (!t || t.length < 4) return [];
143
+ let n = e.getUint16(t.offset + 2);
144
+ if (n > Gt || 4 + n * 8 > t.length) return [];
145
+ let r = /* @__PURE__ */ new Set(), i = [];
146
+ for (let a = 0; a < n; a++) {
147
+ let n = t.offset + 4 + a * 8, o = e.getUint16(n), s = e.getUint16(n + 2);
148
+ if (o !== 0 && !(o === 3 && (s === 1 || s === 10))) continue;
149
+ let c = e.getUint32(n + 4);
150
+ if (c > t.length - 2) return [];
151
+ let l = t.offset + c, u = t.length - c, d = e.getUint16(l);
152
+ if (!(o === 0 && s === 5 && d === 14)) {
153
+ if (d !== 4 && d !== 12 && d !== 13) return [];
154
+ if (!r.has(c)) {
155
+ if (r.add(c), r.size > Kt) return [];
156
+ i.push({
157
+ subtable: l,
158
+ availableLength: u,
159
+ format: d
160
+ });
161
+ }
162
+ }
163
+ }
164
+ let a = { remaining: qt }, o = null;
165
+ for (let t of i) {
166
+ let n = t.format === 4 ? Jt(e, t.subtable, t.availableLength, a) : Yt(e, t.subtable, t.availableLength, t.format === 13, a);
167
+ if (!n?.length) return [];
168
+ if (o === null) {
169
+ o = n;
170
+ continue;
171
+ }
172
+ let r = [], i = 0, s = 0;
173
+ for (; i < o.length && s < n.length;) {
174
+ if (--a.remaining < 0) return [];
175
+ let e = o[i], t = n[s], c = Math.max(e[0], t[0]), l = Math.min(e[1], t[1]);
176
+ if (c <= l) {
177
+ let e = r.at(-1);
178
+ if (e && e[1] + 1 === c) r[r.length - 1] = [e[0], l];
179
+ else {
180
+ if (r.length >= Wt) return [];
181
+ r.push([c, l]);
182
+ }
183
+ }
184
+ e[1] <= t[1] && i++, t[1] <= e[1] && s++;
185
+ }
186
+ if (!r.length) return [];
187
+ o = r;
188
+ }
189
+ return Object.freeze((o ?? []).map((e) => Object.freeze(e)));
190
+ }
191
+ function Zt(e) {
192
+ let t = 0, n = 0;
193
+ for (; t < e.length && n < F.length;) {
194
+ let [r, i] = e[t], [a, o] = F[n];
195
+ if (i < a) t++;
196
+ else if (o < r) n++;
197
+ else return !0;
198
+ }
199
+ return !1;
200
+ }
201
+ function Qt(e, t) {
202
+ return $t(e, t, !0);
203
+ }
204
+ function $t(e, t, n) {
205
+ if (t !== void 0 && (!Number.isSafeInteger(t) || t < 0) || e.byteLength < 12) return null;
206
+ let r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = 0;
207
+ if (r.getUint32(0) === Mt) {
208
+ if (t === void 0 || e.byteLength < 12) return null;
209
+ let n = r.getUint32(8);
210
+ if (t >= n || !I(e.byteLength, 12, n * 4)) return null;
211
+ i = r.getUint32(12 + t * 4);
212
+ } else if (t !== void 0 && t !== 0) return null;
213
+ if (!I(e.byteLength, i, 12)) return null;
214
+ let a = r.getUint32(i);
215
+ if (a !== 65536 && a !== Nt && a !== Pt && a !== Ft) return null;
216
+ let o = r.getUint16(i + 4);
217
+ if (!I(e.byteLength, i + 12, o * 16)) return null;
218
+ let s = /* @__PURE__ */ new Map();
219
+ for (let t = 0; t < o; t++) {
220
+ let n = i + 12 + t * 16, a = r.getUint32(n), o = r.getUint32(n + 8), c = r.getUint32(n + 12);
221
+ if (s.has(a) || !I(e.byteLength, o, c)) return null;
222
+ s.set(a, {
223
+ offset: o,
224
+ length: c
225
+ });
226
+ }
227
+ if (n && s.has(Bt)) return null;
228
+ let c = s.get(It), l = s.get(Lt);
229
+ if (!c || c.length < 20 || !l || l.length < 10) return null;
230
+ let u = r.getUint16(c.offset + 18);
231
+ if (u < 16 || u > 16384) return null;
232
+ let d = s.get(Rt), f = d !== void 0 && d.length >= 4 ? r.getInt16(d.offset + 2) : 0, p = d !== void 0 && d.length >= 78, m = d !== void 0 && d.length >= 86 && r.getUint16(d.offset) >= 1, h = n ? Xt(r, s.get(zt)) : void 0;
233
+ return Object.freeze({
234
+ unitsPerEm: u,
235
+ ...f > 0 ? { averageCharWidthRatio: f / u } : {},
236
+ hheaAscent: r.getInt16(l.offset + 4),
237
+ hheaDescent: r.getInt16(l.offset + 6),
238
+ hheaLineGap: r.getInt16(l.offset + 8),
239
+ farEastCodePage: m ? (r.getUint32(d.offset + 78) & 1966080) != 0 : null,
240
+ hasEastAsianCmap: h ? Zt(h) : Ut(r, s.get(zt)),
241
+ ...h === void 0 ? {} : { unicodeRanges: h },
242
+ ...p ? {
243
+ typoAscent: r.getInt16(d.offset + 68),
244
+ typoDescent: r.getInt16(d.offset + 70),
245
+ typoLineGap: r.getInt16(d.offset + 72),
246
+ winAscent: r.getUint16(d.offset + 74),
247
+ winDescent: r.getUint16(d.offset + 76),
248
+ useTypoMetrics: (r.getUint16(d.offset + 62) & 128) != 0
249
+ } : {}
250
+ });
251
+ }
252
+ function en(e, n) {
253
+ if (e.metric.lineHeightRatio != null || !n) return e.metric;
254
+ let r = t(e.requestedFamily, {
255
+ weight: e.weight,
256
+ style: e.style
257
+ });
258
+ if (e.source !== "substitute" && r.some((e) => e.farEastCodePage !== !1)) return e.metric;
259
+ let i = n.ascentRatio + n.lineGapRatio, a = n.descentRatio;
260
+ return Number.isFinite(i) && Number.isFinite(a) && i >= 0 && a >= 0 && i + a > 0 ? Object.freeze({
261
+ ...e.metric,
262
+ requiresGlyphCoverage: !0,
263
+ lineHeightRatio: i + a,
264
+ designAscentRatio: i,
265
+ designDescentRatio: a,
266
+ lineGapRatio: n.lineGapRatio,
267
+ ...r.length > 0 && e.source === "local" ? { farEastCodePage: !1 } : {}
268
+ }) : e.metric;
269
+ }
270
+ function tn(e) {
271
+ if (e.metric.lineHeightRatio != null) return;
272
+ let n = t(e.requestedFamily, {
273
+ weight: e.weight,
274
+ style: e.style
275
+ });
276
+ return e.source === "substitute" || n.every((e) => e.farEastCodePage === !1) ? n[0]?.unitsPerEm : void 0;
277
+ }
278
+ async function nn(e) {
279
+ let t = typeof document > "u" ? null : document;
280
+ return Promise.all(e.map(async (e) => {
281
+ let n = tn(e), r = an(e), i = t?.body && r && n ? await Ae(r, e.family, e.weight, e.style, n, t) : null;
282
+ return {
283
+ resourceIdentity: e.resourceIdentity,
284
+ weight: e.weight,
285
+ style: e.style,
286
+ measured: i
287
+ };
288
+ }));
289
+ }
290
+ function rn(e) {
291
+ if (e.source !== "local" || e.weight !== 400 || e.style !== "normal") return !1;
292
+ let n = t(e.requestedFamily);
293
+ return !n.some((e) => e.weight >= 600 && e.style === "normal") || !n.some((e) => e.style === "italic");
294
+ }
295
+ function an(e) {
296
+ return e.source === "local" && e.resourceIdentity.startsWith("office-local:local(") ? e.resourceIdentity.slice(13) : void 0;
297
+ }
298
+ async function on(e, t, n) {
299
+ let r = typeof document > "u" ? null : document;
300
+ if (!t) return e;
301
+ let i = r?.body && r.fonts === t ? r.createElement("canvas").getContext("2d") : null, a = /* @__PURE__ */ new Map(), o = await Promise.all(Object.entries(e.routes).map(async ([o, s]) => {
302
+ let c = e.faces.find((e) => e.family === s.family), l = tn(s), u = n?.find((e) => e.resourceIdentity === s.resourceIdentity && e.weight === s.weight && e.style === s.style), d = en(s, c && l && i && r?.body ? at(c, t, i, l, r) : u?.measured ?? null), f = an(s), p = null, m;
303
+ if (c && f && rn(s)) {
304
+ let e = a.get(c);
305
+ e || (e = Re(c, f, t), a.set(c, e)), m = (await e)?.family;
306
+ }
307
+ if (d !== s.metric) {
308
+ if (c && f) {
309
+ let e = a.get(c);
310
+ e || (e = Re(c, f, t), a.set(c, e)), p = await e;
311
+ }
312
+ d = p ? Object.freeze({
313
+ ...d,
314
+ glyphCoverageProbeFamily: p.family
315
+ }) : s.metric;
316
+ }
317
+ return {
318
+ key: o,
319
+ route: {
320
+ ...s,
321
+ metric: d,
322
+ ...m ? { coverageProbeFamily: m } : {}
323
+ },
324
+ probe: p
325
+ };
326
+ })), s = {};
327
+ for (let e of o) s[e.key] = e.route;
328
+ for (let t of a.values()) {
329
+ let n = await t;
330
+ n && e.faces.push(n);
331
+ }
332
+ return {
333
+ ...e,
334
+ routes: s
335
+ };
336
+ }
337
+ async function sn(...e) {
338
+ return on(await g(...e), e[1] === void 0 ? c() : e[1]);
339
+ }
340
+ var cn = /* @__PURE__ */ new WeakMap();
341
+ function L(e, t = []) {
342
+ let n = cn.get(e) ?? [], r = new Map(n.map((e) => [JSON.stringify(e), e]));
343
+ for (let e of t) r.set(JSON.stringify(e), Object.freeze({ ...e }));
344
+ cn.set(e, Object.freeze([...r.values()]));
345
+ }
346
+ function ln(e) {
347
+ return cn.get(e) ?? [];
348
+ }
349
+ var un = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,f,ee=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,f=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function te(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var ne=e((()=>{}));function p(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return p(t.requiredBytes)&&p(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var m=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function h(e){if(e instanceof m)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!re(r)))return new m(r)}function ie(e,t,n){let r=h(e);if(!(!r||r.offeredBytes!==t||r.requiredBytes>n))return r}i(),ee(),ne();const g=`OOXML_RESOURCE_LIMIT:`;function _(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return _(t.archiveEntryCount)&&_(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||_(t.largestInflatedEntryBytes))&&_(t.distinctInflatedBytes)&&_(t.operationInflatedBytes)}function y(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!v(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function ae(e){return e===`docx`||e===`xlsx`||e===`pptx`}function oe(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function b(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function x(e){return b(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function se(e){return!b(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const S=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ce=new Set([...S.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),le=new Set([...S.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function ue(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!ae(t.format)||!b(t.operation,256)||!x(t.resource)||!x(t.metric)||!_(t.limit)||!_(t.observed)||typeof t.configurable!=`boolean`||!v(t.usage)?!1:!(`part`in t)||se(t.part)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!oe(t.stage)||!ue(t.violation))return!1;let n=t.violation,r=S.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ce.has(n.resource)&&le.has(n.metric))}function de(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function fe(e){if(!C(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:de(t.usage)}};return C(n)?n:void 0}function pe(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function w(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(g))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!C(i.details)))return new r(pe(i.details),i.details)}function me(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:w(e)??e}}function he(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function T(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!x(n)||r!==`source-subset`))return{format:n,reason:r}}function E(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ge(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=T(JSON.parse(t.slice(25)));return e?E(e):void 0}catch{return}}function _e(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ge(e)??w(e)??he(e)}function ve(e){let t=s(e);if(t){let e=new f(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=te(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=h(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:_e(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=fe(e.details);return t?{message:typeof e.message==`string`?e.message:pe(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=T(c.details);return e?{message:E(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:b(o.name,128)?o.name:`OoxmlError`,...x(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(g))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:b(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function D(e){try{return ve(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var ye=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},O=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function be(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function xe(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function Se(e,t){return e({module_or_path:t})}var Ce=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new ye(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),we),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return me(()=>this.runtime.run(e))}poison(){this.runtime.poison(new O(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):Se(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,xe(e)}};function we(e){return be(e)?new O(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function Te(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Ee(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const k=`ooxml-pull-v1`;function A(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function De(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var j=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,A(this.maxRetainedBytes,`max retained lease bytes`),A(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},Oe=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){De(e.sessionId),A(e.operationId,`operation id`),A(e.generation,`generation`),A(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&A(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=D(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(A(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:k,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){A(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(A(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:k,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:k,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};i();function ke(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_DOCX_ILVL:`))return;let r=t.slice(16);if(r===`repair-required:level-definition`)return new n(`invalid-numbering`,`The DOCX defines a numbering level outside Word’s supported 0–8 range and requires repair.`);if(r===`cannot-open:whitespace`||r===`cannot-open:non-decimal`)return new n(`invalid-numbering`,`Word cannot open this DOCX numbering level (${r.slice(12)}).`)}function M(e){try{return ke(e)??e}catch{return e}}function Ae(e){try{return e()}catch(e){throw M(e)}}var N=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){let e=this.__destroy_into_raw();J.__wbg_docxarchive_free(e,0)}acknowledge_document_chunk(e,t,n){let r=J.docxarchive_acknowledge_document_chunk(this.__wbg_ptr,e,t,n);if(r[1])throw U(r[0])}assert_healthy(){let e=J.docxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw U(e[0])}cancel_document_cursor(){J.docxarchive_cancel_document_cursor(this.__wbg_ptr)}close_document_session(){J.docxarchive_close_document_session(this.__wbg_ptr)}document_chunk_done(){let e=J.docxarchive_document_chunk_done(this.__wbg_ptr);if(e[2])throw U(e[1]);return e[0]!==0}document_cursor_resource_usage(){let e=J.docxarchive_document_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);let t;return e[0]!==0&&(t=F(e[0],e[1]).slice(),J.__wbindgen_free(e[0],e[1]*1,1)),t}extract_image(e){let t=H(e,J.__wbindgen_malloc,J.__wbindgen_realloc),n=q,r=J.docxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw U(r[2]);var i=F(r[0],r[1]).slice();return J.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Me(e,J.__wbindgen_malloc),a=q,o=J.docxarchive_new(i,a,!V(t),V(t)?BigInt(0):t,!V(n),V(n)?BigInt(0):n,!V(r),V(r)?BigInt(0):r);if(o[2])throw U(o[1]);return this.__wbg_ptr=o[0]>>>0,P.register(this,this.__wbg_ptr,this),this}open_document_cursor(e,t){let n=J.docxarchive_open_document_cursor(this.__wbg_ptr,e,t);if(n[1])throw U(n[0])}parse(){let e=J.docxarchive_parse(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}pull_document_chunk(e,t,n,r){let i=J.docxarchive_pull_document_chunk(this.__wbg_ptr,e,t,n,r);if(i[3])throw U(i[2]);var a=F(i[0],i[1]).slice();return J.__wbindgen_free(i[0],i[1]*1,1),a}resource_usage(){let e=J.docxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=J.docxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,U(i[2]);return e=n,t=r,R(n,r)}finally{J.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);function je(){return{__proto__:null,\"./docx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(R(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(R(e,t))}finally{J.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=H(n,J.__wbindgen_malloc,J.__wbindgen_realloc),i=q;L().setInt32(e+4,i,!0),L().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return R(e,t)},__wbindgen_init_externref_table:function(){let e=J.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const P=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>J.__wbg_docxarchive_free(e>>>0,1));function F(e,t){return e>>>=0,B().subarray(e/1,e/1+t)}let I=null;function L(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==J.memory.buffer)&&(I=new DataView(J.memory.buffer)),I}function R(e,t){return e>>>=0,Ne(e,t)}let z=null;function B(){return(z===null||z.byteLength===0)&&(z=new Uint8Array(J.memory.buffer)),z}function V(e){return e==null}function Me(e,t){let n=t(e.length*1,1)>>>0;return B().set(e,n/1),q=e.length,n}function H(e,t,n){if(n===void 0){let n=K.encode(e),r=t(n.length,1)>>>0;return B().subarray(r,r+n.length).set(n),q=n.length,r}let r=e.length,i=t(r,1)>>>0,a=B(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=B().subarray(i+o,i+r),a=K.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return q=o,i}function U(e){let t=J.__wbindgen_externrefs.get(e);return J.__externref_table_dealloc(e),t}let W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});W.decode();let G=0;function Ne(e,t){return G+=t,G>=2146435072&&(W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),W.decode(),G=t),W.decode(B().subarray(e,e+t))}const K=new TextEncoder;`encodeInto`in K||(K.encodeInto=function(e,t){let n=K.encode(e);return t.set(n),{read:e.length,written:n.length}});let q=0,J;function Pe(e,t){return J=e.exports,I=null,z=null,J.__wbindgen_start(),J}async function Fe(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Y(e){if(J!==void 0)return J;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=je();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Fe(await e,t);return Pe(n,r)}async function Ie(e){return J=void 0,I=null,z=null,Y(e)}function Le(e){let t=e(e=>e.document_cursor_resource_usage?.());return t?y(t):void 0}const Re=67108864;var ze=class{archive;coordinator=new j;host=null;identity=null;executeArchive;constructor(e,t=e=>e(this.requireArchive())){this.archive=e,this.executeArchive=e=>Ae(()=>t(e))}open(e){if(this.host)throw Error(`a DOCX document pull session is already active`);this.executeArchive(t=>{t.open_document_cursor(e.operationId,e.generation)});let t=0;this.identity=e,this.host=new Oe({...e,maxByteCredit:Re,coordinator:this.coordinator,driver:{pull:n=>{let r;try{r=this.executeArchive(r=>r.pull_document_chunk(t,e.operationId,e.generation,n))}catch(e){throw ie(e,n,Re)||e}let i=Te(r);return{payload:i,byteLength:i.byteLength,done:this.executeArchive(e=>e.document_chunk_done()),transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:n=>{if(n!==t)throw Error(`DOCX document acknowledgement sequence mismatch`);this.executeArchive(n=>n.acknowledge_document_chunk(t,e.operationId,e.generation)),t+=1},cancel:()=>this.executeArchive(e=>e.cancel_document_cursor()),close:()=>this.executeArchive(e=>e.close_document_session()),resourceUsage:()=>Le(this.executeArchive)}})}dispatch(e,t){return!this.host||!this.identity?(t({protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:D(Error(`DOCX document pull session is not open`))}),Promise.resolve()):this.host.dispatch(e,t)}async reset(){if(this.host)try{this.archive()&&this.executeArchive(e=>e.close_document_session())}finally{this.host=null,this.identity=null,this.coordinator=new j}}requireArchive(){let e=this.archive();if(!e)throw Error(`No docx loaded`);return e}};function Be(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const X=new Ce(Y,{freeArchive:e=>e.free(),reinit:Ie}),Z=new ze(()=>X.archive,e=>X.run(()=>{let t=X.archive;if(!t)throw Error(`No docx loaded`);return e(t)}));let Q=0;const $=(e,t)=>self.postMessage(e,t);self.onmessage=async e=>{let n=e.data;if(Be(n)){try{await Z.dispatch(n,$)}catch(e){$({protocol:k,kind:`error`,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation,requestId:n.requestId,error:D(M(e))})}return}if(n.type===`init`){X.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await X.ensureReady(),n.type!==`parse`&&X.archive){let e=X.archive;X.run(()=>e.assert_healthy())}if(n.type===`parse`){await Z.reset();let[e,t,i]=Ee(n.resourcePolicy),a=new Uint8Array(n.data);X.run(()=>{let n=new N(a,e,t,i);X.setArchive(n)}),Q+=1;let o={sessionId:Q,operationId:Q,generation:Q};Z.open(o),$({type:`documentSessionOpened`,id:r,...o});return}let e=X.archive;if(n.type===`extractImage`){if(!e)throw Error(`No docx loaded`);let t=X.run(()=>e.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.type===`resourceUsage`){if(!e)throw Error(`No docx loaded`);$({type:`resourceUsage`,id:r,usage:y(X.run(()=>e.resource_usage()))});return}if(n.type===`toMarkdown`){if(!e)throw Error(`No docx loaded`);$({type:`markdownRendered`,id:r,markdown:X.run(()=>e.to_markdown())});return}}catch(e){$({type:`error`,id:r,...D(M(e))})}};", dn = typeof self < "u" && self.Blob && new Blob([un], { type: "text/javascript;charset=utf-8" });
350
+ function fn(e) {
351
+ let t;
352
+ try {
353
+ if (t = dn && (self.URL || self.webkitURL).createObjectURL(dn), !t) throw "";
354
+ let n = new Worker(t, {
355
+ name: e?.name
356
+ });
357
+ return n.addEventListener("error", () => {
358
+ (self.URL || self.webkitURL).revokeObjectURL(t);
359
+ }), n;
360
+ } catch {
361
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(un), {
362
+ name: e?.name
363
+ });
364
+ }
365
+ }
366
+ var pn = new URL("docx_parser_bg.wasm", "https://package.invalid/").href;
367
+ function mn(e) {
368
+ return e === "nativeRouteSentinels" ? "[ooxml] mode: 'worker' fell back to main-thread rendering because the worker cannot register the font probes that size absent-font lines." : "[ooxml] mode: 'worker' fell back to main-thread rendering because this document requires DOM OpenType vertical glyph selection.";
369
+ }
370
+ function hn(e) {
371
+ let t = /* @__PURE__ */ new Map();
372
+ for (let n of e.pages) for (let e of n.bookmarkStarts) e.name !== "" && !t.has(e.name) && t.set(e.name, n.pageIndex);
373
+ return t;
374
+ }
375
+ var gn = new Uint32Array([
376
+ 1116352408,
377
+ 1899447441,
378
+ 3049323471,
379
+ 3921009573,
380
+ 961987163,
381
+ 1508970993,
382
+ 2453635748,
383
+ 2870763221,
384
+ 3624381080,
385
+ 310598401,
386
+ 607225278,
387
+ 1426881987,
388
+ 1925078388,
389
+ 2162078206,
390
+ 2614888103,
391
+ 3248222580,
392
+ 3835390401,
393
+ 4022224774,
394
+ 264347078,
395
+ 604807628,
396
+ 770255983,
397
+ 1249150122,
398
+ 1555081692,
399
+ 1996064986,
400
+ 2554220882,
401
+ 2821834349,
402
+ 2952996808,
403
+ 3210313671,
404
+ 3336571891,
405
+ 3584528711,
406
+ 113926993,
407
+ 338241895,
408
+ 666307205,
409
+ 773529912,
410
+ 1294757372,
411
+ 1396182291,
412
+ 1695183700,
413
+ 1986661051,
414
+ 2177026350,
415
+ 2456956037,
416
+ 2730485921,
417
+ 2820302411,
418
+ 3259730800,
419
+ 3345764771,
420
+ 3516065817,
421
+ 3600352804,
422
+ 4094571909,
423
+ 275423344,
424
+ 430227734,
425
+ 506948616,
426
+ 659060556,
427
+ 883997877,
428
+ 958139571,
429
+ 1322822218,
430
+ 1537002063,
431
+ 1747873779,
432
+ 1955562222,
433
+ 2024104815,
434
+ 2227730452,
435
+ 2361852424,
436
+ 2428436474,
437
+ 2756734187,
438
+ 3204031479,
439
+ 3329325298
440
+ ]);
441
+ function _n(e) {
442
+ let t = new Uint32Array([
443
+ 1779033703,
444
+ 3144134277,
445
+ 1013904242,
446
+ 2773480762,
447
+ 1359893119,
448
+ 2600822924,
449
+ 528734635,
450
+ 1541459225
451
+ ]), n = new Uint32Array(64), r = Math.ceil((e.length + 9) / 64) * 64, i = e.length * 8, a = (t) => t < e.length ? e[t] : t === e.length ? 128 : t >= r - 8 ? Math.floor(i / 2 ** ((r - t - 1) * 8)) & 255 : 0, o = (e, t) => e >>> t | e << 32 - t;
452
+ for (let e = 0; e < r; e += 64) {
453
+ for (let t = 0; t < 16; t++) {
454
+ let r = e + t * 4;
455
+ n[t] = a(r) << 24 | a(r + 1) << 16 | a(r + 2) << 8 | a(r + 3);
456
+ }
457
+ for (let e = 16; e < 64; e++) {
458
+ let t = n[e - 15], r = n[e - 2], i = o(t, 7) ^ o(t, 18) ^ t >>> 3, a = o(r, 17) ^ o(r, 19) ^ r >>> 10;
459
+ n[e] = n[e - 16] + i + n[e - 7] + a >>> 0;
460
+ }
461
+ let [r, i, s, c, l, u, d, f] = t;
462
+ for (let e = 0; e < 64; e++) {
463
+ let t = o(l, 6) ^ o(l, 11) ^ o(l, 25), a = l & u ^ ~l & d, p = f + t + a + gn[e] + n[e] >>> 0, m = (o(r, 2) ^ o(r, 13) ^ o(r, 22)) + (r & i ^ r & s ^ i & s) >>> 0;
464
+ f = d, d = u, u = l, l = c + p >>> 0, c = s, s = i, i = r, r = p + m >>> 0;
465
+ }
466
+ t[0] = t[0] + r >>> 0, t[1] = t[1] + i >>> 0, t[2] = t[2] + s >>> 0, t[3] = t[3] + c >>> 0, t[4] = t[4] + l >>> 0, t[5] = t[5] + u >>> 0, t[6] = t[6] + d >>> 0, t[7] = t[7] + f >>> 0;
467
+ }
468
+ let s = new Uint8Array(32), c = new DataView(s.buffer);
469
+ return t.forEach((e, t) => c.setUint32(t * 4, e)), s;
470
+ }
471
+ var vn = _, yn = 64, R = 2;
472
+ async function bn(e, t) {
473
+ let n;
474
+ try {
475
+ n = globalThis.crypto?.subtle ? new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", e.slice().buffer)) : _n(e);
476
+ } catch {
477
+ n = _n(e);
478
+ }
479
+ let r = Array.from(n, (e) => e.toString(16).padStart(2, "0")).join(""), i = 2166136261;
480
+ for (let e of t.trim().toLowerCase()) i ^= e.codePointAt(0), i = Math.imul(i, 16777619);
481
+ return `__ooxml_docx_embedded_${r}_${(i >>> 0).toString(16)}`;
482
+ }
483
+ async function xn(e, t) {
484
+ let n = e.embeddedFonts;
485
+ if (!n || n.length === 0) return {
486
+ faces: [],
487
+ metrics: {},
488
+ routes: []
489
+ };
490
+ let r = [], a = /* @__PURE__ */ new Set();
491
+ for (let e of n) {
492
+ let t = Sn(e.style) === "bold" ? 700 : 400, n = Cn(e.style), i = `${j(e.fontName)}:${t}:${n}`;
493
+ a.has(i) || (a.add(i), r.push(e));
494
+ }
495
+ let o = [], s = 0, c = Math.min(r.length, yn), u = r.length - c;
496
+ for (let e = 0; e < c; e += R) {
497
+ let n = r.slice(e, Math.min(e + R, c)), a = await Promise.all(n.map(async (e) => {
498
+ try {
499
+ return await t(e.partPath);
500
+ } catch (e) {
501
+ if (e instanceof i || ot(e)) throw e;
502
+ let t = l(e);
503
+ if (t) throw t;
504
+ return null;
505
+ }
506
+ }));
507
+ for (let e = 0; e < n.length; e++) {
508
+ let t = n[e], r = a[e];
509
+ if (r) {
510
+ if (!re(r) || r.byteLength > vn - s) {
511
+ u++;
512
+ continue;
513
+ }
514
+ try {
515
+ let e = t.partPath.toLowerCase().endsWith(".odttf") ? he(r, t.fontKey ?? "") : r, n = await bn(e, t.fontName), i = {
516
+ family: n,
517
+ bytes: e,
518
+ odttf: !1,
519
+ fontKey: "",
520
+ weight: Sn(t.style),
521
+ style: Cn(t.style)
522
+ }, a = null;
523
+ try {
524
+ let r = Qt(e), o = r?.farEastCodePage == null ? null : ke({
525
+ ...r,
526
+ farEastCodePage: r.farEastCodePage
527
+ });
528
+ (o || r?.averageCharWidthRatio != null) && (a = Object.freeze({
529
+ family: n,
530
+ requestedFamily: t.fontName,
531
+ weight: i.weight === "bold" ? 700 : 400,
532
+ style: i.style,
533
+ sourceIdentity: `embedded:${n}`,
534
+ synthesized: !1,
535
+ ...o ? {
536
+ lineHeightRatio: o.lineHeightRatio,
537
+ designAscentRatio: o.designAscentRatio,
538
+ designDescentRatio: o.designDescentRatio
539
+ } : {},
540
+ ...r?.averageCharWidthRatio == null ? {} : { averageCharWidthRatio: r.averageCharWidthRatio },
541
+ unicodeRanges: r?.unicodeRanges ?? [],
542
+ ...o && r?.hasEastAsianCmap ? { eastAsianLineHeightRatio: o.lineHeightRatio } : {}
543
+ }));
544
+ } catch {}
545
+ o.push({
546
+ face: i,
547
+ metric: a,
548
+ route: {
549
+ requestedFamily: t.fontName,
550
+ resolvedFamily: i.family,
551
+ weight: i.weight === "bold" ? 700 : 400,
552
+ style: i.style,
553
+ resourceIdentity: `embedded:${i.family}`
554
+ }
555
+ }), s += r.byteLength;
556
+ } catch {
557
+ continue;
558
+ }
559
+ }
560
+ }
561
+ }
562
+ let d = Object.freeze(u > 0 ? [Object.freeze({
563
+ code: "MISSING_RESOURCE",
564
+ severity: "warning",
565
+ message: `Skipped ${u} embedded font face(s) under the document font resource limits; fallback fonts are used`
566
+ })] : []), f = o;
567
+ if (f.length === 0) return {
568
+ faces: [],
569
+ metrics: {},
570
+ routes: [],
571
+ diagnostics: d
572
+ };
573
+ let p = [], m = /* @__PURE__ */ new Set();
574
+ try {
575
+ for (let e = 0; e < f.length; e += R) {
576
+ let t = f.slice(e, e + R);
577
+ for (let e of await ie(t.map((e) => e.face))) m.has(e) ? E([e]) : (m.add(e), p.push(e));
578
+ }
579
+ } catch (e) {
580
+ throw E(p), e;
581
+ }
582
+ let h = new Set(p.map((e) => {
583
+ let t = e.family.trim().replace(/^(['"])(.*)\1$/, "$2"), n = e.weight === "bold" ? 700 : Number(e.weight) || 400, r = e.style === "italic" ? "italic" : "normal";
584
+ return `${j(t)}:${n}:${r}`;
585
+ })), g = {}, _ = [];
586
+ for (let e of f) {
587
+ let t = j(e.face.family), n = e.face.weight === "bold" ? 700 : 400, r = e.face.style, i = `${t}:${n}:${r}`;
588
+ if (!h.has(i) || (_.push(Object.freeze(e.route)), !e.metric)) continue;
589
+ let a = j(e.route.requestedFamily);
590
+ g[n === 400 && r === "normal" ? a : `${a}:${n}:${r}`] = e.metric;
591
+ }
592
+ return {
593
+ faces: p,
594
+ metrics: Object.freeze(g),
595
+ routes: Object.freeze(_),
596
+ diagnostics: d
597
+ };
598
+ }
599
+ function Sn(e) {
600
+ return e === "bold" || e === "boldItalic" ? "bold" : "normal";
601
+ }
602
+ function Cn(e) {
603
+ return e === "italic" || e === "boldItalic" ? "italic" : "normal";
604
+ }
605
+ var wn = gt, Tn = 16384;
606
+ function En(e, t) {
607
+ let n = [], r = 0, i = !1;
608
+ for (let a of e) {
609
+ if (a.length === 0) continue;
610
+ if (r > 0) {
611
+ if (r >= t) {
612
+ i = !0;
613
+ break;
614
+ }
615
+ n.push("\n"), r++;
616
+ }
617
+ let e = St(a, Math.max(0, t - r));
618
+ if (n.push(e), r += e.length, e.length < a.length) {
619
+ i = !0;
620
+ break;
621
+ }
622
+ }
623
+ let a = n.join("");
624
+ return {
625
+ ...a.length === 0 ? {} : { text: a },
626
+ truncated: i
627
+ };
628
+ }
629
+ function* z(e) {
630
+ if (e.kind === "paragraph") {
631
+ for (let t of e.lines) {
632
+ let e = t.placements.flatMap((e) => e.kind === "text" && !e.optionalHyphenGlyph ? [e.text] : []).join("");
633
+ e && (yield e);
634
+ }
635
+ return;
636
+ }
637
+ if (e.kind === "table") {
638
+ for (let t of e.rows) for (let e of t.cells) for (let t of e.blocks) yield* z(t.layout);
639
+ return;
640
+ }
641
+ if (e.kind === "note") {
642
+ e.leading?.paragraph && (yield* z(e.leading.paragraph));
643
+ for (let t of e.story.blocks) yield* z(t);
644
+ e.trailing?.paragraph && (yield* z(e.trailing.paragraph));
645
+ } else if (e.kind === "textbox") for (let t of e.story.blocks) yield* z(t);
646
+ }
647
+ function* Dn(e) {
648
+ for (let t of e.drawing.commands) (t.kind === "text" || t.kind === "watermark-text") && (yield t.text);
649
+ for (let t of e.textBoxes) yield* z(t);
650
+ }
651
+ function On(e) {
652
+ let t = e ?? Tn;
653
+ if (!Number.isFinite(t) || t < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
654
+ return Math.min(wn, Math.floor(t));
655
+ }
656
+ function kn(e) {
657
+ return {
658
+ story: e.story,
659
+ storyInstance: e.storyInstance,
660
+ path: [...e.path]
661
+ };
662
+ }
663
+ function An(e) {
664
+ return "drawing" in e ? e.drawing.inkBounds : e.placement.bounds;
665
+ }
666
+ function jn(e) {
667
+ let t = An(e), n = [
668
+ O(e.pointToPage, t),
669
+ O(e.pointToPage, {
670
+ xPt: t.xPt + t.widthPt,
671
+ yPt: t.yPt
672
+ }),
673
+ O(e.pointToPage, {
674
+ xPt: t.xPt,
675
+ yPt: t.yPt + t.heightPt
676
+ }),
677
+ O(e.pointToPage, {
678
+ xPt: t.xPt + t.widthPt,
679
+ yPt: t.yPt + t.heightPt
680
+ })
681
+ ], r = Math.min(...n.map((e) => e.xPt)), i = Math.min(...n.map((e) => e.yPt)), a = Math.max(...n.map((e) => e.xPt)), o = Math.max(...n.map((e) => e.yPt));
682
+ return {
683
+ xPt: r,
684
+ yPt: i,
685
+ widthPt: a - r,
686
+ heightPt: o - i
687
+ };
688
+ }
689
+ function B(e, t) {
690
+ return t.xPt >= e.xPt && t.xPt <= e.xPt + e.widthPt && t.yPt >= e.yPt && t.yPt <= e.yPt + e.heightPt;
691
+ }
692
+ function Mn(e, t) {
693
+ let n = !1;
694
+ for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
695
+ let a = t[r], o = t[i];
696
+ a.yPt > e.yPt != o.yPt > e.yPt && e.xPt < (o.xPt - a.xPt) * (e.yPt - a.yPt) / (o.yPt - a.yPt) + a.xPt && (n = !n);
697
+ }
698
+ return n;
699
+ }
700
+ function Nn(e, t) {
701
+ return B(e.inkBounds, t) ? e.clip ? e.clip.kind === "rect" ? B(e.clip.rect, t) : Mn(t, e.clip.points) : !0 : !1;
702
+ }
703
+ function Pn(e, t, n) {
704
+ for (let n of e.clips) {
705
+ let e = Me(n.pointToPage, t);
706
+ if (!e || !B(n.bounds, e)) return !1;
707
+ }
708
+ return "drawing" in e ? Nn(e.drawing, n) : B(e.placement.bounds, n);
709
+ }
710
+ function V(e, t) {
711
+ return e.commands.find((e) => e.kind === "resource" && e.resourceKind === t);
712
+ }
713
+ function Fn(e) {
714
+ return V(e, "chart") ? "chart" : e.commands.some((e) => e.kind === "drawingml-shape" || e.kind === "drawingml-image-fill" || e.kind === "fill-rect" || e.kind === "stroke-rect" || e.kind === "text" || e.kind === "watermark-text") ? "shape" : V(e, "image") ? "image" : null;
715
+ }
716
+ function In(e, t, n, r, i, a) {
717
+ let o = "drawing" in e ? Fn(e.drawing) : e.placement.resourceKind;
718
+ if (!o) return null;
719
+ let s, c = !1, l, u;
720
+ if (o === "chart") {
721
+ let t = "drawing" in e ? V(e.drawing, "chart").resourceKey : e.placement.resourceKey, n = i.resolve(t, "chart"), r = _t(n.model, a);
722
+ s = r.text, c = r.truncated, u = n.model.series.length;
723
+ } else if (o === "image") {
724
+ let t = "drawing" in e ? V(e.drawing, "image").resourceKey : e.placement.resourceKey, n = i.descriptors.find((e) => e.resourceKey === t && e.kind === "image" && "mimeType" in e);
725
+ if (!n) throw Error(`Unknown image paint resource: ${t}`);
726
+ l = n.mimeType;
727
+ } else {
728
+ let t = En(Dn(e), a);
729
+ s = t.text, c = t.truncated;
730
+ }
731
+ return {
732
+ format: "docx",
733
+ kind: "element",
734
+ pageIndex: t,
735
+ elementIndex: n,
736
+ elementType: o,
737
+ point: { ...r },
738
+ bounds: jn(e),
739
+ source: kn("drawing" in e ? e.drawing.source : e.source),
740
+ ...s === void 0 ? {} : { text: s },
741
+ ...l === void 0 ? {} : { mimeType: l },
742
+ ...u === void 0 ? {} : { seriesCount: u },
743
+ truncated: c,
744
+ truncationReasons: c ? ["text"] : [],
745
+ textCharacters: s?.length ?? 0,
746
+ maxTextCharacters: a
747
+ };
748
+ }
749
+ function Ln(e, t, n, r, i = {}) {
750
+ if (!Number.isFinite(n.xPt) || !Number.isFinite(n.yPt)) throw RangeError("DOCX hit-test point must contain finite page coordinates.");
751
+ let a = On(i.maxTextCharacters), o = rt(e, t);
752
+ for (let e = o.length - 1; e >= 0; e--) {
753
+ let i = o[e], s = Me(i.pointToPage, n);
754
+ if (!s || !Pn(i, n, s)) continue;
755
+ let c = In(i, t, e, n, r, a);
756
+ if (c) return c;
757
+ }
758
+ return null;
759
+ }
760
+ function Rn(e, t, n, r) {
761
+ return Ln(Ie(e, {
762
+ currentDate: r.currentDate,
763
+ defaultCurrentDateMs: r.defaultCurrentDateMs,
764
+ showTrackedChanges: r.showTrackedChanges
765
+ }, t).layout, t, n, Ne(e), r);
766
+ }
767
+ function zn(e, t) {
768
+ let n = On(t), r = e.text === void 0 ? void 0 : St(e.text, n), i = e.truncated || e.text !== void 0 && r.length < e.text.length;
769
+ return {
770
+ ...structuredClone(e),
771
+ ...r === void 0 ? {} : { text: r },
772
+ truncated: i,
773
+ truncationReasons: i ? ["text"] : [],
774
+ textCharacters: r?.length ?? 0,
775
+ maxTextCharacters: n
776
+ };
777
+ }
778
+ function Bn(e) {
779
+ if (e === void 0) return;
780
+ let t = e.replace(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");
781
+ if (/^[+-]?\d+$/.test(t)) try {
782
+ return BigInt(t).toString();
783
+ } catch {
784
+ return;
785
+ }
786
+ }
787
+ function Vn(e) {
788
+ return Object.freeze({
789
+ ...e,
790
+ path: Object.freeze([...e.path])
791
+ });
792
+ }
793
+ function Hn(e) {
794
+ return Object.freeze({
795
+ source: Vn(e.source),
796
+ runIndex: e.boundary,
797
+ affinity: e.boundary < e.runCount ? "following" : "preceding"
798
+ });
799
+ }
800
+ function H(e, t) {
801
+ let n = e.runs, r = 0;
802
+ for (let e = 0; e < Math.min(t, n.length); e += 1) n[e]?.type !== "unavailableDrawing" && (r += 1);
803
+ return r;
804
+ }
805
+ function Un(e, t, n, r, i = t.boundary) {
806
+ return Object.freeze({
807
+ commentId: e,
808
+ source: Vn(t.source),
809
+ startRunIndex: t.boundary,
810
+ endRunIndex: i,
811
+ reference: Hn(n),
812
+ ...r === void 0 ? {} : { geometryFallback: Object.freeze({
813
+ source: Vn(r.source),
814
+ sourceRunIndex: r.boundary
815
+ }) }
816
+ });
817
+ }
818
+ function Wn(e, t) {
819
+ let n = e.flatMap(({ paragraph: e, source: n }, r) => {
820
+ let i = H(e, e.runs.length);
821
+ return [...t.get(k(n)) ?? []].sort((e, t) => e - t).map((e) => ({
822
+ paragraphIndex: r,
823
+ source: n,
824
+ boundary: e,
825
+ runCount: i
826
+ }));
827
+ });
828
+ return {
829
+ locations: n,
830
+ paragraphIndices: new Set(n.map(({ paragraphIndex: e }) => e))
831
+ };
832
+ }
833
+ function Gn(e, t) {
834
+ return e.paragraphIndex - t.paragraphIndex || e.boundary - t.boundary;
835
+ }
836
+ function Kn(e, t) {
837
+ let n = 0, r = e.length;
838
+ for (; n < r;) {
839
+ let i = n + Math.floor((r - n) / 2);
840
+ Gn(e[i], t) < 0 ? n = i + 1 : r = i;
841
+ }
842
+ return n;
843
+ }
844
+ function qn(e, t) {
845
+ if (t.paragraphIndices.has(e.paragraphIndex)) return;
846
+ let n = Kn(t.locations, e), r = t.locations[n], i = n > 0 ? t.locations[n - 1] : void 0;
847
+ return Hn(e).affinity === "following" ? r ?? i : i ?? r;
848
+ }
849
+ function Jn(e, t, n) {
850
+ let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
851
+ for (let e of t) {
852
+ let t = Bn(e);
853
+ t === void 0 || i.has(t) || (r.has(t) ? (r.delete(t), i.add(t)) : r.set(t, e));
854
+ }
855
+ let a = /* @__PURE__ */ new Map();
856
+ for (let [t, { paragraph: n, source: r }] of e.entries()) for (let e of n.commentMarks ?? []) {
857
+ let i = Bn(e.id);
858
+ if (i === void 0) continue;
859
+ let o = a.get(i) ?? {
860
+ starts: [],
861
+ ends: [],
862
+ references: []
863
+ };
864
+ a.set(i, o);
865
+ let s = {
866
+ paragraphIndex: t,
867
+ source: r,
868
+ boundary: H(n, e.runIndex),
869
+ runCount: H(n, n.runs.length)
870
+ };
871
+ e.kind === "rangeStart" ? o.starts.push(s) : e.kind === "rangeEnd" ? o.ends.push(s) : e.kind === "reference" && o.references.push(s);
872
+ }
873
+ let o = [], s = Wn(e, n);
874
+ for (let [t, n] of a) {
875
+ let i = r.get(t);
876
+ if (i === void 0 || n.references.length !== 1) continue;
877
+ let a = n.references[0];
878
+ if (n.starts.length > 1 || n.ends.length > 1) continue;
879
+ let c = n.starts.length === 1 ? n.starts[0] : void 0, l = n.ends.length === 1 ? n.ends[0] : void 0;
880
+ if (c && l && (c.paragraphIndex < l.paragraphIndex || c.paragraphIndex === l.paragraphIndex && c.boundary <= l.boundary)) {
881
+ let t = qn(c.paragraphIndex === l.paragraphIndex && c.boundary === l.boundary ? c : a, s);
882
+ for (let n = c.paragraphIndex; n <= l.paragraphIndex; n += 1) {
883
+ let r = e[n], s = n === c.paragraphIndex ? c.boundary : 0, u = n === l.paragraphIndex ? l.boundary : H(r.paragraph, r.paragraph.runs.length);
884
+ o.push(Un(i, {
885
+ paragraphIndex: n,
886
+ source: r.source,
887
+ boundary: s,
888
+ runCount: H(r.paragraph, r.paragraph.runs.length)
889
+ }, a, t, Math.max(s, u)));
890
+ }
891
+ continue;
892
+ }
893
+ let u = c && n.ends.length === 0 ? c : l && n.starts.length === 0 ? l : void 0;
894
+ if (c && l) continue;
895
+ let d = u ?? a, f = qn(d, s);
896
+ o.push(Un(i, d, a, f));
897
+ }
898
+ return o;
899
+ }
900
+ function Yn(e, t, n = /* @__PURE__ */ new Map()) {
901
+ let r = new Set(e.map(({ id: e }) => e)), i = /* @__PURE__ */ new Map();
902
+ for (let e of t.blocks.sources) {
903
+ let n = t.blocks.resolve(e);
904
+ if (n.type !== "paragraph") continue;
905
+ let r = `${e.story}\u0000${e.storyInstance}`, a = i.get(r) ?? [];
906
+ i.has(r) || i.set(r, a), a.push({
907
+ paragraph: n,
908
+ source: e
909
+ });
910
+ }
911
+ return [...i.values()].flatMap((e) => Jn(e, r, n));
912
+ }
913
+ function Xn(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
914
+ if ((e?.length ?? 0) === 0) return [];
915
+ let i = Yn(e ?? [], t, n), a = r.completedSourceKeys;
916
+ return a === void 0 ? i : i.filter((e) => {
917
+ let t = n.get(k(e.source)) ?? /* @__PURE__ */ new Set(), r = e.startRunIndex < e.endRunIndex ? [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) : t.has(e.reference.affinity === "following" ? e.startRunIndex : e.startRunIndex - 1), i = n.get(k(e.reference.source))?.has(e.reference.affinity === "following" ? e.reference.runIndex : e.reference.runIndex - 1) === !0;
918
+ return r || i || a.has(k(e.source)) || a.has(k(e.reference.source));
919
+ });
920
+ }
921
+ function U(e, t) {
922
+ return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
923
+ }
924
+ function W(e, t) {
925
+ let n = t.filter((t) => t.sourceRunIndex !== void 0 && U(t.source, e.source)), r = n.filter((t) => t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
926
+ if (r.length > 0) return r;
927
+ if (e.startRunIndex === e.endRunIndex && n.length > 0) {
928
+ let t = n.reduce((t, n) => {
929
+ let r = n.sourceRunIndex;
930
+ return r < e.startRunIndex ? t : t === void 0 || r < t ? r : t;
931
+ }, void 0), r = n.reduce((t, n) => {
932
+ let r = n.sourceRunIndex;
933
+ return r >= e.startRunIndex ? t : t === void 0 || r > t ? r : t;
934
+ }, void 0), i = t ?? r;
935
+ if (i !== void 0) return n.filter((e) => e.sourceRunIndex === i);
936
+ }
937
+ let i = t.filter((t) => t.sourceRunIndex !== void 0 && U(t.source, e.reference.source)), a = i.reduce((t, n) => {
938
+ let r = n.sourceRunIndex;
939
+ return r < e.reference.runIndex ? t : t === void 0 || r < t ? r : t;
940
+ }, void 0), o = i.reduce((t, n) => {
941
+ let r = n.sourceRunIndex;
942
+ return r >= e.reference.runIndex ? t : t === void 0 || r > t ? r : t;
943
+ }, void 0), s = e.reference.affinity === "following" ? a ?? o : o ?? a;
944
+ if (s !== void 0) return i.filter((e) => e.sourceRunIndex === s);
945
+ let c = e.geometryFallback;
946
+ return c === void 0 ? [] : t.filter((e) => e.sourceRunIndex === c.sourceRunIndex && U(e.source, c.source));
947
+ }
948
+ function Zn(e, t) {
949
+ return t.some((t) => t.sourceRunIndex !== void 0 && U(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex) ? "range" : t.some((t) => U(t.source, e.source) || U(t.source, e.reference.source)) ? "point" : "fallback";
950
+ }
951
+ function Qn(e) {
952
+ let t = e.map((e) => {
953
+ let t = e.highlightBounds;
954
+ return {
955
+ x: t?.x ?? e.x,
956
+ y: t?.y ?? e.y,
957
+ width: t?.width ?? e.w,
958
+ height: t?.height ?? e.h,
959
+ ...e.transform ? { transform: e.transform } : {}
960
+ };
961
+ }).filter(({ width: e, height: t }) => e > 0 && t > 0).sort((e, t) => e.y - t.y || e.x - t.x), n = [];
962
+ for (let e of t) {
963
+ let t = n.at(-1);
964
+ if (t && t.y === e.y && t.height === e.height && t.transform === e.transform) {
965
+ let r = Math.min(t.x, e.x), i = Math.max(t.x + t.width, e.x + e.width);
966
+ n[n.length - 1] = Object.freeze({
967
+ ...t,
968
+ x: r,
969
+ width: i - r
970
+ });
971
+ } else n.push(Object.freeze({ ...e }));
972
+ }
973
+ return Object.freeze(n);
974
+ }
975
+ function $n(e, t, n, r = {}) {
976
+ let i = new Map(e.map((e) => [e.id, e])), a = e.filter((e) => e.parentId === void 0), o = new Map(a.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map(), c = new Map(a.map((e) => [e.id, e.id]));
977
+ for (let t of e) {
978
+ if (t.parentId === void 0) continue;
979
+ let e = new Set([t.id]), n = t;
980
+ for (; n.parentId !== void 0;) {
981
+ let r = i.get(n.parentId);
982
+ if (!r || e.has(r.id)) {
983
+ n = t;
984
+ break;
985
+ }
986
+ e.add(r.id), n = r;
987
+ }
988
+ if (!o.has(n.id) || n === t) continue;
989
+ c.set(t.id, n.id);
990
+ let r = s.get(n.id) ?? [];
991
+ s.has(n.id) || s.set(n.id, r), r.push(t);
992
+ }
993
+ let l = /* @__PURE__ */ new Set();
994
+ for (let e of n) e.source && l.add(k(e.source));
995
+ let u = /* @__PURE__ */ new Map();
996
+ for (let e of t) {
997
+ let t = c.get(e.commentId);
998
+ if (t === void 0 || !(l.has(k(e.source)) || l.has(k(e.reference.source)) || e.geometryFallback !== void 0 && l.has(k(e.geometryFallback.source)))) continue;
999
+ let r = W(e, n);
1000
+ if (r.length === 0) continue;
1001
+ let i = u.get(t) ?? [];
1002
+ u.has(t) || u.set(t, i), i.push(Object.freeze({
1003
+ anchor: e,
1004
+ kind: Zn(e, r),
1005
+ rects: Qn(r)
1006
+ }));
1007
+ }
1008
+ return Object.freeze(a.flatMap((e) => {
1009
+ if (r.includeResolved === !1 && e.resolved === !0) return [];
1010
+ let t = u.get(e.id);
1011
+ return t?.length ? [Object.freeze({
1012
+ root: e,
1013
+ replies: Object.freeze([...s.get(e.id) ?? []]),
1014
+ anchors: Object.freeze([...t])
1015
+ })] : [];
1016
+ }));
1017
+ }
1018
+ function er(e) {
1019
+ let t = Bn(e.id);
1020
+ return t === void 0 ? void 0 : `${e.kind}\u0000${t}`;
1021
+ }
1022
+ function G(e) {
1023
+ return Object.freeze({
1024
+ ...e,
1025
+ path: Object.freeze([...e.path])
1026
+ });
1027
+ }
1028
+ function tr(e, t) {
1029
+ return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
1030
+ }
1031
+ function nr(e, t) {
1032
+ let n = 0, r = e.length;
1033
+ for (; n < r;) {
1034
+ let i = n + Math.floor((r - n) / 2);
1035
+ e[i] < t ? n = i + 1 : r = i;
1036
+ }
1037
+ return n;
1038
+ }
1039
+ function rr(e, t) {
1040
+ let n = Array(e.length), r;
1041
+ for (let i = e.length - 1; i >= 0; --i) {
1042
+ n[i] = r;
1043
+ let a = e[i], o = t.get(k(a.source))?.[0];
1044
+ o !== void 0 && (r = Object.freeze({
1045
+ source: G(a.source),
1046
+ sourceRunIndex: o
1047
+ }));
1048
+ }
1049
+ let i = Array(e.length), a;
1050
+ for (let n = 0; n < e.length; n += 1) {
1051
+ i[n] = a;
1052
+ let r = e[n], o = t.get(k(r.source))?.at(-1);
1053
+ o !== void 0 && (a = Object.freeze({
1054
+ source: G(r.source),
1055
+ sourceRunIndex: o
1056
+ }));
1057
+ }
1058
+ return {
1059
+ following: n,
1060
+ preceding: i
1061
+ };
1062
+ }
1063
+ function ir(e, t, n, r, i, a) {
1064
+ let o = r[e], s = i.get(k(o.source)) ?? [], c = s[nr(s, n)], l = s[nr(s, t) - 1], u = c ?? l;
1065
+ return u === void 0 ? a.following[e] ?? a.preceding[e] : Object.freeze({
1066
+ source: G(o.source),
1067
+ sourceRunIndex: u
1068
+ });
1069
+ }
1070
+ function ar(e, t, n = /* @__PURE__ */ new Map()) {
1071
+ let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
1072
+ e.forEach((e, t) => {
1073
+ let n = er(e);
1074
+ n === void 0 || i.has(n) || (r.has(n) ? (r.delete(n), i.add(n)) : r.set(n, t));
1075
+ });
1076
+ let a = t.blocks.sources.flatMap((e) => {
1077
+ if (e.story !== "body") return [];
1078
+ let n = t.blocks.resolve(e);
1079
+ return n.type === "paragraph" ? [{
1080
+ source: e,
1081
+ runs: n.runs
1082
+ }] : [];
1083
+ }), o = new Map([...n].map(([e, t]) => [e, Object.freeze([...t].sort((e, t) => e - t))])), s = rr(a, o), c = [];
1084
+ for (let [e, t] of a.entries()) {
1085
+ let n = 0;
1086
+ for (; n < t.runs.length;) {
1087
+ let i = t.runs[n], l = i.revision?.kind ? er({
1088
+ kind: i.revision.kind,
1089
+ id: i.revision.id
1090
+ }) : void 0, u = l === void 0 ? void 0 : r.get(l);
1091
+ if (u === void 0) {
1092
+ n += 1;
1093
+ continue;
1094
+ }
1095
+ let d = n;
1096
+ for (n += 1; n < t.runs.length;) {
1097
+ let e = t.runs[n].revision;
1098
+ if (!e?.kind || er({
1099
+ kind: e.kind,
1100
+ id: e.id
1101
+ }) !== l) break;
1102
+ n += 1;
1103
+ }
1104
+ let f = n, p = o.get(k(t.source)) ?? [], m = (p[nr(p, d)] ?? f) < f ? void 0 : ir(e, d, f, a, o, s);
1105
+ c.push(Object.freeze({
1106
+ revisionIndex: u,
1107
+ source: G(t.source),
1108
+ startRunIndex: d,
1109
+ endRunIndex: f,
1110
+ ...m === void 0 ? {} : { geometryFallback: m }
1111
+ }));
1112
+ }
1113
+ }
1114
+ return c;
1115
+ }
1116
+ function or(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
1117
+ if ((e?.length ?? 0) === 0) return [];
1118
+ let i = ar(e ?? [], t, n), a = r.completedSourceKeys;
1119
+ return a === void 0 ? i : i.filter((e) => {
1120
+ let t = n.get(k(e.source));
1121
+ return t !== void 0 && [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) || a.has(k(e.source));
1122
+ });
1123
+ }
1124
+ function sr(e, t) {
1125
+ let n = t.filter((t) => t.sourceRunIndex !== void 0 && tr(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
1126
+ if (n.length > 0) return n;
1127
+ let r = e.geometryFallback;
1128
+ return r === void 0 ? [] : t.filter((e) => e.sourceRunIndex === r.sourceRunIndex && tr(e.source, r.source));
1129
+ }
1130
+ var cr = 12;
1131
+ async function lr(e, t, n, r = {}) {
1132
+ let { onPreview: i, scheduler: a } = r;
1133
+ return Ue(it(e, t, n, i && e.sequence.length > cr ? { onPages: (e, t) => {
1134
+ i(Object.freeze({
1135
+ layout: e,
1136
+ exact: !1,
1137
+ coveredEntries: t
1138
+ }));
1139
+ } } : void 0), a);
1140
+ }
1141
+ var K = /* @__PURE__ */ new WeakMap();
1142
+ function q(e, t) {
1143
+ let n = Object.freeze({ ...t });
1144
+ for (let t of [...K.get(e) ?? []]) try {
1145
+ t.notify(n);
1146
+ } catch (e) {
1147
+ try {
1148
+ t.report(e);
1149
+ } catch {}
1150
+ }
1151
+ }
1152
+ function ur(e, t, n, r) {
1153
+ let i = K.get(e);
1154
+ i || (i = /* @__PURE__ */ new Set(), K.set(e, i));
1155
+ let a = Object.freeze({
1156
+ notify: n,
1157
+ report: r
1158
+ });
1159
+ i.add(a);
1160
+ try {
1161
+ n(Object.freeze({ ...t() }));
1162
+ } catch (e) {
1163
+ try {
1164
+ r(e);
1165
+ } catch {}
1166
+ }
1167
+ return () => {
1168
+ i?.delete(a), i?.size === 0 && K.delete(e);
1169
+ };
1170
+ }
1171
+ function dr(e, t) {
1172
+ if (!e) return 0;
1173
+ let n = Math.min(e.length, t.length), r = 0;
1174
+ for (; r < n && fr(e[r], t[r]);) r += 1;
1175
+ return r;
1176
+ }
1177
+ function fr(e, t) {
1178
+ if (e === t) return !0;
1179
+ if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
1180
+ if (Array.isArray(e)) {
1181
+ if (!Array.isArray(t) || e.length !== t.length) return !1;
1182
+ for (let n = 0; n < e.length; n += 1) if (!fr(e[n], t[n])) return !1;
1183
+ return !0;
1184
+ }
1185
+ if (Array.isArray(t)) return !1;
1186
+ let n = Object.keys(e);
1187
+ if (n.length !== Object.keys(t).length) return !1;
1188
+ for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !fr(e[r], t[r])) return !1;
1189
+ return !0;
1190
+ }
1191
+ var J = /* @__PURE__ */ new WeakMap(), pr = /* @__PURE__ */ new WeakMap(), mr = Symbol("docxLayoutViewRequester");
1192
+ function Y(e) {
1193
+ let t = A(e), n = t.activeLayoutOptions;
1194
+ return {
1195
+ showTrackedChanges: n?.showTrackedChanges === !0,
1196
+ currentDate: n?.currentDateMs ?? t.defaultCurrentDateMs
1197
+ };
1198
+ }
1199
+ async function X(e, t, n) {
1200
+ let r = A(e), i = M(t.currentDate, r.defaultCurrentDateMs, t.showTrackedChanges === !0), a = Object.freeze({
1201
+ showTrackedChanges: i.showTrackedChanges === !0,
1202
+ currentDate: i.currentDateMs
1203
+ }), o = {
1204
+ showTrackedChanges: a.showTrackedChanges,
1205
+ currentDate: a.currentDate,
1206
+ [mr]: n
1207
+ };
1208
+ await e.setLayoutView(o);
1209
+ let s = Y(e);
1210
+ return s.currentDate === a.currentDate && s.showTrackedChanges === a.showTrackedChanges;
1211
+ }
1212
+ async function hr(e, t, n, r, i) {
1213
+ let a = !1, o = () => {
1214
+ a || (a = !0, e.destroy());
1215
+ };
1216
+ try {
1217
+ for (; !t.aborted;) {
1218
+ let a = n();
1219
+ if (a === void 0 || Y(e).showTrackedChanges === a) break;
1220
+ t.addEventListener("abort", o, { once: !0 });
1221
+ try {
1222
+ await X(e, {
1223
+ showTrackedChanges: a,
1224
+ currentDate: r()
1225
+ }, i);
1226
+ } finally {
1227
+ t.removeEventListener("abort", o);
1228
+ }
1229
+ }
1230
+ } catch (e) {
1231
+ throw o(), e;
1232
+ }
1233
+ }
1234
+ function gr(e, t) {
1235
+ let n = Object.freeze({ ...Y(e) }), r = (pr.get(e) ?? 0) + 1;
1236
+ pr.set(e, r);
1237
+ let i = Object.freeze({
1238
+ view: n,
1239
+ generation: r,
1240
+ requester: t
1241
+ });
1242
+ for (let t of [...J.get(e) ?? []]) try {
1243
+ t.notify(i);
1244
+ } catch (e) {
1245
+ try {
1246
+ t.report(e);
1247
+ } catch {}
1248
+ }
1249
+ }
1250
+ function _r(e, t, n) {
1251
+ let r = J.get(e);
1252
+ r || (r = /* @__PURE__ */ new Set(), J.set(e, r));
1253
+ let i = Object.freeze({
1254
+ notify: t,
1255
+ report: n
1256
+ });
1257
+ return r.add(i), () => {
1258
+ r?.delete(i), r?.size === 0 && J.delete(e);
1259
+ };
1260
+ }
1261
+ var vr = Symbol("docxViewerLoadSignal");
1262
+ function yr(e, t) {
1263
+ return e !== null && e.currentDateMs === t.currentDateMs && e.showTrackedChanges === !0 == (t.showTrackedChanges === !0);
1264
+ }
1265
+ var br = Object.freeze([]), xr = Object.freeze([]), Sr = Object.freeze({
1266
+ comments: Object.freeze([]),
1267
+ revisions: Object.freeze([])
1268
+ });
1269
+ function Z(e, t) {
1270
+ return Pe({
1271
+ comments: e,
1272
+ revisions: t
1273
+ }, "DOCX review metadata");
1274
+ }
1275
+ var Q = class e {
1276
+ get diagnostics() {
1277
+ return Pe([
1278
+ ...this._mode === "worker" ? this._meta?.diagnostics ?? [] : this._getLayout()?.diagnostics ?? [],
1279
+ ...this._meta?.resourceDiagnostics ?? [],
1280
+ ...ln(this)
1281
+ ], "DOCX diagnostics");
1282
+ }
1283
+ _metrics = null;
1284
+ _cjkFallback = "jp";
1285
+ _allowFootnoteContinuation = !1;
1286
+ _document = null;
1287
+ _source = null;
1288
+ _meta = null;
1289
+ _review = Sr;
1290
+ _layoutLifecycle = new ae();
1291
+ _layoutObservers = new De();
1292
+ _layoutCompletion = null;
1293
+ _layoutAbort = null;
1294
+ _bookmarkPages = null;
1295
+ _commentAnchorRanges = null;
1296
+ _revisionAnchorRanges = null;
1297
+ _reviewProjectionIndex = null;
1298
+ _parseRequestId = null;
1299
+ _progressive = null;
1300
+ _parseWatchdog;
1301
+ _parseWatchdogMs;
1302
+ _layoutViewGeneration = 0;
1303
+ _mode = "main";
1304
+ _threeD;
1305
+ _regionMap;
1306
+ _chartEx;
1307
+ _tiff;
1308
+ _worker;
1309
+ _bridge;
1310
+ _rawParts = new ee({
1311
+ maxEntries: 64,
1312
+ maxBytes: _
1313
+ });
1314
+ _embeddedFontFaces = [];
1315
+ _officeFontFaces = [];
1316
+ _mainThreadFallbackReason = "vertical";
1317
+ _nativeRouteFaces = [];
1318
+ _nativeRouteFacesReleased = !1;
1319
+ _googleFontFaces = [];
1320
+ _fetchImage = (e, t) => this.getImage(e, t);
1321
+ constructor(e, t, n, r) {
1322
+ this._worker = e, this._mode = t, Fe(this, n), this._bridge = new dt(this._worker, {
1323
+ correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
1324
+ onUnsolicited: (e) => this._onWorkerLayoutPush(e),
1325
+ toError: (e) => {
1326
+ if (!("protocol" in e || e.type !== "error")) return Object.assign(p(e), {
1327
+ ...e.reason === void 0 ? {} : { reason: e.reason },
1328
+ ...e.outgoingColumnIndex === void 0 ? {} : { outgoingColumnIndex: e.outgoingColumnIndex },
1329
+ ...e.outgoingColumnCount === void 0 ? {} : { outgoingColumnCount: e.outgoingColumnCount },
1330
+ ...e.incomingColumnCount === void 0 ? {} : { incomingColumnCount: e.incomingColumnCount }
1331
+ });
1332
+ }
1333
+ });
1334
+ let i = new URL(r ?? pn, location.href).href;
1335
+ this._bridge.post({
1336
+ type: "init",
1337
+ wasmUrl: i
1338
+ });
1339
+ }
1340
+ static async load(t, n = {}) {
1341
+ let r = n[vr], i = r?.signal, l = () => {
1342
+ if (i?.aborted) throw new N();
1343
+ };
1344
+ if (l(), n.legacyDoc !== void 0) {
1345
+ let { loadDocxModelSource: e } = await import("ooxml/document-model-source-BUTSwkyP.js"), a = await e(t, n, r);
1346
+ if (i?.aborted) throw a.destroy(), new N();
1347
+ return a;
1348
+ }
1349
+ let u = S(n.cjkFallback), p = d(n), h = Date.now(), g = n.mode ?? "main", _ = new v({
1350
+ enabled: !0,
1351
+ format: "docx",
1352
+ mode: g,
1353
+ policy: p.policy,
1354
+ onMetrics: p.onResourceMetrics,
1355
+ emitToConsole: p.debug
1356
+ });
1357
+ try {
1358
+ if (g === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
1359
+ let d;
1360
+ if (typeof t == "string") {
1361
+ let e = await fetch(t, { signal: i });
1362
+ if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
1363
+ d = await e.arrayBuffer();
1364
+ } else d = t;
1365
+ l(), d = a(await o(d, n.password)), l(), _.setSourceBytes(d.byteLength), _.checkpoint("container ready");
1366
+ let v = g === "worker" ? (await import("ooxml/render-worker-host-DjBotZNL.js")).createRenderWorker() : new fn(), y = g === "worker" ? jt(n) : void 0, b = g === "worker" && !!n.progressiveLayout, x, S = !1, ee = () => {
1367
+ S || !x || (S = !0, x.destroy());
1368
+ };
1369
+ try {
1370
+ x = new e(v, g, h, n.wasmUrl), i?.addEventListener("abort", ee, { once: !0 }), l(), x._metrics = _, x._cjkFallback = u, x._allowFootnoteContinuation = n.allowFootnoteContinuation !== !1;
1371
+ let t = A(x), a = M(n.currentDate, t.defaultCurrentDateMs, n.showTrackedChanges === !0);
1372
+ t.activeLayoutOptions = a, await x._parse(d, p.policy, g === "worker" ? !!n.useGoogleFonts : !1, n.workerTimeoutMs, (e) => _.observeUsage(e), y, b ? {
1373
+ onPartial: n.onLayoutPartial,
1374
+ onComplete: n.onLayoutComplete,
1375
+ onProgress: n.onLayoutProgress,
1376
+ layoutOptions: a,
1377
+ abort: new AbortController(),
1378
+ firstPublication: ce(),
1379
+ published: !1,
1380
+ settled: !1
1381
+ } : void 0), l(), g === "worker" && x._mode === "main" && (_.setMode("main"), console.warn(mn(x._mainThreadFallbackReason))), n.math && x._mode === "worker" && !y?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), n.threeD && x._mode === "worker" && !y?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), x._threeD = x._mode === "worker" ? void 0 : n.threeD, n.regionMap && x._mode === "worker" && !y?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), x._regionMap = x._mode === "worker" ? void 0 : n.regionMap, n.chartEx && x._mode === "worker" && !y?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), x._chartEx = x._mode === "worker" ? void 0 : n.chartEx, n.tiff && x._mode === "worker" && !y?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them."), x._tiff = x._mode === "worker" ? void 0 : n.tiff;
1382
+ let o, S, C = x, te = x._mode === "main" && x._document && x._source ? Ke(tt(x._source, x._document, {
1383
+ useGoogleFonts: !!n.useGoogleFonts,
1384
+ cjkFallback: u
1385
+ }), !0).then((e) => C._nativeRouteFacesReleased ? (m(e.faces), null) : (C._nativeRouteFaces.push(...e.faces), e), () => null) : null;
1386
+ if (x._mode === "main" && x._document?.embeddedFonts?.length) {
1387
+ let e = x, t = await xn(x._document, (t) => e.getFontBytes(t));
1388
+ if (i?.aborted) throw E(t.faces), new N();
1389
+ L(x, t.diagnostics), x._embeddedFontFaces = t.faces, o = t.metrics, S = t.routes;
1390
+ }
1391
+ let w = x._mode === "main" && x._document ? await sn(Qe(x._document, {
1392
+ useGoogleFonts: n.useGoogleFonts,
1393
+ cjkFallback: u
1394
+ }).filter((e) => e.presenceOnly || !S?.some((t) => t.requestedFamily.toLowerCase() === e.family.toLowerCase() && t.weight === (e.weight ?? 400) && t.style === (e.style ?? "normal")))) : {
1395
+ faces: [],
1396
+ routes: {}
1397
+ };
1398
+ if (i?.aborted) throw m(w.faces), new N();
1399
+ x._officeFontFaces = w.faces;
1400
+ let ne = [];
1401
+ if (x._mode === "main" && n.useGoogleFonts && x._document) {
1402
+ let e = Ge(x._document, u, w);
1403
+ ne = e.installedSubstituteFamilies;
1404
+ let t = await s(e.names, Ve);
1405
+ if (i?.aborted) throw f(t), new N();
1406
+ x._googleFontFaces = t;
1407
+ }
1408
+ let T;
1409
+ if (x._mode === "main" && n.math && x._document && Ze(x._document) && (T = await $e(x._document, n.math)), l(), x._mode === "main" && x._document && x._source) {
1410
+ let e = x, t = A(x), a = {
1411
+ allowFootnoteContinuation: x._allowFootnoteContinuation,
1412
+ fontMetrics: o,
1413
+ useGoogleFonts: !!n.useGoogleFonts,
1414
+ cjkFallback: u,
1415
+ embeddedRoutes: S,
1416
+ officeRoutes: Object.values(w.routes),
1417
+ googleFaces: x._googleFontFaces,
1418
+ installedSubstituteFamilies: ne,
1419
+ installedFamilies: "installed" in w ? w.installed : void 0,
1420
+ mathResources: T?.records,
1421
+ mathDrawables: T?.drawables
1422
+ }, s = await te;
1423
+ l(), t.services = Je(x._source, {
1424
+ ...a,
1425
+ nativeRouteMetrics: s && s.faces.length > 0 ? Ye(s.lines, c()) : void 0
1426
+ });
1427
+ let d = t.services, f = He(x._source, d, t.defaultCurrentDateMs), p = x._source.fatalParse === null, m = t.activeLayoutOptions;
1428
+ if (!m) throw Error("Active layout view was not recorded at load");
1429
+ let h = { onProgress: n.onLayoutProgress ? (t) => e._layoutObservers.notify("onLayoutProgress", n.onLayoutProgress, { committedUnits: t }) : void 0 };
1430
+ if (p && n.progressiveLayout) {
1431
+ let e = f.layoutVariants, t = x, r = new AbortController();
1432
+ t._layoutAbort = r;
1433
+ let i = ce(), a = null, o = !0;
1434
+ t._layoutCompletion = lr(x._source.bodyLayoutInput, d, m, {
1435
+ scheduler: {
1436
+ ...h,
1437
+ signal: r.signal
1438
+ },
1439
+ onPreview: (r) => {
1440
+ if (!o) return;
1441
+ let s = a === null, c = dr(a?.pages, r.layout.pages), l = t._replaceMainLayoutPublication(e, m, a, r.layout);
1442
+ if (l === null) {
1443
+ o = !1;
1444
+ return;
1445
+ }
1446
+ if (a = l, s) t._layoutLifecycle.begin(), q(t, {
1447
+ pageCount: r.layout.pages.length,
1448
+ exact: r.exact,
1449
+ complete: !1
1450
+ }), i.resolve();
1451
+ else {
1452
+ if (!t._isLayoutViewActive(m)) return;
1453
+ q(t, {
1454
+ pageCount: r.layout.pages.length,
1455
+ exact: r.exact,
1456
+ complete: !1,
1457
+ unchangedPages: c
1458
+ }), t._layoutObservers.notify("onLayoutPartial", n.onLayoutPartial, {
1459
+ availableUnits: r.layout.pages.length,
1460
+ exact: r.exact
1461
+ });
1462
+ }
1463
+ }
1464
+ }).then((r) => {
1465
+ let s;
1466
+ o && (s = dr(a?.pages, r.pages), t._replaceMainLayoutPublication(e, m, a, r) === null && (o = !1)), t._layoutLifecycle.succeed(), q(t, {
1467
+ pageCount: t.pageCount,
1468
+ exact: !0,
1469
+ complete: !0,
1470
+ ...o && t._isLayoutViewActive(m) && s !== void 0 ? { unchangedPages: s } : {}
1471
+ }), t._layoutObservers.notify("onLayoutComplete", n.onLayoutComplete), i.resolve();
1472
+ }).catch((e) => {
1473
+ if (a === null) {
1474
+ i.reject(e);
1475
+ return;
1476
+ }
1477
+ if (e instanceof N) {
1478
+ t._layoutLifecycle.succeed();
1479
+ return;
1480
+ }
1481
+ let r = t._layoutLifecycle.fail(e);
1482
+ q(t, {
1483
+ pageCount: t.pageCount,
1484
+ exact: !1,
1485
+ complete: !1,
1486
+ error: r
1487
+ }), t._layoutObservers.notify("onLayoutComplete", n.onLayoutComplete, r);
1488
+ }), await i.promise;
1489
+ } else if (p && (n.sliceLayout !== !1 || n.onLayoutProgress)) for (;;) {
1490
+ l();
1491
+ let e = r?.requestedView(), a = e === void 0 ? m : M(n.currentDate, t.defaultCurrentDateMs, e);
1492
+ t.activeLayoutOptions = a;
1493
+ let o = new AbortController(), s = !1, c = r?.subscribeViewChange(() => {
1494
+ let e = r.requestedView();
1495
+ s || e === void 0 || e === !0 == (a.showTrackedChanges === !0) || (s = !0, o.abort());
1496
+ });
1497
+ x._layoutAbort = o;
1498
+ try {
1499
+ let e = await nt(x._source.bodyLayoutInput, d, a, {
1500
+ ...h,
1501
+ signal: o.signal
1502
+ });
1503
+ if (l(), s) continue;
1504
+ f.layoutVariants.prime(a, e);
1505
+ break;
1506
+ } catch (e) {
1507
+ if (e instanceof N && s && !i?.aborted) continue;
1508
+ throw e;
1509
+ } finally {
1510
+ c?.(), x._layoutAbort = null;
1511
+ }
1512
+ }
1513
+ else f.layoutVariants.layoutFor(m);
1514
+ }
1515
+ return l(), await x._resourceUsage(n.workerTimeoutMs ?? 1e3).then((e) => _.observeUsage(e), () => void 0), _.checkpoint("model and layout ready"), l(), _.succeed({ pages: x.pageCount }), x;
1516
+ } catch (e) {
1517
+ throw ft(v, x ? ee : void 0), e;
1518
+ } finally {
1519
+ i?.removeEventListener("abort", ee);
1520
+ }
1521
+ } catch (e) {
1522
+ throw _.fail(e), e;
1523
+ }
1524
+ }
1525
+ async _parse(e, t, n = !1, r, i, a, o) {
1526
+ if (o) {
1527
+ await this._parseProgressively(e, t, n, r, i, a, o);
1528
+ return;
1529
+ }
1530
+ let s = await this._bridge.request((r) => (this._parseRequestId = r, this._mode === "worker" ? {
1531
+ type: "parse",
1532
+ id: r,
1533
+ data: e,
1534
+ resourcePolicy: t,
1535
+ useGoogleFonts: n,
1536
+ allowFootnoteContinuation: this._allowFootnoteContinuation,
1537
+ cjkFallback: this._cjkFallback,
1538
+ defaultCurrentDateMs: A(this).defaultCurrentDateMs,
1539
+ ...this._parseViewFields(),
1540
+ renderers: a
1541
+ } : {
1542
+ type: "parse",
1543
+ id: r,
1544
+ data: e,
1545
+ resourcePolicy: t
1546
+ }), [e], { timeoutMs: r });
1547
+ if (this._parseRequestId = null, "protocol" in s) throw Error("DOCX parse open returned a pull-protocol response");
1548
+ if (this._mode === "worker") if ("usage" in s && s.usage && i?.(s.usage), s.type === "mainThreadVerticalFallback") {
1549
+ let e = await Xe(this._bridge.transport(et), s, {
1550
+ timeoutMs: r,
1551
+ onUsage: i
1552
+ });
1553
+ this._source = e.source, this._document = e.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = s.reason ?? "vertical";
1554
+ } else this._meta = s.meta;
1555
+ else {
1556
+ let e = s, t = await Xe(this._bridge.transport(et), e, {
1557
+ timeoutMs: r,
1558
+ onUsage: i
1559
+ });
1560
+ this._source = t.source, this._document = t.document;
1561
+ }
1562
+ this._review = Z(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []);
1563
+ }
1564
+ _onWorkerLayoutPush(e) {
1565
+ if (Ot((e, t) => this._worker.postMessage(e, t), e) || !("forId" in e) || e.forId !== this._parseRequestId) return;
1566
+ if (this._rearmParseWatchdog(), e.type === "measureHostFontLines") {
1567
+ nn(e.routes).catch(() => []).then((t) => {
1568
+ e.forId === this._parseRequestId && this._worker.postMessage({
1569
+ type: "hostFontLinesMeasured",
1570
+ forId: e.forId,
1571
+ measurements: t
1572
+ });
1573
+ });
1574
+ return;
1575
+ }
1576
+ if (e.type === "measureNativeRouteLines") {
1577
+ Ke(e.requests, !1).then((e) => e.lines, () => e.requests.map(() => null)).then((t) => {
1578
+ e.forId === this._parseRequestId && this._worker.postMessage({
1579
+ type: "nativeRouteLinesMeasured",
1580
+ forId: e.forId,
1581
+ lines: t
1582
+ });
1583
+ });
1584
+ return;
1585
+ }
1586
+ let t = this._progressive;
1587
+ if (t?.settled) return;
1588
+ if (e.type === "layoutProgress") {
1589
+ this._layoutObservers.notify("onLayoutProgress", t?.onProgress, { committedUnits: e.committedPages });
1590
+ return;
1591
+ }
1592
+ if (e.type !== "layoutPartial" || !t) return;
1593
+ let n = !t.published || this._isLayoutViewActive(t.layoutOptions);
1594
+ if (n && this._applyLayoutPartial(e.partial), t.published) {
1595
+ if (!n) return;
1596
+ q(this, {
1597
+ pageCount: e.partial.pageCount,
1598
+ exact: e.partial.exact,
1599
+ complete: !1,
1600
+ ...e.partial.unchangedPages === void 0 ? {} : { unchangedPages: e.partial.unchangedPages }
1601
+ }), this._layoutObservers.notify("onLayoutPartial", t.onPartial, {
1602
+ availableUnits: e.partial.pageCount,
1603
+ exact: e.partial.exact
1604
+ });
1605
+ return;
1606
+ }
1607
+ t.published = !0, this._layoutLifecycle.begin(), q(this, {
1608
+ pageCount: e.partial.pageCount,
1609
+ exact: e.partial.exact,
1610
+ complete: !1
1611
+ }), t.firstPublication.resolve();
1612
+ }
1613
+ _applyLayoutPartial(e) {
1614
+ let t = e.review ?? this._meta;
1615
+ this._meta = {
1616
+ pageCount: e.pageCount,
1617
+ pageSizes: e.pageSizes,
1618
+ bookmarkPages: e.bookmarkPages,
1619
+ revisions: t?.revisions ?? [],
1620
+ comments: t?.comments ?? [],
1621
+ footnotes: t?.footnotes ?? [],
1622
+ endnotes: t?.endnotes ?? [],
1623
+ diagnostics: e.diagnostics,
1624
+ resourceDiagnostics: e.review?.resourceDiagnostics ?? this._meta?.resourceDiagnostics,
1625
+ commentAnchorRanges: e.commentAnchorRanges,
1626
+ revisionAnchorRanges: e.revisionAnchorRanges
1627
+ }, e.review && (this._review = Z(e.review.comments, e.review.revisions)), this._invalidateLayoutDerivedCaches();
1628
+ }
1629
+ _onAuthoritativeMeta(e, t) {
1630
+ this._clearParseWatchdog();
1631
+ let n = this._progressive;
1632
+ if (n?.settled) return;
1633
+ let r = n !== null && this._meta !== null && this._isLayoutViewActive(n.layoutOptions);
1634
+ if (!n || this._isLayoutViewActive(n.layoutOptions) || !this._meta) this._meta = e;
1635
+ else {
1636
+ let t = this._meta;
1637
+ this._meta = {
1638
+ ...e,
1639
+ diagnostics: t.diagnostics,
1640
+ pageCount: t.pageCount,
1641
+ pageSizes: t.pageSizes,
1642
+ bookmarkPages: t.bookmarkPages,
1643
+ commentAnchorRanges: t.commentAnchorRanges,
1644
+ revisionAnchorRanges: t.revisionAnchorRanges
1645
+ };
1646
+ }
1647
+ this._invalidateLayoutDerivedCaches(), this._review = Z(e.comments, e.revisions), n && (n.settled = !0, this._layoutLifecycle.succeed(), q(this, {
1648
+ pageCount: this.pageCount,
1649
+ exact: !0,
1650
+ complete: !0,
1651
+ ...r && t !== void 0 ? { unchangedPages: t } : {}
1652
+ }), n.firstPublication.resolve(), this._layoutObservers.notify("onLayoutComplete", n.onComplete));
1653
+ }
1654
+ _invalidateLayoutDerivedCaches() {
1655
+ this._bookmarkPages = null, this._commentAnchorRanges = null, this._revisionAnchorRanges = null, this._reviewProjectionIndex = null;
1656
+ }
1657
+ _replaceMainLayoutPublication(e, t, n, r) {
1658
+ let i = e.replaceIfCurrent(t, n, r);
1659
+ return i !== null && this._isLayoutViewActive(t) && this._invalidateLayoutDerivedCaches(), i;
1660
+ }
1661
+ _isLayoutViewActive(e) {
1662
+ return yr(A(this).activeLayoutOptions, e);
1663
+ }
1664
+ _rearmParseWatchdog() {
1665
+ this._parseWatchdogMs !== void 0 && (clearTimeout(this._parseWatchdog), this._parseWatchdog = setTimeout(() => this._onParseWentSilent(), this._parseWatchdogMs));
1666
+ }
1667
+ _clearParseWatchdog() {
1668
+ clearTimeout(this._parseWatchdog), this._parseWatchdog = void 0, this._parseWatchdogMs = void 0;
1669
+ }
1670
+ _onParseWentSilent() {
1671
+ let e = this._progressive, t = this._parseWatchdogMs;
1672
+ this._clearParseWatchdog();
1673
+ let n = /* @__PURE__ */ Error(`worker layout produced no progress for ${t}ms`);
1674
+ e && this._failWorkerProgressive(e, n), this._bridge.terminate();
1675
+ }
1676
+ _failWorkerProgressive(e, t) {
1677
+ if (e.settled) return;
1678
+ if (e.settled = !0, this._clearParseWatchdog(), !e.published) {
1679
+ e.firstPublication.reject(t);
1680
+ return;
1681
+ }
1682
+ let n = this._layoutLifecycle.fail(t);
1683
+ q(this, {
1684
+ pageCount: this.pageCount,
1685
+ exact: !1,
1686
+ complete: !1,
1687
+ error: n
1688
+ }), this._layoutObservers.notify("onLayoutComplete", e.onComplete, n);
1689
+ }
1690
+ _parseViewFields() {
1691
+ let e = A(this), t = e.activeLayoutOptions;
1692
+ return t ? {
1693
+ ...t.currentDateMs === e.defaultCurrentDateMs ? {} : { currentDateMs: t.currentDateMs },
1694
+ ...t.showTrackedChanges === !0 ? { showTrackedChanges: !0 } : {}
1695
+ } : {};
1696
+ }
1697
+ async _parseProgressively(e, t, n, r, i, a, o) {
1698
+ this._progressive = o, this._layoutAbort = o.abort, this._parseWatchdogMs = r;
1699
+ let s = this._bridge.request((r) => (this._parseRequestId = r, {
1700
+ type: "parse",
1701
+ id: r,
1702
+ data: e,
1703
+ resourcePolicy: t,
1704
+ useGoogleFonts: n,
1705
+ allowFootnoteContinuation: this._allowFootnoteContinuation,
1706
+ cjkFallback: this._cjkFallback,
1707
+ defaultCurrentDateMs: A(this).defaultCurrentDateMs,
1708
+ ...this._parseViewFields(),
1709
+ renderers: a,
1710
+ progressiveLayout: !0
1711
+ }), [e], { timeoutMs: !1 });
1712
+ this._layoutCompletion = s.then(async (e) => {
1713
+ if (this._parseRequestId = null, "protocol" in e) throw Error("DOCX parse open returned a pull-protocol response");
1714
+ if ("usage" in e && e.usage && i?.(e.usage), e.type === "mainThreadVerticalFallback") {
1715
+ this._clearParseWatchdog(), o.settled = !0, this._progressive = null, this._layoutAbort = null;
1716
+ let t = await Xe(this._bridge.transport(et), e, {
1717
+ timeoutMs: r,
1718
+ onUsage: i
1719
+ });
1720
+ this._source = t.source, this._document = t.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = e.reason ?? "vertical", this._review = Z(t.document.comments ?? [], t.document.revisions ?? []), o.firstPublication.resolve();
1721
+ return;
1722
+ }
1723
+ let t = e;
1724
+ this._onAuthoritativeMeta(t.meta, t.unchangedPages);
1725
+ }, (e) => {
1726
+ if (this._parseRequestId = null, this._clearParseWatchdog(), !o.settled) {
1727
+ if (o.abort.signal.aborted) {
1728
+ o.settled = !0, this._layoutLifecycle.succeed(), o.firstPublication.resolve();
1729
+ return;
1730
+ }
1731
+ this._failWorkerProgressive(o, e);
1732
+ }
1733
+ }), this._rearmParseWatchdog(), await o.firstPublication.promise;
1734
+ }
1735
+ destroy() {
1736
+ this._layoutAbort?.abort(), this._layoutAbort = null, this._clearParseWatchdog(), this._parseRequestId = null, this._progressive = null, this._layoutViewGeneration++, this._bridge.terminate(), this._document = null, this._source = null, this._meta = null, this._review = Sr, A(this).services = null, this._bookmarkPages = null, this._commentAnchorRanges = null, this._revisionAnchorRanges = null, this._reviewProjectionIndex = null, this._rawParts.clear(), this._embeddedFontFaces.length > 0 && (E(this._embeddedFontFaces), this._embeddedFontFaces = []), this._officeFontFaces.length > 0 && (m(this._officeFontFaces), this._officeFontFaces = []), this._nativeRouteFacesReleased = !0, this._nativeRouteFaces?.length > 0 && (m(this._nativeRouteFaces), this._nativeRouteFaces = []), this._googleFontFaces.length > 0 && (f(this._googleFontFaces), this._googleFontFaces = []), y(this._fetchImage), x(this._fetchImage);
1737
+ }
1738
+ async getImage(e, t) {
1739
+ return this._rawParts.get(e, t, () => this._bridge.request((t) => ({
1740
+ type: "extractImage",
1741
+ id: t,
1742
+ path: e
1743
+ })).then((e) => {
1744
+ let n = e.bytes;
1745
+ return new Blob([n], { type: t });
1746
+ }));
1747
+ }
1748
+ async getFontBytes(e) {
1749
+ let t = (await this._bridge.request((t) => ({
1750
+ type: "extractImage",
1751
+ id: t,
1752
+ path: e
1753
+ }))).bytes;
1754
+ return new Uint8Array(t);
1755
+ }
1756
+ async _resourceUsage(e) {
1757
+ return (await this._bridge.request((e) => ({
1758
+ type: "resourceUsage",
1759
+ id: e
1760
+ }), void 0, { timeoutMs: e })).usage;
1761
+ }
1762
+ async getResourceMetrics() {
1763
+ let e = this._metrics;
1764
+ if (!e) throw Error("Document not loaded");
1765
+ return u(e, (e) => this._resourceUsage(e));
1766
+ }
1767
+ async toMarkdown() {
1768
+ return (await this._bridge.request((e) => ({
1769
+ type: "toMarkdown",
1770
+ id: e
1771
+ }))).markdown;
1772
+ }
1773
+ get pageCount() {
1774
+ return this._meta ? this._meta.pageCount : this._document ? this._getLayout()?.pages.length ?? 0 : 0;
1775
+ }
1776
+ get layoutComplete() {
1777
+ return this._layoutLifecycle.complete;
1778
+ }
1779
+ async waitUntilLayoutComplete() {
1780
+ this._layoutCompletion && await this._layoutCompletion, this._layoutLifecycle.throwIfFailed();
1781
+ }
1782
+ get mode() {
1783
+ return this._mode;
1784
+ }
1785
+ get document() {
1786
+ if (this._meta && !this._document) throw Error("the raw document model stays in the worker in mode: 'worker'; use mode: 'main' if you need direct model access");
1787
+ if (!this._document) throw Error("Document not loaded");
1788
+ return this._document;
1789
+ }
1790
+ get comments() {
1791
+ return this._reviewSnapshot().comments;
1792
+ }
1793
+ get revisions() {
1794
+ return this._reviewSnapshot().revisions;
1795
+ }
1796
+ commentAnchorRanges() {
1797
+ if (this._meta) return this._meta.commentAnchorRanges ?? br;
1798
+ if (!this._document || !this._source) return [];
1799
+ let e = this._reviewSnapshot().comments;
1800
+ if (e.length === 0) return br;
1801
+ let t = A(this), n = t.services;
1802
+ if (!n) throw Error("Document layout services are not initialized");
1803
+ let r = Le(n);
1804
+ if (!r) throw Error("Document layout variant store is not initialized");
1805
+ let i = t.activeLayoutOptions, a = i ? r.layoutFor(i) : r.defaultLayout;
1806
+ this._reviewProjectionIndex ??= Be(a);
1807
+ let o = this._layoutLifecycle?.complete ?? !0 ? void 0 : { completedSourceKeys: this._reviewProjectionIndex.completedSourceKeys };
1808
+ return this._commentAnchorRanges ??= Xn(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._commentAnchorRanges;
1809
+ }
1810
+ revisionAnchorRanges() {
1811
+ if (this._meta) return this._meta.revisionAnchorRanges ?? xr;
1812
+ if (!this._document || !this._source) return [];
1813
+ let e = this._reviewSnapshot().revisions;
1814
+ if (e.length === 0) return xr;
1815
+ let t = A(this), n = t.services;
1816
+ if (!n) throw Error("Document layout services are not initialized");
1817
+ let r = Le(n);
1818
+ if (!r) throw Error("Document layout variant store is not initialized");
1819
+ let i = t.activeLayoutOptions, a = i ? r.layoutFor(i) : r.defaultLayout;
1820
+ this._reviewProjectionIndex ??= Be(a);
1821
+ let o = this._layoutLifecycle?.complete ?? !0 ? void 0 : { completedSourceKeys: this._reviewProjectionIndex.completedSourceKeys };
1822
+ return this._revisionAnchorRanges ??= or(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._revisionAnchorRanges;
1823
+ }
1824
+ _reviewSnapshot() {
1825
+ return this._review ||= Z(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []), this._review;
1826
+ }
1827
+ get footnotes() {
1828
+ return this._meta?.footnotes ?? this._document?.footnotes ?? [];
1829
+ }
1830
+ get endnotes() {
1831
+ return this._meta?.endnotes ?? this._document?.endnotes ?? [];
1832
+ }
1833
+ _getLayout() {
1834
+ if (!this._document) return null;
1835
+ let e = A(this), t = e.services;
1836
+ if (!t) throw Error("Document layout services are not initialized");
1837
+ let n = Le(t);
1838
+ if (!n) throw Error("Document layout variant store is not initialized");
1839
+ let r = e.activeLayoutOptions;
1840
+ return r ? n.layoutFor(r) : n.defaultLayout;
1841
+ }
1842
+ async setLayoutView(e = {}) {
1843
+ let t = e[mr], n = A(this), r = M(e.currentDate, n.defaultCurrentDateMs, e.showTrackedChanges === !0), i = ++this._layoutViewGeneration, a = n.activeLayoutOptions;
1844
+ if (!yr(a, r)) {
1845
+ if (this._mode === "worker" && this._meta) {
1846
+ let e = await this._bridge.request((e) => ({
1847
+ type: "selectLayoutView",
1848
+ id: e,
1849
+ currentDateMs: r.currentDateMs,
1850
+ showTrackedChanges: r.showTrackedChanges === !0
1851
+ }));
1852
+ if (i !== this._layoutViewGeneration) return;
1853
+ let a = e;
1854
+ n.activeLayoutOptions = r, this._meta = {
1855
+ ...this._meta,
1856
+ ...a.meta
1857
+ }, this._invalidateLayoutDerivedCaches(), gr(this, t);
1858
+ return;
1859
+ }
1860
+ n.activeLayoutOptions = r, this._invalidateLayoutDerivedCaches(), gr(this, t);
1861
+ }
1862
+ }
1863
+ _getBookmarkPages() {
1864
+ if (this._bookmarkPages) return this._bookmarkPages;
1865
+ if (this._meta) return this._bookmarkPages = new Map(this._meta.bookmarkPages), this._bookmarkPages;
1866
+ let e = this._getLayout();
1867
+ return e ? (this._bookmarkPages = hn(e), this._bookmarkPages) : null;
1868
+ }
1869
+ getBookmarkPage(e) {
1870
+ return this._getBookmarkPages()?.get(e);
1871
+ }
1872
+ pageSize(e) {
1873
+ if (this._meta) {
1874
+ let t = this._meta.pageSizes, n = t[Math.max(0, Math.min(e, t.length - 1))];
1875
+ return n ? {
1876
+ widthPt: n.widthPt,
1877
+ heightPt: n.heightPt
1878
+ } : {
1879
+ widthPt: 0,
1880
+ heightPt: 0
1881
+ };
1882
+ }
1883
+ if (!this._document) return {
1884
+ widthPt: 0,
1885
+ heightPt: 0
1886
+ };
1887
+ let t = this._getLayout();
1888
+ if (!t || t.pages.length === 0) return {
1889
+ widthPt: 0,
1890
+ heightPt: 0
1891
+ };
1892
+ let n = Math.max(0, Math.min(e, t.pages.length - 1)), r = t.pages[n].geometry;
1893
+ return {
1894
+ widthPt: r.widthPt,
1895
+ heightPt: r.heightPt
1896
+ };
1897
+ }
1898
+ _withActiveView(e) {
1899
+ let t = A(this).activeLayoutOptions;
1900
+ if (!t) return e;
1901
+ let n = { ...e };
1902
+ return e.currentDate === void 0 && (n.currentDate = t.currentDateMs), e.showTrackedChanges === void 0 && t.showTrackedChanges === !0 && (n.showTrackedChanges = !0), n;
1903
+ }
1904
+ renderPage(e, t, n = {}) {
1905
+ return this._renderPageWithTargetOwnership(e, t, n, !0);
1906
+ }
1907
+ _renderPageWithTargetOwnership(e, t, n, r) {
1908
+ if (this._mode === "worker") throw Error("renderPage(canvas) is unavailable in mode: 'worker'; use renderPageToBitmap() and paint it via an ImageBitmapRenderingContext");
1909
+ if (!this._source) throw Error("Document not loaded");
1910
+ return We(this._source, e, t, {
1911
+ ...this._withActiveView(n),
1912
+ onDiagnostic: (e) => L(this, [e]),
1913
+ callerOwnedCanvasTarget: r,
1914
+ fetchImage: this._fetchImage,
1915
+ layoutServices: A(this).services ?? void 0,
1916
+ defaultCurrentDateMs: A(this).defaultCurrentDateMs,
1917
+ threeD: this._threeD,
1918
+ regionMap: this._regionMap,
1919
+ chartEx: this._chartEx,
1920
+ tiff: this._tiff
1921
+ });
1922
+ }
1923
+ async renderPageToBitmap(e, t = {}) {
1924
+ let { onTextRun: n, ...r } = t, i = {
1925
+ ...this._withActiveView(r),
1926
+ dpr: r.dpr ?? h()
1927
+ };
1928
+ if (this._mode === "worker") {
1929
+ let t = new OffscreenCanvas(1, 1), r = await this._bridge.request((n) => ({
1930
+ type: "renderPage",
1931
+ id: n,
1932
+ pageIndex: e,
1933
+ opts: i,
1934
+ canvas: t
1935
+ }), [t]);
1936
+ try {
1937
+ if (L(this, r.diagnostics), n) for (let e of r.runs) n(e);
1938
+ } catch (e) {
1939
+ throw b(r.bitmap), e;
1940
+ }
1941
+ return r.bitmap;
1942
+ }
1943
+ let a = new OffscreenCanvas(1, 1);
1944
+ return await this._renderPageWithTargetOwnership(a, e, {
1945
+ ...i,
1946
+ onTextRun: n
1947
+ }, !1), a.transferToImageBitmap();
1948
+ }
1949
+ async collectPageRuns(e, t = {}) {
1950
+ let n = { ...this._withActiveView(t) };
1951
+ if (this._mode === "worker") return (await this._bridge.request((t) => ({
1952
+ type: "collectRuns",
1953
+ id: t,
1954
+ pageIndex: e,
1955
+ opts: n
1956
+ }))).runs;
1957
+ let r = A(this), i = r.services;
1958
+ if (!i) throw Error("Document layout services are not initialized");
1959
+ return je(i, e, {
1960
+ currentDate: n.currentDate,
1961
+ defaultCurrentDateMs: r.defaultCurrentDateMs,
1962
+ width: n.width,
1963
+ showTrackedChanges: n.showTrackedChanges
1964
+ });
1965
+ }
1966
+ async getCommentThreads(e, t = {}) {
1967
+ let { includeResolved: n, ...r } = t, i = await this.collectPageRuns(e, r);
1968
+ return $n(this.comments, this.commentAnchorRanges(), i, { includeResolved: n });
1969
+ }
1970
+ async getElementContextAt(e, t, n = {}) {
1971
+ let r = this._withActiveView(n);
1972
+ if (this._mode === "worker") return (await this._bridge.request((n) => ({
1973
+ type: "hitTestElement",
1974
+ id: n,
1975
+ pageIndex: e,
1976
+ point: t,
1977
+ opts: r
1978
+ }))).context;
1979
+ let i = A(this), a = i.services;
1980
+ if (!a) throw Error("Document layout services are not initialized");
1981
+ return Rn(a, e, t, {
1982
+ ...r,
1983
+ defaultCurrentDateMs: i.defaultCurrentDateMs
1984
+ });
1985
+ }
1986
+ };
1987
+ function Cr(e, t) {
1988
+ if (!e.eastAsianVert) return 1;
1989
+ let n = t(e.text);
1990
+ return !(n > 0) || e.w >= n ? 1 : e.w / n;
1991
+ }
1992
+ function wr(e, t, n, r, i, a, o) {
1993
+ e.innerHTML = "", D(e, "ooxmlSelectionSurface", "docx"), D(e, "pageIndex", o === void 0 ? void 0 : String(o));
1994
+ let s = e.ownerDocument ?? document;
1995
+ for (let [o, c] of t.entries()) {
1996
+ let t = s.createElement("span");
1997
+ D(t, "ooxmlSelectionRun", "docx"), D(t, "runIndex", String(o)), c.paragraphId !== void 0 && D(t, "paragraphId", c.paragraphId), c.source !== void 0 && (D(t, "sourceStory", c.source.story), D(t, "sourceStoryInstance", c.source.storyInstance), D(t, "sourcePath", JSON.stringify(c.source.path))), t.textContent = c.text;
1998
+ let l = c.transform ?? "";
1999
+ if (a && c.eastAsianVert) {
2000
+ let e = Cr(c, a(c.font));
2001
+ e !== 1 && (l = `${l ? `${l} ` : ""}scaleX(${e})`);
2002
+ }
2003
+ let u = l ? `transform:${l};transform-origin:top left;` : "", d = i ? c.hyperlink : void 0, f = d ? "pointer" : "text", p = c.letterSpacingPx === void 0 ? "0" : `${c.letterSpacingPx}px`, m = c.trailingSpaceCompressionPx === void 0 ? "" : `width:${T(c.w, n)};overflow:hidden;`;
2004
+ t.style.cssText = `position:absolute;left:${T(c.x, n)};top:${T(c.y, r)};font:${c.font};line-height:${c.h}px;letter-spacing:${p};` + m + u + `white-space:pre;color:transparent;cursor:${f};pointer-events:all;`, d && i && (t.title = d.kind === "external" ? d.url : d.ref, t.addEventListener("click", (e) => {
2005
+ e.preventDefault(), i(d);
2006
+ })), e.appendChild(t);
2007
+ }
2008
+ }
2009
+ function Tr(e, t, n, r, i, a, o = {}) {
2010
+ e.innerHTML = "";
2011
+ let s = o.match ?? "rgba(255, 214, 0, 0.42)", c = o.active ?? "rgba(255, 140, 0, 0.55)";
2012
+ for (let o of n) {
2013
+ let n = o.active ? c : s;
2014
+ for (let s of o.slices) {
2015
+ let o = t[s.runIndex];
2016
+ if (!o) continue;
2017
+ let c = a(o.font), l = ne(o.text, s.start, s.end, c), u = o.letterSpacingPx ?? 0, d = Math.max(0, Math.min(s.start, o.text.length)), f = Math.max(d, Math.min(s.end, o.text.length)), p = qe(o.text.slice(d, f)).pitchBearing, m = qe(o.text.slice(0, d)).pitchBearing, h = l.x + m * u, g = l.width + Math.max(0, p - 1) * u, _ = Cr(o, c), v = h * _, y = g * _;
2018
+ if (y <= 0) continue;
2019
+ let b = document.createElement("div"), x = o.transform ? `transform:${o.transform};transform-origin:top left;` : "";
2020
+ b.style.cssText = `position:absolute;left:${T(o.x + v, r)};top:${T(o.y, i)};width:${T(y, r)};height:${T(o.h, i)};` + x + `background:${n};pointer-events:none;`, e.appendChild(b);
2021
+ }
2022
+ }
2023
+ }
2024
+ var Er = class extends w {
2025
+ constructor(e, t) {
2026
+ super(e, t, (e) => ({ page: e }));
2027
+ }
2028
+ pageRuns(e) {
2029
+ return this.unitRuns(e);
2030
+ }
2031
+ setPageRuns(e, t) {
2032
+ this.setUnitRuns(e, t);
2033
+ }
2034
+ pageHighlights(e) {
2035
+ return this.unitHighlights(e);
2036
+ }
2037
+ activePage() {
2038
+ return this.activeUnit();
2039
+ }
2040
+ };
2041
+ function Dr(e, t, n, r, i = {}) {
2042
+ let a = e.find((e) => e.id === n && e.parentId === void 0);
2043
+ if (!a) return null;
2044
+ let o = new Map(e.map((e) => [e.id, e])), s = e.filter((e) => {
2045
+ if (e.parentId === void 0) return !1;
2046
+ let t = e, n = /* @__PURE__ */ new Set();
2047
+ for (; t.parentId !== void 0 && !n.has(t.id);) {
2048
+ n.add(t.id);
2049
+ let e = o.get(t.parentId);
2050
+ if (!e) return !1;
2051
+ if (e.id === a.id) return !0;
2052
+ t = e;
2053
+ }
2054
+ return !1;
2055
+ }), c = Oe({
2056
+ id: a.id,
2057
+ author: a.author,
2058
+ date: a.date,
2059
+ text: a.paragraphs?.join("\n") ?? a.text,
2060
+ status: a.resolved ? "resolved" : "active"
2061
+ }, s.map((e) => ({
2062
+ id: e.id,
2063
+ author: e.author,
2064
+ date: e.date,
2065
+ text: e.paragraphs?.join("\n") ?? e.text,
2066
+ status: e.resolved ? "resolved" : "active"
2067
+ })), i.maxTextCharacters), l = t.find((e) => e.commentId === n)?.source;
2068
+ return Object.freeze({
2069
+ format: "docx",
2070
+ kind: "comment",
2071
+ pageIndex: r,
2072
+ commentId: n,
2073
+ ...l ? { source: Object.freeze({
2074
+ ...l,
2075
+ path: Object.freeze([...l.path])
2076
+ }) } : {},
2077
+ thread: c.thread,
2078
+ truncated: c.truncated,
2079
+ truncationReasons: c.truncated ? ["text"] : [],
2080
+ textCharacters: c.textCharacters,
2081
+ maxTextCharacters: c.maxTextCharacters
2082
+ });
2083
+ }
2084
+ function Or(e) {
2085
+ for (let t = e; t; t = t.parentElement) {
2086
+ let e = Ee(t.dataset.pageIndex);
2087
+ if (e !== null) return e;
2088
+ }
2089
+ return null;
2090
+ }
2091
+ var kr = new Set([
2092
+ "body",
2093
+ "header",
2094
+ "footer",
2095
+ "footnote",
2096
+ "endnote",
2097
+ "textbox"
2098
+ ]);
2099
+ function Ar(e) {
2100
+ let t = e.dataset.sourceStory, n = e.dataset.sourceStoryInstance, r = e.dataset.sourcePath;
2101
+ if (!t || !kr.has(t) || !n || !r) return null;
2102
+ try {
2103
+ let e = JSON.parse(r);
2104
+ return !Array.isArray(e) || e.length === 0 || e.length > 32 || !e.every((e) => Number.isSafeInteger(e) && e >= 0) ? null : {
2105
+ story: t,
2106
+ storyInstance: n,
2107
+ path: [...e]
2108
+ };
2109
+ } catch {
2110
+ return null;
2111
+ }
2112
+ }
2113
+ function $(e, t, n = {}) {
2114
+ let r = ht(e, t, (e) => {
2115
+ let t = Or(e), n = Ee(e.dataset.runIndex);
2116
+ return t === null || n === null ? null : {
2117
+ pageIndex: t,
2118
+ runIndex: n,
2119
+ ...e.dataset.paragraphId === void 0 ? {} : { paragraphId: e.dataset.paragraphId },
2120
+ ...Ar(e) === null ? {} : { source: Ar(e) }
2121
+ };
2122
+ }, {
2123
+ maxChars: n.maxTextCharacters,
2124
+ maxLocators: n.maxRunLocators
2125
+ });
2126
+ if (!r) return null;
2127
+ let i = [...r.locators].sort((e, t) => e.pageIndex - t.pageIndex || e.runIndex - t.runIndex);
2128
+ return {
2129
+ format: "docx",
2130
+ kind: "text",
2131
+ text: r.text,
2132
+ pageIndexes: [...new Set(i.map((e) => e.pageIndex))],
2133
+ paragraphIds: [...new Set(i.flatMap((e) => e.paragraphId ? [e.paragraphId] : []))],
2134
+ runs: i,
2135
+ truncated: r.truncated,
2136
+ truncationReasons: r.truncationReasons,
2137
+ textCharacters: r.textCharacters,
2138
+ maxTextCharacters: r.maxTextCharacters,
2139
+ maxRunLocators: r.maxLocators
2140
+ };
2141
+ }
2142
+ function jr(e, t, n, r, i) {
2143
+ return r === "worker" ? e.renderPageToBitmap(n, i) : e.renderPage(t, n, i);
2144
+ }
2145
+ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2146
+ _pendingLoadAbort = null;
2147
+ _pendingRequestedView;
2148
+ _pendingViewChanged = null;
2149
+ _documentOwner;
2150
+ get _doc() {
2151
+ return this._documentOwner.current;
2152
+ }
2153
+ _borrowed;
2154
+ _hostWindow;
2155
+ _currentPage = 0;
2156
+ _scale = null;
2157
+ _canvas;
2158
+ _wrapper;
2159
+ _canvasMount;
2160
+ _textLayer = null;
2161
+ _highlightLayer = null;
2162
+ _elementLayer = null;
2163
+ _find;
2164
+ _findRequestGeneration = 0;
2165
+ _measureCtx = null;
2166
+ _opts;
2167
+ _showTrackedChangesExplicit = !1;
2168
+ _mode;
2169
+ _renderDispatcher;
2170
+ _errorRouter;
2171
+ _destroyed = !1;
2172
+ _selectionChangeListener = null;
2173
+ _selectionContextKey = "null";
2174
+ _elementContext = null;
2175
+ _elementHitGeneration = 0;
2176
+ _layoutViewGeneration = 0;
2177
+ _layoutViewPublicationGeneration = 0;
2178
+ _navigationGeneration = 0;
2179
+ _layoutUnsubscribe = null;
2180
+ _internalHyperlinkGeneration = 0;
2181
+ _layoutWaiters = /* @__PURE__ */ new Set();
2182
+ _layoutFailed = !1;
2183
+ _loadingIndicator;
2184
+ _elementClickListener = null;
2185
+ _contextMenuListener = null;
2186
+ static fromDocument(t, n, r = {}) {
2187
+ let i = Y(n);
2188
+ return new e(t, {
2189
+ ...r,
2190
+ currentDate: i.currentDate,
2191
+ showTrackedChanges: i.showTrackedChanges,
2192
+ [Mr]: n
2193
+ });
2194
+ }
2195
+ constructor(e, t = {}) {
2196
+ this._canvas = e, this._opts = t, this._showTrackedChangesExplicit = t.showTrackedChanges !== void 0;
2197
+ let n = t[Mr];
2198
+ this._borrowed = n !== void 0, this._mode = Et("DocxViewer", t.mode, n), this._documentOwner = new xt("DocxViewer", n ?? null, !1);
2199
+ let r = e.ownerDocument?.defaultView ?? (typeof window < "u" ? window : null);
2200
+ if (!r) throw Error("DocxViewer requires a canvas with an active Window");
2201
+ this._hostWindow = r, this._canvasMount = new Tt(e, {
2202
+ wrapperCssText: "position:relative;display:inline-block;vertical-align:top;",
2203
+ forceDisplayBlock: !0
2204
+ }), this._wrapper = this._canvasMount.wrapper, this._renderDispatcher = new pt(e, this._mode === "worker"), this._errorRouter = new vt("DocxViewer", t.onError);
2205
+ let i = new Ct(this._wrapper, t.enableTextSelection === !0, t.enableElementSelection === !0);
2206
+ this._textLayer = i.textLayer, this._highlightLayer = i.highlightLayer, this._elementLayer = i.elementLayer, this._loadingIndicator = new bt(this._wrapper, "Loading page");
2207
+ let a = this._wrapper.ownerDocument.createElement("progress");
2208
+ a.setAttribute("aria-hidden", "true"), this._loadingIndicator.layer.appendChild(a), this._wrapper.insertBefore(this._loadingIndicator.layer, this._elementLayer), this._textLayer && (t.onSelectionContextChange || t.enableElementSelection) && (this._selectionChangeListener = () => this._emitSelectionContextChange(), this._wrapper.ownerDocument.addEventListener("selectionchange", this._selectionChangeListener)), t.enableElementSelection && (this._elementClickListener = (e) => {
2209
+ this._onElementClick(e).catch((e) => this._reportRenderError(e));
2210
+ }, this._wrapper.addEventListener("click", this._elementClickListener)), t.onContextMenu && (this._contextMenuListener = (e) => this._onContextMenu(e), this._wrapper.addEventListener("contextmenu", this._contextMenuListener)), this._find = new Er(() => this.pageCount, (e) => this._collectPageRuns(e)), n && this._bindLayoutDocument(n);
2211
+ }
2212
+ async load(e) {
2213
+ if (this._destroyed) throw Error("DocxViewer is destroyed");
2214
+ if (this._borrowed) throw Error("DocxViewer.load() is unsupported on a Viewer created by fromDocument(); the borrowed document is already loaded.");
2215
+ let t = !1, n = this._pendingRequestedView;
2216
+ this._pendingLoadAbort?.abort();
2217
+ let r = new AbortController();
2218
+ this._pendingLoadAbort = r, this._pendingRequestedView = n;
2219
+ try {
2220
+ let i = await this._documentOwner.replace(async () => {
2221
+ let t = await Q.load(e, {
2222
+ password: this._opts.password,
2223
+ useGoogleFonts: this._opts.useGoogleFonts,
2224
+ allowFootnoteContinuation: this._opts.allowFootnoteContinuation,
2225
+ cjkFallback: this._opts.cjkFallback,
2226
+ maxZipEntryBytes: this._opts.maxZipEntryBytes,
2227
+ resourceLimits: this._opts.resourceLimits,
2228
+ debug: this._opts.debug,
2229
+ onResourceMetrics: this._opts.onResourceMetrics,
2230
+ workerTimeoutMs: this._opts.workerTimeoutMs,
2231
+ wasmUrl: this._opts.wasmUrl,
2232
+ math: this._opts.math,
2233
+ threeD: this._opts.threeD,
2234
+ regionMap: this._opts.regionMap,
2235
+ chartEx: this._opts.chartEx,
2236
+ tiff: this._opts.tiff,
2237
+ mode: this._mode,
2238
+ ...this._opts.progressiveLayout ? { progressiveLayout: !0 } : {},
2239
+ ...this._opts.sliceLayout === void 0 ? {} : { sliceLayout: this._opts.sliceLayout },
2240
+ [vr]: {
2241
+ signal: r.signal,
2242
+ requestedView: () => this._pendingRequestedView,
2243
+ subscribeViewChange: (e) => (this._pendingViewChanged = e, () => {
2244
+ this._pendingViewChanged === e && (this._pendingViewChanged = null);
2245
+ })
2246
+ },
2247
+ onLayoutProgress: this._opts.onLayoutProgress,
2248
+ onLayoutPartial: this._opts.onLayoutPartial,
2249
+ onLayoutComplete: this._opts.onLayoutComplete,
2250
+ ...n === void 0 ? this._opts.legacyDoc === void 0 ? this._opts.showTrackedChanges === !0 ? { showTrackedChanges: !0 } : {} : this._showTrackedChangesExplicit ? { showTrackedChanges: this._opts.showTrackedChanges } : void 0 : { showTrackedChanges: n },
2251
+ ...this._opts.legacyDoc === void 0 ? void 0 : { legacyDoc: this._opts.legacyDoc },
2252
+ ...this._opts.currentDate === void 0 ? {} : { currentDate: this._opts.currentDate }
2253
+ });
2254
+ return await hr(t, r.signal, () => this._pendingRequestedView, () => this._opts.currentDate, this), t;
2255
+ }, () => {
2256
+ this._invalidateElementContext(!1), t = !0, this._renderDispatcher.begin(), this._findRequestGeneration++, this._find.invalidate(), this._unbindLayoutDocument();
2257
+ });
2258
+ if (!i) return;
2259
+ if (this._destroyed) throw Error("DocxViewer is destroyed");
2260
+ if (this._pendingLoadAbort !== r || (this._pendingRequestedView !== void 0 && (this._showTrackedChangesExplicit = !0, this._opts = {
2261
+ ...this._opts,
2262
+ showTrackedChanges: this._pendingRequestedView
2263
+ }), this._currentPage = 0, this._bindLayoutDocument(i), this._find.invalidate(), await this._render(), this._pendingLoadAbort !== r)) return;
2264
+ } catch (e) {
2265
+ if (this._destroyed) throw Error("DocxViewer is destroyed");
2266
+ if (this._pendingLoadAbort !== r) return;
2267
+ throw e instanceof Error ? e : Error(String(e));
2268
+ } finally {
2269
+ this._pendingLoadAbort === r && (this._pendingLoadAbort = null, this._pendingRequestedView = void 0, this._pendingViewChanged = null);
2270
+ }
2271
+ t && !this._destroyed && this._emitSelectionContextChange();
2272
+ }
2273
+ get pageCount() {
2274
+ return this._doc?.pageCount ?? 0;
2275
+ }
2276
+ get currentPage() {
2277
+ return this._currentPage;
2278
+ }
2279
+ get layoutComplete() {
2280
+ return this._doc?.layoutComplete ?? !0;
2281
+ }
2282
+ async waitUntilLayoutComplete() {
2283
+ await this._errorRouter.ownBackgroundLifecycle(async () => {
2284
+ await this._doc?.waitUntilLayoutComplete?.();
2285
+ });
2286
+ }
2287
+ get canvasElement() {
2288
+ return this._canvas;
2289
+ }
2290
+ async goToPage(e) {
2291
+ let t = this._doc;
2292
+ if (!t) return;
2293
+ let n = this._cancelPendingNavigation(), r = Math.max(0, Number.isNaN(e) ? 0 : Math.trunc(e));
2294
+ if (r >= this.pageCount && !this.layoutComplete) {
2295
+ this._setLoading(!0);
2296
+ try {
2297
+ await this._waitForPage(t, r, n);
2298
+ } finally {
2299
+ n === this._navigationGeneration && this._setLoading(!1);
2300
+ }
2301
+ }
2302
+ if (this._destroyed || n !== this._navigationGeneration || t !== this._doc) return;
2303
+ let i = Math.max(0, Math.min(r, this.pageCount - 1)), a = i !== this._currentPage;
2304
+ a && this._invalidateElementContext(!1), this._currentPage = i, await this._render(), a && !this._destroyed && this._emitSelectionContextChange();
2305
+ }
2306
+ async nextPage() {
2307
+ await this.goToPage(this._currentPage + 1);
2308
+ }
2309
+ async prevPage() {
2310
+ await this.goToPage(this._currentPage - 1);
2311
+ }
2312
+ _naturalWidthPx() {
2313
+ return !this._doc || this._doc.pageCount === 0 ? 0 : this._doc.pageSize(this._currentPage).widthPt * n;
2314
+ }
2315
+ _renderWidth() {
2316
+ if (this._scale === null) return this._opts.width;
2317
+ let e = this._naturalWidthPx();
2318
+ return e <= 0 ? this._opts.width : Math.round(e * this._scale);
2319
+ }
2320
+ getScale() {
2321
+ if (this._scale !== null) return this._scale;
2322
+ let e = this._naturalWidthPx();
2323
+ return e <= 0 ? 1 : this._opts.width && this._opts.width > 0 ? this._opts.width / e : 1;
2324
+ }
2325
+ _zoomMin() {
2326
+ return this._opts.zoomMin ?? .1;
2327
+ }
2328
+ _zoomMax() {
2329
+ return this._opts.zoomMax ?? 4;
2330
+ }
2331
+ async setScale(e) {
2332
+ let t = Dt(e, this._zoomMin(), this._zoomMax()), n = t !== this.getScale();
2333
+ this._scale = t, await this._render(), n && this._opts.onScaleChange?.(t);
2334
+ }
2335
+ async zoomIn() {
2336
+ await this.setScale(mt(this.getScale()));
2337
+ }
2338
+ async zoomOut() {
2339
+ await this.setScale(kt(this.getScale()));
2340
+ }
2341
+ async fitWidth() {
2342
+ await this._fit("width");
2343
+ }
2344
+ async fitPage() {
2345
+ await this._fit("page");
2346
+ }
2347
+ async _fit(e) {
2348
+ if (!this._doc || this._doc.pageCount === 0) return;
2349
+ let t = this._doc.pageSize(this._currentPage), r = this._fitContainer();
2350
+ if (!r) return;
2351
+ let i = At({
2352
+ contentWidth: t.widthPt * n,
2353
+ contentHeight: t.heightPt * n,
2354
+ containerWidth: r.clientWidth,
2355
+ containerHeight: r.clientHeight
2356
+ }, e);
2357
+ i <= 0 || await this.setScale(i);
2358
+ }
2359
+ _fitContainer() {
2360
+ return this._opts.container ?? this._wrapper.parentElement ?? null;
2361
+ }
2362
+ async findText(e, t = {}) {
2363
+ let n = this._doc;
2364
+ if (!n) return [];
2365
+ let r = ++this._findRequestGeneration;
2366
+ if (e.length > 0 && !n.layoutComplete && (await this._errorRouter.ownBackgroundLifecycle(() => n.waitUntilLayoutComplete()), this._destroyed || this._doc !== n || r !== this._findRequestGeneration)) return [];
2367
+ let i = await this._errorRouter.ownAwaitable(() => this._find.find(e, t));
2368
+ return this._redrawHighlights(), i;
2369
+ }
2370
+ async findNext() {
2371
+ return this._activateMatch(this._find.next());
2372
+ }
2373
+ async findPrev() {
2374
+ return this._activateMatch(this._find.prev());
2375
+ }
2376
+ clearFind() {
2377
+ this._findRequestGeneration++, this._find.invalidate(), this._redrawHighlights();
2378
+ }
2379
+ async _activateMatch(e) {
2380
+ return e ? (e.location.page === this._currentPage ? this._redrawHighlights() : await this.goToPage(e.location.page), e) : (this._redrawHighlights(), null);
2381
+ }
2382
+ _redrawHighlights() {
2383
+ let e = this._find.pageRuns(this._currentPage) ?? [];
2384
+ this._buildHighlightLayer(e);
2385
+ }
2386
+ async getResourceMetrics() {
2387
+ if (!this._doc) throw Error("Document not loaded");
2388
+ return await this._doc.getResourceMetrics();
2389
+ }
2390
+ getSelectionContext(e = {}) {
2391
+ if (this._destroyed) throw Error("DocxViewer is destroyed");
2392
+ return (this._textLayer ? $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._elementContext ? zn(this._elementContext, e.maxTextCharacters) : null);
2393
+ }
2394
+ _emitSelectionContextChange() {
2395
+ let e = this.getSelectionContext();
2396
+ e?.kind === "text" && (this._elementHitGeneration++, this._elementContext = null, this._redrawElementOutline());
2397
+ let t = JSON.stringify(e);
2398
+ t !== this._selectionContextKey && (this._selectionContextKey = t, this._opts.onSelectionContextChange?.(e ? structuredClone(e) : null));
2399
+ }
2400
+ _setElementContext(e) {
2401
+ this._elementContext = e ? structuredClone(e) : null, this._redrawElementOutline(), this._emitSelectionContextChange();
2402
+ }
2403
+ _invalidateElementContext(e = !0) {
2404
+ this._elementHitGeneration++, this._elementContext = null, this._redrawElementOutline(), e && this._emitSelectionContextChange();
2405
+ }
2406
+ _redrawElementOutline() {
2407
+ let e = this._elementContext, t = this._doc;
2408
+ if (!e || !t || e.pageIndex !== this._currentPage) {
2409
+ yt(this._elementLayer, null);
2410
+ return;
2411
+ }
2412
+ let n = t.pageSize(e.pageIndex);
2413
+ yt(this._elementLayer, {
2414
+ x: e.bounds.xPt / n.widthPt,
2415
+ y: e.bounds.yPt / n.heightPt,
2416
+ width: e.bounds.widthPt / n.widthPt,
2417
+ height: e.bounds.heightPt / n.heightPt
2418
+ });
2419
+ }
2420
+ async _onElementClick(e) {
2421
+ this._destroyed || e.defaultPrevented || e.button !== 0 || await this._resolveContextAt(e);
2422
+ }
2423
+ _onContextMenu(e) {
2424
+ let t;
2425
+ this._opts.onContextMenu?.({
2426
+ originalEvent: e,
2427
+ getContext: () => t ??= this._resolveContextAt(e)
2428
+ });
2429
+ }
2430
+ async _resolveContextAt(e) {
2431
+ let t = this._doc;
2432
+ if (this._destroyed || !t) return null;
2433
+ if (this._textLayer && $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null)) return this._emitSelectionContextChange(), this._destroyed ? null : this.getSelectionContext();
2434
+ if (!this._opts.enableElementSelection) return this.getSelectionContext();
2435
+ let n = this._canvas.getBoundingClientRect();
2436
+ if (n.width <= 0 || n.height <= 0) return this._invalidateElementContext(), null;
2437
+ let r = e.clientX - n.left, i = e.clientY - n.top;
2438
+ if (r < 0 || i < 0 || r > n.width || i > n.height) return this._invalidateElementContext(), null;
2439
+ let a = ++this._elementHitGeneration, o = this._currentPage, s = t.pageSize(o), c;
2440
+ try {
2441
+ c = await t.getElementContextAt(o, {
2442
+ xPt: r / n.width * s.widthPt,
2443
+ yPt: i / n.height * s.heightPt
2444
+ }, {
2445
+ currentDate: this._opts.currentDate,
2446
+ showTrackedChanges: this._opts.showTrackedChanges,
2447
+ maxTextCharacters: wn
2448
+ });
2449
+ } catch (e) {
2450
+ if (this._destroyed || a !== this._elementHitGeneration || o !== this._currentPage || t !== this._doc) return null;
2451
+ throw e;
2452
+ }
2453
+ return this._destroyed || a !== this._elementHitGeneration || o !== this._currentPage || t !== this._doc ? null : (this._setElementContext(c), this._destroyed ? null : this.getSelectionContext());
2454
+ }
2455
+ destroy() {
2456
+ this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._layoutViewGeneration++, this._unbindLayoutDocument(), this._errorRouter.close(), this._renderDispatcher.destroy(), ze(this._canvas), this._documentOwner.close(), this._find.invalidate(), this._selectionChangeListener &&= (this._wrapper.ownerDocument.removeEventListener("selectionchange", this._selectionChangeListener), null), this._elementHitGeneration++, this._elementClickListener &&= (this._wrapper.removeEventListener("click", this._elementClickListener), null), this._contextMenuListener &&= (this._wrapper.removeEventListener("contextmenu", this._contextMenuListener), null), this._elementContext = null, this._canvasMount.restore());
2457
+ }
2458
+ async _render() {
2459
+ let e = this._renderDispatcher.begin();
2460
+ try {
2461
+ await this._renderPage(e);
2462
+ } catch (t) {
2463
+ if (!this._renderDispatcher.isCurrent(e)) return;
2464
+ throw t;
2465
+ }
2466
+ }
2467
+ _reportRenderError(e) {
2468
+ this._errorRouter.report(e);
2469
+ }
2470
+ async _renderPage(e) {
2471
+ if (!this._doc) return;
2472
+ let t = this._mode === "worker", n = this._renderWidth(), r = this._doc.pageSize(this._currentPage), i = n ?? r.widthPt * 1.3333333333333333, a = r.widthPt > 0 ? i * r.heightPt / r.widthPt : 0, o = [], s = (e) => o.push(e), c = this._opts.dpr ?? h(), l = {
2473
+ width: n,
2474
+ dpr: this._opts.dpr,
2475
+ imageResources: this._opts.imageResources,
2476
+ defaultTextColor: this._opts.defaultTextColor,
2477
+ currentDate: this._opts.currentDate,
2478
+ showTrackedChanges: this._opts.showTrackedChanges,
2479
+ onTextRun: s
2480
+ };
2481
+ if (t) {
2482
+ let t = await jr(this._doc, this._canvas, this._currentPage, "worker", l);
2483
+ if (!this._renderDispatcher.commitBitmap(e, t, {
2484
+ cssWidth: i > 0 ? i : Math.round(t.width / c),
2485
+ cssHeight: a > 0 ? a : Math.round(t.height / c)
2486
+ })) return;
2487
+ } else if (await jr(this._doc, this._canvas, this._currentPage, "main", l), !this._renderDispatcher.isCurrent(e)) return;
2488
+ this._textLayer && this._buildTextLayer(this._textLayer, o), this._find.setPageRuns(this._currentPage, o), this._buildHighlightLayer(o), this._opts.onPageChange?.(this._currentPage, this.pageCount, this.layoutComplete);
2489
+ }
2490
+ _clearPresentedPage() {
2491
+ this._renderDispatcher.begin(), ze(this._canvas), this._canvas.width = 0, this._canvas.height = 0, this._textLayer?.replaceChildren(), this._find.invalidate();
2492
+ }
2493
+ _bindLayoutDocument(e) {
2494
+ this._unbindLayoutDocument(), this._layoutFailed = !1, this._layoutViewPublicationGeneration = 0;
2495
+ let t = _r(e, (t) => this._onLayoutViewPublication(e, t), (e) => this._reportRenderError(e)), n = !0, r = ur(e, () => ({
2496
+ pageCount: e.pageCount,
2497
+ exact: e.layoutComplete,
2498
+ complete: e.layoutComplete
2499
+ }), (t) => {
2500
+ if (n) {
2501
+ n = !1;
2502
+ return;
2503
+ }
2504
+ this._onLayoutPublication(e, t);
2505
+ }, (e) => this._reportRenderError(e));
2506
+ this._layoutUnsubscribe = () => {
2507
+ r(), t();
2508
+ };
2509
+ }
2510
+ _unbindLayoutDocument() {
2511
+ this._layoutUnsubscribe?.(), this._layoutUnsubscribe = null, this._layoutFailed = !1, this._cancelPendingNavigation();
2512
+ }
2513
+ _onLayoutPublication(e, t) {
2514
+ if (!(this._destroyed || e !== this._doc)) {
2515
+ if (this._wakeLayoutWaiters(), t.error !== void 0) {
2516
+ t.pageCount === 0 && this._clearPresentedPage(), this._layoutFailed = !0, this._errorRouter.reportBackground(t.error, this._opts.onLayoutComplete !== void 0);
2517
+ return;
2518
+ }
2519
+ this._find.invalidate(), this._currentPage = Math.max(0, Math.min(this._currentPage, t.pageCount - 1)), this._render().catch((e) => this._reportRenderError(e));
2520
+ }
2521
+ }
2522
+ _onLayoutViewPublication(e, t) {
2523
+ this._destroyed || e !== this._doc || t.generation <= this._layoutViewPublicationGeneration || (this._layoutViewPublicationGeneration = t.generation, t.requester !== this && (this._layoutViewGeneration++, this._opts = {
2524
+ ...this._opts,
2525
+ currentDate: t.view.currentDate,
2526
+ showTrackedChanges: t.view.showTrackedChanges
2527
+ }, this._find.invalidate(), this._currentPage = Math.max(0, Math.min(this._currentPage, e.pageCount - 1)), this._render().catch((e) => this._reportRenderError(e))));
2528
+ }
2529
+ async _waitForPage(e, t, n) {
2530
+ await this._errorRouter.ownBackgroundLifecycle(async () => {
2531
+ for (; !this._destroyed && n === this._navigationGeneration && e === this._doc && t >= e.pageCount && !e.layoutComplete && !this._layoutFailed;) await new Promise((e) => {
2532
+ this._layoutWaiters.add(e);
2533
+ });
2534
+ e === this._doc && (e.layoutComplete || this._layoutFailed) && await e.waitUntilLayoutComplete();
2535
+ });
2536
+ }
2537
+ _wakeLayoutWaiters() {
2538
+ for (let e of this._layoutWaiters) e();
2539
+ this._layoutWaiters.clear();
2540
+ }
2541
+ _cancelPendingNavigation() {
2542
+ let e = ++this._navigationGeneration;
2543
+ return this._wakeLayoutWaiters(), this._setLoading(!1), e;
2544
+ }
2545
+ _setLoading(e) {
2546
+ this._loadingIndicator.setLoading(e);
2547
+ }
2548
+ async setShowTrackedChanges(e) {
2549
+ let t = ++this._layoutViewGeneration;
2550
+ if (this._pendingLoadAbort) {
2551
+ let t = this._pendingRequestedView !== e;
2552
+ this._pendingRequestedView = e, t && this._pendingViewChanged?.();
2553
+ }
2554
+ let n = this._doc, r = this._opts.legacyDoc === void 0 ? this._opts.showTrackedChanges === !0 : n ? Y(n).showTrackedChanges : this._opts.showTrackedChanges === !0;
2555
+ if ((!n || r === e) && (this._showTrackedChangesExplicit = !0, this._opts = {
2556
+ ...this._opts,
2557
+ showTrackedChanges: e
2558
+ }), r === e) {
2559
+ n && await X(n, {
2560
+ showTrackedChanges: e,
2561
+ currentDate: this._opts.currentDate
2562
+ }, this);
2563
+ return;
2564
+ }
2565
+ let i = {
2566
+ ...this._opts,
2567
+ showTrackedChanges: e
2568
+ };
2569
+ (!n || await X(n, {
2570
+ showTrackedChanges: e,
2571
+ currentDate: i.currentDate
2572
+ }, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChangesExplicit = !0, this._opts = i, this._find.invalidate(), this._currentPage = Math.max(0, Math.min(this._currentPage, this.pageCount - 1)), await this._render()));
2573
+ }
2574
+ _buildHighlightLayer(e) {
2575
+ let t = this._highlightLayer;
2576
+ if (!t) return;
2577
+ let { width: n, height: r } = this._canvasCssPx();
2578
+ Tr(t, e, this._find.pageHighlights(this._currentPage), n, r, (e) => this._measureForFont(e), this._opts.findHighlightColors);
2579
+ }
2580
+ _canvasCssPx() {
2581
+ return {
2582
+ width: parseFloat(this._canvas.style.width) || this._canvas.width,
2583
+ height: parseFloat(this._canvas.style.height) || this._canvas.height
2584
+ };
2585
+ }
2586
+ _measureForFont(e) {
2587
+ if (!this._measureCtx) {
2588
+ let e = document.createElement("canvas");
2589
+ this._measureCtx = e.getContext("2d");
2590
+ }
2591
+ let t = this._measureCtx;
2592
+ return t ? (t.font = e, (e) => t.measureText(e).width) : (e) => e.length;
2593
+ }
2594
+ async _collectPageRuns(e) {
2595
+ return this._doc ? this._doc.collectPageRuns(e, {
2596
+ width: this._renderWidth(),
2597
+ currentDate: this._opts.currentDate,
2598
+ showTrackedChanges: this._opts.showTrackedChanges
2599
+ }) : [];
2600
+ }
2601
+ _buildTextLayer(e, t) {
2602
+ let { width: n, height: r } = this._canvasCssPx();
2603
+ wr(e, t, n, r, this._hyperlinkHandler(), (e) => this._measureForFont(e), this._currentPage);
2604
+ }
2605
+ _hyperlinkHandler() {
2606
+ return this._opts.enableHyperlinks === !1 ? void 0 : this._opts.onHyperlinkClick || ((e) => {
2607
+ if (e.kind === "external") {
2608
+ C(e.url, void 0, this._hostWindow);
2609
+ return;
2610
+ }
2611
+ let t = this._doc;
2612
+ if (!t) return;
2613
+ let n = ++this._internalHyperlinkGeneration;
2614
+ this._navigateInternalHyperlink(t, e.ref, n).catch((e) => this._reportRenderError(e));
2615
+ });
2616
+ }
2617
+ async _navigateInternalHyperlink(e, t, n) {
2618
+ if (e.layoutComplete || await e.waitUntilLayoutComplete(), this._destroyed || this._doc !== e || n !== this._internalHyperlinkGeneration) return;
2619
+ let r = e.getBookmarkPage(t);
2620
+ r !== void 0 && await this.goToPage(r);
2621
+ }
2622
+ }, Pr = class {
2623
+ hooks;
2624
+ pageById = /* @__PURE__ */ new Map();
2625
+ runsByPage = /* @__PURE__ */ new Map();
2626
+ indexedPages = /* @__PURE__ */ new Set();
2627
+ frontier = 0;
2628
+ generation = 0;
2629
+ constructor(e) {
2630
+ this.hooks = e;
2631
+ }
2632
+ reset() {
2633
+ this.generation++, this.pageById.clear(), this.runsByPage.clear(), this.indexedPages.clear(), this.frontier = 0;
2634
+ }
2635
+ commitRuns(e, t) {
2636
+ this.runsByPage.set(e, {
2637
+ scale: this.hooks.scale(),
2638
+ runs: Promise.resolve(t)
2639
+ });
2640
+ let n = this.hooks.document();
2641
+ n && e === this.frontier && this.indexPage(e, t, n.commentAnchorRanges());
2642
+ }
2643
+ indexPage(e, t, n) {
2644
+ if (!this.indexedPages.has(e)) {
2645
+ for (let r of n) !this.pageById.has(r.commentId) && W(r, t).length > 0 && this.pageById.set(r.commentId, e);
2646
+ for (this.indexedPages.add(e); this.indexedPages.has(this.frontier);) this.frontier++;
2647
+ }
2648
+ }
2649
+ async runsForPage(e, t) {
2650
+ for (; !this.hooks.destroyed() && this.hooks.document() === t;) {
2651
+ let n = this.hooks.scale(), r = this.runsByPage.get(e);
2652
+ (!r || r.scale !== n) && (r = {
2653
+ scale: n,
2654
+ runs: t.collectPageRuns(e, {
2655
+ width: this.hooks.pageWidth(e),
2656
+ currentDate: this.hooks.currentDate(),
2657
+ ...this.hooks.showTrackedChanges() ? { showTrackedChanges: !0 } : {}
2658
+ })
2659
+ }, this.runsByPage.set(e, r));
2660
+ try {
2661
+ let e = await r.runs;
2662
+ if (this.hooks.destroyed() || this.hooks.document() !== t) return null;
2663
+ if (this.hooks.scale() !== n) continue;
2664
+ return e;
2665
+ } catch (t) {
2666
+ throw this.runsByPage.get(e) === r && this.runsByPage.delete(e), t;
2667
+ }
2668
+ }
2669
+ return null;
2670
+ }
2671
+ async goToComment(e, t) {
2672
+ if (this.hooks.destroyed()) throw Error("DocxScrollViewer is destroyed");
2673
+ let n = this.hooks.document();
2674
+ if (!n || !n.comments.some((t) => t.id === e && t.parentId === void 0)) return !1;
2675
+ let r = ++this.generation, i = !n.layoutComplete, a = n.commentAnchorRanges().filter((t) => t.commentId === e), o = t?.pageIndex;
2676
+ if (o !== void 0 && (!Number.isInteger(o) || o < 0)) return !1;
2677
+ let s = o ?? this.pageById.get(e), c = async () => {
2678
+ let t = n.commentAnchorRanges();
2679
+ for (; s === void 0 && this.frontier < n.pageCount;) {
2680
+ let i = this.frontier, a = await this.runsForPage(i, n);
2681
+ if (this.hooks.destroyed()) throw Error("DocxScrollViewer is destroyed");
2682
+ if (this.hooks.document() !== n || r !== this.generation || !a) return;
2683
+ this.indexPage(i, a, t), s = this.pageById.get(e);
2684
+ }
2685
+ };
2686
+ if (o === void 0 && s === void 0 && a.length > 0 && await c(), i && (o !== void 0 && o >= n.pageCount || o === void 0 && s === void 0)) {
2687
+ if (await this.hooks.waitForLayout(n), this.hooks.destroyed()) throw Error("DocxScrollViewer is destroyed");
2688
+ if (this.hooks.document() !== n || r !== this.generation) return !1;
2689
+ a = n.commentAnchorRanges().filter((t) => t.commentId === e), this.pageById.clear(), this.runsByPage.clear(), this.indexedPages.clear(), this.frontier = 0, s = o, o === void 0 && a.length > 0 && await c();
2690
+ }
2691
+ if (a.length === 0 || s === void 0 || o !== void 0 && o >= n.pageCount) return !1;
2692
+ let l = await this.runsForPage(s, n);
2693
+ if (this.hooks.destroyed()) throw Error("DocxScrollViewer is destroyed");
2694
+ if (this.hooks.document() !== n || r !== this.generation || !l) return !1;
2695
+ let u = a.flatMap((e) => W(e, l))[0];
2696
+ return u ? (this.hooks.select(e, s, u, t), !0) : !1;
2697
+ }
2698
+ destroy() {
2699
+ this.reset();
2700
+ }
2701
+ }, Fr = class {
2702
+ hooks;
2703
+ unsubscribe = null;
2704
+ viewGeneration = 0;
2705
+ prefix = 0;
2706
+ constructor(e) {
2707
+ this.hooks = e;
2708
+ }
2709
+ get presentedPageCount() {
2710
+ return this.prefix;
2711
+ }
2712
+ set presentedPageCount(e) {
2713
+ this.prefix = e;
2714
+ }
2715
+ bind(e) {
2716
+ this.unbind(), this.viewGeneration = 0, this.prefix = e.pageCount;
2717
+ let t = _r(e, (t) => this.onViewPublication(e, t), this.hooks.report), n = !0, r = ur(e, () => ({
2718
+ pageCount: e.pageCount,
2719
+ exact: e.layoutComplete,
2720
+ complete: e.layoutComplete
2721
+ }), (t) => {
2722
+ if (n) {
2723
+ n = !1;
2724
+ return;
2725
+ }
2726
+ this.onPublication(e, t);
2727
+ }, this.hooks.report);
2728
+ this.unsubscribe = () => {
2729
+ r(), t();
2730
+ };
2731
+ }
2732
+ unbind() {
2733
+ this.unsubscribe?.(), this.unsubscribe = null, this.prefix = 0;
2734
+ }
2735
+ onPublication(e, t) {
2736
+ if (!(this.hooks.destroyed() || e !== this.hooks.current())) {
2737
+ if (t.error !== void 0) {
2738
+ t.pageCount === 0 && (this.prefix = 0), this.hooks.reportBackground(t.error);
2739
+ return;
2740
+ }
2741
+ this.hooks.invalidateFind(), this.hooks.refreshComments(), this.apply(t);
2742
+ }
2743
+ }
2744
+ onViewPublication(e, t) {
2745
+ this.hooks.destroyed() || e !== this.hooks.current() || t.generation <= this.viewGeneration || (this.viewGeneration = t.generation, this.hooks.adoptView(t));
2746
+ }
2747
+ apply(e) {
2748
+ let t = [...this.hooks.mounted()], n = this.prefix;
2749
+ if (this.prefix = e.pageCount, (e.unchangedPages ?? 0) >= Math.min(n, e.pageCount)) {
2750
+ this.hooks.relayout();
2751
+ return;
2752
+ }
2753
+ this.hooks.invalidateRender(), this.hooks.relayout();
2754
+ for (let [e, n] of t) e >= this.prefix || !this.hooks.stillMounted(e, n) || this.hooks.refreshSlot(e, n);
2755
+ }
2756
+ destroy() {
2757
+ this.unbind();
2758
+ }
2759
+ }, Ir = 12, Lr = 13, Rr = Symbol("DocxScrollViewer.borrowedDocument"), zr;
2760
+ function Br() {
2761
+ return zr ??= import("ooxml/comment-ui-runtime-hfewTmVJ.js");
2762
+ }
2763
+ var Vr = class e {
2764
+ _pendingLoadAbort = null;
2765
+ _pendingRequestedView;
2766
+ _pendingViewChanged = null;
2767
+ _documentOwner;
2768
+ get _doc() {
2769
+ return this._documentOwner.current;
2770
+ }
2771
+ _borrowed;
2772
+ _opts;
2773
+ _errorRouter;
2774
+ _container;
2775
+ _shell;
2776
+ get _wrapper() {
2777
+ return this._shell.wrapper;
2778
+ }
2779
+ get _scrollHost() {
2780
+ return this._shell.scrollHost;
2781
+ }
2782
+ get _spacer() {
2783
+ return this._shell.spacer;
2784
+ }
2785
+ _mode;
2786
+ _viewport = new le({
2787
+ options: () => this._opts,
2788
+ container: () => this._container,
2789
+ scrollHost: () => this._scrollHost
2790
+ });
2791
+ _zoom = new Se({
2792
+ scrollHost: () => this._scrollHost,
2793
+ spacer: () => this._spacer,
2794
+ count: () => this._doc?.pageCount ?? 0,
2795
+ zoomMin: () => this._opts.zoomMin ?? .1,
2796
+ zoomMax: () => this._opts.zoomMax ?? 4,
2797
+ baseScale: () => this._baseScale(),
2798
+ fitWidthPx: () => this._viewport.fitWidth(),
2799
+ fitContentSize: (e) => {
2800
+ if (!this._doc) return null;
2801
+ let t = this._doc.pageSize(0);
2802
+ return {
2803
+ width: (e === "width" ? this._widestPageWidthPt() : t.widthPt) * n,
2804
+ height: t.heightPt * n
2805
+ };
2806
+ },
2807
+ indexAt: (e) => this._pageIndexAtOffset(this._range(), e),
2808
+ offset: (e) => this._scrollGeometry.offsets[e] ?? 0,
2809
+ height: (e) => this._heights[e] || 0,
2810
+ totalHeight: () => this._scrollGeometry.totalHeight,
2811
+ recomputeHeights: () => this._recomputeHeights(),
2812
+ syncSpacerWidth: () => this._syncSpacerWidth(),
2813
+ padLeft: () => this._viewport.horizontalPadding().left,
2814
+ invalidateRender: () => {
2815
+ this._renderEpoch++;
2816
+ },
2817
+ preview: () => this._previewVisible(),
2818
+ scheduleSettle: () => this._scheduleSettle(),
2819
+ onScaleChange: (e) => this._opts.onScaleChange?.(e),
2820
+ relayout: () => this.relayout(),
2821
+ mountVisible: () => this._mountVisible(),
2822
+ refitOnResize: () => this._opts.refitOnResize !== !1
2823
+ });
2824
+ get _scale() {
2825
+ return this._zoom.scale;
2826
+ }
2827
+ get _scaleEstablished() {
2828
+ return this._zoom.established;
2829
+ }
2830
+ _scroller = new ue({
2831
+ spacer: () => this._spacer,
2832
+ count: () => this._doc?.pageCount ?? 0,
2833
+ range: () => this._range(),
2834
+ createSlot: () => this._createSlot(),
2835
+ attachSlot: (e) => this._scrollHost.appendChild(e.wrapper),
2836
+ resetSlot: (e, t) => this._resetSlot(e, t),
2837
+ positionSlot: (e, t, n) => this._positionSlot(t, e, n),
2838
+ renderSlot: (e, t, n) => this._renderSlot(e, t, n),
2839
+ previewSlot: (e, t, n) => this._previewSlot(t, e, n),
2840
+ settleSlot: (e, t) => this._refreshSlotAtomically(e, t),
2841
+ renderedScale: (e) => e.renderedScale,
2842
+ scale: () => this._scale,
2843
+ syncSpacerWidth: () => this._syncSpacerWidth(),
2844
+ onRange: (e) => this._emitVisiblePageChange(e),
2845
+ onExistingSlot: (e, t, n) => this._renderSlot(e, t, n)
2846
+ });
2847
+ _slots = this._scroller.slots;
2848
+ _layout = new Fr({
2849
+ current: () => this._doc,
2850
+ destroyed: () => this._destroyed,
2851
+ report: (e) => this._reportRenderError(e),
2852
+ reportBackground: (e) => this._errorRouter.reportBackground(e, this._opts.onLayoutComplete !== void 0),
2853
+ invalidateFind: () => this._find.invalidate(),
2854
+ refreshComments: () => this._refreshCommentSurface(),
2855
+ adoptView: (e) => {
2856
+ e.requester !== this && (this._layoutViewGeneration++, this._showTrackedChanges = e.view.showTrackedChanges, this._currentDate = e.view.currentDate, this._find.invalidate(), this._layout.apply({
2857
+ pageCount: this._doc.pageCount,
2858
+ exact: !0,
2859
+ complete: this._doc.layoutComplete
2860
+ }));
2861
+ },
2862
+ relayout: () => this.relayout(),
2863
+ invalidateRender: () => {
2864
+ this._renderEpoch++;
2865
+ },
2866
+ mounted: () => this._slots,
2867
+ stillMounted: (e, t) => this._slots.get(e) === t,
2868
+ refreshSlot: (e, t) => this._refreshSlotAtomically(e, t)
2869
+ });
2870
+ _renderHooks = {
2871
+ slots: () => this._slots,
2872
+ epoch: () => this._renderEpoch,
2873
+ scale: () => this._scale,
2874
+ slotIndex: (e) => e.renderedPage,
2875
+ token: () => 0,
2876
+ nextToken: () => 0,
2877
+ wantRuns: (e) => !!(this._opts.enableTextSelection && e.textLayer) || this._findActive || !!e.commentTintLayer,
2878
+ reportError: (e) => this._reportRenderError(e)
2879
+ };
2880
+ _bitmap = new fe({
2881
+ ...this._renderHooks,
2882
+ inFlight: () => this._scroller.inFlight,
2883
+ destroyed: () => this._destroyed,
2884
+ width: (e) => this._pageWidthPx(e),
2885
+ dpr: () => this._viewport.dpr(),
2886
+ canRetry: () => !0,
2887
+ render: (e, t, n, r, i) => jr(this._doc, t, e, "worker", {
2888
+ width: n,
2889
+ dpr: r,
2890
+ imageResources: this._opts.imageResources,
2891
+ defaultTextColor: this._opts.defaultTextColor,
2892
+ currentDate: this._currentDate,
2893
+ ...this._showTrackedChanges ? { showTrackedChanges: !0 } : {},
2894
+ onTextRun: i
2895
+ }),
2896
+ commitBitmap: (e, t, n, r, i, a) => n.commitBitmap(r, i, {
2897
+ cssWidth: a,
2898
+ cssHeight: this._pageHeightPx(e)
2899
+ }),
2900
+ commitRuns: (e, t, n, r, i) => this._commitRenderedRuns(e, t, n, t.canvas, i, !0)
2901
+ });
2902
+ _main = new pe({
2903
+ ...this._renderHooks,
2904
+ render: (e, t, n, r, i) => jr(this._doc, t, e, "main", {
2905
+ width: n,
2906
+ dpr: r,
2907
+ imageResources: this._opts.imageResources,
2908
+ defaultTextColor: this._opts.defaultTextColor,
2909
+ currentDate: this._currentDate,
2910
+ ...this._showTrackedChanges ? { showTrackedChanges: !0 } : {},
2911
+ onTextRun: i
2912
+ }),
2913
+ commitRuns: (e, t, n, r, i, a, o) => this._commitRenderedRuns(e, t, n, r, a, o),
2914
+ shadow: () => this._pageShadow
2915
+ });
2916
+ _navigation = new _e({
2917
+ host: () => this._scrollHost,
2918
+ spacer: () => this._spacer,
2919
+ count: () => this.pageCount,
2920
+ established: () => this._scaleEstablished,
2921
+ offset: (e) => this._scrollGeometry.offsets[e] ?? 0,
2922
+ height: (e) => this._heights[e] || 0,
2923
+ indexAt: (e) => this._pageIndexAtOffset(this._range(), e),
2924
+ totalHeight: () => this._scrollGeometry.totalHeight,
2925
+ width: (e) => this._pageWidthPx(e),
2926
+ padLeft: () => this._viewport.horizontalPadding().left,
2927
+ marginOrigin: () => this._commentMargin.originPx,
2928
+ mount: () => this._mountVisible()
2929
+ });
2930
+ _selection = new ye({
2931
+ wrapper: () => this._wrapper,
2932
+ scrollHost: () => this._scrollHost,
2933
+ slots: () => this._slots,
2934
+ resource: () => this._doc,
2935
+ destroyed: () => this._destroyed,
2936
+ textSelectionEnabled: () => this._opts.enableTextSelection === !0,
2937
+ elementSelectionEnabled: () => this._opts.enableElementSelection === !0,
2938
+ textSelected: () => $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null) !== null,
2939
+ getContext: () => this.getSelectionContext(),
2940
+ hitTest: (e, t, n, r) => {
2941
+ let i = e.pageSize(t);
2942
+ return e.getElementContextAt(t, {
2943
+ xPt: n * i.widthPt,
2944
+ yPt: r * i.heightPt
2945
+ }, {
2946
+ currentDate: this._currentDate,
2947
+ ...this._showTrackedChanges ? { showTrackedChanges: !0 } : {},
2948
+ maxTextCharacters: wn
2949
+ });
2950
+ },
2951
+ outline: (e, t, n) => {
2952
+ if (n.pageIndex !== t) return null;
2953
+ let r = e.pageSize(t);
2954
+ return {
2955
+ x: n.bounds.xPt / r.widthPt,
2956
+ y: n.bounds.yPt / r.heightPt,
2957
+ width: n.bounds.widthPt / r.widthPt,
2958
+ height: n.bounds.heightPt / r.heightPt
2959
+ };
2960
+ },
2961
+ onChange: (e) => this._opts.onSelectionContextChange?.(e),
2962
+ onContextMenu: (e, t) => this._opts.onContextMenu?.({
2963
+ originalEvent: e,
2964
+ getContext: t
2965
+ }),
2966
+ reportError: (e) => this._reportRenderError(e)
2967
+ });
2968
+ _heights = [];
2969
+ _scrollGeometry = {
2970
+ offsets: [],
2971
+ totalHeight: 0
2972
+ };
2973
+ _visibleEvents = new be((e, t, n) => this._opts.onVisiblePageChange?.(e, t, n));
2974
+ _loader = new se({
2975
+ name: () => "DocxScrollViewer",
2976
+ borrowed: () => this._borrowed,
2977
+ borrowedMessage: () => "DocxScrollViewer.load() is unsupported on a Viewer created by fromDocument(); the borrowed document is already loaded.",
2978
+ destroyed: () => this._destroyed,
2979
+ owner: () => this._documentOwner,
2980
+ beginLoad: () => {
2981
+ let e = this._pendingRequestedView;
2982
+ this._pendingLoadAbort?.abort();
2983
+ let t = new AbortController();
2984
+ return this._pendingLoadAbort = t, this._pendingRequestedView = e, t;
2985
+ },
2986
+ isCurrentLoad: (e) => this._pendingLoadAbort === e,
2987
+ finishLoad: (e) => {
2988
+ this._pendingLoadAbort === e && (this._pendingLoadAbort = null, this._pendingRequestedView = void 0, this._pendingViewChanged = null);
2989
+ },
2990
+ acquire: async (e, t) => {
2991
+ let n = this._pendingRequestedView, r = await Q.load(e, {
2992
+ password: this._opts.password,
2993
+ useGoogleFonts: this._opts.useGoogleFonts,
2994
+ allowFootnoteContinuation: this._opts.allowFootnoteContinuation,
2995
+ cjkFallback: this._opts.cjkFallback,
2996
+ maxZipEntryBytes: this._opts.maxZipEntryBytes,
2997
+ resourceLimits: this._opts.resourceLimits,
2998
+ debug: this._opts.debug,
2999
+ onResourceMetrics: this._opts.onResourceMetrics,
3000
+ workerTimeoutMs: this._opts.workerTimeoutMs,
3001
+ wasmUrl: this._opts.wasmUrl,
3002
+ math: this._opts.math,
3003
+ threeD: this._opts.threeD,
3004
+ regionMap: this._opts.regionMap,
3005
+ chartEx: this._opts.chartEx,
3006
+ tiff: this._opts.tiff,
3007
+ mode: this._mode,
3008
+ ...n === void 0 ? this._opts.legacyDoc === void 0 ? this._showTrackedChanges ? { showTrackedChanges: !0 } : {} : this._requestedShowTrackedChanges === void 0 ? void 0 : { showTrackedChanges: this._requestedShowTrackedChanges } : { showTrackedChanges: n },
3009
+ ...this._currentDate === void 0 ? {} : { currentDate: this._currentDate },
3010
+ ...this._opts.legacyDoc === void 0 ? void 0 : { legacyDoc: this._opts.legacyDoc },
3011
+ ...this._opts.progressiveLayout ? { progressiveLayout: !0 } : {},
3012
+ ...this._opts.sliceLayout === void 0 ? {} : { sliceLayout: this._opts.sliceLayout },
3013
+ [vr]: {
3014
+ signal: t.signal,
3015
+ requestedView: () => this._pendingRequestedView,
3016
+ subscribeViewChange: (e) => (this._pendingViewChanged = e, () => {
3017
+ this._pendingViewChanged === e && (this._pendingViewChanged = null);
3018
+ })
3019
+ },
3020
+ onLayoutProgress: this._opts.onLayoutProgress,
3021
+ onLayoutPartial: this._opts.onLayoutPartial,
3022
+ onLayoutComplete: this._opts.onLayoutComplete
3023
+ });
3024
+ return await hr(r, t.signal, () => this._pendingRequestedView, () => this._currentDate, this), r;
3025
+ },
3026
+ beforeReplace: (e) => {
3027
+ if (this._selection.invalidateElementContext(!1), this._findRequestGeneration++, this._find.invalidate(), this._findActive = !1, this._activeCommentId = null, this._activeCommentPage = null, this._commentNavigation.reset(), this._layout.unbind(), e) {
3028
+ for (let [e, t] of [...this._slots]) this._recycleSlot(e, t);
3029
+ this._visibleEvents.reset();
3030
+ }
3031
+ },
3032
+ afterReplace: (e) => {
3033
+ this._pendingRequestedView !== void 0 && (this._showTrackedChanges = this._pendingRequestedView, this._requestedShowTrackedChanges = this._pendingRequestedView), this._opts.legacyDoc !== void 0 && (this._showTrackedChanges = Y(e).showTrackedChanges), this._layout.bind(e), this._find.invalidate(), this._findActive = !1, this._activeCommentId = null, this._activeCommentPage = null, this._commentNavigation.reset();
3034
+ },
3035
+ mountOpeningWindow: async () => {
3036
+ let e = [];
3037
+ this._relayout(e), await Promise.all(e);
3038
+ },
3039
+ selectionChanged: () => this._selection.emitChange()
3040
+ });
3041
+ _activeCommentId = null;
3042
+ _activeCommentPage = null;
3043
+ _commentUi = null;
3044
+ _internalHyperlinkGeneration = 0;
3045
+ _commentAnchorRangesForMargin = null;
3046
+ _commentAnchorIds = /* @__PURE__ */ new Set();
3047
+ _commentMargin = new me({
3048
+ container: () => this._container,
3049
+ scrollHost: () => this._scrollHost,
3050
+ spacer: () => this._spacer,
3051
+ enabled: () => this._commentsEnabled(),
3052
+ cards: () => this._commentsOptions()?.cards !== !1,
3053
+ hasDisplayableComments: () => this._hasDisplayableComments(),
3054
+ requestedSide: () => this._commentsOptions()?.side,
3055
+ zoom: () => this._scaleEstablished ? this._scale : 1,
3056
+ gapPx: Ir,
3057
+ widthPx: 280,
3058
+ fontSizePx: Lr
3059
+ });
3060
+ _layers = new we({
3061
+ markerLayer: (e) => e.commentTintLayer,
3062
+ syncMargin: (e) => this._commentMargin.syncMargin(e),
3063
+ marginSide: () => this._commentMargin.side(),
3064
+ marginExtent: () => this._commentMargin.extent(),
3065
+ commentsEnabled: () => this._commentsEnabled(),
3066
+ previewMargin: (e, t) => this._commentUi?.previewReadOnlyCommentMargin(e, t),
3067
+ disposeMargin: (e) => {
3068
+ this._commentUi?.disposeReadOnlyCommentMargin(e), this._commentUi || e.replaceChildren();
3069
+ },
3070
+ disposeDecoration: (e) => {
3071
+ this._commentUi?.disposeReadOnlyCommentDecoration(e), this._commentUi || e.replaceChildren();
3072
+ },
3073
+ redrawOutline: (e, t) => this._selection.redrawOutlineForSlot(e, t),
3074
+ markerRatio: (e) => e,
3075
+ resetMarkerTransform: () => !0,
3076
+ resetDecorationVisibility: () => !1
3077
+ });
3078
+ _commentNavigation = new Pr({
3079
+ document: () => this._doc,
3080
+ destroyed: () => this._destroyed,
3081
+ scale: () => this._scale,
3082
+ pageWidth: (e) => this._pageWidthPx(e),
3083
+ currentDate: () => this._currentDate,
3084
+ showTrackedChanges: () => this._showTrackedChanges,
3085
+ waitForLayout: (e) => this._errorRouter.ownBackgroundLifecycle(() => e.waitUntilLayoutComplete()),
3086
+ select: (e, t, n, r) => {
3087
+ this._activeCommentId = e, this._activeCommentPage = t, this._selection.clearElementContext(), this._scrollToPageTarget(t, n, r);
3088
+ for (let [e, t] of this._slots) this._redrawSlotComments(e, t);
3089
+ this._selection.emitChange();
3090
+ }
3091
+ });
3092
+ _commentOverlay = new Ce({
3093
+ slots: () => this._slots,
3094
+ scale: () => this._scale,
3095
+ destroyed: () => this._destroyed,
3096
+ ownerWindow: () => this._wrapper.ownerDocument.defaultView,
3097
+ width: (e) => this._pageWidthPx(e),
3098
+ height: (e) => this._pageHeightPx(e),
3099
+ side: () => this._commentMargin.side(),
3100
+ marginExtent: () => this._commentMargin.extent(),
3101
+ connectorOptions: () => this._commentsOptions()?.connectors,
3102
+ runtime: () => this._commentUi,
3103
+ redrawComments: (e, t) => this._redrawSlotComments(e, t)
3104
+ });
3105
+ _destroyed = !1;
3106
+ get _renderEpoch() {
3107
+ return this._scroller.renderEpoch;
3108
+ }
3109
+ set _renderEpoch(e) {
3110
+ this._scroller.renderEpoch = e;
3111
+ }
3112
+ get _prevBase() {
3113
+ return this._zoom.prevBase;
3114
+ }
3115
+ set _prevBase(e) {
3116
+ this._zoom.prevBase = e;
3117
+ }
3118
+ _pageShadow;
3119
+ _find = new Er(() => this.pageCount, (e) => this._collectPageRuns(e));
3120
+ _findActive = !1;
3121
+ _highlights = new oe({
3122
+ slots: () => this._slots,
3123
+ active: () => this._findActive,
3124
+ runs: (e) => this._find.pageRuns(e),
3125
+ setRuns: (e, t) => this._find.setPageRuns(e, t),
3126
+ paint: (e, t, n, r) => Tr(t.highlightLayer, n, this._find.pageHighlights(e), this._pageWidthPx(e), this._pageHeightPx(e), r, this._opts.findHighlightColors),
3127
+ reveal: (e) => this.scrollToPage(e),
3128
+ unitOf: (e) => e.page
3129
+ });
3130
+ _findRequestGeneration = 0;
3131
+ _showTrackedChanges;
3132
+ _currentDate;
3133
+ _layoutViewGeneration = 0;
3134
+ static fromDocument(t, n, r = {}) {
3135
+ let i = Y(n);
3136
+ return new e(t, {
3137
+ ...r,
3138
+ currentDate: i.currentDate,
3139
+ showTrackedChanges: i.showTrackedChanges,
3140
+ [Rr]: n
3141
+ });
3142
+ }
3143
+ constructor(e, t = {}) {
3144
+ if (e.tagName === "CANVAS") throw Error("DocxScrollViewer takes a container element (e.g. a <div>), not a <canvas> — the viewer creates and manages its own canvases. Pass a block container; for the single-page canvas API use DocxViewer.");
3145
+ this._container = e, this._opts = t, this._errorRouter = new vt("DocxScrollViewer", t.onError), this._showTrackedChanges = t.showTrackedChanges === !0, t.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = t.showTrackedChanges), this._currentDate = t.currentDate, this._pageShadow = t.pageShadow ?? "0 1px 3px rgba(0,0,0,0.2)";
3146
+ let n = t[Rr];
3147
+ this._borrowed = n !== void 0, n ? (this._documentOwner = new xt("DocxScrollViewer", n, !1), this._mode = Et("DocxScrollViewer", t.mode, n)) : (this._documentOwner = new xt("DocxScrollViewer"), this._mode = Et("DocxScrollViewer", t.mode, void 0)), this._shell = new Te(e, {
3148
+ background: t.background,
3149
+ comments: !!t.comments,
3150
+ onScroll: () => this._onScroll(),
3151
+ onOutsideComment: () => {
3152
+ if (this._activeCommentId !== null) {
3153
+ this._activeCommentId = null, this._activeCommentPage = null;
3154
+ for (let [e, t] of this._slots) this._redrawSlotComments(e, t);
3155
+ this._selection.emitChange();
3156
+ }
3157
+ }
3158
+ }), this._commentsEnabled() && Br().then((e) => {
3159
+ if (!this._destroyed) {
3160
+ this._commentUi = e;
3161
+ for (let [e, t] of this._slots) this._redrawSlotComments(e, t);
3162
+ }
3163
+ }).catch((e) => this._reportRenderError(e)), this._selection.bind(!!t.onSelectionContextChange, !!t.onContextMenu), this._zoom.bind(this._container, this._scrollHost, this._opts.enableZoom !== !1), this._borrowed && (this._layout.bind(n), this.relayout());
3164
+ }
3165
+ async load(e) {
3166
+ await this._loader.load(e);
3167
+ }
3168
+ get pageCount() {
3169
+ return this._doc?.pageCount ?? 0;
3170
+ }
3171
+ get layoutComplete() {
3172
+ return this._doc?.layoutComplete ?? !0;
3173
+ }
3174
+ async waitUntilLayoutComplete() {
3175
+ await this._errorRouter.ownBackgroundLifecycle(async () => {
3176
+ await this._doc?.waitUntilLayoutComplete?.();
3177
+ });
3178
+ }
3179
+ _refreshCommentSurface() {
3180
+ if (!(!this._commentsEnabled() || this._slots.size === 0)) {
3181
+ this._syncSpacerWidth();
3182
+ for (let [e, t] of this._slots) this._redrawSlotComments(e, t);
3183
+ }
3184
+ }
3185
+ _pageWidthPx(e) {
3186
+ return this._doc.pageSize(e).widthPt * n * this._scale;
3187
+ }
3188
+ _pageHeightPx(e) {
3189
+ return this._doc.pageSize(e).heightPt * n * this._scale;
3190
+ }
3191
+ _hasDisplayableComments() {
3192
+ if (!this._commentsEnabled()) return !1;
3193
+ let e = this._doc;
3194
+ if (!e) return !1;
3195
+ let t = e.commentAnchorRanges();
3196
+ if (this._commentAnchorRangesForMargin !== t && (this._commentAnchorRangesForMargin = t, this._commentAnchorIds = new Set(t.map((e) => e.commentId))), this._commentAnchorIds.size === 0) return !1;
3197
+ let n = this._commentsOptions()?.includeResolved === !0;
3198
+ return e.comments.some((e) => this._commentAnchorIds.has(e.id) && e.parentId === void 0 && (n || e.resolved !== !0));
3199
+ }
3200
+ _commentsEnabled() {
3201
+ return this._opts.comments === !0 || typeof this._opts.comments == "object";
3202
+ }
3203
+ _commentsOptions() {
3204
+ return typeof this._opts.comments == "object" ? this._opts.comments : void 0;
3205
+ }
3206
+ _widestPageWidthPt() {
3207
+ if (!this._doc) return 0;
3208
+ let e = 0, t = this._layout.presentedPageCount || this._doc.pageCount;
3209
+ for (let n = 0; n < t; n++) {
3210
+ let t = this._doc.pageSize(n).widthPt;
3211
+ t > e && (e = t);
3212
+ }
3213
+ return e;
3214
+ }
3215
+ _baseScale() {
3216
+ if (!this._doc || this._doc.pageCount === 0) return 0;
3217
+ let e = this._viewport.fitWidth();
3218
+ if (e <= 0) return 0;
3219
+ let t = this._widestPageWidthPt();
3220
+ return t <= 0 ? 0 : e / (t * n);
3221
+ }
3222
+ relayout() {
3223
+ this._relayout();
3224
+ }
3225
+ _relayout(e) {
3226
+ if (this._doc) {
3227
+ if (this._doc.layoutComplete !== !1 && (this._layout.presentedPageCount = this._doc.pageCount), this._scaleEstablished) {
3228
+ let e = this._baseScale();
3229
+ if (e > 0 && e !== this._prevBase) {
3230
+ let t = this._prevBase > 0 ? this._scale / this._prevBase : 1;
3231
+ this._prevBase = e, this.setScale(e * t);
3232
+ }
3233
+ } else if (!this._zoom.establishBase()) return;
3234
+ this._recomputeHeights(), this._syncSpacer(), this._mountVisible(e);
3235
+ for (let [e, t] of this._slots) t.renderedPage === e && t.renderedScale >= 0 && this._redrawSlotComments(e, t);
3236
+ }
3237
+ }
3238
+ _recomputeHeights() {
3239
+ let e = Math.min(this._layout.presentedPageCount, this._doc.pageCount), t = Array(e);
3240
+ for (let n = 0; n < e; n++) t[n] = this._pageHeightPx(n);
3241
+ this._heights = t, this._scrollGeometry = te(t, this._viewport.gap(), this._viewport.verticalPadding());
3242
+ }
3243
+ _pageIndexAtOffset(e, t) {
3244
+ let { offsets: n } = e, r = 0, i = n.length - 1, a = 0;
3245
+ for (; r <= i;) {
3246
+ let e = r + i >> 1;
3247
+ n[e] <= t ? (a = e, r = e + 1) : i = e - 1;
3248
+ }
3249
+ return a;
3250
+ }
3251
+ _range() {
3252
+ return ge(this._scrollGeometry, this._scrollHost.scrollTop, this._scrollHost.clientHeight, this._viewport.overscan());
3253
+ }
3254
+ _syncSpacer() {
3255
+ this._scroller.syncSpacer();
3256
+ }
3257
+ _syncSpacerWidth() {
3258
+ let { left: e, right: t } = this._viewport.horizontalPadding(), n = 0;
3259
+ for (let e = 0; e < this._heights.length; e++) {
3260
+ let t = this._pageWidthPx(e);
3261
+ t > n && (n = t);
3262
+ }
3263
+ this._commentMargin.syncSpacerWidth(n, e, t);
3264
+ }
3265
+ _onScroll() {
3266
+ !this._doc || !this._scaleEstablished || this._mountVisible(void 0, !1);
3267
+ }
3268
+ _mountVisible(e, t = !0) {
3269
+ this._scroller.mount(e, t);
3270
+ }
3271
+ _emitVisiblePageChange(e) {
3272
+ this._doc && this._visibleEvents.publish(e, this._doc.pageCount, this.layoutComplete);
3273
+ }
3274
+ _createSlot() {
3275
+ let { wrapper: e, canvas: t, textLayer: n, highlightLayer: r } = ve(this._scrollHost, this._opts.enableTextSelection === !0, this._pageShadow), { markerLayer: i, margin: a, decorationLayer: o } = xe(e, this._commentsEnabled(), this._commentsOptions()?.cards !== !1, this._commentsOptions()?.connectors !== void 0, (e) => this._commentMargin.syncMargin(e)), s = wt(e, this._opts.enableElementSelection === !0);
3276
+ return this._scrollHost.appendChild(e), {
3277
+ wrapper: e,
3278
+ canvas: t,
3279
+ textLayer: n,
3280
+ highlightLayer: r,
3281
+ elementLayer: s,
3282
+ commentTintLayer: i,
3283
+ commentMargin: a,
3284
+ commentDecorationLayer: o,
3285
+ commentRuns: Object.freeze([]),
3286
+ commentGeometry: null,
3287
+ renderedPage: -1,
3288
+ renderedScale: -1,
3289
+ dispatcher: new pt(t, this._mode === "worker")
3290
+ };
3291
+ }
3292
+ _recycleSlot(e, t) {
3293
+ this._scroller.recycleSlot(e, t);
3294
+ }
3295
+ _resetSlot(e, t) {
3296
+ t.dispatcher.destroy(), this._destroyed || (t.dispatcher = new pt(t.canvas, this._mode === "worker")), this._layers.reset(t), t.commentRuns = Object.freeze([]), t.commentGeometry = null, t.renderedPage = -1, t.renderedScale = -1, t.wrapper.remove();
3297
+ }
3298
+ _positionSlot(e, t, n) {
3299
+ this._layers.position(t, e, n.offsets[t], this._pageWidthPx(t), this._pageHeightPx(t), this._scrollHost.clientWidth, this._viewport.horizontalPadding().left);
3300
+ }
3301
+ _renderSlot(e, t, n = !0) {
3302
+ if (!this._doc || t.renderedPage === e) return null;
3303
+ t.renderedPage = e;
3304
+ let r = this._viewport.dpr(), i = this._pageWidthPx(e), a = this._scale, o = t.dispatcher, s = o.begin();
3305
+ return this._mode === "worker" ? this._renderSlotBitmap(e, t, i, r, a, o, s, n) : this._main.render(e, t, i, r, 0, o, s, n);
3306
+ }
3307
+ _hyperlinkHandler() {
3308
+ return this._opts.enableHyperlinks === !1 ? void 0 : this._opts.onHyperlinkClick || ((e) => {
3309
+ if (e.kind === "external") {
3310
+ C(e.url);
3311
+ return;
3312
+ }
3313
+ let t = this._doc;
3314
+ if (!t) return;
3315
+ let n = ++this._internalHyperlinkGeneration;
3316
+ this._navigateInternalHyperlink(t, e.ref, n).catch((e) => this._reportRenderError(e));
3317
+ });
3318
+ }
3319
+ async _navigateInternalHyperlink(e, t, n) {
3320
+ if (e.layoutComplete || await e.waitUntilLayoutComplete(), this._destroyed || this._doc !== e || n !== this._internalHyperlinkGeneration) return;
3321
+ let r = e.getBookmarkPage(t);
3322
+ r !== void 0 && this.scrollToPage(r);
3323
+ }
3324
+ _canvasCssPx(e) {
3325
+ return {
3326
+ width: parseFloat(e.style.width) || e.width,
3327
+ height: parseFloat(e.style.height) || e.height
3328
+ };
3329
+ }
3330
+ _commitRenderedRuns(e, t, n, r, i, a) {
3331
+ if (t.textLayer && (a && this._clearTextLayerPreview(t.textLayer), this._opts.enableTextSelection)) {
3332
+ let { width: i, height: a } = this._canvasCssPx(r);
3333
+ wr(t.textLayer, n, i, a, this._hyperlinkHandler(), (e) => this._highlights.measure(e), e);
3334
+ }
3335
+ i && this._highlights.refreshRuns(e, n), this._commitCommentRuns(e, t, n), this._highlights.redrawSlot(e, t);
3336
+ }
3337
+ _reportRenderError(e) {
3338
+ this._errorRouter.report(e);
3339
+ }
3340
+ _renderSlotBitmap(e, t, n, r, i, a = t.dispatcher, o = a.begin(), s = !0) {
3341
+ return this._bitmap.render(e, t, n, r, i, 0, a, o, s);
3342
+ }
3343
+ setScale(e) {
3344
+ this._zoom.setScale(e);
3345
+ }
3346
+ getScale() {
3347
+ return this._zoom.getScale();
3348
+ }
3349
+ zoomIn() {
3350
+ this._zoom.zoomIn();
3351
+ }
3352
+ zoomOut() {
3353
+ this._zoom.zoomOut();
3354
+ }
3355
+ fitWidth() {
3356
+ this._zoom.fit("width");
3357
+ }
3358
+ fitPage() {
3359
+ this._zoom.fit("page");
3360
+ }
3361
+ _previewVisible() {
3362
+ this._scroller.preview();
3363
+ }
3364
+ _previewSlot(e, t, n) {
3365
+ this._positionSlot(e, t, n), this._layers.preview(e, this._pageWidthPx(t), this._pageHeightPx(t), this._scale);
3366
+ }
3367
+ _clearTextLayerPreview(e) {
3368
+ de(e);
3369
+ }
3370
+ _scheduleSettle() {
3371
+ this._scroller.scheduleSettle(150);
3372
+ }
3373
+ _refreshSlotAtomically(e, t) {
3374
+ if (!this._doc) return;
3375
+ let n = this._viewport.dpr(), r = this._pageWidthPx(e), i = this._scale;
3376
+ if (this._mode === "worker") {
3377
+ this._renderSlotBitmap(e, t, r, n, i);
3378
+ return;
3379
+ }
3380
+ this._main.settle(e, t, r, n);
3381
+ }
3382
+ async setShowTrackedChanges(e) {
3383
+ let t = ++this._layoutViewGeneration;
3384
+ if (this._pendingLoadAbort) {
3385
+ let t = this._pendingRequestedView !== e;
3386
+ this._pendingRequestedView = e, t && this._pendingViewChanged?.();
3387
+ }
3388
+ let n = this._doc;
3389
+ if (this._opts.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = e), this._showTrackedChanges === e) {
3390
+ n && await X(n, {
3391
+ showTrackedChanges: e,
3392
+ currentDate: this._currentDate
3393
+ }, this);
3394
+ return;
3395
+ }
3396
+ (!n || await X(n, {
3397
+ showTrackedChanges: e,
3398
+ currentDate: this._currentDate
3399
+ }, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChanges = e, this._opts.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = e), this._find.invalidate(), this._layout.apply({
3400
+ pageCount: n?.pageCount ?? 0,
3401
+ exact: !0,
3402
+ complete: n?.layoutComplete !== !1
3403
+ })));
3404
+ }
3405
+ scrollToPage(e, t) {
3406
+ this._navigation.scrollToUnit(e, t);
3407
+ }
3408
+ _scrollToPageTarget(e, t, n) {
3409
+ this._navigation.scrollToPoint(e, t.x + t.w / 2, t.y + t.h / 2, n);
3410
+ }
3411
+ async goToComment(e, t) {
3412
+ return this._commentNavigation.goToComment(e, t);
3413
+ }
3414
+ async findText(e, t = {}) {
3415
+ if (!this._doc) return [];
3416
+ let n = ++this._findRequestGeneration;
3417
+ if (this._doc.layoutComplete === !1) {
3418
+ let e = this._doc;
3419
+ if (await this._errorRouter.ownBackgroundLifecycle(() => e.waitUntilLayoutComplete()), this._destroyed || this._doc !== e || n !== this._findRequestGeneration) return [];
3420
+ }
3421
+ this._findActive = e.length > 0;
3422
+ let r = await this._errorRouter.ownAwaitable(() => this._find.find(e, t));
3423
+ return this._highlights.redrawAll(), r;
3424
+ }
3425
+ async findNext() {
3426
+ return this._highlights.activate(this._find.next());
3427
+ }
3428
+ async findPrev() {
3429
+ return this._highlights.activate(this._find.prev());
3430
+ }
3431
+ clearFind() {
3432
+ this._findRequestGeneration++, this._findActive = !1, this._find.invalidate(), this._highlights.redrawAll();
3433
+ }
3434
+ async _collectPageRuns(e) {
3435
+ return this._doc ? this._doc.collectPageRuns(e, {
3436
+ width: this._pageWidthPx(e),
3437
+ currentDate: this._currentDate,
3438
+ ...this._showTrackedChanges ? { showTrackedChanges: !0 } : {}
3439
+ }) : [];
3440
+ }
3441
+ _commitCommentRuns(e, t, n) {
3442
+ t.commentTintLayer && (t.commentRuns = Object.freeze([...n]), this._commentNavigation.commitRuns(e, t.commentRuns), t.commentTintLayer.style.transform = "", t.commentTintLayer.style.transformOrigin = "", this._redrawSlotComments(e, t), t.commentTintLayer.style.visibility = "", t.commentMargin && (t.commentMargin.style.visibility = ""), t.commentDecorationLayer && (t.commentDecorationLayer.style.visibility = ""));
3443
+ }
3444
+ _redrawSlotComments(e, t) {
3445
+ if (!this._doc || !t.commentTintLayer) return;
3446
+ this._commentMargin.syncMargin(t.commentMargin);
3447
+ let n = this._commentUi;
3448
+ if (!n) {
3449
+ t.commentTintLayer.replaceChildren(), t.commentMargin?.replaceChildren(), t.commentDecorationLayer?.replaceChildren(), t.commentGeometry = null;
3450
+ return;
3451
+ }
3452
+ t.commentGeometry = n.buildDocxCommentMargin(t.commentTintLayer, t.commentMargin, t.commentRuns, {
3453
+ comments: this._doc.comments,
3454
+ anchors: this._doc.commentAnchorRanges()
3455
+ }, this._pageWidthPx(e), this._pageHeightPx(e), this._activeCommentId, (t, n) => {
3456
+ let r = n ? t : this._activeCommentId === t ? null : this._activeCommentId;
3457
+ if (r !== this._activeCommentId) {
3458
+ this._activeCommentId = r, this._activeCommentPage = r ? e : null, this._selection.clearElementContext();
3459
+ for (let [e, t] of this._slots) this._redrawSlotComments(e, t);
3460
+ this._selection.emitChange();
3461
+ }
3462
+ }, this._commentMargin.zoom(), 280, this._commentsOptions()?.markers !== !1, this._commentsOptions()?.includeResolved === !0, t.commentDecorationLayer ? () => this._commentOverlay.schedule(e, t, !1) : void 0, t.commentDecorationLayer ? () => this._commentOverlay.schedule(e, t, !0) : void 0), this._commentOverlay.drawConnectors(e, t);
3463
+ }
3464
+ get topVisiblePage() {
3465
+ return this._scroller.lastRange?.topIndex ?? 0;
3466
+ }
3467
+ async getResourceMetrics() {
3468
+ if (!this._doc) throw Error("Document not loaded");
3469
+ return await this._doc.getResourceMetrics();
3470
+ }
3471
+ getSelectionContext(e = {}) {
3472
+ if (this._destroyed) throw Error("DocxScrollViewer is destroyed");
3473
+ return (this._doc && this._activeCommentId !== null && this._activeCommentPage !== null ? Dr(this._doc.comments, this._doc.commentAnchorRanges(), this._activeCommentId, this._activeCommentPage, e) : null) || ((this._opts.enableTextSelection ? $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._selection.elementContext ? zn(this._selection.elementContext, e.maxTextCharacters) : null));
3474
+ }
3475
+ destroy() {
3476
+ this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._errorRouter.close(), this._layout.unbind(), this._layoutViewGeneration++, this._commentNavigation.reset(), this._find.invalidate(), this._findActive = !1, this._selection.destroy(), this._highlights.destroy(), this._commentOverlay.destroy(), this._selection.clearElementContext(), this._scroller.destroy(), this._zoom.destroy(), this._commentMargin.destroy(), this._documentOwner.close(), this._shell.destroy());
3477
+ }
3478
+ };
3479
+ function Hr(e) {
3480
+ let t = [];
3481
+ for (let n of e.content) {
3482
+ if (n.type !== "paragraph") continue;
3483
+ let e = "";
3484
+ for (let t of n.runs) t.type === "text" && !t.noteRef && (e += t.text);
3485
+ e = e.trim(), e && t.push(e);
3486
+ }
3487
+ return t.join(" ");
3488
+ }
3489
+ var Ur = /* @__PURE__ */ e({
3490
+ DocxDocument: () => Q,
3491
+ DocxScrollViewer: () => Vr,
3492
+ DocxViewer: () => Nr,
3493
+ OoxmlDecodedImageLimitError: () => st,
3494
+ OoxmlError: () => r,
3495
+ OoxmlResourceLimitError: () => i,
3496
+ TiffDecodeError: () => lt,
3497
+ autoResize: () => ut,
3498
+ buildDocxHighlightLayer: () => Tr,
3499
+ buildDocxTextLayer: () => wr,
3500
+ isOoxmlDecodedImageLimitError: () => ot,
3501
+ isTiffDecodeError: () => ct,
3502
+ noteText: () => Hr,
3503
+ openExternalHyperlink: () => C,
3504
+ readDocxTextSelectionContext: () => $,
3505
+ resolveCommentAnchorRuns: () => W,
3506
+ resolveDocxCommentThreads: () => $n,
3507
+ resolveRevisionAnchorRuns: () => sr
3508
+ });
3509
+ export { sn as _, $ as a, Q as c, sr as d, W as f, L as g, mn as h, Nr as i, q as l, xn as m, Hr as n, Tr as o, $n as p, Vr as r, wr as s, Ur as t, lr as u };