@arbidocs/blocks 0.5.107 → 0.5.108

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 (341) hide show
  1. package/dist/{ConnectedCallDock-TDYRHPAK.js → ConnectedCallDock-DV4FU376.js} +8 -8
  2. package/dist/{ConnectedCallDock-TDYRHPAK.js.map → ConnectedCallDock-DV4FU376.js.map} +1 -1
  3. package/dist/{ConnectedCallDock-H3WWFGXF.cjs → ConnectedCallDock-EM2VVGZK.cjs} +10 -10
  4. package/dist/{ConnectedCallDock-H3WWFGXF.cjs.map → ConnectedCallDock-EM2VVGZK.cjs.map} +1 -1
  5. package/dist/{ConnectedCallRoom-55O5OUN7.cjs → ConnectedCallRoom-7WEPEWUJ.cjs} +9 -9
  6. package/dist/{ConnectedCallRoom-55O5OUN7.cjs.map → ConnectedCallRoom-7WEPEWUJ.cjs.map} +1 -1
  7. package/dist/{ConnectedCallRoom-Z6F6WCLH.js → ConnectedCallRoom-RYTZP34O.js} +8 -8
  8. package/dist/{ConnectedCallRoom-Z6F6WCLH.js.map → ConnectedCallRoom-RYTZP34O.js.map} +1 -1
  9. package/dist/{ConnectedNativeDocxComparison-NVZRVNOS.js → ConnectedNativeDocxComparison-2NDXXZLQ.js} +15 -15
  10. package/dist/{ConnectedNativeDocxComparison-NVZRVNOS.js.map → ConnectedNativeDocxComparison-2NDXXZLQ.js.map} +1 -1
  11. package/dist/{ConnectedNativeDocxComparison-DGBZJ4XA.cjs → ConnectedNativeDocxComparison-7HOY3AVI.cjs} +16 -16
  12. package/dist/{ConnectedNativeDocxComparison-DGBZJ4XA.cjs.map → ConnectedNativeDocxComparison-7HOY3AVI.cjs.map} +1 -1
  13. package/dist/{ConnectedNativeDocxEditor-R4WINUUB.cjs → ConnectedNativeDocxEditor-CUWDPHXN.cjs} +16 -16
  14. package/dist/{ConnectedNativeDocxEditor-R4WINUUB.cjs.map → ConnectedNativeDocxEditor-CUWDPHXN.cjs.map} +1 -1
  15. package/dist/{ConnectedNativeDocxEditor-RSVBN7DY.js → ConnectedNativeDocxEditor-SPZB6Y27.js} +14 -14
  16. package/dist/{ConnectedNativeDocxEditor-RSVBN7DY.js.map → ConnectedNativeDocxEditor-SPZB6Y27.js.map} +1 -1
  17. package/dist/{ConnectedProductionSetDialog-2DFBXE2X.js → ConnectedProductionSetDialog-N3EDG3SU.js} +4 -4
  18. package/dist/{ConnectedProductionSetDialog-2DFBXE2X.js.map → ConnectedProductionSetDialog-N3EDG3SU.js.map} +1 -1
  19. package/dist/{ConnectedProductionSetDialog-KYDPQ7SG.cjs → ConnectedProductionSetDialog-XAEFEN3N.cjs} +4 -4
  20. package/dist/{ConnectedProductionSetDialog-KYDPQ7SG.cjs.map → ConnectedProductionSetDialog-XAEFEN3N.cjs.map} +1 -1
  21. package/dist/{ConnectedStreamedWordArtifact-HLJ5IIOU.js → ConnectedStreamedWordArtifact-6LTGEAJO.js} +15 -15
  22. package/dist/ConnectedStreamedWordArtifact-6LTGEAJO.js.map +1 -0
  23. package/dist/{ConnectedStreamedWordArtifact-JQ34AOUU.cjs → ConnectedStreamedWordArtifact-HNCRKZTV.cjs} +16 -16
  24. package/dist/ConnectedStreamedWordArtifact-HNCRKZTV.cjs.map +1 -0
  25. package/dist/{DocumentReviewCard-7JSXRJZ2.js → DocumentReviewCard-RJD3CO32.js} +8 -8
  26. package/dist/{DocumentReviewCard-7JSXRJZ2.js.map → DocumentReviewCard-RJD3CO32.js.map} +1 -1
  27. package/dist/{DocumentReviewCard-C4HVT3WM.cjs → DocumentReviewCard-VON7LOOY.cjs} +8 -8
  28. package/dist/{DocumentReviewCard-C4HVT3WM.cjs.map → DocumentReviewCard-VON7LOOY.cjs.map} +1 -1
  29. package/dist/{FilesViewerDialog-IMQTZWKD.js → FilesViewerDialog-7SJGY72Q.js} +21 -21
  30. package/dist/{FilesViewerDialog-IMQTZWKD.js.map → FilesViewerDialog-7SJGY72Q.js.map} +1 -1
  31. package/dist/{FilesViewerDialog-UP7GFHYN.cjs → FilesViewerDialog-VIPTC6OT.cjs} +27 -27
  32. package/dist/{FilesViewerDialog-UP7GFHYN.cjs.map → FilesViewerDialog-VIPTC6OT.cjs.map} +1 -1
  33. package/dist/{RechartsRenderer-GIRCW7DB.cjs → RechartsRenderer-THES2SE5.cjs} +6 -5
  34. package/dist/RechartsRenderer-THES2SE5.cjs.map +1 -0
  35. package/dist/{RechartsRenderer-23OF4H6X.js → RechartsRenderer-XIZLV6GH.js} +6 -5
  36. package/dist/RechartsRenderer-XIZLV6GH.js.map +1 -0
  37. package/dist/{WorkspaceTableView-PJM47B5F.cjs → WorkspaceTableView-FNME7TL6.cjs} +9 -9
  38. package/dist/{WorkspaceTableView-PJM47B5F.cjs.map → WorkspaceTableView-FNME7TL6.cjs.map} +1 -1
  39. package/dist/{WorkspaceTableView-YDA7A4UJ.js → WorkspaceTableView-XQ6J2JKI.js} +7 -7
  40. package/dist/{WorkspaceTableView-YDA7A4UJ.js.map → WorkspaceTableView-XQ6J2JKI.js.map} +1 -1
  41. package/dist/agents/index.cjs +202 -202
  42. package/dist/agents/index.js +8 -8
  43. package/dist/{ai-ADS6YSS2.cjs → ai-3SAMEYBB.cjs} +20 -20
  44. package/dist/ai-3SAMEYBB.cjs.map +1 -0
  45. package/dist/{ai-KHWTGBT5.js → ai-OTQWSYVK.js} +12 -12
  46. package/dist/ai-OTQWSYVK.js.map +1 -0
  47. package/dist/calls/index.cjs +57 -57
  48. package/dist/calls/index.js +9 -9
  49. package/dist/chat/index.cjs +3 -3
  50. package/dist/chat/index.js +3 -3
  51. package/dist/{chunk-O27K7KTZ.cjs → chunk-2TBQBF4Y.cjs} +5 -5
  52. package/dist/{chunk-O27K7KTZ.cjs.map → chunk-2TBQBF4Y.cjs.map} +1 -1
  53. package/dist/{chunk-YJWAGXYM.js → chunk-4ZA2RSQH.js} +3 -3
  54. package/dist/{chunk-YJWAGXYM.js.map → chunk-4ZA2RSQH.js.map} +1 -1
  55. package/dist/{chunk-6A4GNM4T.cjs → chunk-5D2ZINOJ.cjs} +16 -16
  56. package/dist/{chunk-6A4GNM4T.cjs.map → chunk-5D2ZINOJ.cjs.map} +1 -1
  57. package/dist/{chunk-BFVCYBND.cjs → chunk-5HXQOM3I.cjs} +5 -5
  58. package/dist/{chunk-BFVCYBND.cjs.map → chunk-5HXQOM3I.cjs.map} +1 -1
  59. package/dist/{chunk-GSD5U553.cjs → chunk-5KKT65WU.cjs} +3 -3
  60. package/dist/{chunk-GSD5U553.cjs.map → chunk-5KKT65WU.cjs.map} +1 -1
  61. package/dist/{chunk-AVGHTUPE.js → chunk-5PWLXLHY.js} +5 -5
  62. package/dist/chunk-5PWLXLHY.js.map +1 -0
  63. package/dist/{chunk-BBWLFK3C.js → chunk-5XIMUQ63.js} +3 -3
  64. package/dist/{chunk-BBWLFK3C.js.map → chunk-5XIMUQ63.js.map} +1 -1
  65. package/dist/{chunk-AHMRYY7J.cjs → chunk-6DAJXQZZ.cjs} +13 -13
  66. package/dist/{chunk-AHMRYY7J.cjs.map → chunk-6DAJXQZZ.cjs.map} +1 -1
  67. package/dist/{chunk-3PV25ICC.js → chunk-6KKVJ2V6.js} +3 -3
  68. package/dist/{chunk-3PV25ICC.js.map → chunk-6KKVJ2V6.js.map} +1 -1
  69. package/dist/{chunk-OLAYDOPC.js → chunk-6LUHNFEE.js} +6 -6
  70. package/dist/{chunk-OLAYDOPC.js.map → chunk-6LUHNFEE.js.map} +1 -1
  71. package/dist/{chunk-FSXQHEFQ.cjs → chunk-7CDV7Y4U.cjs} +25 -25
  72. package/dist/{chunk-FSXQHEFQ.cjs.map → chunk-7CDV7Y4U.cjs.map} +1 -1
  73. package/dist/{chunk-OAIOOVFN.cjs → chunk-7SJXYEZI.cjs} +36 -36
  74. package/dist/chunk-7SJXYEZI.cjs.map +1 -0
  75. package/dist/{chunk-LFYKB7KF.cjs → chunk-7V6APLF7.cjs} +19 -19
  76. package/dist/{chunk-LFYKB7KF.cjs.map → chunk-7V6APLF7.cjs.map} +1 -1
  77. package/dist/{chunk-4WMGFGYP.cjs → chunk-AJZ66VJC.cjs} +4 -4
  78. package/dist/{chunk-4WMGFGYP.cjs.map → chunk-AJZ66VJC.cjs.map} +1 -1
  79. package/dist/{chunk-KCP42W67.cjs → chunk-ARGQ5YZ5.cjs} +3 -3
  80. package/dist/{chunk-KCP42W67.cjs.map → chunk-ARGQ5YZ5.cjs.map} +1 -1
  81. package/dist/{chunk-BH6IKGZ3.js → chunk-AUAHGQY6.js} +5 -5
  82. package/dist/{chunk-BH6IKGZ3.js.map → chunk-AUAHGQY6.js.map} +1 -1
  83. package/dist/{chunk-KIXFXCHL.js → chunk-CEOCA7ID.js} +3 -3
  84. package/dist/{chunk-KIXFXCHL.js.map → chunk-CEOCA7ID.js.map} +1 -1
  85. package/dist/{chunk-TNKPQ3EF.js → chunk-CIRSOYGK.js} +12 -12
  86. package/dist/{chunk-TNKPQ3EF.js.map → chunk-CIRSOYGK.js.map} +1 -1
  87. package/dist/{chunk-BAUZUIHB.js → chunk-COL2TJGO.js} +83 -83
  88. package/dist/chunk-COL2TJGO.js.map +1 -0
  89. package/dist/{chunk-XHN5KOI2.cjs → chunk-DRLD4P2C.cjs} +8 -8
  90. package/dist/{chunk-XHN5KOI2.cjs.map → chunk-DRLD4P2C.cjs.map} +1 -1
  91. package/dist/{chunk-5AC52BHL.cjs → chunk-DYPFNQTQ.cjs} +140 -140
  92. package/dist/chunk-DYPFNQTQ.cjs.map +1 -0
  93. package/dist/{chunk-SCLGUHLU.cjs → chunk-E7TGSOPR.cjs} +4 -4
  94. package/dist/{chunk-SCLGUHLU.cjs.map → chunk-E7TGSOPR.cjs.map} +1 -1
  95. package/dist/{chunk-CRLFLMTK.cjs → chunk-EOXA4VJH.cjs} +3 -3
  96. package/dist/{chunk-CRLFLMTK.cjs.map → chunk-EOXA4VJH.cjs.map} +1 -1
  97. package/dist/{chunk-DBKZANTC.js → chunk-GA47YVW5.js} +3 -3
  98. package/dist/{chunk-DBKZANTC.js.map → chunk-GA47YVW5.js.map} +1 -1
  99. package/dist/{chunk-RCZRI72J.cjs → chunk-GMODJT4N.cjs} +4 -4
  100. package/dist/{chunk-RCZRI72J.cjs.map → chunk-GMODJT4N.cjs.map} +1 -1
  101. package/dist/{chunk-22KAKJ3W.cjs → chunk-GS5MFUPC.cjs} +4 -4
  102. package/dist/{chunk-22KAKJ3W.cjs.map → chunk-GS5MFUPC.cjs.map} +1 -1
  103. package/dist/{chunk-62OMGQHS.js → chunk-H6W3VXHU.js} +3 -3
  104. package/dist/{chunk-62OMGQHS.js.map → chunk-H6W3VXHU.js.map} +1 -1
  105. package/dist/{chunk-DX3Z2COD.cjs → chunk-HUYKO2ES.cjs} +3 -3
  106. package/dist/{chunk-DX3Z2COD.cjs.map → chunk-HUYKO2ES.cjs.map} +1 -1
  107. package/dist/{chunk-U5F5P4YU.js → chunk-IK234EFX.js} +12 -12
  108. package/dist/{chunk-U5F5P4YU.js.map → chunk-IK234EFX.js.map} +1 -1
  109. package/dist/{chunk-UQ2OBHMV.js → chunk-JUGEFTRC.js} +1010 -1010
  110. package/dist/chunk-JUGEFTRC.js.map +1 -0
  111. package/dist/{chunk-CHQMVIHR.js → chunk-LPGBRMYS.js} +36 -36
  112. package/dist/chunk-LPGBRMYS.js.map +1 -0
  113. package/dist/{chunk-D35EHOK5.cjs → chunk-M23W7IID.cjs} +12 -12
  114. package/dist/chunk-M23W7IID.cjs.map +1 -0
  115. package/dist/{chunk-FPOKWML2.js → chunk-MIVNNQO3.js} +21 -4
  116. package/dist/chunk-MIVNNQO3.js.map +1 -0
  117. package/dist/{chunk-WI3BVKEC.cjs → chunk-MNFI66H5.cjs} +5 -5
  118. package/dist/{chunk-WI3BVKEC.cjs.map → chunk-MNFI66H5.cjs.map} +1 -1
  119. package/dist/{chunk-T5ZMG6MC.js → chunk-NF4M7PUB.js} +3 -3
  120. package/dist/{chunk-T5ZMG6MC.js.map → chunk-NF4M7PUB.js.map} +1 -1
  121. package/dist/{chunk-ZNY5W3VX.js → chunk-NPSFPBIB.js} +3 -3
  122. package/dist/{chunk-ZNY5W3VX.js.map → chunk-NPSFPBIB.js.map} +1 -1
  123. package/dist/{chunk-LYW5A35J.js → chunk-OMIYTUVR.js} +12 -12
  124. package/dist/{chunk-LYW5A35J.js.map → chunk-OMIYTUVR.js.map} +1 -1
  125. package/dist/{chunk-ZMVF7EYJ.cjs → chunk-PBPO54KZ.cjs} +21 -3
  126. package/dist/chunk-PBPO54KZ.cjs.map +1 -0
  127. package/dist/{chunk-7V4OCZS6.cjs → chunk-RA3EGF6K.cjs} +6 -6
  128. package/dist/{chunk-7V4OCZS6.cjs.map → chunk-RA3EGF6K.cjs.map} +1 -1
  129. package/dist/{chunk-PL7O3RJJ.cjs → chunk-RKBAY7GZ.cjs} +3 -3
  130. package/dist/{chunk-PL7O3RJJ.cjs.map → chunk-RKBAY7GZ.cjs.map} +1 -1
  131. package/dist/{chunk-J3E5CSSC.js → chunk-RKFWBIKS.js} +3 -3
  132. package/dist/{chunk-J3E5CSSC.js.map → chunk-RKFWBIKS.js.map} +1 -1
  133. package/dist/{chunk-YLKHTBYA.js → chunk-RRP7MQAO.js} +3 -3
  134. package/dist/{chunk-YLKHTBYA.js.map → chunk-RRP7MQAO.js.map} +1 -1
  135. package/dist/{chunk-U6LQ6Z3P.cjs → chunk-SP3IKIPA.cjs} +6 -6
  136. package/dist/{chunk-U6LQ6Z3P.cjs.map → chunk-SP3IKIPA.cjs.map} +1 -1
  137. package/dist/{chunk-GX75YCWJ.cjs → chunk-SQUOXOY3.cjs} +560 -560
  138. package/dist/chunk-SQUOXOY3.cjs.map +1 -0
  139. package/dist/{chunk-6ZYOUT73.js → chunk-T5LORFHL.js} +7 -7
  140. package/dist/{chunk-6ZYOUT73.js.map → chunk-T5LORFHL.js.map} +1 -1
  141. package/dist/{chunk-45OU2UAA.cjs → chunk-TEMTKBBL.cjs} +10 -10
  142. package/dist/{chunk-45OU2UAA.cjs.map → chunk-TEMTKBBL.cjs.map} +1 -1
  143. package/dist/{chunk-PHDUN4SG.cjs → chunk-THCMGAFX.cjs} +41 -41
  144. package/dist/{chunk-PHDUN4SG.cjs.map → chunk-THCMGAFX.cjs.map} +1 -1
  145. package/dist/{chunk-HTGEAQOA.js → chunk-TOMDMKOD.js} +7 -7
  146. package/dist/{chunk-HTGEAQOA.js.map → chunk-TOMDMKOD.js.map} +1 -1
  147. package/dist/{chunk-WJHRWXWJ.js → chunk-TXIAF4PX.js} +3 -3
  148. package/dist/{chunk-WJHRWXWJ.js.map → chunk-TXIAF4PX.js.map} +1 -1
  149. package/dist/{chunk-6M5NAAWX.js → chunk-UCSEE52D.js} +3 -3
  150. package/dist/{chunk-6M5NAAWX.js.map → chunk-UCSEE52D.js.map} +1 -1
  151. package/dist/{chunk-I7CJDF3V.cjs → chunk-UHMP6S7M.cjs} +104 -103
  152. package/dist/chunk-UHMP6S7M.cjs.map +1 -0
  153. package/dist/{chunk-PGCKTXYH.js → chunk-UHUI6A36.js} +3 -3
  154. package/dist/{chunk-PGCKTXYH.js.map → chunk-UHUI6A36.js.map} +1 -1
  155. package/dist/{chunk-6KQVTMRL.cjs → chunk-UOGXKHTJ.cjs} +3 -3
  156. package/dist/{chunk-6KQVTMRL.cjs.map → chunk-UOGXKHTJ.cjs.map} +1 -1
  157. package/dist/{chunk-7S7YVBFK.js → chunk-VDSDG4FR.js} +3 -3
  158. package/dist/{chunk-7S7YVBFK.js.map → chunk-VDSDG4FR.js.map} +1 -1
  159. package/dist/{chunk-3GFQNJYE.js → chunk-VGWCHX6G.js} +104 -103
  160. package/dist/chunk-VGWCHX6G.js.map +1 -0
  161. package/dist/{chunk-VY3HTT37.js → chunk-VUH547VQ.js} +3 -3
  162. package/dist/{chunk-VY3HTT37.js.map → chunk-VUH547VQ.js.map} +1 -1
  163. package/dist/{chunk-AZCMKGDG.js → chunk-W37PFYFL.js} +4 -4
  164. package/dist/{chunk-AZCMKGDG.js.map → chunk-W37PFYFL.js.map} +1 -1
  165. package/dist/{chunk-JGUM4EXE.cjs → chunk-W3IX3GZS.cjs} +8 -8
  166. package/dist/{chunk-JGUM4EXE.cjs.map → chunk-W3IX3GZS.cjs.map} +1 -1
  167. package/dist/{chunk-UCA4JLLJ.cjs → chunk-X7GT57KW.cjs} +3 -3
  168. package/dist/{chunk-UCA4JLLJ.cjs.map → chunk-X7GT57KW.cjs.map} +1 -1
  169. package/dist/{chunk-IXL2KJOZ.cjs → chunk-XBEGD33U.cjs} +40 -40
  170. package/dist/{chunk-IXL2KJOZ.cjs.map → chunk-XBEGD33U.cjs.map} +1 -1
  171. package/dist/{chunk-FDNIK5YS.cjs → chunk-XBKIFGBB.cjs} +8 -8
  172. package/dist/{chunk-FDNIK5YS.cjs.map → chunk-XBKIFGBB.cjs.map} +1 -1
  173. package/dist/{chunk-HZE5MHQO.js → chunk-XT7HKQ4H.js} +3 -3
  174. package/dist/{chunk-HZE5MHQO.js.map → chunk-XT7HKQ4H.js.map} +1 -1
  175. package/dist/{chunk-M3OK6KGR.js → chunk-ZGQKED5T.js} +3 -3
  176. package/dist/{chunk-M3OK6KGR.js.map → chunk-ZGQKED5T.js.map} +1 -1
  177. package/dist/{chunk-NWBCZ4PA.js → chunk-ZKBYG6MN.js} +4 -4
  178. package/dist/{chunk-NWBCZ4PA.js.map → chunk-ZKBYG6MN.js.map} +1 -1
  179. package/dist/collaboration/index.cjs +1 -1
  180. package/dist/collaboration/index.js +1 -1
  181. package/dist/connect/docx.cjs +19 -19
  182. package/dist/connect/docx.js +15 -15
  183. package/dist/connect/index.cjs +762 -762
  184. package/dist/connect/index.js +63 -63
  185. package/dist/connect/viewer.cjs +14 -14
  186. package/dist/connect/viewer.js +13 -13
  187. package/dist/connection/dashboards/ConnectedDashboardsPage.d.ts +6 -0
  188. package/dist/dashboards/chartModel.d.ts +12 -0
  189. package/dist/dashboards/index.cjs +113 -42
  190. package/dist/dashboards/index.cjs.map +1 -1
  191. package/dist/dashboards/index.js +95 -24
  192. package/dist/dashboards/index.js.map +1 -1
  193. package/dist/embed/index.cjs +29 -29
  194. package/dist/embed/index.js +23 -23
  195. package/dist/facts/index.cjs +43 -43
  196. package/dist/facts/index.js +2 -2
  197. package/dist/files/index.cjs +1 -1
  198. package/dist/files/index.js +1 -1
  199. package/dist/home/index.cjs +31 -31
  200. package/dist/home/index.js +3 -3
  201. package/dist/index.cjs +383 -383
  202. package/dist/index.js +21 -21
  203. package/dist/settings/index.cjs +153 -153
  204. package/dist/settings/index.js +4 -4
  205. package/dist/shell/index.cjs +36 -36
  206. package/dist/shell/index.js +4 -4
  207. package/dist/site/index.cjs +5 -5
  208. package/dist/site/index.js +1 -1
  209. package/dist/studio/index.cjs +19 -19
  210. package/dist/studio/index.js +14 -14
  211. package/dist/styles.css +1 -1
  212. package/dist/workflow-canvas/index.cjs +33 -33
  213. package/dist/workflow-canvas/index.js +22 -22
  214. package/node_modules/@arbidocs/coedit/package.json +2 -2
  215. package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -1
  216. package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +60 -13
  217. package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -1
  218. package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -1
  219. package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +21 -13
  220. package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -1
  221. package/node_modules/@docx-editor.dev/core/dist/{index-Bsg7oIKP.d.ts → chrome-print-CAs51cpq.d.ts} +31 -21
  222. package/node_modules/@docx-editor.dev/core/dist/{chunk-VDNNLG6X.js → chunk-236O4YQW.js} +1 -1
  223. package/node_modules/@docx-editor.dev/core/dist/chunk-4HENIAFG.js +1 -0
  224. package/node_modules/@docx-editor.dev/core/dist/{chunk-SRPILEWV.cjs → chunk-6JPL6ZAS.cjs} +5 -5
  225. package/node_modules/@docx-editor.dev/core/dist/{chunk-2RC2EPND.js → chunk-6ZQP4HQ7.js} +1 -1
  226. package/node_modules/@docx-editor.dev/core/dist/{chunk-ZUHOMK52.cjs → chunk-7WQ7AAHW.cjs} +1 -1
  227. package/node_modules/@docx-editor.dev/core/dist/{chunk-Z6WBFXJU.js → chunk-BCXH4BXB.js} +3 -3
  228. package/node_modules/@docx-editor.dev/core/dist/{chunk-QMLCVPCD.cjs → chunk-BY2ACZZ6.cjs} +1 -1
  229. package/node_modules/@docx-editor.dev/core/dist/chunk-CAJEXXVG.cjs +4 -0
  230. package/node_modules/@docx-editor.dev/core/dist/chunk-CPWLFPWC.js +30 -0
  231. package/node_modules/@docx-editor.dev/core/dist/{chunk-6APGXLBB.cjs → chunk-D7ZMDMPX.cjs} +2 -2
  232. package/node_modules/@docx-editor.dev/core/dist/chunk-DOHF6FA7.cjs +30 -0
  233. package/node_modules/@docx-editor.dev/core/dist/chunk-DVX32P2P.js +27 -0
  234. package/node_modules/@docx-editor.dev/core/dist/{chunk-6EYYL7FL.js → chunk-E4LOMDNL.js} +1 -1
  235. package/node_modules/@docx-editor.dev/core/dist/chunk-EKLM7NWB.cjs +7 -0
  236. package/node_modules/@docx-editor.dev/core/dist/chunk-G3K63G7P.cjs +27 -0
  237. package/node_modules/@docx-editor.dev/core/dist/{chunk-5CSUYANV.js → chunk-G4HOFIKJ.js} +1 -1
  238. package/node_modules/@docx-editor.dev/core/dist/{chunk-K5U2PLDP.cjs → chunk-JLVBDYVQ.cjs} +1 -1
  239. package/node_modules/@docx-editor.dev/core/dist/chunk-LQX36Z5P.js +7 -0
  240. package/node_modules/@docx-editor.dev/core/dist/{chunk-TSLBZ26X.js → chunk-LSZ6KPKK.js} +1 -1
  241. package/node_modules/@docx-editor.dev/core/dist/{chunk-O2AL2HSJ.cjs → chunk-MM5QBMTE.cjs} +1 -1
  242. package/node_modules/@docx-editor.dev/core/dist/{chunk-ETTO6GK3.js → chunk-OMCG63ZF.js} +1 -1
  243. package/node_modules/@docx-editor.dev/core/dist/chunk-OSFOJTHU.cjs +18 -0
  244. package/node_modules/@docx-editor.dev/core/dist/{chunk-E7BQA6UP.js → chunk-RCLZXP3B.js} +1 -1
  245. package/node_modules/@docx-editor.dev/core/dist/chunk-T6K2QYNZ.cjs +2 -0
  246. package/node_modules/@docx-editor.dev/core/dist/chunk-TRGAVV2Y.js +4 -0
  247. package/node_modules/@docx-editor.dev/core/dist/chunk-U4JZVSOE.js +2 -0
  248. package/node_modules/@docx-editor.dev/core/dist/{chunk-2GO5T2JU.cjs → chunk-UHHYFIDT.cjs} +1 -1
  249. package/node_modules/@docx-editor.dev/core/dist/chunk-V3N4SOAK.cjs +1 -0
  250. package/node_modules/@docx-editor.dev/core/dist/{chunk-6AWEKBLB.cjs → chunk-W35WTWAO.cjs} +1 -1
  251. package/node_modules/@docx-editor.dev/core/dist/chunk-YQ5G6LC7.js +18 -0
  252. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -1
  253. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +5 -5
  254. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -1
  255. package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +4 -4
  256. package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +3 -3
  257. package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +9 -10
  258. package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +2 -2
  259. package/node_modules/@docx-editor.dev/core/dist/contracts/modules.cjs +1 -1
  260. package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +33 -9
  261. package/node_modules/@docx-editor.dev/core/dist/contracts/modules.js +1 -1
  262. package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +2 -2
  263. package/node_modules/@docx-editor.dev/core/dist/{custom-node-writes-cvL5rhcD.d.ts → custom-node-writes-Bn6uciLb.d.ts} +2 -2
  264. package/node_modules/@docx-editor.dev/core/dist/diagnostic-context-B8M79cfK.d.ts +30 -0
  265. package/node_modules/@docx-editor.dev/core/dist/diagnostic-hints-BeVjfNOv.d.ts +113 -0
  266. package/node_modules/@docx-editor.dev/core/dist/{document-protection-BAGVGqaP.d.ts → document-protection-CUb55pl_.d.ts} +2 -2
  267. package/node_modules/@docx-editor.dev/core/dist/{editor-Ci7IZGmG.d.ts → editor-CZQZmTIU.d.ts} +386 -9
  268. package/node_modules/@docx-editor.dev/core/dist/{editor-scope-OHPwVQ5l.d.ts → editor-scope-7o9xweiJ.d.ts} +1 -1
  269. package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -1
  270. package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +54 -33
  271. package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -1
  272. package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -2
  273. package/node_modules/@docx-editor.dev/core/dist/export.d.ts +13 -14
  274. package/node_modules/@docx-editor.dev/core/dist/export.js +1 -1
  275. package/node_modules/@docx-editor.dev/core/dist/{font-resolver-BVQB14qT.d.ts → font-resolver-lSBLirLR.d.ts} +3 -3
  276. package/node_modules/@docx-editor.dev/core/dist/{headless-document-view-qH331moE.d.ts → headless-document-view-pp3q7wIh.d.ts} +2 -2
  277. package/node_modules/@docx-editor.dev/core/dist/{image-resources-BN-hUgCn.d.ts → image-resources-tXLQShoC.d.ts} +2 -2
  278. package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -1
  279. package/node_modules/@docx-editor.dev/core/dist/index.d.ts +65 -20
  280. package/node_modules/@docx-editor.dev/core/dist/index.js +1 -1
  281. package/node_modules/@docx-editor.dev/core/dist/{layout-shaping-BEyuiQOk.d.ts → layout-shaping-BD-dF_rn.d.ts} +1 -1
  282. package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -1
  283. package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +17 -20
  284. package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -1
  285. package/node_modules/@docx-editor.dev/core/dist/{note-properties-4Y9o6Gyk.d.ts → note-properties-qQUjO1GQ.d.ts} +3 -3
  286. package/node_modules/@docx-editor.dev/core/dist/{omml-equation-CuzBL5DD.d.ts → omml-equation-BUbU0utM.d.ts} +1 -1
  287. package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -1
  288. package/node_modules/@docx-editor.dev/core/dist/output.d.ts +8 -9
  289. package/node_modules/@docx-editor.dev/core/dist/output.js +1 -1
  290. package/node_modules/@docx-editor.dev/core/dist/{protocol-Bqk4Izjc.d.ts → protocol-DYzzz2ej.d.ts} +2 -2
  291. package/node_modules/@docx-editor.dev/core/dist/{review-paragraph-order-DT-n6ouC.d.ts → review-paragraph-order-CN_0l2Cb.d.ts} +1 -1
  292. package/node_modules/@docx-editor.dev/core/dist/{semantic-cell-selection-D9D1KSXq.d.ts → semantic-cell-selection-eYag3P47.d.ts} +4 -211
  293. package/node_modules/@docx-editor.dev/core/dist/{semantic-interaction-CIC-PooQ.d.ts → semantic-interaction-kR_QB845.d.ts} +1 -1
  294. package/node_modules/@docx-editor.dev/core/dist/{semantic-paint-BME37OMv.d.ts → semantic-paint-ZayFF3tD.d.ts} +17 -5
  295. package/node_modules/@docx-editor.dev/core/dist/{semantic-record-queries-CBlZqZNa.d.ts → semantic-record-queries-Bsgth6lv.d.ts} +1 -1
  296. package/node_modules/@docx-editor.dev/core/dist/{semantic-records-4B3WwFAi.d.ts → semantic-records-DQmumPgL.d.ts} +1279 -828
  297. package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -1
  298. package/node_modules/@docx-editor.dev/core/dist/store.d.ts +1466 -1464
  299. package/node_modules/@docx-editor.dev/core/dist/store.js +1 -1
  300. package/node_modules/@docx-editor.dev/core/dist/{tree-package-fragment-BeeKxDw8.d.ts → tree-package-store-CovjNARF.d.ts} +83 -83
  301. package/node_modules/@docx-editor.dev/core/dist/{tree-session-contract-CVbmlMlq.d.ts → tree-session-contract-CZVAGl51.d.ts} +6 -6
  302. package/node_modules/@docx-editor.dev/core/dist/{types-barrel-D3xCgQX6.d.ts → types-barrel-DuC5QBNC.d.ts} +548 -527
  303. package/node_modules/@docx-editor.dev/core/package.json +3 -3
  304. package/node_modules/@docx-editor.dev/react/dist/index.js +3 -3
  305. package/node_modules/@docx-editor.dev/react/dist/index.mjs +3 -3
  306. package/node_modules/@docx-editor.dev/react/package.json +4 -4
  307. package/package.json +8 -8
  308. package/dist/ConnectedStreamedWordArtifact-HLJ5IIOU.js.map +0 -1
  309. package/dist/ConnectedStreamedWordArtifact-JQ34AOUU.cjs.map +0 -1
  310. package/dist/RechartsRenderer-23OF4H6X.js.map +0 -1
  311. package/dist/RechartsRenderer-GIRCW7DB.cjs.map +0 -1
  312. package/dist/ai-ADS6YSS2.cjs.map +0 -1
  313. package/dist/ai-KHWTGBT5.js.map +0 -1
  314. package/dist/chunk-3GFQNJYE.js.map +0 -1
  315. package/dist/chunk-5AC52BHL.cjs.map +0 -1
  316. package/dist/chunk-AVGHTUPE.js.map +0 -1
  317. package/dist/chunk-BAUZUIHB.js.map +0 -1
  318. package/dist/chunk-CHQMVIHR.js.map +0 -1
  319. package/dist/chunk-D35EHOK5.cjs.map +0 -1
  320. package/dist/chunk-FPOKWML2.js.map +0 -1
  321. package/dist/chunk-GX75YCWJ.cjs.map +0 -1
  322. package/dist/chunk-I7CJDF3V.cjs.map +0 -1
  323. package/dist/chunk-OAIOOVFN.cjs.map +0 -1
  324. package/dist/chunk-UQ2OBHMV.js.map +0 -1
  325. package/dist/chunk-ZMVF7EYJ.cjs.map +0 -1
  326. package/node_modules/@docx-editor.dev/core/dist/chunk-4GBTELJV.cjs +0 -28
  327. package/node_modules/@docx-editor.dev/core/dist/chunk-4R3TEXMN.js +0 -18
  328. package/node_modules/@docx-editor.dev/core/dist/chunk-EO4C5QJW.cjs +0 -2
  329. package/node_modules/@docx-editor.dev/core/dist/chunk-FIJZIQXA.cjs +0 -18
  330. package/node_modules/@docx-editor.dev/core/dist/chunk-FRXAOVTB.js +0 -28
  331. package/node_modules/@docx-editor.dev/core/dist/chunk-J6BVWIDB.js +0 -2
  332. package/node_modules/@docx-editor.dev/core/dist/chunk-JGNVNT2A.cjs +0 -2
  333. package/node_modules/@docx-editor.dev/core/dist/chunk-KKIJG3C6.js +0 -2
  334. package/node_modules/@docx-editor.dev/core/dist/chunk-LWDSDCMO.js +0 -27
  335. package/node_modules/@docx-editor.dev/core/dist/chunk-NBCVVZOM.cjs +0 -1
  336. package/node_modules/@docx-editor.dev/core/dist/chunk-O5INAWZQ.js +0 -1
  337. package/node_modules/@docx-editor.dev/core/dist/chunk-RCHS4ZEH.cjs +0 -27
  338. package/node_modules/@docx-editor.dev/core/dist/chunk-VHAVHCQY.js +0 -7
  339. package/node_modules/@docx-editor.dev/core/dist/chunk-VX43VBAX.cjs +0 -7
  340. package/node_modules/@docx-editor.dev/core/dist/review-pane-D9jm8DcY.d.ts +0 -128
  341. package/node_modules/@docx-editor.dev/core/dist/revision-projection-DZ4kKVev.d.ts +0 -242
@@ -1,4 +1,4 @@
1
- 'use strict';var Pt=require('react'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),editor=require('@docx-editor.dev/core/editor'),store=require('@docx-editor.dev/core/store'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),Ee=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Pt__namespace=/*#__PURE__*/_interopNamespace(Pt);var Ee__namespace=/*#__PURE__*/_interopNamespace(Ee);var fm={version:"2.28.0"};var Uy=fm.version;var dc=Pt.createContext(i18n.en),uc=Pt.createContext("en");function Un({i18n:e,children:t}){let o=Pt.useContext(dc),n=Pt.useContext(uc),r=typeof e?._lang=="string"?e._lang:n,i=Pt.useMemo(()=>i18n.deepMerge(o,e),[o,e]);return jsxRuntime.jsx(uc.Provider,{value:r,children:jsxRuntime.jsx(dc.Provider,{value:i,children:t})})}function N(){let e=Pt.useContext(dc),t=Pt.useContext(uc);return {t:Pt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function vm(e){let{t}=N();return Pt.useCallback((o,n)=>e?.get(o)??t(o,n),[e,t])}var pc=Pt.createContext(null);function F(){return Pt.useContext(pc)}var xt=Pt.createContext(null);var mc=0,fc=false,gc=false;function xm(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(fc||(fc=true,mc+=1,queueMicrotask(()=>{fc=false;}),gc||(gc=true,setTimeout(()=>{gc=false,mc=0;},0))),mc>16)}function Cm(e){let t=false;return ()=>{if(t)return;t=true;let o=()=>{t=false,e();};xm()?setTimeout(o,0):queueMicrotask(o);}}var ex=()=>{},bc=0;function tx(){return bc}function $r(e){return Cm(e)}function O(e,t=Object.is,o){let n=F(),r=o?.onSubscribe,i=o?.onUnsubscribe,a=Pt.useCallback(d=>{if(!n)return ex;let f=false;bc++,r?.();let u=$r(()=>{f||d();}),g=[n.on("change",u),n.on("selectionChange",u),n.on("error",u)];return ()=>{f=true,bc--,i?.();for(let m of g)m();}},[n,r,i]),s=Pt.useMemo(()=>{let d=false,f,u;return g=>{if(d&&g===f)return u;let m=e(g);return d&&t(u,m)?(f=g,u):(d=true,f=g,u=m,m)}},[n,e,t]),l=Pt.useCallback(()=>s(n?n.snapshot():editor.LOADING_SNAPSHOT),[n,s]),c=Pt.useCallback(()=>s(editor.LOADING_SNAPSHOT),[s]);return Pt.useSyncExternalStore(a,l,c)}function ax(e,t){return typeof t!="function"?e:typeof e!="function"?t:o=>{e(o),o.defaultPrevented||t(o);}}function ix(e,t){let o={...e,...t};for(let n of Object.keys(e))/^on[A-Z]/.test(n)?o[n]=ax(t[n],e[n]):n==="className"?o[n]=[e[n],t[n]].filter(Boolean).join(" "):n==="style"&&(o[n]={...e[n],...t[n]});return o}function j({children:e,...t}){let o=Pt.Children.only(e);if(!Pt.isValidElement(o))return null;let n=o.props,r=ix(t,n),i=o.ref,a=t.ref;return (i||a)&&(r.ref=s=>{for(let l of [i,a])typeof l=="function"?l(s):l&&typeof l=="object"&&(l.current=s);}),Pt.cloneElement(o,r)}var Sm=e=>{let t=e["data-docx-part"];return typeof t=="string"?t==="field"?`field:${e["data-docx-field"]}`:t:null};function Do(){let e=Pt.createContext(null),t=new Map,o=y=>{let x=t.get(y.type);return x==="field"?`field:${y.props.name}`:x};function n(y,x){Pt.Children.forEach(y,h=>{Pt.isValidElement(h)&&(x(h),n(h.props.children,x));});}function r(){let y=Pt.useContext(e);if(!y)throw new globalThis.Error("Dialog controls must be rendered inside their dialog.");return y.state}function i(y,x){return Pt.Children.map(y,h=>{if(!Pt.isValidElement(h))return h;let b=Sm(h.props);return b&&x.has(b)?x.get(b):h.props.children===void 0?h:Pt.cloneElement(h,{children:i(h.props.children,x)})})}function a(y){function x(h){let b=Pt.useContext(e);if(!b||h.hidden)return null;let S=y==="field"?`field:${h.name}`:y,C=b.defaults.get(S);if(!C)return h.children??null;let{children:P,asChild:T,className:R,style:M,hidden:E,name:_,...H}=h,L={...H,...C.props,className:[C.props.className,R].filter(Boolean).join(" "),style:{...C.props.style,...M}};if(T){let{children:k,className:w,style:I,...$}=L;return jsxRuntime.jsx(j,{...$,...R?{className:R}:{},...M?{style:M}:{},children:P})}return Pt.cloneElement(C,L,P===void 0?i(C.props.children,b.overrides):P)}return t.set(x,y),x}let s=a("header"),l=a("title"),c=a("body"),d=a("footer"),f=a("apply"),u=a("cancel"),g=a("reset"),m=a("error"),p=a("field");function v({defaults:y,children:x,preset:h=true,state:b}){let S=new Map;n(y,R=>{let M=Sm(R.props);M&&S.set(M,R);});let C=new Map;n(x,R=>{let M=o(R);M&&C.set(M,R);});let P=R=>Pt.Children.toArray(R).flatMap(M=>Pt.isValidElement(M)&&M.type===Pt.Fragment?P(M.props.children):[M]),T=P(x).filter(R=>!Pt.isValidElement(R)||!o(R));return jsxRuntime.jsx(e.Provider,{value:{defaults:S,overrides:C,state:b},children:h?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i(y,C),T]}):x})}return {Header:s,Title:l,Body:c,Footer:d,Apply:f,Cancel:u,Reset:g,Error:m,Field:p,Composition:v,useState:r}}function pt({kind:e,role:t="dialog",className:o,style:n,label:r,onClose:i,onKeyDown:a,panelRef:s,children:l,dismissOutside:c=true,sessionSignal:d,restoreFocus:f=true}){let u=Pt.useRef(null),g=s??u,m=Pt.useRef(i);return m.current=i,Pt.useLayoutEffect(()=>{let p=g.current;if(!p)return;p.parentElement?.closest(".docx-editor")||p.classList.add("docx-editor");let v=p.ownerDocument.activeElement,y=()=>{p.open&&p.close?.();};return d?.addEventListener("abort",y),typeof p.showModal=="function"?p.showModal():p.setAttribute("open",""),p.querySelector('input:not([disabled]),select:not([disabled]),button:not([disabled]),[tabindex="0"]')?.focus({preventScroll:true}),()=>{d?.removeEventListener("abort",y),typeof p.close=="function"&&p.open&&p.close(),f&&v?.isConnected&&v.focus({preventScroll:true});}},[g,d,f]),jsxRuntime.jsx("dialog",{ref:g,role:t,"aria-modal":"true","aria-label":r,className:`docx-dialog${o?` ${o}`:""}`,style:n,"data-docx-dialog":e,onCancel:p=>{p.preventDefault(),m.current();},onMouseDown:p=>p.stopPropagation(),onClick:p=>{if(c&&p.target===p.currentTarget){let v=p.currentTarget.getBoundingClientRect();(p.clientX<v.left||p.clientX>v.right||p.clientY<v.top||p.clientY>v.bottom)&&m.current();}p.stopPropagation();},onKeyDown:p=>{p.key==="Escape"&&!p.nativeEvent.isComposing?(p.preventDefault(),m.current()):editor.trapTabWithin(p.currentTarget,p.nativeEvent)?p.preventDefault():!p.nativeEvent.isComposing&&!p.defaultPrevented&&a?.(p),p.stopPropagation();},children:l})}function Ai(e,t){let o=F(),n=Cc(),r=Pt.useRef(null);return Pt.useEffect(()=>{if(!e){r.current=null;return}o?.surface&&(r.current===null?r.current=o.mountGeneration:r.current!==o.mountGeneration&&t());},[e,o,n,t]),()=>!!o?.surface&&r.current===o.mountGeneration}function Cc(){let e=F(),t=Pt.useCallback(o=>{if(!e)return ()=>{};let n=true,r=$r(()=>{n&&o();}),i=[e.on("change",r),e.on("selectionChange",r),e.on("error",r)];return ()=>{n=false,i.forEach(a=>a());}},[e]);return Pt.useSyncExternalStore(t,()=>e?.mountGeneration??0,()=>0)}function Em(){let e=0,t=0,o=null,n=new Set,r=new Set,i=new Set,a=s=>{for(let l of [...s])l();};return {getShift:()=>e,setShift(s){let l=Math.max(0,Math.round(s));l!==e&&(e=l,a(n));},subscribeShift(s){return n.add(s),()=>n.delete(s)},getReservation:()=>t,setReservation(s){let l=Math.max(0,Math.round(s));l!==t&&(t=l,a(r));},subscribeReservation(s){return r.add(s),()=>r.delete(s)},getViewport:()=>o,setViewport(s){s!==o&&(o=s,a(i));},subscribeViewport(s){return i.add(s),()=>i.delete(s)}}}var Pc=Pt.createContext(null);function rn(){return Pt.useContext(Pc)}var wm=()=>0,Sc=()=>()=>{};function an(){let e=rn(),t=Pt.useCallback(n=>e?e.subscribeShift(n):Sc(),[e]),o=Pt.useCallback(()=>e?e.getShift():0,[e]);return Pt.useSyncExternalStore(t,o,wm)}function Mm(){let e=rn(),t=Pt.useCallback(n=>e?e.subscribeReservation(n):Sc(),[e]),o=Pt.useCallback(()=>e?e.getReservation():0,[e]);return Pt.useSyncExternalStore(t,o,wm)}function Ye(){let e=rn(),t=Pt.useCallback(r=>e?e.subscribeViewport(r):Sc(),[e]),o=Pt.useCallback(()=>e?e.getViewport():null,[e]),n=Pt.useCallback(()=>null,[]);return Pt.useSyncExternalStore(t,o,n)}function fo(e,t,o){let n=Ye(),r=Pt.useRef({close:o,viewport:n});r.current={close:o,viewport:n},Pt.useEffect(()=>{let i=e.current;if(!(!t||!i))return Tx(i,()=>r.current.close(),()=>r.current.viewport)},[e,t]);}function Tx(e,t,o){let n=s=>{if(s.defaultPrevented||s.altKey||s.ctrlKey||s.metaKey)return;let l=s.target;if(l.matches('input[role="combobox"]')||l.matches("input, textarea, select")&&s.key!=="ArrowDown"&&s.key!=="ArrowUp")return;let d=Array.from(e.querySelectorAll('[role="option"]')).filter(g=>!g.matches(':disabled, [aria-disabled="true"]'));if(d.length===0)return;let f=d.indexOf(l),u;if(s.key==="Home")u=0;else if(s.key==="End")u=d.length-1;else if(s.key==="ArrowDown")u=(f+1)%d.length;else if(s.key==="ArrowUp")u=f<0?d.length-1:(f-1+d.length)%d.length;else return;s.preventDefault(),s.stopPropagation(),d[u]?.focus();},r=s=>{s.relatedTarget instanceof Node&&!e.contains(s.relatedTarget)&&t();},i=editor.listenForPopupEscape({popup:e,contains:s=>e.contains(s),chromeRoot:()=>e.closest(".docx-editor"),editorElements:()=>[o()],skip:s=>s.target instanceof Element&&e.contains(s.target)&&s.target.matches('input[role="combobox"]'),close:s=>{s&&e.querySelector("[aria-haspopup]")?.focus(),t();}}),a=editor.listenForPopupFocusLeave({popup:e,contains:s=>e.contains(s),close:t});return e.addEventListener("keydown",n),e.addEventListener("focusout",r),()=>{e.removeEventListener("keydown",n),e.removeEventListener("focusout",r),i(),a();}}function Dx(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function Ec(e){return typeof e=="string"}function ie(e){let t=F(),{t:o}=N(),n=Ec(e)?e:editor.editorCommandKey(e),r=Pt.useRef(e);r.current=e;let i=Pt.useCallback(l=>{let c=r.current;if(Ec(c)){let f=editor.toolbarCommandState(t,c);return {active:f.active,enabled:f.enabled,disabledReason:i18n.localizeDisabledReason(f.disabledReason,o),value:f.value??null}}if(!t)return {active:false,enabled:false,disabledReason:null,value:null};let d=t.can(c);return {active:t.isActive(c),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,o),value:null}},[t,n,o]),a=O(i,Dx),s=Pt.useCallback(l=>{let c=editor.commandExecOptions(l),d=r.current;return Ec(d)?editor.runToolbarCommand(t,d,void 0,c??{}).ok:t?t.exec(d,c).ok:false},[t]);return Pt.useMemo(()=>({execute:s,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason,value:a.value}),[s,a])}var ln=Pt.createContext({t:void 0,onSave:void 0});function Ix(){return Pt.useContext(ln)}function Oi(e){let{t}=N();return o=>e?.(o)??t(o)}function X(){let{t:e}=Pt.useContext(ln);return Oi(e)}var Fx=()=>()=>{},Hx=()=>true,Ax=()=>false;function ko(){let e=Pt.useSyncExternalStore(Fx,Hx,Ax);return Pt.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function Ox(e){let t=e.viteEnv?.DEV;return typeof t=="boolean"?t:e.hasProcess&&e.nodeEnv!=="production"}function Bx(){try{return undefined}catch{return}}function jt(){let e=typeof process<"u";return Ox({viteEnv:Bx(),nodeEnv:e?"production":void 0,hasProcess:e})}var Im=new Set;function Io(e){!jt()||Im.has(e)||(Im.add(e),console.warn(`[docx-editor] ${e}`));}function _m(e){Io(`Menu.Item and ContextMenu.Slot take the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Nm(e){Io(`A hidden context-menu override names "${e}", but no packaged row has that id, so nothing is removed.`);}function Lm(){Io("A Menu.Item or ContextMenu.Slot has no slotId, so it renders nothing.");}function Fm(){Io("A Menu.Submenu has neither label nor labelKey, so its row has no name.");}function Hm(e){Io(`Toolbar.Button takes the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Am(){Io("A Toolbar.Button has no slotId, so it renders nothing.");}function J(e){for(let t of editor.CHROME_GROUPS)for(let o of t.controls)if(editor.chromeSlotId(t,o)===e)return o;return null}function re(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function B(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Wx(e){if(e.slotId)return e.slotId;if(e.slot)return Hm(e.slot),e.slot;Am();}function sn(e){let{icon:t,asChild:o,className:n,children:r,hidden:i}=e,a=Wx(e)??"",{execute:s,isActive:l,isEnabled:c,disabledReason:d,value:f}=ie(a),u=X(),g=ko();if(i||!a)return null;let m=J(a),p=g(u(m?.labelKey??a)),v=editor.chromeSlotIsToggle(a),y={onClick:()=>s(),onMouseDown:B,disabled:!c,"data-slot":a,className:`docx-toolbar__button${n?` ${n}`:""}`,...l?{"data-active":""}:{},...c?{}:{"data-disabled":""},...v?{"aria-pressed":l}:{},...f!==null?{"data-value":f}:{},"aria-label":p,title:d??p};return o?jsxRuntime.jsx(j,{...y,children:r}):jsxRuntime.jsx("button",{type:"button",...y,children:t??r??re(m?.paths)})}sn.docxToolbarPart=true;var jx=[{value:"C00000",labelKey:"colorPicker.colors.darkRed",css:"#c00000"},{value:"FF0000",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"FFC000",labelKey:"colorPicker.colors.orange",css:"#ffc000"},{value:"FFFF00",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"92D050",labelKey:"colorPicker.colors.lightGreen",css:"#92d050"},{value:"00B050",labelKey:"colorPicker.colors.green",css:"#00b050"},{value:"00B0F0",labelKey:"colorPicker.colors.lightBlue",css:"#00b0f0"},{value:"0070C0",labelKey:"colorPicker.colors.blue",css:"#0070c0"},{value:"002060",labelKey:"colorPicker.colors.darkBlue",css:"#002060"},{value:"7030A0",labelKey:"colorPicker.colors.purple",css:"#7030a0"}],Om=[{value:"yellow",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"green",labelKey:"colorPicker.colors.brightGreen",css:"#00ff00"},{value:"cyan",labelKey:"colorPicker.colors.cyan",css:"#00ffff"},{value:"magenta",labelKey:"colorPicker.colors.magenta",css:"#ff00ff"},{value:"blue",labelKey:"colorPicker.colors.blue",css:"#0000ff"},{value:"red",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"darkBlue",labelKey:"colorPicker.colors.darkBlue",css:"#000080"},{value:"darkCyan",labelKey:"colorPicker.colors.darkCyan",css:"#008080"},{value:"darkGreen",labelKey:"colorPicker.colors.darkGreen",css:"#008000"},{value:"darkMagenta",labelKey:"colorPicker.colors.darkMagenta",css:"#800080"},{value:"darkRed",labelKey:"colorPicker.colors.darkRed",css:"#800000"},{value:"darkYellow",labelKey:"colorPicker.colors.darkYellow",css:"#808000"},{value:"darkGray",labelKey:"colorPicker.colors.darkGray",css:"#808080"},{value:"lightGray",labelKey:"colorPicker.colors.lightGray",css:"#c0c0c0"},{value:"black",labelKey:"colorPicker.colors.black",css:"#000000"},{value:"white",labelKey:"colorPicker.colors.white",css:"#ffffff"}],Bm=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],Zi=["colorPicker.theme.background1","colorPicker.theme.text1","colorPicker.theme.background2","colorPicker.theme.text2","colorPicker.theme.accent1","colorPicker.theme.accent2","colorPicker.theme.accent3","colorPicker.theme.accent4","colorPicker.theme.accent5","colorPicker.theme.accent6"],_o=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Et=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function Yx(e){let t=[0,2,4].map(n=>parseInt(e.slice(n,n+2),16)),o=(Math.max(...t)+Math.min(...t))/2/255;return o===1?[Et(5),Et(15),Et(25),Et(35),Et(50)]:o===0?[_o(50),_o(35),_o(25),_o(15),_o(5)]:o>=.8?[Et(10),Et(25),Et(50),Et(75),Et(90)]:[_o(80),_o(60),_o(40),Et(25),Et(50)]}var Xx=/^[0-9A-Fa-f]{6}$/;function Jx(e,t){let o="";for(let n=0;n<6;n+=2){let r=Math.round(t(parseInt(e.slice(n,n+2),16)));o+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return o.toUpperCase()}function Qx(e){let t=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16);return .299*t+.587*o+.114*n>230}function Gn({value:e,css:t,title:o,selected:n,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":o,"aria-pressed":n,title:o,"data-value":e,...n?{"data-selected":""}:{},...t.startsWith("var(")||Qx(t.replace("#",""))?{"data-light":""}:{},onMouseDown:B,onClick:()=>r(e)})}function eC({apply:e,label:t,current:o,themeHexes:n}){let r=n.map(Yx),i=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[n.map((a,s)=>jsxRuntime.jsx(Gn,{value:a,css:`#${a.toLowerCase()}`,title:t(Zi[s]),selected:o===a,apply:e},`base-${s}`)),i.map(a=>n.map((s,l)=>{let c=r[l][a],d=Jx(s,c.apply);return jsxRuntime.jsx(Gn,{value:d,css:`#${d.toLowerCase()}`,title:`${t(Zi[l])}, ${t(c.labelKey)}`,selected:o===d,apply:e},`${a}-${l}`)}))]})]})}function tC(e){let{apply:t,label:o,current:n}=e,[r,i]=Pt.useState(""),a=Xx.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eC,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:jx.map(s=>jsxRuntime.jsx(Gn,{value:s.value,css:s.css,title:o(s.labelKey),selected:n===s.value,apply:t},s.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.customColor")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-custom",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-hash","aria-hidden":"true",children:"#"}),jsxRuntime.jsx("input",{type:"text",className:"docx-toolbar__swatch-hex",value:r,maxLength:6,spellCheck:false,"aria-label":o("colorPicker.customColor"),onChange:s=>i(s.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:s=>{s.key==="Enter"&&a&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!a,onMouseDown:B,onClick:()=>t(r.toUpperCase()),children:o("colorPicker.apply")})]})]})]})}function Mc({apply:e,current:t}){let o=F(),n=X(),r=o?.getDocumentThemeColors()??[],i=r.length===Zi.length?r.map(s=>s.hex):Bm,a=t?.toUpperCase()??null;return jsxRuntime.jsx(tC,{apply:e,label:n,current:a,themeHexes:i})}var oC=Om.filter(e=>e.value!=="white");function nC({apply:e,label:t,current:o}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.highlightColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--highlight",role:"group",children:oC.map(n=>jsxRuntime.jsx(Gn,{value:n.value,css:n.css,title:t(n.labelKey),selected:o===n.value,apply:e},n.value))})]})}function Zm(e){let{slot:t,defaultValue:o,cssOf:n,clear:r,body:i}=e,a=t==="text.color";return Object.assign(({className:l,hidden:c,icon:d})=>{let f=F(),{isEnabled:u,disabledReason:g}=ie(t),m=X(),[p,v]=Pt.useState(false),[y,x]=Pt.useState(o),h=Pt.useRef(null);fo(h,p,()=>v(false));let b=O(M=>{if(a){let E=M.formatting?.color;return E&&E.kind==="hex"?E.value.toUpperCase():null}return M.formatting?.highlight??null}),S=f?.getDocumentThemeColors()??[],C=S.length===Zi.length?S.map(M=>M.hex):Bm;Pt.useEffect(()=>{if(!p)return;let M=E=>{let _=h.current;_&&E.target instanceof Node&&_.contains(E.target)||v(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[p]);let P=Pt.useCallback(M=>{if(v(false),!f)return;f.focus();let E=editor.commandForSlotValue(t,M);E&&f.can(E).ok&&(f.exec(E),M!==r.value&&x(M));},[f]),T=Pt.useMemo(()=>J(t),[]);if(c)return null;let R=m(T?.labelKey??t);return jsxRuntime.jsxs("div",{ref:h,className:`docx-toolbar__colorsplit${l?` ${l}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!u,...u?{}:{"data-disabled":""},"aria-label":R,title:g??R,onMouseDown:B,onClick:()=>P(y),children:[d??re(T?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:n(y)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!u,...u?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":p,"aria-label":R,title:g??R,onMouseDown:B,onClick:()=>v(M=>!M),children:"\u25BE"}),p?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":R,onMouseDown:B,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>P(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),m(r.labelKey)]}),i({apply:P,label:m,current:b,themeHexes:C})]}):null]})},{docxSlot:t})}var rC=new Map(Om.map(e=>[e.value,e.css])),Rc=Zm({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Mc,{apply:e.apply,current:e.current})}),Dc=Zm({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>rC.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(nC,{...e})});var Ic=e=>e==="auto"?"currentColor":e==="byAuthor"?"var(--doc-review-author-0)":e==="none"?"transparent":`var(--doc-revision-color-${e})`;function Ki({label:e,value:t,values:o,disabled:n,change:r,t:i}){let a=Pt.useId(),[s,l]=Pt.useState(false),c=Pt.useRef(null),d=Pt.useRef(null),f=Pt.useRef(null);Pt.useLayoutEffect(()=>{if(!s||!f.current||!d.current)return;let g=editor.observeContentControlPopup(f.current,d.current);return (f.current.querySelector("[data-selected]")??f.current.querySelector("button"))?.focus(),g},[s]),Pt.useEffect(()=>{if(n&&l(false),!s)return;let g=c.current?.ownerDocument,m=p=>{c.current?.contains(p.target)||l(false);};return g?.addEventListener("pointerdown",m),()=>g?.removeEventListener("pointerdown",m)},[s,n]);let u=()=>{l(false),d.current?.focus();};return jsxRuntime.jsxs("div",{ref:c,className:"docx-revision-color-picker",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||l(false);},children:[jsxRuntime.jsx("span",{id:`${a}-label`,children:e}),jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-revision-color-trigger",disabled:n,"aria-labelledby":`${a}-label ${a}-value`,"aria-expanded":s&&!n,"aria-controls":`${a}-options`,onClick:()=>l(!s),children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:Ic(t)}}),jsxRuntime.jsx("span",{id:`${a}-value`,children:i(`values.${t}`)})]}),jsxRuntime.jsxs("div",{ref:f,id:`${a}-options`,className:"docx-revision-color-options",hidden:!s||n,role:"group","aria-labelledby":`${a}-label`,onKeyDown:g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),u());let m=Array.from(g.currentTarget.querySelectorAll("button")),p=m.indexOf(g.target),v=g.key==="Home"?0:g.key==="End"?m.length-1:["ArrowRight","ArrowDown"].includes(g.key)?(p+1)%m.length:["ArrowLeft","ArrowUp"].includes(g.key)?(p-1+m.length)%m.length:null;v!==null&&(g.preventDefault(),g.stopPropagation(),m[v]?.focus());},children:[jsxRuntime.jsx("div",{className:"docx-revision-color-special",children:o.filter(g=>["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear","aria-pressed":t===g,"data-selected":t===g?"":void 0,onClick:()=>{r(g),u();},children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:Ic(g)}}),i(`values.${g}`)]},g))}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",children:o.filter(g=>!["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsx(Gn,{value:g,css:Ic(g),title:i(`values.${g}`),selected:t===g,apply:m=>{r(m),u();}},g))})]})]})}var qm=["none","colorOnly","bold","italic","underline","doubleUnderline","strikethrough","doubleStrikethrough"],uC=["byAuthor","auto",...editor.REVISION_MARKUP_COLORS];function Km(e,t,o){let{values:n}=e,r=a=>{let s=a==="changedLines"?["none","leftBorder","rightBorder","outsideBorder"]:a==="deletions"||a==="movedFrom"?[...qm,"hidden","caret","pound"]:qm,l=(a==="movedFrom"||a==="movedTo")&&!n.trackMoves;return jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("div",{className:"docx-revision-markup-row",children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-row-title","aria-hidden":"true",children:t(a)}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-field-label",children:t(a)}),jsxRuntime.jsx("select",{value:n[a].mark,disabled:l,onChange:c=>e.setValue(a,{...n[a],mark:c.target.value}),children:s.map(c=>jsxRuntime.jsx("option",{value:c,children:t(`values.${c}`)},c))})]}),jsxRuntime.jsx(Ki,{label:t(`${a}Color`),value:n[a].color,values:uC,disabled:l,t,change:c=>e.setValue(a,{...n[a],color:c})})]}),a!=="changedLines"&&jsxRuntime.jsx("div",{className:"docx-revision-markup-background",children:jsxRuntime.jsx(Ki,{label:t(`${a}Background`),value:n[a].background,values:["none","byAuthor",...editor.REVISION_MARKUP_COLORS],disabled:l,t,change:c=>e.setValue(a,{...n[a],background:c})})})]})},i=a=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n[a],"aria-describedby":`${o}-${a}`,onChange:s=>e.setValue(a,s.target.checked)}),t(a)]}),jsxRuntime.jsx("p",{id:`${o}-${a}`,children:t(`${a}Note`)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("markup")}),r("insertions"),r("deletions"),r("changedLines")]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("moves")}),i("trackMoves"),r("movedFrom"),r("movedTo")]}),jsxRuntime.jsxs("fieldset",{"data-docx-part":"field","data-docx-field":"cells",className:"docx-revision-markup-tableCells",children:[jsxRuntime.jsx("legend",{children:t("tableCells")}),["inserted","deleted","merged","split"].map(a=>jsxRuntime.jsx(Ki,{label:t(`${a}Cells`),value:n.cells[a],values:["byAuthor","none",...editor.REVISION_MARKUP_COLORS],t,change:s=>e.setValue("cells",{...n.cells,[a]:s})},a))]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("formatting")}),i("trackFormatting"),r("formatting")]})]})}var Lt=Do();function vC(){return Lt.useState()}function yC({session:e,...t}){return e?jsxRuntime.jsx(xC,{session:e,...t}):null}function xC({session:e,children:t,preset:o,className:n,style:r}){let i=Pt.useId(),{t:a}=N(),s=p=>a(`revisionMarkup.${p}`),l=Pt.useCallback(p=>e.subscribe(p),[e]),c=Pt.useCallback(()=>e.get(),[e]),d=Pt.useSyncExternalStore(l,c,c),[f,u]=Pt.useState(e.signal.aborted),g=Pt.useRef(null);Pt.useEffect(()=>{g.current=e;let p=()=>u(true);return u(e.signal.aborted),e.signal.addEventListener("abort",p),()=>{e.signal.removeEventListener("abort",p),g.current=null,queueMicrotask(()=>{g.current!==e&&e.cancel();});}},[e]);let m={values:d,setValue(p,v){e.set({[p]:v});},errors:{},isEnabled:!f&&e.canApply(),apply(){e.apply();},cancel(){e.cancel();},reset(){e.reset();}};return f?null:jsxRuntime.jsx(pt,{kind:"revisionMarkup",label:s("title"),className:["docx-revision-markup-dialog",n].filter(Boolean).join(" "),style:r,onClose:m.cancel,dismissOutside:false,sessionSignal:e.signal,children:jsxRuntime.jsx(Lt.Composition,{state:m,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",children:jsxRuntime.jsx("h2",{"data-docx-part":"title",children:s("title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-revision-markup-body",children:Km(m,s,i)}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-revision-markup-actions",children:[jsxRuntime.jsx("button",{"data-docx-part":"reset",type:"button",onClick:m.reset,children:s("reset")}),jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",children:m.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",type:"button",onClick:m.cancel,children:s("cancel")}),jsxRuntime.jsx("button",{"data-docx-part":"apply",type:"button",disabled:!m.isEnabled,onClick:m.apply,children:s("ok")})]})]}),children:t})})}var Ur=Object.assign(yC,{Header:Lt.Header,Title:Lt.Title,Body:Lt.Body,Footer:Lt.Footer,Apply:Lt.Apply,Cancel:Lt.Cancel,Error:Lt.Error,Field:Lt.Field,Reset:Lt.Reset});function Nc(e){let t=F(),o=Pt.useRef(e.onRevisionMarkupChange);o.current=e.onRevisionMarkupChange;let{onRevisionMarkupChange:n,...r}=e,i=JSON.stringify(r);return Pt.useEffect(()=>t?.on("revisionMarkupChange",a=>o.current?.(a)),[t]),Pt.useEffect(()=>{t&&t.setRevisionMarkup(JSON.parse(i));},[t,i]),null}function Vr({open:e,format:t,pending:o,error:n,onClose:r,className:i,style:a,children:s}){let{t:l}=N();if(!e)return null;let c=l(n?t==="pdf"?"toolbar.exportPdfFailed":"toolbar.exportMarkdownFailed":t==="pdf"?"toolbar.exportingPdf":"toolbar.exportingMarkdown");return jsxRuntime.jsx(pt,{kind:"export",label:c,role:n?"alertdialog":"dialog",className:`docx-export-dialog${o?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[o&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:n?"alert":"status",children:n||l("toolbar.exportDownloadHint")})}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:l(n?"common.close":"toolbar.exportContinueEditing")})})]})})}function Gr({open:e,pending:t,error:o,url:n,onClose:r,className:i,style:a,children:s}){let{t:l}=N();if(!e)return null;let c=l(o?"toolbar.printFailed":"toolbar.printPreparing"),d=n.startsWith("blob:")?n:"";return jsxRuntime.jsx(pt,{kind:"print",label:c,role:o?"alertdialog":"dialog",className:`docx-export-dialog docx-print-dialog${t?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,onKeyDown:f=>{editor.isChromePrintShortcut(f.nativeEvent)&&f.preventDefault();},children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[t&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),o&&jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:"alert",children:o})}),jsxRuntime.jsxs("footer",{className:"docx-dialog__footer",children:[o&&d&&jsxRuntime.jsx("a",{className:"docx-dialog__link-button docx-print-dialog__open",href:d,target:"_blank",rel:"noopener noreferrer",children:l("toolbar.printOpenPdf")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:l(o?"common.close":"common.cancel")})]})]})})}var ct={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function jn({text:e,x:t,y:o,className:n}){return jsxRuntime.jsx("div",{role:"tooltip",className:n,"data-testid":"docx-notes-preview",style:{position:"fixed",left:t,top:o,zIndex:ct.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg)",color:"var(--doc-popover-fg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",fontSize:12,lineHeight:1.4,pointerEvents:"none"},onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:e})}function Yn({noteKind:e,x:t,y:o,onDelete:n,onConvert:r,onConvertAll:i,onOpenProperties:a,onClose:s,deleteEnabled:l,convertEnabled:c,convertAllEnabled:d,deleteDisabledReason:f,convertDisabledReason:u,convertAllDisabledReason:g,className:m}){let{t:p}=N();return jsxRuntime.jsxs("div",{role:"menu",className:m,onKeyDown:v=>{v.key==="Escape"&&s();},"data-testid":"docx-notes-menu",style:{position:"fixed",left:t,top:o,zIndex:ct.popover,minWidth:160,background:"var(--doc-popover-bg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",padding:4},onMouseDown:B,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!l,title:f,onClick:n,children:p("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!c,title:u,onClick:r,children:p(e==="footnote"?"notes.convertToEndnote":"notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!d,title:g,onClick:i,children:p(e==="footnote"?"notes.convertAllFootnotes":"notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:a,children:p("dialogs.footnoteProperties.title")})]})}function RC(e){return t=>Pt.createElement(e,t)}var Vm=new WeakMap,DC=0;function De(e,t,o){if(e===false)return null;let n=e(t);if(!o)return n;let r=Vm.get(o);return r===void 0&&Vm.set(o,r=++DC),Pt.createElement(Pt.Fragment,{key:r},n)}function Xn(e,t,o){let n=e.getBoundingClientRect();return {left:t-n.left-e.clientLeft+e.scrollLeft,top:o-n.top-e.clientTop+e.scrollTop}}function Yr(e){return e.paragraphId===""}var dn=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),LC=e=>e;function FC(){let e=o=>!!o&&(o.width>0||o.height>0);if(typeof document<"u"){let n=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(n))return {left:n.left,top:n.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let o=t.getRangeAt(0),n=o.getBoundingClientRect();if(e(n))return {left:n.left,top:n.bottom};let r=o.startContainer,a=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(a))return {left:a.left,top:a.bottom}}return null}var Xr=Pt.createContext(null);function Fc(){let e=Pt.useContext(Xr),t=zi(e===null);return e??t}function zi(e=true){let t=F(),[o,n]=Pt.useState(dn),r=Pt.useRef(null),i=Pt.useRef(o);i.current=o;let a=O(LC),s=t?t.can({type:"insertText",text:""}).ok:false,l=Pt.useCallback(()=>{let h=r.current;h&&(h.editor.releaseSelection(h.pin),r.current=null);},[]),c=Pt.useCallback((h,b)=>{l(),n({mode:h?"reading":"editing",link:h??null,anchor:b??null,text:h?.text??"",url:h?h.kind==="internal"?`#${h.anchor??""}`:h.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,l]),d=Pt.useCallback(()=>{l(),n(dn);},[l]);Pt.useEffect(()=>l,[l]);let f=Pt.useCallback(()=>{let h=FC();l();let b=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(b&&Yr(b)){c(b,h);return}if(b){n({mode:"editing",link:b,anchor:h,text:b.text,url:b.kind==="internal"?`#${b.anchor??""}`:b.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let S=t?.query({type:"selectedText"})??"",C=t?.retainSelection()??null;t&&C&&(r.current={editor:t,pin:C}),n({mode:"editing",link:null,anchor:h,text:S,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c,l]);Pt.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:h=>c(h.link,{left:h.rect.left,top:h.rect.bottom}),onRequest:f})},[t,e,c,f]),Pt.useEffect(()=>{let h=i.current;if(h.mode!=="reading"||!h.link)return;let b=Yr(h.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;b&&b.id===h.link.id||n(dn);},[a,t]),Pt.useEffect(()=>{let h=i.current;if(h.mode!=="editing"||h.link)return;let b=t?.surface;!b||b.retainedSelection()||n(dn);},[a,t]);let u=Pt.useCallback(async()=>{let h=i.current.link?.href;if(!h)return false;try{await navigator.clipboard.writeText(h);}catch{return false}return n(b=>({...b,copied:true})),true},[]),g=Pt.useCallback(()=>{n(h=>({...h,mode:"editing",copied:false,error:false}));},[]),m=Pt.useCallback(h=>{n(b=>({...b,text:h,copied:false,error:false}));},[]),p=Pt.useCallback(h=>{n(b=>({...b,url:h,copied:false,error:false}));},[]),v=Pt.useCallback(()=>{let h=i.current,b=t?.surface?.hyperlinks;if(!b)return false;let S=h.url.trim();if(S.length===0)return n(T=>({...T,error:true})),false;let C=S.startsWith("#");return b.applyHyperlink({...C?{anchor:S.slice(1)}:{url:S},...h.text.trim().length>0?{text:h.text}:{}})?(d(),true):(n(T=>({...T,error:true})),false)},[t,d]),y=Pt.useCallback(()=>{let h=t?.surface?.hyperlinks,b=i.current.link;if(!h)return false;let S=h.removeHyperlink(b?.id);return S&&d(),S},[t,d]),x=Pt.useCallback(()=>{let h=t?.surface?.navigation,b=i.current.link;if(!h||!b)return false;if(b.kind==="internal"){let C=b.anchor?h.goToBookmark(b.anchor):false;return C&&n(dn),C}let S=h.openExternal(b.href);return S&&n(dn),S},[t]);return Pt.useMemo(()=>({state:o.mode==="closed"?dn:{...o,canEdit:s},open:c,openAtCaret:f,close:d,copy:u,beginEdit:g,setText:m,setUrl:p,commitEdit:v,unlink:y,openTarget:x}),[o,s,c,f,d,u,g,m,p,v,y,x])}function pn(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var $i=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),KC="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z",WC="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z",zC="M770-302 656-416l57-57 114 114-57 57ZM603-469 469-603l57-57 134 134-57 57ZM280-280h133v80H280q-83 0-141.5-58.5T80-400q0-83 58.5-141.5T280-600h133v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35Zm40-80v-80h101l80 80H320Zm493-15-57-57q23-11 33.5-32t10.5-36q0-50-35-85t-85-35H547v-80h133q83 0 141.5 58.5T880-400q0 32-11 61.5T813-375ZM792-56 56-792l56-56 736 736-56 56Z",$C="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z";function UC({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=Jt(),a=Pt.useRef(null),{state:s,close:l}=i;Pt.useEffect(()=>{if(s.mode==="closed")return;let p=y=>{y.key==="Escape"&&(y.preventDefault(),l());},v=y=>{let x=a.current;x&&y.target instanceof Node&&x.contains(y.target)||l();};return document.addEventListener("keydown",p),document.addEventListener("mousedown",v,true),()=>{document.removeEventListener("keydown",p),document.removeEventListener("mousedown",v,true);}},[s.mode,l]);let[c,d]=Pt.useState(null);Pt.useLayoutEffect(()=>{let p=s.anchor,v=a.current;if(!p||!v){d(null);return}let y=v.offsetParent;if(!y){d(null);return}let{left:x,top:h}=Xn(y,p.left,p.top),b=Math.max(0,y.scrollWidth-v.offsetWidth);d({left:Math.max(0,Math.min(x,b)),top:h});},[s.anchor]);let{t:f}=N(),u=s.mode==="editing"?f(s.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):f("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(VC,{children:n}):n;if(o)return s.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});let m={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":s.mode,role:"dialog","aria-modal":false,onMouseDown:pn,style:c??void 0,"aria-label":u};return s.mode==="closed"?null:t?jsxRuntime.jsx(j,{...m,children:n}):jsxRuntime.jsx("div",{...m,children:g})}function VC({children:e}){let{state:t}=Jt(),o=Pt.useMemo(()=>GC(e),[e]),n=(i,a)=>i in o?o[i]:a;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Fields",jsxRuntime.jsx(qc,{})),n("Error",jsxRuntime.jsx(Wc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Apply",jsxRuntime.jsx(Kc,{})),n("Cancel",jsxRuntime.jsx(zc,{}))]}),o.__extra]});let r=t.canEdit&&!(t.link&&Yr(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Url",jsxRuntime.jsx(Ac,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Copy",jsxRuntime.jsx(Oc,{})),r?n("Edit",jsxRuntime.jsx(Bc,{})):null,r?n("Unlink",jsxRuntime.jsx(Zc,{})):null]}),o.__extra]})}function GC(e){let t={},o=[],n=r=>{if(Array.isArray(r)){r.forEach(n);return}if(!r||typeof r!="object"||!("type"in r)){r&&o.push(r);return}if(r.type===Pt.Fragment){n(r.props.children);return}let i=r.type.docxHyperLinkPart;i?t[i]=r:o.push(r);};return n(e),o.length>0&&(t.__extra=o),t}function Jt(){return Pt.useContext(Xr)??jC}var jC={state:{mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:false},open:()=>{},openAtCaret:()=>{},close:()=>{},copy:async()=>false,beginEdit:()=>{},setText:()=>{},setUrl:()=>{},commitEdit:()=>false,unlink:()=>false,openTarget:()=>false};function Ac({className:e,asChild:t,hidden:o,children:n}){let{state:r,openTarget:i}=Jt(),{t:a}=N();if(o||!r.link)return null;let s=!r.link.href,l=r.link.kind==="internal",c=l?`#${r.link.anchor??""}`:r.link.authored,d=a(s?"hyperlinkPopup.inertTarget":l?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),f={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...s?{"data-inert":""}:{},title:d,onMouseDown:pn,...s?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx(j,{...f,className:e,children:n}):s?jsxRuntime.jsxs("span",{...f,children:[n??c,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...f,children:[n??c,$i($C)]})}Ac.docxHyperLinkPart="Url";function Oc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{state:i,copy:a}=Jt(),{t:s}=N();if(o||!i.link?.href)return null;let l=i.copied?s("editor.linkCopied"):s("hyperlinkPopup.copyLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...i.copied?{"data-copied":""}:{},"aria-label":l,title:l,onMouseDown:pn,onClick:()=>{a();}};return t?jsxRuntime.jsx(j,{...c,className:e,children:n}):jsxRuntime.jsx("button",{...c,children:r??n??$i(KC)})}Oc.docxHyperLinkPart="Copy";function Bc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{beginEdit:i}=Jt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.editLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":s,title:s,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:r??n??$i(WC)})}Bc.docxHyperLinkPart="Edit";function Zc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{unlink:i}=Jt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.removeLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":s,title:s,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:r??n??$i(zC)})}Zc.docxHyperLinkPart="Unlink";function qc({className:e,hidden:t}){let{state:o,setText:n,setUrl:r,commitEdit:i,close:a}=Jt(),{t:s}=N(),l=Pt.useRef(null),c=Pt.useId(),d=Pt.useId();Pt.useEffect(()=>{o.mode==="editing"&&(l.current?.focus({preventScroll:true}),l.current?.select());},[o.mode]);let f=Pt.useCallback(u=>{if(u.key==="Enter"){u.preventDefault(),i();return}u.key==="Escape"&&(u.preventDefault(),a());},[i,a]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:s("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:c,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:o.text,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onChange:u=>n(u.target.value),onKeyDown:f}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:s("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:l,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:o.url,placeholder:s("hyperlinkPopup.urlPlaceholder"),onChange:u=>r(u.target.value),onKeyDown:f})]})}qc.docxHyperLinkPart="Fields";function Kc({className:e,asChild:t,hidden:o,children:n}){let{state:r,commitEdit:i}=Jt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.apply"),l={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:n??s})}function Wc({className:e,hidden:t}){let{state:o}=Jt(),{t:n}=N();return t||!o.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:n("hyperlinkPopup.refused")})}Wc.docxHyperLinkPart="Error";Kc.docxHyperLinkPart="Apply";function zc({className:e,asChild:t,hidden:o,children:n}){let{close:r}=Jt(),{t:i}=N();if(o)return null;let a=i("hyperlinkPopup.cancel"),s={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:pn,onClick:()=>r()};return t?jsxRuntime.jsx(j,{...s,className:e,children:n}):jsxRuntime.jsx("button",{...s,children:n??a})}zc.docxHyperLinkPart="Cancel";var Jr=Object.assign(UC,{Url:Ac,Copy:Oc,Edit:Bc,Unlink:Zc,Fields:qc,Error:Wc,Apply:Kc,Cancel:zc});var ft={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function QC(e){return e==="sdtLocked"||e==="sdtContentLocked"}function eT(e){return e==="contentLocked"||e==="sdtContentLocked"}function Uc(e,t){return !e.ok&&e.code===t}function Qt(){let e=Pt.useContext(Vc),t=Ui();return e??t}function Ui(){let e=F(),[t,o]=Pt.useState(false),[n,r]=Pt.useState(false),[i,a]=Pt.useState(false),s=O(P=>P),l=e?.surface??null,c=l?.contentControls;Pt.useEffect(()=>{r(c?.showAll()??l?.state().contentControls.showAll??false),a(c?.formFill()??l?.state().contentControls.formFill??false);},[s,c,l]);let d=Pt.useMemo(()=>{if(!e)return null;let P=c?.atCaret()??null;if(P){let w=c?.disabledReason(P.id,"edit")??null,I=c?.disabledReason(P.id,"remove")??null;return {id:P.id,tag:P.tag??null,alias:P.alias??null,controlType:P.controlType,locked:eT(P.effectiveLock)||w==="locked",removalLocked:QC(P.effectiveLock)||I==="locked",placeholder:P.placeholder,bound:P.bound||w==="bound",effectiveLock:P.effectiveLock}}let T=e.query({type:"contentControlAt"});if(!T)return null;let R=c?.disabledReason(T.id,"edit")??null,M=c?.disabledReason(T.id,"remove")??null,E=e.can({type:"setContentControlValue",value:""}),_=e.can({type:"removeContentControl"}),H=T.locked===true||R==="locked"||Uc(E,"locked"),L=R==="bound"||Uc(E,"bound"),k=M==="locked"||Uc(_,"locked");return {id:T.id,tag:T.tag??null,alias:T.alias??null,controlType:T.controlType,locked:H,removalLocked:k,placeholder:false,bound:L,effectiveLock:null}},[e,s,c]),f=Pt.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,s]),u=Pt.useCallback(P=>{c?.setShowAll(P),r(P);},[c]),g=Pt.useCallback(P=>{c?.setFormFill(P),a(P);},[c]),m=Pt.useCallback(()=>u(!n),[u,n]),p=Pt.useCallback(()=>g(!i),[g,i]),v=Pt.useCallback(()=>o(true),[]),y=Pt.useCallback(()=>o(false),[]),x=Pt.useCallback(()=>o(P=>!P),[]),h=Pt.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let T=c.disabledReason(d.id,"edit");return T==="locked"?"the content control is locked":T==="bound"?"the content control is bound to external data":T==="notFound"?"the content control was not found":T}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let P=e.can({type:"setContentControlValue",value:""});return P.ok?null:P.reason},[d,c,e]),b=Pt.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let T=c.disabledReason(d.id,"remove");return T==="locked"?"the content control is locked":T==="notFound"?"the content control was not found":T}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let P=e.can({type:"removeContentControl"});return P.ok?null:P.reason},[d,c,e]),S=Pt.useCallback(P=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c&&d){let T=c.disabledReason(d.id,"edit");if(T)return {ok:false,code:T==="bound"?"bound":T==="locked"?"locked":"notFound",reason:T==="bound"?"the content control is bound to external data":T==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:P})},[e,c,d]),C=Pt.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c){let P=d?.id;if(!P)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let T=c.disabledReason(P,"remove");return T?{ok:false,code:T==="locked"?"locked":"notFound",reason:T==="locked"?"the content control is locked":"the content control was not found"}:c.remove(P)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,c,d]);return Pt.useMemo(()=>({control:d,controls:f,showAll:n,formFill:i,inspectorOpen:t,canSetValue:h===null&&d!==null,canRemove:b===null&&d!==null,setValueDisabledReason:h,removeDisabledReason:b,setShowAll:u,toggleShowAll:m,setFormFill:g,toggleFormFill:p,openInspector:v,closeInspector:y,toggleInspector:x,remove:C,setValue:S}),[d,f,n,i,t,h,b,u,m,g,p,v,y,x,C,S])}var Vc=Pt.createContext(null);function Gc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var ef=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),nT="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z",rT="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z",aT={position:"absolute",zIndex:20,minWidth:240,maxWidth:320,top:12,right:12,padding:12,borderRadius:8,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-surface)",boxShadow:"0 4px 16px var(--doc-shadow)",color:"var(--doc-text)",fontSize:13,display:"flex",flexDirection:"column",gap:10},iT={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},lT={color:"var(--doc-text-muted)",flexShrink:0},sT={textAlign:"right",wordBreak:"break-word"},cT={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},dT={display:"flex",gap:8,marginTop:4},tf={display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:4,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",color:"var(--doc-text)",font:"inherit",cursor:"pointer"};function uT(e){switch(e){case "plainText":return "contentControl.types.plainText";case "checkbox":return "contentControl.types.checkbox";case "dropdown":return "contentControl.types.dropdown";case "comboBox":return "contentControl.types.comboBox";case "date":return "contentControl.types.date";case "picture":return "contentControl.types.picture";case "buildingBlockGallery":return "contentControl.types.buildingBlockGallery";case "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function pT(e){return e.effectiveLock==="sdtContentLocked"?"contentControl.lock.sdtContentLocked":e.effectiveLock==="contentLocked"||e.locked?"contentControl.lock.contentLocked":e.effectiveLock==="sdtLocked"||e.removalLocked?"contentControl.lock.sdtLocked":"contentControl.lock.unlocked"}function Jn({label:e,value:t,testId:o}){return jsxRuntime.jsxs("div",{style:iT,"data-testid":o,children:[jsxRuntime.jsx("span",{style:lT,children:e}),jsxRuntime.jsx("span",{style:sT,children:t})]})}function mT({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=Qt(),a=Pt.useRef(null),s=Pt.useId(),{t:l}=N(),{control:c,inspectorOpen:d,closeInspector:f}=i;if(Pt.useEffect(()=>{if(!d)return;let p=y=>{y.key==="Escape"&&(y.preventDefault(),f());},v=y=>{let x=a.current;x&&y.target instanceof Node&&x.contains(y.target)||f();};return document.addEventListener("keydown",p),document.addEventListener("mousedown",v,true),()=>{document.removeEventListener("keydown",p),document.removeEventListener("mousedown",v,true);}},[d,f]),Pt.useEffect(()=>{d&&!c&&f();},[d,c,f]),o||!d||!c)return null;let u=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(of,{}),jsxRuntime.jsx(nf,{}),jsxRuntime.jsx("div",{style:dT,children:jsxRuntime.jsx(rf,{})}),n]}):n,g={ref:a,role:"dialog","aria-modal":false,"aria-labelledby":s,"data-testid":"content-control-inspector","data-control-id":c.id,"data-control-type":c.controlType,...c.locked?{"data-locked":""}:{},...c.bound?{"data-bound":""}:{},...c.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:aT,onMouseDown:p=>{Gc(p),p.stopPropagation();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:s,className:"docx-editor-sr-only",children:l("contentControl.inspectorPanel.title")}),u]});return t?jsxRuntime.jsx(j,{...g,children:m}):jsxRuntime.jsx("div",{...g,children:m})}function of({className:e,asChild:t,hidden:o,children:n}){let{closeInspector:r}=Qt(),{t:i}=N();if(o)return null;let a={style:cT,className:e??void 0,"data-testid":"content-control-inspector-header"},s=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:n??i("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":i("common.close"),title:i("common.close"),style:{...tf,padding:4,border:"none",background:"transparent"},onMouseDown:Gc,onClick:()=>r(),children:ef(nT)})]});return t?jsxRuntime.jsx(j,{...a,children:s}):jsxRuntime.jsx("div",{...a,children:s})}function nf({className:e,asChild:t,hidden:o,children:n}){let{control:r}=Qt(),{t:i}=N();if(o||!r)return null;let a=i("contentControl.inspectorPanel.empty"),s=i("contentControl.inspectorPanel.yes"),l=i("contentControl.inspectorPanel.no"),c=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.type"),value:i(uT(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.lock"),value:i(pT(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?s:l,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.bound"),value:r.bound?s:l,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:i("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:i("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx(j,{...d,children:c}):jsxRuntime.jsx("div",{...d,children:c})}function rf({className:e,asChild:t,hidden:o,icon:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:s,closeInspector:l}=Qt(),{t:c}=N();if(o)return null;let d=c("contentControl.remove"),f={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":d,title:a??d,style:tf,onMouseDown:Gc,onClick:()=>{s().ok&&l();}},u=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n??r??ef(rT),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(j,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}var ta=Object.assign(mT,{Header:of,Fields:nf,Remove:rf});var bT=e=>e;function Qc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function oa(){let e=F(),{t}=N(),[o,n]=Pt.useState(null),[r,i]=Pt.useState(null),a=Pt.useRef(null),s=Pt.useRef(null),l=Pt.useRef(null),c=Pt.useId(),d=Pt.useId(),f=Pt.useId(),u=o?.activation??null,g=O(bT),m=Pt.useMemo(()=>{if(!e?.surface||!u)return {replaceEnabled:false,removeEnabled:false,reason:null};let h=e.surface.equations.can(u.equation.id,"replace"),b=e.surface.equations.can(u.equation.id,"remove"),S=h.ok?b.ok?null:b.reason:h.reason;return {replaceEnabled:h.ok,removeEnabled:b.ok,reason:S?i18n.localizeDisabledReason(S,t):null}},[u,e,g,t]),p=Pt.useCallback((h=false)=>{l.current?.(),l.current=null,n(null),h&&e&&queueMicrotask(()=>e.focus());},[e]);Pt.useEffect(()=>{if(!e)return;let h=e.setEquationChrome({onPopover:b=>{l.current?.();let S=e.surface;if(S&&typeof S.retainSelection=="function"){let C=S.retainSelection();l.current=()=>S.releaseSelection(C);}else l.current=null;n({activation:b,mountGeneration:e.mountGeneration,draft:b.equation.linear,error:false});}});return ()=>{h(),l.current?.(),l.current=null,n(null);}},[e,p]),Pt.useEffect(()=>{if(!o||!e?.surface)return;(e.mountGeneration!==o.mountGeneration||!e.surface.equations.equationById(o.activation.equation.id))&&p();},[e,g,o,p]),Pt.useEffect(()=>{if(!o)return;let h=a.current,b=h?.ownerDocument,S=b?.defaultView;if(!h||!b||!S)return;let C=T=>{T.key==="Escape"&&(T.preventDefault(),p(true));},P=T=>{T.target instanceof S.Node&&h.contains(T.target)||p();};return b.addEventListener("keydown",C),b.addEventListener("pointerdown",P,true),()=>{b.removeEventListener("keydown",C),b.removeEventListener("pointerdown",P,true);}},[o,p]),Pt.useLayoutEffect(()=>{if(!u){i(null);return}let h=a.current;if(!h)return;let b=h.offsetParent;if(!b){i(null);return}let S=u.rect,C=Xn(b,S.left,S.bottom),P=Math.max(0,b.scrollWidth-h.offsetWidth);i({left:Math.max(0,Math.min(C.left,P)),top:C.top}),s.current?.focus({preventScroll:true}),s.current?.select();},[u]);let v=Pt.useCallback(()=>{if(!o||!e?.surface||!m.replaceEnabled)return false;let h=e.surface.equations.applyEquation(o.activation.equation.id,o.draft);return h?p(true):n(b=>b&&{...b,error:true}),h},[e,o,p,m.replaceEnabled]),y=Pt.useCallback(()=>{if(!o||!e?.surface||!m.removeEnabled)return false;let h=e.surface.equations.removeEquation(o.activation.equation.id);return h?p(true):n(b=>b&&{...b,error:true}),h},[e,o,p,m.removeEnabled]);if(!o)return null;let x=[o.error?d:null,m.reason?f:null].filter(Boolean).join(" ");return jsxRuntime.jsxs("div",{ref:a,className:"docx-equation-popup","data-testid":"equation-popup",role:"dialog","aria-modal":false,"aria-label":t("equationPopup.title"),style:r??void 0,onMouseDown:Qc,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:t("equationPopup.inputLabel")}),jsxRuntime.jsx("input",{id:c,ref:s,className:"docx-equation-popup__input","data-testid":"equation-popup-input",value:o.draft,placeholder:t("equationPopup.placeholder"),spellCheck:false,"aria-describedby":x||void 0,onChange:h=>n(b=>b&&{...b,draft:h.target.value,error:false}),onKeyDown:h=>{h.key!=="Enter"||h.nativeEvent.isComposing||(h.preventDefault(),v());}}),o.error?jsxRuntime.jsx("div",{id:d,className:"docx-equation-popup__error","data-testid":"equation-popup-error",role:"alert",children:t("equationPopup.refused")}):null,m.reason?jsxRuntime.jsx("div",{id:f,className:"docx-equation-popup__error","data-testid":"equation-popup-disabled-reason",role:"status",children:m.reason}):null,jsxRuntime.jsxs("div",{className:"docx-equation-popup__actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__apply","data-testid":"equation-popup-apply",disabled:!m.replaceEnabled,title:m.reason??void 0,onMouseDown:Qc,onClick:v,children:t("equationPopup.apply")}),jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__delete","data-testid":"equation-popup-delete",disabled:!m.removeEnabled,title:m.reason??void 0,onMouseDown:Qc,onClick:y,children:t("equationPopup.delete")})]})]})}var sf="review.comments",ed="review.addComment";function cf(e){return e!==sf?e:(Io(`The context-menu row "${sf}" is now "${ed}". The old id still works in this release; write "${ed}".`),ed)}function tr(e,t){if(!Pt.isValidElement(e)||e.type!==Pt.Fragment)return null;let n=Pt.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return n.length===1?n[0]:null}function Vi({entries:e,children:t,preset:o,keyOfEntry:n,keyOfChild:r,renderEntry:i,childrenOfEntry:a,onUnmatched:s}){if(!o)return t;let l=new Map,c=[];for(let m of Pt.Children.toArray(t)){let p=r(m);p?l.set(p,m):c.push(m);}let d=new Set,f=m=>m.map((p,v)=>{let y=n(p,v);d.add(y);let x=a?.(p),h=x?f(x):void 0,b=l.get(y);return jsxRuntime.jsx(Pt.Fragment,{children:b??i(p,v,h)},y)}),u=f(e),g=[...l.entries()].filter(([m])=>!d.has(m)).map(([m,p])=>(s?.(m,p),jsxRuntime.jsx(Pt.Fragment,{children:p},m)));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,g,c]})}var CT="review.addComment",TT=e=>e.editingMode==="viewing";function Gi(e){let{isEnabled:t,disabledReason:o}=ie(CT),n=O(TT);return t?{isEnabled:t,reason:null}:{isEnabled:t,reason:n?e("editingMode.viewingHint"):o}}var na=Pt.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),or="docx-menubar-more",ji=Pt.createContext({measuring:false,overflow:new Set,inMore:false});function mf(){return Pt.useContext(ji)}function at(){return Pt.useContext(na)}function ke(){let{t:e}=at(),{t}=N();return o=>e?.(o)??t(o)}var nr=Pt.createContext(-1);var PT='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function mn(e){return [...e.querySelectorAll(PT)].filter(t=>t.closest('[role="menu"]')===e)}function nd(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function Ht(e,t,o){if(e.length===0)return false;let n=t?e.indexOf(t):-1,r=n===-1?o>0?0:e.length-1:(n+o+e.length)%e.length;return e[r]?.focus(),true}function At(e,t){let o=t==="first"?e[0]:e[e.length-1];return o?(o.focus(),true):false}function rd(e){let t=e?.ownerDocument.activeElement;((t&&e?.contains(t)?t.closest("[data-menu]"):null)?.querySelector(':scope > [role="menuitem"]')??e?.querySelector('.docx-menubar__trigger[aria-expanded="true"]'))?.focus({preventScroll:true});}var Fo="data-toolbar-group",fn="data-toolbar-fixed",aa="data-toolbar-more",HT=34,Yi=new Set;function Xi(e,t,o){let n=Pt.useRef(null),r=Pt.useRef(new Map),i=Pt.useRef(HT),[a,s]=Pt.useState(Yi),l=Pt.useRef(a);l.current=a;let c=Pt.useRef({groups:t,order:o});c.current={groups:t,order:o};let d=t.join("\0"),f=o.join("\0"),u=Pt.useCallback(()=>{let m=n.current;if(!m||!e)return;let p=getComputedStyle(m),v=editor.readColumnGap(p),y=editor.readAvailableWidth(m,p),x=m.querySelector(".docx-toolbar__separator"),h=v*2;if(x){let R=getComputedStyle(x),M=editor.readInlineMargins(R);h=editor.separatorLeadingCost(x.offsetWidth,M.start,M.end,v);}for(let R of m.querySelectorAll(`[${Fo}]`)){let M=R.getAttribute(Fo);M&&R.offsetWidth>0&&r.current.set(M,editor.collapsibleGroupCost(R.offsetWidth,h));}let b=0;for(let R of m.querySelectorAll(`[${fn}]`))R.offsetWidth>0&&(b+=editor.trailingGapCost(R.offsetWidth,v));let S=m.querySelector(`[${aa}]`);S&&S.offsetWidth>0&&(i.current=editor.trailingGapCost(S.offsetWidth,v));let C={available:y,widths:r.current,groups:c.current.groups,order:c.current.order,fixed:b,more:i.current,previous:l.current,hysteresis:editor.TOOLBAR_OVERFLOW_HYSTERESIS},T=l.current.size===0&&editor.controlsOverflow(m,p)===false?Yi:editor.toolbarOverflowGroups(C);editor.sameOverflow(T,l.current)||(l.current=T,s(T));},[e]),g=Pt.useCallback(m=>{n.current=m;},[]);return Pt.useLayoutEffect(()=>{if(!e){l.current.size>0&&(l.current=Yi,s(Yi));return}u();},[e,d,u,f]),Pt.useEffect(()=>{let m=n.current;if(!e||!m||typeof ResizeObserver>"u")return;let p=0,v=new ResizeObserver(()=>{p===0&&(p=requestAnimationFrame(()=>{p=0,u();}));});v.observe(m),m.parentElement&&v.observe(m.parentElement);for(let y of m.querySelectorAll(`[${Fo}], [${fn}]`))v.observe(y);return ()=>{p!==0&&cancelAnimationFrame(p),v.disconnect();}},[e,d,u,f,a]),{attach:g,overflow:a}}function hf(e,t,o){let n=e.overflow.has(t),r=t===or;return {skip:e.inMore?!n:n,asSubmenu:e.inMore&&n,iconOnly:r,rootAttributes:{...e.measuring&&!r?{[Fo]:t}:{},...r?{[aa]:""}:{}},tabStop:o===t||r&&o!==null&&e.overflow.has(o)}}function bf(e,t,o){let[n,r]=Pt.useState(void 0);return Pt.useLayoutEffect(()=>{if(!e){r(void 0);return}let i=()=>{let s=t.current,l=o.current,c=s?.parentElement,d=s?.ownerDocument.defaultView;if(!s||!l||!c||!d)return;let f=s.getBoundingClientRect(),u=editor.toolbarPanelPlacement({triggerLeft:f.left,triggerRight:f.right,panelWidth:l.offsetWidth,viewportWidth:d.innerWidth});r({left:u.left-c.getBoundingClientRect().left,right:"auto",maxInlineSize:u.maxWidth});};i();let a=t.current?.ownerDocument.defaultView;return a?.addEventListener("resize",i),()=>a?.removeEventListener("resize",i)},[e,o,t]),n}var yf=12700,vf=96;function WT(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function zT(e,t,o,n){let r=e*72/o,i=t*72/n;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(i*100)/100)}}function Ji(e){let t=editor.DEFAULT_IMAGE_RESOURCE_LIMITS;if(e.byteLength===0)return {ok:false,reasonKey:"imageInsert.errors.emptyFile"};if(e.byteLength>t.maxEncodedBytes)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let o=editor.sniffImageMime(e);if(!WT(o))return o==="image/svg+xml"||o==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let n=editor.validateRasterHeader(e,o);if(!n)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(n.pixelWidth*n.pixelHeight>t.maxPixels||n.pixelWidth>t.maxDimension||n.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:i,heightPoints:a}=zT(n.pixelWidth,n.pixelHeight,n.dpiX??vf,n.dpiY??vf);return Object.freeze({ok:true,bytes:e,mime:o,widthPoints:i,heightPoints:a})}function Ho(e){return Math.round(e/yf*100)/100}function ia(e){return Math.round(e*yf)}var YT="image/png,image/jpeg,image/gif",id=Pt.createContext(null);function Tf(){let e=Pt.useContext(id);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function la(){return Pt.useContext(id)}function Qi({children:e}){let t=F(),{t:o}=N(),n=Pt.useRef(null),r=Pt.useRef(false),i=Pt.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),a=O(i,(p,v)=>p.enabled===v.enabled&&p.disabledReason===v.disabledReason),s=a.enabled,l=i18n.localizeDisabledReason(a.disabledReason,o),c=Pt.useCallback(async p=>{if(!t||r.current)return;let v=Ji(p);if(!v.ok){window.alert(o(v.reasonKey));return}let y={type:"insertImage",data:v.bytes,mime:v.mime,widthPoints:v.widthPoints,heightPoints:v.heightPoints},x=t.canExecuteImageCommand?.(y);if(x&&!x.ok){window.alert(x.reason??o("imageInsert.errors.refused"));return}r.current=true;try{let h=await editor.executeImageCommand(t,y);h.ok?t.focus():window.alert(h.reason??o("imageInsert.errors.refused"));}finally{r.current=false;}},[t,o]),d=Pt.useCallback(async p=>{let v=p?.[0];if(!v)return;let y=await v.arrayBuffer();await c(new Uint8Array(y));},[c]),f=Pt.useCallback(async p=>{if(!p)return;let v=[...p.files].find(y=>y.type.startsWith("image/"));if(v){await d([v]);return}for(let y of p.items){if(y.kind!=="file"||!y.type.startsWith("image/"))continue;let x=y.getAsFile();if(!x)continue;let h=await x.arrayBuffer();await c(new Uint8Array(h));return}},[c,d]),u=Pt.useCallback(()=>{s&&n.current?.click();},[s]),g=Pt.useCallback(async p=>{let v=p.currentTarget;await d(v.files),v.value="";},[d]),m=Pt.useMemo(()=>({openFilePicker:u,insertFromFileList:d,insertFromDataTransfer:f,isEnabled:s,disabledReason:l,inputRef:n,onInputChange:g}),[u,d,f,s,l,g]);return jsxRuntime.jsxs(id.Provider,{value:m,children:[jsxRuntime.jsx("input",{ref:n,type:"file",accept:YT,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:p=>p.stopPropagation()}),e]})}function el({className:e,hidden:t,asChild:o,children:n}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=Tf(),s=X();if(t)return null;let l=J("image.insert"),c=s(l?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":c,title:a??c,onMouseDown:B,onClick:r};return o?jsxRuntime.jsx(j,{...d,children:n}):jsxRuntime.jsx("button",{...d,children:n??re(l?.paths)})}el.docxSlot="image.insert";var sa=Object.assign(el,{docxSlot:"image.insert"});var ld=6,Ef=6;function ol({slot:e,label:t,onInserted:o,className:n}){let r=F(),{isEnabled:i}=ie(e),[a,s]=Pt.useState(null),[l,c]=Pt.useState({rows:1,cols:1}),d=Pt.useRef(null),f=Pt.useCallback((m,p)=>{if(!r||!i)return;let v={type:"insertTable",rows:m,cols:p};r.can(v).ok&&(r.exec(v),o(),r.focus());},[r,i,o]),u=Pt.useCallback(m=>{c(p=>{let v={rows:Math.min(Ef,Math.max(1,p.rows+(m.rows??0))),cols:Math.min(ld,Math.max(1,m.toCol??p.cols+(m.cols??0)))};return s(v),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${v.rows}x${v.cols}"]`)?.focus()),v});},[]),g=[];for(let m=1;m<=Ef;m+=1){let p=[];for(let v=1;v<=ld;v+=1){let y=!!a&&m<=a.rows&&v<=a.cols;p.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${m}x${v}`,className:"docx-menubar__grid-cell",tabIndex:l.rows===m&&l.cols===v?0:-1,...y?{"data-filled":""}:{},"aria-label":`${v} \xD7 ${m}`,onMouseDown:B,onMouseEnter:()=>s({rows:m,cols:v}),onFocus:()=>s({rows:m,cols:v}),onClick:()=>f(m,v)},v));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:p},m));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":t,className:`docx-menubar__grid${n?` ${n}`:""}`,onMouseLeave:()=>s(null),onKeyDown:m=>{if(m.key==="ArrowRight")u({cols:1});else if(m.key==="ArrowLeft")u({cols:-1});else if(m.key==="ArrowDown")u({rows:1});else if(m.key==="ArrowUp")u({rows:-1});else if(m.key==="Home")u({toCol:1});else if(m.key==="End")u({toCol:ld});else return;m.preventDefault(),m.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:g}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:a?`${a.cols} \xD7 ${a.rows}`:""})]})}function ar({slot:e="table.insert",className:t}){let{setOpenMenu:o}=at(),n=ke(),r=Pt.useCallback(()=>o(null),[o]);return jsxRuntime.jsx(ol,{slot:e,label:n("toolbar.insertTable"),onInserted:r,className:t})}function _e(e){let{icon:t,shortcut:o,disabled:n,title:r,active:i,selected:a,slot:s,onSelect:l,className:c,children:d}=e,f=e["data-value"],u=ko(),g=Pt.useId(),m=Pt.useContext(nr),p=n&&r?g:void 0;return jsxRuntime.jsxs("button",{type:"button",role:i===void 0?"menuitem":a===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${c?` ${c}`:""}`,tabIndex:m,...s?{"data-slot":s}:{},...f!==void 0?{"data-value":f}:{},...i?{"data-active":""}:{},...n?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...p?{"aria-describedby":p}:{},...r?{title:r}:{},onMouseDown:B,onClick:n?void 0:l,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),o?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:u(o)}):null,p?jsxRuntime.jsx("span",{id:g,className:"docx-editor-sr-only",children:r}):null]})}function da({label:e,labelKey:t,className:o,hidden:n,children:r}){let i=ke();if(n)return null;let a=e??(t===void 0?void 0:i(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${o?` ${o}`:""}`,...a?{"aria-label":a}:{},children:[a?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:a}):null,r]})}function nl(e){if(e.slotId)return e.slotId;if(e.slot)return _m(e.slot),e.slot;Lm();}function ho(e){let{labelKey:t,shortcutKey:o,className:n,hidden:r}=e,i=nl(e)??"",{execute:a,isActive:s,isEnabled:l,disabledReason:c,value:d}=ie(i),{setOpenMenu:f}=at(),u=ke();if(r||!i)return null;let g=J(i),m=u(t??g?.labelKey??i),p=editor.chromeSlotIsToggle(i),v=["setAlignment","setParagraphDirection","setReviewDisplayMode"].includes(editor.commandForSlot(i)?.type??"");return jsxRuntime.jsx(_e,{slot:i,icon:re(g?.paths),...o?{shortcut:u(o)}:{},disabled:!l,...c?{title:c}:{},...p?{active:s}:{},...v?{selected:true}:{},...d!==null?{"data-value":d}:{},onSelect:()=>{a(),f(null);},...n?{className:n}:{},children:m})}ho.docxMenuRow=true;function ua(e,t,o,n,r=()=>true){return Object.assign(({className:a,hidden:s})=>{let l=at(),c=ke(),d=n(l),f=o&&r(l)?o:void 0;if(s)return null;let u=J(e),g=c(t??u?.labelKey??e);return jsxRuntime.jsx(_e,{slot:e,icon:re(u?.paths),...f?{shortcut:c(f)}:{},disabled:!d,onSelect:()=>{d?.(),l.setOpenMenu(null);},...a?{className:a}:{},children:g})},{docxSlot:e})}var cd=ua("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),dd=ua("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave),ud=ua("file.exportMarkdown",void 0,void 0,e=>e.onExport?()=>e.onExport?.("markdown"):void 0),pd=ua("file.exportPdf",void 0,void 0,e=>e.onExport?()=>e.onExport?.("pdf"):void 0),md=ua("file.print",void 0,"toolbar.printShortcut",e=>e.onPrint,e=>e.printShortcut===true);function sP({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=ie(editor.chromeProbeForSlot("file.pageSetup")),r=at(),i=ke();if(t)return null;let a=J("file.pageSetup"),s=i(a?.labelKey??"file.pageSetup"),l=o&&!!r.onPageSetup;return jsxRuntime.jsx(_e,{slot:"file.pageSetup",icon:re(a?.paths),disabled:!l,...n?{title:n}:{},onSelect:()=>{r.onPageSetup?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:s})}function cP({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=ie(editor.chromeProbeForSlot("paragraph.dialog")),r=at(),i=ke();if(t)return null;let a=J("paragraph.dialog"),s=i(a?.labelKey??"lineSpacing.options"),l=o&&!!r.onParagraphDialog;return jsxRuntime.jsx(_e,{slot:"paragraph.dialog",icon:re(a?.paths),disabled:!l,...n?{title:n}:{},onSelect:()=>{r.onParagraphDialog?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:s})}var dP=Object.assign(cP,{docxSlot:"paragraph.dialog"}),fd=Object.assign(sP,{docxSlot:"file.pageSetup"});function uP({className:e,hidden:t}){let o=la(),n=at(),r=ke();if(t)return null;let i=J("image.insert"),a=r(i?.labelKey??"toolbar.image"),s=o?.isEnabled??false,l=o?.disabledReason??null;return jsxRuntime.jsx(_e,{slot:"image.insert",icon:re(i?.paths),disabled:!s,...l?{title:l}:{},onSelect:()=>{o?.openFilePicker(),n.setOpenMenu(null);},...e?{className:e}:{},children:a})}var gd=Object.assign(uP,{docxSlot:"image.insert"}),ca=8;function Ot({labelKey:e,label:t,paths:o,className:n,children:r}){let i=ke(),[a,s]=Pt.useState(false),l=Pt.useRef(null),c=Pt.useRef(null),d=Pt.useId();t===void 0&&e===void 0&&Fm();let f=t??i(e??""),[u,g]=Pt.useState(null);return Pt.useLayoutEffect(()=>{if(!a){g(null);return}let m=l.current,p=c.current,v=m?.ownerDocument.defaultView;if(!m||!p||!v)return;let y=m.getBoundingClientRect(),x=p.offsetWidth,h=p.offsetHeight,b=y.right+x>v.innerWidth-ca;g({left:b?Math.max(ca,y.left-x):Math.min(y.right,v.innerWidth-x-ca),top:Math.max(ca,Math.min(y.top-4,v.innerHeight-h-ca))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onKeyDown:m=>{m.key==="ArrowRight"&&document.activeElement===l.current?(m.preventDefault(),s(true),queueMicrotask(()=>{c.current&&At(mn(c.current),"first");})):(m.key==="ArrowLeft"||m.key==="Escape")&&a&&(m.preventDefault(),m.stopPropagation(),s(false),l.current?.focus());},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||s(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?d:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:B,onFocus:()=>s(true),onClick:()=>s(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:re(o)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:f}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:d,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":f,style:u?{position:"fixed",left:u.left,top:u.top}:{position:"fixed",visibility:"hidden"},onKeyDown:m=>{let p=c.current;if(!p)return;let v=mn(p);m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),Ht(v,document.activeElement,1)):m.key==="ArrowUp"&&(m.preventDefault(),m.stopPropagation(),Ht(v,document.activeElement,-1));},children:jsxRuntime.jsx(nr.Provider,{value:-1,children:r})}):null]})}function pP({entry:e}){let{isEnabled:t}=ie(e.slot),o=J(e.slot);return t?jsxRuntime.jsx(Ot,{labelKey:e.labelKey??o?.labelKey??e.slot,paths:o?.paths,children:jsxRuntime.jsx(ar,{slot:e.slot})}):jsxRuntime.jsx(ho,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function gn({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function pa({entry:e,children:t}){return e.kind==="separator"?jsxRuntime.jsx(gn,{}):e.kind==="submenu"?jsxRuntime.jsx(Ot,{labelKey:e.labelKey,paths:e.paths,children:t??e.items.map((o,n)=>jsxRuntime.jsx(pa,{entry:o},n))}):e.slot==="file.open"?jsxRuntime.jsx(cd,{}):e.slot==="file.save"?jsxRuntime.jsx(dd,{}):e.slot==="file.exportMarkdown"?jsxRuntime.jsx(ud,{}):e.slot==="file.exportPdf"?jsxRuntime.jsx(pd,{}):e.slot==="file.print"?jsxRuntime.jsx(md,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(fd,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(dP,{}):e.slot==="image.insert"?jsxRuntime.jsx(gd,{}):e.picker==="tableGrid"?jsxRuntime.jsx(pP,{entry:e}):jsxRuntime.jsx(ho,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function Df(e){if(!Pt.isValidElement(e))return null;let t=tr(e,Df);if(t!==null)return t;let o=e.type;return typeof o!="function"&&typeof o!="object"?null:typeof o.docxSlot=="string"?o.docxSlot:o.docxMenuRow===true?nl(e.props)??null:null}function mP(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function Mf(e,t,o){return Vi({entries:e??[],children:t,preset:o,keyOfEntry:mP,keyOfChild:Df,childrenOfEntry:n=>n.kind==="submenu"?n.items:void 0,renderEntry:(n,r,i)=>jsxRuntime.jsx(pa,{entry:n,children:i})})}function Bt({id:e,labelKey:t,label:o,icon:n,className:r,hidden:i,preset:a=true,children:s}){let{openMenu:l,setOpenMenu:c,activeMenu:d,opening:f}=at(),u=mf(),g=ke(),m=Pt.useId(),p=Pt.useRef(null),v=Pt.useRef(null),y=Pt.useRef(false),x=Pt.useRef(false),h=editor.CHROME_MENUS.find(E=>E.id===e),b=l===e,S=bf(b&&e===or,p,v);if(i)return null;let C=o??g(t??h?.labelKey??e),P=hf(u,e,d);if(P.skip)return null;if(P.asSubmenu)return jsxRuntime.jsx(Ot,{labelKey:t??h?.labelKey??e,label:C,children:Mf(h?.entries,s,a)});let T=Mf(h?.entries,s,a),R=P.iconOnly,M=()=>{c(null),p.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,...P.rootAttributes,children:[jsxRuntime.jsxs("button",{ref:p,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":b,"aria-controls":b?m:void 0,className:"docx-menubar__trigger",disabled:f===true,tabIndex:P.tabStop?0:-1,...b?{"data-open":""}:{},...R?{"aria-label":C,title:C}:{},onMouseDown:B,onKeyDown:E=>{E.key==="ArrowDown"||E.key==="Enter"||E.key===" "||E.key==="ArrowUp"?(E.preventDefault(),y.current=true,c(e)):E.key==="Escape"&&b&&(E.preventDefault(),M());},onClick:()=>{if(x.current){x.current=false;return}c(b?null:e);},onMouseEnter:()=>{l!==null&&l!==e&&(x.current=true,c(e));},onMouseLeave:()=>{x.current=false;},children:[n?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:n}):null,R?null:C]}),b?jsxRuntime.jsx("div",{ref:E=>{v.current=E,E&&y.current&&(y.current=false,At(mn(E),"first"));},id:m,role:"menu","aria-label":C,style:S,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:E=>{let _=v.current;if(!_)return;let H=mn(_),L=document.activeElement;E.key==="ArrowDown"?(E.preventDefault(),Ht(H,L,1)):E.key==="ArrowUp"?(E.preventDefault(),Ht(H,L,-1)):E.key==="Home"?(E.preventDefault(),At(H,"first")):E.key==="End"?(E.preventDefault(),At(H,"last")):E.key==="Escape"?(E.preventDefault(),E.stopPropagation(),M()):E.key==="Tab"&&c(null);},children:jsxRuntime.jsx(nr.Provider,{value:-1,children:T})}):null]})}function hd(e){return Object.assign(o=>jsxRuntime.jsx(Bt,{id:e,...o}),{docxMenu:e})}var bd=hd("file"),vd=hd("format"),yd=hd("insert");var rl=Pt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function Ao(){return Pt.useContext(rl)}function If(){return Pt.useContext(rl).target}var _f=["M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-560l-80-80 240-240h120v40L600-560ZM240-640q33 0 56.5-23.5T320-720q0-33-23.5-56.5T240-800q-33 0-56.5 23.5T160-720q0 33 23.5 56.5T240-640Zm240 180q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6Zm-240 300q33 0 56.5-23.5T320-240q0-33-23.5-56.5T240-320q-33 0-56.5 23.5T160-240q0 33 23.5 56.5T240-160Z"],Nf=["M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"],xd=["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"],Lf=["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],Ff=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],Hf=["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],Af=["M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"];function sr(e,t,o){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:s,hidden:l})=>{let c=F(),{close:d}=Ao(),f=ke(),{isEnabled:u,disabledReason:g}=ie(t);return l?null:jsxRuntime.jsx(_e,{slot:e,icon:r??re(o.paths),shortcut:f(a??o.shortcutKey),disabled:!u,...g?{title:g}:{},onSelect:()=>{c?.exec(t),d(true);},...s?{className:s}:{},children:f(i??o.labelKey)})},{docxRow:e})}var ma=sr("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:_f}),fa=sr("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:Nf}),ga=sr("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:Lf}),ha=sr("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:Af});function cr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=F(),{close:a,clipboardRefusal:s,reportClipboardRefusal:l}=Ao(),c=ke(),d=Pt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:f,disabledReason:u}=ie(d);if(r)return null;let g=s!==null;return jsxRuntime.jsx(_e,{slot:"edit.paste",icon:e??re(xd),shortcut:c(o??"contextMenu.pasteShortcut"),disabled:!f||g,...s??u?{title:s??u??""}:{},onSelect:()=>{(async()=>{try{let{text:m,html:p}=await hP();(m||p)&&i?.exec({type:"paste",text:m,...p?{html:p}:{}});}catch(m){l(m instanceof Error?m.message:"the clipboard is not readable");}finally{a(true);}})();},...n?{className:n}:{},children:c(t??"contextMenu.paste")})}cr.docxRow="edit.paste";async function hP(){let e=navigator.clipboard;if(typeof e.read=="function"&&typeof ClipboardItem<"u")try{let t=await e.read(),o="",n=null;for(let r of t)r.types.includes("text/plain")&&(o=await(await r.getType("text/plain")).text()),r.types.includes("text/html")&&(n=await(await r.getType("text/html")).text());if(o||n)return {text:o,html:n}}catch{}return {text:await e.readText(),html:null}}function dr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=F(),{close:a,clipboardRefusal:s,reportClipboardRefusal:l}=Ao(),c=ke(),d=Pt.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:f,disabledReason:u}=ie(d);if(r)return null;let g=s!==null;return jsxRuntime.jsx(_e,{slot:"edit.pasteWithoutFormatting",icon:e??re(xd),shortcut:c(o??"contextMenu.pasteWithoutFormattingShortcut"),disabled:!f||g,...s??u?{title:s??u??""}:{},onSelect:()=>{(async()=>{try{let m=await navigator.clipboard.readText();m&&i?.exec({type:"pasteWithoutFormatting",text:m});}catch(m){l(m instanceof Error?m.message:"the clipboard is not readable");}finally{a(true);}})();},...n?{className:n}:{},children:c(t??"contextMenu.pasteWithoutFormatting")})}dr.docxRow="edit.pasteWithoutFormatting";var Of=J("format.painter")?.paths??[],al=sr("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:Of}),il=sr("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:Of});function hn(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:s,destructive:l})=>{let{close:c}=Ao(),d=ke(),f=ll(),{isEnabled:u,disabledReason:g,execute:m}=ie(t);return s||!f?null:jsxRuntime.jsx(_e,{slot:e,icon:r??re(o.paths),disabled:!u,...g?{title:g}:{},className:`${l??o.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{m()&&c(true);},children:d(i??o.labelKey)})},{docxRow:e})}var ur=hn("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),pr=hn("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),mr=hn("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),fr=hn("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),gr=hn("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),hr=hn("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),br=hn("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),bP=[{alignment:"top",labelKey:"tableAdvanced.top",icon:"vertical_align_top"},{alignment:"center",labelKey:"tableAdvanced.middle",icon:"vertical_align_center"},{alignment:"bottom",labelKey:"tableAdvanced.bottom",icon:"vertical_align_bottom"}];function bn({hidden:e}){let{close:t}=Ao(),o=ke(),n=ll(),r=ie({type:"setTableCellVerticalAlignment",alignment:"top"}),i=ie({type:"setTableCellVerticalAlignment",alignment:"center"}),a=ie({type:"setTableCellVerticalAlignment",alignment:"bottom"}),s=[r,i,a];return e||!n?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":o("tableAdvanced.verticalAlignment"),children:bP.map((l,c)=>{let d=s[c];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":o(l.labelKey),title:d.disabledReason??o(l.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:f=>{f.preventDefault(),f.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:re(editor.tableChromeIconPaths(l.icon))},l.alignment)})})]})}bn.docxRow="table.cellVerticalAlignment";function Bf(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:s})=>{let l=F(),{close:c,tocId:d}=Ao(),f=ke(),u=Pt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:m}=ie(u);return s||d===null?null:jsxRuntime.jsx(_e,{slot:e,icon:r??re(o.paths),disabled:!g,...m?{title:m}:{},onSelect:()=>{l?.exec(u),c(true);},...a?{className:a}:{},children:f(i??o.labelKey)})},{docxRow:e})}var vr=Bf("toc.refresh","entire",{labelKey:"toc.refresh",paths:Ff}),yr=Bf("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:Hf});function ll(){return O(Pt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function sl({label:e,icon:t,shortcut:o,disabled:n,disabledReason:r,active:i,onSelect:a,className:s}){let{close:l}=Ao();return jsxRuntime.jsx(_e,{...t?{icon:t}:{},...o?{shortcut:o}:{},...n?{disabled:n}:{},...n&&r?{title:r}:{},...i!==void 0?{active:i}:{},onSelect:()=>{a?.(),l(true);},...s?{className:s}:{},children:e})}var vn=Pt.createContext(false);function Ct(){return Pt.useContext(vn)?"":"docx-editor "}var ul=8;function PP(){let e=Pt.useContext(xt),t=at(),o=ke(),{isEnabled:n,reason:r}=Gi(o);if((e?.mounted??0)===0)return null;let i=J("review.addComment");return jsxRuntime.jsx(_e,{icon:re(i?.paths),slot:"review.addComment",disabled:!n,title:r??void 0,onSelect:()=>{e?.requestCommentDraft()&&t.setOpenMenu(null);},children:o("comments.addComment")})}function SP(){let e=F(),t=at(),o=ke();return e?.can({type:"editTextFormField"}).ok?jsxRuntime.jsx(_e,{slot:"field.edit",onSelect:()=>{t.setOpenMenu(null),e.exec({type:"editTextFormField"});},children:o("textFormField.edit")}):null}var EP=[{kind:"row",id:"field.edit",render:()=>jsxRuntime.jsx(SP,{})},{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(ma,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(fa,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(cr,{})},{kind:"row",id:"edit.pasteWithoutFormatting",render:()=>jsxRuntime.jsx(dr,{})},{kind:"row",id:"format.copyFormatting",render:()=>jsxRuntime.jsx(al,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(il,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(ga,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(ha,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(ho,{slotId:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.addComment",render:()=>jsxRuntime.jsx(PP,{})}];function wP(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:ur.docxRow,render:()=>jsxRuntime.jsx(ur,{})},{kind:"row",id:pr.docxRow,render:()=>jsxRuntime.jsx(pr,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:mr.docxRow,render:()=>jsxRuntime.jsx(mr,{})},{kind:"row",id:fr.docxRow,render:()=>jsxRuntime.jsx(fr,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:gr.docxRow,render:()=>jsxRuntime.jsx(gr,{})},{kind:"row",id:hr.docxRow,render:()=>jsxRuntime.jsx(hr,{})},{kind:"row",id:br.docxRow,render:()=>jsxRuntime.jsx(br,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:bn.docxRow,render:()=>jsxRuntime.jsx(bn,{})}]}function MP(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:vr.docxRow,render:()=>jsxRuntime.jsx(vr,{})},{kind:"row",id:yr.docxRow,render:()=>jsxRuntime.jsx(yr,{})}]}function RP(e,t=false){return [...EP,...e?wP():[],...t?MP():[]]}function zf(e){if(!Pt.isValidElement(e))return null;let t=tr(e,zf);if(t!==null)return t;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxRow=="string")return o.docxRow;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxMenuRow===true){let n=nl(e.props);if(n)return n}return null}function Kf(e){if(!Pt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function DP(e){return e?.closest(".docx-editor__scroll-container")??null}function va({className:e,t,preset:o=true,disabled:n,onOpenChange:r,children:i}){let a=Ct(),s=F(),{t:l}=N(),c=ll(),d=Pt.useRef(null),f=Pt.useRef(null),[u,g]=Pt.useState(null),[m,p]=Pt.useState(null),[v,y]=Pt.useState(null),x=Pt.useMemo(()=>RP(c,m!==null),[c,m]),[h,b]=Pt.useState(null),S=Pt.useCallback((H=false)=>{g(null),b(null),p(null),y(null),H&&s?.focus();},[s]);Pt.useEffect(()=>{if(n)return;let H=DP(d.current);if(!H)return;let L=k=>{k.preventDefault();let w=k.button===-1||k.clientX===0&&k.clientY===0,I=H.getBoundingClientRect();p(s?.snapshot().tocContext?.id??null),y(w||!(k.target instanceof HTMLElement)?null:k.target),g(w?{x:I.left+16,y:I.top+16}:{x:k.clientX,y:k.clientY});};return H.addEventListener("contextmenu",L),()=>H.removeEventListener("contextmenu",L)},[n,s]),Pt.useEffect(()=>{n&&S();},[n,S]),Pt.useEffect(()=>{if(!u)return;let H=w=>{f.current?.contains(w.target)||S();},L=w=>{w.key==="Escape"?(w.preventDefault(),S(true)):w.key==="Tab"&&S();},k=()=>S();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",L),document.addEventListener("scroll",k,{capture:true,passive:true}),window.addEventListener("blur",k),window.addEventListener("resize",k),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",L),document.removeEventListener("scroll",k,true),window.removeEventListener("blur",k),window.removeEventListener("resize",k);}},[u,S]),Pt.useLayoutEffect(()=>{let H=f.current;if(!u||!H)return;let{width:L,height:k}=H.getBoundingClientRect(),w=window.innerWidth-L-ul,I=window.innerHeight-k-ul,$=Math.max(ul,u.x>w?u.x-L:u.x),W=Math.max(ul,u.y>I?u.y-k:u.y);b({x:$,y:W});},[u]),Pt.useLayoutEffect(()=>{h&&f.current?.focus({preventScroll:true});},[h]);let C=Pt.useRef(r);C.current=r;let P=Pt.useRef(false);Pt.useEffect(()=>{let H=u!==null;H!==P.current&&(P.current=H,C.current?.(H));},[u]);let T=Pt.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>S(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,S]),[R,M]=Pt.useState(null),E=Pt.useMemo(()=>({close:S,anchor:u,tocId:m,target:v,clipboardRefusal:R,reportClipboardRefusal:M}),[S,u,m,v,R]),_={position:"fixed",left:(h??u)?.x??0,top:(h??u)?.y??0,visibility:h?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:u?jsxRuntime.jsx(na.Provider,{value:T,children:jsxRuntime.jsx(rl.Provider,{value:E,children:jsxRuntime.jsxs("div",{ref:f,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??l("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:_,onKeyDown:H=>{let L=f.current;if(!L)return;let k=mn(L);H.key==="ArrowDown"?(H.preventDefault(),Ht(k,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),Ht(k,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),At(k,"first")):H.key==="End"&&(H.preventDefault(),At(k,"last"));},children:[Pt.Children.toArray(i).filter(Kf),Vi({entries:x,children:Pt.Children.toArray(i).filter(H=>!Kf(H)),preset:o,keyOfEntry:H=>H.id,keyOfChild:H=>cf(zf(H)),renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(gn,{}):H.render(),onUnmatched:(H,L)=>{L.props.hidden&&Nm(H);}})]})})}):null})}var Pd=Object.assign(va,{Cut:ma,Copy:fa,Paste:cr,PasteWithoutFormatting:dr,Delete:ga,SelectAll:ha,InsertRowAbove:ur,InsertRowBelow:pr,InsertColumnLeft:mr,InsertColumnRight:fr,DeleteTableRow:gr,DeleteTableColumn:hr,DeleteTable:br,CellVerticalAlignment:bn,RefreshToc:vr,RefreshTocPageNumbers:yr,Item:sl,Slot:ho,Row:_e,Group:da,Separator:gn,Submenu:Ot});var $f=Pt.createContext(void 0),Uf=$f.Provider,Zt=()=>Pt.useContext($f);function Vf(){let e=Zt(),{t}=N();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e?.hyperlink&&De(e.hyperlink,{}),e?.contentControl&&De(e.contentControl,{}),e?.equation&&De(e.equation,{}),e?.contextMenu&&De(e.contextMenu,{t:o=>t(o)})]})}function Gf(e,t,o,n){return {...e,hyperlink:e?.hyperlink??(t===false?false:r=>jsxRuntime.jsx(Jr,{...r})),contentControl:e?.contentControl??(r=>jsxRuntime.jsx(ta,{...r})),equation:e?.equation??(()=>jsxRuntime.jsx(oa,{})),contextMenu:e?.contextMenu!==void 0?e.contextMenu===false?false:r=>e.contextMenu&&De(e.contextMenu,{...r,t:n??r.t}):o===false?false:r=>jsxRuntime.jsx(va,{...r,t:n??r.t,...typeof o=="object"?o:{}})}}function FP(e,t){return e===t?true:!e||!t||e.kind!==t.kind?false:e.kind==="note"&&t.kind==="note"?e.id===t.id:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:true}function Sd(){let e=F(),t=Pt.useCallback(n=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),o=O(t,FP);return o?.kind==="note"?o:null}function jf(e,t){return e===t?true:!e||!t?false:e.pos===t.pos&&e.numFmt===t.numFmt&&e.numStart===t.numStart&&e.numRestart===t.numRestart}function Yf(e,t){return e.resolved.pos===t.resolved.pos&&e.resolved.numFmt===t.resolved.numFmt&&e.resolved.numStart===t.resolved.numStart&&e.resolved.numRestart===t.resolved.numRestart&&jf(e.documentAuthored,t.documentAuthored)&&jf(e.sectionAuthored,t.sectionAuthored)}function HP(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Yf(e.footnote,t.footnote)&&Yf(e.endnote,t.endnote)}function Ed(){let e=F(),t=Pt.useCallback(o=>e?.getNotePropertiesState()??null,[e]);return O(t,HP)}function ya(e,t){let[o,n]=Pt.useState(null),r=Pt.useCallback(s=>n(s),[]),[i,a]=Pt.useState({visibility:"hidden"});return Pt.useLayoutEffect(()=>{let s=o?.closest(".docx-editor__scroll-container"),l=s??o?.parentElement?.querySelector(".docx-editor__scroll-container");if(!o||!l)return;let c=0,d=null,f=new ResizeObserver(()=>g()),u=()=>{c=0;let p=e(l);if(p!==d&&(f.disconnect(),f.observe(l),f.observe(o),p&&f.observe(p),d=p),!p||!p.isConnected){a({visibility:"hidden"});return}let v=p.getBoundingClientRect(),y=t==="story-label"?Math.max(o.offsetHeight,28):o.offsetHeight,x=t==="story-label"?6:4,h=s===l,b=t==="after"?v.bottom+6:v.top-y-x,S=h?Xn(l,v.left,b):{left:v.left,top:b},C=S.left,P=S.top,T=h?l.scrollLeft+8:8;a({position:h?"absolute":"fixed",left:t==="story-label"?C:Math.max(T,C+8),top:t==="story-label"?P:Math.max(h?l.scrollTop+8:8,P),...t==="story-label"?{width:Math.max(240,Math.min(v.width,l.clientWidth-16))}:{maxWidth:Math.max(240,Math.min(v.width-16,l.clientWidth-16))},visibility:"visible"});},g=()=>{c||(c=requestAnimationFrame(u));};f.observe(l),f.observe(o);let m=new MutationObserver(g);return m.observe(l,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),l.addEventListener("scroll",g,{passive:true}),window.addEventListener("resize",g),u(),()=>{c&&cancelAnimationFrame(c),f.disconnect(),m.disconnect(),l.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[o,e,t]),{ref:r,style:i}}var BP=/^(footnote|endnote):(-?\d{1,10})$/;function Qf(e){let t=BP.exec(e);if(!t)return null;let o=Number(t[2]);return Number.isInteger(o)?{noteKind:t[1],noteId:o}:null}function ZP(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function Md(e){let t=F();return Pt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function qP(e){let{t}=N(),[o,n]=Pt.useState(false),r=Pt.useRef(null);return Pt.useEffect(()=>{if(!o)return;let i=a=>{r.current?.contains(a.target)||n(false);};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":o,"aria-haspopup":"menu",onMouseDown:B,onClick:()=>n(i=>!i),children:t("headerFooter.options")}),o?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:B,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),n(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),n(false);},children:t("common.close")})]}):null]})}function fl({className:e}){let t=Zt(),o=Pt.useRef(null),{t:n}=N(),r=F(),i=Sd(),[a,s]=Pt.useState(null),[l,c]=Pt.useState(null),[d,f]=Pt.useState(false),u=Pt.useRef(null),g=Pt.useCallback(_=>{if(!i)return null;let L=[..._.querySelectorAll("[data-docx-note-scope]")].find(k=>k.matches("[data-docx-note]")&&k.dataset.docxNoteScope===i.id)??null;return L?.closest("[data-docx-notes]")??L},[i]),m=ya(g,"story-label"),p=Pt.useCallback(()=>{u.current&&clearTimeout(u.current),u.current=null,s(null);},[]);Pt.useEffect(()=>{if(!r)return;let _=o.current?.closest(".docx-editor__scroll-container")??o.current?.closest(".docx-editor");if(!_)return;let H=w=>{let I=w.target;if(!I)return;let $=I.closest("[data-docx-note-ref]");if($?.dataset.docxNoteScope){w.preventDefault(),p(),c(null),r.setActiveScope({kind:"note",id:$.dataset.docxNoteScope});return}I.closest("[data-docx-note-mark-back]")&&(w.preventDefault(),p(),c(null),r.setActiveScope({kind:"body"}));},L=w=>{let I=w,W=I.target?.closest("[data-docx-note-scope]");W?.dataset.docxNoteScope&&(I.preventDefault(),c({scopeId:W.dataset.docxNoteScope,x:I.clientX,y:I.clientY}));},k=w=>{if(ZP())return;let $=w.target?.closest("[data-docx-note-ref]");if(!$?.dataset.docxNoteScope){p();return}let W=$.dataset.docxNoteScope,V=r.getNotePreviewText(W)??$.getAttribute("aria-description")??n("notes.previewFallback"),se=$.getBoundingClientRect();u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{s({scopeId:W,text:V,x:se.left,y:se.bottom+4});},400);};return _.addEventListener("click",H),_.addEventListener("contextmenu",L),_.addEventListener("pointerover",k),_.addEventListener("scroll",p,true),()=>{_.removeEventListener("click",H),_.removeEventListener("contextmenu",L),_.removeEventListener("pointerover",k),_.removeEventListener("scroll",p,true),p();}},[r,p,n]);let v=Pt.useCallback(_=>{r&&(r.exec(_),c(null));},[r]),y=l?Qf(l.scopeId):null,x=Pt.useMemo(()=>y?{type:"deleteNote",noteKind:y.noteKind,noteId:y.noteId}:null,[y]),h=Pt.useMemo(()=>y?{type:"convertNote",fromKind:y.noteKind,noteId:y.noteId}:null,[y]),b=Pt.useMemo(()=>y?{type:"convertAllNotes",fromKind:y.noteKind}:null,[y]),S=Md(x??{type:"deleteNote",noteKind:"footnote",noteId:0}),C=Md(h??{type:"convertNote",fromKind:"footnote",noteId:0}),P=Md(b??{type:"convertAllNotes",fromKind:"footnote"}),T=i?Qf(i.id):null,R=T?n("notes.editingRegion",{kind:T.noteKind==="footnote"?n("notes.footnoteKind"):n("notes.endnoteKind"),number:/* arbi patch: the painted mark, not the w:id */o.current?.closest(".docx-editor")?.querySelector(`[data-docx-note-scope="${i.id}"]:is([data-docx-note-ref],[data-docx-note-mark-back])`)?.textContent?.trim()||T.noteId}):null,M=l&&y?{...l,...y,onDelete:()=>{x&&v(x);},onConvert:()=>{h&&v(h);},onConvertAll:()=>{b&&v(b);},onOpenProperties:()=>f(true),onClose:()=>c(null),deleteEnabled:S.enabled,convertEnabled:C.enabled,convertAllEnabled:P.enabled,deleteDisabledReason:S.reason??void 0,convertDisabledReason:C.reason??void 0,convertAllDisabledReason:P.reason??void 0}:null,E={onClose:()=>f(false),onApply:_=>{v(_),f(false);}};return r?jsxRuntime.jsxs("div",{className:e,ref:o,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":i?void 0:true,children:[i&&T?jsxRuntime.jsxs("div",{ref:m.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":n("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":i.id,style:{...m.style,zIndex:ct.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:R}),jsxRuntime.jsx(qP,{onOpenProperties:()=>f(true),onClose:()=>r.setActiveScope({kind:"body"})})]}):null,a&&t?.notePreview!==false?t?.notePreview?De(t.notePreview,a):jsxRuntime.jsx(jn,{...a}):null,M&&t?.notesContextMenu!==false?t?.notesContextMenu?De(t.notesContextMenu,M):jsxRuntime.jsx(Yn,{...M}):null,d&&t?.noteProperties!==false?t?.noteProperties?De(t.noteProperties,E):jsxRuntime.jsx(gl,{...E}):null]}):null}function gl(e){let{t}=N(),o=F(),n=Ed(),[r,i]=Pt.useState("document"),[a,s]=Pt.useState("decimal"),[l,c]=Pt.useState("continuous"),[d,f]=Pt.useState("pageBottom"),[u,g]=Pt.useState("decimal"),[m,p]=Pt.useState("continuous"),[v,y]=Pt.useState("docEnd");Pt.useEffect(()=>{n&&(s(n.footnote.resolved.numFmt),c(n.footnote.resolved.numRestart),f(n.footnote.resolved.pos),g(n.endnote.resolved.numFmt),p(n.endnote.resolved.numRestart),y(n.endnote.resolved.pos));},[n]);let x=!n?.footnote.documentAuthored&&!n?.footnote.sectionAuthored,h=!n?.endnote.documentAuthored&&!n?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","data-docx-modal":"","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:ct.modal},onClick:e.onClose,onKeyDown:b=>{b.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:b=>b.stopPropagation(),onMouseDown:b=>b.stopPropagation(),children:[jsxRuntime.jsx("h2",{className:"docx-note-properties__title",children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-note-properties__body",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__scope",children:[jsxRuntime.jsx("span",{children:t("notes.scope")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:r,onChange:b=>i(b.target.value),children:[jsxRuntime.jsx("option",{value:"document",children:t("notes.scopeDocument")}),jsxRuntime.jsx("option",{value:"section",children:t("notes.scopeSection")})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.footnotes")}),x?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange:b=>s(b.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:l,onChange:b=>c(b.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:d,onChange:b=>f(b.target.value),children:[jsxRuntime.jsx("option",{value:"pageBottom",children:t("dialogs.footnoteProperties.footnotePositions.bottomOfPage")}),jsxRuntime.jsx("option",{value:"beneathText",children:t("dialogs.footnoteProperties.footnotePositions.belowText")})]})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.endnotes")}),h?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:u,onChange:b=>g(b.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:m,onChange:b=>p(b.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:v,"data-testid":"docx-notes-endnote-position",onChange:b=>y(b.target.value),children:[jsxRuntime.jsx("option",{value:"docEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfDocument")}),jsxRuntime.jsx("option",{value:"sectEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfSection")})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__footer",children:[jsxRuntime.jsx("button",{className:"docx-note-properties__button",type:"button",onClick:e.onClose,children:t("common.cancel")}),jsxRuntime.jsx("button",{className:"docx-note-properties__button docx-note-properties__button--primary",type:"button","data-testid":"docx-notes-properties-apply",onClick:()=>{if(!o)return;let b={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?n?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:l,position:d},endnote:{numFmt:u,numRestart:m,position:v}};o.can(b).ok&&e.onApply(b);},children:t("common.apply")})]})]})})}var og=e=>e.image;function tg(e){return Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(t=>t.offsetParent!==null||t===document.activeElement)}function GP(e){e&&!e.closest(".docx-editor")&&e.classList.add("docx-editor");}function jP(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Nd(e){let t=e.position;return !t||e.kind!=="anchored"?{positionMode:"frame",horizontalPoints:"",verticalPoints:"",relativeToH:"page",relativeToV:"line"}:t.mode==="simple"?{positionMode:"simple",horizontalPoints:t.horizontalEmu!==void 0?String(Ho(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ho(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(Ho(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ho(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function YP(e,t){let o=Nd(t);return e.horizontalPoints!==o.horizontalPoints||e.verticalPoints!==o.verticalPoints||e.relativeToH!==o.relativeToH||e.relativeToV!==o.relativeToV}function hl(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let o=ia(t);return Number.isInteger(o)?o:null}function XP(e,t){let o=Nd(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let c=e.horizontalPoints!==o.horizontalPoints,d=e.verticalPoints!==o.verticalPoints,f=c?hl(e.horizontalPoints):t.position?.horizontalEmu,u=d?hl(e.verticalPoints):t.position?.verticalEmu;return c&&f===null?{ok:false}:d&&u===null?{ok:false}:f===void 0||u===void 0?{ok:false}:{ok:true,value:{horizontalEmu:f,verticalEmu:u}}}let n=e.horizontalPoints!==o.horizontalPoints,r=e.verticalPoints!==o.verticalPoints,i=e.relativeToH!==o.relativeToH,a=e.relativeToV!==o.relativeToV,s=n?hl(e.horizontalPoints):t.position?.horizontalEmu,l=r?hl(e.verticalPoints):t.position?.verticalEmu;return n&&s===null?{ok:false}:r&&l===null?{ok:false}:{ok:true,value:{...typeof s=="number"?{horizontalEmu:s}:{},...typeof l=="number"?{verticalEmu:l}:{},...i||n||r?{relativeToH:e.relativeToH}:{},...a||n||r?{relativeToV:e.relativeToV}:{}}}}function bl(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function vl(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Ca({open:e,onClose:t,className:o,triggerRef:n}){let r=F(),{t:i}=N(),a=O(og),s=Pt.useId(),l=Pt.useId(),c=Pt.useId(),d=Pt.useRef(null),f=Pt.useRef(null),u=Pt.useRef(null),g=Pt.useRef(null),[m,p]=Pt.useState(null),[v,y]=Pt.useState(null),x=f.current,h=x?.canCrop===false,b=x?.canResize===false,S=x?.locks.changeAspect===true,C=x?.kind==="anchored"&&x.canMove===true,P=x?.kind==="inline",T=x?.kind==="anchored"&&x.canMove===false;Pt.useEffect(()=>{if(!e){f.current=null,u.current=null,g.current=null;return}if(!a)return;if(f.current=a,r?.surface){let{anchor:$}=r.surface.state().selection;u.current={paragraphId:$.paragraphId,offset:$.offset},g.current=r.surface.session.packageRevision();}y(null);let w=Nd(a),I=a.crop;p({widthPoints:String(Ho(a.widthEmu)),heightPoints:String(Ho(a.heightEmu)),cropLeft:String(I.left),cropTop:String(I.top),cropRight:String(I.right),cropBottom:String(I.bottom),title:a.title,description:a.description,hyperlink:a.hyperlink??"",wrap:a.wrap,lockAspect:a.locks.changeAspect,...w});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let R=Pt.useCallback(()=>{n?.current?.focus(),r?.focus();},[r,n]),M=Pt.useCallback(()=>{t(),R();},[t,R]);Pt.useEffect(()=>{if(!e)return;let w=d.current;if(!w)return;let I=tg(w);(I.find(ee=>ee.id==="image-prop-width"&&!ee.hasAttribute("disabled"))??I.find(ee=>!ee.hasAttribute("disabled"))??w).focus();let W=ee=>{if(ee.key==="Escape"){ee.preventDefault(),M();return}if(ee.key!=="Tab")return;let V=tg(w);if(V.length===0)return;let se=document.activeElement,U=V.findIndex(pe=>pe===se);if(U===-1)return;ee.preventDefault();let ce=ee.shiftKey?(U-1+V.length)%V.length:(U+1)%V.length;V[ce]?.focus();};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[e,M]);let E=Pt.useMemo(()=>{let w=x??a;return !w||w.widthEmu<=0?1:w.widthEmu/w.heightEmu},[a,x]),_=Pt.useCallback(w=>{p(I=>{if(!I)return I;if(!I.lockAspect)return {...I,widthPoints:w};let $=vl(w);if($===null)return {...I,widthPoints:w};let W=Math.round($/E*100)/100;return {...I,widthPoints:w,heightPoints:String(W)}});},[E]),H=Pt.useCallback(w=>{p(I=>{if(!I)return I;if(!I.lockAspect)return {...I,heightPoints:w};let $=vl(w);if($===null)return {...I,heightPoints:w};let W=Math.round($*E*100)/100;return {...I,widthPoints:String(W),heightPoints:w}});},[E]),L=Pt.useCallback(()=>{let w=f.current;if(!w?.intrinsic)return;let I=w.intrinsic.pixelWidth*72/w.intrinsic.dpiX,$=w.intrinsic.pixelHeight*72/w.intrinsic.dpiY;p(W=>W&&{...W,widthPoints:String(Math.round(I*100)/100),heightPoints:String(Math.round($*100)/100)});},[a]),k=Pt.useCallback(()=>{let w=f.current,I=u.current,$=g.current;if(!r||!w||!m||!I||$===null)return;let W={type:"setImageProperties",drawingNodeId:w.id,expectedPackageRevision:$,selectionParagraphId:I.paragraphId,selectionOffset:I.offset};if(!b){let pe=vl(m.widthPoints),K=vl(m.heightPoints);if(pe===null||K===null){y("imageProperties.errors.invalidDimensions");return}let Z=ia(pe),be=ia(K);Z!==w.widthEmu&&(W.widthEmu=Z),be!==w.heightEmu&&(W.heightEmu=be);}if(w.canCrop&&!h){let pe=bl(m.cropLeft),K=bl(m.cropTop),Z=bl(m.cropRight),be=bl(m.cropBottom);if(pe===null||K===null||Z===null||be===null){y("imageProperties.errors.invalidCrop");return}let Re=w.crop;(pe!==Re.left||K!==Re.top||Z!==Re.right||be!==Re.bottom)&&(W.crop={left:pe,top:K,right:Z,bottom:be});}m.title!==w.title&&(W.title=m.title),m.description!==w.description&&(W.description=m.description);let ee=m.hyperlink.trim();if(ee!==(w.hyperlink??"")&&(W.hyperlink=ee===""?null:ee),w.canChangeWrap&&m.wrap!==w.wrap&&(W.wrap=m.wrap),w.kind==="anchored"&&w.canMove&&YP(m,w)){let pe=XP(m,w);if(!pe.ok){y("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(pe.value,w))){y("imageProperties.errors.invalidPosition");return}Object.assign(W,pe.value);}if(!(W.widthEmu!==void 0||W.heightEmu!==void 0||W.title!==void 0||W.description!==void 0||W.hyperlink!==void 0||W.crop!==void 0||W.wrap!==void 0||W.horizontalEmu!==void 0||W.verticalEmu!==void 0||W.relativeToH!==void 0||W.relativeToV!==void 0)){M();return}if(!r.can(W).ok){y("imageProperties.errors.refused");return}if(!r.exec(W).ok){y("imageProperties.errors.refused");return}M();},[r,m,h,b,M]);return !e||!m?null:jsxRuntime.jsx("div",{ref:GP,className:`docx-dialog-overlay${o?` ${o}`:""}`,onClick:M,onMouseDown:w=>{w.stopPropagation(),jP(w);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","data-docx-modal":"","aria-labelledby":s,className:"docx-dialog docx-image-properties-dialog",onClick:w=>w.stopPropagation(),onMouseDown:w=>w.stopPropagation(),children:[jsxRuntime.jsx("div",{id:s,className:"docx-dialog__header",children:i("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[v?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:i(v)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:i("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:m.widthPoints,disabled:b,onChange:w=>_(w.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:i("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:m.heightPoints,disabled:b,onChange:w=>H(w.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:m.lockAspect,disabled:S,onChange:w=>p(I=>I&&{...I,lockAspect:w.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:h||!x?.intrinsic,onClick:L,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),P?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,T?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:i("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:m.relativeToH??"page",onChange:w=>p(I=>I&&{...I,relativeToH:w.target.value}),children:editor.DRAWING_REL_FROM_H.map(w=>jsxRuntime.jsx("option",{value:w,children:i(`dialogs.imagePosition.relativeOptions.${w}`)},w))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:i("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:m.relativeToV??"line",onChange:w=>p(I=>I&&{...I,relativeToV:w.target.value}),children:editor.DRAWING_REL_FROM_V.map(w=>jsxRuntime.jsx("option",{value:w,children:i(`dialogs.imagePosition.relativeOptions.${w}`)},w))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:i("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:m.horizontalPoints,onChange:w=>p(I=>I&&{...I,horizontalPoints:w.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:i("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:m.verticalPoints,onChange:w=>p(I=>I&&{...I,verticalPoints:w.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:i("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:m.title,onChange:w=>p(I=>I&&{...I,title:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:i("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:m.description,onChange:w=>p(I=>I&&{...I,description:w.target.value}),placeholder:i("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:i("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:c,className:"docx-dialog__input docx-dialog__input--full",value:m.hyperlink,onChange:w=>p(I=>I&&{...I,hyperlink:w.target.value}),placeholder:i("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:l,children:i("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:l,className:"docx-dialog__select docx-dialog__input--full",value:m.wrap,disabled:x?.canChangeWrap===false,onChange:w=>p(I=>I&&{...I,wrap:w.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(w=>jsxRuntime.jsx("option",{value:w,children:i(`imageWrap.targets.${w}`)},w))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:i("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:h,value:m.cropLeft,onChange:w=>p(I=>I&&{...I,cropLeft:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:i("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:h,value:m.cropTop,onChange:w=>p(I=>I&&{...I,cropTop:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:i("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:h,value:m.cropRight,onChange:w=>p(I=>I&&{...I,cropRight:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:i("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:h,value:m.cropBottom,onChange:w=>p(I=>I&&{...I,cropBottom:w.target.value})})]}),h?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:M,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:k,children:i("common.apply")})]})]})})}function yl({className:e,hidden:t,asChild:o,children:n}){let r=Zt(),i=F(),{t:a}=N(),s=O(og),[l,c]=Pt.useState(false),d=Pt.useRef(null),f={type:"setImageProperties",description:"probe"},u=i&&s?i.can(f):null,g=u?.ok===true,m=u&&!u.ok?u.reason:null;if(t)return null;let p=J("image.properties"),v={type:"button",ref:d,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!g,...g?{}:{"data-disabled":""},"aria-label":a("formattingBar.imagePropertiesShortcut"),title:m??a("formattingBar.imagePropertiesShortcut"),onMouseDown:B,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o?jsxRuntime.jsx(j,{...v,children:n}):jsxRuntime.jsx("button",{...v,children:n??re(p?.paths)}),l&&r?.imageProperties!==false?r?.imageProperties?De(r.imageProperties,{open:l,onClose:()=>c(false),triggerRef:d}):jsxRuntime.jsx(Ca,{open:l,onClose:()=>c(false),triggerRef:d}):null]})}yl.docxSlot="image.properties";var Cr=Object.assign(yl,{docxSlot:"image.properties"});function Ta(e){let t=F(),o=Pt.useCallback(()=>editor.toolbarCommandState(t,e),[t,e]),n=O(o,(r,i)=>r.value===i.value&&r.enabled===i.enabled&&r.disabledReason===i.disabledReason);return Pt.useMemo(()=>({execute:(r,i)=>editor.runToolbarCommand(t,e,r,i),value:n.value===void 0?null:e==="font.size"||e==="list.lineSpacing"?Number(n.value):n.value,options:e==="image.wrap"?editor.IMAGE_WRAP_TARGETS:[],isEnabled:n.enabled,disabledReason:n.disabledReason}),[t,e,n])}function xl({className:e,hidden:t,asChild:o,children:n}){let r=Zt(),i=X(),{execute:a,value:s,isEnabled:l,disabledReason:c}=Ta("image.altText"),[d,f]=Pt.useState(false),[u,g]=Pt.useState(""),m=Pt.useRef(null),p=Pt.useRef(null),v=Pt.useId();Pt.useEffect(()=>{d&&g(s??"");},[d,s]),Pt.useEffect(()=>{if(!d)return;let C=T=>{let R=m.current;T.target instanceof Node&&(R?.contains(T.target)||R?.ownerDocument.getElementById(v)?.contains(T.target))||f(false);},P=T=>{T.key==="Escape"&&(T.preventDefault(),f(false),p.current?.focus());};return document.addEventListener("mousedown",C,true),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C,true),document.removeEventListener("keydown",P);}},[d,v]);let y=Pt.useCallback(()=>{a(u),f(false);},[u,a]);if(t)return null;let x=J("image.altText"),h=i(x?.labelKey??"formattingBar.altText"),b={type:"button",ref:p,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!l,...l?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?v:void 0,"aria-label":h,title:c??h,onMouseDown:B,onClick:()=>f(C=>!C)},S={id:v,value:u,onValueChange:g,onApply:y,onClose:()=>f(false),isEnabled:l,anchorRef:p};return jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__alt-text",children:[o?jsxRuntime.jsx(j,{...b,children:n}):jsxRuntime.jsx("button",{...b,children:n??h}),d&&r?.imageAltText!==false?r?.imageAltText?De(r.imageAltText,S):jsxRuntime.jsx(Cl,{...S}):null]})}xl.docxSlot="image.altText";var Pa=Object.assign(xl,{docxSlot:"image.altText"});function Cl({id:e,value:t,onValueChange:o,onApply:n,onClose:r,isEnabled:i,className:a}){let{t:s}=N();return jsxRuntime.jsxs("div",{id:e,role:"dialog","aria-label":s("imageAltText.panelTitle"),className:`docx-toolbar__alt-text-panel${a?` ${a}`:""}`,onMouseDown:l=>l.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${e}-description`,children:s("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${e}-description`,className:"docx-dialog__textarea",value:t,onChange:l=>o(l.target.value),placeholder:s("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:s("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",disabled:!i,onClick:n,children:s("common.apply")})]})]})}var ig=Pt.createContext(void 0),lg=ig.Provider;function Ue(){let e=Pt.useContext(ig),{t}=N();return Pt.useCallback((o,n)=>{let r=e?.(o,n);return r===void 0||r===o?t(o,n):r},[e,t])}function Hd(e){let[t,o]=Pt.useState(e.session),[n,r]=Pt.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(dS,{...e},n)}function dS({session:e,className:t,style:o,children:n}){let r=Ue(),[i,a]=Pt.useState(e.signal.aborted),s=Pt.useRef(null);return Pt.useEffect(()=>{let l=()=>a(true);return e.signal.addEventListener("abort",l,{once:true}),e.signal.aborted&&l(),()=>e.signal.removeEventListener("abort",l)},[e]),i?null:jsxRuntime.jsx(pt,{kind:"invalidTextFormField",role:"alertdialog",label:r("textFormField.invalidTitle"),className:t,style:o,panelRef:s,dismissOutside:false,onClose:e.acknowledge,sessionSignal:e.signal,restoreFocus:false,onKeyDown:l=>{l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),e.acknowledge());},children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("header",{className:"docx-dialog__header",children:jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:r("textFormField.invalidTitle")})}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:r(e.type==="number"?"textFormField.invalidNumber":"textFormField.invalidDate")}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:e.acknowledge,children:r("textFormField.apply")})})]})})}var dg=Pt.createContext(null),ug=dg.Provider;function Qe(){let e=Pt.useContext(dg);if(!e)throw new globalThis.Error("useContentControlWidget must be rendered inside DocxEditorContentControlWidget.");return e}function TS(e){return e.kind==="date"?editor.parseIsoDate(e.value)?e.value.slice(0,10):"":e.value}function pg(e){let t=`docx-cc-list-${Pt.useId()}`,[o,n]=Pt.useState(()=>TS(e)),[r,i]=Pt.useState(()=>editor.calendarDateText(e.value,e.locale)),a=Pt.useMemo(()=>editor.createContentControlListNavigation(e.locale),[e]),[s,l]=Pt.useState(false),c=Pt.useCallback(E=>{i(E),l(false);},[]),d=O(()=>e.canApply()),f=e.kind==="date"?editor.parseIsoDate(e.value):null,[u,g]=Pt.useState(()=>{let E=f??new Date;return {year:E.getFullYear(),month:E.getMonth()}}),m=Pt.useCallback(E=>{let _=e.apply(E??o);return l(!_),_},[e,o]),p=Pt.useCallback(()=>e.cancel(),[e]),v=Pt.useCallback(async E=>{if(!e.replaceImage)return l(true),false;try{let _=E instanceof Uint8Array?E.byteLength:E.size;if(!e.canApply()||_>store.DEFAULT_IMAGE_RESOURCE_LIMITS.maxEncodedBytes)return l(!0),!1;let H=E instanceof Uint8Array?E:new Uint8Array(await E.arrayBuffer()),L=await e.replaceImage(H);return l(!L),L}catch{return l(true),false}},[e]),y=Pt.useMemo(()=>editor.calendarMonth(u.year,u.month,{locale:e.locale,selected:e.kind==="date"?e.value:null}),[u,e]),x=Pt.useCallback(()=>{g(E=>editor.shiftMonth(E.year,E.month,-1)),P(null);},[]),h=Pt.useCallback(()=>{g(E=>editor.shiftMonth(E.year,E.month,1)),P(null);},[]),b=Pt.useCallback(E=>m(E),[m]),S=Pt.useCallback(()=>m(editor.isoDateOf(new Date)),[m]),[C,P]=Pt.useState(null),T=Pt.useCallback(E=>{let _=editor.parseIsoDate(E);_&&(g({year:_.getFullYear(),month:_.getMonth()}),P(editor.isoDateOf(_)));},[]),R=Pt.useCallback(()=>{let E=editor.calendarDateFromText(r,e.locale);return E?m(E):(l(true),false)},[r,e.locale,m]),M=Pt.useCallback((E,_)=>{!Number.isInteger(E)||E<100||E>9999||!Number.isInteger(_)||_<0||_>11||(g({year:E,month:_}),P(null));},[]);return Pt.useMemo(()=>({session:e,kind:e.kind,items:e.items,value:o,setValue:n,isEnabled:d,refused:s,apply:m,cancel:p,calendar:y,previousMonth:x,nextMonth:h,selectDay:b,selectToday:S,focusIso:C,focusDay:T,dateText:r,setDateText:c,applyDateText:R,showMonth:M,listNavigation:a,listId:t,accept:editor.CONTENT_CONTROL_PICTURE_ACCEPT,replaceImage:v}),[e,v,o,d,s,m,p,y,x,h,b,S,C,T,r,c,R,M,a,t])}function Ve(e,t,o,n){if(t.hidden)return null;let{children:r,asChild:i,className:a,style:s,hidden:l,id:c,title:d,"aria-label":f,...u}=t,g=r===void 0?n:r,{key:m,...p}=o,v={...c!==void 0?{id:c}:{},...d!==void 0?{title:d}:{},...f!==void 0?{"aria-label":f}:{}};if(i){let{className:x,style:h,...b}=p;return jsxRuntime.jsx(j,{...u,...b,...v,...a?{className:a}:{},style:{...h,...s},children:g},m)}return jsxRuntime.jsx(e,{...u,...p,...v,className:[o.className,a].filter(Boolean).join(" "),style:{...o.style,...s},children:g},m)}var Cn=e=>e.stopPropagation();function Zd(e){return Ve("div",e,{className:"docx-content-control-calendar-header","data-docx-part":"header"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qd,{}),jsxRuntime.jsx(Xd,{}),jsxRuntime.jsx(Kd,{}),jsxRuntime.jsx(Wd,{className:"docx-content-control-calendar-announcement"})]}))}function qd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"previousMonth","aria-label":o("contentControl.calendar.previousMonth"),onMouseDown:Cn,onClick:t.previousMonth},"\u2039")}function Kd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"nextMonth","aria-label":o("contentControl.calendar.nextMonth"),onMouseDown:Cn,onClick:t.nextMonth},"\u203A")}function Wd(e){let t=Qe();return Ve("div",e,{className:"docx-content-control-calendar-title","data-docx-part":"title","aria-live":"polite"},t.calendar.title)}function zd(e){let t=Qe();return Ve("div",e,{className:"docx-content-control-calendar-weekdays","data-docx-part":"weekdays"},t.calendar.weekdays.map((o,n)=>jsxRuntime.jsx("span",{children:o},n)))}function $d({day:e,...t}){let o=Qe(),n=o.calendar.days.find(i=>i.iso===o.focusIso)??o.calendar.days.find(i=>i.selected)??o.calendar.days.find(i=>i.today&&!i.otherMonth)??o.calendar.days.find(i=>!i.otherMonth),r=i=>{if(i.nativeEvent.isComposing||i.altKey||i.ctrlKey||i.metaKey)return;let a=editor.calendarDateForKey(e.iso,i.key,o.session.locale,i.shiftKey);a&&(i.preventDefault(),o.focusDay(a));};return Ve("button",t,{type:"button",className:"docx-content-control-calendar-day","data-docx-part":"day","data-iso":e.iso,role:"gridcell",tabIndex:e.iso===n?.iso?0:-1,"aria-label":e.label,...e.selected?{"data-selected":"","aria-selected":true}:{},"aria-current":e.today?"date":void 0,"aria-selected":e.selected,...e.today?{"data-today":""}:{},...e.otherMonth?{"data-other-month":""}:{},disabled:!o.isEnabled,onMouseDown:Cn,onClick:()=>o.selectDay(e.iso),onKeyDown:r},String(e.day))}function Ud(e){let t=Qe(),o=Pt.useRef(null);return Pt.useLayoutEffect(()=>{let n=o.current;if(!n||n.ownerDocument.activeElement?.closest("[data-docx-part=previousMonth],[data-docx-part=nextMonth],[data-docx-part=month],[data-docx-part=year]"))return;((t.focusIso?n.querySelector(`[data-iso="${t.focusIso}"]`):null)??n.querySelector("[data-selected]")??n.querySelector("[data-today]:not([data-other-month])")??n.querySelector('[data-docx-part="day"]:not([data-other-month])'))?.focus({preventScroll:true});},[t.focusIso,t.calendar]),Ve("div",e,{ref:o,className:"docx-content-control-calendar-grid","data-docx-part":"grid",role:"grid","aria-label":t.calendar.title},Array.from({length:6},(n,r)=>jsxRuntime.jsx("div",{role:"row",className:"docx-content-control-calendar-week",children:t.calendar.days.slice(r*7,r*7+7).map(i=>jsxRuntime.jsx($d,{day:i},i.iso))},r)))}function Vd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-today","data-docx-part":"today",disabled:!t.isEnabled,onMouseDown:Cn,onClick:t.selectToday},o("contentControl.calendar.today"))}function Gd(e){return Ve("div",e,{className:"docx-content-control-calendar","data-docx-part":"calendar"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Zd,{}),jsxRuntime.jsx(zd,{}),jsxRuntime.jsx(Ud,{}),jsxRuntime.jsxs("div",{className:"docx-content-control-calendar-entry","data-docx-part":"dateEntry",children:[jsxRuntime.jsx(Vd,{}),jsxRuntime.jsx(Pl,{})]}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(El,{})]}))}function jd({item:e,...t}){let o=Qe();return Ve("button",t,{type:"button",className:"docx-content-control-menu-item","data-docx-part":"item","data-value":e.value,role:"option",tabIndex:o.items.findIndex(n=>n.value===o.value)<0?o.items[0]===e?0:-1:o.value===e.value?0:-1,"aria-selected":o.value===e.value,disabled:!o.isEnabled,onMouseDown:Cn,onClick:()=>o.apply(e.value)},e.displayText)}function Tl(e){let t=Qe(),o=Ue();return Ve("div",e,{className:"docx-content-control-menu-list","data-docx-part":"list",role:"listbox",id:t.listId,"aria-label":o(`contentControl.types.${t.kind}`)},t.kind==="buildingBlockGallery"&&t.items.length===0?jsxRuntime.jsx("div",{className:"docx-content-control-menu-empty","data-docx-part":"empty",role:"note",tabIndex:0,children:o("contentControl.gallery.empty")}):t.items.map((n,r)=>jsxRuntime.jsx(jd,{item:n},r)))}function Pl(e){let t=Qe(),o=Ue();return Ve("input",e,{type:"text",className:"docx-content-control-menu-input","data-docx-part":"input","aria-label":o(`contentControl.types.${t.kind}`),value:t.kind==="date"?t.dateText:t.value,placeholder:t.kind==="date"?editor.calendarDateText("2006-11-22",t.session.locale):void 0,"aria-invalid":t.refused||void 0,role:t.kind==="comboBox"?"combobox":void 0,"aria-expanded":t.kind==="comboBox"?true:void 0,"aria-controls":t.kind==="comboBox"?t.listId:void 0,"aria-autocomplete":t.kind==="comboBox"?"list":void 0,onKeyDown:n=>{n.key!=="Enter"||n.nativeEvent.isComposing||(n.preventDefault(),n.stopPropagation(),t.kind==="date"?t.applyDateText():t.apply());},onMouseDown:Cn,onChange:n=>(t.kind==="date"?t.setDateText:t.setValue)(n.target.value)},void 0)}function Tr(e){let t=Qe(),o=Ue();return t.refused?Ve("div",e,{className:"docx-content-control-widget-error","data-docx-part":"error",role:"alert"},o("disabledReason.invalidValue")):null}function Yd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-dialog__button docx-dialog__button--primary","data-docx-part":"apply",disabled:!t.isEnabled,onClick:()=>t.kind==="date"?t.applyDateText():t.apply()},o("common.apply"))}function Sl(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t.cancel},o("common.cancel"))}function El(e){return Ve("div",e,{className:"docx-dialog__footer","data-docx-part":"footer"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sl,{}),jsxRuntime.jsx(Yd,{})]}))}function Xd(e){return Ve("div",e,{className:"docx-content-control-calendar-navigation","data-docx-part":"navigation"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jd,{}),jsxRuntime.jsx(Qd,{})]}))}function Jd(e){let t=Qe(),o=Ue();return Ve("select",e,{className:"docx-content-control-calendar-month","data-docx-part":"month","aria-label":o("contentControl.calendar.month"),value:t.calendar.month,onChange:n=>t.showMonth(t.calendar.year,Number(n.target.value))},editor.calendarMonthNames(t.session.locale).map((n,r)=>jsxRuntime.jsx("option",{value:r,children:n},r)))}function Qd(e){let t=Qe(),o=Ue();return Ve("input",e,{type:"number",min:100,max:9999,className:"docx-content-control-calendar-year","data-docx-part":"year","aria-label":o("contentControl.calendar.year"),key:t.calendar.year,defaultValue:t.calendar.year,onBlur:n=>{let r=Number(n.target.value);if(!Number.isInteger(r)||r<100||r>9999){n.target.value=String(t.calendar.year);return}t.showMonth(r,t.calendar.month);},onKeyDown:n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&(n.preventDefault(),n.currentTarget.blur());}},void 0)}function eu({autoOpen:e,...t}){let o=Qe(),n=Ue(),r=Pt.useRef(null),i=Pt.useRef(false);return Pt.useLayoutEffect(()=>{e!==false&&!i.current&&(i.current=true,r.current?.click());},[e]),Ve("input",t,{ref:r,type:"file",accept:o.accept,className:"docx-content-control-picture-input","data-docx-part":"picture","aria-label":n("contentControl.types.picture"),"aria-invalid":o.refused||void 0,onMouseDown:Cn,onCancel:o.cancel,onChange:a=>{let s=a.target.files?.[0];a.target.value="",s&&o.replaceImage(s);}},void 0)}function IS(e){let[t,o]=Pt.useState(e.session),[n,r]=Pt.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(_S,{...e},n)}function _S({session:e,className:t,style:o,children:n}){let r=Ue(),i=pg(e),[a,s]=Pt.useState(e.signal.aborted),l=Pt.useRef(null),[c]=Pt.useState(()=>editor.contentControlPopupOpener(e.anchor)),d=e.kind==="checkbox"&&n===void 0;if(Pt.useEffect(()=>{let u=()=>s(true);return e.signal.addEventListener("abort",u,{once:true}),e.signal.aborted&&u(),()=>e.signal.removeEventListener("abort",u)},[e]),Pt.useEffect(()=>{!d||e.signal.aborted||e.apply(e.value==="true"?"false":"true");},[d,e]),Pt.useLayoutEffect(()=>{if(a||d)return;let u=l.current,g=u?.ownerDocument,m=u&&e.anchor?editor.observeContentControlPopup(u,e.anchor):void 0;return u?.querySelector('[data-docx-part="grid"]')||(u?.querySelector("input")??u?.querySelector('[role=option][tabindex="0"]')??u?.querySelector("select,button,[data-docx-part=empty]"))?.focus({preventScroll:true}),()=>{m?.();let p=g?.activeElement;c?.isConnected&&(p===g?.body||p&&u?.contains(p))&&c.focus({preventScroll:true});}},[e,a,d,c]),Pt.useEffect(()=>{let u=l.current;if(!u||a||d)return;let g=m=>{u.contains(m.target)||e.cancel();};return u.ownerDocument.addEventListener("pointerdown",g,true),()=>u.ownerDocument.removeEventListener("pointerdown",g,true)},[e,a,d]),a||d)return null;let f=r(`contentControl.types.${e.kind}`);return jsxRuntime.jsx(ug,{value:i,children:jsxRuntime.jsx("div",{ref:l,role:"dialog","aria-label":f,className:`docx-content-control-widget-popup${t?` ${t}`:""}`,style:o,"data-docx-popup":"contentControlWidget","data-docx-part":"popup","data-kind":e.kind,onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{editor.contentControlPopupKeyDown(u.currentTarget,u.nativeEvent,e.cancel),i.listNavigation.keyDown(u.nativeEvent,u.currentTarget);},children:n??NS(i)})})}function NS(e){return e.kind==="date"?jsxRuntime.jsx(Gd,{}):e.kind==="picture"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eu,{}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(Sl,{})]}):e.kind==="comboBox"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pl,{}),jsxRuntime.jsx(Tl,{}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(El,{})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tl,{}),jsxRuntime.jsx(Tr,{})]})}var ru=Object.assign(IS,{Navigation:Xd,Month:Jd,Year:Qd,Calendar:Gd,Header:Zd,PreviousMonth:qd,Title:Wd,NextMonth:Kd,Weekdays:zd,Grid:Ud,Day:$d,Today:Vd,List:Tl,Item:jd,Input:Pl,Picture:eu,Error:Tr,Footer:El,Apply:Yd,Cancel:Sl});var eo=Do();function FS(){return eo.useState()}function HS({session:e,...t}){let[o,n]=Pt.useState(e),[r,i]=Pt.useState(0);return o!==e&&(n(e),i(r+1)),e?jsxRuntime.jsx(AS,{session:e,...t},r):null}function AS({session:e,children:t,preset:o,className:n,style:r}){let i=Ue(),a=O(()=>e.canApply()),[s,l]=Pt.useState(()=>({defaultText:e.field.defaultText,type:e.field.type,maxLength:e.field.maxLength,format:e.field.format,enabled:e.field.enabled})),[c,d]=Pt.useState(e.signal.aborted),[f,u]=Pt.useState(false);Pt.useEffect(()=>{let x=()=>d(true);return e.signal.addEventListener("abort",x),e.signal.aborted&&x(),()=>e.signal.removeEventListener("abort",x)},[e]);let g=()=>{if(e.signal.aborted)return;let x=Number.isInteger(s.maxLength)&&s.maxLength>=0&&s.maxLength<=32767&&e.apply(s.defaultText,{type:s.type,maxLength:s.maxLength,format:s.format,enabled:s.enabled});u(!x);},m={values:s,setValue(x,h){l(b=>({...b,[x]:h,...x==="type"?{format:""}:{}})),u(false);},errors:f?{form:i("textFormField.invalidOptions")}:{},isEnabled:!c&&a,apply:g,cancel:e.cancel};if(c)return null;let p=editor.TEXT_FORM_FORMATS[s.type]??[],v={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"},y=(x,h)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":x,className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label",children:i(`textFormField.${x}`)}),h]});return jsxRuntime.jsx(pt,{kind:"textFormField",className:n,style:r,label:i("textFormField.title"),onClose:e.cancel,dismissOutside:false,sessionSignal:e.signal,restoreFocus:false,onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),e.cancel()),x.key==="Enter"&&x.target instanceof HTMLInputElement&&(x.preventDefault(),g());},children:jsxRuntime.jsx(eo.Composition,{state:m,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:i("textFormField.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[y("defaultText",jsxRuntime.jsx("input",{className:"docx-dialog__input",value:s.defaultText,onChange:x=>m.setValue("defaultText",x.target.value)})),y("type",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:s.type,onChange:x=>m.setValue("type",x.target.value),children:[["regular","number","date"].map(x=>jsxRuntime.jsx("option",{value:x,children:i(`textFormField.${x}`)},x)),Object.hasOwn(editor.TEXT_FORM_FORMATS,s.type)?null:jsxRuntime.jsx("option",{value:s.type,disabled:true,children:i("textFormField.preservedType")})]})),y("maxLength",jsxRuntime.jsx("input",{className:"docx-dialog__input",type:"number",min:0,max:32767,step:1,value:Number.isNaN(s.maxLength)?"":s.maxLength,onChange:x=>m.setValue("maxLength",x.target.valueAsNumber)})),y("format",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:s.format,onChange:x=>m.setValue("format",x.target.value),children:[p.map(x=>jsxRuntime.jsx("option",{value:x,children:v[x]?i(v[x]):x||i("textFormField.noFormat")},x)),p.includes(s.format)?null:jsxRuntime.jsx("option",{value:s.format,disabled:true,children:s.format||i("textFormField.noFormat")})]})),jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":"enabled",className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:s.enabled,onChange:x=>m.setValue("enabled",x.target.checked)}),i("textFormField.enabled")]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",className:"docx-dialog__error",role:"alert",children:m.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",className:"docx-dialog__button",type:"button",onClick:e.cancel,children:i("textFormField.cancel")}),jsxRuntime.jsx("button",{disabled:!a,"data-docx-part":"apply",className:"docx-dialog__button docx-dialog__apply",type:"button",onClick:g,children:i("textFormField.apply")})]})]}),children:t})})}var Ma=Object.assign(HS,{Header:eo.Header,Title:eo.Title,Body:eo.Body,Footer:eo.Footer,Apply:eo.Apply,Cancel:eo.Cancel,Error:eo.Error,Field:eo.Field});var gg="(prefers-color-scheme: dark)";function hg(){return typeof window<"u"&&typeof window.matchMedia=="function"}function bg(){return hg()?window.matchMedia(gg).matches:false}function vg(e,t){return e==="dark"||e==="system"&&t}function yg(e){if(!hg())return ()=>{};let t=window.matchMedia(gg);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}function iu(e){return e==="checkbox"?"contentControlCheckbox":e==="picture"?"contentControlPicture":"contentControlWidget"}function Cg(){let e=F(),t=Zt(),o=Pt.useRef(t);o.current=t;let[n,r]=Pt.useState(null),[i,a]=Pt.useState(null),s=t?.contentControlWidget!==void 0,l=t?.contentControlCheckbox!==void 0,c=t?.contentControlPicture!==void 0,d=t?.invalidTextFormField!==void 0;Pt.useEffect(()=>{if(!e||!s&&!l&&!c)return;let u=true,g=[...s?["dropdown","comboBox","date","buildingBlockGallery"]:[],...l?["checkbox"]:[],...c?["picture"]:[]],m=e.setContentControlWidgetChrome({kinds:g,onRequest(p){if(o.current?.[iu(p.kind)]===false)return p.cancel();r(p),p.signal.addEventListener("abort",()=>{u&&r(v=>v===p?null:v);},{once:true});}},{fallback:true});return ()=>{u=false,m(),r(null);}},[e,s,l,c]),Pt.useEffect(()=>{if(!e||!d)return;let u=true,g=e.setInvalidTextFormFieldChrome({onRequest(m){if(o.current?.invalidTextFormField===false)return m.cancel();a(m),m.signal.addEventListener("abort",()=>{u&&a(p=>p===m?null:p);},{once:true});}},{fallback:true});return ()=>{u=false,g(),a(null);}},[e,d]),Pt.useEffect(()=>{n&&t?.[iu(n.kind)]===false&&n.cancel(),t?.invalidTextFormField===false&&i?.cancel();},[t,n,i]);let f=n?t?.[iu(n.kind)]:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n&&f&&De(f,{session:n},n),i&&t?.invalidTextFormField&&De(t.invalidTextFormField,{session:i},i)]})}var WS=e=>e.pageSetup??null,zS=e=>e.editable;function Pn(){let e=F(),t=O(WS),o=O(zS),n=Pt.useMemo(()=>o&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,o]),r=Pt.useCallback(i=>e?e.exec({...i.pageWidthTwips!==void 0?{pageWidth:i.pageWidthTwips}:{},...i.pageHeightTwips!==void 0?{pageHeight:i.pageHeightTwips}:{},...i.orientation!==void 0?{orientation:i.orientation}:{},...i.marginTopTwips!==void 0?{marginTop:i.marginTopTwips}:{},...i.marginRightTwips!==void 0?{marginRight:i.marginRightTwips}:{},...i.marginBottomTwips!==void 0?{marginBottom:i.marginBottomTwips}:{},...i.marginLeftTwips!==void 0?{marginLeft:i.marginLeftTwips}:{},...i.scope!==void 0?{scope:i.scope}:{},type:"setPageSetup"}).ok:false,[e]);return Pt.useMemo(()=>({pageSetup:t,isEnabled:n,apply:r}),[t,n,r])}var su=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}],wg=1440,US=e=>Math.round(e/wg*100)/100,VS=e=>Math.round(e*wg);function GS(e,t){let o=Math.min(e,t),n=Math.max(e,t);return su.findIndex(r=>Math.abs(r.width-o)<20&&Math.abs(r.height-n)<20)}var Sg=12240,Eg=15840,Bo=1440;function jS({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),s=Ai(e,t),{pageSetup:l,isEnabled:c,apply:d}=Pn(),[f,u]=Pt.useState(Sg),[g,m]=Pt.useState(Eg),[p,v]=Pt.useState("portrait"),[y,x]=Pt.useState(Bo),[h,b]=Pt.useState(Bo),[S,C]=Pt.useState(Bo),[P,T]=Pt.useState(Bo),[R,M]=Pt.useState(false),[E,_]=Pt.useState("document"),H=Pt.useRef(null),L=Pt.useRef("no");Pt.useEffect(()=>{if(!e){L.current="no";return}if(L.current==="yes"&&l===null){L.current="no";return}L.current==="yes"||L.current==="loading"&&l===null||(M(false),u(l?.pageWidthTwips??Sg),m(l?.pageHeightTwips??Eg),v(l?.orientation??"portrait"),x(l?.marginsTwips.top??Bo),b(l?.marginsTwips.bottom??Bo),C(l?.marginsTwips.left??Bo),T(l?.marginsTwips.right??Bo),_("document"),L.current=l===null?"loading":"yes");},[e,l]);let k=Pt.useCallback(U=>{let ce=su[U];ce&&(u(p==="landscape"?ce.height:ce.width),m(p==="landscape"?ce.width:ce.height));},[p]),w=Pt.useCallback(U=>{U!==p&&(v(U),u(g),m(f));},[p,f,g]),I=Pt.useCallback(()=>{if(!c)return;if(!s()){t();return}let U=d({pageWidthTwips:f,pageHeightTwips:g,orientation:p,marginTopTwips:y,marginRightTwips:P,marginBottomTwips:h,marginLeftTwips:S,scope:E});M(!U),U&&t();},[c,s,d,f,g,p,y,P,h,S,E,t]);if(!e)return null;let $=GS(f,g),W=(U,ce,pe)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":`margin${U[0].toUpperCase()}${U.slice(1)}`,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a(`dialogs.pageSetup.${U}`)}),jsxRuntime.jsx("input",{type:"number",className:"docx-dialog__input",min:0,max:22,step:.1,value:US(ce),onChange:K=>pe(Math.max(0,VS(Number(K.target.value)||0))),"aria-label":a(`dialogs.pageSetup.${U}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:"in"})]}),ee={pageWidth:f,pageHeight:g,orientation:p,marginTop:y,marginBottom:h,marginLeft:S,marginRight:P,scope:E},V={pageWidth:u,pageHeight:m,orientation:w,marginTop:x,marginBottom:b,marginLeft:C,marginRight:T,scope:_},se={values:ee,setValue(U,ce){V[U](ce);},errors:R?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:I,cancel:t};return jsxRuntime.jsx(pt,{kind:"pageSetup",className:o,style:n,panelRef:H,label:a("dialogs.pageSetup.title"),onClose:t,onKeyDown:U=>{U.key==="Escape"&&t(),U.key==="Enter"&&U.target instanceof HTMLInputElement&&c&&(U.preventDefault(),I());},children:jsxRuntime.jsx(oo.Composition,{state:se,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.pageSetup.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"pageSize",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:$,onChange:U=>k(Number(U.target.value)),"aria-label":a("dialogs.pageSetup.sizeLabel"),children:[su.map((U,ce)=>jsxRuntime.jsx("option",{value:ce,children:a(U.labelKey)},U.labelKey)),$<0&&jsxRuntime.jsx("option",{value:-1,children:a("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"orientation",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:p,onChange:U=>w(U.target.value),"aria-label":a("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:a("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:a("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label docx-dialog__section-label--spaced",children:a("dialogs.pageSetup.margins")}),W("top",y,x),W("bottom",h,b),W("left",S,C),W("right",P,T),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"scope",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:E,onChange:U=>_(U.target.value),"aria-label":a("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:a("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:a("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",className:"docx-dialog__error",children:R?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:I,children:a("common.apply")})]})]}),children:r})})}var oo=Do();function YS(){return oo.useState()}var Sn=Object.assign(jS,{Header:oo.Header,Title:oo.Title,Body:oo.Body,Footer:oo.Footer,Apply:oo.Apply,Cancel:oo.Cancel,Error:oo.Error,Field:oo.Field});var eE={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},tE=e=>{let t=e.formatting??null;if(!t)return null;let o=t.indent,n=t.paragraphFlags??eE;return {alignment:t.alignment==="both"?"justify":t.alignment??null,direction:t.direction??null,spaceBeforePt:t.spaceBeforePt??null,spaceAfterPt:t.spaceAfterPt??null,lineSpacing:t.lineSpacing??null,indentLeftTwips:o&&!o.mixed.left?o.left:null,indentRightTwips:o&&!o.mixed.right?o.right:null,indentFirstLineTwips:o&&!o.mixed.firstLine?o.firstLine:null,contextualSpacing:n.contextualSpacing,keepNext:n.keepNext,keepLines:n.keepLines,widowControl:n.widowControl,pageBreakBefore:n.pageBreakBefore,tabStops:t.tabStops??null,indentUnknown:!o,disagrees:{alignment:t.disagrees?.alignment??false,direction:t.disagrees?.direction??false,spaceBeforePt:t.disagrees?.spaceBeforePt??false,spaceAfterPt:t.disagrees?.spaceAfterPt??false,lineSpacing:t.disagrees?.lineSpacing??false,tabStops:t.disagrees?.tabStops??false,indentLeft:o?.mixed.left??false,indentRight:o?.mixed.right??false,indentFirstLine:o?.mixed.firstLine??false}}},oE=["alignment","direction","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],nE=(e,t)=>oE.every(o=>e.disagrees[o]===t.disagrees[o]),rE=(e,t)=>e===null||t===null?e===t:e.alignment===t.alignment&&e.direction===t.direction&&e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value&&e.indentLeftTwips===t.indentLeftTwips&&e.indentRightTwips===t.indentRightTwips&&e.indentFirstLineTwips===t.indentFirstLineTwips&&e.contextualSpacing===t.contextualSpacing&&e.keepNext===t.keepNext&&e.keepLines===t.keepLines&&e.widowControl===t.widowControl&&e.pageBreakBefore===t.pageBreakBefore&&nE(e,t)&&e.indentUnknown===t.indentUnknown&&e.tabStops?.length===t.tabStops?.length&&(e.tabStops??[]).every((o,n)=>o.positionTwips===t.tabStops?.[n]?.positionTwips&&o.alignment===t.tabStops?.[n]?.alignment&&(o.leader??"none")===(t.tabStops?.[n]?.leader??"none")),aE=e=>e.editable;function cu(){let e=F(),t=O(tE,rE),o=O(aE),n=Pt.useMemo(()=>o&&e!==null&&e.can({type:"setParagraphFormat",alignment:"left"}).ok,[e,o]),r=Pt.useCallback(i=>{if(!e)return false;let a={type:"setParagraphFormat",...i};return e.can(a).ok?e.exec(a).ok:false},[e]);return {format:t,isEnabled:n,apply:r}}function sE({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),s=Ai(e,t),{format:l,isEnabled:c,apply:d}=cu(),[f,u]=Pt.useState("left"),[g,m]=Pt.useState("ltr"),[p,v]=Pt.useState(0),[y,x]=Pt.useState(0),[h,b]=Pt.useState("none"),[S,C]=Pt.useState(0),[P,T]=Pt.useState(0),[R,M]=Pt.useState(0),[E,_]=Pt.useState("multiple"),[H,L]=Pt.useState(1.08),[k,w]=Pt.useState(false),[I,$]=Pt.useState(false),[W,ee]=Pt.useState(false),[V,se]=Pt.useState(true),[U,ce]=Pt.useState(false),[pe,K]=Pt.useState([]),[Z,be]=Pt.useState(false),[Re,ue]=Pt.useState(0),[ze,_t]=Pt.useState("left"),[Je,ut]=Pt.useState("none"),[Pe,co]=Pt.useState(editor.NO_MIXED_FIELDS),[uo,po]=Pt.useState(false),Mo=q=>a(uo&&(q==="indentLeft"||q==="indentRight"||q==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),Gt=Pt.useRef(editor.NO_MIXED_FIELDS),oe=Pt.useId(),[fe,yt]=Pt.useState(false),zn=Pt.useRef(null),ne=Pt.useRef(false),te=Pt.useRef(null);Pt.useEffect(()=>{if(!e){ne.current=false;return}if(ne.current||l===null)return;let q=editor.seedFields(l);u(q.alignment),m(q.direction),v(q.indentLeft),x(q.indentRight),b(q.special),C(q.specialBy),T(q.spaceBefore),M(q.spaceAfter),_(q.lineRule),L(q.lineValue),w(q.contextualSpacing),$(q.keepNext),ee(q.keepLines),se(q.widowControl),ce(q.pageBreakBefore),K(q.tabStops),be(false);let he=editor.mixedFieldsOf(l);co(he),po(l.indentUnknown),ue(0),_t("left"),ut("none"),Gt.current=he,yt(false),te.current=q,ne.current=true;},[e,l]);let ve=Pt.useCallback(()=>{if(!c)return;if(!s()){t();return}let q=te.current,he=q===null?null:editor.changedFields(q,{alignment:f,direction:g,indentLeft:p,indentRight:y,special:h,specialBy:S,spaceBefore:P,spaceAfter:R,lineRule:E,lineValue:H,contextualSpacing:k,keepNext:I,keepLines:W,widowControl:V,pageBreakBefore:U,tabStops:pe,clearedAllTabStops:Z},Gt.current,Pe);if(he===null){t();return}if(d(he)){yt(false),t();return}yt(true);},[c,s,d,t,Pe,Z,f,g,p,y,h,S,P,R,E,H,k,I,W,V,U,pe]),$e=Pt.useCallback(()=>{let q=Math.round(Re);return q<=0?false:(co(he=>({...he,tabStops:false})),K(editor.withTabStop(pe,{positionTwips:q,alignment:ze,...Je!=="none"?{leader:Je}:{}})),ue(0),_t("left"),ut("none"),true)},[pe,Re,ze,Je]);if(!e)return null;let Ze=q=>co(he=>({...he,[q]:false})),mo=(q,he,Ro,rt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":rt,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-${q}`,children:a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${oe}-${q}`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Pe[rt]?"":editor.twipsToInches(he),placeholder:Pe[rt]?Mo(rt):void 0,onChange:zr=>{Ze(rt),Ro(editor.inchesToTwips(Number(zr.target.value)||0));},"aria-label":a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),$n=(q,he,Ro,rt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":q,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-${q}`,children:a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${oe}-${q}`,type:"number",className:"docx-dialog__input",min:0,step:1,value:Pe[rt]?"":he,placeholder:Pe[rt]?Mo(rt):void 0,onChange:zr=>{Ze(rt),Ro(Math.max(0,Number(zr.target.value)||0));},"aria-label":a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitPoints")})]}),Wr=(q,he,Ro)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":q,className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:he,ref:rt=>{rt&&(rt.indeterminate=Pe[q]);},onChange:rt=>{co(zr=>({...zr,[q]:false})),Ro(rt.target.checked);}}),a(`dialogs.paragraph.${q}`)]}),Ky={alignment:f,direction:g,indentLeft:p,indentRight:y,special:h,specialBy:S,spaceBefore:P,spaceAfter:R,lineRule:E,lineValue:H,contextualSpacing:k,keepNext:I,keepLines:W,widowControl:V,pageBreakBefore:U,tabStops:pe,clearedAllTabStops:Z},mm=q=>{let he=Gt.current;q!==g&&!he.direction&&!he.alignment&&u(editor.alignmentAfterDirectionChange),m(q);},Wy={alignment:u,direction:mm,indentLeft:v,indentRight:x,special:b,specialBy:C,spaceBefore:T,spaceAfter:M,lineRule:_,lineValue:L,contextualSpacing:w,keepNext:$,keepLines:ee,widowControl:se,pageBreakBefore:ce,tabStops:K,clearedAllTabStops:be},zy={values:Ky,mixed:Pe,setValue(q,he){Wy[q](he),q==="lineRule"?(Ze("lineSpacing"),L(he===te.current?.lineRule?te.current.lineValue:he==="multiple"?1.08:12)):q==="specialBy"?Ze("special"):q in Pe&&Ze(q);},errors:fe?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:ve,cancel:t};return jsxRuntime.jsx(pt,{kind:"paragraph",className:o,style:n,panelRef:zn,label:a("dialogs.paragraph.title"),onClose:t,onKeyDown:q=>{q.key==="Escape"&&t();let he=q.target instanceof HTMLButtonElement||q.target instanceof HTMLSelectElement;if(q.key==="Enter"&&!he){let Ro=q.target;if(Ro instanceof HTMLElement&&Ro.dataset.docxTabEntry!==void 0){$e();return}c&&ve();}},children:jsxRuntime.jsx(no.Composition,{state:zy,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.paragraph.title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-dialog__body",children:jsxRuntime.jsxs("div",{className:"docx-dialog__columns",children:[jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"alignment",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-alignment`,children:a("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${oe}-alignment`,className:"docx-dialog__input",value:Pe.alignment?"":f,onChange:q=>{Ze("alignment"),u(q.target.value);},"aria-label":a("dialogs.paragraph.alignment"),children:[Pe.alignment?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.alignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.alignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.alignRight")}),jsxRuntime.jsx("option",{value:"justify",children:a("dialogs.paragraph.alignJustify")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"direction",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-direction`,children:a("dialogs.paragraph.direction")}),jsxRuntime.jsxs("select",{id:`${oe}-direction`,className:"docx-dialog__input",value:Pe.direction?"":g,onChange:q=>{Ze("direction"),mm(q.target.value);},"aria-label":a("dialogs.paragraph.direction"),children:[Pe.direction?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"rtl",children:a("dialogs.paragraph.directionRtl")}),jsxRuntime.jsx("option",{value:"ltr",children:a("dialogs.paragraph.directionLtr")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.indentation")}),mo("beforeText",p,v,"indentLeft"),mo("afterText",y,x,"indentRight"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"special",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-special`,children:a("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${oe}-special`,className:"docx-dialog__input",value:Pe.special?"":h,onChange:q=>{Ze("special"),b(q.target.value);},"aria-label":a("dialogs.paragraph.special"),children:[Pe.special?jsxRuntime.jsx("option",{value:"",children:Mo("special")}):null,jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.specialNone")}),jsxRuntime.jsx("option",{value:"firstLine",children:a("dialogs.paragraph.specialFirstLine")}),jsxRuntime.jsx("option",{value:"hanging",children:a("dialogs.paragraph.specialHanging")})]})]}),h!=="none"?jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"specialBy",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-by`,children:a("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${oe}-by`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Pe.special?"":editor.twipsToInches(S),placeholder:Pe.special?Mo("special"):void 0,onChange:q=>{Ze("special"),C(Math.max(0,editor.inchesToTwips(Number(q.target.value)||0)));},"aria-label":a("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"tabStops",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.tabStops")}),pe.length===0?jsxRuntime.jsx("div",{className:"docx-dialog__note",children:a(Pe.tabStops?"dialogs.paragraph.tabMixed":"dialogs.paragraph.tabEmpty")}):pe.map(q=>jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label docx-dialog__tab-position",children:a("dialogs.paragraph.tabPositionLabel",{position:editor.formatInches(q.positionTwips)})}),jsxRuntime.jsx("span",{className:"docx-dialog__tab-description",children:a(editor.TAB_ALIGNMENT_LABELS[q.alignment])}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>K(pe.filter(he=>he!==q)),"aria-label":a("dialogs.paragraph.tabRemoveAt",{position:editor.formatInches(q.positionTwips)}),children:a("dialogs.paragraph.tabRemove")})]},q.positionTwips)),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-tabPosition`,children:a("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${oe}-tabPosition`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:editor.twipsToInches(Re),onChange:q=>ue(Math.max(0,editor.inchesToTwips(Number(q.target.value)||0))),"aria-label":a("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-tabAlignment`,children:a("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${oe}-tabAlignment`,className:"docx-dialog__input",value:ze,onChange:q=>_t(q.target.value),"aria-label":a("dialogs.paragraph.tabAlignment"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.tabAlignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.tabAlignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.tabAlignRight")}),jsxRuntime.jsx("option",{value:"decimal",children:a("dialogs.paragraph.tabAlignDecimal")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-tabLeader`,children:a("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${oe}-tabLeader`,className:"docx-dialog__input",value:Je,onChange:q=>ut(q.target.value),"aria-label":a("dialogs.paragraph.tabLeader"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.tabNone")}),jsxRuntime.jsx("option",{value:"dot",children:a("dialogs.paragraph.tabLeaderDot")}),jsxRuntime.jsx("option",{value:"hyphen",children:a("dialogs.paragraph.tabLeaderHyphen")}),jsxRuntime.jsx("option",{value:"underscore",children:a("dialogs.paragraph.tabLeaderUnderscore")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row docx-dialog__row--actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:$e,children:a("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>{co(q=>({...q,tabStops:false})),be(true),K([]);},children:a("dialogs.paragraph.tabClearAll")})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.spacing")}),$n("spaceBefore",P,T,"spaceBefore"),$n("spaceAfter",R,M,"spaceAfter"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineRule",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-lineSpacing`,children:a("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${oe}-lineSpacing`,className:"docx-dialog__input",value:Pe.lineSpacing?"":E,onChange:q=>{let he=q.target.value;Ze("lineSpacing"),_(he),L(he===te.current?.lineRule?te.current.lineValue:he==="multiple"?1.08:12);},"aria-label":a("dialogs.paragraph.lineSpacing"),children:[Pe.lineSpacing?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"multiple",children:a("dialogs.paragraph.ruleMultiple")}),jsxRuntime.jsx("option",{value:"atLeast",children:a("dialogs.paragraph.ruleAtLeast")}),jsxRuntime.jsx("option",{value:"exact",children:a("dialogs.paragraph.ruleExactly")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineValue",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-at`,children:a("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${oe}-at`,type:"number",className:"docx-dialog__input",min:.01,step:E==="multiple"?.01:1,value:Pe.lineSpacing?"":H,disabled:Pe.lineSpacing,onChange:q=>{let he=q.target.value.trim();L(he===""?E==="multiple"?1.08:12:Number(he)||0);},"aria-label":a("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:E==="multiple"?"":a("dialogs.paragraph.unitPoints")})]}),Wr("contextualSpacing",k,w),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.pagination")}),Wr("keepNext",I,$),Wr("widowControl",V,se),Wr("keepLines",W,ee),Wr("pageBreakBefore",U,ce)]})]})}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{role:"alert","data-docx-part":"error",className:"docx-dialog__error",children:fe?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:ve,children:a("dialogs.paragraph.ok")})]})]}),children:r})})}var no=Do();function cE(){return no.useState()}var yo=Object.assign(sE,{Header:no.Header,Title:no.Title,Body:no.Body,Footer:no.Footer,Apply:no.Apply,Cancel:no.Cancel,Error:no.Error,Field:no.Field});var Fg=Pt.createContext(null),Pr=()=>Pt.useContext(Fg);function Hg({popups:e,children:t}){let o=F(),n=Cc(),[r,i]=Pt.useState(null),[a,s]=Pt.useState(null),[l,c]=Pt.useState(null),[d,f]=Pt.useState(null),u=Pt.useRef(d);u.current=d;let g=Pt.useRef(e);g.current=e;let m=Pt.useRef(null),p=Pt.useRef(l);p.current=l;let v=()=>s(null);Pt.useEffect(()=>{if(a!==null)return;let b=m.current;m.current=null,b?.isConnected&&b.focus({preventScroll:true});},[a]),Pt.useEffect(()=>{if(o)return o.setTextFormFieldChrome({onRequest(b){if(g.current?.textFormField===false){b.cancel();return}u.current?.cancel(),s(null),c(b),b.signal.addEventListener("abort",()=>c(S=>S===b?null:S),{once:true});}},{fallback:true})},[o]),Pt.useEffect(()=>{if(!o||!r&&e?.revisionMarkup!==false)return;let b=o.setRevisionMarkupChrome({onRequest(S){if(g.current?.revisionMarkup===false){S.cancel();return}p.current?.cancel(),s(null),f(S),S.signal.addEventListener("abort",()=>f(C=>C===S?null:C),{once:true});}},{fallback:true});return ()=>{u.current?.cancel(),b();}},[o,r,e?.revisionMarkup===false]),Pt.useEffect(()=>{s(null),c(null),f(null);},[o,n]),Pt.useEffect(()=>{e?.revisionMarkup===false&&u.current?.cancel(),e?.textFormField===false&&p.current?.cancel(),a&&e?.[a]===false&&s(null);},[e,a]);let y=Pt.useMemo(()=>({container:r,setContainer:i,ownsPageSetup:e?.pageSetup!==void 0,open(b,S){p.current?.cancel(),u.current?.cancel(),g.current?.[b]!==false&&(m.current=S??r?.ownerDocument.activeElement,s(b));}}),[r,e?.pageSetup]),x={open:true,onClose:v},h=a==="pageSetup"&&e?.pageSetup!==false?e?.pageSetup?De(e.pageSetup,x):jsxRuntime.jsx(Sn,{...x}):a==="paragraph"&&e?.paragraph!==false?e?.paragraph?De(e.paragraph,x):jsxRuntime.jsx(yo,{...x}):d&&e?.revisionMarkup!==false?e?.revisionMarkup?De(e.revisionMarkup,{session:d},d):jsxRuntime.jsx(Ur,{session:d}):l&&e?.textFormField!==false?e?.textFormField?De(e.textFormField,{session:l},l):jsxRuntime.jsx(Ma,{session:l}):null;return jsxRuntime.jsxs(Fg.Provider,{value:y,children:[t,r?reactDom.createPortal(h,r):null]})}function Ag(){let e=Pr();return jsxRuntime.jsx("div",{className:"docx-dialog-mount",ref:e?.setContainer})}function Og({children:e}){let t=Pr();return t?.container?reactDom.createPortal(e,t.container):e}var wE=["nw","n","ne","e","se","s","sw","w"],Kg=40,Wg=12;function ME(e){return `imageOverlay.handle.${e}`}function RE(e){switch(e){case "nw":case "se":return "nwse-resize";case "ne":case "sw":return "nesw-resize";case "n":case "s":return "ns-resize";default:return "ew-resize"}}function DE(e){return {nw:{x:"0%",y:"0%"},n:{x:"50%",y:"0%"},ne:{x:"100%",y:"0%"},e:{x:"100%",y:"50%"},se:{x:"100%",y:"100%"},s:{x:"50%",y:"100%"},sw:{x:"0%",y:"100%"},w:{x:"0%",y:"50%"}}[e]}function kE(e,t){return e>0&&t>0?"se":e>0&&t<0?"ne":e<0&&t>0?"sw":e<0&&t<0?"nw":e>0?"e":e<0?"w":t>0?"s":"n"}function mu({containerRef:e,portalRef:t,scrollPort:o}){let n=F(),{t:r}=N(),[i,a]=Pt.useState(null),[s,l]=Pt.useState(null),[c,d]=Pt.useState({left:0,top:0}),f=Pt.useRef(null);f.current=s;let u=Pt.useRef(null),g=Pt.useRef(null),m=Pt.useRef(null),p=Pt.useRef(null),v=Pt.useRef(null);Pt.useEffect(()=>{let T=e.current;if(!T)return;let R=M=>{let E=M.target instanceof Element?M.target:null;if(E?.closest(".docx-drawing-textbox-content")){p.current=null;return}let _=E?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");p.current=_??null,_&&_===i?.id&&queueMicrotask(()=>m.current?.focus({preventScroll:true}));};return T.addEventListener("pointerdown",R,{capture:true}),()=>T.removeEventListener("pointerdown",R,{capture:true})},[e,i?.id]),Pt.useEffect(()=>{if(!n){a(null);return}let T=()=>{a(editor.selectedDrawingOverlayTargetOf(n.surface));},R=()=>{queueMicrotask(T);};T();let M=[n.on("change",R),n.on("selectionChange",T)];return ()=>{for(let E of M)E();}},[n]);let y=Pt.useCallback(()=>{d(T=>{let R=editor.overlayHostOrigin(e.current);return R.left===T.left&&R.top===T.top?T:R});},[e]);Pt.useEffect(()=>{y();let T=t.current;if(!T||typeof ResizeObserver!="function")return;let R=new ResizeObserver(y);R.observe(T);let M=e.current;return M&&R.observe(M),()=>R.disconnect()},[e,t,y,i]),Pt.useEffect(()=>{if(o){v.current=o;return}let T=e.current;if(!T||!n?.surface)return;let R=T.closest(".docx-editor__scroll-container");if(!R)return;let M=n.surface.overlayCoordinates();return v.current=editor.createImageOverlayScrollPort(R,M.paintScale),()=>{v.current=null;}},[e,n,o]);let x=Pt.useCallback(()=>{l(null),u.current=null;let T=g.current;if(g.current=null,T)try{T.releasePointerCapture(T._lastPointerId??0);}catch{}},[]),h=Pt.useCallback((T,R,M,E,_,H,L)=>{if(!n?.surface)return;let k=n.surface.activeScope();if(k.kind==="frame"&&!n.surface.selectDrawing(M.id,k.hostParagraphId))return;let w=n.surface.layout(),I=editor.captureImageMutationPreconditions(n);if(I){u.current=Object.freeze({x:E,y:_}),g.current=H,H._lastPointerId=L;try{H.setPointerCapture(L);}catch{}l({session:Object.freeze({drawingNodeId:M.id,startBounds:Object.freeze({x:M.x,y:M.y,width:M.width,height:M.height}),startWidthEmu:M.widthEmu,startHeightEmu:M.heightEmu,startPosition:M.position,anchorFrameOrigin:M.anchorFrameOrigin,transform:M.transform,mode:T,handle:R,preconditions:I,layoutRevision:w.revision,packageRevision:n.surface.session.packageRevision(),kind:M.kind}),bounds:M,accumulatedScrollPt:0}),m.current?.focus({preventScroll:true});}},[n]),b=Pt.useCallback((T,R,M,E,_)=>{if(!n)return;if(editor.isStaleImageInteractionCommit(n,T)){x();return}T.mode==="resize"?n.exec({type:"setImageProperties",widthEmu:R,heightEmu:M,..._?.mode==="simple"?{horizontalEmu:_.horizontalEmu,verticalEmu:_.verticalEmu}:{},..._?.mode==="frame"?{..._.horizontalEmu!==void 0?{horizontalEmu:_.horizontalEmu}:{},..._.verticalEmu!==void 0?{verticalEmu:_.verticalEmu}:{}}:{}}):T.mode==="move"&&_&&n.exec({type:"setImagePosition",..._}),x();},[x,n]),S=Pt.useCallback(T=>{if(!n)return;let R=f.current?.bounds??editor.selectedDrawingOverlayTargetOf(n.surface);if(!R)return;if(f.current&&T.key==="Escape"){T.preventDefault(),T.stopPropagation(),x();return}if(f.current)return;let M=T.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(T.key==="Delete"||T.key==="Backspace"){T.preventDefault(),T.stopPropagation(),n.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(T.key))return;T.preventDefault(),T.stopPropagation();let E=T.key==="ArrowLeft"?-M:T.key==="ArrowRight"?M:0,_=T.key==="ArrowUp"?-M:T.key==="ArrowDown"?M:0;if(T.altKey){if(!R.canResize)return;let L=kE(E,_),k=editor.computeImageResizeResult({handle:L,startWidthEmu:R.widthEmu,startHeightEmu:R.heightEmu,startBounds:{x:R.x,y:R.y,width:R.width,height:R.height},startPosition:R.position,anchorFrameOrigin:R.anchorFrameOrigin,deltaXPt:E,deltaYPt:_,transform:R.transform,preserveAspect:editor.resizePreservesAspect(L,R.aspectLocked,T.shiftKey,R.textbox),kind:R.kind});n.exec({type:"setImageProperties",widthEmu:k.widthEmu,heightEmu:k.heightEmu,...k.position?.mode==="simple"?{horizontalEmu:k.position.horizontalEmu,verticalEmu:k.position.verticalEmu}:{},...k.position?.mode==="frame"?{...k.position.horizontalEmu!==void 0?{horizontalEmu:k.position.horizontalEmu}:{},...k.position.verticalEmu!==void 0?{verticalEmu:k.position.verticalEmu}:{}}:{}});return}if(R.kind!=="anchored"||!R.canMove||!R.position)return;let H=editor.computeMovedImagePosition(R.position,E,_);n.exec({type:"setImagePosition",...H});},[x,n]);Pt.useEffect(()=>{if(!s||!n?.surface)return;let T=n.surface.overlayCoordinates(),R=E=>{let _=f.current,H=u.current;if(!_||!H)return;let L=editor.cssPixelsToLayoutPoints(E.clientX-H.x,T.paintScale),k=editor.cssPixelsToLayoutPoints(E.clientY-H.y,T.paintScale);if(_.session.mode==="move"){let I=0,$=v.current,W=e.current?.closest(".docx-editor__scroll-container");if($&&W){let V=W.getBoundingClientRect();E.clientY>V.bottom-Kg?I=Wg:E.clientY<V.top+Kg&&(I=-Wg),I!==0&&(I=$.scrollBy(I));}let ee=_.accumulatedScrollPt+I;l({..._,accumulatedScrollPt:ee,bounds:Object.freeze({..._.bounds,x:_.session.startBounds.x+L,y:_.session.startBounds.y+k+ee})});return}if(!_.session.handle)return;let w=editor.computeImageResizeResult({handle:_.session.handle,startWidthEmu:_.session.startWidthEmu,startHeightEmu:_.session.startHeightEmu,startBounds:_.session.startBounds,startPosition:_.session.startPosition,anchorFrameOrigin:_.session.anchorFrameOrigin,deltaXPt:L,deltaYPt:k,transform:_.session.transform,preserveAspect:editor.resizePreservesAspect(_.session.handle,_.bounds.aspectLocked,E.shiftKey,_.bounds.textbox),kind:_.session.kind});l({..._,bounds:Object.freeze({..._.bounds,x:w.previewBounds.x,y:w.previewBounds.y,width:w.previewBounds.width,height:w.previewBounds.height,widthEmu:w.widthEmu,heightEmu:w.heightEmu})});},M=E=>{let _=f.current;if(_)if(E.type==="pointerup"){let H=editor.cssPixelsToLayoutPoints(E.clientX-(u.current?.x??E.clientX),T.paintScale),L=editor.cssPixelsToLayoutPoints(E.clientY-(u.current?.y??E.clientY),T.paintScale),k=editor.finalizeImageOverlayInteraction({session:_.session,deltaXPt:H,deltaYPt:L,accumulatedScrollPt:_.accumulatedScrollPt,aspectLocked:_.bounds.aspectLocked,textbox:_.bounds.textbox,shiftKey:E.shiftKey,anchorFrameOrigin:_.session.anchorFrameOrigin});b(_.session,k.widthEmu,k.heightEmu,k.previewBounds,k.position);}else x();};return window.addEventListener("pointermove",R),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),()=>{window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M);}},[x,b,e,n,s]),Pt.useEffect(()=>{!i||p.current!==i.id||(p.current=null,m.current?.focus({preventScroll:true}));},[i]);let C=s?.bounds??i,P=Pt.useMemo(()=>{if(!n?.surface||!C)return null;let T=n.surface.publishedLayout(),R=n.surface.overlayCoordinates(),M=editor.overlayFrameToSheetCssPixels(T,{pageIndex:C.pageIndex,x:C.x,y:C.y,width:C.width,height:C.height},R),E={left:M.left+c.left,top:M.top+c.top,width:M.width,height:M.height},_=C.canResize,H=C.kind==="anchored"&&C.canMove;return jsxRuntime.jsxs("div",{ref:m,className:"docx-image-selection-overlay","data-drawing-node-id":C.id,tabIndex:0,onKeyDown:S,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${H?" docx-editor-one-surface__overlay-control":""}`,"data-textbox":C.textbox?"true":void 0,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${E.left}px`,top:`${E.top}px`,width:`${E.width}px`,height:`${E.height}px`,cursor:H?"move":"default"},onPointerDown:L=>{B(L),!(!H||!C.position)&&L.button===0&&(L.preventDefault(),L.stopPropagation(),h("move",null,C,L.clientX,L.clientY,L.currentTarget,L.pointerId));}}),_?wE.map(L=>{let k=DE(L);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(ME(L)),tabIndex:0,style:{left:`calc(${E.left}px + ${E.width}px * ${parseFloat(k.x)/100} - 5px)`,top:`calc(${E.top}px + ${E.height}px * ${parseFloat(k.y)/100} - 5px)`,cursor:RE(L)},onPointerDown:w=>{B(w),w.button===0&&(w.preventDefault(),w.stopPropagation(),h("resize",L,C,w.clientX,w.clientY,w.currentTarget,w.pointerId));}},L)}):null]})},[C,h,n,S,c.left,c.top,r]);return !P||!t.current?null:reactDom.createPortal(P,t.current)}function gu(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function Ll({className:e}){let t=F(),o=la(),n=Pt.useRef(null),r=Pt.useRef(null);Pt.useLayoutEffect(()=>{let l=n.current;if(!(!t||!l))return t.attach(l),()=>{t.detach();}},[t]);let i=Pt.useCallback(l=>{if(!o?.isEnabled)return;let c=l.clipboardData;c&&gu(c)&&(editor.clipboardPasteLandsContent(c)||(l.preventDefault(),o.insertFromDataTransfer(c)));},[o]),a=Pt.useCallback(l=>{!o?.isEnabled||!gu(l.dataTransfer)||l.preventDefault();},[o]),s=Pt.useCallback(l=>{if(o?.isEnabled&&gu(l.dataTransfer)){if(editor.clipboardDropLandsText(l.dataTransfer)){if((l.target instanceof Element?l.target:null)?.closest("[contenteditable]")?.getAttribute("contenteditable")==="true")return;l.preventDefault();return}l.preventDefault(),o.insertFromDataTransfer(l.dataTransfer);}},[o]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:n,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:i,onDragOver:a,onDrop:s}),jsxRuntime.jsx(Ag,{}),jsxRuntime.jsx(Vf,{}),jsxRuntime.jsx(Cg,{}),t?jsxRuntime.jsx(mu,{containerRef:n,portalRef:r}):null]})}function Ne(e){return e/1440*96}function Fl(e){return e/96*1440}function gt(e){return `${Math.round(e*100)/100}px`}function hu(e){return e/2}var BE=e=>e.isLoading||e.isOpening===true,ZE=e=>({width:Ne(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Ne(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),qE=(e,t)=>e.width===t.width&&e.height===t.height;function bu({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}var Ug=false;function Vg(){Ug||!jt()||(Ug=true,console.warn("[docx-editor] loadingIndicator is ignored with chrome={false}, which renders no loading screen. Compose <DocxEditor.Loading overlay indicator={...} /> in a positioned box instead."));}function KE(e){let t=F(),[o,n]=Pt.useState(null);return Pt.useEffect(()=>{if(!(!t||!e))return t.setOpeningIndicatorHost({publish:n}),()=>{t.setOpeningIndicatorHost(null),n(null);}},[t,e]),o}function WE({when:e=false,overlay:t=false,className:o,style:n,indicator:r,children:i}){let a=O(BE),s=O(ZE,qE),l=KE(t),{t:c}=N();if(!e&&!a)return null;let d=r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bu,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:c("loading.label")})]});if(l)return reactDom.createPortal(d,l);let f=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${o?` ${o}`:""}`;return jsxRuntime.jsx("div",{className:f,style:n,role:"status","aria-live":"polite",children:i??jsxRuntime.jsx("div",{className:"docx-paginated-surface docx-editor__loading-surface",style:{width:s.width,height:s.height},children:jsxRuntime.jsx("div",{className:"docx-pages",children:jsxRuntime.jsx("div",{className:"docx-page docx-editor__loading-page",children:jsxRuntime.jsx("div",{className:"docx-editor__loading-page-status",children:d})})})})})}var Hl=Object.assign(WE,{Spinner:bu});function Gg(){let e=new Set,t=new Map,o=new Map,n=0,r=null,i=false;function a(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let u=Object.create(null),g=[...t].sort((m,p)=>(o.get(m[0])??0)-(o.get(p[0])??0));for(let[,{author:m,style:p}]of g)u[m]=p;return {authors:u,others:e.size>0?"kind":"author"}}let s=null,l=false;function c(u){if(u===void 0)return "none";if(typeof u=="string")return u;let g=Object.entries(u.authors).map(([m,p])=>`${m}\0${JSON.stringify(p)}`).sort();return `${u.others??"kind"}${g.join("")}`}function d(){if(!r)return;let u=a(),g=c(u);if(g!==s){if(u===void 0){i&&(r.setRevisionStyles("author"),i=false,s=g);return}r.setRevisionStyles(u),i=true,s=g;}}function f(){!r||l||(l=true,queueMicrotask(()=>{l=false,d();}));}return {registerScheme(u){e.add(u),f();},register(u,g,m){o.has(u)||o.set(u,n++),t.set(u,{author:g,style:m}),f();},unregister(u){(e.delete(u)||t.delete(u))&&f();},connect(u){r=u;let g=a();i=u!==null&&g!==void 0,s=u===null?null:c(g),f();},current:a}}var _a=Pt.createContext(null);function Xg(){let e=Pt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function vu(){let e=Pt.useContext(_a),t=Xg();return Pt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function yu(e){let{author:t,color:o,background:n,activeBackground:r,spanClassName:i,avatarUrl:a}=e,s=Pt.useContext(_a),l=Xg();return Pt.useEffect(()=>{if(s)return s.register(l,t,{...o!==void 0?{color:o}:{},...n!==void 0?{background:n}:{},...r!==void 0?{activeBackground:r}:{},...i!==void 0?{spanClassName:i}:{},...a!==void 0?{avatarUrl:a}:{}}),()=>s.unregister(l)},[s,l,t,o,n,r,i,a]),null}var Jg=false;function Qg(e,t){e===t||Jg||!jt()||(Jg=true,console.warn("[docx-editor] fieldResults changed after the editor was created, so the change is ignored. The editor reads fieldResults once; create a new editor to change it."));}function QE(e,t){if(e===t)return true;let o=editor.resolveZoomMode(e),n=editor.resolveZoomMode(t);return o!==null&&n!==null&&editor.sameZoomMode(o,n)}function ew(e){let t=Pt.useRef(e);t.current=e;let[o,n]=Pt.useState(null),{onReady:r,onChange:i,onFontError:a,onRevisionMarkupChange:s,...l}=e,c=Pt.useMemo(()=>({onReady:d=>{n(d),t.current.onReady?.(d);},onChange:d=>t.current.onChange?.(d),onFontError:d=>t.current.onFontError?.(d),onRevisionMarkupChange:d=>t.current.onRevisionMarkupChange?.(d)}),[]);return {DocxEditorRoot:Na,rootProps:l,rootListeners:c,editorRef:o}}function Na(e){let{document:t,fonts:o,author:n,locale:r,translate:i,mode:a,zoom:s,zoomMode:l,tableInteractionLabel:c,imageDecodePort:d,children:f}=e,{t:u}=N(),g=Pt.useCallback((k,w)=>u(k,w),[u]),m=Pt.useRef(g);m.current=g;let p=Pt.useRef(false),[v,y]=Pt.useState(0),x=Pt.useRef(e);x.current=e;let[h,b]=Pt.useState(null),S=Pt.useRef(e.fieldResults),C=Pt.useRef(null);C.current??=Gg();let P=C.current;Pt.useEffect(()=>{let k=x.current,w=k.translate??m.current,I=P.current();S.current=k.fieldResults;let $=editor.createDocxEditor({...k.document!==void 0?{document:k.document}:{},...k.fonts?{fonts:k.fonts}:{},...k.author!==void 0?{author:k.author}:{},...k.locale!==void 0?{locale:k.locale}:{},translate:w,...k.revisionMarkup!==void 0?{revisionMarkup:k.revisionMarkup}:{},...k.reviewDisplayMode!==void 0?{reviewDisplayMode:k.reviewDisplayMode}:{},...k.fieldResults!==void 0?{fieldResults:k.fieldResults}:{},...k.mode!==void 0?{mode:k.mode}:{},...I!==void 0?{revisionStyles:I}:{},...k.modules!==void 0?{modules:k.modules}:{},...k.zoom!==void 0?{zoom:k.zoom}:{},...k.zoomMode!==void 0?{zoomMode:k.zoomMode}:{},...k.tableInteractionLabel?{tableInteractionLabel:k.tableInteractionLabel}:{},...k.imageDecodePort?{imageDecodePort:k.imageDecodePort}:{},onFontError:V=>x.current.onFontError?.(V)}),W=$.on("revisionMarkupChange",V=>{p.current||(x.current.onRevisionMarkupChange?.(V),y(se=>se+1));}),ee=$.on("change",V=>x.current.onChange?.(V));return b($),()=>{W(),ee(),$.destroy(),b(V=>V===$?null:V);}},[t,o,d,P]),Pt.useEffect(()=>{if(!h)return;if(!h.snapshot().isOpening){x.current.onReady?.(h);return}let k=h.on("change",()=>{k(),x.current.onReady?.(h);});return k},[h]);let T=Pt.useRef({editor:null,zoom:void 0,mode:void 0});Pt.useEffect(()=>{if(!h)return;T.current.editor!==h&&(T.current={editor:h,zoom:void 0,mode:void 0});let w=false;s!==void 0&&s!==T.current.zoom&&(T.current.zoom=s,h.setZoom(s),w=true);let I=T.current.mode,$=l!==void 0&&(I===void 0||!QE(I,l)),W=l===void 0?null:editor.resolveZoomMode(l),ee=w&&l!==void 0&&W!==null&&W.type==="fit";($||ee)&&(T.current.mode=l,h.setZoomMode(l));},[h,s,l]),Pt.useEffect(()=>{if(!h||e.revisionMarkup===void 0)return;let k=editor.resolveRevisionMarkup(e.revisionMarkup);if(JSON.stringify(k)!==JSON.stringify(h.snapshot().revisionMarkup)){p.current=true;try{h.setRevisionMarkup(k);}finally{p.current=false;}}},[h,e.revisionMarkup,v]),Pt.useEffect(()=>{h&&h.setAuthor(n);},[h,n]);let R=Pt.useRef({editor:null,value:void 0});Pt.useEffect(()=>{if(h){if(R.current.editor!==h){R.current={editor:h,value:a};return}R.current.value!==a&&(R.current.value=a,h.setMode(a));}},[h,a]),Pt.useEffect(()=>{h&&h.setTranslate(i??g);},[h,i,g]),Pt.useEffect(()=>{h&&h.setLocale(r);},[h,r]),Pt.useEffect(()=>{h&&Qg(S.current,e.fieldResults);},[h,e.fieldResults]),Pt.useEffect(()=>{h&&h.setTableInteractionLabel(c??editor.defaultTableLabel);},[h,c]);let[M,E]=Pt.useState(0),_=Pt.useRef([]),H=Pt.useMemo(()=>({mounted:M,register:()=>(E(k=>k+1),()=>E(k=>Math.max(0,k-1))),registerCommentDraft:k=>(_.current.push(k),()=>{let w=_.current.indexOf(k);w!==-1&&_.current.splice(w,1);}),requestCommentDraft:()=>{let k=_.current.at(-1);return k?(k(),true):false}}),[M]),L=Pt.useMemo(Em,[]);return Pt.useEffect(()=>(P.connect(h),()=>P.connect(null)),[P,h]),jsxRuntime.jsx(lg,{value:i??g,children:jsxRuntime.jsx(xt.Provider,{value:H,children:jsxRuntime.jsx(pc.Provider,{value:h,children:jsxRuntime.jsx(Pc.Provider,{value:L,children:jsxRuntime.jsx(_a.Provider,{value:P,children:jsxRuntime.jsx(tw,{children:jsxRuntime.jsx(ow,{children:jsxRuntime.jsx(Qi,{children:jsxRuntime.jsx(Uf,{value:e.popups,children:jsxRuntime.jsx(Hg,{popups:e.popups,children:f})})})})})})})})})})}function tw({children:e}){let t=zi(true);return jsxRuntime.jsx(Xr.Provider,{value:t,children:e})}function ow({children:e}){let t=Ui();return jsxRuntime.jsx(Vc.Provider,{value:t,children:e})}var La=316,wr=editor.REVIEW_MARKERS_GUTTER_PX,n0=24,Ol={inlineStart:0,inlineEnd:La},e0={inlineStart:wr,inlineEnd:wr},sw={inlineStart:0,inlineEnd:0},Tu={inlineStart:n0,inlineEnd:La};function cw(e){return e.inlineStart===Tu.inlineStart&&e.inlineEnd===Tu.inlineEnd}function r0(e,t){return cw(e)?Math.max(0,t-(La-wr)):t}function a0({open:e,viewportWidth:t,pageWidthPx:o,inlineStartReservation:n=0,docked:r=false,scroll:i=false}){if(!e)return e0;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0)return Ol;let a=Number.isFinite(n)&&n>0?n:0;return t-a-o-2*n0>=La?Ol:i?Tu:e0}var dw=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,reviewPaneOpen:e.reviewPaneOpen??true,entitledZoom:editor.reviewPaneEntitledZoom(t,e.zoom,e.reviewPane.overflow),scroll:e.reviewPane.overflow==="scroll"}},uw=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.scroll===t.scroll&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function i0(){let e=Ye(),[t,o]=Pt.useState(null);return Pt.useEffect(()=>{if(!e){o(null);return}let n=()=>o(e.clientWidth);if(n(),typeof ResizeObserver>"u")return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e]),t}function qo(){let e=Pt.useContext(xt),{pageSetup:t,reviewPaneOpen:o,entitledZoom:n,scroll:r}=O(dw,uw),i=Ye(),a=Mm(),s=Pt.useRef(null);t&&(s.current=t.pageWidthTwips);let l=t?.pageWidthTwips??s.current,c=(e?.mounted??0)>0,d=Pt.useCallback(g=>c?a0({open:o,viewportWidth:g??0,pageWidthPx:l===null||n===null?0:Ne(l)*n,inlineStartReservation:a,docked:n===null,scroll:r}):sw,[c,o,l,n,a,r]),[f,u]=Pt.useState(()=>d(i?i.clientWidth:null));return Pt.useEffect(()=>{let g=()=>u(d(i?i.clientWidth:null));if(g(),!i||typeof ResizeObserver>"u")return;let m=new ResizeObserver(g);return m.observe(i),()=>m.disconnect()},[i,d]),f}var Bl=[.25,.5,.75,1,1.25,1.5,2];function Fa(e,t){return t==="in"?Bl.find(n=>n>e+.001)??null:[...Bl].reverse().find(n=>n<e-.001)??null}function l0(e,t){return e==="0"?1:e==="+"||e==="="?Fa(t,"in")??t:e==="-"?Fa(t,"out")??t:null}var Pu=Pt.createContext(false);function s0(e){let t=Pt.useContext(Pu),[o,n]=Pt.useState(null);return Pt.useLayoutEffect(()=>{let r=t?e?.parentElement??null:null;n(r?{host:r,scoped:r.closest(".docx-editor")!==null}:null);},[t,e]),{inside:t,host:o?.host??null,hostScoped:o?.scoped??false}}var bw=e=>e.reviewPaneOpen??true,vw=e=>e.zoomMode?.type==="fit";function Zl({className:e,style:t,children:o}){let{t:n}=N(),r=Ct(),i=F(),a=O(bw),s=qo(),l=O(vw),d=(Pt.useContext(xt)?.mounted??0)>0,f=rn(),u=an(),g=Pt.useCallback(p=>f?.setViewport(p),[f]),m=Pt.useCallback(p=>{if(!i||!(p.metaKey||p.ctrlKey)||p.altKey)return;let v=p.target;if(v instanceof Element&&v.closest('input, textarea, select, [role="dialog"]'))return;let y=l0(p.key,i.getZoom());y!==null&&(p.preventDefault(),i.setZoom(y));},[i]);return jsxRuntime.jsx("div",{ref:g,"data-testid":"docx-editor-scroll",tabIndex:0,role:"region","aria-label":n("editor.documentViewport"),onKeyDownCapture:m,...d?{"data-review-pane":a?"open":"closed"}:{},...l?{"data-zoom-fit":""}:{},className:`${r}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${u}px`,...d?{"--docx-review-gutter":`${s.inlineEnd}px`,"--docx-review-gutter-start":`${s.inlineStart}px`,"--docx-review-strip":`${2*wr}px`}:{}},children:jsxRuntime.jsx(vn.Provider,{value:true,children:jsxRuntime.jsx(Pu.Provider,{value:true,children:o})})})}var xw=editor.LOADING_SNAPSHOT;function d0({ref:e,editorRef:t}){Pt.useImperativeHandle(e,()=>({load:o=>t.current?.load(o),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(o,n)=>t.current?.exec(o,n)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:o=>t.current?.snapshot(o)??xw}),[t]);}function Mr(e,t,o,n){let r=Ye(),i=Pt.useRef({close:o,skip:n,viewport:r});i.current={close:o,skip:n,viewport:r},Pt.useEffect(()=>{let a=t.current;if(!e||!a)return;let s=d=>a.contains(d),l=editor.listenForPopupEscape({popup:a,contains:s,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current.viewport],skip:d=>i.current.skip?.(d)===true,close:d=>i.current.close(d)}),c=editor.listenForPopupFocusLeave({popup:a,contains:s,close:()=>i.current.close(false)});return ()=>{l(),c();}},[e,t]);}var Dw=e=>e.editingMode??"editing",wu='[role="menuitemradio"]:not([disabled])',kw=(e,t)=>e.length===t.length&&e.every((o,n)=>o===t[n]),Iw=e=>e.isLoading||e.isOpening===true,Ha=[{mode:"editing",labelKey:"editingMode.editing",hintKey:"editingMode.editingHint",path:"M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"},{mode:"suggesting",labelKey:"editingMode.suggesting",hintKey:"editingMode.suggestingHint",path:"M240-400h122l40-40H240v40Zm0-100h222l40-40H240v40Zm0-100h322l40-40H240v40ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v320h-80v-320H160v525l46-45h274v80H240L80-80Zm520-80v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T943-380L723-160H600Zm300-263-37-37 37 37ZM660-220h38l121-122-19-18-18-19-122 121v38Zm140-141-18-19 37 37-19-18Z"},{mode:"viewing",labelKey:"editingMode.viewing",hintKey:"editingMode.viewingHint",path:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Z"}],_w=Object.freeze(Ha.map(()=>null));function Nw(e){return e?Ha.map(t=>{let o=e.can({type:"setEditingMode",mode:t.mode});return o.ok?null:o.reason}):_w}var Lw="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Kl({className:e,hidden:t}){let o=F(),n=O(Dw),r=O(Iw),i=X(),{t:a}=N(),[s,l]=Pt.useState(false),c=Pt.useRef(null),d=Pt.useRef(null),f=Pt.useRef(null);Pt.useEffect(()=>{if(!s)return;let h=f.current?.querySelectorAll(wu);(f.current?.querySelector(`${wu}[aria-checked="true"]`)??h?.[0]??void 0)?.focus();},[s]);let u=Pt.useCallback(h=>{let b=[...f.current?.querySelectorAll(wu)??[]],S=b.indexOf(document.activeElement),C=P=>{h.preventDefault(),b[(P+b.length)%b.length]?.focus();};h.key==="ArrowDown"?C(S+1):h.key==="ArrowUp"?C(S-1):h.key==="Home"?C(0):h.key==="End"&&C(b.length-1);},[]);Pt.useEffect(()=>{if(!s)return;let h=b=>{let S=c.current;S&&b.target instanceof Node&&S.contains(b.target)||l(false);};return document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("mousedown",h,true);}},[s]),Mr(s,c,h=>{l(false),h&&d.current?.focus();});let g=Pt.useCallback(h=>{l(false),editor.runToolbarCommand(o,"review.editingMode",h),o?.focus();},[o]),m=editor.toolbarCommandState(o,"review.editingMode"),p=i18n.localizeDisabledReason(m.disabledReason,a),v=O(()=>Nw(o),kw),y=Pt.useMemo(()=>Ha.find(h=>h.mode===n)??Ha[0],[n]);if(t)return null;let x=J("review.editingMode");return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":n,"aria-haspopup":"menu","aria-expanded":s,"aria-label":i(x?.labelKey??"editingMode.label"),disabled:r||!m.enabled,...p?{title:p}:{},onMouseDown:B,onClick:()=>l(h=>!h),children:[Mu(y.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:i(y.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{ref:f,className:"docx-toolbar__mode-menu",role:"menu","aria-label":i(x?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:u,children:Ha.map((h,b)=>{let S=i18n.localizeDisabledReason(v[b]??null,a);return jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.mode===n,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${h.mode}`,disabled:S!==null,...S?{title:S}:{},onMouseDown:B,onClick:()=>g(h.mode),children:[Mu(h.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:i(h.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:i(h.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:h.mode===n?Mu(Lw):null})]},h.mode)})}):null]})}Kl.docxSlot="review.editingMode";function Mu(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}var f0=[],Aw=()=>{};function Aa(){let e=F(),t=Pt.useCallback(o=>{if(!e)return Aw;let n=$r(o),r=e.on("change",n),i=e.on("selectionChange",n);return ()=>{r(),i();}},[e]);return Pt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??f0,()=>f0)}var Ww=e=>e.hiddenReviewAuthors??[];function zl({className:e,hidden:t,icon:o}){let n=F(),r=Aa(),i=O(Ww),a=new Set(i),s=r.every(b=>!a.has(b.author)),[l,c]=Pt.useState(false),d=Pt.useRef(null),f=Pt.useRef(null),u=Pt.useRef(null),g=X(),{t:m}=N();Pt.useEffect(()=>{if(!l)return;u.current?.querySelector('[role="menuitemcheckbox"]')?.focus();let b=S=>{d.current?.contains(S.target)||c(false);};return document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("mousedown",b,true);}},[l]),Mr(l,d,b=>{c(false),b&&f.current?.focus();});let p=Pt.useCallback(b=>{let S=[...u.current?.querySelectorAll('[role="menuitemcheckbox"]')??[]],C=S.indexOf(document.activeElement),P=T=>{b.preventDefault(),S[(T+S.length)%S.length]?.focus();};b.key==="ArrowDown"?P(C+1):b.key==="ArrowUp"?P(C-1):b.key==="Home"?P(0):b.key==="End"?P(S.length-1):b.key==="Tab"&&c(false);},[]);if(t)return null;let v=J("review.authors"),y=editor.toolbarCommandState(n,"review.authors"),x=i18n.localizeDisabledReason(y.disabledReason,m),h=g(v?.labelKey??"reviewers.label");return jsxRuntime.jsxs("div",{ref:d,className:`docx-toolbar__reviewers${e?` ${e}`:""}`,"data-slot":"review.authors",children:[jsxRuntime.jsxs("button",{ref:f,type:"button",className:"docx-toolbar__picker","data-testid":"reviewers-trigger","aria-haspopup":"menu","aria-expanded":l,"aria-label":h,disabled:!y.enabled,title:x??h,onMouseDown:B,onClick:()=>c(b=>!b),children:[o??re(v?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:h}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__reviewers-menu",role:"menu","aria-label":h,"data-testid":"reviewers-menu",onKeyDown:p,children:[jsxRuntime.jsx(g0,{checked:s,label:m("reviewers.all"),testId:"reviewer-all",onChoose:()=>n?.setAllReviewAuthorsVisible(!s)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),r.map(b=>jsxRuntime.jsx(g0,{checked:!a.has(b.author),label:b.author||"\u2014",testId:`reviewer-${b.slot}`,color:b.color,onChoose:()=>n?.setReviewAuthorVisible(b.author,a.has(b.author))},b.author))]}):null]})}zl.docxSlot="review.authors";function g0(e){return jsxRuntime.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":e.checked,className:"docx-toolbar__reviewer-item","data-testid":e.testId,onMouseDown:B,onClick:e.onChoose,children:[jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:e.checked?"\u2713":""}),e.color?jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-swatch",style:{background:e.color}}):null,jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-name",children:e.label})]})}var h0=Pt.createContext(null);function b0({children:e}){let t=Pr(),[o,n]=Pt.useState(false),r=Pt.useRef(null),i=Pt.useMemo(()=>({open:s=>{if(t){t.open("paragraph",s);return}r.current=s??document.activeElement,n(true);}}),[t]),a=Pt.useCallback(()=>{n(false);let s=r.current;r.current=null,s instanceof HTMLElement&&s.isConnected&&s.focus({preventScroll:true});},[]);return jsxRuntime.jsxs(h0.Provider,{value:i,children:[e,jsxRuntime.jsx(yo,{open:o,onClose:a})]})}function v0(){return Pt.useContext(h0)}var Du=["M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"],ku=Pt.createContext({close:()=>{}});function Rr(){return Pt.useContext(ku).close}function s1(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function T0({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__more-control",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-label",children:e}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-body",children:t})]})}function P0({slot:e}){let t=X(),o=ko(),{close:n}=Pt.useContext(ku),{execute:r,isActive:i,isEnabled:a,disabledReason:s,value:l}=ie(e),c=J(e),d=editor.chromeSlotIsToggle(e),f=o(t(c?.labelKey??e));return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...s?{title:s}:{},...d?{"aria-pressed":i}:{},...i?{"data-active":""}:{},...l!==null?{"data-value":l}:{},onMouseDown:B,onClick:u=>{r(),n(u.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:re(c?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:f})]})}function S0({sections:e,className:t}){let o=X(),[n,r]=Pt.useState(false),i=Pt.useRef(null),a=Pt.useRef(null),s=Pt.useRef(null),l=Pt.useRef(false),c=Pt.useId(),d=Ye(),f=Pt.useRef(d);f.current=d;let u=o("formattingBar.more"),g=Pt.useCallback(x=>{r(false),x&&a.current?.focus();},[]),m=Pt.useMemo(()=>({close:g}),[g]);Pt.useEffect(()=>{if(!n)return;let x=P=>{let T=P.target;T instanceof Node&&i.current?.contains(T)||r(false);},h=i.current,b=P=>i.current?.contains(P)===true||s.current?.contains(P)===true,S=h?editor.listenForPopupEscape({popup:h,contains:b,chromeRoot:()=>i.current?.closest(".docx-editor"),editorElements:()=>[f.current],skip:()=>editor.hasOpenNestedPopup(s.current),close:g}):void 0,C=h?editor.listenForPopupFocusLeave({popup:h,contains:b,close:()=>r(false)}):void 0;return document.addEventListener("mousedown",x,true),()=>{document.removeEventListener("mousedown",x,true),S?.(),C?.();}},[n,g]);let[p,v]=Pt.useState(null);Pt.useLayoutEffect(()=>{if(!n){v(null);return}let x=()=>{let b=i.current,S=s.current,C=a.current,P=b?.ownerDocument.defaultView;if(!b||!S||!C||!P)return;let T=C.getBoundingClientRect(),R=editor.toolbarPanelPlacement({triggerLeft:T.left,triggerRight:T.right,panelWidth:S.offsetWidth,viewportWidth:P.innerWidth}),M=R.left-b.getBoundingClientRect().left;v(E=>E&&E.left===M&&E.maxWidth===R.maxWidth&&E.anchor===R.anchor?E:{...R,left:M});};x();let h=i.current?.ownerDocument.defaultView;return h?.addEventListener("resize",x),()=>h?.removeEventListener("resize",x)},[n]),Pt.useEffect(()=>{if(!n||!l.current)return;l.current=false;let x=s.current;x&&s1(x);},[n]);let y=x=>{x.key!=="Escape"||x.defaultPrevented||(x.preventDefault(),g(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[aa]:"",children:[jsxRuntime.jsx("button",{ref:a,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?c:void 0,"aria-label":u,title:u,...n?{"data-active":""}:{},onMouseDown:B,onClick:()=>r(x=>!x),onKeyDown:x=>{x.key==="ArrowDown"&&(x.preventDefault(),l.current=true,r(true));},children:re(Du)}),n?jsxRuntime.jsx(ku.Provider,{value:m,children:jsxRuntime.jsx("div",{ref:s,id:c,role:"dialog","aria-label":u,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",...p?{"data-anchor":p.anchor}:{},style:p?{left:p.left,right:"auto",maxInlineSize:p.maxWidth}:void 0,onKeyDown:y,children:e.map(x=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":x.label??o(x.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:x.label??o(x.labelKey)}),x.children]},x.id))})}):null]})}function d1(e){if(!Pt.isValidElement(e))return false;let t=e.type;return (typeof t=="function"||typeof t=="object")&&t.docxToolbarGroup===true}function w0(e,t,o,n){let r=new Map,i=new Map,a=new Map,s=[];for(let l of Pt.Children.toArray(e)){if(d1(l)){a.delete(l.props.id),a.set(l.props.id,l.props);continue}let c=t(l);if(c&&o(c))r.set(c,l);else if(c&&n(c))i.set(c,l);else {if(c&&Pt.isValidElement(l)&&l.props.hidden===true)continue;s.push(l);}}return {overrides:r,tableOverrides:i,groups:[...a.values()],appended:s}}function Ul(e,t){return e.label!==void 0?e.label:e.labelKey!==void 0?t(e.labelKey):e.id}function Iu(e){let t=X();return e.hidden?null:jsxRuntime.jsx("div",{role:"group","aria-label":Ul(e,t),className:`docx-toolbar__group${e.className?` ${e.className}`:""}`,"data-toolbar-host-group":e.id,children:e.children})}Iu.docxToolbarGroup=true;function Ba(e){return e.hidden?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.children})}Ba.docxToolbarSlot=true;var _u=Pt.createContext("bar");function M0(){return Pt.useContext(_u)}var Vl="review.addComment";function g1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=Pt.useContext(xt),a=X(),{isEnabled:s,reason:l}=Gi(a),c=Rr();if(t||(i?.mounted??0)===0)return null;let d=J(Vl),f=a(d?.labelKey??Vl),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Vl,disabled:!s,...s?{}:{"data-disabled":""},"aria-label":f,title:l??f,onMouseDown:B,onClick:()=>{i?.requestCommentDraft()&&c(false);}};return n?jsxRuntime.jsx(j,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??re(d?.paths)})}var Nu=Object.assign(g1,{docxSlot:Vl});var k0=new Set;function Gl(e){!jt()||k0.has(e)||(k0.add(e),console.warn(`[docx-editor] ${e}`));}function I0(e,t,o){Gl(`Toolbar.Group "${e}" has after="${t}", but no group has that id. The group is placed after every other group. Known ids: ${o.join(", ")}.`);}function _0(e,t){Gl(`Toolbar.Group "${e}" is a built-in group, so its ${t} is ignored. A built-in group keeps its own label and place in the bar.`);}function N0(e){Gl(`Toolbar.Group "${e}" uses the id of the contextual table group, so it is ignored. Give the group another id.`);}function L0(e,t){Gl(t?`Toolbar slot "${e}" is not part of the preset arrangement, so its content is appended after the groups. Put it in a Toolbar.Group to give it a place.`:`"${e}" is not a toolbar slot id. Its content is appended after the groups. Use a ChromeSlotId such as "text.bold".`);}var Fu=[{value:"inline",labelKey:"imageWrap.menu.inLineWithText",iconName:"wrap_text"},{value:"square",labelKey:"imageWrap.square",iconName:"crop_square"},{value:"squareLeft",labelKey:"imageWrap.menu.squareLeft",iconName:"format_image_left"},{value:"squareRight",labelKey:"imageWrap.menu.squareRight",iconName:"format_image_right"},{value:"tight",labelKey:"imageWrap.tight",iconName:"wrap_text"},{value:"through",labelKey:"imageWrap.through",iconName:"wrap_text"},{value:"topAndBottom",labelKey:"imageWrap.topAndBottom",iconName:"vertical_align_center"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function Yl({className:e,hidden:t,asChild:o,children:n}){let{t:r}=N(),i=X(),{execute:a,value:s,isEnabled:l,disabledReason:c}=Ta("image.wrap"),[d,f]=Pt.useState(false),u=Pt.useRef(null),g=Pt.useRef(null),m=Pt.useRef(null),p=Pt.useId(),v=Pt.useMemo(()=>Fu.find(C=>C.value===s)??Fu[0],[s]),y=J("image.wrap"),x=i(y?.labelKey??"formattingBar.imageWrap");Pt.useEffect(()=>{if(!d)return;let C=T=>{let R=u.current;R&&T.target instanceof Node&&R.contains(T.target)||f(false);},P=T=>{T.key==="Escape"&&(T.preventDefault(),f(false),g.current?.focus());};return document.addEventListener("mousedown",C,true),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C,true),document.removeEventListener("keydown",P);}},[d]);let h=Pt.useCallback(C=>{f(false),a(C);},[a]);if(t)return null;let b=r("imageWrap.tooltipPrefix",{label:r(v.labelKey)}),S={type:"button",ref:g,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!l,...l?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?p:void 0,"aria-label":x,title:c??b,onMouseDown:B,onClick:()=>f(C=>!C)};return jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__image-wrap",children:[o?jsxRuntime.jsx(j,{...S,children:n}):jsxRuntime.jsx("button",{...S,children:n??re(y?.paths)}),d?jsxRuntime.jsx("div",{ref:m,id:p,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:C=>C.stopPropagation(),children:Fu.map(C=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":s===C.value,...s===C.value?{"data-active":""}:{},onMouseDown:B,onClick:()=>h(C.value),children:r(C.labelKey)},C.value))}):null]})}Yl.docxSlot="image.wrap";var Za=Object.assign(Yl,{docxSlot:"image.wrap"});var Dr="table.insert";function M1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=F(),{isEnabled:a,disabledReason:s}=ie(Dr),l=X(),[c,d]=Pt.useState(false),f=Pt.useRef(null),u=Pt.useRef(null),g=Pt.useRef(null),m=Pt.useId(),p=Rr();Pt.useEffect(()=>{let S=f.current?.ownerDocument;if(!c||!S)return;let C=P=>{let T=f.current;T&&P.target instanceof Node&&T.contains(P.target)||d(false);};return S.addEventListener("mousedown",C,true),()=>S.removeEventListener("mousedown",C,true)},[c]),Pt.useEffect(()=>{c&&f.current?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();},[c]);let v=c&&a;Pt.useLayoutEffect(()=>{let S=g.current,C=f.current,P=C?.ownerDocument.defaultView;if(!v||!S||!C||!P||C.closest(".docx-toolbar__more-panel"))return;let T=C.getBoundingClientRect(),R=editor.toolbarPopupLeft({anchorLeft:T.left,popupWidth:S.offsetWidth,viewportWidth:P.innerWidth});S.style.left=`${R-T.left}px`;},[v]);let y=Pt.useCallback(()=>{d(false),p(false);},[p]);if(t)return null;let x=J(Dr),h=l(x?.labelKey??Dr),b={ref:u,type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Dr,disabled:!a,...a?{}:{"data-disabled":""},...v?{"data-active":""}:{},"aria-haspopup":"grid","aria-expanded":v,"aria-controls":v?m:void 0,"aria-label":h,title:s??h,onMouseDown:B,onClick:()=>{if(!c){d(true);return}d(false),i?.focus();},onKeyDown:S=>{S.key==="ArrowDown"&&(S.preventDefault(),d(true));}};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__table-insert",children:[n?jsxRuntime.jsx(j,{...b,children:r}):jsxRuntime.jsx("button",{...b,children:o??r??re(x?.paths)}),v?jsxRuntime.jsx("div",{ref:g,id:m,className:"docx-toolbar__menu docx-toolbar__table-insert-menu",onBlur:S=>{let C=S.relatedTarget;C instanceof Node&&!f.current?.contains(C)&&d(false);},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),d(false),u.current?.focus());},children:jsxRuntime.jsx(ol,{slot:Dr,label:l("toolbar.insertTable"),onInserted:y})}):null]})}var Au=Object.assign(M1,{docxSlot:Dr});function Ge(e){return Object.assign(o=>jsxRuntime.jsx(sn,{slotId:e,...o}),{docxSlot:e})}var H0=Ge("history.undo"),A0=Ge("history.redo"),O0=Ge("text.bold"),B0=Ge("text.italic"),Z0=Ge("text.underline"),q0=Ge("text.strike"),K0=Ge("format.clear"),W0=Ge("script.super"),z0=Ge("script.sub"),$0=Ge("alignment.left"),U0=Ge("alignment.center"),V0=Ge("alignment.right"),G0=Ge("alignment.justify"),j0=Ge("direction.ltr"),Y0=Ge("direction.rtl"),X0=Ge("list.bullet"),J0=Ge("list.numbered"),Q0=Ge("list.outdent"),eh=Ge("list.indent");var th=Ge("review.comments");function _1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=F(),{openAtCaret:a}=Fc(),s=editor.chromeProbeForSlot("text.link"),l=i&&s?i.can(s):null,c=l?.ok===true,{t:d}=N(),f=i18n.localizeDisabledReason(l&&!l.ok?l.reason:null,d),u=X();if(t)return null;let g=J("text.link"),m=u(g?.labelKey??"text.link"),p={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!c,...c?{}:{"data-disabled":""},"aria-label":m,title:f??m,onMouseDown:B,onClick:()=>a()};return n?jsxRuntime.jsx(j,{...p,children:r}):jsxRuntime.jsx("button",{...p,children:o??r??re(g?.paths)})}var Ou=Object.assign(_1,{docxSlot:"text.link"});function N1({className:e,hidden:t}){let o=F(),{onSave:n}=Pt.useContext(ln),r=X();if(t)return null;let i=J("file.save"),a=r(i?.labelKey??"file.save"),s=!o||!n;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:s,...s?{"data-disabled":""}:{},"aria-label":a,title:a,onMouseDown:B,onClick:()=>n?.(),children:re(i?.paths)})}var Bu=Object.assign(N1,{docxSlot:"file.save"});function En({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}var H1=e=>({zoom:e.zoom,mode:e.zoomMode}),A1=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,nh={type:"fixed"};function Zu(){let e=F(),{zoom:t,mode:o}=O(H1,A1),n=Pt.useCallback(i=>{e?.setZoom(i);},[e]),r=Pt.useCallback(i=>{e?.setZoomMode(i);},[e]);return Pt.useMemo(()=>{let i=o??nh,a=Fa(t,"out"),s=Fa(t,"in");return {zoom:t,mode:i,isFit:i.type==="fit",setZoom:n,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(nh),n(1);},zoomIn:()=>s!==null&&n(s),zoomOut:()=>a!==null&&n(a),canZoomIn:!!e&&s!==null,canZoomOut:!!e&&a!==null,levels:Bl}},[e,t,o,n,r])}var Wa=2,za=3276,Ka=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],q1=e=>e.formatting?.fontSizePt??null;function ih(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function lh(e,t,o){for(let n=t.length-1;n>=0;n-=1)if(t[n]<e)return t[n];return Math.max(e-1,o)}function ch(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:B,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:B,onClick:e.onIncrease,children:"+"})]})}function K1(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let o=Number(t);if(!Number.isFinite(o))return null;let n=Math.round(o*2);return n<Wa||n>za?null:n}function W1({className:e,hidden:t}){let o=F(),n=O(q1),{isEnabled:r,disabledReason:i}=ie("font.size"),a=X(),[s,l]=Pt.useState(false),[c,d]=Pt.useState(null),f=Pt.useRef(null);fo(f,s,()=>l(false));let u=Pt.useRef(null),g=Pt.useId(),m=Pt.useCallback(C=>{if(!o)return;let P=editor.commandForSlotValue("font.size",C);P&&o.can(P).ok&&o.exec(P);},[o]),p=Pt.useCallback(C=>{m(Math.min(za,Math.max(Wa,Math.round(C*2))));},[m]),v=Pt.useCallback(C=>{l(false),d(null),u.current?.blur(),C&&o?.focus();},[o]);if(Pt.useEffect(()=>{if(!s)return;let C=P=>{let T=f.current;T&&P.target instanceof Node&&T.contains(P.target)||(l(false),d(null));};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]),t)return null;let y=r&&n!==null,x=n===null?"\u2014":String(Math.round(n*2)/2),h=c??x,b=n===null?null:Math.round(n*2)/2,S=()=>{if(c===null)return;let C=K1(c);C!==null&&m(C);};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(ch,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:u,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:h,disabled:!r,role:"combobox","aria-expanded":s,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),"aria-controls":s?g:void 0,autoComplete:"off",onChange:C=>{d(C.target.value),l(true);},onFocus:C=>{C.target.select(),l(true);},onClick:()=>l(true),onKeyDown:C=>{C.key==="Enter"?(C.preventDefault(),S(),v(true)):C.key==="Escape"?(C.preventDefault(),v(true)):(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),l(true),n!==null&&p(C.key==="ArrowDown"?lh(n,Ka,Wa/2):ih(n,Ka,za/2)));},onBlur:()=>{S(),d(null);}}),canDecrease:y&&Math.round(n*2)>Wa,canIncrease:y&&Math.round(n*2)<za,onDecrease:()=>p(lh(n??0,Ka,Wa/2)),onIncrease:()=>p(ih(n??0,Ka,za/2))}),s&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox",tabIndex:0,"aria-label":a("fontSize.listLabel"),id:g,children:Ka.map(C=>{let P=b===C;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":P,...P?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>{p(C),v(true);},children:C},C)})}):null]})}var Wu=Object.assign(W1,{docxSlot:"font.size"});function z1({className:e,hidden:t}){let o=F(),{zoom:n,isFit:r,mode:i,setZoom:a,setMode:s,zoomIn:l,zoomOut:c,canZoomIn:d,canZoomOut:f,levels:u}=Zu(),g=X(),[m,p]=Pt.useState(false),v=Pt.useRef(null);fo(v,m,()=>p(false)),Pt.useEffect(()=>{if(!m)return;let C=P=>{let T=v.current;T&&P.target instanceof Node&&T.contains(P.target)||p(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[m]);let y=Pt.useCallback(C=>{v.current?.querySelector("[aria-haspopup]")?.focus(),p(false),a(C);},[a]),x=Pt.useCallback(C=>{v.current?.querySelector("[aria-haspopup]")?.focus(),p(false),s(C==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[s]);if(t)return null;let h=`${Math.round(n*100)}%`,b=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),S=editor.sameZoomMode(i,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:v,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(ch,{className:e,groupLabel:g("zoom.zoomLevel"),decreaseLabel:g("zoom.zoomOut"),increaseLabel:g("zoom.zoomIn"),middle:jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--menu",disabled:!o,"aria-haspopup":"listbox","aria-expanded":m,"aria-label":`${g("zoom.zoomLevel")}: ${h}`,onMouseDown:B,onClick:()=>p(C=>!C),children:[h,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:f,canIncrease:d,onDecrease:c,onIncrease:l}),m?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox",tabIndex:0,"aria-label":g("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":b,...b?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>x("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>x("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),u.map(C=>{let P=!r&&Math.abs(C-n)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":P,...P?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>y(C),children:`${Math.round(C*100)}%`},C)})]}):null]})}var zu=Object.assign(z1,{docxSlot:"zoom.level"});function wn(e,t,o,n=false){let r=Ye(),i=Pt.useRef(r);i.current=r,Pt.useEffect(()=>{e&&n&&t(false);},[e,n,t]),Pt.useEffect(()=>{let a=o.current;if(!e||n||!a)return;let s=a.ownerDocument,l=u=>a.contains(u),c=u=>{u.composedPath().includes(a)||t(false);},d=editor.listenForPopupEscape({popup:a,contains:l,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current],close:u=>{t(false),u&&a.querySelector("[aria-haspopup]")?.focus();}}),f=editor.listenForPopupFocusLeave({popup:a,contains:l,close:()=>t(false)});return s.addEventListener("mousedown",c),()=>{s.removeEventListener("mousedown",c),d(),f();}},[e,n,t,o]);}var Y1=[1,1.15,1.5,2,2.5,3],mh=10,fh=0,X1=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),J1=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Q1({className:e,hidden:t}){let o=F(),n=O(X1,J1),{isEnabled:r,disabledReason:i}=ie("list.lineSpacing"),a=ie("paragraph.dialog"),s=v0(),l=X(),[c,d]=Pt.useState(false),f=Pt.useRef(null),u=Pt.useRef(null);wn(c,d,f,t);let g=Pt.useCallback(h=>{if(d(false),!o)return;let b=editor.commandForSlotValue("list.lineSpacing",h);b&&o.can(b).ok&&o.exec(b);},[o]),m=Pt.useCallback((h,b)=>{if(d(false),!o)return;let S={type:"setParagraphSpacing",[h]:b};o.can(S).ok&&o.exec(S);},[o]);if(t)return null;let p=J("list.lineSpacing"),v=(n.spaceBeforePt??0)>0,y=(n.spaceAfterPt??0)>0,x=n.lineSpacing?.rule==="multiple"?n.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{ref:u,type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":c,"aria-label":l("lineSpacing.label"),title:i??l("lineSpacing.label"),onMouseDown:B,onClick:()=>d(h=>!h),children:[re(p?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),c&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[Y1.map(h=>{let b=x===h;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":b,...b?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>g(h),children:Number.isInteger(h*10)?h.toFixed(1):h.toFixed(2)},h)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item","data-slot":"paragraph.dialog",disabled:!a.isEnabled,title:a.disabledReason??void 0,onMouseDown:B,onClick:()=>{d(false),s?.open(u.current);},children:l("lineSpacing.options")}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>m("beforePt",v?fh:mh),children:l(v?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>m("afterPt",y?fh:mh),children:l(y?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Uu=Object.assign(Q1,{docxSlot:"list.lineSpacing"});var oM=["alignment.left","alignment.center","alignment.right","alignment.justify"];function nM({className:e,hidden:t}){let o=ie("alignment.left"),n=ie("alignment.center"),r=ie("alignment.right"),i=ie("alignment.justify"),a=X(),[s,l]=Pt.useState(false),c=Pt.useRef(null);if(wn(s,l,c,t),t)return null;let d=[o,n,r,i],f=oM.map((p,v)=>({slot:p,control:J(p),state:d[v]})),u=f.find(p=>p.state.isActive)??f[0],g=f.some(p=>p.state.isEnabled),m=a(u.control?.labelKey??u.slot);return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":s,"aria-label":m,title:g?m:u.state.disabledReason??m,onMouseDown:B,onClick:()=>l(p=>!p),children:[re(u.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:f.map(p=>{let v=a(p.control?.labelKey??p.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":p.slot,disabled:!p.state.isEnabled,...p.state.isActive?{"data-active":""}:{},"aria-pressed":p.state.isActive,"aria-label":v,title:p.state.disabledReason??v,onMouseDown:B,onClick:()=>{p.state.execute(),l(false);},children:re(p.control?.paths)},p.slot)})}):null]})}var Jl=Object.assign(nM,{docxSlot:"alignment"});function Gu(e){let{label:t,icon:o,active:n,disabled:r,disabledReason:i,onSelect:a,asChild:s,className:l,children:c}=e,d=M0(),f=Rr();if(d==="panel"&&!s)return jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__more-command${l?` ${l}`:""}`,disabled:r,...n?{"data-active":""}:{},...n!==void 0?{"aria-pressed":n}:{},...r&&i?{title:i}:{},onMouseDown:g=>B(g),onClick:g=>{a?.(),f(g.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:o??c}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:t})]});let u={type:"button",className:`docx-toolbar__button${l?` ${l}`:""}`,disabled:r,...n?{"data-active":""}:{},...r?{"data-disabled":""}:{},...n!==void 0?{"aria-pressed":n}:{},"aria-label":t,title:r?i??t:t,onMouseDown:g=>B(g),onClick:r?void 0:a};return s?jsxRuntime.jsx(j,{...u,children:c}):jsxRuntime.jsx("button",{...u,children:o??c})}var dM=Object.freeze([]),uM=e=>e.formatting?.fontFamily??null,pM=e=>e;function ts(){let e=F(),t=O(uM),o=O(pM),n=Pt.useMemo(()=>e&&!o.isLoading?e.getAvailableFonts():dM,[e,o]),{isEnabled:r}=ie("font.family"),i=Pt.useCallback(a=>{if(!e)return;let s=editor.commandForSlotValue("font.family",a);s&&e.can(s).ok&&e.exec(s);},[e]);return Pt.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var vh=Pt.createContext(null);function Yu(){return Pt.useContext(vh)}function Xu({asChild:e,className:t,children:o}){let n=Yu(),r=X();if(!n)return null;let i=r(J("font.family")?.labelKey??"font.family"),a={onClick:()=>n.setOpen(!n.open),onMouseDown:B,disabled:!n.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,"aria-label":o!==void 0?void 0:`${i}: ${n.value??"\u2014"}`,title:i},s=o??jsxRuntime.jsx("span",{children:n.value??"\u2014"});return e?jsxRuntime.jsx(j,{...a,children:s}):jsxRuntime.jsx("button",{type:"button",...a,children:s})}Xu.docxToolbarPart=true;var mM=new Map([["arial","sansSerif"],["calibri","sansSerif"],["helvetica","sansSerif"],["verdana","sansSerif"],["open sans","sansSerif"],["roboto","sansSerif"],["times new roman","serif"],["georgia","serif"],["cambria","serif"],["garamond","serif"],["courier new","monospace"],["consolas","monospace"]]),fM=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function yh({asChild:e,className:t,children:o}){let n=Yu(),r=X(),[i,a]=Pt.useState("");if(Pt.useEffect(()=>{n?.open||a("");},[n?.open]),!n||!n.open)return null;let s={role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`},l;return o!==void 0?l=o:l=fM.map(d=>({...d,fonts:n.options.filter(f=>f.toLowerCase().includes(i.toLowerCase())&&(mM.get(f.toLowerCase())??"other")===d.category)})).filter(d=>d.fonts.length>0).map((d,f)=>jsxRuntime.jsxs("div",{role:"group",children:[f>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator","aria-hidden":"true"}):null,d.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(d.labelKey)}):null,d.fonts.map(u=>jsxRuntime.jsx(xh,{value:u},u))]},d.category)),e?jsxRuntime.jsx(j,{...s,children:l}):o!==void 0?jsxRuntime.jsx("div",{...s,children:l}):jsxRuntime.jsxs("div",{className:s.className,children:[jsxRuntime.jsx("input",{type:"search",className:"docx-toolbar__font-search","aria-label":r("font.search"),placeholder:r("font.search"),value:i,onChange:c=>a(c.target.value)}),jsxRuntime.jsx("div",{role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:"docx-toolbar__font-options",children:l})]})}function xh({value:e,asChild:t,className:o,children:n}){let r=F(),i=Yu();if(!i)return null;let a=i.value===e,s={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:B,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__font-family-item${o?` ${o}`:""}`},l=n??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(j,{...s,children:l}):jsxRuntime.jsxs("button",{type:"button",...s,children:[l,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function gM({hidden:e,asChild:t,className:o,children:n}){let r=ts(),[i,a]=Pt.useState(false),s=Pt.useRef(null);fo(s,i,()=>a(false)),Pt.useEffect(()=>{if(!i)return;let f=u=>{let g=s.current;g&&u.target instanceof Node&&g.contains(u.target)||a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]);let l=Pt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__font-family${o?` ${o}`:""}`,"data-slot":"font.family"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xu,{}),jsxRuntime.jsx(yh,{})]});return jsxRuntime.jsx(vh.Provider,{value:l,children:t?jsxRuntime.jsx(j,{...c,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...c,children:d})})}var Ju=Object.assign(gM,{docxSlot:"font.family",Trigger:Xu,Content:yh,Item:xh});var bM={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},vM=new Set(["Title","Heading1","Heading2","Heading3"]),yM={Subtitle:"666666"},xM="#4a6c8c";function Ch(e){let t=bM[e.styleId],n={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??vM.has(e.styleId))&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic");let r=e.color??yM[e.styleId];return r?n.color=`#${r}`:e.styleId.startsWith("Heading")&&(n.color=xM),n}var CM=/^heading ([1-9])$/;function Qu(e,t){let o=e||t,n=CM.exec(o);return n?`Heading ${n[1]}`:o}function Th(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:Qu(t.name,t.styleId),priority:99}))}function DM(e){let t=e.fontSizePt;return {...e.fontFamily?{fontFamily:e.fontFamily}:{},...t?{fontSize:`${Math.min(Math.max(t,9),20)}px`}:{},...e.bold?{fontWeight:700}:{},...e.italic?{fontStyle:"italic"}:{},...e.color?{color:`#${e.color}`}:{}}}var kM=Object.freeze([]),IM=e=>e.formatting?.styleId??null,_M=e=>e;function os(){let e=F(),t=O(IM),o=O(_M),n=Pt.useMemo(()=>e&&!o.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:Qu(a.name,a.styleId),preview:a.preview})):kM,[e,o]),{isEnabled:r}=ie("styles.style"),i=Pt.useCallback(a=>{if(!e)return;let s=editor.commandForSlotValue("styles.style",a);s&&e.can(s).ok&&e.exec(s);},[e]);return Pt.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var Ph=Pt.createContext(null);function tp(){return Pt.useContext(Ph)}function op({asChild:e,className:t,children:o}){let n=tp(),r=X();if(!n)return null;let i=J("styles.style"),a=r(i?.labelKey??"styles.style"),s={onClick:()=>n.setOpen(!n.open),onMouseDown:B,disabled:!n.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,title:a},l=n.options.find(d=>d.styleId===n.value),c=o??(n.value===null?jsxRuntime.jsx("span",{children:i?.valueKey?r(i.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:l?.name??n.value}));return e?jsxRuntime.jsx(j,{...s,children:c}):jsxRuntime.jsx("button",{type:"button",...s,children:c})}op.docxToolbarPart=true;function Sh({asChild:e,className:t,children:o}){let n=X(),r=tp();if(!r||!r.open)return null;let i={role:"listbox",tabIndex:0,"aria-label":n("styles.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`},a=o??r.options.map(s=>jsxRuntime.jsx(Eh,{value:s.styleId},s.styleId));return e?jsxRuntime.jsx(j,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function Eh({value:e,asChild:t,className:o,children:n}){let r=F(),i=tp();if(!i)return null;let a=i.value===e,s=i.options.find(d=>d.styleId===e),l={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:B,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__style-item${o?` ${o}`:""}`},c=n??jsxRuntime.jsx("span",{style:s?DM(s.preview):void 0,children:s?.name??e});return t?jsxRuntime.jsx(j,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function NM({hidden:e,asChild:t,className:o,children:n}){let r=os(),[i,a]=Pt.useState(false),s=Pt.useRef(null);fo(s,i,()=>a(false)),Pt.useEffect(()=>{if(!i)return;let f=u=>{let g=s.current;g&&u.target instanceof Node&&g.contains(u.target)||a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]);let l=Pt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__style${o?` ${o}`:""}`,"data-slot":"styles.style"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(op,{}),jsxRuntime.jsx(Sh,{})]});return jsxRuntime.jsx(Ph.Provider,{value:l,children:t?jsxRuntime.jsx(j,{...c,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...c,children:d})})}var np=Object.assign(NM,{docxSlot:"styles.style",Trigger:op,Content:Sh,Item:Eh});function Mh(e,t){let o=e;return Object.assign(({className:r,hidden:i,icon:a,asChild:s,children:l})=>{let{isEnabled:c,disabledReason:d}=ie(o),f=Qt(),u=t==="showAll"?f.showAll:f.formFill,g=X();if(i)return null;let m=J(o),p=g(m?.labelKey??e),v={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!c,...c?{}:{"data-disabled":""},...u?{"data-active":""}:{},"aria-pressed":u,"aria-label":p,title:d??p,onMouseDown:B,onClick:()=>{t==="showAll"?f.toggleShowAll():f.toggleFormFill();}};return s?jsxRuntime.jsx(j,{...v,children:l}):jsxRuntime.jsx("button",{...v,children:a??l??re(m?.paths)})},{docxSlot:o})}function FM({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=ft.inspector,{isEnabled:a,disabledReason:s}=ie(i),{inspectorOpen:l,openInspector:c}=Qt(),d=X();if(t)return null;let f=J(i),u=d(f?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":ft.inspector,disabled:!a,...a?{}:{"data-disabled":""},...l?{"data-active":""}:{},"aria-pressed":l,"aria-label":u,title:s??u,onMouseDown:B,onClick:()=>c()};return n?jsxRuntime.jsx(j,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:o??r??re(f?.paths)})}function HM({className:e,hidden:t,icon:o,asChild:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:s}=Qt(),l=X();if(t)return null;let c=ft.remove,d=J(c),f=l(d?.labelKey??"contentControl.remove"),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":ft.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":f,title:a??f,onMouseDown:B,onClick:()=>{s();}};return n?jsxRuntime.jsx(j,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??re(d?.paths)})}var ns=Mh(ft.showAll,"showAll"),rs=Mh(ft.formFill,"formFill"),as=Object.assign(HM,{docxSlot:ft.remove}),is=Object.assign(FM,{docxSlot:ft.inspector}),Rh={[ft.showAll]:ns,[ft.formFill]:rs,[ft.inspector]:is,[ft.remove]:as};function rp(e,t){let o=F(),n=Pt.useRef(t);n.current=t,Pt.useEffect(()=>{if(!o)return;let r=((...i)=>{n.current(...i);});return o.on(e,r)},[o,e]);}var WM=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],ip=Pt.createContext(null);function Fh(){let e=Pt.useContext(ip);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function $M(e,t){let o=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",i=o?`${r}|${o.rows}|${o.columns}|${o.rowIndex}|${o.columnIndex}`:"",a=t.selection,s=a?`${a.from&&"paraId"in a.from?a.from.paraId:""}|${a.to&&"paraId"in a.to?a.to.paraId:""}|${t.selectionCollapsed}`:"",l=e?.getTableCellSelection()??null,c=l?`${l.tableId}|${l.rows.from}-${l.rows.to}|${l.columns.from}-${l.columns.to}|${l.cellIds.join(",")}`:"";return {tableKey:i,selectionKey:s,cellSelectionKey:c,editable:t.editable,editingMode:t.editingMode??"editing"}}function UM(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function VM(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var Nh={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function GM(e,t){let o={};for(let n of WM){let r=editor.tableChromeToolbarState(e,n,t);o[n]={enabled:r.enabled,disabledReason:r.disabledReason};}return o}function lp({children:e}){let t=F(),[o,n]=Pt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=Pt.useState(Nh);Pt.useEffect(()=>(()=>{}),[]);let a=O(Pt.useCallback(u=>({table:u.table,editable:u.editable,editingMode:u.editingMode??"editing",headParagraphId:u.selection?.to&&"paraId"in u.selection.to?u.selection.to.paraId:u.selection?.from&&"paraId"in u.selection.from?u.selection.from.paraId:""}),[]),UM,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),s=Pt.useCallback(()=>{if(!t){i(Nh);return}let u=$M(t,t.snapshot());i(g=>VM(g,u)?g:u);},[t]);Pt.useEffect(()=>{s();},[s,a]),rp("selectionChange",Pt.useCallback(()=>{s();},[s]));let l=r.tableKey!=="",c=Pt.useMemo(()=>t?GM(t,o):{},[t,o,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Pt.useCallback((u,g)=>{if(!t)return;let{result:m,nextDraft:p}=editor.runTableChromeCommand(t,u,g,o);m.ok&&p&&n(p);},[t,o]),f=Pt.useMemo(()=>({visible:l,draft:o,setDraft:n,slotState:u=>c[u]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[l,o,c,d]);return jsxRuntime.jsx(ip.Provider,{value:f,children:e})}function jM(){let e=Pt.useContext(ip);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ss(e){let t=jM(),o=t.slotState(e);return Pt.useMemo(()=>({visible:t.visible,enabled:o.enabled,disabledReason:o.disabledReason,draft:t.draft,apply:n=>t.apply(e,n)}),[t,e,o])}function cs(e){(editor.editorInstanceScope(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function ds({enabled:e,disabledReason:t,ariaLabel:o}){let{t:n}=N(),r=i18n.localizeDisabledReason(t,n),i=Pt.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:B,"aria-label":o,...a?{"aria-describedby":a}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:a&&r?jsxRuntime.jsx("span",{id:i,className:"docx-editor-sr-only",children:r}):null}}var eR='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function Ah(e,t,o,n){Pt.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll(eR)].filter(c=>c.closest('[role="menu"]')===r);queueMicrotask(()=>{let c=a();(c.find(f=>f.hasAttribute("data-selected")||f.hasAttribute("data-active"))??c[0])?.focus();});let l=c=>{if(c.defaultPrevented||c.isComposing||c.keyCode===229)return;let d=a();if(c.key==="Escape"){c.preventDefault(),t(false),i?.focus();return}if(c.key==="ArrowDown"){c.preventDefault(),Ht(d,document.activeElement,1);return}if(c.key==="ArrowUp"){c.preventDefault(),Ht(d,document.activeElement,-1);return}if(c.key==="Home"){c.preventDefault(),At(d,"first");return}if(c.key==="End"){c.preventDefault(),At(d,"last");return}if(c.key==="Enter"||c.key===" "){let f=document.activeElement;f instanceof HTMLElement&&d.includes(f)&&(c.preventDefault(),f.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,o,n]);}function Oh(e,t,o,n){Pt.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(l=>l.closest('[role="dialog"]')===r);queueMicrotask(()=>{a()[0]?.focus();});let s=l=>{if(l.key==="Escape"){l.preventDefault(),t(false),i?.focus();return}if(l.key==="Enter"||l.key===" "){let c=document.activeElement,d=a();c instanceof HTMLElement&&d.includes(c)&&(l.preventDefault(),c.click());}};return r.addEventListener("keydown",s),()=>r.removeEventListener("keydown",s)},[e,t,o,n]);}function Wh(e,t,o){if(e)return n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),o(!t));}}function lR(e){return re(editor.tableChromeIconPaths(e))}function zh(){return Pt.createContext(null)}function Co(e){let t=Pt.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function cp(e,t,o){let n=zh();function r({hidden:s,asChild:l,className:c,children:d}){let{visible:f,enabled:u,disabledReason:g,draft:m,apply:p}=ss(e),[v,y]=Pt.useState(false),x=Pt.useRef(null),h=Pt.useRef(null);wn(v,y,x,s||!f);let b=Pt.useMemo(()=>({open:v,setOpen:y,enabled:u,disabledReason:g,apply:p,draft:m,triggerRef:h}),[v,u,g,p,m]);if(s||!f)return null;let S={className:`${t}${c?` ${c}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},C=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(a,{})]});return jsxRuntime.jsx(n.Provider,{value:b,children:l?jsxRuntime.jsx(j,{...S,ref:x,children:C}):jsxRuntime.jsx("div",{ref:x,...S,children:C})})}function i({asChild:s,className:l,children:c}){let{open:d,setOpen:f,enabled:u,disabledReason:g,triggerRef:m}=Co(n),p=X(),v=J(e),y=p(v?.labelKey??o),{shared:x,reasonNode:h}=ds({enabled:u,disabledReason:g,ariaLabel:y}),b={...x,ref:m,className:`docx-toolbar__button docx-table-chrome__trigger${l?` ${l}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:u?()=>f(!d):void 0,...s?{tabIndex:u?0:-1,role:"button",onKeyDown:Wh(u,d,f)}:{}},S=c??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re(v?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...b,children:S}),h]}):jsxRuntime.jsxs("button",{...b,children:[S,h]})}i.docxToolbarPart=true;function a({asChild:s,className:l,children:c}){let{open:d,setOpen:f,enabled:u,triggerRef:g}=Co(n),m=X(),p=Pt.useRef(null);if(Ah(d&&u,f,p,g),!d||!u)return null;let v=J(e),y=m(v?.labelKey??o),x={ref:p,role:"menu","aria-label":y,className:`docx-table-chrome__panel${l?` ${l}`:""}`,onMouseDown:B};return s?jsxRuntime.jsx(j,{...x,children:c}):jsxRuntime.jsx("div",{...x,children:c})}return {Root:r,Trigger:i,Content:a,Ctx:n}}var Va=cp("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function $h({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(Va.Ctx),s=X(),l=editor.TABLE_BORDER_TARGET_OPTIONS.find(u=>u.value===e);if(!l)return null;let c=l.value==="none"?false:l.value===a.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":c,"data-value":l.value,className:`docx-table-chrome__target-btn${o?` ${o}`:""}`,...c?{"data-active":""}:{},"aria-label":s(l.labelKey),title:s(l.labelKey),onMouseDown:B,onClick:()=>{i(false),r(l.value);}},f=n??lR(l.icon);return t?jsxRuntime.jsx(j,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function Uh(e){let{children:t}=e;return jsxRuntime.jsx(Va.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(o=>jsxRuntime.jsx($h,{value:o.value},o.value))})})}function sR(e){let{children:t}=e,o=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Va.Trigger,{}),jsxRuntime.jsx(Uh,{})]});return jsxRuntime.jsx(Va.Root,{...e,children:o})}var Ja=Object.assign(sR,{docxSlot:"table.borderTarget",Trigger:Va.Trigger,Content:Uh,Item:$h}),Ga=cp("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Vh({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(Ga.Ctx),s=X(),l=editor.TABLE_BORDER_STYLE_OPTIONS.find(u=>u.value===e);if(!l)return null;let c=l.value===a.spec.style,d={type:"button",role:"menuitemradio","aria-checked":c,...c?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:B,onClick:()=>{i(false),r(l.value);}},f=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${l.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(l.labelKey)})]});return t?jsxRuntime.jsx(j,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function Gh(e){let{children:t}=e;return jsxRuntime.jsx(Ga.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(o=>jsxRuntime.jsx(Vh,{value:o.value},o.value))})}function cR(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ga.Trigger,{}),jsxRuntime.jsx(Gh,{})]});return jsxRuntime.jsx(Ga.Root,{...e,children:t})}var Qa=Object.assign(cR,{docxSlot:"table.borderStyle",Trigger:Ga.Trigger,Content:Gh,Item:Vh}),ja=cp("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function jh({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(ja.Ctx),s=X(),l=Number(e),c=editor.TABLE_BORDER_WIDTH_OPTIONS.find(g=>g.size===l);if(!c)return null;let d=c.size===a.spec.size,f={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:B,onClick:()=>{i(false),r(c.size);}},u=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${c.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(c.labelKey)})]});return t?jsxRuntime.jsx(j,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}function Yh(e){let{children:t}=e;return jsxRuntime.jsx(ja.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(o=>jsxRuntime.jsx(jh,{value:String(o.size)},o.size))})}function dR(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ja.Trigger,{}),jsxRuntime.jsx(Yh,{})]});return jsxRuntime.jsx(ja.Root,{...e,children:t})}var ei=Object.assign(dR,{docxSlot:"table.borderWidth",Trigger:ja.Trigger,Content:Yh,Item:jh});function Xh(e,t,o){let n=o?.defaultHex??"FF0000",r=zh();function i({hidden:d,asChild:f,className:u,children:g}){let{visible:m,enabled:p,disabledReason:v,draft:y,apply:x}=ss(e),[h,b]=Pt.useState(false),[S,C]=Pt.useState(n),P=Pt.useRef(null),T=Pt.useRef(null);wn(h,b,P,d||!m);let R=Pt.useMemo(()=>({open:h,setOpen:b,enabled:p,disabledReason:v,apply:x,draft:y,triggerRef:T,lastHex:S,setLastHex:C}),[h,p,v,x,y,S]);if(d||!m)return null;let M={className:`docx-toolbar__colorsplit docx-table-chrome${u?` ${u}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},E=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(s,{}),jsxRuntime.jsx(l,{clearFill:o?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:R,children:f?jsxRuntime.jsx(j,{...M,ref:P,children:E}):jsxRuntime.jsx("div",{ref:P,...M,children:E})})}function a({asChild:d,className:f,children:u}){let{enabled:g,disabledReason:m,apply:p,draft:v,lastHex:y}=Co(r),x=X(),h=J(e),b=x(h?.labelKey??t),{shared:S,reasonNode:C}=ds({enabled:g,disabledReason:m,ariaLabel:b}),P=e==="table.borderColor"&&v.spec.color.kind==="hex"?v.spec.color.value:y??n,T={...S,className:`docx-toolbar__button docx-toolbar__colorsplit-main${f?` ${f}`:""}`,onClick:g?()=>p({kind:"hex",value:P}):void 0},R=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re(h?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${P.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...T,children:R}),C]}):jsxRuntime.jsxs("button",{...T,children:[R,C]})}a.docxToolbarPart=true;function s({asChild:d,className:f,children:u}){let{open:g,setOpen:m,enabled:p,disabledReason:v,triggerRef:y}=Co(r),x=X(),h=J(e),b=x(h?.labelKey??t),{shared:S,reasonNode:C}=ds({enabled:p,disabledReason:v,ariaLabel:b}),P={...S,ref:y,className:`docx-toolbar__colorsplit-caret${f?` ${f}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:p?()=>m(!g):void 0,...d?{tabIndex:p?0:-1,role:"button",onKeyDown:Wh(p,g,m)}:{}},T=u??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...P,children:T}),C]}):jsxRuntime.jsxs("button",{...P,children:[T,C]})}s.docxToolbarPart=true;function l({asChild:d,className:f,children:u,clearFill:g}){let{open:m,setOpen:p,enabled:v,apply:y,draft:x,triggerRef:h,lastHex:b,setLastHex:S}=Co(r),C=X(),P=Pt.useRef(null);if(Oh(m&&v,p,P,h),!m||!v)return null;let T=C(t),R=e==="table.borderColor"&&x.spec.color.kind==="hex"?x.spec.color.value:b??n,M={ref:P,role:"dialog","aria-label":T,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${f?` ${f}`:""}`,onMouseDown:B},E=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>{p(false),y(null),cs(h.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),C("table.clearCellFill")]}):null,jsxRuntime.jsx(Mc,{apply:_=>{p(false),S?.(_),y({kind:"hex",value:_}),cs(h.current);},current:R})]});return d?jsxRuntime.jsx(j,{...M,children:E}):jsxRuntime.jsx("div",{...M,children:E})}function c({value:d,css:f,labelKey:u,asChild:g,className:m,children:p}){let{apply:v,setOpen:y,setLastHex:x,triggerRef:h}=Co(r),b=X(),S=f??`#${d.toLowerCase()}`,C=u?b(u):d,P={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${m?` ${m}`:""}`,style:{backgroundColor:S},"data-value":d,"aria-label":C,title:C,onMouseDown:B,onClick:()=>{y(false),x?.(d),v({kind:"hex",value:d}),cs(h.current);}};return g?jsxRuntime.jsx(j,{...P,children:p}):jsxRuntime.jsx("button",{...P,children:p})}return {Root:i,Main:a,Trigger:s,Content:l,Item:c,Ctx:r}}var Ya=Xh("table.borderColor","table.borderColor",{defaultHex:"000000"});function uR(e){return jsxRuntime.jsx(Ya.Content,{...e,clearFill:false})}function pR(e){return jsxRuntime.jsx(Ya.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function mR(e){return jsxRuntime.jsx(Ya.Root,{...e})}var ti=Object.assign(mR,{docxSlot:"table.borderColor",Trigger:Ya.Trigger,Content:uR,Item:pR,Main:Ya.Main}),Xa=Xh("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function fR(e){return jsxRuntime.jsx(Xa.Content,{...e,clearFill:true})}function gR(e){return jsxRuntime.jsx(Xa.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function hR(e){return jsxRuntime.jsx(Xa.Root,{...e})}var oi=Object.assign(hR,{docxSlot:"table.cellFill",Trigger:Xa.Trigger,Content:fR,Item:gR,Main:Xa.Main});function Jh({overrides:e=new Map,separator:t=true}){return Fh()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(En,{}):null,[Ja,ti,Qa,ei,oi].map(r=>{let i=e.get(r.docxSlot);return i?jsxRuntime.jsx(Pt.Fragment,{children:i},r.docxSlot):jsxRuntime.jsx(r,{},r.docxSlot)})]}):null}function Qh(){let e=X(),{draft:t}=ss("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var up=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Nr="contextual-table",pp={"zoom.level":zu,"styles.style":np,"font.family":Ju,"font.size":Wu,"text.color":Rc,"text.highlight":Dc,"text.link":Ou,"list.lineSpacing":Uu,"review.editingMode":Kl,"review.authors":zl,"file.save":Bu,...Rh,"table.borderTarget":Ja,"table.borderColor":ti,"table.borderStyle":Qa,"table.borderWidth":ei,"table.cellFill":oi,"image.insert":sa,"image.properties":Cr,"image.wrap":Za,"image.altText":Pa},us={id:Nr,labelKey:"formattingBar.groups.table",entries:up.map(e=>({slot:e,Part:pp[e]}))},eb=new Map;function PR(e){let t=eb.get(e);return t||(t=o=>jsxRuntime.jsx(sn,{slotId:e,...o}),eb.set(e,t)),t}function SR(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:Jl}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(o=>{let n=editor.chromeSlotId(t,o);return {slot:n,Part:pp[n]??PR(n)}})})}var ER=e=>e.image,wR=e=>e.isLoading||e.isOpening===true,MR=e=>e.table!==null;function RR(e){return e==="alignment"||e in pp}function ms(e){let t=tr(e,ms);if(t!==null)return t;if(!Pt.isValidElement(e))return null;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxToolbarSlot===true){let n=e.props.slotId;return typeof n=="string"?n:null}if(o.docxToolbarPart===true){let n=e.props,r=n.slotId??n.slot;if(typeof r=="string")return r}return null}function dp(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(dp);let t=ms(e);return t!=null&&up.includes(t)?true:Pt.isValidElement(e)?Pt.Children.toArray(e.props.children).some(dp):false}function DR(e,t){return t?true:Pt.Children.toArray(e).some(dp)}function kR(e){let t=Ct(),{className:o,t:n,onSave:r,preset:i=true,overflow:a=true,children:s}=e,l=Pt.useMemo(()=>({t:n,onSave:r}),[n,r]),c=Oi(n),d=O(ER),f=O(wR),u=O(MR),g=Pt.useMemo(()=>SR(d),[d]),m=Pt.useMemo(()=>new Set(g.flatMap(P=>P.entries.map(T=>T.slot))),[g]),p=Pt.useMemo(()=>i?w0(s,ms,P=>m.has(P),P=>up.includes(P)):null,[i,s,m]),v=Pt.useMemo(()=>p?IR(g,p):[],[g,p]),y=Pt.useMemo(()=>[...v.filter(P=>!P.pinned).map(P=>P.id),...u?[Nr]:[]],[v,u]),x=Pt.useMemo(()=>{let P=new Map;for(let T of v)T.priority!==void 0&&P.set(T.id,T.priority);return editor.collapseOrder(y,editor.TOOLBAR_COLLAPSE_ORDER,P)},[v,y]),h=i&&a,{attach:b,overflow:S}=Xi(h,y,x),C;if(!p)C=s;else {let{overrides:P,tableOverrides:T,appended:R}=p,M=w=>{let I=P.get(w.slot);if(I)return I;let $=w.Part;return jsxRuntime.jsx($,{})},E=w=>{let I=T.get(w.slot);if(I)return I;let $=w.Part;return jsxRuntime.jsx($,{})},_=[],H=[],L=0;for(let w of v){if(S.has(w.id)){let I=w.entries.flatMap(W=>{let ee=tb(W,P,c,w.labelKey,M);return ee===null?[]:[jsxRuntime.jsx(Pt.Fragment,{children:ee},W.slot)]}),$=NR(w);if($!==null&&I.push(jsxRuntime.jsx(Pt.Fragment,{children:$},"host")),I.length===0)continue;H.push({id:w.id,labelKey:w.labelKey,...w.heading?{label:Ul(w.heading,c)}:{},children:I});continue}L>0&&_.push(jsxRuntime.jsx(En,{},`separator-${w.id}`)),L+=1,_.push(jsxRuntime.jsxs("div",{className:`docx-toolbar__group${w.className?` ${w.className}`:""}`,...w.heading?{role:"group","aria-label":Ul(w.heading,c)}:{},...w.pinned?{[fn]:""}:{[Fo]:w.id},children:[w.entries.map(I=>jsxRuntime.jsx(Pt.Fragment,{children:M(I)},I.slot)),w.extras.length>0?jsxRuntime.jsx(Pt.Fragment,{children:w.extras},"host"):null]},w.id));}let k=S.has(Nr);if(u&&k){let w=us.entries.flatMap(I=>{let $=tb(I,T,c,us.labelKey,E);return $===null?[]:[jsxRuntime.jsx(Pt.Fragment,{children:$},I.slot)]});w.length>0&&H.unshift({id:us.id,labelKey:us.labelKey,children:w});}C=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_,u&&!k?jsxRuntime.jsx(En,{},"separator-contextual-table"):null,k?null:jsxRuntime.jsx("div",{className:"docx-toolbar__contextual",[Fo]:Nr,children:jsxRuntime.jsx(Jh,{overrides:T,separator:false})}),R.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[fn]:"",children:R}):null,H.length>0?jsxRuntime.jsx(S0,{sections:H}):null]});}return jsxRuntime.jsx(ln.Provider,{value:l,children:jsxRuntime.jsx(b0,{children:jsxRuntime.jsx("fieldset",{ref:b,disabled:f,"aria-label":c("formattingBar.label"),"data-testid":"docx-toolbar",className:`${t}docx-toolbar${o?` ${o}`:""}`,...h?{"data-overflow":""}:{},onMouseDown:B,children:DR(s,i)?jsxRuntime.jsx(lp,{children:C}):C})})})}function mp(e){if(!e)return false;if(e.type===Pt.Fragment){let t=Pt.Children.toArray(e.props.children).find(o=>ms(o)!==null);return Pt.isValidElement(t)?mp(t):false}return !!e.props.hidden}function IR(e,t){let o=new Map(t.groups.map(l=>[l.id,l])),n=new Set(e.map(l=>l.id)),r=new Map;for(let l of e){let c=o.get(l.id);if(c&&_R(c),c?.hidden)continue;let d=Pt.Children.toArray(c?.children);!l.entries.some(u=>!mp(t.overrides.get(u.slot)))&&d.length===0||r.set(l.id,{id:l.id,labelKey:l.labelKey,heading:void 0,entries:l.entries,extras:d,pinned:c?.pinned??editor.TOOLBAR_PINNED_GROUPS.has(l.id),priority:c?.priority,overflowContent:c?.overflowContent,className:c?.className,host:false});}for(let l of t.groups)l.id===Nr&&N0(l.id);let i=t.groups.filter(l=>!n.has(l.id)&&l.id!==Nr);for(let l of i){let c=Pt.Children.toArray(l.children);l.hidden||c.length===0||r.set(l.id,{id:l.id,labelKey:l.labelKey??l.id,heading:{id:l.id,label:l.label,labelKey:l.labelKey},entries:[],extras:c,pinned:l.pinned===true,priority:l.priority,overflowContent:l.overflowContent,className:l.className,host:true});}let a=[...n,...i.map(l=>l.id)];for(let l of i)l.after!==void 0&&!a.includes(l.after)&&I0(l.id,l.after,a);for(let l of t.appended){if(!Pt.isValidElement(l)||l.type!==Ba)continue;let c=l.props.slotId;L0(c,J(c)!==null);}return editor.arrangeToolbarGroups(e.map(l=>l.id),i.map(l=>({id:l.id,after:l.after}))).flatMap(l=>{let c=r.get(l);return c?[c]:[]})}function _R(e){for(let t of ["label","labelKey","after"])e[t]!==void 0&&_0(e.id,t);}function NR(e){return e.overflowContent?e.overflowContent():e.extras.length===0?null:jsxRuntime.jsx(_u.Provider,{value:"panel",children:jsxRuntime.jsx("div",{className:"docx-toolbar__more-host",children:e.extras})})}function tb(e,t,o,n,r){let i=t.get(e.slot);if(mp(i))return null;let a=i?.type===Ba?i.props.overflowContent:void 0;return i||RR(e.slot)?jsxRuntime.jsx(T0,{label:LR(o,e,n),children:a?a():r(e)}):jsxRuntime.jsx(P0,{slot:e.slot})}function LR(e,t,o){let n=t.slot==="alignment"?null:J(t.slot);return e(n?.labelKey??o)}var ri=Object.assign(kR,{Button:sn,Action:Gu,Separator:En,Group:Iu,Slot:Ba,AddComment:Nu,Undo:H0,Redo:A0,Bold:O0,Italic:B0,Underline:Z0,Strike:q0,Link:Ou,ClearFormatting:K0,Superscript:W0,Subscript:z0,Alignment:Jl,AlignLeft:$0,AlignCenter:U0,AlignRight:V0,AlignJustify:G0,LeftToRight:j0,RightToLeft:Y0,LineSpacing:Uu,BulletList:X0,NumberedList:J0,Outdent:Q0,Indent:eh,ImageInsert:sa,ImageProperties:Cr,ImageWrap:Za,ImageAltText:Pa,TableInsert:Au,TableBorderTarget:Ja,TableBorderColor:ti,TableBorderStyle:Qa,TableBorderWidth:ei,TableCellFill:oi,Comments:th,FontFamily:Ju,FontSize:Wu,FontColor:Rc,Highlight:Dc,Zoom:zu,StylePicker:np,EditingMode:Kl,Reviewers:zl,Save:Bu,ContentControlShowAll:ns,ContentControlFormFill:rs,ContentControlInspector:is,ContentControlRemove:as});var nb=/^(con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])$/i,HR=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var rb=new TextEncoder;function AR(e,t){if(rb.encode(e).length<=t)return e;let o=0,n="";for(let r of e){let i=rb.encode(r).length;if(o+i>t)break;o+=i,n+=r;}return n}function ab(e){let t=e.length;for(;t>0;){let o=e.charCodeAt(t-1);if(o!==46&&o!==32)break;t-=1;}return e.slice(0,t)}function ib(e){return ab(ab(e).replace(/\.docx$/i,""))}function fs(e){let t=(e??"").replace(HR," ").replace(/\s+/g," ").trim(),o=ib(t).replace(/^[. ]+/,""),n=AR(o,200),r=n===o?o:ib(n);return !r||nb.test(r)?"document.docx":nb.test(r.split(".",1)[0].trim())?`_${r}.docx`:`${r}.docx`}function gs(e,t,o="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let n=URL.createObjectURL(new Blob([e],{type:o})),r=document.createElement("a");r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0);}function lb(e,t,o){let{t:n}=N(),r=Pt.useRef(false),[i,a]=Pt.useState(false),[s,l]=Pt.useState(""),[c,d]=Pt.useState("pdf"),[f,u]=Pt.useState(false),[g,m]=Pt.useState({});return {pending:i,error:s,format:c,visible:f,session:g,dismiss:()=>u(false),execute:async v=>{if(!(!e||r.current)){r.current=true,m({}),d(v),u(true),a(true),l("");try{let y=await editor.runChromeExport(e,v,t);gs(y.bytes.slice().buffer,fs(o).replace(/\.docx$/,`.${y.extension}`),y.mimeType),u(!1);}catch(y){u(true),l(y instanceof editor.ChromeExportError?n(y.format==="markdown"?"toolbar.exportMarkdownMissing":"toolbar.exportPdfMissing"):n("toolbar.exportFailed",{message:y instanceof Error?y.message:String(y)}));}finally{r.current=false,a(false);}}}}}function cb(e,t,o){let{t:n}=N(),r=Pt.useRef({editor:e,exporters:t,feedback:o,t:n});r.current={editor:e,exporters:t,feedback:o,t:n};let i=Pt.useRef(null),a=Pt.useRef(null),[s,l]=Pt.useState(false),[c,d]=Pt.useState(""),[f,u]=Pt.useState(""),[g,m]=Pt.useState(false),[p,v]=Pt.useState(false),[y,x]=Pt.useState({}),h=Pt.useCallback(C=>{let{t:P}=r.current;if(C instanceof editor.ChromeExportError)return P("toolbar.printPdfMissing");if(C instanceof editor.ChromePrintError){if(C.code==="pdf-viewer-unavailable")return P("toolbar.printNoViewer");if(C.code==="pdf-load-failed")return P("toolbar.printLoadFailed");if(C.code==="print-refused")return P("toolbar.printRefused")}return P("toolbar.printFailedMessage",{message:C instanceof Error?C.message:String(C)})},[]),b=Pt.useCallback(()=>{i.current=null,v(false),m(false),l(false);},[]),S=Pt.useCallback(async C=>{let{editor:P,exporters:T}=r.current;if(!P||i.current)return;let R={};i.current=R,a.current?.dispose(),a.current=null,x(R),v(true),m(true),l(true),d(""),u("");try{let M=await editor.runChromePrint(P,T,C??document);if(i.current!==R){M.dispose();return}a.current=M,await M.print({beforePrint:()=>{if(i.current!==R)throw new editor.ChromePrintError("print-ended");reactDom.flushSync(()=>m(!1));}}),i.current===R&&b();}catch(M){if(i.current!==R)return;if(!r.current.feedback){console.error("[docx-editor] print failed",M),b();return}l(false),u(a.current?.url??""),d(h(M)),m(true);}},[b,h]);return Pt.useEffect(()=>()=>{i.current=null,a.current?.dispose(),a.current=null;},[]),{pending:s,error:c,url:f,visible:g,active:p,session:y,execute:S,close:b}}var $R="https://github.com/eigenpal/docx-editor/issues/new";function UR(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function db(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),o=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??UR()}`,`- Viewport: ${o.width} x ${o.height}`,`- User agent: ${t}`,""].join(`
2
- `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${$R}?${i.toString()}`}function ii(e){typeof window>"u"||window.open(db(e),"_blank","noopener,noreferrer");}function VR({className:e,hidden:t,onSelect:o}){let{setOpenMenu:n,onReportIssue:r,reportIssue:i}=at(),a=ke();if(t||i===false)return null;let s=o??r??ii;return jsxRuntime.jsx(_e,{slot:"help.reportIssue",onSelect:()=>{s(),n(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var hs=Object.assign(VR,{docxSlot:"help.reportIssue"});function GR({children:e,...t}){let{reportIssue:o}=at();return e===void 0&&o===false?null:jsxRuntime.jsxs(Bt,{id:"help",...t,children:[jsxRuntime.jsx(hs,{}),e]})}var hp=Object.assign(GR,{docxMenu:"help"});var JR=e=>e.hiddenReviewAuthors??[];function bs({className:e,hidden:t}){let o=F(),n=Aa(),r=O(JR),i=ke(),{t:a}=N();if(t)return null;let s=i("reviewers.label"),l=editor.toolbarCommandState(o,"review.authors"),c=i18n.localizeDisabledReason(l.disabledReason,a);if(!l.enabled)return jsxRuntime.jsx(_e,{disabled:true,title:c??void 0,slot:"review.authors",children:s});let d=new Set(r),f=n.every(u=>!d.has(u.author));return jsxRuntime.jsxs(Ot,{labelKey:"reviewers.label",className:e,children:[jsxRuntime.jsx(pb,{checked:f,label:i("reviewers.all"),slot:"reviewer-all",onChoose:()=>o?.setAllReviewAuthorsVisible(!f)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),n.map(u=>jsxRuntime.jsx(pb,{checked:!d.has(u.author),label:u.author||"\u2014",slot:`reviewer-${u.slot}`,onChoose:()=>o?.setReviewAuthorVisible(u.author,d.has(u.author))},u.author))]})}function pb(e){return jsxRuntime.jsx(_e,{active:e.checked,slot:e.slot,className:"docx-menubar__reviewer-item",icon:jsxRuntime.jsx("span",{className:"docx-menubar__reviewer-check",children:e.checked?"\u2713":""}),onSelect:e.onChoose,children:e.label})}function QR({children:e,...t}){return jsxRuntime.jsxs(Bt,{id:"review",...t,children:[jsxRuntime.jsx(Ot,{labelKey:"reviewers.markupOptions",className:"docx-menubar__markup-options",children:jsxRuntime.jsx(bs,{className:"docx-menubar__reviewers-submenu"})}),e]})}var vs=Object.assign(QR,{docxMenu:"review"});var t2={file:bd,format:vd,insert:yd,review:vs,help:hp};function si(e,t=false){if(!Pt.isValidElement(e))return null;if(e.type===Pt.Fragment){let i=Pt.Children.toArray(e.props.children).map(a=>si(a,t)).filter(a=>a!==null);return i.length===1?i[0]:null}let o=e.props;if(o.hidden===true&&!t)return null;let n=e.type;return (typeof n=="function"||typeof n=="object")&&typeof n.docxMenu=="string"?n.docxMenu:e.type===Bt&&typeof o.id=="string"?o.id:null}var o2=new Set(editor.CHROME_MENUS.map(e=>e.id));function Ts(e){if(!Pt.isValidElement(e))return null;if(e.type===Pt.Fragment){let n=Pt.Children.toArray(e.props.children).map(Ts).filter(r=>r!==null);return n.length===1?n[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===Bt){let o=e.props.id;if(typeof o=="string"&&o2.has(o))return o}return null}var n2=e=>e.isOpening===true;function r2(e){let t=Pr(),o=Zt(),n=Ct(),{className:r,t:i,fileName:a,exporters:s,onOpen:l,onOpenFile:c,onSave:d,onPageSetup:f,onReportIssue:u,reportIssue:g,preset:m=true,overflow:p=true,children:v}=e,y=F(),{t:x}=N(),[h,b]=Pt.useState(null),S=O(n2);Pt.useEffect(()=>{S&&b(null);},[S]);let[C,P]=Pt.useState(null),T=lb(y,s,a??C??void 0),{pending:R,execute:M}=T,E=cb(y,s,o?.print!==false),{active:_,execute:H}=E,L=E.visible&&o?.print!==false,[k,w]=Pt.useState(null),[I,$]=Pt.useState(false),[W,ee]=Pt.useState(false),V=Pt.useRef(null),se=Pt.useRef(null);Pt.useEffect(()=>{if(h===null)return;let ne=te=>{let ve=V.current;ve&&te.target instanceof Node&&ve.contains(te.target)||b(null);};return document.addEventListener("mousedown",ne),()=>{document.removeEventListener("mousedown",ne);}},[h]),Mr(h!==null,V,()=>b(null),ne=>ne.target instanceof Node&&V.current?.contains(ne.target)===true);let U=Pt.useCallback(ne=>{b(ne),ne!==null&&w(ne);},[]),ce=Pt.useCallback(()=>se.current?.click(),[]),pe=Pt.useCallback(()=>{y&&y.save().then(ne=>gs(ne,fs(a??C??void 0))).catch(ne=>{console.error("[docx-editor] save failed",ne);});},[y,a,C]),K=Pt.useCallback(()=>t?t.open("pageSetup",V.current?.querySelector('[data-menu="file"] > [role="menuitem"]')):$(true),[t]),Z=y?l??ce:void 0,be=y?d??pe:void 0,Re=!!s?.pdf,ue=Pt.useMemo(()=>y&&!_?()=>{rd(V.current),H(editor.editorInstanceScope(V.current)??V.current??void 0);}:void 0,[y,_,H]),ze=y?t?.ownsPageSetup?K:f??K:void 0;Pt.useEffect(()=>{let ne=te=>{if(!(te.metaKey||te.ctrlKey)||te.altKey||te.shiftKey)return;let ve=te.key.toLowerCase(),$e=editor.isChromePrintShortcut(te);if(ve!=="s"&&ve!=="o"&&!$e)return;let Ze=te.target,mo=editor.editorInstanceScope(V.current)??V.current;if(!(!Ze||!mo?.contains(Ze)))if($e){if(!Re||!y||!ue&&!L)return;te.preventDefault(),ue?.();}else ve==="s"&&be?(te.preventDefault(),be()):ve==="o"&&Z&&(te.preventDefault(),Z());};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[Z,be,ue,L,Re,y]);let _t=Pt.useMemo(()=>({t:i,openMenu:h,setOpenMenu:U,activeMenu:k,onOpen:Z,onSave:be,onExport:y&&!R?ne=>(rd(V.current),M(ne)):void 0,onPrint:ue,printShortcut:Re,onPageSetup:ze,onParagraphDialog:()=>t?t.open("paragraph",V.current?.querySelector('[data-menu="format"] > [role="menuitem"]')):ee(true),onReportIssue:u,reportIssue:g,opening:S}),[S,y,R,M,ue,Re,i,h,U,k,Z,be,ze,t,u,g]),Je=Pt.Children.toArray(v),ut=[];if(m){let ne=new Map(Je.map(te=>[Ts(te),te]));for(let te of editor.CHROME_MENUS){let ve=ne.get(te.id);(ve===void 0||si(ve)!==null)&&ut.push(te.id);}for(let te of Je){if(Ts(te)!==null)continue;let ve=si(te);ve!==null&&ut.push(ve);}}else for(let ne of Je){let te=si(ne);te!==null&&ut.push(te);}let Pe=[...ut].reverse(),{attach:co,overflow:uo}=Xi(p,ut,Pe),po=Pt.useMemo(()=>({measuring:p,overflow:uo,inMore:false}),[p,uo]),Mo=Pt.useMemo(()=>({measuring:false,overflow:uo,inMore:true}),[uo]),Gt=ne=>si(ne,true)!==null,oe=(ne,te)=>jsxRuntime.jsx("div",{role:"none",className:"docx-menubar__host",[fn]:"",children:ne},te),fe,yt;if(!m)fe=Je.filter(Gt),yt=p?Je.map((ne,te)=>Gt(ne)?ne:oe([ne],`host-${te}`)):v;else {let ne=new Map,te=[];for(let $e of Je){let Ze=Ts($e);Ze?ne.set(Ze,$e):te.push($e);}fe=[...editor.CHROME_MENUS.map($e=>{let Ze=ne.get($e.id);if(Ze)return jsxRuntime.jsx(Pt.Fragment,{children:Ze},$e.id);let mo=t2[$e.id];return jsxRuntime.jsx(mo,{},$e.id)}),...te.filter(Gt)];let ve=te.filter($e=>!Gt($e));yt=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[fe,ve.length>0?oe(ve,"host"):null]});}let zn=i?.("formattingBar.more")??x("formattingBar.more");return jsxRuntime.jsxs(na.Provider,{value:_t,children:[jsxRuntime.jsx("div",{ref:ne=>{if(V.current=ne,co(ne),ne&&k===null){let te=nd(ne)[0]?.closest("[data-menu]")?.getAttribute("data-menu");te&&w(te);}},role:"menubar","aria-label":i?.("titleBar.menuBarAriaLabel")??x("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",...p?{"data-overflow":""}:{},className:`${n}docx-menubar${r?` ${r}`:""}`,onMouseDown:B,onKeyDown:ne=>{if(ne.key!=="ArrowLeft"&&ne.key!=="ArrowRight")return;let te=V.current;if(!te)return;let ve=nd(te),$e=ve.indexOf(document.activeElement);if($e===-1)return;ne.preventDefault();let Ze=ne.key==="ArrowRight"?1:-1,mo=ve[($e+Ze+ve.length)%ve.length],$n=mo?.closest("[data-menu]")?.getAttribute("data-menu");$n&&(w($n),mo?.focus(),h!==null&&b($n));},children:jsxRuntime.jsxs(ji.Provider,{value:po,children:[jsxRuntime.jsx(nr.Provider,{value:0,children:yt}),uo.size>0?jsxRuntime.jsx(Bt,{id:or,label:zn,icon:re(Du),preset:false,children:jsxRuntime.jsx(ji.Provider,{value:Mo,children:fe})}):null]})}),jsxRuntime.jsxs(Og,{children:[T.visible&&o?.export!==false?o?.export?De(o.export,{open:true,format:T.format,pending:T.pending,error:T.error,onClose:T.dismiss},T.session):jsxRuntime.jsx(Vr,{open:true,format:T.format,pending:T.pending,error:T.error,onClose:T.dismiss}):null,E.visible&&o?.print!==false?o?.print?De(o.print,{open:true,pending:E.pending,error:E.error,url:E.url,onClose:E.close},E.session):jsxRuntime.jsx(Gr,{open:true,pending:E.pending,error:E.error,url:E.url,onClose:E.close}):null]}),jsxRuntime.jsx("input",{ref:se,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:ne=>{let te=ne.target.files?.[0];ne.target.value="",!(!te||!y)&&(P(te.name),c?.(te),te.arrayBuffer().then(ve=>y.load(new Uint8Array(ve))).catch(ve=>{console.error("[docx-editor] could not open the file",ve);}));}}),jsxRuntime.jsx(Sn,{open:I,onClose:()=>$(false)}),jsxRuntime.jsx(yo,{open:W,onClose:()=>ee(false)})]})}var ci=Object.assign(r2,{Menu:Bt,File:bd,Format:vd,Insert:yd,Review:vs,Help:hp,Item:ho,Row:_e,Group:da,Separator:gn,Submenu:Ot,TableGrid:ar,Entry:pa,Open:cd,Save:dd,ExportMarkdown:ud,ExportPdf:pd,Print:md,PageSetup:fd,ImageInsert:gd,Reviewers:bs,ReportIssue:hs});var c2=12240,yb=1440,Tb=1440,Pb=567,Dn=20,Tp=6,Sp=Dn+Tp+2,d2="var(--doc-text-muted)",u2="var(--doc-text-subtle)",xb="var(--doc-shadow-subtle)",p2="var(--doc-primary)",m2="var(--doc-primary-hover)",f2="var(--doc-text-subtle)",ui=5,di=7,g2={left:0,right:0,firstLine:0};function Cb(e,t){return t==="inch"?(e/Tb).toFixed(2)+'"':(e/Pb).toFixed(1)+" cm"}function h2(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function kn({pageSetup:e,zoom:t=1,editable:o=false,onLeftMarginChange:n,onRightMarginChange:r,onMarginDragEnd:i,showIndentHandles:a=false,indent:s,indentEditable:l=false,onIndentChange:c,onIndentDragEnd:d,unit:f="inch",className:u="",style:g,tabMarks:m,onTabMarkRemove:p}){let{t:v}=N(),[y,x]=Pt.useState(null),[h,b]=Pt.useState(null),[S,C]=Pt.useState(null),[P,T]=Pt.useState(null),R=Pt.useRef(null),M=e?.pageWidthTwips??c2,E=e?.marginsTwips.left??yb,_=e?.marginsTwips.right??yb,H=e?.gutterTwips??0,L={pageWidth:M,leftMargin:E,rightMargin:_},k=s??g2,w=Ne(M)*t,I=Ne(E)*t,$=Ne(_)*t,W=Pt.useCallback(Z=>{let be=R.current?.getBoundingClientRect();return be?Fl((Z-be.left)/t):null},[t]),ee=Pt.useCallback((Z,be,Re)=>{let ue=W(be);if(ue===null)return;if(T(Ne(ue)*t),Z==="leftMargin"||Z==="rightMargin"){if(Z==="leftMargin"){let _t=M-_-H-720,Je=Math.round(Math.max(0,Math.min(ue,_t)));C(Je),n?.(Je);}else {let _t=M-ue,Je=M-E-H-720,ut=Math.round(Math.max(0,Math.min(_t,Je)));C(ut),r?.(ut);}return}let ze=editor.dragIndent(Z,ue,k,L,{unit:f,precise:Re});C(Z==="right"?ze.right:Z==="firstLine"?ze.firstLine:ze.left),c?.(ze);},[W,t,M,E,_,H,n,r,c,k,L,f]),V=Pt.useCallback(Z=>{Z==="leftMargin"||Z==="rightMargin"?i?.():d?.(),x(null),C(null),T(null);},[i,d]),se=Pt.useCallback((Z,be,Re)=>{let ue=editor.handlePosition(Z,k,L),ze=editor.dragIndent(Z,ue+be*h2(f,Re),k,L,{unit:f,precise:true});c?.(ze),d?.();},[k,L,f,c,d]),U=T2(M,t,f),ce=a&&l&&c!==void 0,pe=Z=>Ne(editor.handlePosition(Z,k,L))*t,K=(Z,be,Re)=>({positionPx:pe(Z),editable:ce,isDragging:y===Z,isHovered:h===Z,onPointerEnter:()=>b(Z),onPointerLeave:()=>b(null),onPointerDown:ue=>{ce&&(ue.preventDefault(),ue.stopPropagation(),ue.currentTarget.setPointerCapture(ue.pointerId),x(Z));},onPointerMove:ue=>{y===Z&&ee(Z,ue.clientX,ue.altKey);},onPointerUp:ue=>{y===Z&&(ue.currentTarget.releasePointerCapture(ue.pointerId),V(Z));},onKeyDown:ue=>{ce&&(ue.key!=="ArrowLeft"&&ue.key!=="ArrowRight"||(ue.preventDefault(),se(Z,ue.key==="ArrowLeft"?-1:1,ue.shiftKey)));},label:v(be),valueNow:Re,valueText:Cb(Re,f),pageWidthTwips:M});return jsxRuntime.jsxs("div",{ref:R,className:`docx-horizontal-ruler ${u}`,style:{position:"relative",width:gt(w),height:Sp,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:y?"ew-resize":"default",flexShrink:0,marginInline:"auto",...g},role:"group","aria-label":v("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:gt(I),height:Dn,backgroundColor:xb,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&n?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),x("leftMargin");}:void 0,onPointerMove:Z=>y==="leftMargin"&&ee("leftMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{y==="leftMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),V("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:gt($),height:Dn,backgroundColor:xb,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&r?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),x("rightMargin");}:void 0,onPointerMove:Z=>y==="rightMargin"&&ee("rightMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{y==="rightMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),V("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Dn,pointerEvents:"none"},children:U.map((Z,be)=>jsxRuntime.jsx(b2,{tick:Z},be))}),m?.map(Z=>jsxRuntime.jsx(C2,{tabMark:Z,positionPx:Ne(Z.position)*t,onDoubleClick:()=>p?.(Z.position)},Z.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cp,{direction:"down",anchor:"top",...K("firstLine","ruler.firstLineIndent",k.firstLine)}),jsxRuntime.jsx(Cp,{direction:"up",anchor:"strip",...K("hanging","ruler.hangingIndent",k.left)}),jsxRuntime.jsx(v2,{...K("left","ruler.leftIndent",k.left)}),jsxRuntime.jsx(Cp,{direction:"up",anchor:"strip",...K("right","ruler.rightIndent",k.right)})]}),y&&S!==null&&P!==null&&jsxRuntime.jsx(y2,{value:Cb(S,f),positionPx:P})]})}function b2({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(e.position),bottom:0,width:1,height:e.height,backgroundColor:u2}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:d2,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Sb(e){return e.editable?e.isDragging||e.isHovered?m2:p2:f2}function Eb(e,t,o){return {position:"absolute",left:gt(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...o}}function wb(e){return {role:"slider","aria-label":e.label,"aria-orientation":"horizontal","aria-valuenow":e.valueNow,"aria-valuemin":-e.pageWidthTwips,"aria-valuemax":e.pageWidthTwips,"aria-valuetext":e.valueText,"aria-disabled":e.editable?void 0:true,tabIndex:e.editable?0:-1}}function Cp({direction:e,anchor:t,...o}){let n=Sb(o),r=t==="top"?{top:0,height:di+1}:{top:Dn-di,height:di};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Eb(o,ui*2,r),onPointerEnter:o.onPointerEnter,onPointerLeave:o.onPointerLeave,onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onKeyDown:o.onKeyDown,...wb(o),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${ui}px solid transparent`,borderRight:`${ui}px solid transparent`,...e==="down"?{top:0,borderTop:`${di}px solid ${n}`}:{bottom:0,borderBottom:`${di}px solid ${n}`},transition:"border-color 0.1s"}})})}function v2(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Eb(e,ui*2,{top:Dn+1,height:Tp}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...wb(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:ui*2-2,height:Tp,backgroundColor:Sb(e),borderRadius:1,transition:"background-color 0.1s"}})})}function y2({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(t),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var x2={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function C2({tabMark:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(t-5),top:Dn-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:n=>{n.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:x2[e.alignment]||"L"})}function T2(e,t,o){let n=[];if(o==="inch"){let r=Tb/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;a%8===0?n.push({position:l,height:8,label:a/8>0?String(a/8):void 0}):a%4===0?n.push({position:l,height:5}):a%2===0?n.push({position:l,height:3}):n.push({position:l,height:2});}}else {let r=Pb/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;a%10===0?n.push({position:l,height:8,label:a/10>0?String(a/10):void 0}):a%5===0?n.push({position:l,height:5}):n.push({position:l,height:3});}}return n}var E2=15840,Db=1440,Es=1440,ws=567,Fr=20,w2="var(--doc-text-muted)",M2="var(--doc-text-subtle)",R2="var(--doc-primary)",D2="var(--doc-primary)",k2="var(--doc-primary-hover)";function pi({pageSetup:e,zoom:t=1,editable:o=false,onTopMarginChange:n,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:s="",style:l}){let{t:c}=N(),[d,f]=Pt.useState(null),[u,g]=Pt.useState(null),m=Pt.useRef(null),p=e?.pageHeightTwips??E2,v=e?.marginsTwips.top??Db,y=e?.marginsTwips.bottom??Db,x=(E,_)=>{if(!o||E.altKey||E.ctrlKey||E.metaKey||!["ArrowUp","ArrowDown","Home","End"].includes(E.key))return;E.preventDefault();let H=_==="topMargin"?v:y,k=Math.max(0,p-(_==="topMargin"?y:v)-720),w=E.shiftKey?1:Math.round(a==="cm"?ws/10:Es/8),I=E.key==="Home"?0:E.key==="End"?k:Math.max(0,Math.min(k,H+(E.key==="ArrowUp"?w:-w)));I!==H&&((_==="topMargin"?n:r)?.(I),i?.());},h=Ne(p)*t,b=Ne(v)*t,S=Ne(y)*t,C=Pt.useCallback((E,_)=>{o&&(E.preventDefault(),f(_));},[o]),P=Pt.useCallback(E=>{if(!d||!m.current)return;let _=m.current.getBoundingClientRect(),H=E.clientY-_.top,L=Fl(H/t);if(d==="topMargin"){let k=p-y-720,w=Math.max(0,Math.min(L,k));n?.(Math.round(w));}else if(d==="bottomMargin"){let k=p-L,w=p-v-720,I=Math.max(0,Math.min(k,w));r?.(Math.round(I));}},[d,t,p,v,y,n,r]),T=Pt.useCallback(()=>{d!==null&&i?.(),f(null);},[d,i]);Pt.useEffect(()=>{if(d)return document.addEventListener("mousemove",P),document.addEventListener("mouseup",T),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",T);}},[d,P,T]);let R=_2(p,t,a),M={position:"relative",width:Fr,height:gt(h),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...l};return jsxRuntime.jsxs("div",{ref:m,className:`docx-vertical-ruler ${s}`,style:M,role:"group","aria-label":c("ruler.vertical"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:R.map((E,_)=>jsxRuntime.jsx(I2,{tick:E},_))}),jsxRuntime.jsx(kb,{type:"topMargin",value:v,maximum:Math.max(0,p-y-720),valueText:v/(a==="cm"?ws:Es),unit:a,onKeyDown:E=>x(E,"topMargin"),position:b,editable:o,isDragging:d==="topMargin",isHovered:u==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>C(E,"topMargin")}),jsxRuntime.jsx(kb,{type:"bottomMargin",value:y,maximum:Math.max(0,p-v-720),valueText:y/(a==="cm"?ws:Es),unit:a,onKeyDown:E=>x(E,"bottomMargin"),position:h-S,editable:o,isDragging:d==="bottomMargin",isHovered:u==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>C(E,"bottomMargin")})]})}function I2({tick:e}){let t={position:"absolute",top:gt(e.position),right:0,height:1,width:e.width,backgroundColor:M2},o={position:"absolute",top:gt(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:w2,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:o,children:e.label})]})}function kb({type:e,position:t,value:o,maximum:n,valueText:r,unit:i,onKeyDown:a,editable:s,isDragging:l,isHovered:c,onMouseEnter:d,onMouseLeave:f,onMouseDown:u}){let{t:g}=N(),m=l?k2:c?D2:R2,p={position:"absolute",top:gt(t-5),right:0,width:Fr,height:10,cursor:s?"ns-resize":"default",zIndex:l?10:1},v={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${m}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:p,onMouseEnter:d,onMouseLeave:f,onMouseDown:u,role:"slider","aria-label":g(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":n,"aria-valuetext":`${r.toFixed(2)} ${i==="cm"?"cm":"in"}`,"aria-disabled":!s,onKeyDown:a,tabIndex:s?0:-1,children:jsxRuntime.jsx("div",{style:v})})}function _2(e,t,o){let n=[];if(o==="inch"){let r=Es/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;if(a%8===0){let c=a/8;n.push({position:l,width:10,label:c>0?String(c):void 0});}else a%4===0?n.push({position:l,width:6}):a%2===0?n.push({position:l,width:4}):n.push({position:l,width:2});}}else {let r=ws/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;if(a%10===0){let c=a/10;n.push({position:l,width:10,label:c>0?String(c):void 0});}else a%5===0?n.push({position:l,width:6}):n.push({position:l,width:3});}}return n}var In=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var F2=e=>e.formatting?.indent??null,H2=e=>e.editable;function wp(){let e=F(),t=O(F2),o=O(H2),n=Pt.useMemo(()=>o&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,o]),r=Pt.useCallback(i=>e?e.exec({...i.left!==void 0?{left:i.left}:{},...i.right!==void 0?{right:i.right}:{},...i.firstLine!==void 0?{firstLine:i.firstLine}:{},type:"setIndent"}).ok:false,[e]);return Pt.useMemo(()=>({indent:t,isEnabled:n,apply:r}),[t,n,r])}var Fb=e=>e.zoom,O2=e=>e.isOpening===true;function Hb(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Ab(){let{apply:e}=Pn(),[t,o]=Pt.useState({}),n=Pt.useRef({}),r=Pt.useCallback(a=>s=>{n.current={...n.current,[a]:Math.round(s)},o(n.current);},[]),i=Pt.useCallback(()=>{let a=n.current;n.current={},o({}),Object.keys(a).length!==0&&e({...a.top!==void 0?{marginTopTwips:a.top}:{},...a.right!==void 0?{marginRightTwips:a.right}:{},...a.bottom!==void 0?{marginBottomTwips:a.bottom}:{},...a.left!==void 0?{marginLeftTwips:a.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:i}}function Lb(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function B2(){let e=F(),{indent:t,isEnabled:o,apply:n}=wp(),[r,i]=Pt.useState(null),a=Pt.useRef(null),s=Pt.useRef(null),l=Pt.useCallback(f=>{s.current===null&&(s.current=Lb(e)),a.current=f,i(f);},[e]),c=Pt.useCallback(()=>{let f=a.current,u=s.current;a.current=null,s.current=null,i(null),f&&(u!==null&&u!==Lb(e)||n({left:f.left,right:f.right,firstLine:f.firstLine}));},[e,n]),d=Pt.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine,...t.rtl?{rtl:true}:{}}:null),[r,t]);return Pt.useMemo(()=>({indent:d,isEnabled:o,preview:l,commit:c}),[d,o,l,c])}function Z2(){let e=Ye(),[t,o]=Pt.useState(0);return Pt.useEffect(()=>{if(!e){o(0);return}let n=()=>o(e.scrollLeft);return n(),e.addEventListener("scroll",n,{passive:true}),()=>e.removeEventListener("scroll",n)},[e]),t}function Rs(e){let t=O(In),o=O(O2),{pageSetup:n,isEnabled:r}=Pn(),i=O(Fb),{pending:a,preview:s,commit:l}=Ab(),c=B2(),d=an(),f=qo(),u=Z2();return t?null:jsxRuntime.jsx("div",{className:`docx-ruler-frame${o?" docx-ruler-frame--opening":""}`,style:{paddingInlineStart:d+f.inlineStart,paddingRight:f.inlineEnd},children:jsxRuntime.jsx(kn,{pageSetup:Hb(n,a),zoom:i,editable:r,onLeftMarginChange:s("left"),onRightMarginChange:s("right"),onMarginDragEnd:l,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-u}px)`,clipPath:d>0&&u>0?`inset(0 0 0 ${u}px)`:e.style?.clipPath}})})}function Ds(e){let t=O(In),{pageSetup:o,isEnabled:n}=Pn(),r=O(Fb),{pending:i,preview:a,commit:s}=Ab(),l=an(),c=qo(),d=i0();return t||d!==null&&d>0&&o&&Ne(o.pageWidthTwips)*r>d-l-c.inlineStart-c.inlineEnd?null:jsxRuntime.jsx(pi,{pageSetup:Hb(o,i),zoom:r,editable:n,onTopMarginChange:a("top"),onBottomMarginChange:a("bottom"),onMarginDragEnd:s,unit:e.unit??"inch",className:e.className??"",style:e.style})}function A({size:e=20,className:t="",style:o,children:n}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...o},"aria-hidden":"true",children:n})}function Ob(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function Bb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function Zb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function qb(e){return jsxRuntime.jsxs(A,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function Kb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function Wb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function zb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function $b(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Ub(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function Vb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Gb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function jb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80Zm-120 480v-400 400Z"})})}function W2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function z2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function $2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function U2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function V2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function G2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function j2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function Y2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function X2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function J2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function Q2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function eD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function tD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"})})}function oD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"})})}function nD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function rD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function aD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function iD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function lD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function kp(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function sD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function cD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function dD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function uD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function pD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function mD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function fD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function gD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function hD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function bD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function vD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function yD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function xD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function Yb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function CD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function TD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function PD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function SD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function ED(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function wD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function MD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function RD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function DD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function kD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function ID(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function _D(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function ND(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function LD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function FD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function HD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function AD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function OD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function BD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function ZD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function qD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function KD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function WD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function zD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function $D(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function UD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function VD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function GD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function jD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function YD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function XD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function JD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function QD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function ek(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function tk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function ok(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function nk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function rk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function ak(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function ik(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function lk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function sk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function ck(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function dk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function uk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function pk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function mk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function fk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function gk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function hk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function bk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function vk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function yk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function xk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function Ck(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function Tk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function Pk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var Sk={undo:W2,redo:z2,print:$2,file_download:U2,file_upload:V2,format_bold:G2,format_italic:j2,format_underlined:Y2,strikethrough_s:X2,superscript:J2,subscript:Q2,link:eD,format_clear:nD,format_paragraph:tD,format_shapes:oD,lock:jb,format_align_left:rD,format_align_center:aD,format_align_right:iD,format_align_justify:lD,format_line_spacing:kp,format_list_bulleted:sD,format_list_numbered:cD,format_indent_increase:dD,format_indent_decrease:uD,format_color_text:pD,ink_highlighter:mD,format_color_reset:fD,arrow_drop_down:gD,table:hD,table_chart:bD,grid_on:vD,table_rows:yD,view_column:xD,border_all:Yb,select_all:Yb,border_outer:CD,border_inner:TD,border_clear:PD,add:SD,remove:ED,delete:wD,delete_sweep:MD,call_merge:RD,call_split:DD,drag_indicator:kD,image:ID,format_image_left:_D,format_image_right:ND,horizontal_rule:LD,flip_to_back:FD,flip_to_front:HD,open_with:AD,tune:OD,rotate_right:BD,rotate_left:ZD,swap_horiz:qD,swap_vert:KD,shapes:WD,format_paint:zD,expand_more:$D,expand_less:UD,border_top:VD,border_bottom:GD,border_left:jD,border_right:YD,border_horizontal:XD,border_vertical:JD,padding:QD,text_rotation_none:ek,wrap_text:tk,height:ok,fit_width:nk,settings:rk,border_color:ak,format_color_fill:ik,vertical_align_top:lk,vertical_align_center:sk,vertical_align_bottom:ck,line_weight:dk,keyboard_arrow_up:uk,keyboard_arrow_down:pk,keyboard_arrow_left:mk,keyboard_arrow_right:fk,more_vert:gk,page_break:hk,branding_watermark:bk,arrow_back:vk,search:yk,toc:xk,done_all:Ob,check_circle:Bb,chat_bubble_outline:Zb,chat_bubble_check:qb,check:Kb,close:Wb,add_comment:zb,comment:$b,edit_note:Ub,rate_review:Vb,visibility:Gb,format_textdirection_l_to_r:Ck,format_textdirection_r_to_l:Tk,"agent-sparkle":Pk};function z({name:e,size:t=20,className:o="",style:n}){let r=Sk[e];return r?jsxRuntime.jsx(r,{size:t,className:o,style:n}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:o,style:{fontSize:t,width:t,height:t,...n},children:e}))}var mi=12,Ip=240,Jb=16,Rk=24,Dk=mi+Ip+Jb,Hr=12,kk=36,Ik=Hr+kk+Jb,fi=Pt__namespace.default.memo(function({headings:t,onHeadingClick:o,onClose:n,topOffset:r=0,scrollLeft:i=0,leftOffset:a=mi}){let{t:s}=N(),[l,c]=Pt.useState(false),d=t.length?Math.min(...t.map(f=>f.level)):0;return Pt.useEffect(()=>{requestAnimationFrame(()=>c(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":s("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:a-i,bottom:0,width:Ip,paddingTop:Rk,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:l?"translateX(0)":`translateX(-${a+Ip}px)`,transition:"transform 0.15s ease-out"},onMouseDown:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":s("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:s("documentOutline.closeTitle"),children:jsxRuntime.jsx(z,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"var(--doc-text)",letterSpacing:"0.01em"},children:s("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:4},children:t.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"var(--doc-text-subtle)",fontSize:13,lineHeight:"20px"},children:s("documentOutline.noHeadings")}):t.map((f,u)=>jsxRuntime.jsx("div",{style:{marginLeft:(f.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>o(f.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:f.text,children:f.text})},`${f.blockId}-${u}`))})]})});var Lk=e=>e,Fk=Object.freeze([]),Hk=()=>{};function _p(e){let t=F(),o=O(Lk),n=Pt.useMemo(()=>t&&!o.isLoading?t.getOutline():Fk,[t,o]),r=Pt.useCallback(i=>{if(!t)return;t.focus();let a={paragraphId:i,offset:0};t.exec({type:"setSelection",range:{anchor:a,head:a}}),t.scrollToBlock(i);},[t]);return In(o)?null:jsxRuntime.jsx(fi,{headings:n,onHeadingClick:r,onClose:e.onClose??Hk,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Np=Pt.createContext(null);function Vo(e){let t=Pt.useContext(Np);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Ar=280,ks=32,Qb=16;function Or(e=280){return 32+e+16}function Is({viewportWidth:e,pageWidthPx:t,reservation:o,inlineEndReservation:n=0,inlineStartReservation:r=0,docked:i=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(n)||n<0||!Number.isFinite(r)||r<0)return 0;let a=(e-n-t)/2,s=a>=o?0:!i&&o<=2*a?2*(o-a):o;return Math.ceil(Math.max(0,s-r))}var Lp=320;function _s(e,t){return !Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?false:e-t<Lp}var Kk=Object.freeze([]),Wk=e=>e;function Ns(){let e=F(),t=O(Wk),[o,n]=Pt.useState(null),r=Pt.useMemo(()=>e&&!t.isLoading?e.getOutline():Kk,[e,t]),i=Pt.useMemo(()=>{if(r.length===0)return [];let s=r[0].level;for(let l of r)l.level<s&&(s=l.level);return r.map(l=>({heading:l,depth:l.level-s}))},[r]),a=Pt.useCallback(s=>{if(!e||typeof s!="string"||s.length===0)return;e.focus();let l={paragraphId:s,offset:0};e.exec({type:"setSelection",range:{anchor:l,head:l}}),e.scrollToBlock(s),n(s);},[e]);return {headings:r,items:i,selectedBlockId:o,goTo:a,isEmpty:r.length===0}}var iv=Object.freeze({query:"",matchCase:false,wholeWord:false,matches:Object.freeze([]),truncated:false,activeIndex:-1,activeMatch:null,isPending:false}),Vk=()=>()=>{},tv=()=>iv;function Ls(e={}){let t=e.highlight??"all",o=F(),n=Pt.useMemo(()=>o?editor.createDocumentSearch(o):null,[o]),r=Pt.useSyncExternalStore(n?n.subscribe:Vk,n?n.getState:tv,n?n.getState:tv);Pt.useEffect(()=>{if(!(!n||t==="none"))return n.showHighlights(t)},[n,t]);let i=Pt.useMemo(()=>({setQuery:a=>n?.setQuery(a),find:(a,s)=>n?.find(a,s)??iv.matches,setMatchCase:a=>n?.setMatchCase(a),setWholeWord:a=>n?.setWholeWord(a),goTo:a=>n?.goTo(a)??false,next:()=>n?.next()??false,previous:()=>n?.previous()??false,clear:()=>n?.clear()}),[n]);return Pt.useMemo(()=>({...r,...i}),[r,i])}function cv(e,t=i18n.isApplePlatform()){return e.altKey||e.shiftKey||e.isComposing||(t?!e.metaKey||e.ctrlKey:!e.ctrlKey||e.metaKey)?false:editor.chordLetter(e)==="f"}function dv(e){return e.startsWith("Ctrl")?"Control+F":"Meta+F"}function uv(e,t,o){if(e?.isConnected){o&&e.closest(".docx-pages")?o():e.focus({preventScroll:true});return}t?t.focus({preventScroll:true}):o?.();}function pv(e,t,o){if(!e||typeof Node>"u"||!(e instanceof Node))return false;if(t?.contains(e))return true;if(!o)return false;if(o.contains(e))return true;let n=e instanceof Element?e:e.parentElement;if(!n)return false;let r=editor.editorInstanceScope(o);if(r&&r!==o&&r.contains(n))return true;if(!n.closest(".docx-editor")||editor.editorInstanceScope(n)!==null)return false;let i=o.ownerDocument.querySelectorAll(".docx-editor__scroll-container");return i.length===1&&i[0]===o}function Hp(e,t){let o=e?.querySelector(`#docx-nav-panel-${t}`);if(!o)return null;if(t==="headings"){let n=o.querySelector(".docx-nav__heading--current")??o.querySelector(".docx-nav__heading");if(n)return n}return o.querySelector(".docx-nav__search-input")}function Ap(e){e.focus(),typeof HTMLInputElement<"u"&&e instanceof HTMLInputElement&&e.select();}function Yk(e){let o=e.querySelector('[role="tab"][aria-selected="true"]')?.id==="docx-nav-tab-find"?"find":"headings",n=Hp(e,o);if(n){Ap(n);return}e instanceof HTMLElement&&(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus());}function Xk(e,t){let o=[];if(t.contains(e)){let i=e;for(;i!==t&&i.parentElement;){for(let a of i.parentElement.children)a!==i&&o.push(a);i=i.parentElement;}}else o.push(...t.children);let n=e.ownerDocument.activeElement;n&&o.some(i=>i.contains(n))&&Yk(e);let r=[];for(let i of o)i.hasAttribute("inert")||(i.setAttribute("inert",""),r.push(i));return ()=>{for(let i of r)i.removeAttribute("inert");r.length=0;}}function mv(e,t,o){let n=Xk(e,t),r=i=>{i.target instanceof Node&&e.contains(i.target)||o();};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),n();}}function sv(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function fv(e,t){let o=()=>{let r=getComputedStyle(t),i=t.clientHeight-sv(r.paddingTop)-sv(r.paddingBottom);e.style.setProperty("--docx-nav-block-size",`${Math.max(0,Math.round(i))}px`),e.style.setProperty("--docx-nav-inline-size",`${Math.round(t.clientWidth)}px`);};if(o(),typeof ResizeObserver>"u")return ()=>{};let n=new ResizeObserver(o);return n.observe(t),()=>n.disconnect()}function gv(e,t=true){let o=F(),n=Ye(),r=Pt.useRef(null),i=Pt.useRef(null),a=Pt.useRef(false),s=Pt.useRef(false),l=Pt.useRef(false),c=Pt.useRef(0),d=Pt.useCallback(()=>{let b=++c.current;setTimeout(()=>{c.current===b&&(a.current=false,s.current=false,l.current=false);},0);},[]),f=Pt.useRef(e);f.current=e;let u=Pt.useCallback(()=>{a.current=false;let b=Hp(r.current,f.current.tab);b&&Ap(b);},[]),g=Pt.useCallback(()=>{s.current=false;let b=i.current;i.current=null;let S=r.current?.querySelector(".docx-nav__toggle")??null;uv(b,S,o?()=>o.focus():null);},[o]),m=Pt.useRef(g);m.current=g,Pt.useEffect(()=>()=>{s.current&&m.current();},[]);let p=Pt.useCallback(()=>{a.current=false,s.current=true,f.current.setOpen(false),d();},[d]),v=Pt.useMemo(()=>({toggle:()=>{if(f.current.open){p();return}i.current=null,s.current=false,a.current=true,f.current.setOpen(true),d();},close:p,picked:()=>{let b=f.current;if(!b.overlay)return;let S=r.current?.ownerDocument.activeElement;l.current=!!S&&!!r.current?.contains(S),b.setOpen(false),d();}}),[p,d]),y=Pt.useRef(v);y.current=v,Pt.useEffect(()=>{let b=r.current?.ownerDocument;if(!b||!t)return;let S=C=>{if(C.defaultPrevented||!cv(C)||!pv(C.target,r.current,n))return;C.preventDefault();let P=b.activeElement;P instanceof HTMLElement&&!r.current?.contains(P)&&(i.current=P),s.current=false;let T=f.current;if(T.open&&T.tab==="find"){u();return}a.current=true,T.tab!=="find"&&T.setTab("find"),T.open||T.setOpen(true),d();};return b.addEventListener("keydown",S),()=>b.removeEventListener("keydown",S)},[n,u,t,d]),Pt.useEffect(()=>{a.current&&(f.current.open?u():a.current=false),s.current&&(f.current.open?s.current=false:g()),l.current&&(l.current=false,f.current.open||o?.focus());});let x=e.open&&e.overlay;Pt.useEffect(()=>{let b=r.current;if(!(!x||!b||!n))return mv(b,n,()=>y.current.close())},[x,n]),Pt.useEffect(()=>{let b=r.current;if(!(!b||!n||!n.contains(b)))return fv(b,n)},[n]);let h=Pt.useCallback(b=>{b.key!=="Escape"||b.defaultPrevented||b.nativeEvent.isComposing||f.current.open&&(b.preventDefault(),p());},[p]);return {rootRef:r,intents:v,onKeyDown:h}}function Qk(e){return e.source!==void 0?true:(e.created?.length??0)>0||(e.deleted?.length??0)>0}function e8(e){let t=0;for(let o of e)t=Math.max(t,o.box.width);return t>0?t:null}function hv(e,t){let o=null,n=false,r=()=>{o=null,n||t(e8(e.getPageGeometry()));},i=()=>{n||(o!==null&&clearTimeout(o),o=setTimeout(r,150));},a=e.on("change",s=>{Qk(s)&&i();});return r(),{nudge:i,dispose(){n=true,o!==null&&clearTimeout(o),o=null,a();}}}var a8=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,zoom:e.zoom,reviewPaneOpen:e.reviewPaneOpen??true,fitting:t?.type==="fit"&&e.zoom<(t.maxZoom??editor.ZOOM_MAX)&&e.zoom>(t.minZoom??editor.ZOOM_MIN)}},i8=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips,l8=e=>e.page.total;function Fs(e={}){let{defaultOpen:t=false,defaultTab:o="headings",paneWidth:n=280}=e,[r,i]=Pt.useState(t),[a,s]=Pt.useState(o),l=e.open??r,c=e.tab??a,{onOpenChange:d,onTabChange:f}=e,u=e.open!==void 0,g=e.tab!==void 0,m=Pt.useCallback(K=>{u||i(K),d?.(K);},[u,d]),p=Pt.useCallback(()=>m(!l),[l,m]),v=Pt.useCallback(K=>{g||s(K),f?.(K);},[g,f]),y=rn(),x=Ye(),h=Pt.useContext(xt),{pageSetup:b,zoom:S,reviewPaneOpen:C,fitting:P}=O(a8,i8),T=F(),R=O(l8),[M,E]=Pt.useState(0),[_,H]=Pt.useState(null),[L,k]=Pt.useState(0),[w,I]=Pt.useState(0),$=qo();Pt.useEffect(()=>{if(!x){E(0),k(0),I(0);return}let K=()=>{E(x.clientWidth);let be=getComputedStyle(x),Re=Number.parseFloat(be.paddingInlineEnd);k(Number.isFinite(Re)?Re:0);let ue=Number.parseFloat(be.getPropertyValue("--docx-review-gutter-start"));I(Number.isFinite(ue)?ue:0);};if(K(),typeof ResizeObserver>"u")return;let Z=new ResizeObserver(K);return Z.observe(x),()=>Z.disconnect()},[x,l,C,h?.mounted,$]);let W=Pt.useRef(null);b&&(W.current=b.pageWidthTwips);let ee=b?.pageWidthTwips??W.current,V=Pt.useRef(null);Pt.useEffect(()=>{if(!l||!T)return;let K=hv(T,H);return V.current=K,()=>{K.dispose(),V.current===K&&(V.current=null);}},[l,T]),Pt.useEffect(()=>V.current?.nudge(),[R,ee]);let se=Or(n),U=r0($,L),ce=l&&_s(M-U,se),pe=Pt.useMemo(()=>!l||ce||ee===null?0:Is({viewportWidth:M,pageWidthPx:Math.max(_??0,Ne(ee))*S,reservation:se,inlineEndReservation:L,inlineStartReservation:w,docked:P}),[l,ce,ee,_,S,M,se,L,w,P]);return Pt.useEffect(()=>{if(y)return y.setShift(pe),()=>y.setShift(0)},[y,pe]),Pt.useEffect(()=>{if(y)return y.setReservation(l&&!ce?se:0),()=>y.setReservation(0)},[y,l,ce,se]),{open:l,setOpen:m,toggle:p,tab:c,setTab:v,paneWidth:n,shift:pe,overlay:ce}}var vi=["headings","find"],ao=(...e)=>e.filter(Boolean).join(" ");function yi({className:e,style:t,children:o}){return jsxRuntime.jsx("div",{className:ao("docx-nav__header",e),style:t,children:o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xi,{}),jsxRuntime.jsx(Ci,{})]})})}function xi({className:e,style:t,children:o}){let{intents:n,t:r}=Vo("Close");return jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:n.close,children:o??jsxRuntime.jsx(z,{name:"arrow_back",size:20})})}function Ci({className:e,style:t,children:o}){let{t:n}=Vo("Title");return jsxRuntime.jsx("h2",{className:ao("docx-nav__title",e),style:t,children:o??n("navigation.title")})}function Ti({className:e,style:t,children:o}){let{pane:n,t:r}=Vo("Tabs"),i=Pt.useCallback(a=>{let s=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(s===0)return;a.preventDefault();let l=vi.indexOf(n.tab);n.setTab(vi[(l+s+vi.length)%vi.length]);},[n]);return jsxRuntime.jsx("div",{className:ao("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:o??vi.map(a=>jsxRuntime.jsx(Pi,{value:a},a))})}function Pi({value:e,className:t,style:o,children:n}){let{pane:r,t:i}=Vo("Tab"),a=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":a,"aria-controls":`docx-nav-panel-${e}`,tabIndex:a?0:-1,className:ao("docx-nav__tab",a&&"docx-nav__tab--selected",t),style:o,onClick:()=>r.setTab(e),children:n??i(`navigation.tabs.${e}`)})}function vv({value:e,onChange:t,onClear:o,placeholder:n,label:r,clearLabel:i,autoFocus:a,onEnter:s}){let l=Pt.useRef(null);return Pt.useEffect(()=>{a&&l.current?.focus();},[a]),jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(z,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{ref:l,type:"search",className:"docx-nav__search-input",value:e,placeholder:n,"aria-label":r,autoFocus:a,onChange:c=>t(c.target.value),onKeyDown:c=>{!s||c.key!=="Enter"||c.nativeEvent.isComposing||(c.preventDefault(),s(c.shiftKey));}}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":i,onClick:o,children:jsxRuntime.jsx(z,{name:"close",size:16})})]})}function Si({className:e,style:t}){let{pane:o,outline:n,intents:r,t:i}=Vo("Headings"),[a,s]=Pt.useState(""),l=O(In),c=Pt.useMemo(()=>{let f=a.trim().toLowerCase();return f.length===0?n.items:n.items.filter(u=>u.heading.text.toLowerCase().includes(f))},[n.items,a]),d=o.tab!=="headings";return jsxRuntime.jsxs("div",{className:ao("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:d,children:[jsxRuntime.jsx(vv,{value:a,onChange:s,onClear:()=>s(""),placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel")}),l?null:n.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((f,u)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__heading",n.selectedBlockId===f.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+f.depth*14}px`},title:f.heading.text,onClick:()=>{n.goTo(f.heading.blockId),r.picked();},children:f.heading.text})},`${f.heading.blockId}-${u}`))})]})}function m8({match:e,active:t,onSelect:o}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:o,children:jsxRuntime.jsxs("span",{className:"docx-nav__result-text",children:[e.contextBefore,jsxRuntime.jsx("mark",{className:"docx-nav__result-hit",children:e.text}),e.contextAfter]})})})}function Ei({className:e,style:t}){let{pane:o,search:n,intents:r,t:i}=Vo("Find"),a=o.tab!=="find",s=n.query.trim().length>0,l=o.open&&!a,c=n.matches.length===0?null:n.activeIndex<0?i(n.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:n.matches.length}):i(n.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:n.activeIndex+1,total:n.matches.length});return jsxRuntime.jsxs("div",{className:ao("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(vv,{value:n.query,onChange:n.setQuery,onClear:n.clear,placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel"),autoFocus:l,onEnter:d=>{n.isPending&&n.find(n.query),d?n.previous():n.next();}}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":i("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.matchCase,onChange:d=>n.setMatchCase(d.target.checked)}),i("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.wholeWord,onChange:d=>n.setWholeWord(d.target.checked)}),i("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:s?n.isPending?i("navigation.find.searching"):c??i("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.previousAriaLabel"),disabled:n.matches.length===0,onClick:n.previous,children:jsxRuntime.jsx(z,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.nextAriaLabel"),disabled:n.matches.length===0,onClick:n.next,children:jsxRuntime.jsx(z,{name:"keyboard_arrow_down",size:18})})]})]}),n.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":i("navigation.find.resultsAriaLabel"),children:n.matches.map((d,f)=>jsxRuntime.jsx(m8,{match:d,active:f===n.activeIndex,onSelect:()=>{n.goTo(f),r.picked();}},`${d.blockId}-${d.start}-${f}`))})]})}function wi({className:e,style:t,children:o}){let{pane:n,intents:r,findShortcut:i,t:a}=Vo("Toggle"),l=ko()("Ctrl+F"),c=i?dv(l):void 0,d=i?a("navigation.openShortcutTitle",{shortcut:l}):a("navigation.openTitle");return jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__toggle",e),style:t,"aria-label":a("navigation.openAriaLabel"),"aria-expanded":n.open,"aria-keyshortcuts":c,title:d,onMouseDown:f=>f.preventDefault(),onClick:r.toggle,children:o??jsxRuntime.jsx(z,{name:"toc",size:20})})}function Bp(e){let t=Ct(),{t:o,toggle:n=true,searchHighlight:r="all",findShortcut:i=true,className:a,style:s,children:l,...c}=e,d=Fs(c),f=Ns(),u=d.open&&d.tab==="find"?r:"none",g=Ls({highlight:u}),m=Ue(),p=Pt.useMemo(()=>o??((h,b)=>m(h,b)),[o,m]),v=gv(d,i),y=Pt.useMemo(()=>({pane:d,outline:f,search:g,t:p,intents:v.intents,findShortcut:i}),[d,f,g,p,v.intents,i]),x=e.paneWidth??280;return jsxRuntime.jsx(Np.Provider,{value:y,children:jsxRuntime.jsxs("div",{ref:v.rootRef,className:`${t}docx-nav${d.open?" docx-nav--open":""}${d.overlay?" docx-nav--overlay":""}${a?` ${a}`:""}`,"data-open":d.open?"true":"false",onKeyDown:v.onKeyDown,style:{"--docx-nav-width":`${x}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${Or(x)}px`,...s},children:[n!==false&&!d.open&&jsxRuntime.jsx(wi,{...typeof n=="object"?n:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":y.t("navigation.ariaLabel"),inert:!d.open,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yi,{}),jsxRuntime.jsx(Ti,{}),jsxRuntime.jsx(Si,{}),jsxRuntime.jsx(Ei,{})]})})]})})}var Hs=Object.assign(Bp,{Header:yi,Close:xi,Title:Ci,Tabs:Ti,Tab:Pi,Headings:Si,Find:Ei,Toggle:wi});var x8=600,C8=e=>e.isOpening===true?0:e.page.total,As=Pt.createContext(null);function Os({className:e,style:t}){let o=Ct(),n=F(),r=Ye(),{inside:i,host:a,hostScoped:s}=s0(r),l=O(C8),{t:c}=N(),d=Pt.useContext(As),[f,u]=Pt.useState(1),[g,m]=Pt.useState(false);if(Pt.useEffect(()=>{if(m(false),!n||!r||l<=1)return;u(n.getCurrentPage("viewport"));let x=null,h=()=>{u(n.getCurrentPage("viewport")),m(true),x&&clearTimeout(x),x=setTimeout(()=>m(false),x8);};return r.addEventListener("scroll",h,{passive:true}),()=>{r.removeEventListener("scroll",h),x&&clearTimeout(x);}},[n,l,r]),l<=1)return null;let p=a?s?"":"docx-editor ":o,v=d?d("viewer.pageIndicator").replace(/\{current\}/g,String(f)).replace(/\{total\}/g,String(l)):c("viewer.pageIndicator",{current:f,total:l}),y=jsxRuntime.jsx("div",{className:`${p}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":g?"true":"false",role:"status","aria-live":"polite",children:v});return i?a?reactDom.createPortal(y,a):null:y}var S8=[],E8=e=>e.fontSubstitutions??S8;function Bs({className:e,style:t,t:o}){let n=O(E8),{t:r}=N(),i=o??r,[a,s]=Pt.useState(null);if(n.length===0)return null;let l=n.join("\0");return a===l?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:i("editor.fontSubstitutionNotice",{fonts:n.join(", ")}).replace("{fonts}",n.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>s(l),children:i("common.dismiss")})]})}function Zp(e){return Math.round(e/1440*100)/100}function Pv(e){return Math.round(e*1440)}function R8(e,t){return e===t?true:!e||!t?false:e.editing===t.editing&&e.sectionIndex===t.sectionIndex&&e.variant===t.variant&&e.rId===t.rId&&e.partName===t.partName&&e.inherited===t.inherited&&e.titlePage===t.titlePage&&e.evenAndOddHeaders===t.evenAndOddHeaders&&e.headerDistanceTwips===t.headerDistanceTwips&&e.footerDistanceTwips===t.footerDistanceTwips}function qp(){let e=F(),t=Pt.useCallback(o=>e?.getHeaderFooterState()??null,[e]);return O(t,R8)}function I8(e,t){return t==="first"?e==="header"?"headerFooter.firstPageHeader":"headerFooter.firstPageFooter":t==="even"?e==="header"?"headerFooter.evenPageHeader":"headerFooter.evenPageFooter":e==="header"?"headerFooter.header":"headerFooter.footer"}var _8=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Mi(e){let t=F();return Pt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function N8(e){let{state:t,onMouseDown:o}=e,{t:n}=N(),r=F(),[i,a]=Pt.useState(false),s=Pt.useRef(null),[l,c]=Pt.useState(""),[d,f]=Pt.useState("");Pt.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(c(String(Zp(t.headerDistanceTwips))),f(String(Zp(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),Pt.useEffect(()=>{if(!i)return;let P=T=>{s.current?.contains(T.target)||a(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[i]);let u=Pt.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=Pt.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),m=Pt.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),p=Pt.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),v=Pt.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),y=Mi(u),x=Mi(g),h=Mi(m),b=Mi(p),S=Mi(v),C=(P,T)=>{if(!r)return;let R=Number.parseFloat(T);Number.isFinite(R)&&r.exec({type:"setHeaderFooterOptions",[P]:Pv(R)});};return jsxRuntime.jsxs("div",{ref:s,className:"docx-hf-chrome__options",onMouseDown:o,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":i,"aria-haspopup":"menu",onClick:()=>a(P=>!P),onMouseDown:o,children:n("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:o,children:[_8.map(P=>{let T={type:"insertPageField",field:P.field},R=r?.can(T);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!R?.ok,title:R&&!R.ok?R.reason:void 0,onClick:()=>{r?.exec(T),a(false);},onMouseDown:o,children:n(P.labelKey)},P.field)}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.titlePage===true,disabled:!y.enabled,title:y.reason??void 0,onChange:()=>r?.exec(u)}),jsxRuntime.jsx("span",{children:n("headerFooter.differentFirstPage")})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.evenAndOddHeaders===true,disabled:!x.enabled,title:x.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[n("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:n("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!b.enabled,title:b.reason??void 0,onClick:()=>r?.exec(p),onMouseDown:o,children:n("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!h.enabled,title:h.reason??void 0,onClick:()=>r?.exec(m),onMouseDown:o,children:n("headerFooter.linkToPrevious")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.headerDistance"),value:l,onChange:P=>c(P.target.value),onBlur:()=>C("headerDistanceTwips",l)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.footerDistance"),value:d,onChange:P=>f(P.target.value),onBlur:()=>C("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!S.enabled,title:S.reason??void 0,onClick:()=>r?.exec(v),onMouseDown:o,children:t.editing==="header"?n("headerFooter.removeHeader"):n("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),a(false);},onMouseDown:o,children:n("common.close")})]}):null]})}function Zs({className:e}){let{t}=N(),o=qp(),n=Pt.useCallback(s=>s.querySelector("[data-docx-hf-active]"),[]),r=ya(n,"story-label"),i=B;if(!o?.editing)return null;let a=I8(o.editing,o.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:ct.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),o.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(N8,{state:o,onMouseDown:i})]})}var A8={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},O8={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},B8={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},Z8={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},q8={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},K8={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:"var(--doc-z-overlay)",backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},W8={padding:"8px 12px"},z8={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},$8={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},U8={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function V8({forwardedRef:e}){let t=F(),o=Pt.useRef(null);return o.current=t,d0({ref:e,editorRef:o}),null}var G8=Pt.forwardRef(function(t,o){let{document:n,fonts:r,className:i,t:a,chrome:s=true,title:l,onTitleChange:c,renderTitleBarLeft:d,renderTitleBarRight:f,loadingIndicator:u,colorMode:g="light",author:m,locale:p,mode:v="edit",modules:y,zoom:x,zoomMode:h,revisionMarkup:b,onRevisionMarkupChange:S,reviewDisplayMode:C,fieldResults:P,onReady:T,onChange:R,onFontError:M,onOpen:E,onSave:_,hyperlinkPopup:H,contextMenu:L=true,menu:k=true,navigation:w=true,rulers:I=true}=t;!s&&u!==void 0&&Vg();let[$,W]=Pt.useState(bg);Pt.useEffect(()=>{if(g==="system")return yg(W)},[g]);let ee=vg(g,$),{t:V}=N(),se=Pt.useCallback((K,Z)=>a?a(K,Z):V(K,Z),[a,V]),U=jsxRuntime.jsxs(Zl,{className:s?ee?"dark":void 0:i,style:s?O8:void 0,children:[s?jsxRuntime.jsx(Zs,{}):null,s?jsxRuntime.jsx(fl,{}):null,jsxRuntime.jsx(Ll,{}),I&&s?jsxRuntime.jsx("div",{style:q8,children:jsxRuntime.jsx(Ds,{})}):null,t.children]}),ce=s?jsxRuntime.jsxs("div",{className:`docx-editor${ee?" dark":""}${i?` ${i}`:""}`,style:A8,children:[jsxRuntime.jsxs("div",{style:K8,children:[jsxRuntime.jsxs("div",{style:z8,children:[d?.(),jsxRuntime.jsxs("div",{style:$8,children:[c?jsxRuntime.jsx("input",{"aria-label":se("titleBar.documentNameAriaLabel"),value:l??"",placeholder:se("titleBar.untitled"),onChange:K=>c(K.target.value),style:U8}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:l??se("titleBar.untitled")}),k!==false?jsxRuntime.jsx(ci,{t:se,...l!==void 0?{fileName:l}:{},...E?{onOpen:E}:{},..._?{onSave:_}:{},...typeof k=="object"?k:{}}):null]}),f?.()]}),jsxRuntime.jsx("div",{style:W8,children:jsxRuntime.jsx(ri,{t:se})})]}),I?jsxRuntime.jsx("div",{style:Z8,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(Rs,{})}):null,jsxRuntime.jsx(Bs,{t:se}),jsxRuntime.jsxs("div",{style:B8,children:[w===false?null:jsxRuntime.jsx(Hs,{t:se,...typeof w=="object"?w:{}}),U,jsxRuntime.jsx(As.Provider,{value:se,children:jsxRuntime.jsx(Os,{})}),jsxRuntime.jsx(Hl,{overlay:true,indicator:u})]})]}):U,pe=Pt.useCallback(K=>se(K),[se]);return jsxRuntime.jsxs(Na,{popups:Gf(t.popups,H,L,se),...n!==void 0?{document:n}:{},...r?{fonts:r}:{},...m!==void 0?{author:m}:{},...p!==void 0?{locale:p}:{},translate:se,mode:v,...y!==void 0?{modules:y}:{},...x!==void 0?{zoom:x}:{},revisionMarkup:b,onRevisionMarkupChange:S,reviewDisplayMode:C,...P!==void 0?{fieldResults:P}:{},...h!==void 0?{zoomMode:h}:{},tableInteractionLabel:pe,...T?{onReady:T}:{},...R?{onChange:R}:{},...M?{onFontError:M}:{},children:[jsxRuntime.jsx(V8,{forwardedRef:o}),jsxRuntime.jsx(vn.Provider,{value:s,children:ce})]})}),j8=Pt.forwardRef(function(t,o){return jsxRuntime.jsx(Un,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(G8,{...t,ref:o})})}),Y8=Object.assign(j8,{Root:Na,Viewport:Zl,Content:Ll,Toolbar:ri,Menu:ci,Loading:Hl,ColorByChangeType:vu,RevisionMarkup:Nc,RevisionMarkupDialog:Ur,AuthorStyle:yu,HorizontalRuler:Rs,VerticalRuler:Ds,DocumentOutline:_p,Navigation:Hs,ExportDialog:Vr,PrintDialog:Gr,PageSetupDialog:Sn,ParagraphDialog:yo,TextFormFieldDialog:Ma,PageNumber:Os,FontNotice:Bs,HeaderFooterChrome:Zs,NotesChrome:fl,Equation:oa,HyperLink:Jr,ContextMenu:Pd,ContentControlWidget:ru,InvalidTextFormFieldDialog:Hd,ImageAltTextPopup:Cl,ImagePropertiesDialog:Ca,NotePropertiesDialog:gl,NotePreview:jn,NotesContextMenu:Yn,ContentControl:ta});function tI(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Wp(e){return Array.isArray(e)?e:[e]}function oI(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function Rv(e){return e!==void 0&&Wp(e).some(t=>editor.isFontResolver(t))}async function nI(e){return typeof e!="function"?await e:await e()}function rI(e,t={}){let[o,n]=Pt.useState(void 0),[r,i]=Pt.useState(void 0),[a,s]=Pt.useState(null),[l,c]=Pt.useState(e!=null),d=Rv(t.fonts),f=t.fonts===void 0?"absent":d?"on-demand":"eager",[u,g]=Pt.useState(t.fonts===void 0),m=Pt.useRef(t);m.current=t;let p=Pt.useMemo(()=>editor.defineFontResolver(v=>editor.composeFontOrigins(Wp(m.current.fonts??[]).map(oI),v)),[]);return Pt.useEffect(()=>{let v=m.current.fonts;if(v===void 0){i(void 0),g(true);return}if(Rv(v)){g(true);return}g(false);let y=true;return (async()=>{try{let x=await Promise.allSettled(Wp(v).map(nI)),h=[];for(let b of x){if(b.status==="rejected"){console.warn("[fonts] font loading failed for one origin; the others still compose",b.reason);continue}b.value!==void 0&&h.push(b.value);}y&&h.length>0&&i(editor.composeFontConfiguration(h[0],...h.slice(1)));}catch(x){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",x);}finally{y&&g(true);}})(),()=>{y=false;}},[f]),Pt.useEffect(()=>{if(e==null){n(void 0),s(null),c(false);return}let v=tI(e);if(v){n(v),s(null),c(false);return}let y=true,x=new AbortController;return c(true),s(null),(async()=>{try{let h=await fetch(String(e),{...m.current.fetchOptions,signal:x.signal});if(!h.ok)throw new Error(`could not open the document: ${h.status} ${h.statusText}`);let b=new Uint8Array(await h.arrayBuffer());if(!y)return;n(b),c(!1);}catch(h){if(!y||h instanceof Error&&h.name==="AbortError")return;s(h instanceof Error?h:new Error("could not open the document")),c(false);}})(),()=>{y=false,x.abort();}},[e]),{document:u?o:void 0,fonts:d?p:r,error:a,isLoading:l||!u}}function cI(...e){let t=Pt.useRef(e);return t.current=e,Pt.useMemo(()=>editor.defineFontResolver(o=>editor.composeFontOrigins(t.current,o)),[])}function pI(e){let o=e?.surface?.state?.().selection?.head;return o&&typeof o.paragraphId=="string"&&Number.isFinite(o.offset)?o:null}function mI(){let e=F(),t=Pt.useRef(null),o=Pt.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),n=Pt.useCallback(()=>{let r=pI(e),i=t.current;return (r===null?i===null:i!==null&&fI(i,r))?i:(t.current=r,r)},[e]);return Pt.useSyncExternalStore(o,n,()=>null)}function fI(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}var Nv=Object.freeze({applied:0,unavailable:0});function Lv(e){if(!e)return "";let{color:t,activeColor:o,activeIndex:n,className:r,priority:i}=e;return JSON.stringify([t,o,n,r,i])}function vI(e,t,o){let n=F(),[r,i]=Pt.useState(Nv),a=Pt.useRef(null),s=Pt.useRef(o);s.current=o;let l=Pt.useRef(t);l.current=t;let c=Lv(o);return Pt.useEffect(()=>{if(!n){i(Nv);return}let d=editor.watchHighlights(n,e,l.current,{...s.current,onResult:i});return a.current={watch:d,source:l.current,key:Lv(s.current)},i(d.result),()=>{d.stop(),a.current=null;}},[n,e]),Pt.useEffect(()=>{let d=a.current;!d||d.source===t&&d.key===c||(d.source=t,d.key=c,d.watch.update(t,s.current??{}));},[t,c]),r}function CI(e,t){return e===t?true:!e||!t?false:e.name===t.name&&e.index===t.index&&e.range===t.range&&e.active===t.active&&e.rect.left===t.rect.left&&e.rect.top===t.rect.top&&e.rect.width===t.rect.width&&e.rect.height===t.rect.height}function TI(e){let t=F(),[o,n]=Pt.useState(null);return Pt.useEffect(()=>{if(!t){n(null);return}let r=globalThis.document,i=0,a=null,s=()=>{i=0;let u=a?t.getHighlightsAt(a.x,a.y).find(g=>e===void 0||g.name===e)??null:null;n(g=>CI(g,u)?g:u);},l=()=>{i===0&&(i=requestAnimationFrame(s));},c=u=>{let g=u.target;a=g instanceof Element&&g.closest("[data-page-index]")!==null?{x:u.clientX,y:u.clientY}:null,l();},d=u=>{u.relatedTarget||(a=null,l());};r.addEventListener("pointermove",c,{passive:true}),r.addEventListener("pointerout",d,{passive:true}),r.addEventListener("scroll",l,{passive:true,capture:true});let f=t.on("change",l);return ()=>{r.removeEventListener("pointermove",c),r.removeEventListener("pointerout",d),r.removeEventListener("scroll",l,{capture:true}),f(),i!==0&&cancelAnimationFrame(i);}},[t,e]),o}function $p({source:e,scale:t,measurer:o,onStateChange:n,onError:r,className:i,documentFontFamily:a,ref:s}){let l=Pt.useRef(null),c=Pt.useRef(null),[d,f]=Pt.useState(null),u=Pt.useRef(n);u.current=n;let g=Pt.useRef(r);return g.current=r,Pt.useEffect(()=>{let m=l.current;if(!m)return;let p=editor.mountPaginatedSurface(m,e,{...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onChange:y=>{f(y),u.current?.(y);}});if(!p.ok){g.current?.(p.reason,p.detail);return}c.current=p.surface;let v=p.surface.state();return f(v),u.current?.(v),()=>{p.surface.destroy(),c.current=null;}},[e,o]),Pt.useImperativeHandle(s,()=>({focus:()=>c.current?.focus(),type:m=>c.current?.type(m),undo:()=>c.current?.undo(),redo:()=>c.current?.redo(),selectAll:()=>c.current?.selectAll(),navigate:(m,p)=>c.current?.navigate(m,p),toggleRunProperty:(m,p)=>c.current?.toggleRunProperty(m,p),setRunProperty:(m,p)=>c.current?.setRunProperty(m,p),setParagraphProperty:(m,p,v)=>c.current?.setParagraphProperty(m,p,v),formatting:()=>c.current?.formatting()??null,sectionProperties:()=>c.current?.sectionProperties()??null,save:()=>c.current?.save()??null}),[]),jsxRuntime.jsx("div",{ref:l,style:{margin:"24px auto",...a?{fontFamily:a}:{}},className:i?`docx-paginated-surface ${i}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Di=Pt.createContext(null);function Fv(){let e=Pt.useContext(Di);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function II(e){return "type"in e&&e.type==="separator"}var Ov={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},_I={...Ov,background:"var(--doc-bg-hover)"},Bv={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},NI={...Bv,opacity:.4,cursor:"default"},LI={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},FI={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},HI={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function ki({label:e,items:t,disabled:o,showChevron:n=false}){let[r,i]=Pt.useState(false),[a,s]=Pt.useState(null),l=Pt.useRef(null),c=Pt.useRef(null),[d,f]=Pt.useState({top:0,left:0}),u=Pt.useCallback(()=>{i(false),s(null);},[]);Pt.useEffect(()=>{if(!r||!l.current)return;let m=l.current.getBoundingClientRect();f({top:m.bottom+2,left:m.left});},[r]),Pt.useEffect(()=>{if(!r)return;function m(y){let x=y.target;l.current&&!l.current.contains(x)&&c.current&&!c.current.contains(x)&&u();}function p(y){y.key==="Escape"&&u();}function v(){u();}return document.addEventListener("mousedown",m),document.addEventListener("keydown",p),window.addEventListener("scroll",v,true),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",p),window.removeEventListener("scroll",v,true);}},[r,u]);let g=m=>{m.disabled||m.submenuContent||m.onClick&&(m.onClick(),u());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",onClick:()=>!o&&i(!r),onMouseDown:m=>m.preventDefault(),disabled:o,style:r?_I:Ov,children:[e,n&&jsxRuntime.jsx(z,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:c,style:{position:"fixed",top:d.top,left:d.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:m=>m.preventDefault(),children:t.map((m,p)=>{if(II(m))return jsxRuntime.jsx("div",{style:LI},`sep-${p}`);let v=m;if(v.customContent)return jsxRuntime.jsx("div",{onMouseDown:h=>h.preventDefault(),children:v.customContent},v.label);let y=!!v.submenuContent,x=a===v.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>y&&s(v.label),onMouseLeave:()=>y&&s(null),children:[jsxRuntime.jsxs("button",{type:"button",style:v.disabled?NI:Bv,onClick:()=>g(v),onMouseDown:h=>h.preventDefault(),onMouseOver:h=>{v.disabled||(h.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent";},disabled:v.disabled,children:[v.icon&&jsxRuntime.jsx(z,{name:v.icon,size:18}),jsxRuntime.jsx("span",{children:v.label}),v.shortcut&&jsxRuntime.jsx("span",{style:FI,children:v.shortcut}),y&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(z,{name:"keyboard_arrow_right",size:16})})]}),y&&x&&jsxRuntime.jsx("div",{style:HI,onMouseDown:h=>h.preventDefault(),children:v.submenuContent(u)})]},v.label)})})]})}var Gp=18,OI=2,qv={width:Gp,height:Gp,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},BI={...qv,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},ZI={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Kv({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[n,r]=Pt.useState(0),[i,a]=Pt.useState(0),s=Pt.useCallback(()=>{n>0&&i>0&&e(n,i);},[n,i,e]),l=[];for(let d=1;d<=t;d++)for(let f=1;f<=o;f++){let u=d<=n&&f<=i;l.push(jsxRuntime.jsx("div",{style:u?BI:qv,onMouseEnter:()=>{r(d),a(f);},onClick:s,role:"gridcell","aria-selected":u},`${d}-${f}`));}let c=n>0&&i>0?`${i} \xD7 ${n}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:OI,gridTemplateColumns:`repeat(${o}, ${Gp}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:l}),jsxRuntime.jsx("div",{style:ZI,children:c})]})}function zI({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(o=>{let n=!o.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:n,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:n?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:n?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{n||(o.onClick?.(),t());},onMouseOver:r=>{n||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(z,{name:o.icon,size:18}),jsxRuntime.jsx("span",{children:o.label})]},o.label)})})}function $I(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Ws({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function UI(e){return e.replace(/\.docx$/i,"")}function Yp({value:e,onChange:t,placeholder:o,editable:n=true}){let{t:r}=N(),i=o??r("titleBar.untitled"),a=UI(e)??"";return n?jsxRuntime.jsx("input",{type:"text",value:a,onChange:s=>{let l=s.target.value;t?.(l.endsWith(".docx")?l:l+".docx");},placeholder:i,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:a||i})}function zs({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function $s(){let{t:e}=N(),t=Fv(),{disabled:o=false,onFormat:n,onPrint:r,onOpen:i,onSave:a,onPageSetup:s,onInsertImage:l,onInsertTable:c,showTableInsert:d=true,showHelpMenu:f=true,onInsertPageBreak:u,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:m,onInsertTOC:p,onWatermark:v,onRefocusEditor:y}=t,x=Pt.useCallback(C=>{!o&&n&&n(C);},[o,n]),h=Pt.useCallback((C,P)=>{!o&&c&&(c(C,P),requestAnimationFrame(()=>y?.()));},[o,c,y]),b=!!r||!!s,S=b||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[S&&jsxRuntime.jsx(ki,{label:e("toolbar.file"),disabled:o,items:[...i?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:i}]:[],...a?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:a}]:[],...(i||a)&&b?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...s?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:s}]:[]]}),jsxRuntime.jsx(ki,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>x("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>x("setRtl")}]}),jsxRuntime.jsx(ki,{label:e("toolbar.insert"),disabled:o,items:[...l?[{icon:"image",label:e("toolbar.image"),onClick:l}]:[],...d&&c?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:C=>jsxRuntime.jsx(Kv,{onInsert:(P,T)=>{h(P,T),C();}})}]:[],...l||d&&c?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:C=>jsxRuntime.jsx(zI,{closeMenu:C,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:u},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:g},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:m}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:p,disabled:!p},...v?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:v}]:[]]}),f&&jsxRuntime.jsx(ki,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>ii()}]})]})}function Xp({children:e}){let t=null,o=null,n=[],r=[];Pt.Children.forEach(e,a=>{Pt.isValidElement(a)&&(a.type===Ws?t=a:a.type===zs?o=a:a.type===$s?r.push(a):n.push(a));});let i=Pt.useCallback(a=>{let s=a.target;s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.tagName==="OPTION"||a.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx($I,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[n.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:n}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),o&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:o})]})}var Us={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},YI={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},Wv={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function XI(e,t){let o=Wv[t]??Wv[t.toLowerCase()]??t,r=e?.colorScheme?.[o];return typeof r=="string"&&r?r:Us[o]??"000000"}function zv(e){let t=e.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/.test(t))return t;if(/^[0-9A-F]{3}$/.test(t))return t.split("").map(o=>o+o).join("")}function Jp(e,t,o="000000"){if(!e||e.kind==="auto")return `#${o}`;if(e.kind==="hex")return `#${zv(e.value)??o}`;let n=Object.entries(t?.colorScheme??Us).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,n);return `#${r.ok?r.hex:XI(t,e.slot)}`}function So(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?zv(e.value):Jp(e,t).slice(1)}function $v(e){if(!e||e==="none")return "";let t=YI[e];return t?`#${t}`:""}var JI=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],QI=[{type:"base",keep:1,labelSuffix:""},{type:"tint",keep:.2,labelSuffix:", Lighter 80%"},{type:"tint",keep:.4,labelSuffix:", Lighter 60%"},{type:"tint",keep:.6,labelSuffix:", Lighter 40%"},{type:"shade",keep:.75,labelSuffix:", Darker 25%"},{type:"shade",keep:.5,labelSuffix:", Darker 50%"}];function Uv(e){let t=e??Us;return QI.map(o=>JI.map(n=>{let r=t[n.slot]??Us[n.slot]??"000000",a={hex:o.type==="base"?r.toUpperCase():o.type==="tint"?editor.applyThemeTint(r,o.keep):editor.applyThemeShade(r,o.keep),themeSlot:n.slot,label:`${n.name}${o.labelSuffix}`};return o.type==="tint"?a.tint=o.keep:o.type==="shade"&&(a.shade=o.keep),a}))}function ae(...e){return clsx.clsx(e)}var o_=classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),Xe=Pt__namespace.forwardRef(({className:e,variant:t,size:o,...n},r)=>jsxRuntime.jsx("button",{className:ae(o_({variant:t,size:o,className:e})),ref:r,...n}));Xe.displayName="Button";function Dt({content:e,children:t,side:o="bottom",delayMs:n=400}){let[r,i]=Pt__namespace.useState(false),[a,s]=Pt__namespace.useState({x:0,y:0}),l=Pt__namespace.useRef(null),c=Pt__namespace.useRef(null),d=Pt__namespace.useCallback(()=>{c.current=setTimeout(()=>{if(l.current){let m=l.current.getBoundingClientRect(),p=m.left+m.width/2,v=o==="top"?m.top-8:m.bottom+8;s({x:p,y:v});}i(true);},n);},[n,o]),f=Pt__namespace.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),i(false);},[]);Pt__namespace.useEffect(()=>()=>{c.current&&clearTimeout(c.current);},[]);let u=t.props,g=Pt__namespace.cloneElement(t,{ref:l,onMouseEnter:m=>{d(),u.onMouseEnter?.(m);},onMouseLeave:m=>{f(),u.onMouseLeave?.(m);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:a.x,top:a.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var Go=Ee__namespace.Root,jo=Ee__namespace.Group,Vs=Ee__namespace.Value;function Yo({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(Ee__namespace.Trigger,{className:ae("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:r=>{r.preventDefault(),o?.(r);},...n,children:[t,jsxRuntime.jsx(Ee__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(l_,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Xo({className:e,children:t,position:o="popper",onCloseAutoFocus:n,...r}){let i=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(Ee__namespace.Portal,{children:jsxRuntime.jsx("div",{className:ae("docx-editor",i&&"dark"),children:jsxRuntime.jsx(Ee__namespace.Content,{className:ae("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:a=>{a.preventDefault(),n?.(a);},...r,children:jsxRuntime.jsx(Ee__namespace.Viewport,{className:ae("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:a=>a.preventDefault(),children:t})})})})}function Fn({className:e,...t}){return jsxRuntime.jsx(Ee__namespace.Label,{className:ae("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function kt({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(Ee__namespace.Item,{className:ae("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),o?.(r);},...n,children:[jsxRuntime.jsx(Ee__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(Ee__namespace.ItemIndicator,{children:jsxRuntime.jsx(s_,{className:"h-4 w-4"})})})]})}function Hn({className:e,...t}){return jsxRuntime.jsx(Ee__namespace.Separator,{className:ae("-mx-1 my-1 h-px bg-muted",e),...t})}function l_({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function s_({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function Qp(e){let t=e.trim();if(!t)return "";let o=null,n="";for(let r of t){if((r==='"'||r==="'")&&o===null){o=r,n+=r;continue}if(r===o){o=null,n+=r;continue}if(r===","&&o===null)break;n+=r;}return n.trim().replace(/^['"]|['"]$/g,"")}var c_=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function jv({value:e,onChange:t,fonts:o=c_,documentFonts:n,disabled:r=false,className:i,placeholder:a="Arial",width:s=120,showPreview:l=true}){let{t:c}=N(),d=Pt__namespace.useMemo(()=>{if(!n)return [];let p=new Set(o.map(v=>v.name.toLowerCase()));return n.filter(v=>!p.has(v.name.toLowerCase()))},[n,o]),f=Pt__namespace.useMemo(()=>[...d,...o],[d,o]),u=Pt__namespace.useMemo(()=>e?f.find(v=>v.fontFamily===e||v.name.toLowerCase()===e.toLowerCase()||Qp(v.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,f,a]),g=Pt__namespace.useCallback(p=>{let v=f.find(y=>y.name===p);v&&t?.(Qp(v.fontFamily)||v.name);},[t,f]),m=Pt__namespace.useMemo(()=>{let p={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(v=>{let y=v.category||"other";p[y].push(v);}),p},[o]);return jsxRuntime.jsxs(Go,{value:u,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(Yo,{className:ae("h-8 text-sm",i),style:{minWidth:typeof s=="number"?`${s}px`:s},"aria-label":c("font.selectAriaLabel"),children:jsxRuntime.jsx(Vs,{placeholder:a,children:u})}),jsxRuntime.jsxs(Xo,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.documentFonts")}),d.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},`doc-${p.name}`))]}),jsxRuntime.jsx(Hn,{})]}),m["sans-serif"].length>0&&jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.sansSerif")}),m["sans-serif"].map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]}),m.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.serif")}),m.serif.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]}),m.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.monospace")}),m.monospace.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]}),m.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(jo,{children:m.other.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))})]})]})]})}function em(e){if(e===void 0)return;let t=e.map(o=>typeof o=="string"?{name:o,fontFamily:o,category:"other"}:o);if(jt()){let o=new Set,n=new Set;for(let r of t)n.has(r.name)&&!o.has(r.name)&&(console.warn(`[DocxEditor] Duplicate font name in fontFamilies: "${r.name}"`),o.add(r.name)),n.add(r.name);}return t}function p_(e,t,o,n){let i=Math.max(8,window.innerWidth-o-8),a=Math.max(8,window.innerHeight-n-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function bt({isOpen:e,onClose:t,align:o="left"}){let n=Pt.useRef(null),r=Pt.useRef(null),[i,a]=Pt.useState({top:0,left:0});Pt.useEffect(()=>{if(!e||!n.current)return;let c=n.current.getBoundingClientRect();o==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),f=p_(c.bottom+4,c.right-d.width,d.width,d.height);a(f);}else a({top:c.bottom+4,left:c.left});}):a({top:c.bottom+4,left:c.left});},[e,o]),Pt.useEffect(()=>{if(!e)return;let c=performance.now()+150,d=g=>{let m=g.target;n.current&&!n.current.contains(m)&&r.current&&!r.current.contains(m)&&t();},f=g=>{g.key==="Escape"&&t();},u=g=>{if(performance.now()<c)return;let m=g.target;m&&r.current&&r.current.contains(m)||m instanceof Element&&m!==document.documentElement&&m!==document.body&&n.current&&m.contains(n.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),window.addEventListener("scroll",u,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f),window.removeEventListener("scroll",u,true);}},[e,t]);let s=Pt.useCallback(c=>{c.preventDefault(),c.stopPropagation();},[]),l={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:n,dropdownRef:r,dropdownStyle:l,handleMouseDown:s}}var g_=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],h_=1,b_=400;function Jv(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function Qv(e,t,o){for(let n=t.length-1;n>=0;n--)if(t[n]<e)return t[n];return Math.max(e-1,o)}function ey({value:e,onChange:t,sizes:o=g_,disabled:n=false,className:r,placeholder:i="11",minSize:a=h_,maxSize:s=b_}){let{t:l}=N(),[c,d]=Pt.useState(false),[f,u]=Pt.useState(""),[g,m]=Pt.useState(false),p=Pt.useRef(null),v=Pt.useCallback(()=>{m(false),d(false);},[]),{containerRef:y,dropdownRef:x,dropdownStyle:h}=bt({isOpen:g,onClose:v}),b=e??(parseInt(i,10)||11),S=e!==void 0?e.toString():i,C=Pt.useCallback(L=>{if(L.preventDefault(),n)return;let k=Qv(b,o,a);t?.(k);},[b,o,a,n,t]),P=Pt.useCallback(L=>{if(L.preventDefault(),n)return;let k=Jv(b,o,s);t?.(k);},[b,o,s,n,t]),T=Pt.useCallback(L=>{L.preventDefault(),!n&&(d(true),u(S),m(true),requestAnimationFrame(()=>{p.current?.focus(),p.current?.select();}));},[n,S]),R=Pt.useCallback(L=>{u(L.target.value);},[]),M=Pt.useCallback(()=>{d(false);let L=parseFloat(f);if(!isNaN(L)&&L>=a&&L<=s){let k=Math.round(L*2)/2;t?.(k);}},[f,a,s,t]),E=Pt.useCallback(L=>{if(L.key==="Enter")L.preventDefault(),M(),m(false);else if(L.key==="Escape")d(false),m(false);else if(L.key==="ArrowUp"){L.preventDefault();let k=Jv(b,o,s);u(k.toString()),t?.(k);}else if(L.key==="ArrowDown"){L.preventDefault();let k=Qv(b,o,a);u(k.toString()),t?.(k);}},[M,b,o,s,a,t]),_=Pt.useCallback(L=>{t?.(L),m(false),d(false);},[t]),H=Pt.useCallback(L=>{L.target.tagName!=="INPUT"&&L.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:y,className:ae("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:C,disabled:n||b<=a,"aria-label":l("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(z,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:c?jsxRuntime.jsx("input",{ref:p,type:"text",value:f,onChange:R,onBlur:M,onKeyDown:E,className:ae("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":l("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:T,className:ae("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",n&&"opacity-50 cursor-not-allowed"),disabled:n,"aria-label":l("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:S})}),g&&jsxRuntime.jsx("div",{ref:x,style:{...h,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":l("fontSize.listLabel"),children:o.map(L=>jsxRuntime.jsx("button",{type:"button",onClick:()=>_(L),className:ae("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",L===b&&"bg-muted font-medium"),role:"option","aria-selected":L===b,children:L},L))}),jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:P,disabled:n||b>=s,"aria-label":l("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(z,{name:"add",size:18})})]})}var x_=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],js=18,C_=2,T_={position:"relative",display:"inline-block"},P_={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},S_={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},nm={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},rm={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},ny={display:"grid",gap:`${C_}px`},Ys={width:`${js}px`,height:`${js}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},ry={...Ys,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},ay={...Ys,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},E_={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},w_={display:"flex",alignItems:"center",gap:"6px"},M_={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},R_={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},ty={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},D_={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},k_={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},I_={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function am(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let n=$v(e);return n||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Jp(e,o)}function oy(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let o=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (o*299+n*587+r*114)/1e3>230}function iy(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():So(e,o))===t.toUpperCase():false}function __({matrix:e,selectedColor:t,theme:o,onSelect:n}){let[r,i]=Pt.useState(null);return jsxRuntime.jsx("div",{style:{...ny,gridTemplateColumns:`repeat(10, ${js}px)`},children:e.flatMap((a,s)=>a.map((l,c)=>{let d=`${s}-${c}`,f=r===d,u=iy(t,l.hex,o);return jsxRuntime.jsx("button",{type:"button",style:{...u?ay:f?ry:Ys,backgroundColor:`#${l.hex}`},title:l.label,"aria-label":l.label,"aria-selected":u,onClick:()=>n(l),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function N_({selectedColor:e,theme:t,onSelect:o}){let[n,r]=Pt.useState(null),{t:i}=N();return jsxRuntime.jsx("div",{style:{...ny,gridTemplateColumns:`repeat(10, ${js}px)`},children:x_.map((a,s)=>{let l=n===s,c=iy(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...c?ay:l?ry:Ys,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":c,onClick:()=>o(a.hex),onMouseDown:f=>f.preventDefault(),onMouseEnter:()=>r(s),onMouseLeave:()=>r(null)},a.hex)})})}function Bn({mode:e,value:t,onChange:o,theme:n,disabled:r=false,className:i,style:a,title:s,icon:l,autoLabel:c,splitButton:d=true,defaultColor:f}){let[u,g]=Pt.useState(false),[m,p]=Pt.useState(false),[v,y]=Pt.useState(false),[x,h]=Pt.useState(false),[b,S]=Pt.useState(""),[C,P]=Pt.useState(()=>f??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:T}=N();Pt.useEffect(()=>{let K=am(t,e,n).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(K)&&S(K.toUpperCase());},[t,e,n]);let R=Pt.useCallback(()=>g(false),[]),{containerRef:M,dropdownRef:E,dropdownStyle:_}=bt({isOpen:u,onClose:R}),H=n?.colorScheme??null,L=Pt.useMemo(()=>Uv(H),[H]),k=Pt.useMemo(()=>am(t,e,n),[t,e,n]),w=Pt.useMemo(()=>am(C,e,n),[C,e,n]),I=Pt.useCallback(()=>{r||g(K=>!K);},[r]),$=Pt.useCallback(K=>{let Z;e==="highlight"?Z=K.hex:Z={kind:"theme",slot:K.themeSlot,...K.tint!==void 0?{tint:K.tint}:{},...K.shade!==void 0?{shade:K.shade}:{}},P(Z),o?.(Z),g(false);},[e,o]),W=Pt.useCallback(K=>{let Z=e==="highlight"?K:{kind:"hex",value:K};P(Z),o?.(Z),g(false);},[e,o]),ee=Pt.useCallback(()=>{o?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,o]),V=Pt.useCallback(()=>{let K=b.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(K)){let Z=e==="highlight"?K:{kind:"hex",value:K};P(Z),o?.(Z),g(false),S("");}},[e,b,o]),se=Pt.useCallback(()=>{r||o?.(C);},[r,C,o]),U={...P_,...r?{cursor:"default",opacity:.38}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:m?{backgroundColor:"var(--doc-bg-hover)"}:{}},ce=T(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),pe=l??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:M,className:`docx-color-picker ${i||""}`,style:{...T_,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...D_,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...k_,...r?{cursor:"default"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:se,onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:r,title:s||ce,"aria-label":s||ce,children:[jsxRuntime.jsx(z,{name:pe,size:18}),jsxRuntime.jsx("div",{style:{...ty,backgroundColor:w==="transparent"?"#fff":w,outline:w==="transparent"||oy(w)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...I_,...r?{cursor:"default"}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:x?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:I,onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:s||ce,"aria-label":s||ce,"aria-haspopup":"true","aria-expanded":u,children:jsxRuntime.jsx(z,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:U,onClick:I,onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),disabled:r,title:s||ce,"aria-label":s||ce,"aria-haspopup":"true","aria-expanded":u,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(z,{name:pe,size:18}),jsxRuntime.jsx("div",{style:{...ty,backgroundColor:k==="transparent"?"#fff":k,outline:k==="transparent"||oy(k)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14})]}),u&&jsxRuntime.jsx("div",{ref:E,className:"docx-color-picker-dropdown",style:{..._,...S_},role:"dialog","aria-label":`${ce} picker`,onMouseDown:K=>{K.target.tagName!=="INPUT"&&K.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:E_,onClick:ee,onMouseDown:K=>K.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),c??T(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:T("colorPicker.themeColors")}),jsxRuntime.jsx(__,{matrix:L,selectedColor:t,theme:n,onSelect:$}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:T("colorPicker.standardColors")}),jsxRuntime.jsx(N_,{selectedColor:t,theme:n,onSelect:W}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:T("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:w_,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:M_,value:b,onChange:K=>S(K.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:K=>{K.key==="Enter"&&V();},onMouseDown:K=>{K.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...R_,opacity:/^[0-9A-Fa-f]{6}$/.test(b)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(b)?"pointer":"default"},onClick:V,onMouseDown:K=>K.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(b),children:T("common.apply")})]})]})})]})}var _i=20,im=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_left",size:_i}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_center",size:_i}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_right",size:_i}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_justify",size:_i}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function cy({value:e="left",onChange:t,disabled:o=false}){let{t:n}=N(),[r,i]=Pt.useState(false),a=Pt.useCallback(()=>i(false),[]),{containerRef:s,dropdownRef:l,dropdownStyle:c,handleMouseDown:d}=bt({isOpen:r,onClose:a}),f=Pt.useCallback(y=>{o||t?.(y),i(false);},[o,t]),u=im.find(y=>y.value===e)||im[0],g=n(u.labelKey),m=u.shortcutKey?n(u.shortcutKey):void 0,p=`${g}${m?` (${m})`:""}`,v=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",o&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!o&&i(y=>!y),disabled:o,"aria-label":p,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(z,{name:u.iconName,size:_i}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?v:jsxRuntime.jsx(Dt,{content:p,children:v}),r&&!o&&jsxRuntime.jsx("div",{ref:l,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:y=>y.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:im.map(y=>{let x=e===y.value,h=n(y.labelKey),b=y.shortcutKey?n(y.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${h}${b?` (${b})`:""}`,"data-testid":`alignment-${y.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:x?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:x?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{x||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=x?"var(--doc-primary-light)":"transparent";},onClick:()=>f(y.value),children:jsxRuntime.jsx(z,{name:y.iconName,size:18})},y.value)})})})]})}function Xs(){return {type:"none",level:0,isInList:false}}var O_={display:"inline-flex",alignItems:"center",gap:"4px"},dy={display:"inline-flex",alignItems:"center",gap:"4px"},tc={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},B_={...tc,backgroundColor:"var(--doc-bg-hover)"},Z_={...tc,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},q_={...tc,cursor:"default",opacity:.38},K_={width:"28px",height:"28px",padding:"2px"},W_={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Js=20;function Qs({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,style:a}){let[s,l]=Pt.useState(false),c={...t?q_:e?Z_:s?B_:tc,...a},d=f=>{f.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:c,onMouseDown:d,onClick:t?void 0:n,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:r})}function uy({listState:e,onBulletList:t,onNumberedList:o,onIndent:n,onOutdent:r,disabled:i=false,className:a,style:s,showIndentButtons:l=true,compact:c=false,hasIndent:d=false}){let{t:f}=N(),u=Pt.useCallback(()=>c?{...K_}:{},[c]),g=e?.type==="bullet",m=e?.type==="numbered",v=(e?.isInList||g||m)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...O_,...s},role:"group","aria-label":f("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:dy,role:"group","aria-label":f("lists.typeAriaLabel"),children:[jsxRuntime.jsx(Qs,{active:g,disabled:i,title:f("lists.bulletList"),onClick:t,style:u(),children:jsxRuntime.jsx(z,{name:"format_list_bulleted",size:Js})}),jsxRuntime.jsx(Qs,{active:m,disabled:i,title:f("lists.numberedList"),onClick:o,style:u(),children:jsxRuntime.jsx(z,{name:"format_list_numbered",size:Js})})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:W_,role:"separator"}),jsxRuntime.jsxs("div",{style:dy,role:"group","aria-label":f("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(Qs,{active:false,disabled:i||!v,title:f("lists.decreaseIndent"),onClick:r,style:u(),children:jsxRuntime.jsx(z,{name:"format_indent_decrease",size:Js})}),jsxRuntime.jsx(Qs,{active:false,disabled:i,title:f("lists.increaseIndent"),onClick:n,style:u(),children:jsxRuntime.jsx(z,{name:"format_indent_increase",size:Js})})]})]})]})}var $_=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function my({value:e,onChange:t,options:o=$_,disabled:n=false,className:r}){let{t:i}=N(),a=Pt__namespace.useMemo(()=>e===void 0?o[0]:o.find(c=>c.twipsValue===e)||o[0],[e,o]),s=Pt__namespace.useCallback(c=>{let d=parseInt(c,10);isNaN(d)||t?.(d);},[t]),l=c=>c.labelKey?i(c.labelKey):c.label;return jsxRuntime.jsxs(Go,{value:a.twipsValue.toString(),onValueChange:s,disabled:n,children:[jsxRuntime.jsx(Yo,{className:ae("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":i("lineSpacing.label"),title:i("lineSpacing.lineSpacingTitle",{label:l(a)}),children:jsxRuntime.jsx(kp,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Xo,{children:[o.map(c=>jsxRuntime.jsx(kt,{value:c.twipsValue.toString(),children:l(c)},c.twipsValue)),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(jo,{children:jsxRuntime.jsx(Fn,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var fy=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function gy({value:e,onChange:t,styles:o,disabled:n=false,className:r,width:i=120}){let{t:a}=N(),s=Pt__namespace.useMemo(()=>{let g=Th(o);return g.length===0?fy:g.map(m=>({...m,type:"paragraph",nameKey:fy.find(p=>p.styleId===m.styleId)?.nameKey}))},[o]),l=Pt__namespace.useCallback(g=>{t?.(g);},[t]),c=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",f=s.find(g=>g.styleId===d),u=f?c(f):d;return jsxRuntime.jsxs(Go,{value:d,onValueChange:l,disabled:n,children:[jsxRuntime.jsx(Yo,{className:ae("h-8 text-sm",r),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":a("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:u})}),jsxRuntime.jsx(Xo,{className:"min-w-[260px] max-h-[400px]",children:s.map(g=>jsxRuntime.jsx(kt,{value:g.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:Ch(g),children:c(g)})},g.styleId))})]})}var V_=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function by({value:e=1,onChange:t,levels:o=V_,disabled:n=false,className:r,compact:i=false}){let{t:a}=N(),s=Pt__namespace.useMemo(()=>{let g=o.find(m=>Math.abs(m.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[o,e]),l=Pt__namespace.useCallback(g=>{let m=parseFloat(g);isNaN(m)||t?.(m);},[t]),c=Pt__namespace.useMemo(()=>[...o].sort((g,m)=>g.value-m.value),[o]),d=Pt__namespace.useMemo(()=>[...c].reverse().find(g=>g.value<e-.001),[c,e]),f=Pt__namespace.useMemo(()=>c.find(g=>g.value>e+.001),[c,e]),u=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(n||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:n||!d,"aria-label":a("zoom.zoomOut"),children:jsxRuntime.jsx(z,{name:"remove",size:18})}),jsxRuntime.jsxs(Go,{value:e.toString(),onValueChange:l,disabled:n,children:[jsxRuntime.jsx(Yo,{className:ae(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":a("zoom.ariaLabel",{label:s}),children:jsxRuntime.jsx(Vs,{placeholder:"100%",children:s})}),jsxRuntime.jsx(Xo,{children:o.map(g=>jsxRuntime.jsx(kt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(n||!f)&&"opacity-30 cursor-not-allowed"),onClick:()=>f&&t?.(f.value),disabled:n||!f,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx(z,{name:"add",size:18})})]})}var j_=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function xy({onAction:e,disabled:t=false}){let{t:o}=N(),[n,r]=Pt.useState(false),i=Pt.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:s,dropdownStyle:l,handleMouseDown:c}=bt({isOpen:n,onClose:i}),d=Pt.useCallback(u=>{e(u),r(false);},[e]),f=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&r(u=>!u),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(z,{name:"border_all",size:20}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?f:jsxRuntime.jsx(Dt,{content:o("table.borders.tooltip"),children:f}),n&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:u=>u.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:j_.map(({action:u,icon:g,labelKey:m})=>jsxRuntime.jsx("button",{type:"button",title:o(m),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:p=>p.preventDefault(),onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:jsxRuntime.jsx(z,{name:g,size:18})},typeof u=="string"?u:u.type))})})]})}function Cy({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Pt.useCallback(a=>{if(typeof a=="string"){e({type:"borderColor",color:a.replace(/^#/,"")});return}let s=a.kind==="auto"?"000000":So(a,o);s&&e({type:"borderColor",color:s});},[e,o]);return jsxRuntime.jsx(Bn,{mode:"border",value:n,onChange:i,theme:o,disabled:t,title:r("table.borderColor")})}var Q_=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function Py({onAction:e,disabled:t=false}){let[o,n]=Pt.useState(false),{t:r}=N(),i=Pt.useCallback(()=>n(false),[]),{containerRef:a,dropdownRef:s,dropdownStyle:l,handleMouseDown:c}=bt({isOpen:o,onClose:i}),d=Pt.useCallback(u=>{e({type:"borderWidth",size:u}),n(false);},[e]),f=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&n(u=>!u),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(z,{name:"line_weight",size:20}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?f:jsxRuntime.jsx(Dt,{content:r("table.borderWidth"),children:f}),o&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:u=>u.stopPropagation(),children:Q_.map(({size:u,label:g,thickness:m})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:p=>p.preventDefault(),onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(m,1),backgroundColor:"#000",borderRadius:m>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},u))})]})}function Ey({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Pt.useCallback(a=>{typeof a=="string"&&e(a==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:a.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(Bn,{mode:"highlight",value:n,onChange:i,theme:o,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var t5={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},Kn={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Ry={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Dy({onAction:e,disabled:t=false,tableContext:o}){let{t:n}=N(),[r,i]=Pt.useState(false),[a,s]=Pt.useState(null),l=Pt.useCallback(()=>i(false),[]),{containerRef:c,dropdownRef:d,dropdownStyle:f,handleMouseDown:u}=bt({isOpen:r,onClose:l,align:"right"}),g=o?.table?.attrs?.justification??"left",m=Pt.useCallback(y=>{e(y),i(false);},[e]),p=(y,x,h,b,S)=>{let C=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...t5,backgroundColor:a===y&&!C?"var(--doc-bg-hover)":"transparent",color:C?"var(--doc-text-muted)":S?.danger?"var(--doc-error)":"var(--doc-text)",cursor:C?"not-allowed":"pointer"},onClick:()=>!C&&m(b),onMouseEnter:()=>s(y),onMouseLeave:()=>s(null),disabled:C,children:[jsxRuntime.jsx(z,{name:x,size:16,className:S?.danger&&!C?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:h})]},y)},v=jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:u,onClick:()=>!t&&i(y=>!y),disabled:t,"aria-label":n("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(z,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[r?v:jsxRuntime.jsx(Dt,{content:n("table.moreOptions"),children:v}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...f,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:y=>y.stopPropagation(),children:[p("addRowAbove","add",n("table.insertRowAbove"),"addRowAbove"),p("addRowBelow","add",n("table.insertRowBelow"),"addRowBelow"),p("addColumnLeft","add",n("table.insertColumnLeft"),"addColumnLeft"),p("addColumnRight","add",n("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("mergeCells","call_merge",n("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),p("splitCell","call_split",n("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("selectTable","select_all",n("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("deleteRow","delete",n("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),p("deleteColumn","delete",n("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),p("deleteTable","delete",n("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),jsxRuntime.jsx("div",{style:Ry,children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(y=>{let x={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:n({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:b=>b.preventDefault(),onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},onClick:()=>m({type:"cellVerticalAlign",align:y}),children:jsxRuntime.jsx(z,{name:x[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),jsxRuntime.jsx("div",{style:Ry,children:n("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(y=>{let x={left:"format_align_left",center:"format_align_center",right:"format_align_right"},h=g===y;return jsxRuntime.jsx("button",{type:"button",title:n({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",borderColor:h?"var(--doc-primary)":"var(--doc-border)",color:h?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:b=>b.preventDefault(),onClick:()=>m({type:"tableProperties",props:{justification:y}}),children:jsxRuntime.jsx(z,{name:x[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("headerRow","table_rows",n("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),p("distribute","view_column",n("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),p("autoFit","fit_width",n("tableAdvanced.autoFit"),{type:"autoFitContents"}),p("noWrap","wrap_text",n("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("properties","settings",n("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var n5=20;function rc({options:e,activeValue:t,triggerIcon:o,tooltipContent:n,onSelect:r,disabled:i=false,ariaLabel:a,testId:s,showLabels:l=false}){let[c,d]=Pt.useState(false),f=Pt.useCallback(()=>d(false),[]),{containerRef:u,dropdownRef:g,dropdownStyle:m,handleMouseDown:p}=bt({isOpen:c,onClose:f}),v=Pt.useCallback(x=>{i||r(x),d(false);},[i,r]),y=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",c&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!i&&d(x=>!x),disabled:i,"aria-label":a??n,"aria-expanded":c,"aria-haspopup":"true","data-testid":s,children:[jsxRuntime.jsx(z,{name:o,size:n5}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:u,style:{position:"relative",display:"inline-block"},children:[c?y:jsxRuntime.jsx(Dt,{content:n,children:y}),c&&!i&&jsxRuntime.jsx("div",{ref:g,style:{...m,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:x=>x.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:l?"column":"row",gap:l?1:2,minWidth:l?200:void 0},children:e.map(x=>{let h=t===x.value;return jsxRuntime.jsxs("button",{type:"button",title:x.label,"data-testid":s?`${s}-${x.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:h?"var(--doc-primary)":"var(--doc-text)",...l?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:b=>b.preventDefault(),onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:b=>{b.currentTarget.style.backgroundColor=h?"var(--doc-primary-light)":"transparent";},onClick:()=>v(x.value),children:[jsxRuntime.jsx(z,{name:x.iconName,size:18}),l&&jsxRuntime.jsx("span",{style:{flex:1},children:x.label})]},x.value)})})})]})}var r5=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function a5(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function Iy({imageContext:e,onChange:t,disabled:o=false}){let{t:n}=N(),r=r5.map(s=>({...s,label:n(s.labelKey)})),i=a5(e),a=r.find(s=>s.value===i)||r[0];return jsxRuntime.jsx(rc,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var l5=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function _y({onTransform:e,disabled:t=false}){let{t:o}=N(),n=l5.map(r=>({...r,label:o(r.labelKey)}));return jsxRuntime.jsx(rc,{options:n,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var $t=18;function It({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,ariaLabel:a}){let s=a?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),l=d=>{d.preventDefault();},c=jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",i),"data-active":e?"true":void 0,onMouseDown:l,onClick:t?void 0:n,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":a||o,"data-testid":s?`toolbar-${s}`:void 0,children:r});return o?jsxRuntime.jsx(Dt,{content:o,children:c}):c}function Ut({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:ae("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function p5(e){let t=Pt__namespace.default.useContext(Di);return t?{...t,...m5(e)}:e}function m5(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function dm(e){let{t}=N(),o=p5(e),{currentFormatting:n={},onFormat:r,onUndo:i,onRedo:a,canUndo:s=false,canRedo:l=false,disabled:c=false,className:d,style:f,enableShortcuts:u=true,editorRef:g,children:m,showFontPicker:p=true,fontFamilies:v,documentFonts:y,showFontSizePicker:x=true,showTextColorPicker:h=true,showHighlightColorPicker:b=true,showAlignmentButtons:S=true,showListButtons:C=true,showLineSpacingPicker:P=true,showStylePicker:T=true,documentStyles:R,theme:M,showZoomControl:E=true,zoom:_,onZoomChange:H,onRefocusEditor:L,imageContext:k,onImageWrapType:w,onImageTransform:I,onOpenImageProperties:$,tableContext:W,onTableAction:ee,inline:V=false}=o,se=Pt.useRef(null),U=Pt.useCallback(oe=>{!c&&r&&r(oe);},[c,r]),ce=Pt.useCallback(()=>{!c&&s&&i&&i();},[c,s,i]),pe=Pt.useCallback(()=>{!c&&l&&a&&a();},[c,l,a]),K=Pt.useCallback(oe=>{!c&&r&&r({type:"fontFamily",value:oe});},[c,r]),Z=Pt__namespace.default.useMemo(()=>em(v),[v]),be=Pt.useCallback(oe=>{!c&&r&&r({type:"fontSize",value:oe});},[c,r]),Re=Pt.useCallback(oe=>{!c&&r&&r({type:"textColor",value:oe});},[c,r]),ue=Pt.useCallback(oe=>{!c&&r&&r({type:"highlightColor",value:typeof oe=="string"?oe:""});},[c,r]),ze=Pt.useCallback(oe=>{!c&&r&&r({type:"alignment",value:oe});},[c,r]),_t=Pt.useCallback(()=>{!c&&r&&r("bulletList");},[c,r]),Je=Pt.useCallback(()=>{!c&&r&&r("numberedList");},[c,r]),ut=Pt.useCallback(()=>{!c&&r&&r("indent");},[c,r]),Pe=Pt.useCallback(()=>{!c&&r&&r("outdent");},[c,r]),co=Pt.useCallback(oe=>{!c&&r&&(r({type:"lineSpacing",value:oe}),requestAnimationFrame(()=>L?.()));},[c,r,L]),uo=Pt.useCallback(oe=>{!c&&r&&r({type:"applyStyle",value:oe});},[c,r]),po=Pt.useCallback(oe=>{!c&&ee&&(ee(oe),requestAnimationFrame(()=>L?.()));},[c,ee,L]);Pt.useEffect(()=>{if(!u)return;let oe=fe=>{if(fe.defaultPrevented)return;let yt=fe.target,zn=g?.current,ne=se.current,te=zn?.contains(yt),ve=ne?.contains(yt);if(!te&&!ve)return;if((fe.ctrlKey||fe.metaKey)&&!fe.altKey)switch(fe.key.toLowerCase()){case "b":fe.preventDefault(),U("bold");break;case "i":fe.preventDefault(),U("italic");break;case "u":fe.preventDefault(),U("underline");break;case "=":fe.shiftKey?(fe.preventDefault(),U("superscript")):(fe.preventDefault(),U("subscript"));break;case "l":fe.preventDefault(),ze("left");break;case "e":fe.preventDefault(),ze("center");break;case "r":fe.preventDefault(),ze("right");break;case "j":fe.preventDefault(),ze("both");break;case "k":fe.preventDefault(),U("insertLink");break}};return document.addEventListener("keydown",oe),()=>{document.removeEventListener("keydown",oe);}},[u,U,ze,g]);let Mo=Pt.useCallback(oe=>{let fe=oe.target;fe.tagName==="INPUT"||fe.tagName==="TEXTAREA"||fe.tagName==="SELECT"||fe.tagName==="OPTION"||oe.preventDefault();},[]),Gt=Pt.useCallback(oe=>{let fe=oe.target,yt=document.activeElement;fe.tagName==="SELECT"||fe.tagName==="OPTION"||yt?.tagName==="SELECT"||requestAnimationFrame(()=>{L?.();});},[L]);return jsxRuntime.jsxs("div",{ref:se,className:ae(!V&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:V?{display:"contents",...f}:f,role:V?void 0:"toolbar","aria-label":V?void 0:t("toolbar.ariaLabel"),"data-testid":V?void 0:"formatting-bar",onMouseDown:V?void 0:Mo,onMouseUp:V?void 0:Gt,children:[jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(It,{onClick:ce,disabled:c||!s,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(z,{name:"undo",size:$t})}),jsxRuntime.jsx(It,{onClick:pe,disabled:c||!l,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(z,{name:"redo",size:$t})})]}),E&&jsxRuntime.jsx(Ut,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(by,{value:_,onChange:H,disabled:c,compact:true})}),T&&jsxRuntime.jsx(Ut,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(gy,{value:n.styleId||"Normal",onChange:uo,styles:R,theme:M,disabled:c,width:120})}),(p||x)&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.font"),children:[p&&jsxRuntime.jsx(jv,{value:n.fontFamily||"Arial",onChange:K,fonts:Z,documentFonts:y,disabled:c,width:60,placeholder:"Arial"}),x&&jsxRuntime.jsx(ey,{value:n.fontSize!==void 0?hu(n.fontSize):11,onChange:be,disabled:c,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(It,{onClick:()=>U("bold"),active:n.bold,disabled:c,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(z,{name:"format_bold",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("italic"),active:n.italic,disabled:c,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(z,{name:"format_italic",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("underline"),active:n.underline,disabled:c,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(z,{name:"format_underlined",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("strikethrough"),active:n.strike,disabled:c,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(z,{name:"strikethrough_s",size:$t})}),h&&jsxRuntime.jsx(Bn,{mode:"text",value:n.color?.replace(/^#/,""),onChange:Re,theme:M,disabled:c,title:t("formattingBar.fontColor")}),b&&jsxRuntime.jsx(Bn,{mode:"highlight",value:n.highlight,onChange:ue,theme:M,disabled:c,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(It,{onClick:()=>U("insertLink"),disabled:c,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(z,{name:"link",size:$t})})]}),jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(It,{onClick:()=>U("superscript"),active:n.superscript,disabled:c,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(z,{name:"superscript",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("subscript"),active:n.subscript,disabled:c,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(z,{name:"subscript",size:$t})})]}),S&&jsxRuntime.jsx(Ut,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(cy,{value:n.alignment||"left",onChange:ze,disabled:c})}),(C||P)&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.listFormatting"),children:[C&&jsxRuntime.jsx(uy,{listState:n.listState||Xs(),onBulletList:_t,onNumberedList:Je,onIndent:ut,onOutdent:Pe,disabled:c,showIndentButtons:true,compact:true,hasIndent:(n.indentLeft??0)>0}),P&&jsxRuntime.jsx(my,{value:n.lineSpacing,onChange:co,disabled:c})]}),k&&w&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(Iy,{imageContext:k,onChange:w,disabled:c}),I&&jsxRuntime.jsx(_y,{onTransform:I,disabled:c}),$&&jsxRuntime.jsx(It,{onClick:$,disabled:c,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(z,{name:"tune",size:$t})})]}),W?.isInTable&&ee&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(xy,{onAction:po,disabled:c}),jsxRuntime.jsx(Cy,{onAction:po,disabled:c,theme:M,value:So(W?.cellBorderColor,M)}),jsxRuntime.jsx(Py,{onAction:po,disabled:c}),jsxRuntime.jsx(Ey,{onAction:po,disabled:c,theme:M,value:W?.cellBackgroundColor}),jsxRuntime.jsx(Dy,{onAction:po,disabled:c,tableContext:W})]}),jsxRuntime.jsx(It,{onClick:()=>U("clearFormatting"),disabled:c,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(z,{name:"format_clear",size:$t})}),m]})}function f5({children:e,className:t,style:o,...n}){return jsxRuntime.jsx(Di.Provider,{value:n,children:jsxRuntime.jsx("div",{className:ae("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:ct.toolbar,...o},"data-testid":"editor-toolbar",children:e})})}var vt=f5;vt.TitleBar=Xp;vt.Logo=Ws;vt.DocumentName=Yp;vt.MenuBar=$s;vt.TitleBarRight=zs;vt.Toolbar=dm;var b5=new Map([["#ffff00","yellow"],["#00ff00","green"],["#00ffff","cyan"],["#ff00ff","magenta"],["#0000ff","blue"],["#ff0000","red"],["#000080","darkBlue"],["#008080","darkCyan"],["#008000","darkGreen"],["#800080","darkMagenta"],["#800000","darkRed"],["#808000","darkYellow"],["#808080","darkGray"],["#c0c0c0","lightGray"],["#ffffff","white"]]),v5=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function y5({source:e,scale:t,measurer:o,documentName:n,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:s,renderTitleBarRight:l,ref:c,colorMode:d,onZoomChange:f,documentFontFamily:u,className:g}){let m=Pt.useRef(null),[p,v]=Pt.useState(null),[y,x]=Pt.useState({}),[h,b]=Pt.useState(null),S=Pt.useCallback(R=>{v(R);let M=m.current?.formatting();M&&x({bold:M.bold,italic:M.italic,underline:M.underline,strike:M.strikethrough,superscript:M.superscript,subscript:M.subscript,...M.fontFamily?{fontFamily:M.fontFamily}:{},...M.fontSizeHalfPoints?{fontSize:M.fontSizeHalfPoints}:{},...M.alignment?{alignment:M.alignment}:{},...M.styleId?{styleId:M.styleId}:{},...M.color?{color:`#${M.color}`}:{},...M.highlight?{highlight:M.highlight}:{}}),b(m.current?.sectionProperties()??null),r?.(R);},[r]),C=Pt.useCallback(R=>{let M=m.current;if(M){if(typeof R=="string")switch(R){case "bold":return M.toggleRunProperty("b");case "italic":return M.toggleRunProperty("i");case "underline":return M.toggleRunProperty("u",{val:"single"});case "strikethrough":return M.toggleRunProperty("strike");case "superscript":return M.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return M.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":M.setRunProperty("b",{val:"0"}),M.setRunProperty("i",{val:"0"}),M.setRunProperty("u",{val:"none"}),M.setRunProperty("strike",{val:"0"}),M.setRunProperty("vertAlign",{val:"baseline"});return;case "setRtl":case "setLtr":return M.setParagraphProperty("bidi",void 0,{paragraphDirection:R==="setRtl"?"rtl":"ltr"});default:return}switch(R.type){case "fontFamily":return M.setRunProperty("rFonts",{ascii:R.value,hAnsi:R.value});case "fontSize":return M.setRunProperty("sz",{val:String(Math.round(R.value*2))});case "textColor":{let E=R.value,_=typeof E=="string"?v5(E):So(E,null)??null;return _?M.setRunProperty("color",{val:_}):void 0}case "highlightColor":{let E=R.value.trim().toLowerCase();if(E==="none"||E==="")return M.setRunProperty("highlight",{val:"none"});let _=b5.get(E.startsWith("#")?E:`#${E}`);return _?M.setRunProperty("highlight",{val:_}):void 0}case "alignment":return M.setParagraphProperty("jc",{val:String(R.value)},{physicalAlignment:true});case "lineSpacing":return M.setParagraphProperty("spacing",{line:String(Math.round(R.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return M.setParagraphProperty("pStyle",{val:R.value});default:return}}},[]);Pt.useImperativeHandle(c,()=>m.current,[]);let P=t===void 0?1:t/(96/72),T=h?{pageWidthTwips:h.pageSize.widthTwips,pageHeightTwips:h.pageSize.heightTwips,orientation:h.landscape?"landscape":"portrait",marginsTwips:{top:h.margins.topTwips,right:h.margins.rightTwips,bottom:h.margins.bottomTwips,left:h.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",g??""].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:"var(--doc-bg)",color:"var(--doc-text)"},"data-testid":"paginated-shell",children:[jsxRuntime.jsxs(vt,{currentFormatting:y,onFormat:C,onUndo:()=>m.current?.undo(),onRedo:()=>m.current?.redo(),canUndo:p?.canUndo??false,canRedo:p?.canRedo??false,zoom:P,onZoomChange:f,onSave:()=>{let R=m.current?.save();R&&a?.(R);},children:[jsxRuntime.jsxs(vt.TitleBar,{children:[s&&jsxRuntime.jsx(vt.Logo,{children:s()}),jsxRuntime.jsx(vt.DocumentName,{value:n??"Document",editable:false}),l&&jsxRuntime.jsx(vt.TitleBarRight,{children:l()}),jsxRuntime.jsx(vt.MenuBar,{})]}),jsxRuntime.jsx(vt.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[T?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(kn,{pageSetup:T,zoom:P})}):null,jsxRuntime.jsx($p,{ref:m,source:e,...u?{documentFontFamily:u}:{},...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onStateChange:S,...i?{onError:i}:{}})]})]})}var ic=class{listeners=new Set;snapshot;constructor(t){this.snapshot=t;}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t);});getSnapshot=()=>this.snapshot;setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var lc=class extends ic{notifications=[];idCounter=0;timers=new Set;constructor(){super({notifications:[]});}showError(t,o){return this.addNotification(t,"error",o)}showWarning(t,o){return this.addNotification(t,"warning",o)}showInfo(t,o){return this.addNotification(t,"info",o)}dismiss(t){this.notifications=this.notifications.map(n=>n.id===t?{...n,dismissed:true}:n),this.emitSnapshot();let o=setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(n=>n.id!==t),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,o,n){let r=`error-${++this.idCounter}-${Date.now()}`,i={id:r,message:t,severity:o,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),o!=="error"){let a=setTimeout(()=>{this.timers.delete(a),this.dismiss(r);},5e3);this.timers.add(a);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var E5=Pt.createContext(null);function Ay({children:e}){let t=Pt.useMemo(()=>new lc,[]),o=Pt.useSyncExternalStore(t.subscribe,t.getSnapshot),n=Pt.useCallback((c,d)=>{t.showError(c,d);},[t]),r=Pt.useCallback((c,d)=>{t.showWarning(c,d);},[t]),i=Pt.useCallback((c,d)=>{t.showInfo(c,d);},[t]),a=Pt.useCallback(c=>{t.dismiss(c);},[t]),s=Pt.useCallback(()=>{t.clearAll();},[t]),l=Pt.useMemo(()=>({notifications:o.notifications,showError:n,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:s}),[o.notifications,n,r,i,a,s]);return jsxRuntime.jsxs(E5.Provider,{value:l,children:[e,jsxRuntime.jsx(w5,{notifications:o.notifications,onDismiss:a})]})}function w5({notifications:e,onDismiss:t}){let o=e.filter(r=>!r.dismissed);return o.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:o.map(r=>jsxRuntime.jsx(M5,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function M5({notification:e,onDismiss:t}){let{t:o}=N(),[n,r]=Pt.useState(false),a=(p=>{switch(p){case "error":return {bg:"var(--doc-error-bg)",border:"var(--doc-error)",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"var(--doc-warning)",text:"var(--doc-warning-text)",icon:"var(--doc-warning)"};case "info":return {bg:"var(--doc-primary-light)",border:"var(--doc-primary)",text:"var(--doc-primary)",icon:"var(--doc-primary)"}}})(e.severity),s={background:a.bg,border:`1px solid ${a.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"docx-notification-slide-in 0.3s ease-out"},l={display:"flex",alignItems:"flex-start",gap:"8px"},c={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},f={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},u={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:a.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:a.text},m=p=>{switch(p){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsx("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:s,children:jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("span",{style:c,children:m(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:f,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!n),style:{...g,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:o(n?"errors.hideDetails":"errors.showDetails")}),n&&jsxRuntime.jsx("div",{style:u,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:g,title:o("common.dismiss"),children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})})}var sc=class extends Pt.Component{constructor(t){super(t),this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",t,o),this.props.onError&&this.props.onError(t,o);}resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};render(){if(this.state.hasError){let{fallback:t,showDetails:o=true}=this.props,{error:n,errorInfo:r}=this.state;return t?typeof t=="function"?t(n,this.resetError):t:jsxRuntime.jsx(R5,{error:n,errorInfo:r,showDetails:o,onReset:this.resetError})}return this.props.children}};function R5({error:e,errorInfo:t,showDetails:o,onReset:n}){let{t:r}=N(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},a={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},l={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},c={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:i,children:[jsxRuntime.jsx("div",{style:a,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:s,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:l,children:r("errors.errorDescription")}),o&&jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
1
+ 'use strict';var Pt=require('react'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),editor=require('@docx-editor.dev/core/editor'),store=require('@docx-editor.dev/core/store'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),Ee=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Pt__namespace=/*#__PURE__*/_interopNamespace(Pt);var Ee__namespace=/*#__PURE__*/_interopNamespace(Ee);var fm={version:"2.29.0"};var Vy=fm.version;var dc=Pt.createContext(i18n.en),uc=Pt.createContext("en");function Un({i18n:e,children:t}){let o=Pt.useContext(dc),n=Pt.useContext(uc),r=typeof e?._lang=="string"?e._lang:n,i=Pt.useMemo(()=>i18n.deepMerge(o,e),[o,e]);return jsxRuntime.jsx(uc.Provider,{value:r,children:jsxRuntime.jsx(dc.Provider,{value:i,children:t})})}function N(){let e=Pt.useContext(dc),t=Pt.useContext(uc);return {t:Pt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function vm(e){let{t}=N();return Pt.useCallback((o,n)=>e?.get(o)??t(o,n),[e,t])}var pc=Pt.createContext(null);function F(){return Pt.useContext(pc)}var xt=Pt.createContext(null);var mc=0,fc=false,gc=false;function xm(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(fc||(fc=true,mc+=1,queueMicrotask(()=>{fc=false;}),gc||(gc=true,setTimeout(()=>{gc=false,mc=0;},0))),mc>16)}function Cm(e){let t=false;return ()=>{if(t)return;t=true;let o=()=>{t=false,e();};xm()?setTimeout(o,0):queueMicrotask(o);}}var tx=()=>{},bc=0;function ox(){return bc}function $r(e){return Cm(e)}function O(e,t=Object.is,o){let n=F(),r=o?.onSubscribe,i=o?.onUnsubscribe,a=Pt.useCallback(d=>{if(!n)return tx;let f=false;bc++,r?.();let u=$r(()=>{f||d();}),g=[n.on("change",u),n.on("selectionChange",u),n.on("error",u)];return ()=>{f=true,bc--,i?.();for(let m of g)m();}},[n,r,i]),s=Pt.useMemo(()=>{let d=false,f,u;return g=>{if(d&&g===f)return u;let m=e(g);return d&&t(u,m)?(f=g,u):(d=true,f=g,u=m,m)}},[n,e,t]),l=Pt.useCallback(()=>s(n?n.snapshot():editor.LOADING_SNAPSHOT),[n,s]),c=Pt.useCallback(()=>s(editor.LOADING_SNAPSHOT),[s]);return Pt.useSyncExternalStore(a,l,c)}function ix(e,t){return typeof t!="function"?e:typeof e!="function"?t:o=>{e(o),o.defaultPrevented||t(o);}}function lx(e,t){let o={...e,...t};for(let n of Object.keys(e))/^on[A-Z]/.test(n)?o[n]=ix(t[n],e[n]):n==="className"?o[n]=[e[n],t[n]].filter(Boolean).join(" "):n==="style"&&(o[n]={...e[n],...t[n]});return o}function j({children:e,...t}){let o=Pt.Children.only(e);if(!Pt.isValidElement(o))return null;let n=o.props,r=lx(t,n),i=o.ref,a=t.ref;return (i||a)&&(r.ref=s=>{for(let l of [i,a])typeof l=="function"?l(s):l&&typeof l=="object"&&(l.current=s);}),Pt.cloneElement(o,r)}var Sm=e=>{let t=e["data-docx-part"];return typeof t=="string"?t==="field"?`field:${e["data-docx-field"]}`:t:null};function Do(){let e=Pt.createContext(null),t=new Map,o=y=>{let x=t.get(y.type);return x==="field"?`field:${y.props.name}`:x};function n(y,x){Pt.Children.forEach(y,h=>{Pt.isValidElement(h)&&(x(h),n(h.props.children,x));});}function r(){let y=Pt.useContext(e);if(!y)throw new globalThis.Error("Dialog controls must be rendered inside their dialog.");return y.state}function i(y,x){return Pt.Children.map(y,h=>{if(!Pt.isValidElement(h))return h;let b=Sm(h.props);return b&&x.has(b)?x.get(b):h.props.children===void 0?h:Pt.cloneElement(h,{children:i(h.props.children,x)})})}function a(y){function x(h){let b=Pt.useContext(e);if(!b||h.hidden)return null;let S=y==="field"?`field:${h.name}`:y,C=b.defaults.get(S);if(!C)return h.children??null;let{children:P,asChild:T,className:R,style:M,hidden:E,name:_,...H}=h,L={...H,...C.props,className:[C.props.className,R].filter(Boolean).join(" "),style:{...C.props.style,...M}};if(T){let{children:k,className:w,style:I,...$}=L;return jsxRuntime.jsx(j,{...$,...R?{className:R}:{},...M?{style:M}:{},children:P})}return Pt.cloneElement(C,L,P===void 0?i(C.props.children,b.overrides):P)}return t.set(x,y),x}let s=a("header"),l=a("title"),c=a("body"),d=a("footer"),f=a("apply"),u=a("cancel"),g=a("reset"),m=a("error"),p=a("field");function v({defaults:y,children:x,preset:h=true,state:b}){let S=new Map;n(y,R=>{let M=Sm(R.props);M&&S.set(M,R);});let C=new Map;n(x,R=>{let M=o(R);M&&C.set(M,R);});let P=R=>Pt.Children.toArray(R).flatMap(M=>Pt.isValidElement(M)&&M.type===Pt.Fragment?P(M.props.children):[M]),T=P(x).filter(R=>!Pt.isValidElement(R)||!o(R));return jsxRuntime.jsx(e.Provider,{value:{defaults:S,overrides:C,state:b},children:h?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i(y,C),T]}):x})}return {Header:s,Title:l,Body:c,Footer:d,Apply:f,Cancel:u,Reset:g,Error:m,Field:p,Composition:v,useState:r}}function pt({kind:e,role:t="dialog",className:o,style:n,label:r,onClose:i,onKeyDown:a,panelRef:s,children:l,dismissOutside:c=true,sessionSignal:d,restoreFocus:f=true}){let u=Pt.useRef(null),g=s??u,m=Pt.useRef(i);return m.current=i,Pt.useLayoutEffect(()=>{let p=g.current;if(!p)return;p.parentElement?.closest(".docx-editor")||p.classList.add("docx-editor");let v=p.ownerDocument.activeElement,y=()=>{p.open&&p.close?.();};return d?.addEventListener("abort",y),typeof p.showModal=="function"?p.showModal():p.setAttribute("open",""),p.querySelector('input:not([disabled]),select:not([disabled]),button:not([disabled]),[tabindex="0"]')?.focus({preventScroll:true}),()=>{d?.removeEventListener("abort",y),typeof p.close=="function"&&p.open&&p.close(),f&&v?.isConnected&&v.focus({preventScroll:true});}},[g,d,f]),jsxRuntime.jsx("dialog",{ref:g,role:t,"aria-modal":"true","aria-label":r,className:`docx-dialog${o?` ${o}`:""}`,style:n,"data-docx-dialog":e,onCancel:p=>{p.preventDefault(),m.current();},onMouseDown:p=>p.stopPropagation(),onClick:p=>{if(c&&p.target===p.currentTarget){let v=p.currentTarget.getBoundingClientRect();(p.clientX<v.left||p.clientX>v.right||p.clientY<v.top||p.clientY>v.bottom)&&m.current();}p.stopPropagation();},onKeyDown:p=>{p.key==="Escape"&&!p.nativeEvent.isComposing?(p.preventDefault(),m.current()):editor.trapTabWithin(p.currentTarget,p.nativeEvent)?p.preventDefault():!p.nativeEvent.isComposing&&!p.defaultPrevented&&a?.(p),p.stopPropagation();},children:l})}function Ai(e,t){let o=F(),n=Cc(),r=Pt.useRef(null);return Pt.useEffect(()=>{if(!e){r.current=null;return}o?.surface&&(r.current===null?r.current=o.mountGeneration:r.current!==o.mountGeneration&&t());},[e,o,n,t]),()=>!!o?.surface&&r.current===o.mountGeneration}function Cc(){let e=F(),t=Pt.useCallback(o=>{if(!e)return ()=>{};let n=true,r=$r(()=>{n&&o();}),i=[e.on("change",r),e.on("selectionChange",r),e.on("error",r)];return ()=>{n=false,i.forEach(a=>a());}},[e]);return Pt.useSyncExternalStore(t,()=>e?.mountGeneration??0,()=>0)}function Em(){let e=0,t=0,o=null,n=new Set,r=new Set,i=new Set,a=s=>{for(let l of [...s])l();};return {getShift:()=>e,setShift(s){let l=Math.max(0,Math.round(s));l!==e&&(e=l,a(n));},subscribeShift(s){return n.add(s),()=>n.delete(s)},getReservation:()=>t,setReservation(s){let l=Math.max(0,Math.round(s));l!==t&&(t=l,a(r));},subscribeReservation(s){return r.add(s),()=>r.delete(s)},getViewport:()=>o,setViewport(s){s!==o&&(o=s,a(i));},subscribeViewport(s){return i.add(s),()=>i.delete(s)}}}var Pc=Pt.createContext(null);function rn(){return Pt.useContext(Pc)}var wm=()=>0,Sc=()=>()=>{};function an(){let e=rn(),t=Pt.useCallback(n=>e?e.subscribeShift(n):Sc(),[e]),o=Pt.useCallback(()=>e?e.getShift():0,[e]);return Pt.useSyncExternalStore(t,o,wm)}function Mm(){let e=rn(),t=Pt.useCallback(n=>e?e.subscribeReservation(n):Sc(),[e]),o=Pt.useCallback(()=>e?e.getReservation():0,[e]);return Pt.useSyncExternalStore(t,o,wm)}function Ye(){let e=rn(),t=Pt.useCallback(r=>e?e.subscribeViewport(r):Sc(),[e]),o=Pt.useCallback(()=>e?e.getViewport():null,[e]),n=Pt.useCallback(()=>null,[]);return Pt.useSyncExternalStore(t,o,n)}function fo(e,t,o){let n=Ye(),r=Pt.useRef({close:o,viewport:n});r.current={close:o,viewport:n},Pt.useEffect(()=>{let i=e.current;if(!(!t||!i))return Px(i,()=>r.current.close(),()=>r.current.viewport)},[e,t]);}function Px(e,t,o){let n=s=>{if(s.defaultPrevented||s.altKey||s.ctrlKey||s.metaKey)return;let l=s.target;if(l.matches('input[role="combobox"]')||l.matches("input, textarea, select")&&s.key!=="ArrowDown"&&s.key!=="ArrowUp")return;let d=Array.from(e.querySelectorAll('[role="option"]')).filter(g=>!g.matches(':disabled, [aria-disabled="true"]'));if(d.length===0)return;let f=d.indexOf(l),u;if(s.key==="Home")u=0;else if(s.key==="End")u=d.length-1;else if(s.key==="ArrowDown")u=(f+1)%d.length;else if(s.key==="ArrowUp")u=f<0?d.length-1:(f-1+d.length)%d.length;else return;s.preventDefault(),s.stopPropagation(),d[u]?.focus();},r=s=>{s.relatedTarget instanceof Node&&!e.contains(s.relatedTarget)&&t();},i=editor.listenForPopupEscape({popup:e,contains:s=>e.contains(s),chromeRoot:()=>e.closest(".docx-editor"),editorElements:()=>[o()],skip:s=>s.target instanceof Element&&e.contains(s.target)&&s.target.matches('input[role="combobox"]'),close:s=>{s&&e.querySelector("[aria-haspopup]")?.focus(),t();}}),a=editor.listenForPopupFocusLeave({popup:e,contains:s=>e.contains(s),close:t});return e.addEventListener("keydown",n),e.addEventListener("focusout",r),()=>{e.removeEventListener("keydown",n),e.removeEventListener("focusout",r),i(),a();}}function kx(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function Ec(e){return typeof e=="string"}function ie(e){let t=F(),{t:o}=N(),n=Ec(e)?e:editor.editorCommandKey(e),r=Pt.useRef(e);r.current=e;let i=Pt.useCallback(l=>{let c=r.current;if(Ec(c)){let f=editor.toolbarCommandState(t,c);return {active:f.active,enabled:f.enabled,disabledReason:i18n.localizeDisabledReason(f.disabledReason,o),value:f.value??null}}if(!t)return {active:false,enabled:false,disabledReason:null,value:null};let d=t.can(c);return {active:t.isActive(c),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,o),value:null}},[t,n,o]),a=O(i,kx),s=Pt.useCallback(l=>{let c=editor.commandExecOptions(l),d=r.current;return Ec(d)?editor.runToolbarCommand(t,d,void 0,c??{}).ok:t?t.exec(d,c).ok:false},[t]);return Pt.useMemo(()=>({execute:s,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason,value:a.value}),[s,a])}var ln=Pt.createContext({t:void 0,onSave:void 0});function _x(){return Pt.useContext(ln)}function Oi(e){let{t}=N();return o=>e?.(o)??t(o)}function X(){let{t:e}=Pt.useContext(ln);return Oi(e)}var Hx=()=>()=>{},Ax=()=>true,Ox=()=>false;function ko(){let e=Pt.useSyncExternalStore(Hx,Ax,Ox);return Pt.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function Bx(e){let t=e.viteEnv?.DEV;return typeof t=="boolean"?t:e.hasProcess&&e.nodeEnv!=="production"}function Zx(){try{return undefined}catch{return}}function jt(){let e=typeof process<"u";return Bx({viteEnv:Zx(),nodeEnv:e?"production":void 0,hasProcess:e})}var Im=new Set;function Io(e){!jt()||Im.has(e)||(Im.add(e),console.warn(`[docx-editor] ${e}`));}function _m(e){Io(`Menu.Item and ContextMenu.Slot take the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Nm(e){Io(`A hidden context-menu override names "${e}", but no packaged row has that id, so nothing is removed.`);}function Lm(){Io("A Menu.Item or ContextMenu.Slot has no slotId, so it renders nothing.");}function Fm(){Io("A Menu.Submenu has neither label nor labelKey, so its row has no name.");}function Hm(e){Io(`Toolbar.Button takes the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Am(){Io("A Toolbar.Button has no slotId, so it renders nothing.");}function J(e){for(let t of editor.CHROME_GROUPS)for(let o of t.controls)if(editor.chromeSlotId(t,o)===e)return o;return null}function re(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function B(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function zx(e){if(e.slotId)return e.slotId;if(e.slot)return Hm(e.slot),e.slot;Am();}function sn(e){let{icon:t,asChild:o,className:n,children:r,hidden:i}=e,a=zx(e)??"",{execute:s,isActive:l,isEnabled:c,disabledReason:d,value:f}=ie(a),u=X(),g=ko();if(i||!a)return null;let m=J(a),p=g(u(m?.labelKey??a)),v=editor.chromeSlotIsToggle(a),y={onClick:()=>s(),onMouseDown:B,disabled:!c,"data-slot":a,className:`docx-toolbar__button${n?` ${n}`:""}`,...l?{"data-active":""}:{},...c?{}:{"data-disabled":""},...v?{"aria-pressed":l}:{},...f!==null?{"data-value":f}:{},"aria-label":p,title:d??p};return o?jsxRuntime.jsx(j,{...y,children:r}):jsxRuntime.jsx("button",{type:"button",...y,children:t??r??re(m?.paths)})}sn.docxToolbarPart=true;var Yx=[{value:"C00000",labelKey:"colorPicker.colors.darkRed",css:"#c00000"},{value:"FF0000",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"FFC000",labelKey:"colorPicker.colors.orange",css:"#ffc000"},{value:"FFFF00",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"92D050",labelKey:"colorPicker.colors.lightGreen",css:"#92d050"},{value:"00B050",labelKey:"colorPicker.colors.green",css:"#00b050"},{value:"00B0F0",labelKey:"colorPicker.colors.lightBlue",css:"#00b0f0"},{value:"0070C0",labelKey:"colorPicker.colors.blue",css:"#0070c0"},{value:"002060",labelKey:"colorPicker.colors.darkBlue",css:"#002060"},{value:"7030A0",labelKey:"colorPicker.colors.purple",css:"#7030a0"}],Om=[{value:"yellow",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"green",labelKey:"colorPicker.colors.brightGreen",css:"#00ff00"},{value:"cyan",labelKey:"colorPicker.colors.cyan",css:"#00ffff"},{value:"magenta",labelKey:"colorPicker.colors.magenta",css:"#ff00ff"},{value:"blue",labelKey:"colorPicker.colors.blue",css:"#0000ff"},{value:"red",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"darkBlue",labelKey:"colorPicker.colors.darkBlue",css:"#000080"},{value:"darkCyan",labelKey:"colorPicker.colors.darkCyan",css:"#008080"},{value:"darkGreen",labelKey:"colorPicker.colors.darkGreen",css:"#008000"},{value:"darkMagenta",labelKey:"colorPicker.colors.darkMagenta",css:"#800080"},{value:"darkRed",labelKey:"colorPicker.colors.darkRed",css:"#800000"},{value:"darkYellow",labelKey:"colorPicker.colors.darkYellow",css:"#808000"},{value:"darkGray",labelKey:"colorPicker.colors.darkGray",css:"#808080"},{value:"lightGray",labelKey:"colorPicker.colors.lightGray",css:"#c0c0c0"},{value:"black",labelKey:"colorPicker.colors.black",css:"#000000"},{value:"white",labelKey:"colorPicker.colors.white",css:"#ffffff"}],Bm=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],Zi=["colorPicker.theme.background1","colorPicker.theme.text1","colorPicker.theme.background2","colorPicker.theme.text2","colorPicker.theme.accent1","colorPicker.theme.accent2","colorPicker.theme.accent3","colorPicker.theme.accent4","colorPicker.theme.accent5","colorPicker.theme.accent6"],_o=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Et=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function Xx(e){let t=[0,2,4].map(n=>parseInt(e.slice(n,n+2),16)),o=(Math.max(...t)+Math.min(...t))/2/255;return o===1?[Et(5),Et(15),Et(25),Et(35),Et(50)]:o===0?[_o(50),_o(35),_o(25),_o(15),_o(5)]:o>=.8?[Et(10),Et(25),Et(50),Et(75),Et(90)]:[_o(80),_o(60),_o(40),Et(25),Et(50)]}var Jx=/^[0-9A-Fa-f]{6}$/;function Qx(e,t){let o="";for(let n=0;n<6;n+=2){let r=Math.round(t(parseInt(e.slice(n,n+2),16)));o+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return o.toUpperCase()}function eC(e){let t=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16);return .299*t+.587*o+.114*n>230}function Gn({value:e,css:t,title:o,selected:n,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":o,"aria-pressed":n,title:o,"data-value":e,...n?{"data-selected":""}:{},...t.startsWith("var(")||eC(t.replace("#",""))?{"data-light":""}:{},onMouseDown:B,onClick:()=>r(e)})}function tC({apply:e,label:t,current:o,themeHexes:n}){let r=n.map(Xx),i=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[n.map((a,s)=>jsxRuntime.jsx(Gn,{value:a,css:`#${a.toLowerCase()}`,title:t(Zi[s]),selected:o===a,apply:e},`base-${s}`)),i.map(a=>n.map((s,l)=>{let c=r[l][a],d=Qx(s,c.apply);return jsxRuntime.jsx(Gn,{value:d,css:`#${d.toLowerCase()}`,title:`${t(Zi[l])}, ${t(c.labelKey)}`,selected:o===d,apply:e},`${a}-${l}`)}))]})]})}function oC(e){let{apply:t,label:o,current:n}=e,[r,i]=Pt.useState(""),a=Jx.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(tC,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:Yx.map(s=>jsxRuntime.jsx(Gn,{value:s.value,css:s.css,title:o(s.labelKey),selected:n===s.value,apply:t},s.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.customColor")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-custom",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-hash","aria-hidden":"true",children:"#"}),jsxRuntime.jsx("input",{type:"text",className:"docx-toolbar__swatch-hex",value:r,maxLength:6,spellCheck:false,"aria-label":o("colorPicker.customColor"),onChange:s=>i(s.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:s=>{s.key==="Enter"&&a&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!a,onMouseDown:B,onClick:()=>t(r.toUpperCase()),children:o("colorPicker.apply")})]})]})]})}function Mc({apply:e,current:t}){let o=F(),n=X(),r=o?.getDocumentThemeColors()??[],i=r.length===Zi.length?r.map(s=>s.hex):Bm,a=t?.toUpperCase()??null;return jsxRuntime.jsx(oC,{apply:e,label:n,current:a,themeHexes:i})}var nC=Om.filter(e=>e.value!=="white");function rC({apply:e,label:t,current:o}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.highlightColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--highlight",role:"group",children:nC.map(n=>jsxRuntime.jsx(Gn,{value:n.value,css:n.css,title:t(n.labelKey),selected:o===n.value,apply:e},n.value))})]})}function Zm(e){let{slot:t,defaultValue:o,cssOf:n,clear:r,body:i}=e,a=t==="text.color";return Object.assign(({className:l,hidden:c,icon:d})=>{let f=F(),{isEnabled:u,disabledReason:g}=ie(t),m=X(),[p,v]=Pt.useState(false),[y,x]=Pt.useState(o),h=Pt.useRef(null);fo(h,p,()=>v(false));let b=O(M=>{if(a){let E=M.formatting?.color;return E&&E.kind==="hex"?E.value.toUpperCase():null}return M.formatting?.highlight??null}),S=f?.getDocumentThemeColors()??[],C=S.length===Zi.length?S.map(M=>M.hex):Bm;Pt.useEffect(()=>{if(!p)return;let M=E=>{let _=h.current;_&&E.target instanceof Node&&_.contains(E.target)||v(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[p]);let P=Pt.useCallback(M=>{if(v(false),!f)return;f.focus();let E=editor.commandForSlotValue(t,M);E&&f.can(E).ok&&(f.exec(E),M!==r.value&&x(M));},[f]),T=Pt.useMemo(()=>J(t),[]);if(c)return null;let R=m(T?.labelKey??t);return jsxRuntime.jsxs("div",{ref:h,className:`docx-toolbar__colorsplit${l?` ${l}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!u,...u?{}:{"data-disabled":""},"aria-label":R,title:g??R,onMouseDown:B,onClick:()=>P(y),children:[d??re(T?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:n(y)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!u,...u?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":p,"aria-label":R,title:g??R,onMouseDown:B,onClick:()=>v(M=>!M),children:"\u25BE"}),p?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":R,onMouseDown:B,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>P(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),m(r.labelKey)]}),i({apply:P,label:m,current:b,themeHexes:C})]}):null]})},{docxSlot:t})}var aC=new Map(Om.map(e=>[e.value,e.css])),Rc=Zm({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Mc,{apply:e.apply,current:e.current})}),Dc=Zm({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>aC.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(rC,{...e})});var Ic=e=>e==="auto"?"currentColor":e==="byAuthor"?"var(--doc-review-author-0)":e==="none"?"transparent":`var(--doc-revision-color-${e})`;function Ki({label:e,value:t,values:o,disabled:n,change:r,t:i}){let a=Pt.useId(),[s,l]=Pt.useState(false),c=Pt.useRef(null),d=Pt.useRef(null),f=Pt.useRef(null);Pt.useLayoutEffect(()=>{if(!s||!f.current||!d.current)return;let g=editor.observeContentControlPopup(f.current,d.current);return (f.current.querySelector("[data-selected]")??f.current.querySelector("button"))?.focus(),g},[s]),Pt.useEffect(()=>{if(n&&l(false),!s)return;let g=c.current?.ownerDocument,m=p=>{c.current?.contains(p.target)||l(false);};return g?.addEventListener("pointerdown",m),()=>g?.removeEventListener("pointerdown",m)},[s,n]);let u=()=>{l(false),d.current?.focus();};return jsxRuntime.jsxs("div",{ref:c,className:"docx-revision-color-picker",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||l(false);},children:[jsxRuntime.jsx("span",{id:`${a}-label`,children:e}),jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-revision-color-trigger",disabled:n,"aria-labelledby":`${a}-label ${a}-value`,"aria-expanded":s&&!n,"aria-controls":`${a}-options`,onClick:()=>l(!s),children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:Ic(t)}}),jsxRuntime.jsx("span",{id:`${a}-value`,children:i(`values.${t}`)})]}),jsxRuntime.jsxs("div",{ref:f,id:`${a}-options`,className:"docx-revision-color-options",hidden:!s||n,role:"group","aria-labelledby":`${a}-label`,onKeyDown:g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),u());let m=Array.from(g.currentTarget.querySelectorAll("button")),p=m.indexOf(g.target),v=g.key==="Home"?0:g.key==="End"?m.length-1:["ArrowRight","ArrowDown"].includes(g.key)?(p+1)%m.length:["ArrowLeft","ArrowUp"].includes(g.key)?(p-1+m.length)%m.length:null;v!==null&&(g.preventDefault(),g.stopPropagation(),m[v]?.focus());},children:[jsxRuntime.jsx("div",{className:"docx-revision-color-special",children:o.filter(g=>["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear","aria-pressed":t===g,"data-selected":t===g?"":void 0,onClick:()=>{r(g),u();},children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:Ic(g)}}),i(`values.${g}`)]},g))}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",children:o.filter(g=>!["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsx(Gn,{value:g,css:Ic(g),title:i(`values.${g}`),selected:t===g,apply:m=>{r(m),u();}},g))})]})]})}var qm=["none","colorOnly","bold","italic","underline","doubleUnderline","strikethrough","doubleStrikethrough"],pC=["byAuthor","auto",...editor.REVISION_MARKUP_COLORS];function Km(e,t,o){let{values:n}=e,r=a=>{let s=a==="changedLines"?["none","leftBorder","rightBorder","outsideBorder"]:a==="deletions"||a==="movedFrom"?[...qm,"hidden","caret","pound"]:qm,l=(a==="movedFrom"||a==="movedTo")&&!n.trackMoves;return jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("div",{className:"docx-revision-markup-row",children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-row-title","aria-hidden":"true",children:t(a)}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-field-label",children:t(a)}),jsxRuntime.jsx("select",{value:n[a].mark,disabled:l,onChange:c=>e.setValue(a,{...n[a],mark:c.target.value}),children:s.map(c=>jsxRuntime.jsx("option",{value:c,children:t(`values.${c}`)},c))})]}),jsxRuntime.jsx(Ki,{label:t(`${a}Color`),value:n[a].color,values:pC,disabled:l,t,change:c=>e.setValue(a,{...n[a],color:c})})]}),a!=="changedLines"&&jsxRuntime.jsx("div",{className:"docx-revision-markup-background",children:jsxRuntime.jsx(Ki,{label:t(`${a}Background`),value:n[a].background,values:["none","byAuthor",...editor.REVISION_MARKUP_COLORS],disabled:l,t,change:c=>e.setValue(a,{...n[a],background:c})})})]})},i=a=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n[a],"aria-describedby":`${o}-${a}`,onChange:s=>e.setValue(a,s.target.checked)}),t(a)]}),jsxRuntime.jsx("p",{id:`${o}-${a}`,children:t(`${a}Note`)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("markup")}),r("insertions"),r("deletions"),r("changedLines")]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("moves")}),i("trackMoves"),r("movedFrom"),r("movedTo")]}),jsxRuntime.jsxs("fieldset",{"data-docx-part":"field","data-docx-field":"cells",className:"docx-revision-markup-tableCells",children:[jsxRuntime.jsx("legend",{children:t("tableCells")}),["inserted","deleted","merged","split"].map(a=>jsxRuntime.jsx(Ki,{label:t(`${a}Cells`),value:n.cells[a],values:["byAuthor","none",...editor.REVISION_MARKUP_COLORS],t,change:s=>e.setValue("cells",{...n.cells,[a]:s})},a))]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("formatting")}),i("trackFormatting"),r("formatting")]})]})}var Lt=Do();function yC(){return Lt.useState()}function xC({session:e,...t}){return e?jsxRuntime.jsx(CC,{session:e,...t}):null}function CC({session:e,children:t,preset:o,className:n,style:r}){let i=Pt.useId(),{t:a}=N(),s=p=>a(`revisionMarkup.${p}`),l=Pt.useCallback(p=>e.subscribe(p),[e]),c=Pt.useCallback(()=>e.get(),[e]),d=Pt.useSyncExternalStore(l,c,c),[f,u]=Pt.useState(e.signal.aborted),g=Pt.useRef(null);Pt.useEffect(()=>{g.current=e;let p=()=>u(true);return u(e.signal.aborted),e.signal.addEventListener("abort",p),()=>{e.signal.removeEventListener("abort",p),g.current=null,queueMicrotask(()=>{g.current!==e&&e.cancel();});}},[e]);let m={values:d,setValue(p,v){e.set({[p]:v});},errors:{},isEnabled:!f&&e.canApply(),apply(){e.apply();},cancel(){e.cancel();},reset(){e.reset();}};return f?null:jsxRuntime.jsx(pt,{kind:"revisionMarkup",label:s("title"),className:["docx-revision-markup-dialog",n].filter(Boolean).join(" "),style:r,onClose:m.cancel,dismissOutside:false,sessionSignal:e.signal,children:jsxRuntime.jsx(Lt.Composition,{state:m,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",children:jsxRuntime.jsx("h2",{"data-docx-part":"title",children:s("title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-revision-markup-body",children:Km(m,s,i)}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-revision-markup-actions",children:[jsxRuntime.jsx("button",{"data-docx-part":"reset",type:"button",onClick:m.reset,children:s("reset")}),jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",children:m.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",type:"button",onClick:m.cancel,children:s("cancel")}),jsxRuntime.jsx("button",{"data-docx-part":"apply",type:"button",disabled:!m.isEnabled,onClick:m.apply,children:s("ok")})]})]}),children:t})})}var Ur=Object.assign(xC,{Header:Lt.Header,Title:Lt.Title,Body:Lt.Body,Footer:Lt.Footer,Apply:Lt.Apply,Cancel:Lt.Cancel,Error:Lt.Error,Field:Lt.Field,Reset:Lt.Reset});function Nc(e){let t=F(),o=Pt.useRef(e.onRevisionMarkupChange);o.current=e.onRevisionMarkupChange;let{onRevisionMarkupChange:n,...r}=e,i=JSON.stringify(r);return Pt.useEffect(()=>t?.on("revisionMarkupChange",a=>o.current?.(a)),[t]),Pt.useEffect(()=>{t&&t.setRevisionMarkup(JSON.parse(i));},[t,i]),null}function Vr({open:e,format:t,pending:o,error:n,onClose:r,className:i,style:a,children:s}){let{t:l}=N();if(!e)return null;let c=l(n?t==="pdf"?"toolbar.exportPdfFailed":"toolbar.exportMarkdownFailed":t==="pdf"?"toolbar.exportingPdf":"toolbar.exportingMarkdown");return jsxRuntime.jsx(pt,{kind:"export",label:c,role:n?"alertdialog":"dialog",className:`docx-export-dialog${o?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[o&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:n?"alert":"status",children:n||l("toolbar.exportDownloadHint")})}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:l(n?"common.close":"toolbar.exportContinueEditing")})})]})})}function Gr({open:e,pending:t,error:o,url:n,onClose:r,className:i,style:a,children:s}){let{t:l}=N();if(!e)return null;let c=l(o?"toolbar.printFailed":"toolbar.printPreparing"),d=n.startsWith("blob:")?n:"";return jsxRuntime.jsx(pt,{kind:"print",label:c,role:o?"alertdialog":"dialog",className:`docx-export-dialog docx-print-dialog${t?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,onKeyDown:f=>{editor.isChromePrintShortcut(f.nativeEvent)&&f.preventDefault();},children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[t&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),o&&jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:"alert",children:o})}),jsxRuntime.jsxs("footer",{className:"docx-dialog__footer",children:[o&&d&&jsxRuntime.jsx("a",{className:"docx-dialog__link-button docx-print-dialog__open",href:d,target:"_blank",rel:"noopener noreferrer",children:l("toolbar.printOpenPdf")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:l(o?"common.close":"common.cancel")})]})]})})}var ct={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function jn({text:e,x:t,y:o,className:n}){return jsxRuntime.jsx("div",{role:"tooltip",className:n,"data-testid":"docx-notes-preview",style:{position:"fixed",left:t,top:o,zIndex:ct.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg)",color:"var(--doc-popover-fg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",fontSize:12,lineHeight:1.4,pointerEvents:"none"},onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:e})}function Yn({noteKind:e,x:t,y:o,onDelete:n,onConvert:r,onConvertAll:i,onOpenProperties:a,onClose:s,deleteEnabled:l,convertEnabled:c,convertAllEnabled:d,deleteDisabledReason:f,convertDisabledReason:u,convertAllDisabledReason:g,className:m}){let{t:p}=N();return jsxRuntime.jsxs("div",{role:"menu",className:m,onKeyDown:v=>{v.key==="Escape"&&s();},"data-testid":"docx-notes-menu",style:{position:"fixed",left:t,top:o,zIndex:ct.popover,minWidth:160,background:"var(--doc-popover-bg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",padding:4},onMouseDown:B,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!l,title:f,onClick:n,children:p("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!c,title:u,onClick:r,children:p(e==="footnote"?"notes.convertToEndnote":"notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!d,title:g,onClick:i,children:p(e==="footnote"?"notes.convertAllFootnotes":"notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:a,children:p("dialogs.footnoteProperties.title")})]})}function DC(e){return t=>Pt.createElement(e,t)}var Vm=new WeakMap,kC=0;function De(e,t,o){if(e===false)return null;let n=e(t);if(!o)return n;let r=Vm.get(o);return r===void 0&&Vm.set(o,r=++kC),Pt.createElement(Pt.Fragment,{key:r},n)}function Xn(e,t,o){let n=e.getBoundingClientRect();return {left:t-n.left-e.clientLeft+e.scrollLeft,top:o-n.top-e.clientTop+e.scrollTop}}function Yr(e){return e.paragraphId===""}var dn=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),FC=e=>e;function HC(){let e=o=>!!o&&(o.width>0||o.height>0);if(typeof document<"u"){let n=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(n))return {left:n.left,top:n.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let o=t.getRangeAt(0),n=o.getBoundingClientRect();if(e(n))return {left:n.left,top:n.bottom};let r=o.startContainer,a=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(a))return {left:a.left,top:a.bottom}}return null}var Xr=Pt.createContext(null);function Fc(){let e=Pt.useContext(Xr),t=zi(e===null);return e??t}function zi(e=true){let t=F(),[o,n]=Pt.useState(dn),r=Pt.useRef(null),i=Pt.useRef(o);i.current=o;let a=O(FC),s=t?t.can({type:"insertText",text:""}).ok:false,l=Pt.useCallback(()=>{let h=r.current;h&&(h.editor.releaseSelection(h.pin),r.current=null);},[]),c=Pt.useCallback((h,b)=>{l(),n({mode:h?"reading":"editing",link:h??null,anchor:b??null,text:h?.text??"",url:h?h.kind==="internal"?`#${h.anchor??""}`:h.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,l]),d=Pt.useCallback(()=>{l(),n(dn);},[l]);Pt.useEffect(()=>l,[l]);let f=Pt.useCallback(()=>{let h=HC();l();let b=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(b&&Yr(b)){c(b,h);return}if(b){n({mode:"editing",link:b,anchor:h,text:b.text,url:b.kind==="internal"?`#${b.anchor??""}`:b.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let S=t?.query({type:"selectedText"})??"",C=t?.retainSelection()??null;t&&C&&(r.current={editor:t,pin:C}),n({mode:"editing",link:null,anchor:h,text:S,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c,l]);Pt.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:h=>c(h.link,{left:h.rect.left,top:h.rect.bottom}),onRequest:f})},[t,e,c,f]),Pt.useEffect(()=>{let h=i.current;if(h.mode!=="reading"||!h.link)return;let b=Yr(h.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;b&&b.id===h.link.id||n(dn);},[a,t]),Pt.useEffect(()=>{let h=i.current;if(h.mode!=="editing"||h.link)return;let b=t?.surface;!b||b.retainedSelection()||n(dn);},[a,t]);let u=Pt.useCallback(async()=>{let h=i.current.link?.href;if(!h)return false;try{await navigator.clipboard.writeText(h);}catch{return false}return n(b=>({...b,copied:true})),true},[]),g=Pt.useCallback(()=>{n(h=>({...h,mode:"editing",copied:false,error:false}));},[]),m=Pt.useCallback(h=>{n(b=>({...b,text:h,copied:false,error:false}));},[]),p=Pt.useCallback(h=>{n(b=>({...b,url:h,copied:false,error:false}));},[]),v=Pt.useCallback(()=>{let h=i.current,b=t?.surface?.hyperlinks;if(!b)return false;let S=h.url.trim();if(S.length===0)return n(T=>({...T,error:true})),false;let C=S.startsWith("#");return b.applyHyperlink({...C?{anchor:S.slice(1)}:{url:S},...h.text.trim().length>0?{text:h.text}:{}})?(d(),true):(n(T=>({...T,error:true})),false)},[t,d]),y=Pt.useCallback(()=>{let h=t?.surface?.hyperlinks,b=i.current.link;if(!h)return false;let S=h.removeHyperlink(b?.id);return S&&d(),S},[t,d]),x=Pt.useCallback(()=>{let h=t?.surface?.navigation,b=i.current.link;if(!h||!b)return false;if(b.kind==="internal"){let C=b.anchor?h.goToBookmark(b.anchor):false;return C&&n(dn),C}let S=h.openExternal(b.href);return S&&n(dn),S},[t]);return Pt.useMemo(()=>({state:o.mode==="closed"?dn:{...o,canEdit:s},open:c,openAtCaret:f,close:d,copy:u,beginEdit:g,setText:m,setUrl:p,commitEdit:v,unlink:y,openTarget:x}),[o,s,c,f,d,u,g,m,p,v,y,x])}function pn(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var $i=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),WC="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z",zC="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z",$C="M770-302 656-416l57-57 114 114-57 57ZM603-469 469-603l57-57 134 134-57 57ZM280-280h133v80H280q-83 0-141.5-58.5T80-400q0-83 58.5-141.5T280-600h133v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35Zm40-80v-80h101l80 80H320Zm493-15-57-57q23-11 33.5-32t10.5-36q0-50-35-85t-85-35H547v-80h133q83 0 141.5 58.5T880-400q0 32-11 61.5T813-375ZM792-56 56-792l56-56 736 736-56 56Z",UC="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z";function VC({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=Jt(),a=Pt.useRef(null),{state:s,close:l}=i;Pt.useEffect(()=>{if(s.mode==="closed")return;let p=y=>{y.key==="Escape"&&(y.preventDefault(),l());},v=y=>{let x=a.current;x&&y.target instanceof Node&&x.contains(y.target)||l();};return document.addEventListener("keydown",p),document.addEventListener("mousedown",v,true),()=>{document.removeEventListener("keydown",p),document.removeEventListener("mousedown",v,true);}},[s.mode,l]);let[c,d]=Pt.useState(null);Pt.useLayoutEffect(()=>{let p=s.anchor,v=a.current;if(!p||!v){d(null);return}let y=v.offsetParent;if(!y){d(null);return}let{left:x,top:h}=Xn(y,p.left,p.top),b=Math.max(0,y.scrollWidth-v.offsetWidth);d({left:Math.max(0,Math.min(x,b)),top:h});},[s.anchor]);let{t:f}=N(),u=s.mode==="editing"?f(s.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):f("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(GC,{children:n}):n;if(o)return s.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});let m={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":s.mode,role:"dialog","aria-modal":false,onMouseDown:pn,style:c??void 0,"aria-label":u};return s.mode==="closed"?null:t?jsxRuntime.jsx(j,{...m,children:n}):jsxRuntime.jsx("div",{...m,children:g})}function GC({children:e}){let{state:t}=Jt(),o=Pt.useMemo(()=>jC(e),[e]),n=(i,a)=>i in o?o[i]:a;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Fields",jsxRuntime.jsx(qc,{})),n("Error",jsxRuntime.jsx(Wc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Apply",jsxRuntime.jsx(Kc,{})),n("Cancel",jsxRuntime.jsx(zc,{}))]}),o.__extra]});let r=t.canEdit&&!(t.link&&Yr(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Url",jsxRuntime.jsx(Ac,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Copy",jsxRuntime.jsx(Oc,{})),r?n("Edit",jsxRuntime.jsx(Bc,{})):null,r?n("Unlink",jsxRuntime.jsx(Zc,{})):null]}),o.__extra]})}function jC(e){let t={},o=[],n=r=>{if(Array.isArray(r)){r.forEach(n);return}if(!r||typeof r!="object"||!("type"in r)){r&&o.push(r);return}if(r.type===Pt.Fragment){n(r.props.children);return}let i=r.type.docxHyperLinkPart;i?t[i]=r:o.push(r);};return n(e),o.length>0&&(t.__extra=o),t}function Jt(){return Pt.useContext(Xr)??YC}var YC={state:{mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:false},open:()=>{},openAtCaret:()=>{},close:()=>{},copy:async()=>false,beginEdit:()=>{},setText:()=>{},setUrl:()=>{},commitEdit:()=>false,unlink:()=>false,openTarget:()=>false};function Ac({className:e,asChild:t,hidden:o,children:n}){let{state:r,openTarget:i}=Jt(),{t:a}=N();if(o||!r.link)return null;let s=!r.link.href,l=r.link.kind==="internal",c=l?`#${r.link.anchor??""}`:r.link.authored,d=a(s?"hyperlinkPopup.inertTarget":l?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),f={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...s?{"data-inert":""}:{},title:d,onMouseDown:pn,...s?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx(j,{...f,className:e,children:n}):s?jsxRuntime.jsxs("span",{...f,children:[n??c,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...f,children:[n??c,$i(UC)]})}Ac.docxHyperLinkPart="Url";function Oc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{state:i,copy:a}=Jt(),{t:s}=N();if(o||!i.link?.href)return null;let l=i.copied?s("editor.linkCopied"):s("hyperlinkPopup.copyLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...i.copied?{"data-copied":""}:{},"aria-label":l,title:l,onMouseDown:pn,onClick:()=>{a();}};return t?jsxRuntime.jsx(j,{...c,className:e,children:n}):jsxRuntime.jsx("button",{...c,children:r??n??$i(WC)})}Oc.docxHyperLinkPart="Copy";function Bc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{beginEdit:i}=Jt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.editLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":s,title:s,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:r??n??$i(zC)})}Bc.docxHyperLinkPart="Edit";function Zc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{unlink:i}=Jt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.removeLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":s,title:s,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:r??n??$i($C)})}Zc.docxHyperLinkPart="Unlink";function qc({className:e,hidden:t}){let{state:o,setText:n,setUrl:r,commitEdit:i,close:a}=Jt(),{t:s}=N(),l=Pt.useRef(null),c=Pt.useId(),d=Pt.useId();Pt.useEffect(()=>{o.mode==="editing"&&(l.current?.focus({preventScroll:true}),l.current?.select());},[o.mode]);let f=Pt.useCallback(u=>{if(u.key==="Enter"){u.preventDefault(),i();return}u.key==="Escape"&&(u.preventDefault(),a());},[i,a]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:s("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:c,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:o.text,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onChange:u=>n(u.target.value),onKeyDown:f}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:s("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:l,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:o.url,placeholder:s("hyperlinkPopup.urlPlaceholder"),onChange:u=>r(u.target.value),onKeyDown:f})]})}qc.docxHyperLinkPart="Fields";function Kc({className:e,asChild:t,hidden:o,children:n}){let{state:r,commitEdit:i}=Jt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.apply"),l={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:n??s})}function Wc({className:e,hidden:t}){let{state:o}=Jt(),{t:n}=N();return t||!o.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:n("hyperlinkPopup.refused")})}Wc.docxHyperLinkPart="Error";Kc.docxHyperLinkPart="Apply";function zc({className:e,asChild:t,hidden:o,children:n}){let{close:r}=Jt(),{t:i}=N();if(o)return null;let a=i("hyperlinkPopup.cancel"),s={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:pn,onClick:()=>r()};return t?jsxRuntime.jsx(j,{...s,className:e,children:n}):jsxRuntime.jsx("button",{...s,children:n??a})}zc.docxHyperLinkPart="Cancel";var Jr=Object.assign(VC,{Url:Ac,Copy:Oc,Edit:Bc,Unlink:Zc,Fields:qc,Error:Wc,Apply:Kc,Cancel:zc});var ft={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function eT(e){return e==="sdtLocked"||e==="sdtContentLocked"}function tT(e){return e==="contentLocked"||e==="sdtContentLocked"}function Uc(e,t){return !e.ok&&e.code===t}function Qt(){let e=Pt.useContext(Vc),t=Ui();return e??t}function Ui(){let e=F(),[t,o]=Pt.useState(false),[n,r]=Pt.useState(false),[i,a]=Pt.useState(false),s=O(P=>P),l=e?.surface??null,c=l?.contentControls;Pt.useEffect(()=>{r(c?.showAll()??l?.state().contentControls.showAll??false),a(c?.formFill()??l?.state().contentControls.formFill??false);},[s,c,l]);let d=Pt.useMemo(()=>{if(!e)return null;let P=c?.atCaret()??null;if(P){let w=c?.disabledReason(P.id,"edit")??null,I=c?.disabledReason(P.id,"remove")??null;return {id:P.id,tag:P.tag??null,alias:P.alias??null,controlType:P.controlType,locked:tT(P.effectiveLock)||w==="locked",removalLocked:eT(P.effectiveLock)||I==="locked",placeholder:P.placeholder,bound:P.bound||w==="bound",effectiveLock:P.effectiveLock}}let T=e.query({type:"contentControlAt"});if(!T)return null;let R=c?.disabledReason(T.id,"edit")??null,M=c?.disabledReason(T.id,"remove")??null,E=e.can({type:"setContentControlValue",value:""}),_=e.can({type:"removeContentControl"}),H=T.locked===true||R==="locked"||Uc(E,"locked"),L=R==="bound"||Uc(E,"bound"),k=M==="locked"||Uc(_,"locked");return {id:T.id,tag:T.tag??null,alias:T.alias??null,controlType:T.controlType,locked:H,removalLocked:k,placeholder:false,bound:L,effectiveLock:null}},[e,s,c]),f=Pt.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,s]),u=Pt.useCallback(P=>{c?.setShowAll(P),r(P);},[c]),g=Pt.useCallback(P=>{c?.setFormFill(P),a(P);},[c]),m=Pt.useCallback(()=>u(!n),[u,n]),p=Pt.useCallback(()=>g(!i),[g,i]),v=Pt.useCallback(()=>o(true),[]),y=Pt.useCallback(()=>o(false),[]),x=Pt.useCallback(()=>o(P=>!P),[]),h=Pt.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let T=c.disabledReason(d.id,"edit");return T==="locked"?"the content control is locked":T==="bound"?"the content control is bound to external data":T==="notFound"?"the content control was not found":T}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let P=e.can({type:"setContentControlValue",value:""});return P.ok?null:P.reason},[d,c,e]),b=Pt.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let T=c.disabledReason(d.id,"remove");return T==="locked"?"the content control is locked":T==="notFound"?"the content control was not found":T}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let P=e.can({type:"removeContentControl"});return P.ok?null:P.reason},[d,c,e]),S=Pt.useCallback(P=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c&&d){let T=c.disabledReason(d.id,"edit");if(T)return {ok:false,code:T==="bound"?"bound":T==="locked"?"locked":"notFound",reason:T==="bound"?"the content control is bound to external data":T==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:P})},[e,c,d]),C=Pt.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c){let P=d?.id;if(!P)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let T=c.disabledReason(P,"remove");return T?{ok:false,code:T==="locked"?"locked":"notFound",reason:T==="locked"?"the content control is locked":"the content control was not found"}:c.remove(P)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,c,d]);return Pt.useMemo(()=>({control:d,controls:f,showAll:n,formFill:i,inspectorOpen:t,canSetValue:h===null&&d!==null,canRemove:b===null&&d!==null,setValueDisabledReason:h,removeDisabledReason:b,setShowAll:u,toggleShowAll:m,setFormFill:g,toggleFormFill:p,openInspector:v,closeInspector:y,toggleInspector:x,remove:C,setValue:S}),[d,f,n,i,t,h,b,u,m,g,p,v,y,x,C,S])}var Vc=Pt.createContext(null);function Gc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var ef=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),rT="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z",aT="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z",iT={position:"absolute",zIndex:20,minWidth:240,maxWidth:320,top:12,right:12,padding:12,borderRadius:8,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-surface)",boxShadow:"0 4px 16px var(--doc-shadow)",color:"var(--doc-text)",fontSize:13,display:"flex",flexDirection:"column",gap:10},lT={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},sT={color:"var(--doc-text-muted)",flexShrink:0},cT={textAlign:"right",wordBreak:"break-word"},dT={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},uT={display:"flex",gap:8,marginTop:4},tf={display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:4,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",color:"var(--doc-text)",font:"inherit",cursor:"pointer"};function pT(e){switch(e){case "plainText":return "contentControl.types.plainText";case "checkbox":return "contentControl.types.checkbox";case "dropdown":return "contentControl.types.dropdown";case "comboBox":return "contentControl.types.comboBox";case "date":return "contentControl.types.date";case "picture":return "contentControl.types.picture";case "buildingBlockGallery":return "contentControl.types.buildingBlockGallery";case "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function mT(e){return e.effectiveLock==="sdtContentLocked"?"contentControl.lock.sdtContentLocked":e.effectiveLock==="contentLocked"||e.locked?"contentControl.lock.contentLocked":e.effectiveLock==="sdtLocked"||e.removalLocked?"contentControl.lock.sdtLocked":"contentControl.lock.unlocked"}function Jn({label:e,value:t,testId:o}){return jsxRuntime.jsxs("div",{style:lT,"data-testid":o,children:[jsxRuntime.jsx("span",{style:sT,children:e}),jsxRuntime.jsx("span",{style:cT,children:t})]})}function fT({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=Qt(),a=Pt.useRef(null),s=Pt.useId(),{t:l}=N(),{control:c,inspectorOpen:d,closeInspector:f}=i;if(Pt.useEffect(()=>{if(!d)return;let p=y=>{y.key==="Escape"&&(y.preventDefault(),f());},v=y=>{let x=a.current;x&&y.target instanceof Node&&x.contains(y.target)||f();};return document.addEventListener("keydown",p),document.addEventListener("mousedown",v,true),()=>{document.removeEventListener("keydown",p),document.removeEventListener("mousedown",v,true);}},[d,f]),Pt.useEffect(()=>{d&&!c&&f();},[d,c,f]),o||!d||!c)return null;let u=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(of,{}),jsxRuntime.jsx(nf,{}),jsxRuntime.jsx("div",{style:uT,children:jsxRuntime.jsx(rf,{})}),n]}):n,g={ref:a,role:"dialog","aria-modal":false,"aria-labelledby":s,"data-testid":"content-control-inspector","data-control-id":c.id,"data-control-type":c.controlType,...c.locked?{"data-locked":""}:{},...c.bound?{"data-bound":""}:{},...c.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:iT,onMouseDown:p=>{Gc(p),p.stopPropagation();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:s,className:"docx-editor-sr-only",children:l("contentControl.inspectorPanel.title")}),u]});return t?jsxRuntime.jsx(j,{...g,children:m}):jsxRuntime.jsx("div",{...g,children:m})}function of({className:e,asChild:t,hidden:o,children:n}){let{closeInspector:r}=Qt(),{t:i}=N();if(o)return null;let a={style:dT,className:e??void 0,"data-testid":"content-control-inspector-header"},s=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:n??i("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":i("common.close"),title:i("common.close"),style:{...tf,padding:4,border:"none",background:"transparent"},onMouseDown:Gc,onClick:()=>r(),children:ef(rT)})]});return t?jsxRuntime.jsx(j,{...a,children:s}):jsxRuntime.jsx("div",{...a,children:s})}function nf({className:e,asChild:t,hidden:o,children:n}){let{control:r}=Qt(),{t:i}=N();if(o||!r)return null;let a=i("contentControl.inspectorPanel.empty"),s=i("contentControl.inspectorPanel.yes"),l=i("contentControl.inspectorPanel.no"),c=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.type"),value:i(pT(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.lock"),value:i(mT(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?s:l,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.bound"),value:r.bound?s:l,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:i("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:i("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx(j,{...d,children:c}):jsxRuntime.jsx("div",{...d,children:c})}function rf({className:e,asChild:t,hidden:o,icon:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:s,closeInspector:l}=Qt(),{t:c}=N();if(o)return null;let d=c("contentControl.remove"),f={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":d,title:a??d,style:tf,onMouseDown:Gc,onClick:()=>{s().ok&&l();}},u=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n??r??ef(aT),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(j,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}var ta=Object.assign(fT,{Header:of,Fields:nf,Remove:rf});var vT=e=>e;function Qc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function oa(){let e=F(),{t}=N(),[o,n]=Pt.useState(null),[r,i]=Pt.useState(null),a=Pt.useRef(null),s=Pt.useRef(null),l=Pt.useRef(null),c=Pt.useId(),d=Pt.useId(),f=Pt.useId(),u=o?.activation??null,g=O(vT),m=Pt.useMemo(()=>{if(!e?.surface||!u)return {replaceEnabled:false,removeEnabled:false,reason:null};let h=e.surface.equations.can(u.equation.id,"replace"),b=e.surface.equations.can(u.equation.id,"remove"),S=h.ok?b.ok?null:b.reason:h.reason;return {replaceEnabled:h.ok,removeEnabled:b.ok,reason:S?i18n.localizeDisabledReason(S,t):null}},[u,e,g,t]),p=Pt.useCallback((h=false)=>{l.current?.(),l.current=null,n(null),h&&e&&queueMicrotask(()=>e.focus());},[e]);Pt.useEffect(()=>{if(!e)return;let h=e.setEquationChrome({onPopover:b=>{l.current?.();let S=e.surface;if(S&&typeof S.retainSelection=="function"){let C=S.retainSelection();l.current=()=>S.releaseSelection(C);}else l.current=null;n({activation:b,mountGeneration:e.mountGeneration,draft:b.equation.linear,error:false});}});return ()=>{h(),l.current?.(),l.current=null,n(null);}},[e,p]),Pt.useEffect(()=>{if(!o||!e?.surface)return;(e.mountGeneration!==o.mountGeneration||!e.surface.equations.equationById(o.activation.equation.id))&&p();},[e,g,o,p]),Pt.useEffect(()=>{if(!o)return;let h=a.current,b=h?.ownerDocument,S=b?.defaultView;if(!h||!b||!S)return;let C=T=>{T.key==="Escape"&&(T.preventDefault(),p(true));},P=T=>{T.target instanceof S.Node&&h.contains(T.target)||p();};return b.addEventListener("keydown",C),b.addEventListener("pointerdown",P,true),()=>{b.removeEventListener("keydown",C),b.removeEventListener("pointerdown",P,true);}},[o,p]),Pt.useLayoutEffect(()=>{if(!u){i(null);return}let h=a.current;if(!h)return;let b=h.offsetParent;if(!b){i(null);return}let S=u.rect,C=Xn(b,S.left,S.bottom),P=Math.max(0,b.scrollWidth-h.offsetWidth);i({left:Math.max(0,Math.min(C.left,P)),top:C.top}),s.current?.focus({preventScroll:true}),s.current?.select();},[u]);let v=Pt.useCallback(()=>{if(!o||!e?.surface||!m.replaceEnabled)return false;let h=e.surface.equations.applyEquation(o.activation.equation.id,o.draft);return h?p(true):n(b=>b&&{...b,error:true}),h},[e,o,p,m.replaceEnabled]),y=Pt.useCallback(()=>{if(!o||!e?.surface||!m.removeEnabled)return false;let h=e.surface.equations.removeEquation(o.activation.equation.id);return h?p(true):n(b=>b&&{...b,error:true}),h},[e,o,p,m.removeEnabled]);if(!o)return null;let x=[o.error?d:null,m.reason?f:null].filter(Boolean).join(" ");return jsxRuntime.jsxs("div",{ref:a,className:"docx-equation-popup","data-testid":"equation-popup",role:"dialog","aria-modal":false,"aria-label":t("equationPopup.title"),style:r??void 0,onMouseDown:Qc,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:t("equationPopup.inputLabel")}),jsxRuntime.jsx("input",{id:c,ref:s,className:"docx-equation-popup__input","data-testid":"equation-popup-input",value:o.draft,placeholder:t("equationPopup.placeholder"),spellCheck:false,"aria-describedby":x||void 0,onChange:h=>n(b=>b&&{...b,draft:h.target.value,error:false}),onKeyDown:h=>{h.key!=="Enter"||h.nativeEvent.isComposing||(h.preventDefault(),v());}}),o.error?jsxRuntime.jsx("div",{id:d,className:"docx-equation-popup__error","data-testid":"equation-popup-error",role:"alert",children:t("equationPopup.refused")}):null,m.reason?jsxRuntime.jsx("div",{id:f,className:"docx-equation-popup__error","data-testid":"equation-popup-disabled-reason",role:"status",children:m.reason}):null,jsxRuntime.jsxs("div",{className:"docx-equation-popup__actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__apply","data-testid":"equation-popup-apply",disabled:!m.replaceEnabled,title:m.reason??void 0,onMouseDown:Qc,onClick:v,children:t("equationPopup.apply")}),jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__delete","data-testid":"equation-popup-delete",disabled:!m.removeEnabled,title:m.reason??void 0,onMouseDown:Qc,onClick:y,children:t("equationPopup.delete")})]})]})}var sf="review.comments",ed="review.addComment";function cf(e){return e!==sf?e:(Io(`The context-menu row "${sf}" is now "${ed}". The old id still works in this release; write "${ed}".`),ed)}function tr(e,t){if(!Pt.isValidElement(e)||e.type!==Pt.Fragment)return null;let n=Pt.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return n.length===1?n[0]:null}function Vi({entries:e,children:t,preset:o,keyOfEntry:n,keyOfChild:r,renderEntry:i,childrenOfEntry:a,onUnmatched:s}){if(!o)return t;let l=new Map,c=[];for(let m of Pt.Children.toArray(t)){let p=r(m);p?l.set(p,m):c.push(m);}let d=new Set,f=m=>m.map((p,v)=>{let y=n(p,v);d.add(y);let x=a?.(p),h=x?f(x):void 0,b=l.get(y);return jsxRuntime.jsx(Pt.Fragment,{children:b??i(p,v,h)},y)}),u=f(e),g=[...l.entries()].filter(([m])=>!d.has(m)).map(([m,p])=>(s?.(m,p),jsxRuntime.jsx(Pt.Fragment,{children:p},m)));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,g,c]})}var TT="review.addComment",PT=e=>e.editingMode==="viewing";function Gi(e){let{isEnabled:t,disabledReason:o}=ie(TT),n=O(PT);return t?{isEnabled:t,reason:null}:{isEnabled:t,reason:n?e("editingMode.viewingHint"):o}}var na=Pt.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),or="docx-menubar-more",ji=Pt.createContext({measuring:false,overflow:new Set,inMore:false});function mf(){return Pt.useContext(ji)}function at(){return Pt.useContext(na)}function ke(){let{t:e}=at(),{t}=N();return o=>e?.(o)??t(o)}var nr=Pt.createContext(-1);var ST='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function mn(e){return [...e.querySelectorAll(ST)].filter(t=>t.closest('[role="menu"]')===e)}function nd(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function Ht(e,t,o){if(e.length===0)return false;let n=t?e.indexOf(t):-1,r=n===-1?o>0?0:e.length-1:(n+o+e.length)%e.length;return e[r]?.focus(),true}function At(e,t){let o=t==="first"?e[0]:e[e.length-1];return o?(o.focus(),true):false}function rd(e){let t=e?.ownerDocument.activeElement;((t&&e?.contains(t)?t.closest("[data-menu]"):null)?.querySelector(':scope > [role="menuitem"]')??e?.querySelector('.docx-menubar__trigger[aria-expanded="true"]'))?.focus({preventScroll:true});}var Fo="data-toolbar-group",fn="data-toolbar-fixed",aa="data-toolbar-more",AT=34,Yi=new Set;function Xi(e,t,o){let n=Pt.useRef(null),r=Pt.useRef(new Map),i=Pt.useRef(AT),[a,s]=Pt.useState(Yi),l=Pt.useRef(a);l.current=a;let c=Pt.useRef({groups:t,order:o});c.current={groups:t,order:o};let d=t.join("\0"),f=o.join("\0"),u=Pt.useCallback(()=>{let m=n.current;if(!m||!e)return;let p=getComputedStyle(m),v=editor.readColumnGap(p),y=editor.readAvailableWidth(m,p),x=m.querySelector(".docx-toolbar__separator"),h=v*2;if(x){let R=getComputedStyle(x),M=editor.readInlineMargins(R);h=editor.separatorLeadingCost(x.offsetWidth,M.start,M.end,v);}for(let R of m.querySelectorAll(`[${Fo}]`)){let M=R.getAttribute(Fo);M&&R.offsetWidth>0&&r.current.set(M,editor.collapsibleGroupCost(R.offsetWidth,h));}let b=0;for(let R of m.querySelectorAll(`[${fn}]`))R.offsetWidth>0&&(b+=editor.trailingGapCost(R.offsetWidth,v));let S=m.querySelector(`[${aa}]`);S&&S.offsetWidth>0&&(i.current=editor.trailingGapCost(S.offsetWidth,v));let C={available:y,widths:r.current,groups:c.current.groups,order:c.current.order,fixed:b,more:i.current,previous:l.current,hysteresis:editor.TOOLBAR_OVERFLOW_HYSTERESIS},T=l.current.size===0&&editor.controlsOverflow(m,p)===false?Yi:editor.toolbarOverflowGroups(C);editor.sameOverflow(T,l.current)||(l.current=T,s(T));},[e]),g=Pt.useCallback(m=>{n.current=m;},[]);return Pt.useLayoutEffect(()=>{if(!e){l.current.size>0&&(l.current=Yi,s(Yi));return}u();},[e,d,u,f]),Pt.useEffect(()=>{let m=n.current;if(!e||!m||typeof ResizeObserver>"u")return;let p=0,v=new ResizeObserver(()=>{p===0&&(p=requestAnimationFrame(()=>{p=0,u();}));});v.observe(m),m.parentElement&&v.observe(m.parentElement);for(let y of m.querySelectorAll(`[${Fo}], [${fn}]`))v.observe(y);return ()=>{p!==0&&cancelAnimationFrame(p),v.disconnect();}},[e,d,u,f,a]),{attach:g,overflow:a}}function hf(e,t,o){let n=e.overflow.has(t),r=t===or;return {skip:e.inMore?!n:n,asSubmenu:e.inMore&&n,iconOnly:r,rootAttributes:{...e.measuring&&!r?{[Fo]:t}:{},...r?{[aa]:""}:{}},tabStop:o===t||r&&o!==null&&e.overflow.has(o)}}function bf(e,t,o){let[n,r]=Pt.useState(void 0);return Pt.useLayoutEffect(()=>{if(!e){r(void 0);return}let i=()=>{let s=t.current,l=o.current,c=s?.parentElement,d=s?.ownerDocument.defaultView;if(!s||!l||!c||!d)return;let f=s.getBoundingClientRect(),u=editor.toolbarPanelPlacement({triggerLeft:f.left,triggerRight:f.right,panelWidth:l.offsetWidth,viewportWidth:d.innerWidth});r({left:u.left-c.getBoundingClientRect().left,right:"auto",maxInlineSize:u.maxWidth});};i();let a=t.current?.ownerDocument.defaultView;return a?.addEventListener("resize",i),()=>a?.removeEventListener("resize",i)},[e,o,t]),n}var yf=12700,vf=96;function zT(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function $T(e,t,o,n){let r=e*72/o,i=t*72/n;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(i*100)/100)}}function Ji(e){let t=editor.DEFAULT_IMAGE_RESOURCE_LIMITS;if(e.byteLength===0)return {ok:false,reasonKey:"imageInsert.errors.emptyFile"};if(e.byteLength>t.maxEncodedBytes)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let o=editor.sniffImageMime(e);if(!zT(o))return o==="image/svg+xml"||o==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let n=editor.validateRasterHeader(e,o);if(!n)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(n.pixelWidth*n.pixelHeight>t.maxPixels||n.pixelWidth>t.maxDimension||n.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:i,heightPoints:a}=$T(n.pixelWidth,n.pixelHeight,n.dpiX??vf,n.dpiY??vf);return Object.freeze({ok:true,bytes:e,mime:o,widthPoints:i,heightPoints:a})}function Ho(e){return Math.round(e/yf*100)/100}function ia(e){return Math.round(e*yf)}var YT="image/png,image/jpeg,image/gif",id=Pt.createContext(null);function Pf(){let e=Pt.useContext(id);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function la(){return Pt.useContext(id)}function Qi({children:e}){let t=F(),{t:o}=N(),n=Pt.useRef(null),r=Pt.useRef(false),i=Pt.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),a=O(i,(p,v)=>p.enabled===v.enabled&&p.disabledReason===v.disabledReason),s=a.enabled,l=i18n.localizeDisabledReason(a.disabledReason,o),c=Pt.useCallback(async p=>{if(!t||r.current)return;let v=Ji(p);if(!v.ok){window.alert(o(v.reasonKey));return}let y={type:"insertImage",data:v.bytes,mime:v.mime,widthPoints:v.widthPoints,heightPoints:v.heightPoints};r.current=true;try{let x=await editor.executeImageCommand(t,y);x.ok?t.focus():window.alert(i18n.localizeDisabledReason(XT(x.reason)??null,o)??o("imageInsert.errors.refused"));}finally{r.current=false;}},[t,o]),d=Pt.useCallback(async p=>{let v=p?.[0];if(!v)return;let y=await v.arrayBuffer();await c(new Uint8Array(y));},[c]),f=Pt.useCallback(async p=>{if(!p)return;let v=[...p.files].find(y=>y.type.startsWith("image/"));if(v){await d([v]);return}for(let y of p.items){if(y.kind!=="file"||!y.type.startsWith("image/"))continue;let x=y.getAsFile();if(!x)continue;let h=await x.arrayBuffer();await c(new Uint8Array(h));return}},[c,d]),u=Pt.useCallback(()=>{s&&n.current?.click();},[s]),g=Pt.useCallback(async p=>{let v=p.currentTarget;await d(v.files),v.value="";},[d]),m=Pt.useMemo(()=>({openFilePicker:u,insertFromFileList:d,insertFromDataTransfer:f,isEnabled:s,disabledReason:l,inputRef:n,onInputChange:g}),[u,d,f,s,l,g]);return jsxRuntime.jsxs(id.Provider,{value:m,children:[jsxRuntime.jsx("input",{ref:n,type:"file",accept:YT,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:p=>p.stopPropagation()}),e]})}function el({className:e,hidden:t,asChild:o,children:n}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=Pf(),s=X();if(t)return null;let l=J("image.insert"),c=s(l?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":c,title:a??c,onMouseDown:B,onClick:r};return o?jsxRuntime.jsx(j,{...d,children:n}):jsxRuntime.jsx("button",{...d,children:n??re(l?.paths)})}el.docxSlot="image.insert";var sa=Object.assign(el,{docxSlot:"image.insert"});function XT(e){return e&&/\s/.test(e)?e:void 0}var ld=6,wf=6;function ol({slot:e,label:t,onInserted:o,className:n}){let r=F(),{isEnabled:i}=ie(e),[a,s]=Pt.useState(null),[l,c]=Pt.useState({rows:1,cols:1}),d=Pt.useRef(null),f=Pt.useCallback((m,p)=>{if(!r||!i)return;let v={type:"insertTable",rows:m,cols:p};r.can(v).ok&&(r.exec(v),o(),r.focus());},[r,i,o]),u=Pt.useCallback(m=>{c(p=>{let v={rows:Math.min(wf,Math.max(1,p.rows+(m.rows??0))),cols:Math.min(ld,Math.max(1,m.toCol??p.cols+(m.cols??0)))};return s(v),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${v.rows}x${v.cols}"]`)?.focus()),v});},[]),g=[];for(let m=1;m<=wf;m+=1){let p=[];for(let v=1;v<=ld;v+=1){let y=!!a&&m<=a.rows&&v<=a.cols;p.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${m}x${v}`,className:"docx-menubar__grid-cell",tabIndex:l.rows===m&&l.cols===v?0:-1,...y?{"data-filled":""}:{},"aria-label":`${v} \xD7 ${m}`,onMouseDown:B,onMouseEnter:()=>s({rows:m,cols:v}),onFocus:()=>s({rows:m,cols:v}),onClick:()=>f(m,v)},v));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:p},m));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":t,className:`docx-menubar__grid${n?` ${n}`:""}`,onMouseLeave:()=>s(null),onKeyDown:m=>{if(m.key==="ArrowRight")u({cols:1});else if(m.key==="ArrowLeft")u({cols:-1});else if(m.key==="ArrowDown")u({rows:1});else if(m.key==="ArrowUp")u({rows:-1});else if(m.key==="Home")u({toCol:1});else if(m.key==="End")u({toCol:ld});else return;m.preventDefault(),m.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:g}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:a?`${a.cols} \xD7 ${a.rows}`:""})]})}function ar({slot:e="table.insert",className:t}){let{setOpenMenu:o}=at(),n=ke(),r=Pt.useCallback(()=>o(null),[o]);return jsxRuntime.jsx(ol,{slot:e,label:n("toolbar.insertTable"),onInserted:r,className:t})}function _e(e){let{icon:t,shortcut:o,disabled:n,title:r,active:i,selected:a,slot:s,onSelect:l,className:c,children:d}=e,f=e["data-value"],u=ko(),g=Pt.useId(),m=Pt.useContext(nr),p=n&&r?g:void 0;return jsxRuntime.jsxs("button",{type:"button",role:i===void 0?"menuitem":a===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${c?` ${c}`:""}`,tabIndex:m,...s?{"data-slot":s}:{},...f!==void 0?{"data-value":f}:{},...i?{"data-active":""}:{},...n?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...p?{"aria-describedby":p}:{},...r?{title:r}:{},onMouseDown:B,onClick:n?void 0:l,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),o?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:u(o)}):null,p?jsxRuntime.jsx("span",{id:g,className:"docx-editor-sr-only",children:r}):null]})}function da({label:e,labelKey:t,className:o,hidden:n,children:r}){let i=ke();if(n)return null;let a=e??(t===void 0?void 0:i(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${o?` ${o}`:""}`,...a?{"aria-label":a}:{},children:[a?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:a}):null,r]})}function nl(e){if(e.slotId)return e.slotId;if(e.slot)return _m(e.slot),e.slot;Lm();}function ho(e){let{labelKey:t,shortcutKey:o,className:n,hidden:r}=e,i=nl(e)??"",{execute:a,isActive:s,isEnabled:l,disabledReason:c,value:d}=ie(i),{setOpenMenu:f}=at(),u=ke();if(r||!i)return null;let g=J(i),m=u(t??g?.labelKey??i),p=editor.chromeSlotIsToggle(i),v=["setAlignment","setParagraphDirection","setReviewDisplayMode"].includes(editor.commandForSlot(i)?.type??"");return jsxRuntime.jsx(_e,{slot:i,icon:re(g?.paths),...o?{shortcut:u(o)}:{},disabled:!l,...c?{title:c}:{},...p?{active:s}:{},...v?{selected:true}:{},...d!==null?{"data-value":d}:{},onSelect:()=>{a(),f(null);},...n?{className:n}:{},children:m})}ho.docxMenuRow=true;function ua(e,t,o,n,r=()=>true){return Object.assign(({className:a,hidden:s})=>{let l=at(),c=ke(),d=n(l),f=o&&r(l)?o:void 0;if(s)return null;let u=J(e),g=c(t??u?.labelKey??e);return jsxRuntime.jsx(_e,{slot:e,icon:re(u?.paths),...f?{shortcut:c(f)}:{},disabled:!d,onSelect:()=>{d?.(),l.setOpenMenu(null);},...a?{className:a}:{},children:g})},{docxSlot:e})}var cd=ua("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),dd=ua("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave),ud=ua("file.exportMarkdown",void 0,void 0,e=>e.onExport?()=>e.onExport?.("markdown"):void 0),pd=ua("file.exportPdf",void 0,void 0,e=>e.onExport?()=>e.onExport?.("pdf"):void 0),md=ua("file.print",void 0,"toolbar.printShortcut",e=>e.onPrint,e=>e.printShortcut===true);function cP({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=ie(editor.chromeProbeForSlot("file.pageSetup")),r=at(),i=ke();if(t)return null;let a=J("file.pageSetup"),s=i(a?.labelKey??"file.pageSetup"),l=o&&!!r.onPageSetup;return jsxRuntime.jsx(_e,{slot:"file.pageSetup",icon:re(a?.paths),disabled:!l,...n?{title:n}:{},onSelect:()=>{r.onPageSetup?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:s})}function dP({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=ie(editor.chromeProbeForSlot("paragraph.dialog")),r=at(),i=ke();if(t)return null;let a=J("paragraph.dialog"),s=i(a?.labelKey??"lineSpacing.options"),l=o&&!!r.onParagraphDialog;return jsxRuntime.jsx(_e,{slot:"paragraph.dialog",icon:re(a?.paths),disabled:!l,...n?{title:n}:{},onSelect:()=>{r.onParagraphDialog?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:s})}var uP=Object.assign(dP,{docxSlot:"paragraph.dialog"}),fd=Object.assign(cP,{docxSlot:"file.pageSetup"});function pP({className:e,hidden:t}){let o=la(),n=at(),r=ke();if(t)return null;let i=J("image.insert"),a=r(i?.labelKey??"toolbar.image"),s=o?.isEnabled??false,l=o?.disabledReason??null;return jsxRuntime.jsx(_e,{slot:"image.insert",icon:re(i?.paths),disabled:!s,...l?{title:l}:{},onSelect:()=>{o?.openFilePicker(),n.setOpenMenu(null);},...e?{className:e}:{},children:a})}var gd=Object.assign(pP,{docxSlot:"image.insert"}),ca=8;function Ot({labelKey:e,label:t,paths:o,className:n,children:r}){let i=ke(),[a,s]=Pt.useState(false),l=Pt.useRef(null),c=Pt.useRef(null),d=Pt.useId();t===void 0&&e===void 0&&Fm();let f=t??i(e??""),[u,g]=Pt.useState(null);return Pt.useLayoutEffect(()=>{if(!a){g(null);return}let m=l.current,p=c.current,v=m?.ownerDocument.defaultView;if(!m||!p||!v)return;let y=m.getBoundingClientRect(),x=p.offsetWidth,h=p.offsetHeight,b=y.right+x>v.innerWidth-ca;g({left:b?Math.max(ca,y.left-x):Math.min(y.right,v.innerWidth-x-ca),top:Math.max(ca,Math.min(y.top-4,v.innerHeight-h-ca))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onKeyDown:m=>{m.key==="ArrowRight"&&document.activeElement===l.current?(m.preventDefault(),s(true),queueMicrotask(()=>{c.current&&At(mn(c.current),"first");})):(m.key==="ArrowLeft"||m.key==="Escape")&&a&&(m.preventDefault(),m.stopPropagation(),s(false),l.current?.focus());},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||s(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?d:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:B,onFocus:()=>s(true),onClick:()=>s(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:re(o)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:f}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:d,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":f,style:u?{position:"fixed",left:u.left,top:u.top}:{position:"fixed",visibility:"hidden"},onKeyDown:m=>{let p=c.current;if(!p)return;let v=mn(p);m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),Ht(v,document.activeElement,1)):m.key==="ArrowUp"&&(m.preventDefault(),m.stopPropagation(),Ht(v,document.activeElement,-1));},children:jsxRuntime.jsx(nr.Provider,{value:-1,children:r})}):null]})}function mP({entry:e}){let{isEnabled:t}=ie(e.slot),o=J(e.slot);return t?jsxRuntime.jsx(Ot,{labelKey:e.labelKey??o?.labelKey??e.slot,paths:o?.paths,children:jsxRuntime.jsx(ar,{slot:e.slot})}):jsxRuntime.jsx(ho,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function gn({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function pa({entry:e,children:t}){return e.kind==="separator"?jsxRuntime.jsx(gn,{}):e.kind==="submenu"?jsxRuntime.jsx(Ot,{labelKey:e.labelKey,paths:e.paths,children:t??e.items.map((o,n)=>jsxRuntime.jsx(pa,{entry:o},n))}):e.slot==="file.open"?jsxRuntime.jsx(cd,{}):e.slot==="file.save"?jsxRuntime.jsx(dd,{}):e.slot==="file.exportMarkdown"?jsxRuntime.jsx(ud,{}):e.slot==="file.exportPdf"?jsxRuntime.jsx(pd,{}):e.slot==="file.print"?jsxRuntime.jsx(md,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(fd,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(uP,{}):e.slot==="image.insert"?jsxRuntime.jsx(gd,{}):e.picker==="tableGrid"?jsxRuntime.jsx(mP,{entry:e}):jsxRuntime.jsx(ho,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function kf(e){if(!Pt.isValidElement(e))return null;let t=tr(e,kf);if(t!==null)return t;let o=e.type;return typeof o!="function"&&typeof o!="object"?null:typeof o.docxSlot=="string"?o.docxSlot:o.docxMenuRow===true?nl(e.props)??null:null}function fP(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function Rf(e,t,o){return Vi({entries:e??[],children:t,preset:o,keyOfEntry:fP,keyOfChild:kf,childrenOfEntry:n=>n.kind==="submenu"?n.items:void 0,renderEntry:(n,r,i)=>jsxRuntime.jsx(pa,{entry:n,children:i})})}function Bt({id:e,labelKey:t,label:o,icon:n,className:r,hidden:i,preset:a=true,children:s}){let{openMenu:l,setOpenMenu:c,activeMenu:d,opening:f}=at(),u=mf(),g=ke(),m=Pt.useId(),p=Pt.useRef(null),v=Pt.useRef(null),y=Pt.useRef(false),x=Pt.useRef(false),h=editor.CHROME_MENUS.find(E=>E.id===e),b=l===e,S=bf(b&&e===or,p,v);if(i)return null;let C=o??g(t??h?.labelKey??e),P=hf(u,e,d);if(P.skip)return null;if(P.asSubmenu)return jsxRuntime.jsx(Ot,{labelKey:t??h?.labelKey??e,label:C,children:Rf(h?.entries,s,a)});let T=Rf(h?.entries,s,a),R=P.iconOnly,M=()=>{c(null),p.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,...P.rootAttributes,children:[jsxRuntime.jsxs("button",{ref:p,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":b,"aria-controls":b?m:void 0,className:"docx-menubar__trigger",disabled:f===true,tabIndex:P.tabStop?0:-1,...b?{"data-open":""}:{},...R?{"aria-label":C,title:C}:{},onMouseDown:B,onKeyDown:E=>{E.key==="ArrowDown"||E.key==="Enter"||E.key===" "||E.key==="ArrowUp"?(E.preventDefault(),y.current=true,c(e)):E.key==="Escape"&&b&&(E.preventDefault(),M());},onClick:()=>{if(x.current){x.current=false;return}c(b?null:e);},onMouseEnter:()=>{l!==null&&l!==e&&(x.current=true,c(e));},onMouseLeave:()=>{x.current=false;},children:[n?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:n}):null,R?null:C]}),b?jsxRuntime.jsx("div",{ref:E=>{v.current=E,E&&y.current&&(y.current=false,At(mn(E),"first"));},id:m,role:"menu","aria-label":C,style:S,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:E=>{let _=v.current;if(!_)return;let H=mn(_),L=document.activeElement;E.key==="ArrowDown"?(E.preventDefault(),Ht(H,L,1)):E.key==="ArrowUp"?(E.preventDefault(),Ht(H,L,-1)):E.key==="Home"?(E.preventDefault(),At(H,"first")):E.key==="End"?(E.preventDefault(),At(H,"last")):E.key==="Escape"?(E.preventDefault(),E.stopPropagation(),M()):E.key==="Tab"&&c(null);},children:jsxRuntime.jsx(nr.Provider,{value:-1,children:T})}):null]})}function hd(e){return Object.assign(o=>jsxRuntime.jsx(Bt,{id:e,...o}),{docxMenu:e})}var bd=hd("file"),vd=hd("format"),yd=hd("insert");var rl=Pt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function Ao(){return Pt.useContext(rl)}function _f(){return Pt.useContext(rl).target}var Nf=["M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-560l-80-80 240-240h120v40L600-560ZM240-640q33 0 56.5-23.5T320-720q0-33-23.5-56.5T240-800q-33 0-56.5 23.5T160-720q0 33 23.5 56.5T240-640Zm240 180q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6Zm-240 300q33 0 56.5-23.5T320-240q0-33-23.5-56.5T240-320q-33 0-56.5 23.5T160-240q0 33 23.5 56.5T240-160Z"],Lf=["M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"],xd=["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"],Ff=["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],Hf=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],Af=["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],Of=["M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"];function sr(e,t,o){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:s,hidden:l})=>{let c=F(),{close:d}=Ao(),f=ke(),{isEnabled:u,disabledReason:g}=ie(t);return l?null:jsxRuntime.jsx(_e,{slot:e,icon:r??re(o.paths),shortcut:f(a??o.shortcutKey),disabled:!u,...g?{title:g}:{},onSelect:()=>{c?.exec(t),d(true);},...s?{className:s}:{},children:f(i??o.labelKey)})},{docxRow:e})}var ma=sr("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:Nf}),fa=sr("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:Lf}),ga=sr("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:Ff}),ha=sr("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:Of});function cr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=F(),{close:a,clipboardRefusal:s,reportClipboardRefusal:l}=Ao(),c=ke(),d=Pt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:f,disabledReason:u}=ie(d);if(r)return null;let g=s!==null;return jsxRuntime.jsx(_e,{slot:"edit.paste",icon:e??re(xd),shortcut:c(o??"contextMenu.pasteShortcut"),disabled:!f||g,...s??u?{title:s??u??""}:{},onSelect:()=>{(async()=>{try{let{text:m,html:p}=await bP();(m||p)&&i?.exec({type:"paste",text:m,...p?{html:p}:{}});}catch(m){l(m instanceof Error?m.message:"the clipboard is not readable");}finally{a(true);}})();},...n?{className:n}:{},children:c(t??"contextMenu.paste")})}cr.docxRow="edit.paste";async function bP(){let e=navigator.clipboard;if(typeof e.read=="function"&&typeof ClipboardItem<"u")try{let t=await e.read(),o="",n=null;for(let r of t)r.types.includes("text/plain")&&(o=await(await r.getType("text/plain")).text()),r.types.includes("text/html")&&(n=await(await r.getType("text/html")).text());if(o||n)return {text:o,html:n}}catch{}return {text:await e.readText(),html:null}}function dr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=F(),{close:a,clipboardRefusal:s,reportClipboardRefusal:l}=Ao(),c=ke(),d=Pt.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:f,disabledReason:u}=ie(d);if(r)return null;let g=s!==null;return jsxRuntime.jsx(_e,{slot:"edit.pasteWithoutFormatting",icon:e??re(xd),shortcut:c(o??"contextMenu.pasteWithoutFormattingShortcut"),disabled:!f||g,...s??u?{title:s??u??""}:{},onSelect:()=>{(async()=>{try{let m=await navigator.clipboard.readText();m&&i?.exec({type:"pasteWithoutFormatting",text:m});}catch(m){l(m instanceof Error?m.message:"the clipboard is not readable");}finally{a(true);}})();},...n?{className:n}:{},children:c(t??"contextMenu.pasteWithoutFormatting")})}dr.docxRow="edit.pasteWithoutFormatting";var Bf=J("format.painter")?.paths??[],al=sr("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:Bf}),il=sr("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:Bf});function hn(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:s,destructive:l})=>{let{close:c}=Ao(),d=ke(),f=ll(),{isEnabled:u,disabledReason:g,execute:m}=ie(t);return s||!f?null:jsxRuntime.jsx(_e,{slot:e,icon:r??re(o.paths),disabled:!u,...g?{title:g}:{},className:`${l??o.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{m()&&c(true);},children:d(i??o.labelKey)})},{docxRow:e})}var ur=hn("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),pr=hn("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),mr=hn("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),fr=hn("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),gr=hn("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),hr=hn("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),br=hn("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),vP=[{alignment:"top",labelKey:"tableAdvanced.top",icon:"vertical_align_top"},{alignment:"center",labelKey:"tableAdvanced.middle",icon:"vertical_align_center"},{alignment:"bottom",labelKey:"tableAdvanced.bottom",icon:"vertical_align_bottom"}];function bn({hidden:e}){let{close:t}=Ao(),o=ke(),n=ll(),r=ie({type:"setTableCellVerticalAlignment",alignment:"top"}),i=ie({type:"setTableCellVerticalAlignment",alignment:"center"}),a=ie({type:"setTableCellVerticalAlignment",alignment:"bottom"}),s=[r,i,a];return e||!n?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":o("tableAdvanced.verticalAlignment"),children:vP.map((l,c)=>{let d=s[c];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":o(l.labelKey),title:d.disabledReason??o(l.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:f=>{f.preventDefault(),f.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:re(editor.tableChromeIconPaths(l.icon))},l.alignment)})})]})}bn.docxRow="table.cellVerticalAlignment";function Zf(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:s})=>{let l=F(),{close:c,tocId:d}=Ao(),f=ke(),u=Pt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:m}=ie(u);return s||d===null?null:jsxRuntime.jsx(_e,{slot:e,icon:r??re(o.paths),disabled:!g,...m?{title:m}:{},onSelect:()=>{l?.exec(u),c(true);},...a?{className:a}:{},children:f(i??o.labelKey)})},{docxRow:e})}var vr=Zf("toc.refresh","entire",{labelKey:"toc.refresh",paths:Hf}),yr=Zf("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:Af});function ll(){return O(Pt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function sl({label:e,icon:t,shortcut:o,disabled:n,disabledReason:r,active:i,onSelect:a,className:s}){let{close:l}=Ao();return jsxRuntime.jsx(_e,{...t?{icon:t}:{},...o?{shortcut:o}:{},...n?{disabled:n}:{},...n&&r?{title:r}:{},...i!==void 0?{active:i}:{},onSelect:()=>{a?.(),l(true);},...s?{className:s}:{},children:e})}var vn=Pt.createContext(false);function Ct(){return Pt.useContext(vn)?"":"docx-editor "}var ul=8;function SP(){let e=Pt.useContext(xt),t=at(),o=ke(),{isEnabled:n,reason:r}=Gi(o);if((e?.mounted??0)===0)return null;let i=J("review.addComment");return jsxRuntime.jsx(_e,{icon:re(i?.paths),slot:"review.addComment",disabled:!n,title:r??void 0,onSelect:()=>{e?.requestCommentDraft()&&t.setOpenMenu(null);},children:o("comments.addComment")})}function EP(){let e=F(),t=at(),o=ke();return e?.can({type:"editTextFormField"}).ok?jsxRuntime.jsx(_e,{slot:"field.edit",onSelect:()=>{t.setOpenMenu(null),e.exec({type:"editTextFormField"});},children:o("textFormField.edit")}):null}var wP=[{kind:"row",id:"field.edit",render:()=>jsxRuntime.jsx(EP,{})},{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(ma,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(fa,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(cr,{})},{kind:"row",id:"edit.pasteWithoutFormatting",render:()=>jsxRuntime.jsx(dr,{})},{kind:"row",id:"format.copyFormatting",render:()=>jsxRuntime.jsx(al,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(il,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(ga,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(ha,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(ho,{slotId:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.addComment",render:()=>jsxRuntime.jsx(SP,{})}];function MP(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:ur.docxRow,render:()=>jsxRuntime.jsx(ur,{})},{kind:"row",id:pr.docxRow,render:()=>jsxRuntime.jsx(pr,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:mr.docxRow,render:()=>jsxRuntime.jsx(mr,{})},{kind:"row",id:fr.docxRow,render:()=>jsxRuntime.jsx(fr,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:gr.docxRow,render:()=>jsxRuntime.jsx(gr,{})},{kind:"row",id:hr.docxRow,render:()=>jsxRuntime.jsx(hr,{})},{kind:"row",id:br.docxRow,render:()=>jsxRuntime.jsx(br,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:bn.docxRow,render:()=>jsxRuntime.jsx(bn,{})}]}function RP(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:vr.docxRow,render:()=>jsxRuntime.jsx(vr,{})},{kind:"row",id:yr.docxRow,render:()=>jsxRuntime.jsx(yr,{})}]}function DP(e,t=false){return [...wP,...e?MP():[],...t?RP():[]]}function $f(e){if(!Pt.isValidElement(e))return null;let t=tr(e,$f);if(t!==null)return t;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxRow=="string")return o.docxRow;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxMenuRow===true){let n=nl(e.props);if(n)return n}return null}function Wf(e){if(!Pt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function kP(e){return e?.closest(".docx-editor__scroll-container")??null}function va({className:e,t,preset:o=true,disabled:n,onOpenChange:r,children:i}){let a=Ct(),s=F(),{t:l}=N(),c=ll(),d=Pt.useRef(null),f=Pt.useRef(null),[u,g]=Pt.useState(null),[m,p]=Pt.useState(null),[v,y]=Pt.useState(null),x=Pt.useMemo(()=>DP(c,m!==null),[c,m]),[h,b]=Pt.useState(null),S=Pt.useCallback((H=false)=>{g(null),b(null),p(null),y(null),H&&s?.focus();},[s]);Pt.useEffect(()=>{if(n)return;let H=kP(d.current);if(!H)return;let L=k=>{k.preventDefault();let w=k.button===-1||k.clientX===0&&k.clientY===0,I=H.getBoundingClientRect();p(s?.snapshot().tocContext?.id??null),y(w||!(k.target instanceof HTMLElement)?null:k.target),g(w?{x:I.left+16,y:I.top+16}:{x:k.clientX,y:k.clientY});};return H.addEventListener("contextmenu",L),()=>H.removeEventListener("contextmenu",L)},[n,s]),Pt.useEffect(()=>{n&&S();},[n,S]),Pt.useEffect(()=>{if(!u)return;let H=w=>{f.current?.contains(w.target)||S();},L=w=>{w.key==="Escape"?(w.preventDefault(),S(true)):w.key==="Tab"&&S();},k=()=>S();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",L),document.addEventListener("scroll",k,{capture:true,passive:true}),window.addEventListener("blur",k),window.addEventListener("resize",k),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",L),document.removeEventListener("scroll",k,true),window.removeEventListener("blur",k),window.removeEventListener("resize",k);}},[u,S]),Pt.useLayoutEffect(()=>{let H=f.current;if(!u||!H)return;let{width:L,height:k}=H.getBoundingClientRect(),w=window.innerWidth-L-ul,I=window.innerHeight-k-ul,$=Math.max(ul,u.x>w?u.x-L:u.x),W=Math.max(ul,u.y>I?u.y-k:u.y);b({x:$,y:W});},[u]),Pt.useLayoutEffect(()=>{h&&f.current?.focus({preventScroll:true});},[h]);let C=Pt.useRef(r);C.current=r;let P=Pt.useRef(false);Pt.useEffect(()=>{let H=u!==null;H!==P.current&&(P.current=H,C.current?.(H));},[u]);let T=Pt.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>S(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,S]),[R,M]=Pt.useState(null),E=Pt.useMemo(()=>({close:S,anchor:u,tocId:m,target:v,clipboardRefusal:R,reportClipboardRefusal:M}),[S,u,m,v,R]),_={position:"fixed",left:(h??u)?.x??0,top:(h??u)?.y??0,visibility:h?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:u?jsxRuntime.jsx(na.Provider,{value:T,children:jsxRuntime.jsx(rl.Provider,{value:E,children:jsxRuntime.jsxs("div",{ref:f,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??l("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:_,onKeyDown:H=>{let L=f.current;if(!L)return;let k=mn(L);H.key==="ArrowDown"?(H.preventDefault(),Ht(k,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),Ht(k,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),At(k,"first")):H.key==="End"&&(H.preventDefault(),At(k,"last"));},children:[Pt.Children.toArray(i).filter(Wf),Vi({entries:x,children:Pt.Children.toArray(i).filter(H=>!Wf(H)),preset:o,keyOfEntry:H=>H.id,keyOfChild:H=>cf($f(H)),renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(gn,{}):H.render(),onUnmatched:(H,L)=>{L.props.hidden&&Nm(H);}})]})})}):null})}var Pd=Object.assign(va,{Cut:ma,Copy:fa,Paste:cr,PasteWithoutFormatting:dr,Delete:ga,SelectAll:ha,InsertRowAbove:ur,InsertRowBelow:pr,InsertColumnLeft:mr,InsertColumnRight:fr,DeleteTableRow:gr,DeleteTableColumn:hr,DeleteTable:br,CellVerticalAlignment:bn,RefreshToc:vr,RefreshTocPageNumbers:yr,Item:sl,Slot:ho,Row:_e,Group:da,Separator:gn,Submenu:Ot});var Uf=Pt.createContext(void 0),Vf=Uf.Provider,Zt=()=>Pt.useContext(Uf);function Gf(){let e=Zt(),{t}=N();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e?.hyperlink&&De(e.hyperlink,{}),e?.contentControl&&De(e.contentControl,{}),e?.equation&&De(e.equation,{}),e?.contextMenu&&De(e.contextMenu,{t:o=>t(o)})]})}function jf(e,t,o,n){return {...e,hyperlink:e?.hyperlink??(t===false?false:r=>jsxRuntime.jsx(Jr,{...r})),contentControl:e?.contentControl??(r=>jsxRuntime.jsx(ta,{...r})),equation:e?.equation??(()=>jsxRuntime.jsx(oa,{})),contextMenu:e?.contextMenu!==void 0?e.contextMenu===false?false:r=>e.contextMenu&&De(e.contextMenu,{...r,t:n??r.t}):o===false?false:r=>jsxRuntime.jsx(va,{...r,t:n??r.t,...typeof o=="object"?o:{}})}}function HP(e,t){return e===t?true:!e||!t||e.kind!==t.kind?false:e.kind==="note"&&t.kind==="note"?e.id===t.id:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:true}function Sd(){let e=F(),t=Pt.useCallback(n=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),o=O(t,HP);return o?.kind==="note"?o:null}function Yf(e,t){return e===t?true:!e||!t?false:e.pos===t.pos&&e.numFmt===t.numFmt&&e.numStart===t.numStart&&e.numRestart===t.numRestart}function Xf(e,t){return e.resolved.pos===t.resolved.pos&&e.resolved.numFmt===t.resolved.numFmt&&e.resolved.numStart===t.resolved.numStart&&e.resolved.numRestart===t.resolved.numRestart&&Yf(e.documentAuthored,t.documentAuthored)&&Yf(e.sectionAuthored,t.sectionAuthored)}function AP(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Xf(e.footnote,t.footnote)&&Xf(e.endnote,t.endnote)}function Ed(){let e=F(),t=Pt.useCallback(o=>e?.getNotePropertiesState()??null,[e]);return O(t,AP)}function ya(e,t){let[o,n]=Pt.useState(null),r=Pt.useCallback(s=>n(s),[]),[i,a]=Pt.useState({visibility:"hidden"});return Pt.useLayoutEffect(()=>{let s=o?.closest(".docx-editor__scroll-container"),l=s??o?.parentElement?.querySelector(".docx-editor__scroll-container");if(!o||!l)return;let c=0,d=null,f=new ResizeObserver(()=>g()),u=()=>{c=0;let p=e(l);if(p!==d&&(f.disconnect(),f.observe(l),f.observe(o),p&&f.observe(p),d=p),!p||!p.isConnected){a({visibility:"hidden"});return}let v=p.getBoundingClientRect(),y=t==="story-label"?Math.max(o.offsetHeight,28):o.offsetHeight,x=t==="story-label"?6:4,h=s===l,b=t==="after"?v.bottom+6:v.top-y-x,S=h?Xn(l,v.left,b):{left:v.left,top:b},C=S.left,P=S.top,T=h?l.scrollLeft+8:8;a({position:h?"absolute":"fixed",left:t==="story-label"?C:Math.max(T,C+8),top:t==="story-label"?P:Math.max(h?l.scrollTop+8:8,P),...t==="story-label"?{width:Math.max(240,Math.min(v.width,l.clientWidth-16))}:{maxWidth:Math.max(240,Math.min(v.width-16,l.clientWidth-16))},visibility:"visible"});},g=()=>{c||(c=requestAnimationFrame(u));};f.observe(l),f.observe(o);let m=new MutationObserver(g);return m.observe(l,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),l.addEventListener("scroll",g,{passive:true}),window.addEventListener("resize",g),u(),()=>{c&&cancelAnimationFrame(c),f.disconnect(),m.disconnect(),l.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[o,e,t]),{ref:r,style:i}}var ZP=/^(footnote|endnote):(-?\d{1,10})$/;function eg(e){let t=ZP.exec(e);if(!t)return null;let o=Number(t[2]);return Number.isInteger(o)?{noteKind:t[1],noteId:o}:null}function qP(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function Md(e){let t=F();return Pt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function KP(e){let{t}=N(),[o,n]=Pt.useState(false),r=Pt.useRef(null);return Pt.useEffect(()=>{if(!o)return;let i=a=>{r.current?.contains(a.target)||n(false);};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":o,"aria-haspopup":"menu",onMouseDown:B,onClick:()=>n(i=>!i),children:t("headerFooter.options")}),o?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:B,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),n(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),n(false);},children:t("common.close")})]}):null]})}function fl({className:e}){let t=Zt(),o=Pt.useRef(null),{t:n}=N(),r=F(),i=Sd(),[a,s]=Pt.useState(null),[l,c]=Pt.useState(null),[d,f]=Pt.useState(false),u=Pt.useRef(null),g=Pt.useCallback(_=>{if(!i)return null;let L=[..._.querySelectorAll("[data-docx-note-scope]")].find(k=>k.matches("[data-docx-note]")&&k.dataset.docxNoteScope===i.id)??null;return L?.closest("[data-docx-notes]")??L},[i]),m=ya(g,"story-label"),p=Pt.useCallback(()=>{u.current&&clearTimeout(u.current),u.current=null,s(null);},[]);Pt.useEffect(()=>{if(!r)return;let _=o.current?.closest(".docx-editor__scroll-container")??o.current?.closest(".docx-editor");if(!_)return;let H=w=>{let I=w.target;if(!I)return;let $=I.closest("[data-docx-note-ref]");if($?.dataset.docxNoteScope){w.preventDefault(),p(),c(null),r.setActiveScope({kind:"note",id:$.dataset.docxNoteScope});return}I.closest("[data-docx-note-mark-back]")&&(w.preventDefault(),p(),c(null),r.setActiveScope({kind:"body"}));},L=w=>{let I=w,W=I.target?.closest("[data-docx-note-scope]");W?.dataset.docxNoteScope&&(I.preventDefault(),c({scopeId:W.dataset.docxNoteScope,x:I.clientX,y:I.clientY}));},k=w=>{if(qP())return;let $=w.target?.closest("[data-docx-note-ref]");if(!$?.dataset.docxNoteScope){p();return}let W=$.dataset.docxNoteScope,V=r.getNotePreviewText(W)??$.getAttribute("aria-description")??n("notes.previewFallback"),se=$.getBoundingClientRect();u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{s({scopeId:W,text:V,x:se.left,y:se.bottom+4});},400);};return _.addEventListener("click",H),_.addEventListener("contextmenu",L),_.addEventListener("pointerover",k),_.addEventListener("scroll",p,true),()=>{_.removeEventListener("click",H),_.removeEventListener("contextmenu",L),_.removeEventListener("pointerover",k),_.removeEventListener("scroll",p,true),p();}},[r,p,n]);let v=Pt.useCallback(_=>{r&&(r.exec(_),c(null));},[r]),y=l?eg(l.scopeId):null,x=Pt.useMemo(()=>y?{type:"deleteNote",noteKind:y.noteKind,noteId:y.noteId}:null,[y]),h=Pt.useMemo(()=>y?{type:"convertNote",fromKind:y.noteKind,noteId:y.noteId}:null,[y]),b=Pt.useMemo(()=>y?{type:"convertAllNotes",fromKind:y.noteKind}:null,[y]),S=Md(x??{type:"deleteNote",noteKind:"footnote",noteId:0}),C=Md(h??{type:"convertNote",fromKind:"footnote",noteId:0}),P=Md(b??{type:"convertAllNotes",fromKind:"footnote"}),T=i?eg(i.id):null,R=T?n("notes.editingRegion",{kind:T.noteKind==="footnote"?n("notes.footnoteKind"):n("notes.endnoteKind"),number:/* arbi patch: the painted mark, not the w:id */o.current?.closest(".docx-editor")?.querySelector(`[data-docx-note-scope="${i.id}"]:is([data-docx-note-ref],[data-docx-note-mark-back])`)?.textContent?.trim()||T.noteId}):null,M=l&&y?{...l,...y,onDelete:()=>{x&&v(x);},onConvert:()=>{h&&v(h);},onConvertAll:()=>{b&&v(b);},onOpenProperties:()=>f(true),onClose:()=>c(null),deleteEnabled:S.enabled,convertEnabled:C.enabled,convertAllEnabled:P.enabled,deleteDisabledReason:S.reason??void 0,convertDisabledReason:C.reason??void 0,convertAllDisabledReason:P.reason??void 0}:null,E={onClose:()=>f(false),onApply:_=>{v(_),f(false);}};return r?jsxRuntime.jsxs("div",{className:e,ref:o,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":i?void 0:true,children:[i&&T?jsxRuntime.jsxs("div",{ref:m.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":n("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":i.id,style:{...m.style,zIndex:ct.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:R}),jsxRuntime.jsx(KP,{onOpenProperties:()=>f(true),onClose:()=>r.setActiveScope({kind:"body"})})]}):null,a&&t?.notePreview!==false?t?.notePreview?De(t.notePreview,a):jsxRuntime.jsx(jn,{...a}):null,M&&t?.notesContextMenu!==false?t?.notesContextMenu?De(t.notesContextMenu,M):jsxRuntime.jsx(Yn,{...M}):null,d&&t?.noteProperties!==false?t?.noteProperties?De(t.noteProperties,E):jsxRuntime.jsx(gl,{...E}):null]}):null}function gl(e){let{t}=N(),o=F(),n=Ed(),[r,i]=Pt.useState("document"),[a,s]=Pt.useState("decimal"),[l,c]=Pt.useState("continuous"),[d,f]=Pt.useState("pageBottom"),[u,g]=Pt.useState("decimal"),[m,p]=Pt.useState("continuous"),[v,y]=Pt.useState("docEnd");Pt.useEffect(()=>{n&&(s(n.footnote.resolved.numFmt),c(n.footnote.resolved.numRestart),f(n.footnote.resolved.pos),g(n.endnote.resolved.numFmt),p(n.endnote.resolved.numRestart),y(n.endnote.resolved.pos));},[n]);let x=!n?.footnote.documentAuthored&&!n?.footnote.sectionAuthored,h=!n?.endnote.documentAuthored&&!n?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","data-docx-modal":"","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:ct.modal},onClick:e.onClose,onKeyDown:b=>{b.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:b=>b.stopPropagation(),onMouseDown:b=>b.stopPropagation(),children:[jsxRuntime.jsx("h2",{className:"docx-note-properties__title",children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-note-properties__body",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__scope",children:[jsxRuntime.jsx("span",{children:t("notes.scope")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:r,onChange:b=>i(b.target.value),children:[jsxRuntime.jsx("option",{value:"document",children:t("notes.scopeDocument")}),jsxRuntime.jsx("option",{value:"section",children:t("notes.scopeSection")})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.footnotes")}),x?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange:b=>s(b.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:l,onChange:b=>c(b.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:d,onChange:b=>f(b.target.value),children:[jsxRuntime.jsx("option",{value:"pageBottom",children:t("dialogs.footnoteProperties.footnotePositions.bottomOfPage")}),jsxRuntime.jsx("option",{value:"beneathText",children:t("dialogs.footnoteProperties.footnotePositions.belowText")})]})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.endnotes")}),h?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:u,onChange:b=>g(b.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:m,onChange:b=>p(b.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:v,"data-testid":"docx-notes-endnote-position",onChange:b=>y(b.target.value),children:[jsxRuntime.jsx("option",{value:"docEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfDocument")}),jsxRuntime.jsx("option",{value:"sectEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfSection")})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__footer",children:[jsxRuntime.jsx("button",{className:"docx-note-properties__button",type:"button",onClick:e.onClose,children:t("common.cancel")}),jsxRuntime.jsx("button",{className:"docx-note-properties__button docx-note-properties__button--primary",type:"button","data-testid":"docx-notes-properties-apply",onClick:()=>{if(!o)return;let b={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?n?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:l,position:d},endnote:{numFmt:u,numRestart:m,position:v}};o.can(b).ok&&e.onApply(b);},children:t("common.apply")})]})]})})}var ng=e=>e.image;function og(e){return Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(t=>t.offsetParent!==null||t===document.activeElement)}function jP(e){e&&!e.closest(".docx-editor")&&e.classList.add("docx-editor");}function YP(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Nd(e){let t=e.position;return !t||e.kind!=="anchored"?{positionMode:"frame",horizontalPoints:"",verticalPoints:"",relativeToH:"page",relativeToV:"line"}:t.mode==="simple"?{positionMode:"simple",horizontalPoints:t.horizontalEmu!==void 0?String(Ho(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ho(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(Ho(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ho(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function XP(e,t){let o=Nd(t);return e.horizontalPoints!==o.horizontalPoints||e.verticalPoints!==o.verticalPoints||e.relativeToH!==o.relativeToH||e.relativeToV!==o.relativeToV}function hl(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let o=ia(t);return Number.isInteger(o)?o:null}function JP(e,t){let o=Nd(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let c=e.horizontalPoints!==o.horizontalPoints,d=e.verticalPoints!==o.verticalPoints,f=c?hl(e.horizontalPoints):t.position?.horizontalEmu,u=d?hl(e.verticalPoints):t.position?.verticalEmu;return c&&f===null?{ok:false}:d&&u===null?{ok:false}:f===void 0||u===void 0?{ok:false}:{ok:true,value:{horizontalEmu:f,verticalEmu:u}}}let n=e.horizontalPoints!==o.horizontalPoints,r=e.verticalPoints!==o.verticalPoints,i=e.relativeToH!==o.relativeToH,a=e.relativeToV!==o.relativeToV,s=n?hl(e.horizontalPoints):t.position?.horizontalEmu,l=r?hl(e.verticalPoints):t.position?.verticalEmu;return n&&s===null?{ok:false}:r&&l===null?{ok:false}:{ok:true,value:{...typeof s=="number"?{horizontalEmu:s}:{},...typeof l=="number"?{verticalEmu:l}:{},...i||n||r?{relativeToH:e.relativeToH}:{},...a||n||r?{relativeToV:e.relativeToV}:{}}}}function bl(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function vl(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Ca({open:e,onClose:t,className:o,triggerRef:n}){let r=F(),{t:i}=N(),a=O(ng),s=Pt.useId(),l=Pt.useId(),c=Pt.useId(),d=Pt.useRef(null),f=Pt.useRef(null),u=Pt.useRef(null),g=Pt.useRef(null),[m,p]=Pt.useState(null),[v,y]=Pt.useState(null),x=f.current,h=x?.canCrop===false,b=x?.canResize===false,S=x?.locks.changeAspect===true,C=x?.kind==="anchored"&&x.canMove===true,P=x?.kind==="inline",T=x?.kind==="anchored"&&x.canMove===false;Pt.useEffect(()=>{if(!e){f.current=null,u.current=null,g.current=null;return}if(!a)return;if(f.current=a,r?.surface){let{anchor:$}=r.surface.state().selection;u.current={paragraphId:$.paragraphId,offset:$.offset},g.current=r.surface.session.packageRevision();}y(null);let w=Nd(a),I=a.crop;p({widthPoints:String(Ho(a.widthEmu)),heightPoints:String(Ho(a.heightEmu)),cropLeft:String(I.left),cropTop:String(I.top),cropRight:String(I.right),cropBottom:String(I.bottom),title:a.title,description:a.description,hyperlink:a.hyperlink??"",wrap:a.wrap,lockAspect:a.locks.changeAspect,...w});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let R=Pt.useCallback(()=>{n?.current?.focus(),r?.focus();},[r,n]),M=Pt.useCallback(()=>{t(),R();},[t,R]);Pt.useEffect(()=>{if(!e)return;let w=d.current;if(!w)return;let I=og(w);(I.find(ee=>ee.id==="image-prop-width"&&!ee.hasAttribute("disabled"))??I.find(ee=>!ee.hasAttribute("disabled"))??w).focus();let W=ee=>{if(ee.key==="Escape"){ee.preventDefault(),M();return}if(ee.key!=="Tab")return;let V=og(w);if(V.length===0)return;let se=document.activeElement,U=V.findIndex(pe=>pe===se);if(U===-1)return;ee.preventDefault();let ce=ee.shiftKey?(U-1+V.length)%V.length:(U+1)%V.length;V[ce]?.focus();};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[e,M]);let E=Pt.useMemo(()=>{let w=x??a;return !w||w.widthEmu<=0?1:w.widthEmu/w.heightEmu},[a,x]),_=Pt.useCallback(w=>{p(I=>{if(!I)return I;if(!I.lockAspect)return {...I,widthPoints:w};let $=vl(w);if($===null)return {...I,widthPoints:w};let W=Math.round($/E*100)/100;return {...I,widthPoints:w,heightPoints:String(W)}});},[E]),H=Pt.useCallback(w=>{p(I=>{if(!I)return I;if(!I.lockAspect)return {...I,heightPoints:w};let $=vl(w);if($===null)return {...I,heightPoints:w};let W=Math.round($*E*100)/100;return {...I,widthPoints:String(W),heightPoints:w}});},[E]),L=Pt.useCallback(()=>{let w=f.current;if(!w?.intrinsic)return;let I=w.intrinsic.pixelWidth*72/w.intrinsic.dpiX,$=w.intrinsic.pixelHeight*72/w.intrinsic.dpiY;p(W=>W&&{...W,widthPoints:String(Math.round(I*100)/100),heightPoints:String(Math.round($*100)/100)});},[a]),k=Pt.useCallback(()=>{let w=f.current,I=u.current,$=g.current;if(!r||!w||!m||!I||$===null)return;let W={type:"setImageProperties",drawingNodeId:w.id,expectedPackageRevision:$,selectionParagraphId:I.paragraphId,selectionOffset:I.offset};if(!b){let pe=vl(m.widthPoints),K=vl(m.heightPoints);if(pe===null||K===null){y("imageProperties.errors.invalidDimensions");return}let Z=ia(pe),be=ia(K);Z!==w.widthEmu&&(W.widthEmu=Z),be!==w.heightEmu&&(W.heightEmu=be);}if(w.canCrop&&!h){let pe=bl(m.cropLeft),K=bl(m.cropTop),Z=bl(m.cropRight),be=bl(m.cropBottom);if(pe===null||K===null||Z===null||be===null){y("imageProperties.errors.invalidCrop");return}let Re=w.crop;(pe!==Re.left||K!==Re.top||Z!==Re.right||be!==Re.bottom)&&(W.crop={left:pe,top:K,right:Z,bottom:be});}m.title!==w.title&&(W.title=m.title),m.description!==w.description&&(W.description=m.description);let ee=m.hyperlink.trim();if(ee!==(w.hyperlink??"")&&(W.hyperlink=ee===""?null:ee),w.canChangeWrap&&m.wrap!==w.wrap&&(W.wrap=m.wrap),w.kind==="anchored"&&w.canMove&&XP(m,w)){let pe=JP(m,w);if(!pe.ok){y("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(pe.value,w))){y("imageProperties.errors.invalidPosition");return}Object.assign(W,pe.value);}if(!(W.widthEmu!==void 0||W.heightEmu!==void 0||W.title!==void 0||W.description!==void 0||W.hyperlink!==void 0||W.crop!==void 0||W.wrap!==void 0||W.horizontalEmu!==void 0||W.verticalEmu!==void 0||W.relativeToH!==void 0||W.relativeToV!==void 0)){M();return}if(!r.can(W).ok){y("imageProperties.errors.refused");return}if(!r.exec(W).ok){y("imageProperties.errors.refused");return}M();},[r,m,h,b,M]);return !e||!m?null:jsxRuntime.jsx("div",{ref:jP,className:`docx-dialog-overlay${o?` ${o}`:""}`,onClick:M,onMouseDown:w=>{w.stopPropagation(),YP(w);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","data-docx-modal":"","aria-labelledby":s,className:"docx-dialog docx-image-properties-dialog",onClick:w=>w.stopPropagation(),onMouseDown:w=>w.stopPropagation(),children:[jsxRuntime.jsx("div",{id:s,className:"docx-dialog__header",children:i("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[v?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:i(v)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:i("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:m.widthPoints,disabled:b,onChange:w=>_(w.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:i("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:m.heightPoints,disabled:b,onChange:w=>H(w.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:m.lockAspect,disabled:S,onChange:w=>p(I=>I&&{...I,lockAspect:w.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:h||!x?.intrinsic,onClick:L,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),P?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,T?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:i("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:m.relativeToH??"page",onChange:w=>p(I=>I&&{...I,relativeToH:w.target.value}),children:editor.DRAWING_REL_FROM_H.map(w=>jsxRuntime.jsx("option",{value:w,children:i(`dialogs.imagePosition.relativeOptions.${w}`)},w))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:i("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:m.relativeToV??"line",onChange:w=>p(I=>I&&{...I,relativeToV:w.target.value}),children:editor.DRAWING_REL_FROM_V.map(w=>jsxRuntime.jsx("option",{value:w,children:i(`dialogs.imagePosition.relativeOptions.${w}`)},w))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:i("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:m.horizontalPoints,onChange:w=>p(I=>I&&{...I,horizontalPoints:w.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:i("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:m.verticalPoints,onChange:w=>p(I=>I&&{...I,verticalPoints:w.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:i("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:m.title,onChange:w=>p(I=>I&&{...I,title:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:i("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:m.description,onChange:w=>p(I=>I&&{...I,description:w.target.value}),placeholder:i("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:i("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:c,className:"docx-dialog__input docx-dialog__input--full",value:m.hyperlink,onChange:w=>p(I=>I&&{...I,hyperlink:w.target.value}),placeholder:i("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:l,children:i("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:l,className:"docx-dialog__select docx-dialog__input--full",value:m.wrap,disabled:x?.canChangeWrap===false,onChange:w=>p(I=>I&&{...I,wrap:w.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(w=>jsxRuntime.jsx("option",{value:w,children:i(`imageWrap.targets.${w}`)},w))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:i("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:h,value:m.cropLeft,onChange:w=>p(I=>I&&{...I,cropLeft:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:i("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:h,value:m.cropTop,onChange:w=>p(I=>I&&{...I,cropTop:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:i("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:h,value:m.cropRight,onChange:w=>p(I=>I&&{...I,cropRight:w.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:i("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:h,value:m.cropBottom,onChange:w=>p(I=>I&&{...I,cropBottom:w.target.value})})]}),h?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:M,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:k,children:i("common.apply")})]})]})})}function yl({className:e,hidden:t,asChild:o,children:n}){let r=Zt(),i=F(),{t:a}=N(),s=O(ng),[l,c]=Pt.useState(false),d=Pt.useRef(null),f={type:"setImageProperties",description:"probe"},u=i&&s?i.can(f):null,g=u?.ok===true,m=u&&!u.ok?u.reason:null;if(t)return null;let p=J("image.properties"),v={type:"button",ref:d,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!g,...g?{}:{"data-disabled":""},"aria-label":a("formattingBar.imagePropertiesShortcut"),title:m??a("formattingBar.imagePropertiesShortcut"),onMouseDown:B,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o?jsxRuntime.jsx(j,{...v,children:n}):jsxRuntime.jsx("button",{...v,children:n??re(p?.paths)}),l&&r?.imageProperties!==false?r?.imageProperties?De(r.imageProperties,{open:l,onClose:()=>c(false),triggerRef:d}):jsxRuntime.jsx(Ca,{open:l,onClose:()=>c(false),triggerRef:d}):null]})}yl.docxSlot="image.properties";var Cr=Object.assign(yl,{docxSlot:"image.properties"});function Ta(e){let t=F(),o=Pt.useCallback(()=>editor.toolbarCommandState(t,e),[t,e]),n=O(o,(r,i)=>r.value===i.value&&r.enabled===i.enabled&&r.disabledReason===i.disabledReason);return Pt.useMemo(()=>({execute:(r,i)=>editor.runToolbarCommand(t,e,r,i),value:n.value===void 0?null:e==="font.size"||e==="list.lineSpacing"?Number(n.value):n.value,options:e==="image.wrap"?editor.IMAGE_WRAP_TARGETS:[],isEnabled:n.enabled,disabledReason:n.disabledReason}),[t,e,n])}function xl({className:e,hidden:t,asChild:o,children:n}){let r=Zt(),i=X(),{execute:a,value:s,isEnabled:l,disabledReason:c}=Ta("image.altText"),[d,f]=Pt.useState(false),[u,g]=Pt.useState(""),m=Pt.useRef(null),p=Pt.useRef(null),v=Pt.useId();Pt.useEffect(()=>{d&&g(s??"");},[d,s]),Pt.useEffect(()=>{if(!d)return;let C=T=>{let R=m.current;T.target instanceof Node&&(R?.contains(T.target)||R?.ownerDocument.getElementById(v)?.contains(T.target))||f(false);},P=T=>{T.key==="Escape"&&(T.preventDefault(),f(false),p.current?.focus());};return document.addEventListener("mousedown",C,true),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C,true),document.removeEventListener("keydown",P);}},[d,v]);let y=Pt.useCallback(()=>{a(u),f(false);},[u,a]);if(t)return null;let x=J("image.altText"),h=i(x?.labelKey??"formattingBar.altText"),b={type:"button",ref:p,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!l,...l?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?v:void 0,"aria-label":h,title:c??h,onMouseDown:B,onClick:()=>f(C=>!C)},S={id:v,value:u,onValueChange:g,onApply:y,onClose:()=>f(false),isEnabled:l,anchorRef:p};return jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__alt-text",children:[o?jsxRuntime.jsx(j,{...b,children:n}):jsxRuntime.jsx("button",{...b,children:n??h}),d&&r?.imageAltText!==false?r?.imageAltText?De(r.imageAltText,S):jsxRuntime.jsx(Cl,{...S}):null]})}xl.docxSlot="image.altText";var Pa=Object.assign(xl,{docxSlot:"image.altText"});function Cl({id:e,value:t,onValueChange:o,onApply:n,onClose:r,isEnabled:i,className:a}){let{t:s}=N();return jsxRuntime.jsxs("div",{id:e,role:"dialog","aria-label":s("imageAltText.panelTitle"),className:`docx-toolbar__alt-text-panel${a?` ${a}`:""}`,onMouseDown:l=>l.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${e}-description`,children:s("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${e}-description`,className:"docx-dialog__textarea",value:t,onChange:l=>o(l.target.value),placeholder:s("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:s("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",disabled:!i,onClick:n,children:s("common.apply")})]})]})}var lg=Pt.createContext(void 0),sg=lg.Provider;function Ue(){let e=Pt.useContext(lg),{t}=N();return Pt.useCallback((o,n)=>{let r=e?.(o,n);return r===void 0||r===o?t(o,n):r},[e,t])}function Hd(e){let[t,o]=Pt.useState(e.session),[n,r]=Pt.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(uS,{...e},n)}function uS({session:e,className:t,style:o,children:n}){let r=Ue(),[i,a]=Pt.useState(e.signal.aborted),s=Pt.useRef(null);return Pt.useEffect(()=>{let l=()=>a(true);return e.signal.addEventListener("abort",l,{once:true}),e.signal.aborted&&l(),()=>e.signal.removeEventListener("abort",l)},[e]),i?null:jsxRuntime.jsx(pt,{kind:"invalidTextFormField",role:"alertdialog",label:r("textFormField.invalidTitle"),className:t,style:o,panelRef:s,dismissOutside:false,onClose:e.acknowledge,sessionSignal:e.signal,restoreFocus:false,onKeyDown:l=>{l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),e.acknowledge());},children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("header",{className:"docx-dialog__header",children:jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:r("textFormField.invalidTitle")})}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:r(e.type==="number"?"textFormField.invalidNumber":"textFormField.invalidDate")}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:e.acknowledge,children:r("textFormField.apply")})})]})})}var ug=Pt.createContext(null),pg=ug.Provider;function Qe(){let e=Pt.useContext(ug);if(!e)throw new globalThis.Error("useContentControlWidget must be rendered inside DocxEditorContentControlWidget.");return e}function PS(e){return e.kind==="date"?editor.parseIsoDate(e.value)?e.value.slice(0,10):"":e.value}function mg(e){let t=`docx-cc-list-${Pt.useId()}`,[o,n]=Pt.useState(()=>PS(e)),[r,i]=Pt.useState(()=>editor.calendarDateText(e.value,e.locale)),a=Pt.useMemo(()=>editor.createContentControlListNavigation(e.locale),[e]),[s,l]=Pt.useState(false),c=Pt.useCallback(E=>{i(E),l(false);},[]),d=O(()=>e.canApply()),f=e.kind==="date"?editor.parseIsoDate(e.value):null,[u,g]=Pt.useState(()=>{let E=f??new Date;return {year:E.getFullYear(),month:E.getMonth()}}),m=Pt.useCallback(E=>{let _=e.apply(E??o);return l(!_),_},[e,o]),p=Pt.useCallback(()=>e.cancel(),[e]),v=Pt.useCallback(async E=>{if(!e.replaceImage)return l(true),false;try{let _=E instanceof Uint8Array?E.byteLength:E.size;if(!e.canApply()||_>store.DEFAULT_IMAGE_RESOURCE_LIMITS.maxEncodedBytes)return l(!0),!1;let H=E instanceof Uint8Array?E:new Uint8Array(await E.arrayBuffer()),L=await e.replaceImage(H);return l(!L),L}catch{return l(true),false}},[e]),y=Pt.useMemo(()=>editor.calendarMonth(u.year,u.month,{locale:e.locale,selected:e.kind==="date"?e.value:null}),[u,e]),x=Pt.useCallback(()=>{g(E=>editor.shiftMonth(E.year,E.month,-1)),P(null);},[]),h=Pt.useCallback(()=>{g(E=>editor.shiftMonth(E.year,E.month,1)),P(null);},[]),b=Pt.useCallback(E=>m(E),[m]),S=Pt.useCallback(()=>m(editor.isoDateOf(new Date)),[m]),[C,P]=Pt.useState(null),T=Pt.useCallback(E=>{let _=editor.parseIsoDate(E);_&&(g({year:_.getFullYear(),month:_.getMonth()}),P(editor.isoDateOf(_)));},[]),R=Pt.useCallback(()=>{let E=editor.calendarDateFromText(r,e.locale);return E?m(E):(l(true),false)},[r,e.locale,m]),M=Pt.useCallback((E,_)=>{!Number.isInteger(E)||E<100||E>9999||!Number.isInteger(_)||_<0||_>11||(g({year:E,month:_}),P(null));},[]);return Pt.useMemo(()=>({session:e,kind:e.kind,items:e.items,value:o,setValue:n,isEnabled:d,refused:s,apply:m,cancel:p,calendar:y,previousMonth:x,nextMonth:h,selectDay:b,selectToday:S,focusIso:C,focusDay:T,dateText:r,setDateText:c,applyDateText:R,showMonth:M,listNavigation:a,listId:t,accept:editor.CONTENT_CONTROL_PICTURE_ACCEPT,replaceImage:v}),[e,v,o,d,s,m,p,y,x,h,b,S,C,T,r,c,R,M,a,t])}function Ve(e,t,o,n){if(t.hidden)return null;let{children:r,asChild:i,className:a,style:s,hidden:l,id:c,title:d,"aria-label":f,...u}=t,g=r===void 0?n:r,{key:m,...p}=o,v={...c!==void 0?{id:c}:{},...d!==void 0?{title:d}:{},...f!==void 0?{"aria-label":f}:{}};if(i){let{className:x,style:h,...b}=p;return jsxRuntime.jsx(j,{...u,...b,...v,...a?{className:a}:{},style:{...h,...s},children:g},m)}return jsxRuntime.jsx(e,{...u,...p,...v,className:[o.className,a].filter(Boolean).join(" "),style:{...o.style,...s},children:g},m)}var Cn=e=>e.stopPropagation();function Zd(e){return Ve("div",e,{className:"docx-content-control-calendar-header","data-docx-part":"header"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qd,{}),jsxRuntime.jsx(Xd,{}),jsxRuntime.jsx(Kd,{}),jsxRuntime.jsx(Wd,{className:"docx-content-control-calendar-announcement"})]}))}function qd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"previousMonth","aria-label":o("contentControl.calendar.previousMonth"),onMouseDown:Cn,onClick:t.previousMonth},"\u2039")}function Kd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"nextMonth","aria-label":o("contentControl.calendar.nextMonth"),onMouseDown:Cn,onClick:t.nextMonth},"\u203A")}function Wd(e){let t=Qe();return Ve("div",e,{className:"docx-content-control-calendar-title","data-docx-part":"title","aria-live":"polite"},t.calendar.title)}function zd(e){let t=Qe();return Ve("div",e,{className:"docx-content-control-calendar-weekdays","data-docx-part":"weekdays"},t.calendar.weekdays.map((o,n)=>jsxRuntime.jsx("span",{children:o},n)))}function $d({day:e,...t}){let o=Qe(),n=o.calendar.days.find(i=>i.iso===o.focusIso)??o.calendar.days.find(i=>i.selected)??o.calendar.days.find(i=>i.today&&!i.otherMonth)??o.calendar.days.find(i=>!i.otherMonth),r=i=>{if(i.nativeEvent.isComposing||i.altKey||i.ctrlKey||i.metaKey)return;let a=editor.calendarDateForKey(e.iso,i.key,o.session.locale,i.shiftKey);a&&(i.preventDefault(),o.focusDay(a));};return Ve("button",t,{type:"button",className:"docx-content-control-calendar-day","data-docx-part":"day","data-iso":e.iso,role:"gridcell",tabIndex:e.iso===n?.iso?0:-1,"aria-label":e.label,...e.selected?{"data-selected":"","aria-selected":true}:{},"aria-current":e.today?"date":void 0,"aria-selected":e.selected,...e.today?{"data-today":""}:{},...e.otherMonth?{"data-other-month":""}:{},disabled:!o.isEnabled,onMouseDown:Cn,onClick:()=>o.selectDay(e.iso),onKeyDown:r},String(e.day))}function Ud(e){let t=Qe(),o=Pt.useRef(null);return Pt.useLayoutEffect(()=>{let n=o.current;if(!n||n.ownerDocument.activeElement?.closest("[data-docx-part=previousMonth],[data-docx-part=nextMonth],[data-docx-part=month],[data-docx-part=year]"))return;((t.focusIso?n.querySelector(`[data-iso="${t.focusIso}"]`):null)??n.querySelector("[data-selected]")??n.querySelector("[data-today]:not([data-other-month])")??n.querySelector('[data-docx-part="day"]:not([data-other-month])'))?.focus({preventScroll:true});},[t.focusIso,t.calendar]),Ve("div",e,{ref:o,className:"docx-content-control-calendar-grid","data-docx-part":"grid",role:"grid","aria-label":t.calendar.title},Array.from({length:6},(n,r)=>jsxRuntime.jsx("div",{role:"row",className:"docx-content-control-calendar-week",children:t.calendar.days.slice(r*7,r*7+7).map(i=>jsxRuntime.jsx($d,{day:i},i.iso))},r)))}function Vd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-today","data-docx-part":"today",disabled:!t.isEnabled,onMouseDown:Cn,onClick:t.selectToday},o("contentControl.calendar.today"))}function Gd(e){return Ve("div",e,{className:"docx-content-control-calendar","data-docx-part":"calendar"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Zd,{}),jsxRuntime.jsx(zd,{}),jsxRuntime.jsx(Ud,{}),jsxRuntime.jsxs("div",{className:"docx-content-control-calendar-entry","data-docx-part":"dateEntry",children:[jsxRuntime.jsx(Vd,{}),jsxRuntime.jsx(Pl,{})]}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(El,{})]}))}function jd({item:e,...t}){let o=Qe();return Ve("button",t,{type:"button",className:"docx-content-control-menu-item","data-docx-part":"item","data-value":e.value,role:"option",tabIndex:o.items.findIndex(n=>n.value===o.value)<0?o.items[0]===e?0:-1:o.value===e.value?0:-1,"aria-selected":o.value===e.value,disabled:!o.isEnabled,onMouseDown:Cn,onClick:()=>o.apply(e.value)},e.displayText)}function Tl(e){let t=Qe(),o=Ue();return Ve("div",e,{className:"docx-content-control-menu-list","data-docx-part":"list",role:"listbox",id:t.listId,"aria-label":o(`contentControl.types.${t.kind}`)},t.kind==="buildingBlockGallery"&&t.items.length===0?jsxRuntime.jsx("div",{className:"docx-content-control-menu-empty","data-docx-part":"empty",role:"note",tabIndex:0,children:o("contentControl.gallery.empty")}):t.items.map((n,r)=>jsxRuntime.jsx(jd,{item:n},r)))}function Pl(e){let t=Qe(),o=Ue();return Ve("input",e,{type:"text",className:"docx-content-control-menu-input","data-docx-part":"input","aria-label":o(`contentControl.types.${t.kind}`),value:t.kind==="date"?t.dateText:t.value,placeholder:t.kind==="date"?editor.calendarDateText("2006-11-22",t.session.locale):void 0,"aria-invalid":t.refused||void 0,role:t.kind==="comboBox"?"combobox":void 0,"aria-expanded":t.kind==="comboBox"?true:void 0,"aria-controls":t.kind==="comboBox"?t.listId:void 0,"aria-autocomplete":t.kind==="comboBox"?"list":void 0,onKeyDown:n=>{n.key!=="Enter"||n.nativeEvent.isComposing||(n.preventDefault(),n.stopPropagation(),t.kind==="date"?t.applyDateText():t.apply());},onMouseDown:Cn,onChange:n=>(t.kind==="date"?t.setDateText:t.setValue)(n.target.value)},void 0)}function Tr(e){let t=Qe(),o=Ue();return t.refused?Ve("div",e,{className:"docx-content-control-widget-error","data-docx-part":"error",role:"alert"},o("disabledReason.invalidValue")):null}function Yd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-dialog__button docx-dialog__button--primary","data-docx-part":"apply",disabled:!t.isEnabled,onClick:()=>t.kind==="date"?t.applyDateText():t.apply()},o("common.apply"))}function Sl(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t.cancel},o("common.cancel"))}function El(e){return Ve("div",e,{className:"docx-dialog__footer","data-docx-part":"footer"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sl,{}),jsxRuntime.jsx(Yd,{})]}))}function Xd(e){return Ve("div",e,{className:"docx-content-control-calendar-navigation","data-docx-part":"navigation"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jd,{}),jsxRuntime.jsx(Qd,{})]}))}function Jd(e){let t=Qe(),o=Ue();return Ve("select",e,{className:"docx-content-control-calendar-month","data-docx-part":"month","aria-label":o("contentControl.calendar.month"),value:t.calendar.month,onChange:n=>t.showMonth(t.calendar.year,Number(n.target.value))},editor.calendarMonthNames(t.session.locale).map((n,r)=>jsxRuntime.jsx("option",{value:r,children:n},r)))}function Qd(e){let t=Qe(),o=Ue();return Ve("input",e,{type:"number",min:100,max:9999,className:"docx-content-control-calendar-year","data-docx-part":"year","aria-label":o("contentControl.calendar.year"),key:t.calendar.year,defaultValue:t.calendar.year,onBlur:n=>{let r=Number(n.target.value);if(!Number.isInteger(r)||r<100||r>9999){n.target.value=String(t.calendar.year);return}t.showMonth(r,t.calendar.month);},onKeyDown:n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&(n.preventDefault(),n.currentTarget.blur());}},void 0)}function eu({autoOpen:e,...t}){let o=Qe(),n=Ue(),r=Pt.useRef(null),i=Pt.useRef(false);return Pt.useLayoutEffect(()=>{e!==false&&!i.current&&(i.current=true,r.current?.click());},[e]),Ve("input",t,{ref:r,type:"file",accept:o.accept,className:"docx-content-control-picture-input","data-docx-part":"picture","aria-label":n("contentControl.types.picture"),"aria-invalid":o.refused||void 0,onMouseDown:Cn,onCancel:o.cancel,onChange:a=>{let s=a.target.files?.[0];a.target.value="",s&&o.replaceImage(s);}},void 0)}function _S(e){let[t,o]=Pt.useState(e.session),[n,r]=Pt.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(NS,{...e},n)}function NS({session:e,className:t,style:o,children:n}){let r=Ue(),i=mg(e),[a,s]=Pt.useState(e.signal.aborted),l=Pt.useRef(null),[c]=Pt.useState(()=>editor.contentControlPopupOpener(e.anchor)),d=e.kind==="checkbox"&&n===void 0;if(Pt.useEffect(()=>{let u=()=>s(true);return e.signal.addEventListener("abort",u,{once:true}),e.signal.aborted&&u(),()=>e.signal.removeEventListener("abort",u)},[e]),Pt.useEffect(()=>{!d||e.signal.aborted||e.apply(e.value==="true"?"false":"true");},[d,e]),Pt.useLayoutEffect(()=>{if(a||d)return;let u=l.current,g=u?.ownerDocument,m=u&&e.anchor?editor.observeContentControlPopup(u,e.anchor):void 0;return u?.querySelector('[data-docx-part="grid"]')||(u?.querySelector("input")??u?.querySelector('[role=option][tabindex="0"]')??u?.querySelector("select,button,[data-docx-part=empty]"))?.focus({preventScroll:true}),()=>{m?.();let p=g?.activeElement;c?.isConnected&&(p===g?.body||p&&u?.contains(p))&&c.focus({preventScroll:true});}},[e,a,d,c]),Pt.useEffect(()=>{let u=l.current;if(!u||a||d)return;let g=m=>{u.contains(m.target)||e.cancel();};return u.ownerDocument.addEventListener("pointerdown",g,true),()=>u.ownerDocument.removeEventListener("pointerdown",g,true)},[e,a,d]),a||d)return null;let f=r(`contentControl.types.${e.kind}`);return jsxRuntime.jsx(pg,{value:i,children:jsxRuntime.jsx("div",{ref:l,role:"dialog","aria-label":f,className:`docx-content-control-widget-popup${t?` ${t}`:""}`,style:o,"data-docx-popup":"contentControlWidget","data-docx-part":"popup","data-kind":e.kind,onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{editor.contentControlPopupKeyDown(u.currentTarget,u.nativeEvent,e.cancel),i.listNavigation.keyDown(u.nativeEvent,u.currentTarget);},children:n??LS(i)})})}function LS(e){return e.kind==="date"?jsxRuntime.jsx(Gd,{}):e.kind==="picture"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eu,{}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(Sl,{})]}):e.kind==="comboBox"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pl,{}),jsxRuntime.jsx(Tl,{}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(El,{})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tl,{}),jsxRuntime.jsx(Tr,{})]})}var ru=Object.assign(_S,{Navigation:Xd,Month:Jd,Year:Qd,Calendar:Gd,Header:Zd,PreviousMonth:qd,Title:Wd,NextMonth:Kd,Weekdays:zd,Grid:Ud,Day:$d,Today:Vd,List:Tl,Item:jd,Input:Pl,Picture:eu,Error:Tr,Footer:El,Apply:Yd,Cancel:Sl});var eo=Do();function HS(){return eo.useState()}function AS({session:e,...t}){let[o,n]=Pt.useState(e),[r,i]=Pt.useState(0);return o!==e&&(n(e),i(r+1)),e?jsxRuntime.jsx(OS,{session:e,...t},r):null}function OS({session:e,children:t,preset:o,className:n,style:r}){let i=Ue(),a=O(()=>e.canApply()),[s,l]=Pt.useState(()=>({defaultText:e.field.defaultText,type:e.field.type,maxLength:e.field.maxLength,format:e.field.format,enabled:e.field.enabled})),[c,d]=Pt.useState(e.signal.aborted),[f,u]=Pt.useState(false);Pt.useEffect(()=>{let x=()=>d(true);return e.signal.addEventListener("abort",x),e.signal.aborted&&x(),()=>e.signal.removeEventListener("abort",x)},[e]);let g=()=>{if(e.signal.aborted)return;let x=Number.isInteger(s.maxLength)&&s.maxLength>=0&&s.maxLength<=32767&&e.apply(s.defaultText,{type:s.type,maxLength:s.maxLength,format:s.format,enabled:s.enabled});u(!x);},m={values:s,setValue(x,h){l(b=>({...b,[x]:h,...x==="type"?{format:""}:{}})),u(false);},errors:f?{form:i("textFormField.invalidOptions")}:{},isEnabled:!c&&a,apply:g,cancel:e.cancel};if(c)return null;let p=editor.TEXT_FORM_FORMATS[s.type]??[],v={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"},y=(x,h)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":x,className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label",children:i(`textFormField.${x}`)}),h]});return jsxRuntime.jsx(pt,{kind:"textFormField",className:n,style:r,label:i("textFormField.title"),onClose:e.cancel,dismissOutside:false,sessionSignal:e.signal,restoreFocus:false,onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),e.cancel()),x.key==="Enter"&&x.target instanceof HTMLInputElement&&(x.preventDefault(),g());},children:jsxRuntime.jsx(eo.Composition,{state:m,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:i("textFormField.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[y("defaultText",jsxRuntime.jsx("input",{className:"docx-dialog__input",value:s.defaultText,onChange:x=>m.setValue("defaultText",x.target.value)})),y("type",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:s.type,onChange:x=>m.setValue("type",x.target.value),children:[["regular","number","date"].map(x=>jsxRuntime.jsx("option",{value:x,children:i(`textFormField.${x}`)},x)),Object.hasOwn(editor.TEXT_FORM_FORMATS,s.type)?null:jsxRuntime.jsx("option",{value:s.type,disabled:true,children:i("textFormField.preservedType")})]})),y("maxLength",jsxRuntime.jsx("input",{className:"docx-dialog__input",type:"number",min:0,max:32767,step:1,value:Number.isNaN(s.maxLength)?"":s.maxLength,onChange:x=>m.setValue("maxLength",x.target.valueAsNumber)})),y("format",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:s.format,onChange:x=>m.setValue("format",x.target.value),children:[p.map(x=>jsxRuntime.jsx("option",{value:x,children:v[x]?i(v[x]):x||i("textFormField.noFormat")},x)),p.includes(s.format)?null:jsxRuntime.jsx("option",{value:s.format,disabled:true,children:s.format||i("textFormField.noFormat")})]})),jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":"enabled",className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:s.enabled,onChange:x=>m.setValue("enabled",x.target.checked)}),i("textFormField.enabled")]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",className:"docx-dialog__error",role:"alert",children:m.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",className:"docx-dialog__button",type:"button",onClick:e.cancel,children:i("textFormField.cancel")}),jsxRuntime.jsx("button",{disabled:!a,"data-docx-part":"apply",className:"docx-dialog__button docx-dialog__apply",type:"button",onClick:g,children:i("textFormField.apply")})]})]}),children:t})})}var Ma=Object.assign(AS,{Header:eo.Header,Title:eo.Title,Body:eo.Body,Footer:eo.Footer,Apply:eo.Apply,Cancel:eo.Cancel,Error:eo.Error,Field:eo.Field});var hg="(prefers-color-scheme: dark)";function bg(){return typeof window<"u"&&typeof window.matchMedia=="function"}function vg(){return bg()?window.matchMedia(hg).matches:false}function yg(e,t){return e==="dark"||e==="system"&&t}function xg(e){if(!bg())return ()=>{};let t=window.matchMedia(hg);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}function iu(e){return e==="checkbox"?"contentControlCheckbox":e==="picture"?"contentControlPicture":"contentControlWidget"}function Tg(){let e=F(),t=Zt(),o=Pt.useRef(t);o.current=t;let[n,r]=Pt.useState(null),[i,a]=Pt.useState(null),s=t?.contentControlWidget!==void 0,l=t?.contentControlCheckbox!==void 0,c=t?.contentControlPicture!==void 0,d=t?.invalidTextFormField!==void 0;Pt.useEffect(()=>{if(!e||!s&&!l&&!c)return;let u=true,g=[...s?["dropdown","comboBox","date","buildingBlockGallery"]:[],...l?["checkbox"]:[],...c?["picture"]:[]],m=e.setContentControlWidgetChrome({kinds:g,onRequest(p){if(o.current?.[iu(p.kind)]===false)return p.cancel();r(p),p.signal.addEventListener("abort",()=>{u&&r(v=>v===p?null:v);},{once:true});}},{fallback:true});return ()=>{u=false,m(),r(null);}},[e,s,l,c]),Pt.useEffect(()=>{if(!e||!d)return;let u=true,g=e.setInvalidTextFormFieldChrome({onRequest(m){if(o.current?.invalidTextFormField===false)return m.cancel();a(m),m.signal.addEventListener("abort",()=>{u&&a(p=>p===m?null:p);},{once:true});}},{fallback:true});return ()=>{u=false,g(),a(null);}},[e,d]),Pt.useEffect(()=>{n&&t?.[iu(n.kind)]===false&&n.cancel(),t?.invalidTextFormField===false&&i?.cancel();},[t,n,i]);let f=n?t?.[iu(n.kind)]:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n&&f&&De(f,{session:n},n),i&&t?.invalidTextFormField&&De(t.invalidTextFormField,{session:i},i)]})}var zS=e=>e.pageSetup??null,$S=e=>e.editable;function Pn(){let e=F(),t=O(zS),o=O($S),n=Pt.useMemo(()=>o&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,o]),r=Pt.useCallback(i=>e?e.exec({...i.pageWidthTwips!==void 0?{pageWidth:i.pageWidthTwips}:{},...i.pageHeightTwips!==void 0?{pageHeight:i.pageHeightTwips}:{},...i.orientation!==void 0?{orientation:i.orientation}:{},...i.marginTopTwips!==void 0?{marginTop:i.marginTopTwips}:{},...i.marginRightTwips!==void 0?{marginRight:i.marginRightTwips}:{},...i.marginBottomTwips!==void 0?{marginBottom:i.marginBottomTwips}:{},...i.marginLeftTwips!==void 0?{marginLeft:i.marginLeftTwips}:{},...i.scope!==void 0?{scope:i.scope}:{},type:"setPageSetup"}).ok:false,[e]);return Pt.useMemo(()=>({pageSetup:t,isEnabled:n,apply:r}),[t,n,r])}var su=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}],Mg=1440,VS=e=>Math.round(e/Mg*100)/100,GS=e=>Math.round(e*Mg);function jS(e,t){let o=Math.min(e,t),n=Math.max(e,t);return su.findIndex(r=>Math.abs(r.width-o)<20&&Math.abs(r.height-n)<20)}var Eg=12240,wg=15840,Bo=1440;function YS({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),s=Ai(e,t),{pageSetup:l,isEnabled:c,apply:d}=Pn(),[f,u]=Pt.useState(Eg),[g,m]=Pt.useState(wg),[p,v]=Pt.useState("portrait"),[y,x]=Pt.useState(Bo),[h,b]=Pt.useState(Bo),[S,C]=Pt.useState(Bo),[P,T]=Pt.useState(Bo),[R,M]=Pt.useState(false),[E,_]=Pt.useState("document"),H=Pt.useRef(null),L=Pt.useRef("no");Pt.useEffect(()=>{if(!e){L.current="no";return}if(L.current==="yes"&&l===null){L.current="no";return}L.current==="yes"||L.current==="loading"&&l===null||(M(false),u(l?.pageWidthTwips??Eg),m(l?.pageHeightTwips??wg),v(l?.orientation??"portrait"),x(l?.marginsTwips.top??Bo),b(l?.marginsTwips.bottom??Bo),C(l?.marginsTwips.left??Bo),T(l?.marginsTwips.right??Bo),_("document"),L.current=l===null?"loading":"yes");},[e,l]);let k=Pt.useCallback(U=>{let ce=su[U];ce&&(u(p==="landscape"?ce.height:ce.width),m(p==="landscape"?ce.width:ce.height));},[p]),w=Pt.useCallback(U=>{U!==p&&(v(U),u(g),m(f));},[p,f,g]),I=Pt.useCallback(()=>{if(!c)return;if(!s()){t();return}let U=d({pageWidthTwips:f,pageHeightTwips:g,orientation:p,marginTopTwips:y,marginRightTwips:P,marginBottomTwips:h,marginLeftTwips:S,scope:E});M(!U),U&&t();},[c,s,d,f,g,p,y,P,h,S,E,t]);if(!e)return null;let $=jS(f,g),W=(U,ce,pe)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":`margin${U[0].toUpperCase()}${U.slice(1)}`,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a(`dialogs.pageSetup.${U}`)}),jsxRuntime.jsx("input",{type:"number",className:"docx-dialog__input",min:0,max:22,step:.1,value:VS(ce),onChange:K=>pe(Math.max(0,GS(Number(K.target.value)||0))),"aria-label":a(`dialogs.pageSetup.${U}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:"in"})]}),ee={pageWidth:f,pageHeight:g,orientation:p,marginTop:y,marginBottom:h,marginLeft:S,marginRight:P,scope:E},V={pageWidth:u,pageHeight:m,orientation:w,marginTop:x,marginBottom:b,marginLeft:C,marginRight:T,scope:_},se={values:ee,setValue(U,ce){V[U](ce);},errors:R?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:I,cancel:t};return jsxRuntime.jsx(pt,{kind:"pageSetup",className:o,style:n,panelRef:H,label:a("dialogs.pageSetup.title"),onClose:t,onKeyDown:U=>{U.key==="Escape"&&t(),U.key==="Enter"&&U.target instanceof HTMLInputElement&&c&&(U.preventDefault(),I());},children:jsxRuntime.jsx(oo.Composition,{state:se,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.pageSetup.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"pageSize",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:$,onChange:U=>k(Number(U.target.value)),"aria-label":a("dialogs.pageSetup.sizeLabel"),children:[su.map((U,ce)=>jsxRuntime.jsx("option",{value:ce,children:a(U.labelKey)},U.labelKey)),$<0&&jsxRuntime.jsx("option",{value:-1,children:a("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"orientation",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:p,onChange:U=>w(U.target.value),"aria-label":a("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:a("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:a("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label docx-dialog__section-label--spaced",children:a("dialogs.pageSetup.margins")}),W("top",y,x),W("bottom",h,b),W("left",S,C),W("right",P,T),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"scope",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:E,onChange:U=>_(U.target.value),"aria-label":a("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:a("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:a("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",className:"docx-dialog__error",children:R?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:I,children:a("common.apply")})]})]}),children:r})})}var oo=Do();function XS(){return oo.useState()}var Sn=Object.assign(YS,{Header:oo.Header,Title:oo.Title,Body:oo.Body,Footer:oo.Footer,Apply:oo.Apply,Cancel:oo.Cancel,Error:oo.Error,Field:oo.Field});var tE={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},oE=e=>{let t=e.formatting??null;if(!t)return null;let o=t.indent,n=t.paragraphFlags??tE;return {alignment:t.alignment==="both"?"justify":t.alignment??null,direction:t.direction??null,spaceBeforePt:t.spaceBeforePt??null,spaceAfterPt:t.spaceAfterPt??null,lineSpacing:t.lineSpacing??null,indentLeftTwips:o&&!o.mixed.left?o.left:null,indentRightTwips:o&&!o.mixed.right?o.right:null,indentFirstLineTwips:o&&!o.mixed.firstLine?o.firstLine:null,contextualSpacing:n.contextualSpacing,keepNext:n.keepNext,keepLines:n.keepLines,widowControl:n.widowControl,pageBreakBefore:n.pageBreakBefore,tabStops:t.tabStops??null,indentUnknown:!o,disagrees:{alignment:t.disagrees?.alignment??false,direction:t.disagrees?.direction??false,spaceBeforePt:t.disagrees?.spaceBeforePt??false,spaceAfterPt:t.disagrees?.spaceAfterPt??false,lineSpacing:t.disagrees?.lineSpacing??false,tabStops:t.disagrees?.tabStops??false,indentLeft:o?.mixed.left??false,indentRight:o?.mixed.right??false,indentFirstLine:o?.mixed.firstLine??false}}},nE=["alignment","direction","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],rE=(e,t)=>nE.every(o=>e.disagrees[o]===t.disagrees[o]),aE=(e,t)=>e===null||t===null?e===t:e.alignment===t.alignment&&e.direction===t.direction&&e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value&&e.indentLeftTwips===t.indentLeftTwips&&e.indentRightTwips===t.indentRightTwips&&e.indentFirstLineTwips===t.indentFirstLineTwips&&e.contextualSpacing===t.contextualSpacing&&e.keepNext===t.keepNext&&e.keepLines===t.keepLines&&e.widowControl===t.widowControl&&e.pageBreakBefore===t.pageBreakBefore&&rE(e,t)&&e.indentUnknown===t.indentUnknown&&e.tabStops?.length===t.tabStops?.length&&(e.tabStops??[]).every((o,n)=>o.positionTwips===t.tabStops?.[n]?.positionTwips&&o.alignment===t.tabStops?.[n]?.alignment&&(o.leader??"none")===(t.tabStops?.[n]?.leader??"none")),iE=e=>e.editable;function cu(){let e=F(),t=O(oE,aE),o=O(iE),n=Pt.useMemo(()=>o&&e!==null&&e.can({type:"setParagraphFormat",alignment:"left"}).ok,[e,o]),r=Pt.useCallback(i=>{if(!e)return false;let a={type:"setParagraphFormat",...i};return e.can(a).ok?e.exec(a).ok:false},[e]);return {format:t,isEnabled:n,apply:r}}function cE({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),s=Ai(e,t),{format:l,isEnabled:c,apply:d}=cu(),[f,u]=Pt.useState("left"),[g,m]=Pt.useState("ltr"),[p,v]=Pt.useState(0),[y,x]=Pt.useState(0),[h,b]=Pt.useState("none"),[S,C]=Pt.useState(0),[P,T]=Pt.useState(0),[R,M]=Pt.useState(0),[E,_]=Pt.useState("multiple"),[H,L]=Pt.useState(1.08),[k,w]=Pt.useState(false),[I,$]=Pt.useState(false),[W,ee]=Pt.useState(false),[V,se]=Pt.useState(true),[U,ce]=Pt.useState(false),[pe,K]=Pt.useState([]),[Z,be]=Pt.useState(false),[Re,ue]=Pt.useState(0),[ze,_t]=Pt.useState("left"),[Je,ut]=Pt.useState("none"),[Pe,co]=Pt.useState(editor.NO_MIXED_FIELDS),[uo,po]=Pt.useState(false),Mo=q=>a(uo&&(q==="indentLeft"||q==="indentRight"||q==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),Gt=Pt.useRef(editor.NO_MIXED_FIELDS),oe=Pt.useId(),[fe,yt]=Pt.useState(false),zn=Pt.useRef(null),ne=Pt.useRef(false),te=Pt.useRef(null);Pt.useEffect(()=>{if(!e){ne.current=false;return}if(ne.current||l===null)return;let q=editor.seedFields(l);u(q.alignment),m(q.direction),v(q.indentLeft),x(q.indentRight),b(q.special),C(q.specialBy),T(q.spaceBefore),M(q.spaceAfter),_(q.lineRule),L(q.lineValue),w(q.contextualSpacing),$(q.keepNext),ee(q.keepLines),se(q.widowControl),ce(q.pageBreakBefore),K(q.tabStops),be(false);let he=editor.mixedFieldsOf(l);co(he),po(l.indentUnknown),ue(0),_t("left"),ut("none"),Gt.current=he,yt(false),te.current=q,ne.current=true;},[e,l]);let ve=Pt.useCallback(()=>{if(!c)return;if(!s()){t();return}let q=te.current,he=q===null?null:editor.changedFields(q,{alignment:f,direction:g,indentLeft:p,indentRight:y,special:h,specialBy:S,spaceBefore:P,spaceAfter:R,lineRule:E,lineValue:H,contextualSpacing:k,keepNext:I,keepLines:W,widowControl:V,pageBreakBefore:U,tabStops:pe,clearedAllTabStops:Z},Gt.current,Pe);if(he===null){t();return}if(d(he)){yt(false),t();return}yt(true);},[c,s,d,t,Pe,Z,f,g,p,y,h,S,P,R,E,H,k,I,W,V,U,pe]),$e=Pt.useCallback(()=>{let q=Math.round(Re);return q<=0?false:(co(he=>({...he,tabStops:false})),K(editor.withTabStop(pe,{positionTwips:q,alignment:ze,...Je!=="none"?{leader:Je}:{}})),ue(0),_t("left"),ut("none"),true)},[pe,Re,ze,Je]);if(!e)return null;let Ze=q=>co(he=>({...he,[q]:false})),mo=(q,he,Ro,rt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":rt,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-${q}`,children:a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${oe}-${q}`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Pe[rt]?"":editor.twipsToInches(he),placeholder:Pe[rt]?Mo(rt):void 0,onChange:zr=>{Ze(rt),Ro(editor.inchesToTwips(Number(zr.target.value)||0));},"aria-label":a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),$n=(q,he,Ro,rt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":q,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-${q}`,children:a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${oe}-${q}`,type:"number",className:"docx-dialog__input",min:0,step:1,value:Pe[rt]?"":he,placeholder:Pe[rt]?Mo(rt):void 0,onChange:zr=>{Ze(rt),Ro(Math.max(0,Number(zr.target.value)||0));},"aria-label":a(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitPoints")})]}),Wr=(q,he,Ro)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":q,className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:he,ref:rt=>{rt&&(rt.indeterminate=Pe[q]);},onChange:rt=>{co(zr=>({...zr,[q]:false})),Ro(rt.target.checked);}}),a(`dialogs.paragraph.${q}`)]}),Wy={alignment:f,direction:g,indentLeft:p,indentRight:y,special:h,specialBy:S,spaceBefore:P,spaceAfter:R,lineRule:E,lineValue:H,contextualSpacing:k,keepNext:I,keepLines:W,widowControl:V,pageBreakBefore:U,tabStops:pe,clearedAllTabStops:Z},mm=q=>{let he=Gt.current;q!==g&&!he.direction&&!he.alignment&&u(editor.alignmentAfterDirectionChange),m(q);},zy={alignment:u,direction:mm,indentLeft:v,indentRight:x,special:b,specialBy:C,spaceBefore:T,spaceAfter:M,lineRule:_,lineValue:L,contextualSpacing:w,keepNext:$,keepLines:ee,widowControl:se,pageBreakBefore:ce,tabStops:K,clearedAllTabStops:be},$y={values:Wy,mixed:Pe,setValue(q,he){zy[q](he),q==="lineRule"?(Ze("lineSpacing"),L(he===te.current?.lineRule?te.current.lineValue:he==="multiple"?1.08:12)):q==="specialBy"?Ze("special"):q in Pe&&Ze(q);},errors:fe?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:ve,cancel:t};return jsxRuntime.jsx(pt,{kind:"paragraph",className:o,style:n,panelRef:zn,label:a("dialogs.paragraph.title"),onClose:t,onKeyDown:q=>{q.key==="Escape"&&t();let he=q.target instanceof HTMLButtonElement||q.target instanceof HTMLSelectElement;if(q.key==="Enter"&&!he){let Ro=q.target;if(Ro instanceof HTMLElement&&Ro.dataset.docxTabEntry!==void 0){$e();return}c&&ve();}},children:jsxRuntime.jsx(no.Composition,{state:$y,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.paragraph.title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-dialog__body",children:jsxRuntime.jsxs("div",{className:"docx-dialog__columns",children:[jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"alignment",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-alignment`,children:a("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${oe}-alignment`,className:"docx-dialog__input",value:Pe.alignment?"":f,onChange:q=>{Ze("alignment"),u(q.target.value);},"aria-label":a("dialogs.paragraph.alignment"),children:[Pe.alignment?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.alignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.alignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.alignRight")}),jsxRuntime.jsx("option",{value:"justify",children:a("dialogs.paragraph.alignJustify")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"direction",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-direction`,children:a("dialogs.paragraph.direction")}),jsxRuntime.jsxs("select",{id:`${oe}-direction`,className:"docx-dialog__input",value:Pe.direction?"":g,onChange:q=>{Ze("direction"),mm(q.target.value);},"aria-label":a("dialogs.paragraph.direction"),children:[Pe.direction?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"rtl",children:a("dialogs.paragraph.directionRtl")}),jsxRuntime.jsx("option",{value:"ltr",children:a("dialogs.paragraph.directionLtr")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.indentation")}),mo("beforeText",p,v,"indentLeft"),mo("afterText",y,x,"indentRight"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"special",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-special`,children:a("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${oe}-special`,className:"docx-dialog__input",value:Pe.special?"":h,onChange:q=>{Ze("special"),b(q.target.value);},"aria-label":a("dialogs.paragraph.special"),children:[Pe.special?jsxRuntime.jsx("option",{value:"",children:Mo("special")}):null,jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.specialNone")}),jsxRuntime.jsx("option",{value:"firstLine",children:a("dialogs.paragraph.specialFirstLine")}),jsxRuntime.jsx("option",{value:"hanging",children:a("dialogs.paragraph.specialHanging")})]})]}),h!=="none"?jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"specialBy",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-by`,children:a("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${oe}-by`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Pe.special?"":editor.twipsToInches(S),placeholder:Pe.special?Mo("special"):void 0,onChange:q=>{Ze("special"),C(Math.max(0,editor.inchesToTwips(Number(q.target.value)||0)));},"aria-label":a("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"tabStops",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.tabStops")}),pe.length===0?jsxRuntime.jsx("div",{className:"docx-dialog__note",children:a(Pe.tabStops?"dialogs.paragraph.tabMixed":"dialogs.paragraph.tabEmpty")}):pe.map(q=>jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label docx-dialog__tab-position",children:a("dialogs.paragraph.tabPositionLabel",{position:editor.formatInches(q.positionTwips)})}),jsxRuntime.jsx("span",{className:"docx-dialog__tab-description",children:a(editor.TAB_ALIGNMENT_LABELS[q.alignment])}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>K(pe.filter(he=>he!==q)),"aria-label":a("dialogs.paragraph.tabRemoveAt",{position:editor.formatInches(q.positionTwips)}),children:a("dialogs.paragraph.tabRemove")})]},q.positionTwips)),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-tabPosition`,children:a("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${oe}-tabPosition`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:editor.twipsToInches(Re),onChange:q=>ue(Math.max(0,editor.inchesToTwips(Number(q.target.value)||0))),"aria-label":a("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-tabAlignment`,children:a("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${oe}-tabAlignment`,className:"docx-dialog__input",value:ze,onChange:q=>_t(q.target.value),"aria-label":a("dialogs.paragraph.tabAlignment"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.tabAlignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.tabAlignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.tabAlignRight")}),jsxRuntime.jsx("option",{value:"decimal",children:a("dialogs.paragraph.tabAlignDecimal")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-tabLeader`,children:a("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${oe}-tabLeader`,className:"docx-dialog__input",value:Je,onChange:q=>ut(q.target.value),"aria-label":a("dialogs.paragraph.tabLeader"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.tabNone")}),jsxRuntime.jsx("option",{value:"dot",children:a("dialogs.paragraph.tabLeaderDot")}),jsxRuntime.jsx("option",{value:"hyphen",children:a("dialogs.paragraph.tabLeaderHyphen")}),jsxRuntime.jsx("option",{value:"underscore",children:a("dialogs.paragraph.tabLeaderUnderscore")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row docx-dialog__row--actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:$e,children:a("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>{co(q=>({...q,tabStops:false})),be(true),K([]);},children:a("dialogs.paragraph.tabClearAll")})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.spacing")}),$n("spaceBefore",P,T,"spaceBefore"),$n("spaceAfter",R,M,"spaceAfter"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineRule",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-lineSpacing`,children:a("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${oe}-lineSpacing`,className:"docx-dialog__input",value:Pe.lineSpacing?"":E,onChange:q=>{let he=q.target.value;Ze("lineSpacing"),_(he),L(he===te.current?.lineRule?te.current.lineValue:he==="multiple"?1.08:12);},"aria-label":a("dialogs.paragraph.lineSpacing"),children:[Pe.lineSpacing?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"multiple",children:a("dialogs.paragraph.ruleMultiple")}),jsxRuntime.jsx("option",{value:"atLeast",children:a("dialogs.paragraph.ruleAtLeast")}),jsxRuntime.jsx("option",{value:"exact",children:a("dialogs.paragraph.ruleExactly")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineValue",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${oe}-at`,children:a("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${oe}-at`,type:"number",className:"docx-dialog__input",min:.01,step:E==="multiple"?.01:1,value:Pe.lineSpacing?"":H,disabled:Pe.lineSpacing,onChange:q=>{let he=q.target.value.trim();L(he===""?E==="multiple"?1.08:12:Number(he)||0);},"aria-label":a("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:E==="multiple"?"":a("dialogs.paragraph.unitPoints")})]}),Wr("contextualSpacing",k,w),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.pagination")}),Wr("keepNext",I,$),Wr("widowControl",V,se),Wr("keepLines",W,ee),Wr("pageBreakBefore",U,ce)]})]})}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{role:"alert","data-docx-part":"error",className:"docx-dialog__error",children:fe?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:ve,children:a("dialogs.paragraph.ok")})]})]}),children:r})})}var no=Do();function dE(){return no.useState()}var yo=Object.assign(cE,{Header:no.Header,Title:no.Title,Body:no.Body,Footer:no.Footer,Apply:no.Apply,Cancel:no.Cancel,Error:no.Error,Field:no.Field});var Hg=Pt.createContext(null),Pr=()=>Pt.useContext(Hg);function Ag({popups:e,children:t}){let o=F(),n=Cc(),[r,i]=Pt.useState(null),[a,s]=Pt.useState(null),[l,c]=Pt.useState(null),[d,f]=Pt.useState(null),u=Pt.useRef(d);u.current=d;let g=Pt.useRef(e);g.current=e;let m=Pt.useRef(null),p=Pt.useRef(l);p.current=l;let v=()=>s(null);Pt.useEffect(()=>{if(a!==null)return;let b=m.current;m.current=null,b?.isConnected&&b.focus({preventScroll:true});},[a]),Pt.useEffect(()=>{if(o)return o.setTextFormFieldChrome({onRequest(b){if(g.current?.textFormField===false){b.cancel();return}u.current?.cancel(),s(null),c(b),b.signal.addEventListener("abort",()=>c(S=>S===b?null:S),{once:true});}},{fallback:true})},[o]),Pt.useEffect(()=>{if(!o||!r&&e?.revisionMarkup!==false)return;let b=o.setRevisionMarkupChrome({onRequest(S){if(g.current?.revisionMarkup===false){S.cancel();return}p.current?.cancel(),s(null),f(S),S.signal.addEventListener("abort",()=>f(C=>C===S?null:C),{once:true});}},{fallback:true});return ()=>{u.current?.cancel(),b();}},[o,r,e?.revisionMarkup===false]),Pt.useEffect(()=>{s(null),c(null),f(null);},[o,n]),Pt.useEffect(()=>{e?.revisionMarkup===false&&u.current?.cancel(),e?.textFormField===false&&p.current?.cancel(),a&&e?.[a]===false&&s(null);},[e,a]);let y=Pt.useMemo(()=>({container:r,setContainer:i,ownsPageSetup:e?.pageSetup!==void 0,open(b,S){p.current?.cancel(),u.current?.cancel(),g.current?.[b]!==false&&(m.current=S??r?.ownerDocument.activeElement,s(b));}}),[r,e?.pageSetup]),x={open:true,onClose:v},h=a==="pageSetup"&&e?.pageSetup!==false?e?.pageSetup?De(e.pageSetup,x):jsxRuntime.jsx(Sn,{...x}):a==="paragraph"&&e?.paragraph!==false?e?.paragraph?De(e.paragraph,x):jsxRuntime.jsx(yo,{...x}):d&&e?.revisionMarkup!==false?e?.revisionMarkup?De(e.revisionMarkup,{session:d},d):jsxRuntime.jsx(Ur,{session:d}):l&&e?.textFormField!==false?e?.textFormField?De(e.textFormField,{session:l},l):jsxRuntime.jsx(Ma,{session:l}):null;return jsxRuntime.jsxs(Hg.Provider,{value:y,children:[t,r?reactDom.createPortal(h,r):null]})}function Og(){let e=Pr();return jsxRuntime.jsx("div",{className:"docx-dialog-mount",ref:e?.setContainer})}function Bg({children:e}){let t=Pr();return t?.container?reactDom.createPortal(e,t.container):e}var ME=["nw","n","ne","e","se","s","sw","w"],Wg=40,zg=12;function RE(e){return `imageOverlay.handle.${e}`}function DE(e){switch(e){case "nw":case "se":return "nwse-resize";case "ne":case "sw":return "nesw-resize";case "n":case "s":return "ns-resize";default:return "ew-resize"}}function kE(e){return {nw:{x:"0%",y:"0%"},n:{x:"50%",y:"0%"},ne:{x:"100%",y:"0%"},e:{x:"100%",y:"50%"},se:{x:"100%",y:"100%"},s:{x:"50%",y:"100%"},sw:{x:"0%",y:"100%"},w:{x:"0%",y:"50%"}}[e]}function IE(e,t){return e>0&&t>0?"se":e>0&&t<0?"ne":e<0&&t>0?"sw":e<0&&t<0?"nw":e>0?"e":e<0?"w":t>0?"s":"n"}function mu({containerRef:e,portalRef:t,scrollPort:o}){let n=F(),{t:r}=N(),[i,a]=Pt.useState(null),[s,l]=Pt.useState(null),[c,d]=Pt.useState({left:0,top:0}),f=Pt.useRef(null);f.current=s;let u=Pt.useRef(null),g=Pt.useRef(null),m=Pt.useRef(null),p=Pt.useRef(null),v=Pt.useRef(null);Pt.useEffect(()=>{let T=e.current;if(!T)return;let R=M=>{let E=M.target instanceof Element?M.target:null;if(E?.closest(".docx-drawing-textbox-content")){p.current=null;return}let _=E?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");p.current=_??null,_&&_===i?.id&&queueMicrotask(()=>m.current?.focus({preventScroll:true}));};return T.addEventListener("pointerdown",R,{capture:true}),()=>T.removeEventListener("pointerdown",R,{capture:true})},[e,i?.id]),Pt.useEffect(()=>{if(!n){a(null);return}let T=()=>{a(editor.selectedDrawingOverlayTargetOf(n.surface));},R=()=>{queueMicrotask(T);};T();let M=[n.on("change",R),n.on("selectionChange",T)];return ()=>{for(let E of M)E();}},[n]);let y=Pt.useCallback(()=>{d(T=>{let R=editor.overlayHostOrigin(e.current);return R.left===T.left&&R.top===T.top?T:R});},[e]);Pt.useEffect(()=>{y();let T=t.current;if(!T||typeof ResizeObserver!="function")return;let R=new ResizeObserver(y);R.observe(T);let M=e.current;return M&&R.observe(M),()=>R.disconnect()},[e,t,y,i]),Pt.useEffect(()=>{if(o){v.current=o;return}let T=e.current;if(!T||!n?.surface)return;let R=T.closest(".docx-editor__scroll-container");if(!R)return;let M=n.surface.overlayCoordinates();return v.current=editor.createImageOverlayScrollPort(R,M.paintScale),()=>{v.current=null;}},[e,n,o]);let x=Pt.useCallback(()=>{l(null),u.current=null;let T=g.current;if(g.current=null,T)try{T.releasePointerCapture(T._lastPointerId??0);}catch{}},[]),h=Pt.useCallback((T,R,M,E,_,H,L)=>{if(!n?.surface)return;let k=n.surface.activeScope();if(k.kind==="frame"&&!n.surface.selectDrawing(M.id,k.hostParagraphId))return;let w=n.surface.layout(),I=editor.captureImageMutationPreconditions(n);if(I){u.current=Object.freeze({x:E,y:_}),g.current=H,H._lastPointerId=L;try{H.setPointerCapture(L);}catch{}l({session:Object.freeze({drawingNodeId:M.id,startBounds:Object.freeze({x:M.x,y:M.y,width:M.width,height:M.height}),startWidthEmu:M.widthEmu,startHeightEmu:M.heightEmu,startPosition:M.position,anchorFrameOrigin:M.anchorFrameOrigin,transform:M.transform,mode:T,handle:R,preconditions:I,layoutRevision:w.revision,packageRevision:n.surface.session.packageRevision(),kind:M.kind}),bounds:M,accumulatedScrollPt:0}),m.current?.focus({preventScroll:true});}},[n]),b=Pt.useCallback((T,R,M,E,_)=>{if(!n)return;if(editor.isStaleImageInteractionCommit(n,T)){x();return}T.mode==="resize"?n.exec({type:"setImageProperties",widthEmu:R,heightEmu:M,..._?.mode==="simple"?{horizontalEmu:_.horizontalEmu,verticalEmu:_.verticalEmu}:{},..._?.mode==="frame"?{..._.horizontalEmu!==void 0?{horizontalEmu:_.horizontalEmu}:{},..._.verticalEmu!==void 0?{verticalEmu:_.verticalEmu}:{}}:{}}):T.mode==="move"&&_&&n.exec({type:"setImagePosition",..._}),x();},[x,n]),S=Pt.useCallback(T=>{if(!n)return;let R=f.current?.bounds??editor.selectedDrawingOverlayTargetOf(n.surface);if(!R)return;if(f.current&&T.key==="Escape"){T.preventDefault(),T.stopPropagation(),x();return}if(f.current)return;let M=T.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(T.key==="Delete"||T.key==="Backspace"){T.preventDefault(),T.stopPropagation(),n.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(T.key))return;T.preventDefault(),T.stopPropagation();let E=T.key==="ArrowLeft"?-M:T.key==="ArrowRight"?M:0,_=T.key==="ArrowUp"?-M:T.key==="ArrowDown"?M:0;if(T.altKey){if(!R.canResize)return;let L=IE(E,_),k=editor.computeImageResizeResult({handle:L,startWidthEmu:R.widthEmu,startHeightEmu:R.heightEmu,startBounds:{x:R.x,y:R.y,width:R.width,height:R.height},startPosition:R.position,anchorFrameOrigin:R.anchorFrameOrigin,deltaXPt:E,deltaYPt:_,transform:R.transform,preserveAspect:editor.resizePreservesAspect(L,R.aspectLocked,T.shiftKey,R.textbox),kind:R.kind});n.exec({type:"setImageProperties",widthEmu:k.widthEmu,heightEmu:k.heightEmu,...k.position?.mode==="simple"?{horizontalEmu:k.position.horizontalEmu,verticalEmu:k.position.verticalEmu}:{},...k.position?.mode==="frame"?{...k.position.horizontalEmu!==void 0?{horizontalEmu:k.position.horizontalEmu}:{},...k.position.verticalEmu!==void 0?{verticalEmu:k.position.verticalEmu}:{}}:{}});return}if(R.kind!=="anchored"||!R.canMove||!R.position)return;let H=editor.computeMovedImagePosition(R.position,E,_);n.exec({type:"setImagePosition",...H});},[x,n]);Pt.useEffect(()=>{if(!s||!n?.surface)return;let T=n.surface.overlayCoordinates(),R=E=>{let _=f.current,H=u.current;if(!_||!H)return;let L=editor.cssPixelsToLayoutPoints(E.clientX-H.x,T.paintScale),k=editor.cssPixelsToLayoutPoints(E.clientY-H.y,T.paintScale);if(_.session.mode==="move"){let I=0,$=v.current,W=e.current?.closest(".docx-editor__scroll-container");if($&&W){let V=W.getBoundingClientRect();E.clientY>V.bottom-Wg?I=zg:E.clientY<V.top+Wg&&(I=-zg),I!==0&&(I=$.scrollBy(I));}let ee=_.accumulatedScrollPt+I;l({..._,accumulatedScrollPt:ee,bounds:Object.freeze({..._.bounds,x:_.session.startBounds.x+L,y:_.session.startBounds.y+k+ee})});return}if(!_.session.handle)return;let w=editor.computeImageResizeResult({handle:_.session.handle,startWidthEmu:_.session.startWidthEmu,startHeightEmu:_.session.startHeightEmu,startBounds:_.session.startBounds,startPosition:_.session.startPosition,anchorFrameOrigin:_.session.anchorFrameOrigin,deltaXPt:L,deltaYPt:k,transform:_.session.transform,preserveAspect:editor.resizePreservesAspect(_.session.handle,_.bounds.aspectLocked,E.shiftKey,_.bounds.textbox),kind:_.session.kind});l({..._,bounds:Object.freeze({..._.bounds,x:w.previewBounds.x,y:w.previewBounds.y,width:w.previewBounds.width,height:w.previewBounds.height,widthEmu:w.widthEmu,heightEmu:w.heightEmu})});},M=E=>{let _=f.current;if(_)if(E.type==="pointerup"){let H=editor.cssPixelsToLayoutPoints(E.clientX-(u.current?.x??E.clientX),T.paintScale),L=editor.cssPixelsToLayoutPoints(E.clientY-(u.current?.y??E.clientY),T.paintScale),k=editor.finalizeImageOverlayInteraction({session:_.session,deltaXPt:H,deltaYPt:L,accumulatedScrollPt:_.accumulatedScrollPt,aspectLocked:_.bounds.aspectLocked,textbox:_.bounds.textbox,shiftKey:E.shiftKey,anchorFrameOrigin:_.session.anchorFrameOrigin});b(_.session,k.widthEmu,k.heightEmu,k.previewBounds,k.position);}else x();};return window.addEventListener("pointermove",R),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),()=>{window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M);}},[x,b,e,n,s]),Pt.useEffect(()=>{!i||p.current!==i.id||(p.current=null,m.current?.focus({preventScroll:true}));},[i]);let C=s?.bounds??i,P=Pt.useMemo(()=>{if(!n?.surface||!C)return null;let T=n.surface.publishedLayout(),R=n.surface.overlayCoordinates(),M=editor.overlayFrameToSheetCssPixels(T,{pageIndex:C.pageIndex,x:C.x,y:C.y,width:C.width,height:C.height},R),E={left:M.left+c.left,top:M.top+c.top,width:M.width,height:M.height},_=C.canResize,H=C.kind==="anchored"&&C.canMove;return jsxRuntime.jsxs("div",{ref:m,className:"docx-image-selection-overlay","data-drawing-node-id":C.id,tabIndex:0,onKeyDown:S,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${H?" docx-editor-one-surface__overlay-control":""}`,"data-textbox":C.textbox?"true":void 0,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${E.left}px`,top:`${E.top}px`,width:`${E.width}px`,height:`${E.height}px`,cursor:H?"move":"default"},onPointerDown:L=>{B(L),!(!H||!C.position)&&L.button===0&&(L.preventDefault(),L.stopPropagation(),h("move",null,C,L.clientX,L.clientY,L.currentTarget,L.pointerId));}}),_?ME.map(L=>{let k=kE(L);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(RE(L)),tabIndex:0,style:{left:`calc(${E.left}px + ${E.width}px * ${parseFloat(k.x)/100} - 5px)`,top:`calc(${E.top}px + ${E.height}px * ${parseFloat(k.y)/100} - 5px)`,cursor:DE(L)},onPointerDown:w=>{B(w),w.button===0&&(w.preventDefault(),w.stopPropagation(),h("resize",L,C,w.clientX,w.clientY,w.currentTarget,w.pointerId));}},L)}):null]})},[C,h,n,S,c.left,c.top,r]);return !P||!t.current?null:reactDom.createPortal(P,t.current)}function gu(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function Ll({className:e}){let t=F(),o=la(),n=Pt.useRef(null),r=Pt.useRef(null);Pt.useLayoutEffect(()=>{let l=n.current;if(!(!t||!l))return t.attach(l),()=>{t.detach();}},[t]);let i=Pt.useCallback(l=>{if(!o?.isEnabled)return;let c=l.clipboardData;c&&gu(c)&&(editor.clipboardPasteLandsContent(c)||(l.preventDefault(),o.insertFromDataTransfer(c)));},[o]),a=Pt.useCallback(l=>{!o?.isEnabled||!gu(l.dataTransfer)||l.preventDefault();},[o]),s=Pt.useCallback(l=>{if(o?.isEnabled&&gu(l.dataTransfer)){if(editor.clipboardDropLandsText(l.dataTransfer)){if((l.target instanceof Element?l.target:null)?.closest("[contenteditable]")?.getAttribute("contenteditable")==="true")return;l.preventDefault();return}l.preventDefault(),o.insertFromDataTransfer(l.dataTransfer);}},[o]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:n,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:i,onDragOver:a,onDrop:s}),jsxRuntime.jsx(Og,{}),jsxRuntime.jsx(Gf,{}),jsxRuntime.jsx(Tg,{}),t?jsxRuntime.jsx(mu,{containerRef:n,portalRef:r}):null]})}function Ne(e){return e/1440*96}function Fl(e){return e/96*1440}function gt(e){return `${Math.round(e*100)/100}px`}function hu(e){return e/2}var ZE=e=>e.isLoading||e.isOpening===true,qE=e=>({width:Ne(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Ne(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),KE=(e,t)=>e.width===t.width&&e.height===t.height;function bu({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}var Vg=false;function Gg(){Vg||!jt()||(Vg=true,console.warn("[docx-editor] loadingIndicator is ignored with chrome={false}, which renders no loading screen. Compose <DocxEditor.Loading overlay indicator={...} /> in a positioned box instead."));}function WE(e){let t=F(),[o,n]=Pt.useState(null);return Pt.useEffect(()=>{if(!(!t||!e))return t.setOpeningIndicatorHost({publish:n}),()=>{t.setOpeningIndicatorHost(null),n(null);}},[t,e]),o}function zE({when:e=false,overlay:t=false,className:o,style:n,indicator:r,children:i}){let a=O(ZE),s=O(qE,KE),l=WE(t),{t:c}=N();if(!e&&!a)return null;let d=r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bu,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:c("loading.label")})]});if(l)return reactDom.createPortal(d,l);let f=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${o?` ${o}`:""}`;return jsxRuntime.jsx("div",{className:f,style:n,role:"status","aria-live":"polite",children:i??jsxRuntime.jsx("div",{className:"docx-paginated-surface docx-editor__loading-surface",style:{width:s.width,height:s.height},children:jsxRuntime.jsx("div",{className:"docx-pages",children:jsxRuntime.jsx("div",{className:"docx-page docx-editor__loading-page",children:jsxRuntime.jsx("div",{className:"docx-editor__loading-page-status",children:d})})})})})}var Hl=Object.assign(zE,{Spinner:bu});function jg(){let e=new Set,t=new Map,o=new Map,n=0,r=null,i=false;function a(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let u=Object.create(null),g=[...t].sort((m,p)=>(o.get(m[0])??0)-(o.get(p[0])??0));for(let[,{author:m,style:p}]of g)u[m]=p;return {authors:u,others:e.size>0?"kind":"author"}}let s=null,l=false;function c(u){if(u===void 0)return "none";if(typeof u=="string")return u;let g=Object.entries(u.authors).map(([m,p])=>`${m}\0${JSON.stringify(p)}`).sort();return `${u.others??"kind"}${g.join("")}`}function d(){if(!r)return;let u=a(),g=c(u);if(g!==s){if(u===void 0){i&&(r.setRevisionStyles("author"),i=false,s=g);return}r.setRevisionStyles(u),i=true,s=g;}}function f(){!r||l||(l=true,queueMicrotask(()=>{l=false,d();}));}return {registerScheme(u){e.add(u),f();},register(u,g,m){o.has(u)||o.set(u,n++),t.set(u,{author:g,style:m}),f();},unregister(u){(e.delete(u)||t.delete(u))&&f();},connect(u){r=u;let g=a();i=u!==null&&g!==void 0,s=u===null?null:c(g),f();},current:a}}var _a=Pt.createContext(null);function Jg(){let e=Pt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function vu(){let e=Pt.useContext(_a),t=Jg();return Pt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function yu(e){let{author:t,color:o,background:n,activeBackground:r,spanClassName:i,avatarUrl:a}=e,s=Pt.useContext(_a),l=Jg();return Pt.useEffect(()=>{if(s)return s.register(l,t,{...o!==void 0?{color:o}:{},...n!==void 0?{background:n}:{},...r!==void 0?{activeBackground:r}:{},...i!==void 0?{spanClassName:i}:{},...a!==void 0?{avatarUrl:a}:{}}),()=>s.unregister(l)},[s,l,t,o,n,r,i,a]),null}var Qg=false;function e0(e,t){e===t||Qg||!jt()||(Qg=true,console.warn("[docx-editor] fieldResults changed after the editor was created, so the change is ignored. The editor reads fieldResults once; create a new editor to change it."));}function ew(e,t){if(e===t)return true;let o=editor.resolveZoomMode(e),n=editor.resolveZoomMode(t);return o!==null&&n!==null&&editor.sameZoomMode(o,n)}function tw(e){let t=Pt.useRef(e);t.current=e;let[o,n]=Pt.useState(null),{onReady:r,onChange:i,onFontError:a,onRevisionMarkupChange:s,...l}=e,c=Pt.useMemo(()=>({onReady:d=>{n(d),t.current.onReady?.(d);},onChange:d=>t.current.onChange?.(d),onFontError:d=>t.current.onFontError?.(d),onRevisionMarkupChange:d=>t.current.onRevisionMarkupChange?.(d)}),[]);return {DocxEditorRoot:Na,rootProps:l,rootListeners:c,editorRef:o}}function Na(e){let{document:t,fonts:o,author:n,locale:r,translate:i,mode:a,zoom:s,zoomMode:l,tableInteractionLabel:c,imageDecodePort:d,children:f}=e,{t:u}=N(),g=Pt.useCallback((k,w)=>u(k,w),[u]),m=Pt.useRef(g);m.current=g;let p=Pt.useRef(false),[v,y]=Pt.useState(0),x=Pt.useRef(e);x.current=e;let[h,b]=Pt.useState(null),S=Pt.useRef(e.fieldResults),C=Pt.useRef(null);C.current??=jg();let P=C.current;Pt.useEffect(()=>{let k=x.current,w=k.translate??m.current,I=P.current();S.current=k.fieldResults;let $=editor.createDocxEditor({...k.document!==void 0?{document:k.document}:{},...k.fonts?{fonts:k.fonts}:{},...k.author!==void 0?{author:k.author}:{},...k.locale!==void 0?{locale:k.locale}:{},translate:w,...k.revisionMarkup!==void 0?{revisionMarkup:k.revisionMarkup}:{},...k.reviewDisplayMode!==void 0?{reviewDisplayMode:k.reviewDisplayMode}:{},...k.fieldResults!==void 0?{fieldResults:k.fieldResults}:{},...k.mode!==void 0?{mode:k.mode}:{},...I!==void 0?{revisionStyles:I}:{},...k.modules!==void 0?{modules:k.modules}:{},...k.zoom!==void 0?{zoom:k.zoom}:{},...k.zoomMode!==void 0?{zoomMode:k.zoomMode}:{},...k.tableInteractionLabel?{tableInteractionLabel:k.tableInteractionLabel}:{},...k.imageDecodePort?{imageDecodePort:k.imageDecodePort}:{},onFontError:V=>x.current.onFontError?.(V)}),W=$.on("revisionMarkupChange",V=>{p.current||(x.current.onRevisionMarkupChange?.(V),y(se=>se+1));}),ee=$.on("change",V=>x.current.onChange?.(V));return b($),()=>{W(),ee(),$.destroy(),b(V=>V===$?null:V);}},[t,o,d,P]),Pt.useEffect(()=>{if(!h)return;if(!h.snapshot().isOpening){x.current.onReady?.(h);return}let k=h.on("change",()=>{k(),x.current.onReady?.(h);});return k},[h]);let T=Pt.useRef({editor:null,zoom:void 0,mode:void 0});Pt.useEffect(()=>{if(!h)return;T.current.editor!==h&&(T.current={editor:h,zoom:void 0,mode:void 0});let w=false;s!==void 0&&s!==T.current.zoom&&(T.current.zoom=s,h.setZoom(s),w=true);let I=T.current.mode,$=l!==void 0&&(I===void 0||!ew(I,l)),W=l===void 0?null:editor.resolveZoomMode(l),ee=w&&l!==void 0&&W!==null&&W.type==="fit";($||ee)&&(T.current.mode=l,h.setZoomMode(l));},[h,s,l]),Pt.useEffect(()=>{if(!h||e.revisionMarkup===void 0)return;let k=editor.resolveRevisionMarkup(e.revisionMarkup);if(JSON.stringify(k)!==JSON.stringify(h.snapshot().revisionMarkup)){p.current=true;try{h.setRevisionMarkup(k);}finally{p.current=false;}}},[h,e.revisionMarkup,v]),Pt.useEffect(()=>{h&&h.setAuthor(n);},[h,n]);let R=Pt.useRef({editor:null,value:void 0});Pt.useEffect(()=>{if(h){if(R.current.editor!==h){R.current={editor:h,value:a};return}R.current.value!==a&&(R.current.value=a,h.setMode(a));}},[h,a]),Pt.useEffect(()=>{h&&h.setTranslate(i??g);},[h,i,g]),Pt.useEffect(()=>{h&&h.setLocale(r);},[h,r]),Pt.useEffect(()=>{h&&e0(S.current,e.fieldResults);},[h,e.fieldResults]),Pt.useEffect(()=>{h&&h.setTableInteractionLabel(c??editor.defaultTableLabel);},[h,c]);let[M,E]=Pt.useState(0),_=Pt.useRef([]),H=Pt.useMemo(()=>({mounted:M,register:()=>(E(k=>k+1),()=>E(k=>Math.max(0,k-1))),registerCommentDraft:k=>(_.current.push(k),()=>{let w=_.current.indexOf(k);w!==-1&&_.current.splice(w,1);}),requestCommentDraft:()=>{let k=_.current.at(-1);return k?(k(),true):false}}),[M]),L=Pt.useMemo(Em,[]);return Pt.useEffect(()=>(P.connect(h),()=>P.connect(null)),[P,h]),jsxRuntime.jsx(sg,{value:i??g,children:jsxRuntime.jsx(xt.Provider,{value:H,children:jsxRuntime.jsx(pc.Provider,{value:h,children:jsxRuntime.jsx(Pc.Provider,{value:L,children:jsxRuntime.jsx(_a.Provider,{value:P,children:jsxRuntime.jsx(ow,{children:jsxRuntime.jsx(nw,{children:jsxRuntime.jsx(Qi,{children:jsxRuntime.jsx(Vf,{value:e.popups,children:jsxRuntime.jsx(Ag,{popups:e.popups,children:f})})})})})})})})})})}function ow({children:e}){let t=zi(true);return jsxRuntime.jsx(Xr.Provider,{value:t,children:e})}function nw({children:e}){let t=Ui();return jsxRuntime.jsx(Vc.Provider,{value:t,children:e})}var La=316,wr=editor.REVIEW_MARKERS_GUTTER_PX,r0=24,Ol={inlineStart:0,inlineEnd:La},t0={inlineStart:wr,inlineEnd:wr},cw={inlineStart:0,inlineEnd:0},Tu={inlineStart:r0,inlineEnd:La};function dw(e){return e.inlineStart===Tu.inlineStart&&e.inlineEnd===Tu.inlineEnd}function a0(e,t){return dw(e)?Math.max(0,t-(La-wr)):t}function i0({open:e,viewportWidth:t,pageWidthPx:o,inlineStartReservation:n=0,docked:r=false,scroll:i=false}){if(!e)return t0;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0)return Ol;let a=Number.isFinite(n)&&n>0?n:0;return t-a-o-2*r0>=La?Ol:i?Tu:t0}var uw=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,reviewPaneOpen:e.reviewPaneOpen??true,entitledZoom:editor.reviewPaneEntitledZoom(t,e.zoom,e.reviewPane.overflow),scroll:e.reviewPane.overflow==="scroll"}},pw=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.scroll===t.scroll&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function l0(){let e=Ye(),[t,o]=Pt.useState(null);return Pt.useEffect(()=>{if(!e){o(null);return}let n=()=>o(e.clientWidth);if(n(),typeof ResizeObserver>"u")return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e]),t}function qo(){let e=Pt.useContext(xt),{pageSetup:t,reviewPaneOpen:o,entitledZoom:n,scroll:r}=O(uw,pw),i=Ye(),a=Mm(),s=Pt.useRef(null);t&&(s.current=t.pageWidthTwips);let l=t?.pageWidthTwips??s.current,c=(e?.mounted??0)>0,d=Pt.useCallback(g=>c?i0({open:o,viewportWidth:g??0,pageWidthPx:l===null||n===null?0:Ne(l)*n,inlineStartReservation:a,docked:n===null,scroll:r}):cw,[c,o,l,n,a,r]),[f,u]=Pt.useState(()=>d(i?i.clientWidth:null));return Pt.useEffect(()=>{let g=()=>u(d(i?i.clientWidth:null));if(g(),!i||typeof ResizeObserver>"u")return;let m=new ResizeObserver(g);return m.observe(i),()=>m.disconnect()},[i,d]),f}var Bl=[.25,.5,.75,1,1.25,1.5,2];function Fa(e,t){return t==="in"?Bl.find(n=>n>e+.001)??null:[...Bl].reverse().find(n=>n<e-.001)??null}function s0(e,t){return e==="0"?1:e==="+"||e==="="?Fa(t,"in")??t:e==="-"?Fa(t,"out")??t:null}var Pu=Pt.createContext(false);function c0(e){let t=Pt.useContext(Pu),[o,n]=Pt.useState(null);return Pt.useLayoutEffect(()=>{let r=t?e?.parentElement??null:null;n(r?{host:r,scoped:r.closest(".docx-editor")!==null}:null);},[t,e]),{inside:t,host:o?.host??null,hostScoped:o?.scoped??false}}var vw=e=>e.reviewPaneOpen??true,yw=e=>e.zoomMode?.type==="fit";function Zl({className:e,style:t,children:o}){let{t:n}=N(),r=Ct(),i=F(),a=O(vw),s=qo(),l=O(yw),d=(Pt.useContext(xt)?.mounted??0)>0,f=rn(),u=an(),g=Pt.useCallback(p=>f?.setViewport(p),[f]),m=Pt.useCallback(p=>{if(!i||!(p.metaKey||p.ctrlKey)||p.altKey)return;let v=p.target;if(v instanceof Element&&v.closest('input, textarea, select, [role="dialog"]'))return;let y=s0(p.key,i.getZoom());y!==null&&(p.preventDefault(),i.setZoom(y));},[i]);return jsxRuntime.jsx("div",{ref:g,"data-testid":"docx-editor-scroll",tabIndex:0,role:"region","aria-label":n("editor.documentViewport"),onKeyDownCapture:m,...d?{"data-review-pane":a?"open":"closed"}:{},...l?{"data-zoom-fit":""}:{},className:`${r}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${u}px`,...d?{"--docx-review-gutter":`${s.inlineEnd}px`,"--docx-review-gutter-start":`${s.inlineStart}px`,"--docx-review-strip":`${2*wr}px`}:{}},children:jsxRuntime.jsx(vn.Provider,{value:true,children:jsxRuntime.jsx(Pu.Provider,{value:true,children:o})})})}var Cw=editor.LOADING_SNAPSHOT;function u0({ref:e,editorRef:t}){Pt.useImperativeHandle(e,()=>({load:o=>t.current?.load(o),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(o,n)=>t.current?.exec(o,n)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:o=>t.current?.snapshot(o)??Cw}),[t]);}function Mr(e,t,o,n){let r=Ye(),i=Pt.useRef({close:o,skip:n,viewport:r});i.current={close:o,skip:n,viewport:r},Pt.useEffect(()=>{let a=t.current;if(!e||!a)return;let s=d=>a.contains(d),l=editor.listenForPopupEscape({popup:a,contains:s,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current.viewport],skip:d=>i.current.skip?.(d)===true,close:d=>i.current.close(d)}),c=editor.listenForPopupFocusLeave({popup:a,contains:s,close:()=>i.current.close(false)});return ()=>{l(),c();}},[e,t]);}var kw=e=>e.editingMode??"editing",wu='[role="menuitemradio"]:not([disabled])',Iw=(e,t)=>e.length===t.length&&e.every((o,n)=>o===t[n]),_w=e=>e.isLoading||e.isOpening===true,Ha=[{mode:"editing",labelKey:"editingMode.editing",hintKey:"editingMode.editingHint",path:"M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"},{mode:"suggesting",labelKey:"editingMode.suggesting",hintKey:"editingMode.suggestingHint",path:"M240-400h122l40-40H240v40Zm0-100h222l40-40H240v40Zm0-100h322l40-40H240v40ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v320h-80v-320H160v525l46-45h274v80H240L80-80Zm520-80v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T943-380L723-160H600Zm300-263-37-37 37 37ZM660-220h38l121-122-19-18-18-19-122 121v38Zm140-141-18-19 37 37-19-18Z"},{mode:"viewing",labelKey:"editingMode.viewing",hintKey:"editingMode.viewingHint",path:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Z"}],Nw=Object.freeze(Ha.map(()=>null));function Lw(e){return e?Ha.map(t=>{let o=e.can({type:"setEditingMode",mode:t.mode});return o.ok?null:o.reason}):Nw}var Fw="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Kl({className:e,hidden:t}){let o=F(),n=O(kw),r=O(_w),i=X(),{t:a}=N(),[s,l]=Pt.useState(false),c=Pt.useRef(null),d=Pt.useRef(null),f=Pt.useRef(null);Pt.useEffect(()=>{if(!s)return;let h=f.current?.querySelectorAll(wu);(f.current?.querySelector(`${wu}[aria-checked="true"]`)??h?.[0]??void 0)?.focus();},[s]);let u=Pt.useCallback(h=>{let b=[...f.current?.querySelectorAll(wu)??[]],S=b.indexOf(document.activeElement),C=P=>{h.preventDefault(),b[(P+b.length)%b.length]?.focus();};h.key==="ArrowDown"?C(S+1):h.key==="ArrowUp"?C(S-1):h.key==="Home"?C(0):h.key==="End"&&C(b.length-1);},[]);Pt.useEffect(()=>{if(!s)return;let h=b=>{let S=c.current;S&&b.target instanceof Node&&S.contains(b.target)||l(false);};return document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("mousedown",h,true);}},[s]),Mr(s,c,h=>{l(false),h&&d.current?.focus();});let g=Pt.useCallback(h=>{l(false),editor.runToolbarCommand(o,"review.editingMode",h),o?.focus();},[o]),m=editor.toolbarCommandState(o,"review.editingMode"),p=i18n.localizeDisabledReason(m.disabledReason,a),v=O(()=>Lw(o),Iw),y=Pt.useMemo(()=>Ha.find(h=>h.mode===n)??Ha[0],[n]);if(t)return null;let x=J("review.editingMode");return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":n,"aria-haspopup":"menu","aria-expanded":s,"aria-label":i(x?.labelKey??"editingMode.label"),disabled:r||!m.enabled,...p?{title:p}:{},onMouseDown:B,onClick:()=>l(h=>!h),children:[Mu(y.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:i(y.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{ref:f,className:"docx-toolbar__mode-menu",role:"menu","aria-label":i(x?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:u,children:Ha.map((h,b)=>{let S=i18n.localizeDisabledReason(v[b]??null,a);return jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.mode===n,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${h.mode}`,disabled:S!==null,...S?{title:S}:{},onMouseDown:B,onClick:()=>g(h.mode),children:[Mu(h.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:i(h.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:i(h.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:h.mode===n?Mu(Fw):null})]},h.mode)})}):null]})}Kl.docxSlot="review.editingMode";function Mu(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}var g0=[],Ow=()=>{};function Aa(){let e=F(),t=Pt.useCallback(o=>{if(!e)return Ow;let n=$r(o),r=e.on("change",n),i=e.on("selectionChange",n);return ()=>{r(),i();}},[e]);return Pt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??g0,()=>g0)}var zw=e=>e.hiddenReviewAuthors??[];function zl({className:e,hidden:t,icon:o}){let n=F(),r=Aa(),i=O(zw),a=new Set(i),s=r.every(b=>!a.has(b.author)),[l,c]=Pt.useState(false),d=Pt.useRef(null),f=Pt.useRef(null),u=Pt.useRef(null),g=X(),{t:m}=N();Pt.useEffect(()=>{if(!l)return;u.current?.querySelector('[role="menuitemcheckbox"]')?.focus();let b=S=>{d.current?.contains(S.target)||c(false);};return document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("mousedown",b,true);}},[l]),Mr(l,d,b=>{c(false),b&&f.current?.focus();});let p=Pt.useCallback(b=>{let S=[...u.current?.querySelectorAll('[role="menuitemcheckbox"]')??[]],C=S.indexOf(document.activeElement),P=T=>{b.preventDefault(),S[(T+S.length)%S.length]?.focus();};b.key==="ArrowDown"?P(C+1):b.key==="ArrowUp"?P(C-1):b.key==="Home"?P(0):b.key==="End"?P(S.length-1):b.key==="Tab"&&c(false);},[]);if(t)return null;let v=J("review.authors"),y=editor.toolbarCommandState(n,"review.authors"),x=i18n.localizeDisabledReason(y.disabledReason,m),h=g(v?.labelKey??"reviewers.label");return jsxRuntime.jsxs("div",{ref:d,className:`docx-toolbar__reviewers${e?` ${e}`:""}`,"data-slot":"review.authors",children:[jsxRuntime.jsxs("button",{ref:f,type:"button",className:"docx-toolbar__picker","data-testid":"reviewers-trigger","aria-haspopup":"menu","aria-expanded":l,"aria-label":h,disabled:!y.enabled,title:x??h,onMouseDown:B,onClick:()=>c(b=>!b),children:[o??re(v?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:h}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__reviewers-menu",role:"menu","aria-label":h,"data-testid":"reviewers-menu",onKeyDown:p,children:[jsxRuntime.jsx(h0,{checked:s,label:m("reviewers.all"),testId:"reviewer-all",onChoose:()=>n?.setAllReviewAuthorsVisible(!s)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),r.map(b=>jsxRuntime.jsx(h0,{checked:!a.has(b.author),label:b.author||"\u2014",testId:`reviewer-${b.slot}`,color:b.color,onChoose:()=>n?.setReviewAuthorVisible(b.author,a.has(b.author))},b.author))]}):null]})}zl.docxSlot="review.authors";function h0(e){return jsxRuntime.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":e.checked,className:"docx-toolbar__reviewer-item","data-testid":e.testId,onMouseDown:B,onClick:e.onChoose,children:[jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:e.checked?"\u2713":""}),e.color?jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-swatch",style:{background:e.color}}):null,jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-name",children:e.label})]})}var b0=Pt.createContext(null);function v0({children:e}){let t=Pr(),[o,n]=Pt.useState(false),r=Pt.useRef(null),i=Pt.useMemo(()=>({open:s=>{if(t){t.open("paragraph",s);return}r.current=s??document.activeElement,n(true);}}),[t]),a=Pt.useCallback(()=>{n(false);let s=r.current;r.current=null,s instanceof HTMLElement&&s.isConnected&&s.focus({preventScroll:true});},[]);return jsxRuntime.jsxs(b0.Provider,{value:i,children:[e,jsxRuntime.jsx(yo,{open:o,onClose:a})]})}function y0(){return Pt.useContext(b0)}var Du=["M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"],ku=Pt.createContext({close:()=>{}});function Rr(){return Pt.useContext(ku).close}function c1(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function P0({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__more-control",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-label",children:e}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-body",children:t})]})}function S0({slot:e}){let t=X(),o=ko(),{close:n}=Pt.useContext(ku),{execute:r,isActive:i,isEnabled:a,disabledReason:s,value:l}=ie(e),c=J(e),d=editor.chromeSlotIsToggle(e),f=o(t(c?.labelKey??e));return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...s?{title:s}:{},...d?{"aria-pressed":i}:{},...i?{"data-active":""}:{},...l!==null?{"data-value":l}:{},onMouseDown:B,onClick:u=>{r(),n(u.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:re(c?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:f})]})}function E0({sections:e,className:t}){let o=X(),[n,r]=Pt.useState(false),i=Pt.useRef(null),a=Pt.useRef(null),s=Pt.useRef(null),l=Pt.useRef(false),c=Pt.useId(),d=Ye(),f=Pt.useRef(d);f.current=d;let u=o("formattingBar.more"),g=Pt.useCallback(x=>{r(false),x&&a.current?.focus();},[]),m=Pt.useMemo(()=>({close:g}),[g]);Pt.useEffect(()=>{if(!n)return;let x=P=>{let T=P.target;T instanceof Node&&i.current?.contains(T)||r(false);},h=i.current,b=P=>i.current?.contains(P)===true||s.current?.contains(P)===true,S=h?editor.listenForPopupEscape({popup:h,contains:b,chromeRoot:()=>i.current?.closest(".docx-editor"),editorElements:()=>[f.current],skip:()=>editor.hasOpenNestedPopup(s.current),close:g}):void 0,C=h?editor.listenForPopupFocusLeave({popup:h,contains:b,close:()=>r(false)}):void 0;return document.addEventListener("mousedown",x,true),()=>{document.removeEventListener("mousedown",x,true),S?.(),C?.();}},[n,g]);let[p,v]=Pt.useState(null);Pt.useLayoutEffect(()=>{if(!n){v(null);return}let x=()=>{let b=i.current,S=s.current,C=a.current,P=b?.ownerDocument.defaultView;if(!b||!S||!C||!P)return;let T=C.getBoundingClientRect(),R=editor.toolbarPanelPlacement({triggerLeft:T.left,triggerRight:T.right,panelWidth:S.offsetWidth,viewportWidth:P.innerWidth}),M=R.left-b.getBoundingClientRect().left;v(E=>E&&E.left===M&&E.maxWidth===R.maxWidth&&E.anchor===R.anchor?E:{...R,left:M});};x();let h=i.current?.ownerDocument.defaultView;return h?.addEventListener("resize",x),()=>h?.removeEventListener("resize",x)},[n]),Pt.useEffect(()=>{if(!n||!l.current)return;l.current=false;let x=s.current;x&&c1(x);},[n]);let y=x=>{x.key!=="Escape"||x.defaultPrevented||(x.preventDefault(),g(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[aa]:"",children:[jsxRuntime.jsx("button",{ref:a,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?c:void 0,"aria-label":u,title:u,...n?{"data-active":""}:{},onMouseDown:B,onClick:()=>r(x=>!x),onKeyDown:x=>{x.key==="ArrowDown"&&(x.preventDefault(),l.current=true,r(true));},children:re(Du)}),n?jsxRuntime.jsx(ku.Provider,{value:m,children:jsxRuntime.jsx("div",{ref:s,id:c,role:"dialog","aria-label":u,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",...p?{"data-anchor":p.anchor}:{},style:p?{left:p.left,right:"auto",maxInlineSize:p.maxWidth}:void 0,onKeyDown:y,children:e.map(x=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":x.label??o(x.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:x.label??o(x.labelKey)}),x.children]},x.id))})}):null]})}function u1(e){if(!Pt.isValidElement(e))return false;let t=e.type;return (typeof t=="function"||typeof t=="object")&&t.docxToolbarGroup===true}function M0(e,t,o,n){let r=new Map,i=new Map,a=new Map,s=[];for(let l of Pt.Children.toArray(e)){if(u1(l)){a.delete(l.props.id),a.set(l.props.id,l.props);continue}let c=t(l);if(c&&o(c))r.set(c,l);else if(c&&n(c))i.set(c,l);else {if(c&&Pt.isValidElement(l)&&l.props.hidden===true)continue;s.push(l);}}return {overrides:r,tableOverrides:i,groups:[...a.values()],appended:s}}function Ul(e,t){return e.label!==void 0?e.label:e.labelKey!==void 0?t(e.labelKey):e.id}function Iu(e){let t=X();return e.hidden?null:jsxRuntime.jsx("div",{role:"group","aria-label":Ul(e,t),className:`docx-toolbar__group${e.className?` ${e.className}`:""}`,"data-toolbar-host-group":e.id,children:e.children})}Iu.docxToolbarGroup=true;function Ba(e){return e.hidden?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.children})}Ba.docxToolbarSlot=true;var _u=Pt.createContext("bar");function R0(){return Pt.useContext(_u)}var Vl="review.addComment";function h1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=Pt.useContext(xt),a=X(),{isEnabled:s,reason:l}=Gi(a),c=Rr();if(t||(i?.mounted??0)===0)return null;let d=J(Vl),f=a(d?.labelKey??Vl),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Vl,disabled:!s,...s?{}:{"data-disabled":""},"aria-label":f,title:l??f,onMouseDown:B,onClick:()=>{i?.requestCommentDraft()&&c(false);}};return n?jsxRuntime.jsx(j,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??re(d?.paths)})}var Nu=Object.assign(h1,{docxSlot:Vl});var I0=new Set;function Gl(e){!jt()||I0.has(e)||(I0.add(e),console.warn(`[docx-editor] ${e}`));}function _0(e,t,o){Gl(`Toolbar.Group "${e}" has after="${t}", but no group has that id. The group is placed after every other group. Known ids: ${o.join(", ")}.`);}function N0(e,t){Gl(`Toolbar.Group "${e}" is a built-in group, so its ${t} is ignored. A built-in group keeps its own label and place in the bar.`);}function L0(e){Gl(`Toolbar.Group "${e}" uses the id of the contextual table group, so it is ignored. Give the group another id.`);}function F0(e,t){Gl(t?`Toolbar slot "${e}" is not part of the preset arrangement, so its content is appended after the groups. Put it in a Toolbar.Group to give it a place.`:`"${e}" is not a toolbar slot id. Its content is appended after the groups. Use a ChromeSlotId such as "text.bold".`);}var Fu=[{value:"inline",labelKey:"imageWrap.menu.inLineWithText",iconName:"wrap_text"},{value:"square",labelKey:"imageWrap.square",iconName:"crop_square"},{value:"squareLeft",labelKey:"imageWrap.menu.squareLeft",iconName:"format_image_left"},{value:"squareRight",labelKey:"imageWrap.menu.squareRight",iconName:"format_image_right"},{value:"tight",labelKey:"imageWrap.tight",iconName:"wrap_text"},{value:"through",labelKey:"imageWrap.through",iconName:"wrap_text"},{value:"topAndBottom",labelKey:"imageWrap.topAndBottom",iconName:"vertical_align_center"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function Yl({className:e,hidden:t,asChild:o,children:n}){let{t:r}=N(),i=X(),{execute:a,value:s,isEnabled:l,disabledReason:c}=Ta("image.wrap"),[d,f]=Pt.useState(false),u=Pt.useRef(null),g=Pt.useRef(null),m=Pt.useRef(null),p=Pt.useId(),v=Pt.useMemo(()=>Fu.find(C=>C.value===s)??Fu[0],[s]),y=J("image.wrap"),x=i(y?.labelKey??"formattingBar.imageWrap");Pt.useEffect(()=>{if(!d)return;let C=T=>{let R=u.current;R&&T.target instanceof Node&&R.contains(T.target)||f(false);},P=T=>{T.key==="Escape"&&(T.preventDefault(),f(false),g.current?.focus());};return document.addEventListener("mousedown",C,true),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C,true),document.removeEventListener("keydown",P);}},[d]);let h=Pt.useCallback(C=>{f(false),a(C);},[a]);if(t)return null;let b=r("imageWrap.tooltipPrefix",{label:r(v.labelKey)}),S={type:"button",ref:g,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!l,...l?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?p:void 0,"aria-label":x,title:c??b,onMouseDown:B,onClick:()=>f(C=>!C)};return jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__image-wrap",children:[o?jsxRuntime.jsx(j,{...S,children:n}):jsxRuntime.jsx("button",{...S,children:n??re(y?.paths)}),d?jsxRuntime.jsx("div",{ref:m,id:p,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:C=>C.stopPropagation(),children:Fu.map(C=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":s===C.value,...s===C.value?{"data-active":""}:{},onMouseDown:B,onClick:()=>h(C.value),children:r(C.labelKey)},C.value))}):null]})}Yl.docxSlot="image.wrap";var Za=Object.assign(Yl,{docxSlot:"image.wrap"});var Dr="table.insert";function R1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=F(),{isEnabled:a,disabledReason:s}=ie(Dr),l=X(),[c,d]=Pt.useState(false),f=Pt.useRef(null),u=Pt.useRef(null),g=Pt.useRef(null),m=Pt.useId(),p=Rr();Pt.useEffect(()=>{let S=f.current?.ownerDocument;if(!c||!S)return;let C=P=>{let T=f.current;T&&P.target instanceof Node&&T.contains(P.target)||d(false);};return S.addEventListener("mousedown",C,true),()=>S.removeEventListener("mousedown",C,true)},[c]),Pt.useEffect(()=>{c&&f.current?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();},[c]);let v=c&&a;Pt.useLayoutEffect(()=>{let S=g.current,C=f.current,P=C?.ownerDocument.defaultView;if(!v||!S||!C||!P||C.closest(".docx-toolbar__more-panel"))return;let T=C.getBoundingClientRect(),R=editor.toolbarPopupLeft({anchorLeft:T.left,popupWidth:S.offsetWidth,viewportWidth:P.innerWidth});S.style.left=`${R-T.left}px`;},[v]);let y=Pt.useCallback(()=>{d(false),p(false);},[p]);if(t)return null;let x=J(Dr),h=l(x?.labelKey??Dr),b={ref:u,type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Dr,disabled:!a,...a?{}:{"data-disabled":""},...v?{"data-active":""}:{},"aria-haspopup":"grid","aria-expanded":v,"aria-controls":v?m:void 0,"aria-label":h,title:s??h,onMouseDown:B,onClick:()=>{if(!c){d(true);return}d(false),i?.focus();},onKeyDown:S=>{S.key==="ArrowDown"&&(S.preventDefault(),d(true));}};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__table-insert",children:[n?jsxRuntime.jsx(j,{...b,children:r}):jsxRuntime.jsx("button",{...b,children:o??r??re(x?.paths)}),v?jsxRuntime.jsx("div",{ref:g,id:m,className:"docx-toolbar__menu docx-toolbar__table-insert-menu",onBlur:S=>{let C=S.relatedTarget;C instanceof Node&&!f.current?.contains(C)&&d(false);},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),d(false),u.current?.focus());},children:jsxRuntime.jsx(ol,{slot:Dr,label:l("toolbar.insertTable"),onInserted:y})}):null]})}var Au=Object.assign(R1,{docxSlot:Dr});function Ge(e){return Object.assign(o=>jsxRuntime.jsx(sn,{slotId:e,...o}),{docxSlot:e})}var A0=Ge("history.undo"),O0=Ge("history.redo"),B0=Ge("text.bold"),Z0=Ge("text.italic"),q0=Ge("text.underline"),K0=Ge("text.strike"),W0=Ge("format.clear"),z0=Ge("script.super"),$0=Ge("script.sub"),U0=Ge("alignment.left"),V0=Ge("alignment.center"),G0=Ge("alignment.right"),j0=Ge("alignment.justify"),Y0=Ge("direction.ltr"),X0=Ge("direction.rtl"),J0=Ge("list.bullet"),Q0=Ge("list.numbered"),eh=Ge("list.outdent"),th=Ge("list.indent");var oh=Ge("review.comments");function N1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=F(),{openAtCaret:a}=Fc(),s=editor.chromeProbeForSlot("text.link"),l=i&&s?i.can(s):null,c=l?.ok===true,{t:d}=N(),f=i18n.localizeDisabledReason(l&&!l.ok?l.reason:null,d),u=X();if(t)return null;let g=J("text.link"),m=u(g?.labelKey??"text.link"),p={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!c,...c?{}:{"data-disabled":""},"aria-label":m,title:f??m,onMouseDown:B,onClick:()=>a()};return n?jsxRuntime.jsx(j,{...p,children:r}):jsxRuntime.jsx("button",{...p,children:o??r??re(g?.paths)})}var Ou=Object.assign(N1,{docxSlot:"text.link"});function L1({className:e,hidden:t}){let o=F(),{onSave:n}=Pt.useContext(ln),r=X();if(t)return null;let i=J("file.save"),a=r(i?.labelKey??"file.save"),s=!o||!n;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:s,...s?{"data-disabled":""}:{},"aria-label":a,title:a,onMouseDown:B,onClick:()=>n?.(),children:re(i?.paths)})}var Bu=Object.assign(L1,{docxSlot:"file.save"});function En({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}var A1=e=>({zoom:e.zoom,mode:e.zoomMode}),O1=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,rh={type:"fixed"};function Zu(){let e=F(),{zoom:t,mode:o}=O(A1,O1),n=Pt.useCallback(i=>{e?.setZoom(i);},[e]),r=Pt.useCallback(i=>{e?.setZoomMode(i);},[e]);return Pt.useMemo(()=>{let i=o??rh,a=Fa(t,"out"),s=Fa(t,"in");return {zoom:t,mode:i,isFit:i.type==="fit",setZoom:n,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(rh),n(1);},zoomIn:()=>s!==null&&n(s),zoomOut:()=>a!==null&&n(a),canZoomIn:!!e&&s!==null,canZoomOut:!!e&&a!==null,levels:Bl}},[e,t,o,n,r])}var Wa=2,za=3276,Ka=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],K1=e=>e.formatting?.fontSizePt??null;function lh(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function sh(e,t,o){for(let n=t.length-1;n>=0;n-=1)if(t[n]<e)return t[n];return Math.max(e-1,o)}function dh(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:B,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:B,onClick:e.onIncrease,children:"+"})]})}function W1(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let o=Number(t);if(!Number.isFinite(o))return null;let n=Math.round(o*2);return n<Wa||n>za?null:n}function z1({className:e,hidden:t}){let o=F(),n=O(K1),{isEnabled:r,disabledReason:i}=ie("font.size"),a=X(),[s,l]=Pt.useState(false),[c,d]=Pt.useState(null),f=Pt.useRef(null);fo(f,s,()=>l(false));let u=Pt.useRef(null),g=Pt.useId(),m=Pt.useCallback(C=>{if(!o)return;let P=editor.commandForSlotValue("font.size",C);P&&o.can(P).ok&&o.exec(P);},[o]),p=Pt.useCallback(C=>{m(Math.min(za,Math.max(Wa,Math.round(C*2))));},[m]),v=Pt.useCallback(C=>{l(false),d(null),u.current?.blur(),C&&o?.focus();},[o]);if(Pt.useEffect(()=>{if(!s)return;let C=P=>{let T=f.current;T&&P.target instanceof Node&&T.contains(P.target)||(l(false),d(null));};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]),t)return null;let y=r&&n!==null,x=n===null?"\u2014":String(Math.round(n*2)/2),h=c??x,b=n===null?null:Math.round(n*2)/2,S=()=>{if(c===null)return;let C=W1(c);C!==null&&m(C);};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(dh,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:u,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:h,disabled:!r,role:"combobox","aria-expanded":s,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),"aria-controls":s?g:void 0,autoComplete:"off",onChange:C=>{d(C.target.value),l(true);},onFocus:C=>{C.target.select(),l(true);},onClick:()=>l(true),onKeyDown:C=>{C.key==="Enter"?(C.preventDefault(),S(),v(true)):C.key==="Escape"?(C.preventDefault(),v(true)):(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),l(true),n!==null&&p(C.key==="ArrowDown"?sh(n,Ka,Wa/2):lh(n,Ka,za/2)));},onBlur:()=>{S(),d(null);}}),canDecrease:y&&Math.round(n*2)>Wa,canIncrease:y&&Math.round(n*2)<za,onDecrease:()=>p(sh(n??0,Ka,Wa/2)),onIncrease:()=>p(lh(n??0,Ka,za/2))}),s&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox",tabIndex:0,"aria-label":a("fontSize.listLabel"),id:g,children:Ka.map(C=>{let P=b===C;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":P,...P?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>{p(C),v(true);},children:C},C)})}):null]})}var Wu=Object.assign(z1,{docxSlot:"font.size"});function $1({className:e,hidden:t}){let o=F(),{zoom:n,isFit:r,mode:i,setZoom:a,setMode:s,zoomIn:l,zoomOut:c,canZoomIn:d,canZoomOut:f,levels:u}=Zu(),g=X(),[m,p]=Pt.useState(false),v=Pt.useRef(null);fo(v,m,()=>p(false)),Pt.useEffect(()=>{if(!m)return;let C=P=>{let T=v.current;T&&P.target instanceof Node&&T.contains(P.target)||p(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[m]);let y=Pt.useCallback(C=>{v.current?.querySelector("[aria-haspopup]")?.focus(),p(false),a(C);},[a]),x=Pt.useCallback(C=>{v.current?.querySelector("[aria-haspopup]")?.focus(),p(false),s(C==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[s]);if(t)return null;let h=`${Math.round(n*100)}%`,b=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),S=editor.sameZoomMode(i,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:v,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(dh,{className:e,groupLabel:g("zoom.zoomLevel"),decreaseLabel:g("zoom.zoomOut"),increaseLabel:g("zoom.zoomIn"),middle:jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--menu",disabled:!o,"aria-haspopup":"listbox","aria-expanded":m,"aria-label":`${g("zoom.zoomLevel")}: ${h}`,onMouseDown:B,onClick:()=>p(C=>!C),children:[h,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:f,canIncrease:d,onDecrease:c,onIncrease:l}),m?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox",tabIndex:0,"aria-label":g("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":b,...b?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>x("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>x("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),u.map(C=>{let P=!r&&Math.abs(C-n)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":P,...P?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>y(C),children:`${Math.round(C*100)}%`},C)})]}):null]})}var zu=Object.assign($1,{docxSlot:"zoom.level"});function wn(e,t,o,n=false){let r=Ye(),i=Pt.useRef(r);i.current=r,Pt.useEffect(()=>{e&&n&&t(false);},[e,n,t]),Pt.useEffect(()=>{let a=o.current;if(!e||n||!a)return;let s=a.ownerDocument,l=u=>a.contains(u),c=u=>{u.composedPath().includes(a)||t(false);},d=editor.listenForPopupEscape({popup:a,contains:l,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current],close:u=>{t(false),u&&a.querySelector("[aria-haspopup]")?.focus();}}),f=editor.listenForPopupFocusLeave({popup:a,contains:l,close:()=>t(false)});return s.addEventListener("mousedown",c),()=>{s.removeEventListener("mousedown",c),d(),f();}},[e,n,t,o]);}var X1=[1,1.15,1.5,2,2.5,3],fh=10,gh=0,J1=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Q1=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function eM({className:e,hidden:t}){let o=F(),n=O(J1,Q1),{isEnabled:r,disabledReason:i}=ie("list.lineSpacing"),a=ie("paragraph.dialog"),s=y0(),l=X(),[c,d]=Pt.useState(false),f=Pt.useRef(null),u=Pt.useRef(null);wn(c,d,f,t);let g=Pt.useCallback(h=>{if(d(false),!o)return;let b=editor.commandForSlotValue("list.lineSpacing",h);b&&o.can(b).ok&&o.exec(b);},[o]),m=Pt.useCallback((h,b)=>{if(d(false),!o)return;let S={type:"setParagraphSpacing",[h]:b};o.can(S).ok&&o.exec(S);},[o]);if(t)return null;let p=J("list.lineSpacing"),v=(n.spaceBeforePt??0)>0,y=(n.spaceAfterPt??0)>0,x=n.lineSpacing?.rule==="multiple"?n.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{ref:u,type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":c,"aria-label":l("lineSpacing.label"),title:i??l("lineSpacing.label"),onMouseDown:B,onClick:()=>d(h=>!h),children:[re(p?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),c&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[X1.map(h=>{let b=x===h;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":b,...b?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>g(h),children:Number.isInteger(h*10)?h.toFixed(1):h.toFixed(2)},h)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item","data-slot":"paragraph.dialog",disabled:!a.isEnabled,title:a.disabledReason??void 0,onMouseDown:B,onClick:()=>{d(false),s?.open(u.current);},children:l("lineSpacing.options")}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>m("beforePt",v?gh:fh),children:l(v?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>m("afterPt",y?gh:fh),children:l(y?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Uu=Object.assign(eM,{docxSlot:"list.lineSpacing"});var nM=["alignment.left","alignment.center","alignment.right","alignment.justify"];function rM({className:e,hidden:t}){let o=ie("alignment.left"),n=ie("alignment.center"),r=ie("alignment.right"),i=ie("alignment.justify"),a=X(),[s,l]=Pt.useState(false),c=Pt.useRef(null);if(wn(s,l,c,t),t)return null;let d=[o,n,r,i],f=nM.map((p,v)=>({slot:p,control:J(p),state:d[v]})),u=f.find(p=>p.state.isActive)??f[0],g=f.some(p=>p.state.isEnabled),m=a(u.control?.labelKey??u.slot);return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":s,"aria-label":m,title:g?m:u.state.disabledReason??m,onMouseDown:B,onClick:()=>l(p=>!p),children:[re(u.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:f.map(p=>{let v=a(p.control?.labelKey??p.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":p.slot,disabled:!p.state.isEnabled,...p.state.isActive?{"data-active":""}:{},"aria-pressed":p.state.isActive,"aria-label":v,title:p.state.disabledReason??v,onMouseDown:B,onClick:()=>{p.state.execute(),l(false);},children:re(p.control?.paths)},p.slot)})}):null]})}var Jl=Object.assign(rM,{docxSlot:"alignment"});function Gu(e){let{label:t,icon:o,active:n,disabled:r,disabledReason:i,onSelect:a,asChild:s,className:l,children:c}=e,d=R0(),f=Rr();if(d==="panel"&&!s)return jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__more-command${l?` ${l}`:""}`,disabled:r,...n?{"data-active":""}:{},...n!==void 0?{"aria-pressed":n}:{},...r&&i?{title:i}:{},onMouseDown:g=>B(g),onClick:g=>{a?.(),f(g.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:o??c}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:t})]});let u={type:"button",className:`docx-toolbar__button${l?` ${l}`:""}`,disabled:r,...n?{"data-active":""}:{},...r?{"data-disabled":""}:{},...n!==void 0?{"aria-pressed":n}:{},"aria-label":t,title:r?i??t:t,onMouseDown:g=>B(g),onClick:r?void 0:a};return s?jsxRuntime.jsx(j,{...u,children:c}):jsxRuntime.jsx("button",{...u,children:o??c})}var uM=Object.freeze([]),pM=e=>e.formatting?.fontFamily??null,mM=e=>e;function ts(){let e=F(),t=O(pM),o=O(mM),n=Pt.useMemo(()=>e&&!o.isLoading?e.getAvailableFonts():uM,[e,o]),{isEnabled:r}=ie("font.family"),i=Pt.useCallback(a=>{if(!e)return;let s=editor.commandForSlotValue("font.family",a);s&&e.can(s).ok&&e.exec(s);},[e]);return Pt.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var yh=Pt.createContext(null);function Yu(){return Pt.useContext(yh)}function Xu({asChild:e,className:t,children:o}){let n=Yu(),r=X();if(!n)return null;let i=r(J("font.family")?.labelKey??"font.family"),a={onClick:()=>n.setOpen(!n.open),onMouseDown:B,disabled:!n.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,"aria-label":o!==void 0?void 0:`${i}: ${n.value??"\u2014"}`,title:i},s=o??jsxRuntime.jsx("span",{children:n.value??"\u2014"});return e?jsxRuntime.jsx(j,{...a,children:s}):jsxRuntime.jsx("button",{type:"button",...a,children:s})}Xu.docxToolbarPart=true;var fM=new Map([["arial","sansSerif"],["calibri","sansSerif"],["helvetica","sansSerif"],["verdana","sansSerif"],["open sans","sansSerif"],["roboto","sansSerif"],["times new roman","serif"],["georgia","serif"],["cambria","serif"],["garamond","serif"],["courier new","monospace"],["consolas","monospace"]]),gM=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function xh({asChild:e,className:t,children:o}){let n=Yu(),r=X(),[i,a]=Pt.useState("");if(Pt.useEffect(()=>{n?.open||a("");},[n?.open]),!n||!n.open)return null;let s={role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`},l;return o!==void 0?l=o:l=gM.map(d=>({...d,fonts:n.options.filter(f=>f.toLowerCase().includes(i.toLowerCase())&&(fM.get(f.toLowerCase())??"other")===d.category)})).filter(d=>d.fonts.length>0).map((d,f)=>jsxRuntime.jsxs("div",{role:"group",children:[f>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator","aria-hidden":"true"}):null,d.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(d.labelKey)}):null,d.fonts.map(u=>jsxRuntime.jsx(Ch,{value:u},u))]},d.category)),e?jsxRuntime.jsx(j,{...s,children:l}):o!==void 0?jsxRuntime.jsx("div",{...s,children:l}):jsxRuntime.jsxs("div",{className:s.className,children:[jsxRuntime.jsx("input",{type:"search",className:"docx-toolbar__font-search","aria-label":r("font.search"),placeholder:r("font.search"),value:i,onChange:c=>a(c.target.value)}),jsxRuntime.jsx("div",{role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:"docx-toolbar__font-options",children:l})]})}function Ch({value:e,asChild:t,className:o,children:n}){let r=F(),i=Yu();if(!i)return null;let a=i.value===e,s={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:B,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__font-family-item${o?` ${o}`:""}`},l=n??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(j,{...s,children:l}):jsxRuntime.jsxs("button",{type:"button",...s,children:[l,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function hM({hidden:e,asChild:t,className:o,children:n}){let r=ts(),[i,a]=Pt.useState(false),s=Pt.useRef(null);fo(s,i,()=>a(false)),Pt.useEffect(()=>{if(!i)return;let f=u=>{let g=s.current;g&&u.target instanceof Node&&g.contains(u.target)||a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]);let l=Pt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__font-family${o?` ${o}`:""}`,"data-slot":"font.family"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xu,{}),jsxRuntime.jsx(xh,{})]});return jsxRuntime.jsx(yh.Provider,{value:l,children:t?jsxRuntime.jsx(j,{...c,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...c,children:d})})}var Ju=Object.assign(hM,{docxSlot:"font.family",Trigger:Xu,Content:xh,Item:Ch});var vM={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},yM=new Set(["Title","Heading1","Heading2","Heading3"]),xM={Subtitle:"666666"},CM="#4a6c8c";function Th(e){let t=vM[e.styleId],n={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??yM.has(e.styleId))&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic");let r=e.color??xM[e.styleId];return r?n.color=`#${r}`:e.styleId.startsWith("Heading")&&(n.color=CM),n}var TM=/^heading ([1-9])$/;function Qu(e,t){let o=e||t,n=TM.exec(o);return n?`Heading ${n[1]}`:o}function Ph(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:Qu(t.name,t.styleId),priority:99}))}function kM(e){let t=e.fontSizePt;return {...e.fontFamily?{fontFamily:e.fontFamily}:{},...t?{fontSize:`${Math.min(Math.max(t,9),20)}px`}:{},...e.bold?{fontWeight:700}:{},...e.italic?{fontStyle:"italic"}:{},...e.color?{color:`#${e.color}`}:{}}}var IM=Object.freeze([]),_M=e=>e.formatting?.styleId??null,NM=e=>e;function os(){let e=F(),t=O(_M),o=O(NM),n=Pt.useMemo(()=>e&&!o.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:Qu(a.name,a.styleId),preview:a.preview})):IM,[e,o]),{isEnabled:r}=ie("styles.style"),i=Pt.useCallback(a=>{if(!e)return;let s=editor.commandForSlotValue("styles.style",a);s&&e.can(s).ok&&e.exec(s);},[e]);return Pt.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var Sh=Pt.createContext(null);function tp(){return Pt.useContext(Sh)}function op({asChild:e,className:t,children:o}){let n=tp(),r=X();if(!n)return null;let i=J("styles.style"),a=r(i?.labelKey??"styles.style"),s={onClick:()=>n.setOpen(!n.open),onMouseDown:B,disabled:!n.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,title:a},l=n.options.find(d=>d.styleId===n.value),c=o??(n.value===null?jsxRuntime.jsx("span",{children:i?.valueKey?r(i.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:l?.name??n.value}));return e?jsxRuntime.jsx(j,{...s,children:c}):jsxRuntime.jsx("button",{type:"button",...s,children:c})}op.docxToolbarPart=true;function Eh({asChild:e,className:t,children:o}){let n=X(),r=tp();if(!r||!r.open)return null;let i={role:"listbox",tabIndex:0,"aria-label":n("styles.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`},a=o??r.options.map(s=>jsxRuntime.jsx(wh,{value:s.styleId},s.styleId));return e?jsxRuntime.jsx(j,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function wh({value:e,asChild:t,className:o,children:n}){let r=F(),i=tp();if(!i)return null;let a=i.value===e,s=i.options.find(d=>d.styleId===e),l={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:B,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__style-item${o?` ${o}`:""}`},c=n??jsxRuntime.jsx("span",{style:s?kM(s.preview):void 0,children:s?.name??e});return t?jsxRuntime.jsx(j,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function LM({hidden:e,asChild:t,className:o,children:n}){let r=os(),[i,a]=Pt.useState(false),s=Pt.useRef(null);fo(s,i,()=>a(false)),Pt.useEffect(()=>{if(!i)return;let f=u=>{let g=s.current;g&&u.target instanceof Node&&g.contains(u.target)||a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]);let l=Pt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__style${o?` ${o}`:""}`,"data-slot":"styles.style"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(op,{}),jsxRuntime.jsx(Eh,{})]});return jsxRuntime.jsx(Sh.Provider,{value:l,children:t?jsxRuntime.jsx(j,{...c,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...c,children:d})})}var np=Object.assign(LM,{docxSlot:"styles.style",Trigger:op,Content:Eh,Item:wh});function Rh(e,t){let o=e;return Object.assign(({className:r,hidden:i,icon:a,asChild:s,children:l})=>{let{isEnabled:c,disabledReason:d}=ie(o),f=Qt(),u=t==="showAll"?f.showAll:f.formFill,g=X();if(i)return null;let m=J(o),p=g(m?.labelKey??e),v={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!c,...c?{}:{"data-disabled":""},...u?{"data-active":""}:{},"aria-pressed":u,"aria-label":p,title:d??p,onMouseDown:B,onClick:()=>{t==="showAll"?f.toggleShowAll():f.toggleFormFill();}};return s?jsxRuntime.jsx(j,{...v,children:l}):jsxRuntime.jsx("button",{...v,children:a??l??re(m?.paths)})},{docxSlot:o})}function HM({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=ft.inspector,{isEnabled:a,disabledReason:s}=ie(i),{inspectorOpen:l,openInspector:c}=Qt(),d=X();if(t)return null;let f=J(i),u=d(f?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":ft.inspector,disabled:!a,...a?{}:{"data-disabled":""},...l?{"data-active":""}:{},"aria-pressed":l,"aria-label":u,title:s??u,onMouseDown:B,onClick:()=>c()};return n?jsxRuntime.jsx(j,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:o??r??re(f?.paths)})}function AM({className:e,hidden:t,icon:o,asChild:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:s}=Qt(),l=X();if(t)return null;let c=ft.remove,d=J(c),f=l(d?.labelKey??"contentControl.remove"),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":ft.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":f,title:a??f,onMouseDown:B,onClick:()=>{s();}};return n?jsxRuntime.jsx(j,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??re(d?.paths)})}var ns=Rh(ft.showAll,"showAll"),rs=Rh(ft.formFill,"formFill"),as=Object.assign(AM,{docxSlot:ft.remove}),is=Object.assign(HM,{docxSlot:ft.inspector}),Dh={[ft.showAll]:ns,[ft.formFill]:rs,[ft.inspector]:is,[ft.remove]:as};function rp(e,t){let o=F(),n=Pt.useRef(t);n.current=t,Pt.useEffect(()=>{if(!o)return;let r=((...i)=>{n.current(...i);});return o.on(e,r)},[o,e]);}var zM=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],ip=Pt.createContext(null);function Hh(){let e=Pt.useContext(ip);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function UM(e,t){let o=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",i=o?`${r}|${o.rows}|${o.columns}|${o.rowIndex}|${o.columnIndex}`:"",a=t.selection,s=a?`${a.from&&"paraId"in a.from?a.from.paraId:""}|${a.to&&"paraId"in a.to?a.to.paraId:""}|${t.selectionCollapsed}`:"",l=e?.getTableCellSelection()??null,c=l?`${l.tableId}|${l.rows.from}-${l.rows.to}|${l.columns.from}-${l.columns.to}|${l.cellIds.join(",")}`:"";return {tableKey:i,selectionKey:s,cellSelectionKey:c,editable:t.editable,editingMode:t.editingMode??"editing"}}function VM(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function GM(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var Lh={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function jM(e,t){let o={};for(let n of zM){let r=editor.tableChromeToolbarState(e,n,t);o[n]={enabled:r.enabled,disabledReason:r.disabledReason};}return o}function lp({children:e}){let t=F(),[o,n]=Pt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=Pt.useState(Lh);Pt.useEffect(()=>(()=>{}),[]);let a=O(Pt.useCallback(u=>({table:u.table,editable:u.editable,editingMode:u.editingMode??"editing",headParagraphId:u.selection?.to&&"paraId"in u.selection.to?u.selection.to.paraId:u.selection?.from&&"paraId"in u.selection.from?u.selection.from.paraId:""}),[]),VM,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),s=Pt.useCallback(()=>{if(!t){i(Lh);return}let u=UM(t,t.snapshot());i(g=>GM(g,u)?g:u);},[t]);Pt.useEffect(()=>{s();},[s,a]),rp("selectionChange",Pt.useCallback(()=>{s();},[s]));let l=r.tableKey!=="",c=Pt.useMemo(()=>t?jM(t,o):{},[t,o,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Pt.useCallback((u,g)=>{if(!t)return;let{result:m,nextDraft:p}=editor.runTableChromeCommand(t,u,g,o);m.ok&&p&&n(p);},[t,o]),f=Pt.useMemo(()=>({visible:l,draft:o,setDraft:n,slotState:u=>c[u]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[l,o,c,d]);return jsxRuntime.jsx(ip.Provider,{value:f,children:e})}function YM(){let e=Pt.useContext(ip);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ss(e){let t=YM(),o=t.slotState(e);return Pt.useMemo(()=>({visible:t.visible,enabled:o.enabled,disabledReason:o.disabledReason,draft:t.draft,apply:n=>t.apply(e,n)}),[t,e,o])}function cs(e){(editor.editorInstanceScope(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function ds({enabled:e,disabledReason:t,ariaLabel:o}){let{t:n}=N(),r=i18n.localizeDisabledReason(t,n),i=Pt.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:B,"aria-label":o,...a?{"aria-describedby":a}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:a&&r?jsxRuntime.jsx("span",{id:i,className:"docx-editor-sr-only",children:r}):null}}var tR='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function Oh(e,t,o,n){Pt.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll(tR)].filter(c=>c.closest('[role="menu"]')===r);queueMicrotask(()=>{let c=a();(c.find(f=>f.hasAttribute("data-selected")||f.hasAttribute("data-active"))??c[0])?.focus();});let l=c=>{if(c.defaultPrevented||c.isComposing||c.keyCode===229)return;let d=a();if(c.key==="Escape"){c.preventDefault(),t(false),i?.focus();return}if(c.key==="ArrowDown"){c.preventDefault(),Ht(d,document.activeElement,1);return}if(c.key==="ArrowUp"){c.preventDefault(),Ht(d,document.activeElement,-1);return}if(c.key==="Home"){c.preventDefault(),At(d,"first");return}if(c.key==="End"){c.preventDefault(),At(d,"last");return}if(c.key==="Enter"||c.key===" "){let f=document.activeElement;f instanceof HTMLElement&&d.includes(f)&&(c.preventDefault(),f.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,o,n]);}function Bh(e,t,o,n){Pt.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(l=>l.closest('[role="dialog"]')===r);queueMicrotask(()=>{a()[0]?.focus();});let s=l=>{if(l.key==="Escape"){l.preventDefault(),t(false),i?.focus();return}if(l.key==="Enter"||l.key===" "){let c=document.activeElement,d=a();c instanceof HTMLElement&&d.includes(c)&&(l.preventDefault(),c.click());}};return r.addEventListener("keydown",s),()=>r.removeEventListener("keydown",s)},[e,t,o,n]);}function zh(e,t,o){if(e)return n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),o(!t));}}function sR(e){return re(editor.tableChromeIconPaths(e))}function $h(){return Pt.createContext(null)}function Co(e){let t=Pt.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function cp(e,t,o){let n=$h();function r({hidden:s,asChild:l,className:c,children:d}){let{visible:f,enabled:u,disabledReason:g,draft:m,apply:p}=ss(e),[v,y]=Pt.useState(false),x=Pt.useRef(null),h=Pt.useRef(null);wn(v,y,x,s||!f);let b=Pt.useMemo(()=>({open:v,setOpen:y,enabled:u,disabledReason:g,apply:p,draft:m,triggerRef:h}),[v,u,g,p,m]);if(s||!f)return null;let S={className:`${t}${c?` ${c}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},C=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(a,{})]});return jsxRuntime.jsx(n.Provider,{value:b,children:l?jsxRuntime.jsx(j,{...S,ref:x,children:C}):jsxRuntime.jsx("div",{ref:x,...S,children:C})})}function i({asChild:s,className:l,children:c}){let{open:d,setOpen:f,enabled:u,disabledReason:g,triggerRef:m}=Co(n),p=X(),v=J(e),y=p(v?.labelKey??o),{shared:x,reasonNode:h}=ds({enabled:u,disabledReason:g,ariaLabel:y}),b={...x,ref:m,className:`docx-toolbar__button docx-table-chrome__trigger${l?` ${l}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:u?()=>f(!d):void 0,...s?{tabIndex:u?0:-1,role:"button",onKeyDown:zh(u,d,f)}:{}},S=c??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re(v?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...b,children:S}),h]}):jsxRuntime.jsxs("button",{...b,children:[S,h]})}i.docxToolbarPart=true;function a({asChild:s,className:l,children:c}){let{open:d,setOpen:f,enabled:u,triggerRef:g}=Co(n),m=X(),p=Pt.useRef(null);if(Oh(d&&u,f,p,g),!d||!u)return null;let v=J(e),y=m(v?.labelKey??o),x={ref:p,role:"menu","aria-label":y,className:`docx-table-chrome__panel${l?` ${l}`:""}`,onMouseDown:B};return s?jsxRuntime.jsx(j,{...x,children:c}):jsxRuntime.jsx("div",{...x,children:c})}return {Root:r,Trigger:i,Content:a,Ctx:n}}var Va=cp("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function Uh({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(Va.Ctx),s=X(),l=editor.TABLE_BORDER_TARGET_OPTIONS.find(u=>u.value===e);if(!l)return null;let c=l.value==="none"?false:l.value===a.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":c,"data-value":l.value,className:`docx-table-chrome__target-btn${o?` ${o}`:""}`,...c?{"data-active":""}:{},"aria-label":s(l.labelKey),title:s(l.labelKey),onMouseDown:B,onClick:()=>{i(false),r(l.value);}},f=n??sR(l.icon);return t?jsxRuntime.jsx(j,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function Vh(e){let{children:t}=e;return jsxRuntime.jsx(Va.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(o=>jsxRuntime.jsx(Uh,{value:o.value},o.value))})})}function cR(e){let{children:t}=e,o=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Va.Trigger,{}),jsxRuntime.jsx(Vh,{})]});return jsxRuntime.jsx(Va.Root,{...e,children:o})}var Ja=Object.assign(cR,{docxSlot:"table.borderTarget",Trigger:Va.Trigger,Content:Vh,Item:Uh}),Ga=cp("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Gh({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(Ga.Ctx),s=X(),l=editor.TABLE_BORDER_STYLE_OPTIONS.find(u=>u.value===e);if(!l)return null;let c=l.value===a.spec.style,d={type:"button",role:"menuitemradio","aria-checked":c,...c?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:B,onClick:()=>{i(false),r(l.value);}},f=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${l.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(l.labelKey)})]});return t?jsxRuntime.jsx(j,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function jh(e){let{children:t}=e;return jsxRuntime.jsx(Ga.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(o=>jsxRuntime.jsx(Gh,{value:o.value},o.value))})}function dR(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ga.Trigger,{}),jsxRuntime.jsx(jh,{})]});return jsxRuntime.jsx(Ga.Root,{...e,children:t})}var Qa=Object.assign(dR,{docxSlot:"table.borderStyle",Trigger:Ga.Trigger,Content:jh,Item:Gh}),ja=cp("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function Yh({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(ja.Ctx),s=X(),l=Number(e),c=editor.TABLE_BORDER_WIDTH_OPTIONS.find(g=>g.size===l);if(!c)return null;let d=c.size===a.spec.size,f={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:B,onClick:()=>{i(false),r(c.size);}},u=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${c.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(c.labelKey)})]});return t?jsxRuntime.jsx(j,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}function Xh(e){let{children:t}=e;return jsxRuntime.jsx(ja.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(o=>jsxRuntime.jsx(Yh,{value:String(o.size)},o.size))})}function uR(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ja.Trigger,{}),jsxRuntime.jsx(Xh,{})]});return jsxRuntime.jsx(ja.Root,{...e,children:t})}var ei=Object.assign(uR,{docxSlot:"table.borderWidth",Trigger:ja.Trigger,Content:Xh,Item:Yh});function Jh(e,t,o){let n=o?.defaultHex??"FF0000",r=$h();function i({hidden:d,asChild:f,className:u,children:g}){let{visible:m,enabled:p,disabledReason:v,draft:y,apply:x}=ss(e),[h,b]=Pt.useState(false),[S,C]=Pt.useState(n),P=Pt.useRef(null),T=Pt.useRef(null);wn(h,b,P,d||!m);let R=Pt.useMemo(()=>({open:h,setOpen:b,enabled:p,disabledReason:v,apply:x,draft:y,triggerRef:T,lastHex:S,setLastHex:C}),[h,p,v,x,y,S]);if(d||!m)return null;let M={className:`docx-toolbar__colorsplit docx-table-chrome${u?` ${u}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},E=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(s,{}),jsxRuntime.jsx(l,{clearFill:o?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:R,children:f?jsxRuntime.jsx(j,{...M,ref:P,children:E}):jsxRuntime.jsx("div",{ref:P,...M,children:E})})}function a({asChild:d,className:f,children:u}){let{enabled:g,disabledReason:m,apply:p,draft:v,lastHex:y}=Co(r),x=X(),h=J(e),b=x(h?.labelKey??t),{shared:S,reasonNode:C}=ds({enabled:g,disabledReason:m,ariaLabel:b}),P=e==="table.borderColor"&&v.spec.color.kind==="hex"?v.spec.color.value:y??n,T={...S,className:`docx-toolbar__button docx-toolbar__colorsplit-main${f?` ${f}`:""}`,onClick:g?()=>p({kind:"hex",value:P}):void 0},R=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re(h?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${P.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...T,children:R}),C]}):jsxRuntime.jsxs("button",{...T,children:[R,C]})}a.docxToolbarPart=true;function s({asChild:d,className:f,children:u}){let{open:g,setOpen:m,enabled:p,disabledReason:v,triggerRef:y}=Co(r),x=X(),h=J(e),b=x(h?.labelKey??t),{shared:S,reasonNode:C}=ds({enabled:p,disabledReason:v,ariaLabel:b}),P={...S,ref:y,className:`docx-toolbar__colorsplit-caret${f?` ${f}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:p?()=>m(!g):void 0,...d?{tabIndex:p?0:-1,role:"button",onKeyDown:zh(p,g,m)}:{}},T=u??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...P,children:T}),C]}):jsxRuntime.jsxs("button",{...P,children:[T,C]})}s.docxToolbarPart=true;function l({asChild:d,className:f,children:u,clearFill:g}){let{open:m,setOpen:p,enabled:v,apply:y,draft:x,triggerRef:h,lastHex:b,setLastHex:S}=Co(r),C=X(),P=Pt.useRef(null);if(Bh(m&&v,p,P,h),!m||!v)return null;let T=C(t),R=e==="table.borderColor"&&x.spec.color.kind==="hex"?x.spec.color.value:b??n,M={ref:P,role:"dialog","aria-label":T,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${f?` ${f}`:""}`,onMouseDown:B},E=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>{p(false),y(null),cs(h.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),C("table.clearCellFill")]}):null,jsxRuntime.jsx(Mc,{apply:_=>{p(false),S?.(_),y({kind:"hex",value:_}),cs(h.current);},current:R})]});return d?jsxRuntime.jsx(j,{...M,children:E}):jsxRuntime.jsx("div",{...M,children:E})}function c({value:d,css:f,labelKey:u,asChild:g,className:m,children:p}){let{apply:v,setOpen:y,setLastHex:x,triggerRef:h}=Co(r),b=X(),S=f??`#${d.toLowerCase()}`,C=u?b(u):d,P={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${m?` ${m}`:""}`,style:{backgroundColor:S},"data-value":d,"aria-label":C,title:C,onMouseDown:B,onClick:()=>{y(false),x?.(d),v({kind:"hex",value:d}),cs(h.current);}};return g?jsxRuntime.jsx(j,{...P,children:p}):jsxRuntime.jsx("button",{...P,children:p})}return {Root:i,Main:a,Trigger:s,Content:l,Item:c,Ctx:r}}var Ya=Jh("table.borderColor","table.borderColor",{defaultHex:"000000"});function pR(e){return jsxRuntime.jsx(Ya.Content,{...e,clearFill:false})}function mR(e){return jsxRuntime.jsx(Ya.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function fR(e){return jsxRuntime.jsx(Ya.Root,{...e})}var ti=Object.assign(fR,{docxSlot:"table.borderColor",Trigger:Ya.Trigger,Content:pR,Item:mR,Main:Ya.Main}),Xa=Jh("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function gR(e){return jsxRuntime.jsx(Xa.Content,{...e,clearFill:true})}function hR(e){return jsxRuntime.jsx(Xa.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function bR(e){return jsxRuntime.jsx(Xa.Root,{...e})}var oi=Object.assign(bR,{docxSlot:"table.cellFill",Trigger:Xa.Trigger,Content:gR,Item:hR,Main:Xa.Main});function Qh({overrides:e=new Map,separator:t=true}){return Hh()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(En,{}):null,[Ja,ti,Qa,ei,oi].map(r=>{let i=e.get(r.docxSlot);return i?jsxRuntime.jsx(Pt.Fragment,{children:i},r.docxSlot):jsxRuntime.jsx(r,{},r.docxSlot)})]}):null}function eb(){let e=X(),{draft:t}=ss("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var up=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Nr="contextual-table",pp={"zoom.level":zu,"styles.style":np,"font.family":Ju,"font.size":Wu,"text.color":Rc,"text.highlight":Dc,"text.link":Ou,"list.lineSpacing":Uu,"review.editingMode":Kl,"review.authors":zl,"file.save":Bu,...Dh,"table.borderTarget":Ja,"table.borderColor":ti,"table.borderStyle":Qa,"table.borderWidth":ei,"table.cellFill":oi,"image.insert":sa,"image.properties":Cr,"image.wrap":Za,"image.altText":Pa},us={id:Nr,labelKey:"formattingBar.groups.table",entries:up.map(e=>({slot:e,Part:pp[e]}))},tb=new Map;function SR(e){let t=tb.get(e);return t||(t=o=>jsxRuntime.jsx(sn,{slotId:e,...o}),tb.set(e,t)),t}function ER(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:Jl}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(o=>{let n=editor.chromeSlotId(t,o);return {slot:n,Part:pp[n]??SR(n)}})})}var wR=e=>e.image,MR=e=>e.isLoading||e.isOpening===true,RR=e=>e.table!==null;function DR(e){return e==="alignment"||e in pp}function ms(e){let t=tr(e,ms);if(t!==null)return t;if(!Pt.isValidElement(e))return null;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxToolbarSlot===true){let n=e.props.slotId;return typeof n=="string"?n:null}if(o.docxToolbarPart===true){let n=e.props,r=n.slotId??n.slot;if(typeof r=="string")return r}return null}function dp(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(dp);let t=ms(e);return t!=null&&up.includes(t)?true:Pt.isValidElement(e)?Pt.Children.toArray(e.props.children).some(dp):false}function kR(e,t){return t?true:Pt.Children.toArray(e).some(dp)}function IR(e){let t=Ct(),{className:o,t:n,onSave:r,preset:i=true,overflow:a=true,children:s}=e,l=Pt.useMemo(()=>({t:n,onSave:r}),[n,r]),c=Oi(n),d=O(wR),f=O(MR),u=O(RR),g=Pt.useMemo(()=>ER(d),[d]),m=Pt.useMemo(()=>new Set(g.flatMap(P=>P.entries.map(T=>T.slot))),[g]),p=Pt.useMemo(()=>i?M0(s,ms,P=>m.has(P),P=>up.includes(P)):null,[i,s,m]),v=Pt.useMemo(()=>p?_R(g,p):[],[g,p]),y=Pt.useMemo(()=>[...v.filter(P=>!P.pinned).map(P=>P.id),...u?[Nr]:[]],[v,u]),x=Pt.useMemo(()=>{let P=new Map;for(let T of v)T.priority!==void 0&&P.set(T.id,T.priority);return editor.collapseOrder(y,editor.TOOLBAR_COLLAPSE_ORDER,P)},[v,y]),h=i&&a,{attach:b,overflow:S}=Xi(h,y,x),C;if(!p)C=s;else {let{overrides:P,tableOverrides:T,appended:R}=p,M=w=>{let I=P.get(w.slot);if(I)return I;let $=w.Part;return jsxRuntime.jsx($,{})},E=w=>{let I=T.get(w.slot);if(I)return I;let $=w.Part;return jsxRuntime.jsx($,{})},_=[],H=[],L=0;for(let w of v){if(S.has(w.id)){let I=w.entries.flatMap(W=>{let ee=ob(W,P,c,w.labelKey,M);return ee===null?[]:[jsxRuntime.jsx(Pt.Fragment,{children:ee},W.slot)]}),$=LR(w);if($!==null&&I.push(jsxRuntime.jsx(Pt.Fragment,{children:$},"host")),I.length===0)continue;H.push({id:w.id,labelKey:w.labelKey,...w.heading?{label:Ul(w.heading,c)}:{},children:I});continue}L>0&&_.push(jsxRuntime.jsx(En,{},`separator-${w.id}`)),L+=1,_.push(jsxRuntime.jsxs("div",{className:`docx-toolbar__group${w.className?` ${w.className}`:""}`,...w.heading?{role:"group","aria-label":Ul(w.heading,c)}:{},...w.pinned?{[fn]:""}:{[Fo]:w.id},children:[w.entries.map(I=>jsxRuntime.jsx(Pt.Fragment,{children:M(I)},I.slot)),w.extras.length>0?jsxRuntime.jsx(Pt.Fragment,{children:w.extras},"host"):null]},w.id));}let k=S.has(Nr);if(u&&k){let w=us.entries.flatMap(I=>{let $=ob(I,T,c,us.labelKey,E);return $===null?[]:[jsxRuntime.jsx(Pt.Fragment,{children:$},I.slot)]});w.length>0&&H.unshift({id:us.id,labelKey:us.labelKey,children:w});}C=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_,u&&!k?jsxRuntime.jsx(En,{},"separator-contextual-table"):null,k?null:jsxRuntime.jsx("div",{className:"docx-toolbar__contextual",[Fo]:Nr,children:jsxRuntime.jsx(Qh,{overrides:T,separator:false})}),R.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[fn]:"",children:R}):null,H.length>0?jsxRuntime.jsx(E0,{sections:H}):null]});}return jsxRuntime.jsx(ln.Provider,{value:l,children:jsxRuntime.jsx(v0,{children:jsxRuntime.jsx("fieldset",{ref:b,disabled:f,"aria-label":c("formattingBar.label"),"data-testid":"docx-toolbar",className:`${t}docx-toolbar${o?` ${o}`:""}`,...h?{"data-overflow":""}:{},onMouseDown:B,children:kR(s,i)?jsxRuntime.jsx(lp,{children:C}):C})})})}function mp(e){if(!e)return false;if(e.type===Pt.Fragment){let t=Pt.Children.toArray(e.props.children).find(o=>ms(o)!==null);return Pt.isValidElement(t)?mp(t):false}return !!e.props.hidden}function _R(e,t){let o=new Map(t.groups.map(l=>[l.id,l])),n=new Set(e.map(l=>l.id)),r=new Map;for(let l of e){let c=o.get(l.id);if(c&&NR(c),c?.hidden)continue;let d=Pt.Children.toArray(c?.children);!l.entries.some(u=>!mp(t.overrides.get(u.slot)))&&d.length===0||r.set(l.id,{id:l.id,labelKey:l.labelKey,heading:void 0,entries:l.entries,extras:d,pinned:c?.pinned??editor.TOOLBAR_PINNED_GROUPS.has(l.id),priority:c?.priority,overflowContent:c?.overflowContent,className:c?.className,host:false});}for(let l of t.groups)l.id===Nr&&L0(l.id);let i=t.groups.filter(l=>!n.has(l.id)&&l.id!==Nr);for(let l of i){let c=Pt.Children.toArray(l.children);l.hidden||c.length===0||r.set(l.id,{id:l.id,labelKey:l.labelKey??l.id,heading:{id:l.id,label:l.label,labelKey:l.labelKey},entries:[],extras:c,pinned:l.pinned===true,priority:l.priority,overflowContent:l.overflowContent,className:l.className,host:true});}let a=[...n,...i.map(l=>l.id)];for(let l of i)l.after!==void 0&&!a.includes(l.after)&&_0(l.id,l.after,a);for(let l of t.appended){if(!Pt.isValidElement(l)||l.type!==Ba)continue;let c=l.props.slotId;F0(c,J(c)!==null);}return editor.arrangeToolbarGroups(e.map(l=>l.id),i.map(l=>({id:l.id,after:l.after}))).flatMap(l=>{let c=r.get(l);return c?[c]:[]})}function NR(e){for(let t of ["label","labelKey","after"])e[t]!==void 0&&N0(e.id,t);}function LR(e){return e.overflowContent?e.overflowContent():e.extras.length===0?null:jsxRuntime.jsx(_u.Provider,{value:"panel",children:jsxRuntime.jsx("div",{className:"docx-toolbar__more-host",children:e.extras})})}function ob(e,t,o,n,r){let i=t.get(e.slot);if(mp(i))return null;let a=i?.type===Ba?i.props.overflowContent:void 0;return i||DR(e.slot)?jsxRuntime.jsx(P0,{label:FR(o,e,n),children:a?a():r(e)}):jsxRuntime.jsx(S0,{slot:e.slot})}function FR(e,t,o){let n=t.slot==="alignment"?null:J(t.slot);return e(n?.labelKey??o)}var ri=Object.assign(IR,{Button:sn,Action:Gu,Separator:En,Group:Iu,Slot:Ba,AddComment:Nu,Undo:A0,Redo:O0,Bold:B0,Italic:Z0,Underline:q0,Strike:K0,Link:Ou,ClearFormatting:W0,Superscript:z0,Subscript:$0,Alignment:Jl,AlignLeft:U0,AlignCenter:V0,AlignRight:G0,AlignJustify:j0,LeftToRight:Y0,RightToLeft:X0,LineSpacing:Uu,BulletList:J0,NumberedList:Q0,Outdent:eh,Indent:th,ImageInsert:sa,ImageProperties:Cr,ImageWrap:Za,ImageAltText:Pa,TableInsert:Au,TableBorderTarget:Ja,TableBorderColor:ti,TableBorderStyle:Qa,TableBorderWidth:ei,TableCellFill:oi,Comments:oh,FontFamily:Ju,FontSize:Wu,FontColor:Rc,Highlight:Dc,Zoom:zu,StylePicker:np,EditingMode:Kl,Reviewers:zl,Save:Bu,ContentControlShowAll:ns,ContentControlFormFill:rs,ContentControlInspector:is,ContentControlRemove:as});var rb=/^(con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])$/i,AR=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var ab=new TextEncoder;function OR(e,t){if(ab.encode(e).length<=t)return e;let o=0,n="";for(let r of e){let i=ab.encode(r).length;if(o+i>t)break;o+=i,n+=r;}return n}function ib(e){let t=e.length;for(;t>0;){let o=e.charCodeAt(t-1);if(o!==46&&o!==32)break;t-=1;}return e.slice(0,t)}function lb(e){return ib(ib(e).replace(/\.docx$/i,""))}function fs(e){let t=(e??"").replace(AR," ").replace(/\s+/g," ").trim(),o=lb(t).replace(/^[. ]+/,""),n=OR(o,200),r=n===o?o:lb(n);return !r||rb.test(r)?"document.docx":rb.test(r.split(".",1)[0].trim())?`_${r}.docx`:`${r}.docx`}function gs(e,t,o="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let n=URL.createObjectURL(new Blob([e],{type:o})),r=document.createElement("a");r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0);}function sb(e,t,o){let{t:n}=N(),r=Pt.useRef(false),[i,a]=Pt.useState(false),[s,l]=Pt.useState(""),[c,d]=Pt.useState("pdf"),[f,u]=Pt.useState(false),[g,m]=Pt.useState({});return {pending:i,error:s,format:c,visible:f,session:g,dismiss:()=>u(false),execute:async v=>{if(!(!e||r.current)){r.current=true,m({}),d(v),u(true),a(true),l("");try{let y=await editor.runChromeExport(e,v,t);gs(y.bytes.slice().buffer,fs(o).replace(/\.docx$/,`.${y.extension}`),y.mimeType),u(!1);}catch(y){u(true),l(y instanceof editor.ChromeExportError?n(y.format==="markdown"?"toolbar.exportMarkdownMissing":"toolbar.exportPdfMissing"):n("toolbar.exportFailed",{message:y instanceof Error?y.message:String(y)}));}finally{r.current=false,a(false);}}}}}function db(e,t,o){let{t:n}=N(),r=Pt.useRef({editor:e,exporters:t,feedback:o,t:n});r.current={editor:e,exporters:t,feedback:o,t:n};let i=Pt.useRef(null),a=Pt.useRef(null),[s,l]=Pt.useState(false),[c,d]=Pt.useState(""),[f,u]=Pt.useState(""),[g,m]=Pt.useState(false),[p,v]=Pt.useState(false),[y,x]=Pt.useState({}),h=Pt.useCallback(C=>{let{t:P}=r.current;if(C instanceof editor.ChromeExportError)return P("toolbar.printPdfMissing");if(C instanceof editor.ChromePrintError){if(C.code==="pdf-viewer-unavailable")return P("toolbar.printNoViewer");if(C.code==="pdf-load-failed")return P("toolbar.printLoadFailed");if(C.code==="print-refused")return P("toolbar.printRefused")}return P("toolbar.printFailedMessage",{message:C instanceof Error?C.message:String(C)})},[]),b=Pt.useCallback(()=>{i.current=null,v(false),m(false),l(false);},[]),S=Pt.useCallback(async C=>{let{editor:P,exporters:T}=r.current;if(!P||i.current)return;let R={};i.current=R,a.current?.dispose(),a.current=null,x(R),v(true),m(true),l(true),d(""),u("");try{let M=await editor.runChromePrint(P,T,C??document);if(i.current!==R){M.dispose();return}a.current=M,await M.print({beforePrint:()=>{if(i.current!==R)throw new editor.ChromePrintError("print-ended");reactDom.flushSync(()=>m(!1));}}),i.current===R&&b();}catch(M){if(i.current!==R)return;if(!r.current.feedback){console.error("[docx-editor] print failed",M),b();return}l(false),u(a.current?.url??""),d(h(M)),m(true);}},[b,h]);return Pt.useEffect(()=>()=>{i.current=null,a.current?.dispose(),a.current=null;},[]),{pending:s,error:c,url:f,visible:g,active:p,session:y,execute:S,close:b}}var UR="https://github.com/eigenpal/docx-editor/issues/new";function VR(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function ub(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),o=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??VR()}`,`- Viewport: ${o.width} x ${o.height}`,`- User agent: ${t}`,""].join(`
2
+ `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${UR}?${i.toString()}`}function ii(e){typeof window>"u"||window.open(ub(e),"_blank","noopener,noreferrer");}function GR({className:e,hidden:t,onSelect:o}){let{setOpenMenu:n,onReportIssue:r,reportIssue:i}=at(),a=ke();if(t||i===false)return null;let s=o??r??ii;return jsxRuntime.jsx(_e,{slot:"help.reportIssue",onSelect:()=>{s(),n(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var hs=Object.assign(GR,{docxSlot:"help.reportIssue"});function jR({children:e,...t}){let{reportIssue:o}=at();return e===void 0&&o===false?null:jsxRuntime.jsxs(Bt,{id:"help",...t,children:[jsxRuntime.jsx(hs,{}),e]})}var hp=Object.assign(jR,{docxMenu:"help"});var QR=e=>e.hiddenReviewAuthors??[];function bs({className:e,hidden:t}){let o=F(),n=Aa(),r=O(QR),i=ke(),{t:a}=N();if(t)return null;let s=i("reviewers.label"),l=editor.toolbarCommandState(o,"review.authors"),c=i18n.localizeDisabledReason(l.disabledReason,a);if(!l.enabled)return jsxRuntime.jsx(_e,{disabled:true,title:c??void 0,slot:"review.authors",children:s});let d=new Set(r),f=n.every(u=>!d.has(u.author));return jsxRuntime.jsxs(Ot,{labelKey:"reviewers.label",className:e,children:[jsxRuntime.jsx(mb,{checked:f,label:i("reviewers.all"),slot:"reviewer-all",onChoose:()=>o?.setAllReviewAuthorsVisible(!f)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),n.map(u=>jsxRuntime.jsx(mb,{checked:!d.has(u.author),label:u.author||"\u2014",slot:`reviewer-${u.slot}`,onChoose:()=>o?.setReviewAuthorVisible(u.author,d.has(u.author))},u.author))]})}function mb(e){return jsxRuntime.jsx(_e,{active:e.checked,slot:e.slot,className:"docx-menubar__reviewer-item",icon:jsxRuntime.jsx("span",{className:"docx-menubar__reviewer-check",children:e.checked?"\u2713":""}),onSelect:e.onChoose,children:e.label})}function e2({children:e,...t}){return jsxRuntime.jsxs(Bt,{id:"review",...t,children:[jsxRuntime.jsx(Ot,{labelKey:"reviewers.markupOptions",className:"docx-menubar__markup-options",children:jsxRuntime.jsx(bs,{className:"docx-menubar__reviewers-submenu"})}),e]})}var vs=Object.assign(e2,{docxMenu:"review"});var o2={file:bd,format:vd,insert:yd,review:vs,help:hp};function si(e,t=false){if(!Pt.isValidElement(e))return null;if(e.type===Pt.Fragment){let i=Pt.Children.toArray(e.props.children).map(a=>si(a,t)).filter(a=>a!==null);return i.length===1?i[0]:null}let o=e.props;if(o.hidden===true&&!t)return null;let n=e.type;return (typeof n=="function"||typeof n=="object")&&typeof n.docxMenu=="string"?n.docxMenu:e.type===Bt&&typeof o.id=="string"?o.id:null}var n2=new Set(editor.CHROME_MENUS.map(e=>e.id));function Ts(e){if(!Pt.isValidElement(e))return null;if(e.type===Pt.Fragment){let n=Pt.Children.toArray(e.props.children).map(Ts).filter(r=>r!==null);return n.length===1?n[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===Bt){let o=e.props.id;if(typeof o=="string"&&n2.has(o))return o}return null}var r2=e=>e.isOpening===true;function a2(e){let t=Pr(),o=Zt(),n=Ct(),{className:r,t:i,fileName:a,exporters:s,onOpen:l,onOpenFile:c,onSave:d,onPageSetup:f,onReportIssue:u,reportIssue:g,preset:m=true,overflow:p=true,children:v}=e,y=F(),{t:x}=N(),[h,b]=Pt.useState(null),S=O(r2);Pt.useEffect(()=>{S&&b(null);},[S]);let[C,P]=Pt.useState(null),T=sb(y,s,a??C??void 0),{pending:R,execute:M}=T,E=db(y,s,o?.print!==false),{active:_,execute:H}=E,L=E.visible&&o?.print!==false,[k,w]=Pt.useState(null),[I,$]=Pt.useState(false),[W,ee]=Pt.useState(false),V=Pt.useRef(null),se=Pt.useRef(null);Pt.useEffect(()=>{if(h===null)return;let ne=te=>{let ve=V.current;ve&&te.target instanceof Node&&ve.contains(te.target)||b(null);};return document.addEventListener("mousedown",ne),()=>{document.removeEventListener("mousedown",ne);}},[h]),Mr(h!==null,V,()=>b(null),ne=>ne.target instanceof Node&&V.current?.contains(ne.target)===true);let U=Pt.useCallback(ne=>{b(ne),ne!==null&&w(ne);},[]),ce=Pt.useCallback(()=>se.current?.click(),[]),pe=Pt.useCallback(()=>{y&&y.save().then(ne=>gs(ne,fs(a??C??void 0))).catch(ne=>{console.error("[docx-editor] save failed",ne);});},[y,a,C]),K=Pt.useCallback(()=>t?t.open("pageSetup",V.current?.querySelector('[data-menu="file"] > [role="menuitem"]')):$(true),[t]),Z=y?l??ce:void 0,be=y?d??pe:void 0,Re=!!s?.pdf,ue=Pt.useMemo(()=>y&&!_?()=>{rd(V.current),H(editor.editorInstanceScope(V.current)??V.current??void 0);}:void 0,[y,_,H]),ze=y?t?.ownsPageSetup?K:f??K:void 0;Pt.useEffect(()=>{let ne=te=>{if(!(te.metaKey||te.ctrlKey)||te.altKey||te.shiftKey)return;let ve=te.key.toLowerCase(),$e=editor.isChromePrintShortcut(te);if(ve!=="s"&&ve!=="o"&&!$e)return;let Ze=te.target,mo=editor.editorInstanceScope(V.current)??V.current;if(!(!Ze||!mo?.contains(Ze)))if($e){if(!Re||!y||!ue&&!L)return;te.preventDefault(),ue?.();}else ve==="s"&&be?(te.preventDefault(),be()):ve==="o"&&Z&&(te.preventDefault(),Z());};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[Z,be,ue,L,Re,y]);let _t=Pt.useMemo(()=>({t:i,openMenu:h,setOpenMenu:U,activeMenu:k,onOpen:Z,onSave:be,onExport:y&&!R?ne=>(rd(V.current),M(ne)):void 0,onPrint:ue,printShortcut:Re,onPageSetup:ze,onParagraphDialog:()=>t?t.open("paragraph",V.current?.querySelector('[data-menu="format"] > [role="menuitem"]')):ee(true),onReportIssue:u,reportIssue:g,opening:S}),[S,y,R,M,ue,Re,i,h,U,k,Z,be,ze,t,u,g]),Je=Pt.Children.toArray(v),ut=[];if(m){let ne=new Map(Je.map(te=>[Ts(te),te]));for(let te of editor.CHROME_MENUS){let ve=ne.get(te.id);(ve===void 0||si(ve)!==null)&&ut.push(te.id);}for(let te of Je){if(Ts(te)!==null)continue;let ve=si(te);ve!==null&&ut.push(ve);}}else for(let ne of Je){let te=si(ne);te!==null&&ut.push(te);}let Pe=[...ut].reverse(),{attach:co,overflow:uo}=Xi(p,ut,Pe),po=Pt.useMemo(()=>({measuring:p,overflow:uo,inMore:false}),[p,uo]),Mo=Pt.useMemo(()=>({measuring:false,overflow:uo,inMore:true}),[uo]),Gt=ne=>si(ne,true)!==null,oe=(ne,te)=>jsxRuntime.jsx("div",{role:"none",className:"docx-menubar__host",[fn]:"",children:ne},te),fe,yt;if(!m)fe=Je.filter(Gt),yt=p?Je.map((ne,te)=>Gt(ne)?ne:oe([ne],`host-${te}`)):v;else {let ne=new Map,te=[];for(let $e of Je){let Ze=Ts($e);Ze?ne.set(Ze,$e):te.push($e);}fe=[...editor.CHROME_MENUS.map($e=>{let Ze=ne.get($e.id);if(Ze)return jsxRuntime.jsx(Pt.Fragment,{children:Ze},$e.id);let mo=o2[$e.id];return jsxRuntime.jsx(mo,{},$e.id)}),...te.filter(Gt)];let ve=te.filter($e=>!Gt($e));yt=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[fe,ve.length>0?oe(ve,"host"):null]});}let zn=i?.("formattingBar.more")??x("formattingBar.more");return jsxRuntime.jsxs(na.Provider,{value:_t,children:[jsxRuntime.jsx("div",{ref:ne=>{if(V.current=ne,co(ne),ne&&k===null){let te=nd(ne)[0]?.closest("[data-menu]")?.getAttribute("data-menu");te&&w(te);}},role:"menubar","aria-label":i?.("titleBar.menuBarAriaLabel")??x("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",...p?{"data-overflow":""}:{},className:`${n}docx-menubar${r?` ${r}`:""}`,onMouseDown:B,onKeyDown:ne=>{if(ne.key!=="ArrowLeft"&&ne.key!=="ArrowRight")return;let te=V.current;if(!te)return;let ve=nd(te),$e=ve.indexOf(document.activeElement);if($e===-1)return;ne.preventDefault();let Ze=ne.key==="ArrowRight"?1:-1,mo=ve[($e+Ze+ve.length)%ve.length],$n=mo?.closest("[data-menu]")?.getAttribute("data-menu");$n&&(w($n),mo?.focus(),h!==null&&b($n));},children:jsxRuntime.jsxs(ji.Provider,{value:po,children:[jsxRuntime.jsx(nr.Provider,{value:0,children:yt}),uo.size>0?jsxRuntime.jsx(Bt,{id:or,label:zn,icon:re(Du),preset:false,children:jsxRuntime.jsx(ji.Provider,{value:Mo,children:fe})}):null]})}),jsxRuntime.jsxs(Bg,{children:[T.visible&&o?.export!==false?o?.export?De(o.export,{open:true,format:T.format,pending:T.pending,error:T.error,onClose:T.dismiss},T.session):jsxRuntime.jsx(Vr,{open:true,format:T.format,pending:T.pending,error:T.error,onClose:T.dismiss}):null,E.visible&&o?.print!==false?o?.print?De(o.print,{open:true,pending:E.pending,error:E.error,url:E.url,onClose:E.close},E.session):jsxRuntime.jsx(Gr,{open:true,pending:E.pending,error:E.error,url:E.url,onClose:E.close}):null]}),jsxRuntime.jsx("input",{ref:se,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:ne=>{let te=ne.target.files?.[0];ne.target.value="",!(!te||!y)&&(P(te.name),c?.(te),te.arrayBuffer().then(ve=>y.load(new Uint8Array(ve))).catch(ve=>{console.error("[docx-editor] could not open the file",ve);}));}}),jsxRuntime.jsx(Sn,{open:I,onClose:()=>$(false)}),jsxRuntime.jsx(yo,{open:W,onClose:()=>ee(false)})]})}var ci=Object.assign(a2,{Menu:Bt,File:bd,Format:vd,Insert:yd,Review:vs,Help:hp,Item:ho,Row:_e,Group:da,Separator:gn,Submenu:Ot,TableGrid:ar,Entry:pa,Open:cd,Save:dd,ExportMarkdown:ud,ExportPdf:pd,Print:md,PageSetup:fd,ImageInsert:gd,Reviewers:bs,ReportIssue:hs});var d2=12240,xb=1440,Pb=1440,Sb=567,Dn=20,Tp=6,Sp=Dn+Tp+2,u2="var(--doc-text-muted)",p2="var(--doc-text-subtle)",Cb="var(--doc-shadow-subtle)",m2="var(--doc-primary)",f2="var(--doc-primary-hover)",g2="var(--doc-text-subtle)",ui=5,di=7,h2={left:0,right:0,firstLine:0};function Tb(e,t){return t==="inch"?(e/Pb).toFixed(2)+'"':(e/Sb).toFixed(1)+" cm"}function b2(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function kn({pageSetup:e,zoom:t=1,editable:o=false,onLeftMarginChange:n,onRightMarginChange:r,onMarginDragEnd:i,showIndentHandles:a=false,indent:s,indentEditable:l=false,onIndentChange:c,onIndentDragEnd:d,unit:f="inch",className:u="",style:g,tabMarks:m,onTabMarkRemove:p}){let{t:v}=N(),[y,x]=Pt.useState(null),[h,b]=Pt.useState(null),[S,C]=Pt.useState(null),[P,T]=Pt.useState(null),R=Pt.useRef(null),M=e?.pageWidthTwips??d2,E=e?.marginsTwips.left??xb,_=e?.marginsTwips.right??xb,H=e?.gutterTwips??0,L={pageWidth:M,leftMargin:E,rightMargin:_},k=s??h2,w=Ne(M)*t,I=Ne(E)*t,$=Ne(_)*t,W=Pt.useCallback(Z=>{let be=R.current?.getBoundingClientRect();return be?Fl((Z-be.left)/t):null},[t]),ee=Pt.useCallback((Z,be,Re)=>{let ue=W(be);if(ue===null)return;if(T(Ne(ue)*t),Z==="leftMargin"||Z==="rightMargin"){if(Z==="leftMargin"){let _t=M-_-H-720,Je=Math.round(Math.max(0,Math.min(ue,_t)));C(Je),n?.(Je);}else {let _t=M-ue,Je=M-E-H-720,ut=Math.round(Math.max(0,Math.min(_t,Je)));C(ut),r?.(ut);}return}let ze=editor.dragIndent(Z,ue,k,L,{unit:f,precise:Re});C(Z==="right"?ze.right:Z==="firstLine"?ze.firstLine:ze.left),c?.(ze);},[W,t,M,E,_,H,n,r,c,k,L,f]),V=Pt.useCallback(Z=>{Z==="leftMargin"||Z==="rightMargin"?i?.():d?.(),x(null),C(null),T(null);},[i,d]),se=Pt.useCallback((Z,be,Re)=>{let ue=editor.handlePosition(Z,k,L),ze=editor.dragIndent(Z,ue+be*b2(f,Re),k,L,{unit:f,precise:true});c?.(ze),d?.();},[k,L,f,c,d]),U=P2(M,t,f),ce=a&&l&&c!==void 0,pe=Z=>Ne(editor.handlePosition(Z,k,L))*t,K=(Z,be,Re)=>({positionPx:pe(Z),editable:ce,isDragging:y===Z,isHovered:h===Z,onPointerEnter:()=>b(Z),onPointerLeave:()=>b(null),onPointerDown:ue=>{ce&&(ue.preventDefault(),ue.stopPropagation(),ue.currentTarget.setPointerCapture(ue.pointerId),x(Z));},onPointerMove:ue=>{y===Z&&ee(Z,ue.clientX,ue.altKey);},onPointerUp:ue=>{y===Z&&(ue.currentTarget.releasePointerCapture(ue.pointerId),V(Z));},onKeyDown:ue=>{ce&&(ue.key!=="ArrowLeft"&&ue.key!=="ArrowRight"||(ue.preventDefault(),se(Z,ue.key==="ArrowLeft"?-1:1,ue.shiftKey)));},label:v(be),valueNow:Re,valueText:Tb(Re,f),pageWidthTwips:M});return jsxRuntime.jsxs("div",{ref:R,className:`docx-horizontal-ruler ${u}`,style:{position:"relative",width:gt(w),height:Sp,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:y?"ew-resize":"default",flexShrink:0,marginInline:"auto",...g},role:"group","aria-label":v("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:gt(I),height:Dn,backgroundColor:Cb,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&n?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),x("leftMargin");}:void 0,onPointerMove:Z=>y==="leftMargin"&&ee("leftMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{y==="leftMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),V("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:gt($),height:Dn,backgroundColor:Cb,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&r?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),x("rightMargin");}:void 0,onPointerMove:Z=>y==="rightMargin"&&ee("rightMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{y==="rightMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),V("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Dn,pointerEvents:"none"},children:U.map((Z,be)=>jsxRuntime.jsx(v2,{tick:Z},be))}),m?.map(Z=>jsxRuntime.jsx(T2,{tabMark:Z,positionPx:Ne(Z.position)*t,onDoubleClick:()=>p?.(Z.position)},Z.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cp,{direction:"down",anchor:"top",...K("firstLine","ruler.firstLineIndent",k.firstLine)}),jsxRuntime.jsx(Cp,{direction:"up",anchor:"strip",...K("hanging","ruler.hangingIndent",k.left)}),jsxRuntime.jsx(y2,{...K("left","ruler.leftIndent",k.left)}),jsxRuntime.jsx(Cp,{direction:"up",anchor:"strip",...K("right","ruler.rightIndent",k.right)})]}),y&&S!==null&&P!==null&&jsxRuntime.jsx(x2,{value:Tb(S,f),positionPx:P})]})}function v2({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(e.position),bottom:0,width:1,height:e.height,backgroundColor:p2}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:u2,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Eb(e){return e.editable?e.isDragging||e.isHovered?f2:m2:g2}function wb(e,t,o){return {position:"absolute",left:gt(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...o}}function Mb(e){return {role:"slider","aria-label":e.label,"aria-orientation":"horizontal","aria-valuenow":e.valueNow,"aria-valuemin":-e.pageWidthTwips,"aria-valuemax":e.pageWidthTwips,"aria-valuetext":e.valueText,"aria-disabled":e.editable?void 0:true,tabIndex:e.editable?0:-1}}function Cp({direction:e,anchor:t,...o}){let n=Eb(o),r=t==="top"?{top:0,height:di+1}:{top:Dn-di,height:di};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:wb(o,ui*2,r),onPointerEnter:o.onPointerEnter,onPointerLeave:o.onPointerLeave,onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onKeyDown:o.onKeyDown,...Mb(o),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${ui}px solid transparent`,borderRight:`${ui}px solid transparent`,...e==="down"?{top:0,borderTop:`${di}px solid ${n}`}:{bottom:0,borderBottom:`${di}px solid ${n}`},transition:"border-color 0.1s"}})})}function y2(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:wb(e,ui*2,{top:Dn+1,height:Tp}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Mb(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:ui*2-2,height:Tp,backgroundColor:Eb(e),borderRadius:1,transition:"background-color 0.1s"}})})}function x2({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(t),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var C2={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function T2({tabMark:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:gt(t-5),top:Dn-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:n=>{n.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:C2[e.alignment]||"L"})}function P2(e,t,o){let n=[];if(o==="inch"){let r=Pb/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;a%8===0?n.push({position:l,height:8,label:a/8>0?String(a/8):void 0}):a%4===0?n.push({position:l,height:5}):a%2===0?n.push({position:l,height:3}):n.push({position:l,height:2});}}else {let r=Sb/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;a%10===0?n.push({position:l,height:8,label:a/10>0?String(a/10):void 0}):a%5===0?n.push({position:l,height:5}):n.push({position:l,height:3});}}return n}var w2=15840,kb=1440,Es=1440,ws=567,Fr=20,M2="var(--doc-text-muted)",R2="var(--doc-text-subtle)",D2="var(--doc-primary)",k2="var(--doc-primary)",I2="var(--doc-primary-hover)";function pi({pageSetup:e,zoom:t=1,editable:o=false,onTopMarginChange:n,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:s="",style:l}){let{t:c}=N(),[d,f]=Pt.useState(null),[u,g]=Pt.useState(null),m=Pt.useRef(null),p=e?.pageHeightTwips??w2,v=e?.marginsTwips.top??kb,y=e?.marginsTwips.bottom??kb,x=(E,_)=>{if(!o||E.altKey||E.ctrlKey||E.metaKey||!["ArrowUp","ArrowDown","Home","End"].includes(E.key))return;E.preventDefault();let H=_==="topMargin"?v:y,k=Math.max(0,p-(_==="topMargin"?y:v)-720),w=E.shiftKey?1:Math.round(a==="cm"?ws/10:Es/8),I=E.key==="Home"?0:E.key==="End"?k:Math.max(0,Math.min(k,H+(E.key==="ArrowUp"?w:-w)));I!==H&&((_==="topMargin"?n:r)?.(I),i?.());},h=Ne(p)*t,b=Ne(v)*t,S=Ne(y)*t,C=Pt.useCallback((E,_)=>{o&&(E.preventDefault(),f(_));},[o]),P=Pt.useCallback(E=>{if(!d||!m.current)return;let _=m.current.getBoundingClientRect(),H=E.clientY-_.top,L=Fl(H/t);if(d==="topMargin"){let k=p-y-720,w=Math.max(0,Math.min(L,k));n?.(Math.round(w));}else if(d==="bottomMargin"){let k=p-L,w=p-v-720,I=Math.max(0,Math.min(k,w));r?.(Math.round(I));}},[d,t,p,v,y,n,r]),T=Pt.useCallback(()=>{d!==null&&i?.(),f(null);},[d,i]);Pt.useEffect(()=>{if(d)return document.addEventListener("mousemove",P),document.addEventListener("mouseup",T),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",T);}},[d,P,T]);let R=N2(p,t,a),M={position:"relative",width:Fr,height:gt(h),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...l};return jsxRuntime.jsxs("div",{ref:m,className:`docx-vertical-ruler ${s}`,style:M,role:"group","aria-label":c("ruler.vertical"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:R.map((E,_)=>jsxRuntime.jsx(_2,{tick:E},_))}),jsxRuntime.jsx(Ib,{type:"topMargin",value:v,maximum:Math.max(0,p-y-720),valueText:v/(a==="cm"?ws:Es),unit:a,onKeyDown:E=>x(E,"topMargin"),position:b,editable:o,isDragging:d==="topMargin",isHovered:u==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>C(E,"topMargin")}),jsxRuntime.jsx(Ib,{type:"bottomMargin",value:y,maximum:Math.max(0,p-v-720),valueText:y/(a==="cm"?ws:Es),unit:a,onKeyDown:E=>x(E,"bottomMargin"),position:h-S,editable:o,isDragging:d==="bottomMargin",isHovered:u==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>C(E,"bottomMargin")})]})}function _2({tick:e}){let t={position:"absolute",top:gt(e.position),right:0,height:1,width:e.width,backgroundColor:R2},o={position:"absolute",top:gt(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:M2,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:o,children:e.label})]})}function Ib({type:e,position:t,value:o,maximum:n,valueText:r,unit:i,onKeyDown:a,editable:s,isDragging:l,isHovered:c,onMouseEnter:d,onMouseLeave:f,onMouseDown:u}){let{t:g}=N(),m=l?I2:c?k2:D2,p={position:"absolute",top:gt(t-5),right:0,width:Fr,height:10,cursor:s?"ns-resize":"default",zIndex:l?10:1},v={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${m}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:p,onMouseEnter:d,onMouseLeave:f,onMouseDown:u,role:"slider","aria-label":g(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":n,"aria-valuetext":`${r.toFixed(2)} ${i==="cm"?"cm":"in"}`,"aria-disabled":!s,onKeyDown:a,tabIndex:s?0:-1,children:jsxRuntime.jsx("div",{style:v})})}function N2(e,t,o){let n=[];if(o==="inch"){let r=Es/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;if(a%8===0){let c=a/8;n.push({position:l,width:10,label:c>0?String(c):void 0});}else a%4===0?n.push({position:l,width:6}):a%2===0?n.push({position:l,width:4}):n.push({position:l,width:2});}}else {let r=ws/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;if(a%10===0){let c=a/10;n.push({position:l,width:10,label:c>0?String(c):void 0});}else a%5===0?n.push({position:l,width:6}):n.push({position:l,width:3});}}return n}var In=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var H2=e=>e.formatting?.indent??null,A2=e=>e.editable;function wp(){let e=F(),t=O(H2),o=O(A2),n=Pt.useMemo(()=>o&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,o]),r=Pt.useCallback(i=>e?e.exec({...i.left!==void 0?{left:i.left}:{},...i.right!==void 0?{right:i.right}:{},...i.firstLine!==void 0?{firstLine:i.firstLine}:{},type:"setIndent"}).ok:false,[e]);return Pt.useMemo(()=>({indent:t,isEnabled:n,apply:r}),[t,n,r])}var Hb=e=>e.zoom,B2=e=>e.isOpening===true;function Ab(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Ob(){let{apply:e}=Pn(),[t,o]=Pt.useState({}),n=Pt.useRef({}),r=Pt.useCallback(a=>s=>{n.current={...n.current,[a]:Math.round(s)},o(n.current);},[]),i=Pt.useCallback(()=>{let a=n.current;n.current={},o({}),Object.keys(a).length!==0&&e({...a.top!==void 0?{marginTopTwips:a.top}:{},...a.right!==void 0?{marginRightTwips:a.right}:{},...a.bottom!==void 0?{marginBottomTwips:a.bottom}:{},...a.left!==void 0?{marginLeftTwips:a.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:i}}function Fb(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function Z2(){let e=F(),{indent:t,isEnabled:o,apply:n}=wp(),[r,i]=Pt.useState(null),a=Pt.useRef(null),s=Pt.useRef(null),l=Pt.useCallback(f=>{s.current===null&&(s.current=Fb(e)),a.current=f,i(f);},[e]),c=Pt.useCallback(()=>{let f=a.current,u=s.current;a.current=null,s.current=null,i(null),f&&(u!==null&&u!==Fb(e)||n({left:f.left,right:f.right,firstLine:f.firstLine}));},[e,n]),d=Pt.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine,...t.rtl?{rtl:true}:{}}:null),[r,t]);return Pt.useMemo(()=>({indent:d,isEnabled:o,preview:l,commit:c}),[d,o,l,c])}function q2(){let e=Ye(),[t,o]=Pt.useState(0);return Pt.useEffect(()=>{if(!e){o(0);return}let n=()=>o(e.scrollLeft);return n(),e.addEventListener("scroll",n,{passive:true}),()=>e.removeEventListener("scroll",n)},[e]),t}function Rs(e){let t=O(In),o=O(B2),{pageSetup:n,isEnabled:r}=Pn(),i=O(Hb),{pending:a,preview:s,commit:l}=Ob(),c=Z2(),d=an(),f=qo(),u=q2();return t?null:jsxRuntime.jsx("div",{className:`docx-ruler-frame${o?" docx-ruler-frame--opening":""}`,style:{paddingInlineStart:d+f.inlineStart,paddingRight:f.inlineEnd},children:jsxRuntime.jsx(kn,{pageSetup:Ab(n,a),zoom:i,editable:r,onLeftMarginChange:s("left"),onRightMarginChange:s("right"),onMarginDragEnd:l,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-u}px)`,clipPath:d>0&&u>0?`inset(0 0 0 ${u}px)`:e.style?.clipPath}})})}function Ds(e){let t=O(In),{pageSetup:o,isEnabled:n}=Pn(),r=O(Hb),{pending:i,preview:a,commit:s}=Ob(),l=an(),c=qo(),d=l0();return t||d!==null&&d>0&&o&&Ne(o.pageWidthTwips)*r>d-l-c.inlineStart-c.inlineEnd?null:jsxRuntime.jsx(pi,{pageSetup:Ab(o,i),zoom:r,editable:n,onTopMarginChange:a("top"),onBottomMarginChange:a("bottom"),onMarginDragEnd:s,unit:e.unit??"inch",className:e.className??"",style:e.style})}function A({size:e=20,className:t="",style:o,children:n}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...o},"aria-hidden":"true",children:n})}function Bb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function Zb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function qb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Kb(e){return jsxRuntime.jsxs(A,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function Wb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function zb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function $b(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Ub(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Vb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function Gb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function jb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function Yb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80Zm-120 480v-400 400Z"})})}function z2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function $2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function U2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function V2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function G2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function j2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function Y2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function X2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function J2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function Q2(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function eD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function tD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function oD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"})})}function nD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"})})}function rD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function aD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function iD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function lD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function sD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function kp(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function cD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function dD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function uD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function pD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function mD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function fD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function gD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function hD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function bD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function vD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function yD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function xD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function CD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function Xb(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function TD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function PD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function SD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function ED(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function wD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function MD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function RD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function DD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function kD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function ID(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function _D(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function ND(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function LD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function FD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function HD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function AD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function OD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function BD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function ZD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function qD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function KD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function WD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function zD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function $D(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function UD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function VD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function GD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function jD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function YD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function XD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function JD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function QD(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function ek(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function tk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function ok(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function nk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function rk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function ak(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function ik(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function lk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function sk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function ck(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function dk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function uk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function pk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function mk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function fk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function gk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function hk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function bk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function vk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function yk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function xk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function Ck(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function Tk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function Pk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function Sk(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var Ek={undo:z2,redo:$2,print:U2,file_download:V2,file_upload:G2,format_bold:j2,format_italic:Y2,format_underlined:X2,strikethrough_s:J2,superscript:Q2,subscript:eD,link:tD,format_clear:rD,format_paragraph:oD,format_shapes:nD,lock:Yb,format_align_left:aD,format_align_center:iD,format_align_right:lD,format_align_justify:sD,format_line_spacing:kp,format_list_bulleted:cD,format_list_numbered:dD,format_indent_increase:uD,format_indent_decrease:pD,format_color_text:mD,ink_highlighter:fD,format_color_reset:gD,arrow_drop_down:hD,table:bD,table_chart:vD,grid_on:yD,table_rows:xD,view_column:CD,border_all:Xb,select_all:Xb,border_outer:TD,border_inner:PD,border_clear:SD,add:ED,remove:wD,delete:MD,delete_sweep:RD,call_merge:DD,call_split:kD,drag_indicator:ID,image:_D,format_image_left:ND,format_image_right:LD,horizontal_rule:FD,flip_to_back:HD,flip_to_front:AD,open_with:OD,tune:BD,rotate_right:ZD,rotate_left:qD,swap_horiz:KD,swap_vert:WD,shapes:zD,format_paint:$D,expand_more:UD,expand_less:VD,border_top:GD,border_bottom:jD,border_left:YD,border_right:XD,border_horizontal:JD,border_vertical:QD,padding:ek,text_rotation_none:tk,wrap_text:ok,height:nk,fit_width:rk,settings:ak,border_color:ik,format_color_fill:lk,vertical_align_top:sk,vertical_align_center:ck,vertical_align_bottom:dk,line_weight:uk,keyboard_arrow_up:pk,keyboard_arrow_down:mk,keyboard_arrow_left:fk,keyboard_arrow_right:gk,more_vert:hk,page_break:bk,branding_watermark:vk,arrow_back:yk,search:xk,toc:Ck,done_all:Bb,check_circle:Zb,chat_bubble_outline:qb,chat_bubble_check:Kb,check:Wb,close:zb,add_comment:$b,comment:Ub,edit_note:Vb,rate_review:Gb,visibility:jb,format_textdirection_l_to_r:Tk,format_textdirection_r_to_l:Pk,"agent-sparkle":Sk};function z({name:e,size:t=20,className:o="",style:n}){let r=Ek[e];return r?jsxRuntime.jsx(r,{size:t,className:o,style:n}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:o,style:{fontSize:t,width:t,height:t,...n},children:e}))}var mi=12,Ip=240,Qb=16,Dk=24,kk=mi+Ip+Qb,Hr=12,Ik=36,_k=Hr+Ik+Qb,fi=Pt__namespace.default.memo(function({headings:t,onHeadingClick:o,onClose:n,topOffset:r=0,scrollLeft:i=0,leftOffset:a=mi}){let{t:s}=N(),[l,c]=Pt.useState(false),d=t.length?Math.min(...t.map(f=>f.level)):0;return Pt.useEffect(()=>{requestAnimationFrame(()=>c(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":s("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:a-i,bottom:0,width:Ip,paddingTop:Dk,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:l?"translateX(0)":`translateX(-${a+Ip}px)`,transition:"transform 0.15s ease-out"},onMouseDown:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":s("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:s("documentOutline.closeTitle"),children:jsxRuntime.jsx(z,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"var(--doc-text)",letterSpacing:"0.01em"},children:s("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:4},children:t.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"var(--doc-text-subtle)",fontSize:13,lineHeight:"20px"},children:s("documentOutline.noHeadings")}):t.map((f,u)=>jsxRuntime.jsx("div",{style:{marginLeft:(f.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>o(f.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:f.text,children:f.text})},`${f.blockId}-${u}`))})]})});var Fk=e=>e,Hk=Object.freeze([]),Ak=()=>{};function _p(e){let t=F(),o=O(Fk),n=Pt.useMemo(()=>t&&!o.isLoading?t.getOutline():Hk,[t,o]),r=Pt.useCallback(i=>{if(!t)return;t.focus();let a={paragraphId:i,offset:0};t.exec({type:"setSelection",range:{anchor:a,head:a}}),t.scrollToBlock(i);},[t]);return In(o)?null:jsxRuntime.jsx(fi,{headings:n,onHeadingClick:r,onClose:e.onClose??Ak,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Np=Pt.createContext(null);function Vo(e){let t=Pt.useContext(Np);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Ar=280,ks=32,ev=16;function Or(e=280){return 32+e+16}function Is({viewportWidth:e,pageWidthPx:t,reservation:o,inlineEndReservation:n=0,inlineStartReservation:r=0,docked:i=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(n)||n<0||!Number.isFinite(r)||r<0)return 0;let a=(e-n-t)/2,s=a>=o?0:!i&&o<=2*a?2*(o-a):o;return Math.ceil(Math.max(0,s-r))}var Lp=320;function _s(e,t){return !Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?false:e-t<Lp}var Wk=Object.freeze([]),zk=e=>e;function Ns(){let e=F(),t=O(zk),[o,n]=Pt.useState(null),r=Pt.useMemo(()=>e&&!t.isLoading?e.getOutline():Wk,[e,t]),i=Pt.useMemo(()=>{if(r.length===0)return [];let s=r[0].level;for(let l of r)l.level<s&&(s=l.level);return r.map(l=>({heading:l,depth:l.level-s}))},[r]),a=Pt.useCallback(s=>{if(!e||typeof s!="string"||s.length===0)return;e.focus();let l={paragraphId:s,offset:0};e.exec({type:"setSelection",range:{anchor:l,head:l}}),e.scrollToBlock(s),n(s);},[e]);return {headings:r,items:i,selectedBlockId:o,goTo:a,isEmpty:r.length===0}}var lv=Object.freeze({query:"",matchCase:false,wholeWord:false,matches:Object.freeze([]),truncated:false,activeIndex:-1,activeMatch:null,isPending:false}),Gk=()=>()=>{},ov=()=>lv;function Ls(e={}){let t=e.highlight??"all",o=F(),n=Pt.useMemo(()=>o?editor.createDocumentSearch(o):null,[o]),r=Pt.useSyncExternalStore(n?n.subscribe:Gk,n?n.getState:ov,n?n.getState:ov);Pt.useEffect(()=>{if(!(!n||t==="none"))return n.showHighlights(t)},[n,t]);let i=Pt.useMemo(()=>({setQuery:a=>n?.setQuery(a),find:(a,s)=>n?.find(a,s)??lv.matches,setMatchCase:a=>n?.setMatchCase(a),setWholeWord:a=>n?.setWholeWord(a),goTo:a=>n?.goTo(a)??false,next:()=>n?.next()??false,previous:()=>n?.previous()??false,clear:()=>n?.clear()}),[n]);return Pt.useMemo(()=>({...r,...i}),[r,i])}function dv(e,t=i18n.isApplePlatform()){return e.altKey||e.shiftKey||e.isComposing||(t?!e.metaKey||e.ctrlKey:!e.ctrlKey||e.metaKey)?false:editor.chordLetter(e)==="f"}function uv(e){return e.startsWith("Ctrl")?"Control+F":"Meta+F"}function pv(e,t,o){if(e?.isConnected){o&&e.closest(".docx-pages")?o():e.focus({preventScroll:true});return}t?t.focus({preventScroll:true}):o?.();}function mv(e,t,o){if(!e||typeof Node>"u"||!(e instanceof Node))return false;if(t?.contains(e))return true;if(!o)return false;if(o.contains(e))return true;let n=e instanceof Element?e:e.parentElement;if(!n)return false;let r=editor.editorInstanceScope(o);if(r&&r!==o&&r.contains(n))return true;if(!n.closest(".docx-editor")||editor.editorInstanceScope(n)!==null)return false;let i=o.ownerDocument.querySelectorAll(".docx-editor__scroll-container");return i.length===1&&i[0]===o}function Hp(e,t){let o=e?.querySelector(`#docx-nav-panel-${t}`);if(!o)return null;if(t==="headings"){let n=o.querySelector(".docx-nav__heading--current")??o.querySelector(".docx-nav__heading");if(n)return n}return o.querySelector(".docx-nav__search-input")}function Ap(e){e.focus(),typeof HTMLInputElement<"u"&&e instanceof HTMLInputElement&&e.select();}function Xk(e){let o=e.querySelector('[role="tab"][aria-selected="true"]')?.id==="docx-nav-tab-find"?"find":"headings",n=Hp(e,o);if(n){Ap(n);return}e instanceof HTMLElement&&(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus());}function Jk(e,t){let o=[];if(t.contains(e)){let i=e;for(;i!==t&&i.parentElement;){for(let a of i.parentElement.children)a!==i&&o.push(a);i=i.parentElement;}}else o.push(...t.children);let n=e.ownerDocument.activeElement;n&&o.some(i=>i.contains(n))&&Xk(e);let r=[];for(let i of o)i.hasAttribute("inert")||(i.setAttribute("inert",""),r.push(i));return ()=>{for(let i of r)i.removeAttribute("inert");r.length=0;}}function fv(e,t,o){let n=Jk(e,t),r=i=>{i.target instanceof Node&&e.contains(i.target)||o();};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),n();}}function cv(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function gv(e,t){let o=()=>{let r=getComputedStyle(t),i=t.clientHeight-cv(r.paddingTop)-cv(r.paddingBottom);e.style.setProperty("--docx-nav-block-size",`${Math.max(0,Math.round(i))}px`),e.style.setProperty("--docx-nav-inline-size",`${Math.round(t.clientWidth)}px`);};if(o(),typeof ResizeObserver>"u")return ()=>{};let n=new ResizeObserver(o);return n.observe(t),()=>n.disconnect()}function hv(e,t=true){let o=F(),n=Ye(),r=Pt.useRef(null),i=Pt.useRef(null),a=Pt.useRef(false),s=Pt.useRef(false),l=Pt.useRef(false),c=Pt.useRef(0),d=Pt.useCallback(()=>{let b=++c.current;setTimeout(()=>{c.current===b&&(a.current=false,s.current=false,l.current=false);},0);},[]),f=Pt.useRef(e);f.current=e;let u=Pt.useCallback(()=>{a.current=false;let b=Hp(r.current,f.current.tab);b&&Ap(b);},[]),g=Pt.useCallback(()=>{s.current=false;let b=i.current;i.current=null;let S=r.current?.querySelector(".docx-nav__toggle")??null;pv(b,S,o?()=>o.focus():null);},[o]),m=Pt.useRef(g);m.current=g,Pt.useEffect(()=>()=>{s.current&&m.current();},[]);let p=Pt.useCallback(()=>{a.current=false,s.current=true,f.current.setOpen(false),d();},[d]),v=Pt.useMemo(()=>({toggle:()=>{if(f.current.open){p();return}i.current=null,s.current=false,a.current=true,f.current.setOpen(true),d();},close:p,picked:()=>{let b=f.current;if(!b.overlay)return;let S=r.current?.ownerDocument.activeElement;l.current=!!S&&!!r.current?.contains(S),b.setOpen(false),d();}}),[p,d]),y=Pt.useRef(v);y.current=v,Pt.useEffect(()=>{let b=r.current?.ownerDocument;if(!b||!t)return;let S=C=>{if(C.defaultPrevented||!dv(C)||!mv(C.target,r.current,n))return;C.preventDefault();let P=b.activeElement;P instanceof HTMLElement&&!r.current?.contains(P)&&(i.current=P),s.current=false;let T=f.current;if(T.open&&T.tab==="find"){u();return}a.current=true,T.tab!=="find"&&T.setTab("find"),T.open||T.setOpen(true),d();};return b.addEventListener("keydown",S),()=>b.removeEventListener("keydown",S)},[n,u,t,d]),Pt.useEffect(()=>{a.current&&(f.current.open?u():a.current=false),s.current&&(f.current.open?s.current=false:g()),l.current&&(l.current=false,f.current.open||o?.focus());});let x=e.open&&e.overlay;Pt.useEffect(()=>{let b=r.current;if(!(!x||!b||!n))return fv(b,n,()=>y.current.close())},[x,n]),Pt.useEffect(()=>{let b=r.current;if(!(!b||!n||!n.contains(b)))return gv(b,n)},[n]);let h=Pt.useCallback(b=>{b.key!=="Escape"||b.defaultPrevented||b.nativeEvent.isComposing||f.current.open&&(b.preventDefault(),p());},[p]);return {rootRef:r,intents:v,onKeyDown:h}}function e8(e){return e.source!==void 0?true:(e.created?.length??0)>0||(e.deleted?.length??0)>0}function t8(e){let t=0;for(let o of e)t=Math.max(t,o.box.width);return t>0?t:null}function bv(e,t){let o=null,n=false,r=()=>{o=null,n||t(t8(e.getPageGeometry()));},i=()=>{n||(o!==null&&clearTimeout(o),o=setTimeout(r,150));},a=e.on("change",s=>{e8(s)&&i();});return r(),{nudge:i,dispose(){n=true,o!==null&&clearTimeout(o),o=null,a();}}}var i8=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,zoom:e.zoom,reviewPaneOpen:e.reviewPaneOpen??true,fitting:t?.type==="fit"&&e.zoom<(t.maxZoom??editor.ZOOM_MAX)&&e.zoom>(t.minZoom??editor.ZOOM_MIN)}},l8=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips,s8=e=>e.page.total;function Fs(e={}){let{defaultOpen:t=false,defaultTab:o="headings",paneWidth:n=280}=e,[r,i]=Pt.useState(t),[a,s]=Pt.useState(o),l=e.open??r,c=e.tab??a,{onOpenChange:d,onTabChange:f}=e,u=e.open!==void 0,g=e.tab!==void 0,m=Pt.useCallback(K=>{u||i(K),d?.(K);},[u,d]),p=Pt.useCallback(()=>m(!l),[l,m]),v=Pt.useCallback(K=>{g||s(K),f?.(K);},[g,f]),y=rn(),x=Ye(),h=Pt.useContext(xt),{pageSetup:b,zoom:S,reviewPaneOpen:C,fitting:P}=O(i8,l8),T=F(),R=O(s8),[M,E]=Pt.useState(0),[_,H]=Pt.useState(null),[L,k]=Pt.useState(0),[w,I]=Pt.useState(0),$=qo();Pt.useEffect(()=>{if(!x){E(0),k(0),I(0);return}let K=()=>{E(x.clientWidth);let be=getComputedStyle(x),Re=Number.parseFloat(be.paddingInlineEnd);k(Number.isFinite(Re)?Re:0);let ue=Number.parseFloat(be.getPropertyValue("--docx-review-gutter-start"));I(Number.isFinite(ue)?ue:0);};if(K(),typeof ResizeObserver>"u")return;let Z=new ResizeObserver(K);return Z.observe(x),()=>Z.disconnect()},[x,l,C,h?.mounted,$]);let W=Pt.useRef(null);b&&(W.current=b.pageWidthTwips);let ee=b?.pageWidthTwips??W.current,V=Pt.useRef(null);Pt.useEffect(()=>{if(!l||!T)return;let K=bv(T,H);return V.current=K,()=>{K.dispose(),V.current===K&&(V.current=null);}},[l,T]),Pt.useEffect(()=>V.current?.nudge(),[R,ee]);let se=Or(n),U=a0($,L),ce=l&&_s(M-U,se),pe=Pt.useMemo(()=>!l||ce||ee===null?0:Is({viewportWidth:M,pageWidthPx:Math.max(_??0,Ne(ee))*S,reservation:se,inlineEndReservation:L,inlineStartReservation:w,docked:P}),[l,ce,ee,_,S,M,se,L,w,P]);return Pt.useEffect(()=>{if(y)return y.setShift(pe),()=>y.setShift(0)},[y,pe]),Pt.useEffect(()=>{if(y)return y.setReservation(l&&!ce?se:0),()=>y.setReservation(0)},[y,l,ce,se]),{open:l,setOpen:m,toggle:p,tab:c,setTab:v,paneWidth:n,shift:pe,overlay:ce}}var vi=["headings","find"],ao=(...e)=>e.filter(Boolean).join(" ");function yi({className:e,style:t,children:o}){return jsxRuntime.jsx("div",{className:ao("docx-nav__header",e),style:t,children:o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xi,{}),jsxRuntime.jsx(Ci,{})]})})}function xi({className:e,style:t,children:o}){let{intents:n,t:r}=Vo("Close");return jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:n.close,children:o??jsxRuntime.jsx(z,{name:"arrow_back",size:20})})}function Ci({className:e,style:t,children:o}){let{t:n}=Vo("Title");return jsxRuntime.jsx("h2",{className:ao("docx-nav__title",e),style:t,children:o??n("navigation.title")})}function Ti({className:e,style:t,children:o}){let{pane:n,t:r}=Vo("Tabs"),i=Pt.useCallback(a=>{let s=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(s===0)return;a.preventDefault();let l=vi.indexOf(n.tab);n.setTab(vi[(l+s+vi.length)%vi.length]);},[n]);return jsxRuntime.jsx("div",{className:ao("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:o??vi.map(a=>jsxRuntime.jsx(Pi,{value:a},a))})}function Pi({value:e,className:t,style:o,children:n}){let{pane:r,t:i}=Vo("Tab"),a=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":a,"aria-controls":`docx-nav-panel-${e}`,tabIndex:a?0:-1,className:ao("docx-nav__tab",a&&"docx-nav__tab--selected",t),style:o,onClick:()=>r.setTab(e),children:n??i(`navigation.tabs.${e}`)})}function yv({value:e,onChange:t,onClear:o,placeholder:n,label:r,clearLabel:i,autoFocus:a,onEnter:s}){let l=Pt.useRef(null);return Pt.useEffect(()=>{a&&l.current?.focus();},[a]),jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(z,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{ref:l,type:"search",className:"docx-nav__search-input",value:e,placeholder:n,"aria-label":r,autoFocus:a,onChange:c=>t(c.target.value),onKeyDown:c=>{!s||c.key!=="Enter"||c.nativeEvent.isComposing||(c.preventDefault(),s(c.shiftKey));}}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":i,onClick:o,children:jsxRuntime.jsx(z,{name:"close",size:16})})]})}function Si({className:e,style:t}){let{pane:o,outline:n,intents:r,t:i}=Vo("Headings"),[a,s]=Pt.useState(""),l=O(In),c=Pt.useMemo(()=>{let f=a.trim().toLowerCase();return f.length===0?n.items:n.items.filter(u=>u.heading.text.toLowerCase().includes(f))},[n.items,a]),d=o.tab!=="headings";return jsxRuntime.jsxs("div",{className:ao("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:d,children:[jsxRuntime.jsx(yv,{value:a,onChange:s,onClear:()=>s(""),placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel")}),l?null:n.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((f,u)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__heading",n.selectedBlockId===f.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+f.depth*14}px`},title:f.heading.text,onClick:()=>{n.goTo(f.heading.blockId),r.picked();},children:f.heading.text})},`${f.heading.blockId}-${u}`))})]})}function f8({match:e,active:t,onSelect:o}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:o,children:jsxRuntime.jsxs("span",{className:"docx-nav__result-text",children:[e.contextBefore,jsxRuntime.jsx("mark",{className:"docx-nav__result-hit",children:e.text}),e.contextAfter]})})})}function Ei({className:e,style:t}){let{pane:o,search:n,intents:r,t:i}=Vo("Find"),a=o.tab!=="find",s=n.query.trim().length>0,l=o.open&&!a,c=n.matches.length===0?null:n.activeIndex<0?i(n.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:n.matches.length}):i(n.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:n.activeIndex+1,total:n.matches.length});return jsxRuntime.jsxs("div",{className:ao("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(yv,{value:n.query,onChange:n.setQuery,onClear:n.clear,placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel"),autoFocus:l,onEnter:d=>{n.isPending&&n.find(n.query),d?n.previous():n.next();}}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":i("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.matchCase,onChange:d=>n.setMatchCase(d.target.checked)}),i("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.wholeWord,onChange:d=>n.setWholeWord(d.target.checked)}),i("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:s?n.isPending?i("navigation.find.searching"):c??i("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.previousAriaLabel"),disabled:n.matches.length===0,onClick:n.previous,children:jsxRuntime.jsx(z,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.nextAriaLabel"),disabled:n.matches.length===0,onClick:n.next,children:jsxRuntime.jsx(z,{name:"keyboard_arrow_down",size:18})})]})]}),n.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":i("navigation.find.resultsAriaLabel"),children:n.matches.map((d,f)=>jsxRuntime.jsx(f8,{match:d,active:f===n.activeIndex,onSelect:()=>{n.goTo(f),r.picked();}},`${d.blockId}-${d.start}-${f}`))})]})}function wi({className:e,style:t,children:o}){let{pane:n,intents:r,findShortcut:i,t:a}=Vo("Toggle"),l=ko()("Ctrl+F"),c=i?uv(l):void 0,d=i?a("navigation.openShortcutTitle",{shortcut:l}):a("navigation.openTitle");return jsxRuntime.jsx("button",{type:"button",className:ao("docx-nav__toggle",e),style:t,"aria-label":a("navigation.openAriaLabel"),"aria-expanded":n.open,"aria-keyshortcuts":c,title:d,onMouseDown:f=>f.preventDefault(),onClick:r.toggle,children:o??jsxRuntime.jsx(z,{name:"toc",size:20})})}function Bp(e){let t=Ct(),{t:o,toggle:n=true,searchHighlight:r="all",findShortcut:i=true,className:a,style:s,children:l,...c}=e,d=Fs(c),f=Ns(),u=d.open&&d.tab==="find"?r:"none",g=Ls({highlight:u}),m=Ue(),p=Pt.useMemo(()=>o??((h,b)=>m(h,b)),[o,m]),v=hv(d,i),y=Pt.useMemo(()=>({pane:d,outline:f,search:g,t:p,intents:v.intents,findShortcut:i}),[d,f,g,p,v.intents,i]),x=e.paneWidth??280;return jsxRuntime.jsx(Np.Provider,{value:y,children:jsxRuntime.jsxs("div",{ref:v.rootRef,className:`${t}docx-nav${d.open?" docx-nav--open":""}${d.overlay?" docx-nav--overlay":""}${a?` ${a}`:""}`,"data-open":d.open?"true":"false",onKeyDown:v.onKeyDown,style:{"--docx-nav-width":`${x}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${Or(x)}px`,...s},children:[n!==false&&!d.open&&jsxRuntime.jsx(wi,{...typeof n=="object"?n:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":y.t("navigation.ariaLabel"),inert:!d.open,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yi,{}),jsxRuntime.jsx(Ti,{}),jsxRuntime.jsx(Si,{}),jsxRuntime.jsx(Ei,{})]})})]})})}var Hs=Object.assign(Bp,{Header:yi,Close:xi,Title:Ci,Tabs:Ti,Tab:Pi,Headings:Si,Find:Ei,Toggle:wi});var C8=600,T8=e=>e.isOpening===true?0:e.page.total,As=Pt.createContext(null);function Os({className:e,style:t}){let o=Ct(),n=F(),r=Ye(),{inside:i,host:a,hostScoped:s}=c0(r),l=O(T8),{t:c}=N(),d=Pt.useContext(As),[f,u]=Pt.useState(1),[g,m]=Pt.useState(false);if(Pt.useEffect(()=>{if(m(false),!n||!r||l<=1)return;u(n.getCurrentPage("viewport"));let x=null,h=()=>{u(n.getCurrentPage("viewport")),m(true),x&&clearTimeout(x),x=setTimeout(()=>m(false),C8);};return r.addEventListener("scroll",h,{passive:true}),()=>{r.removeEventListener("scroll",h),x&&clearTimeout(x);}},[n,l,r]),l<=1)return null;let p=a?s?"":"docx-editor ":o,v=d?d("viewer.pageIndicator").replace(/\{current\}/g,String(f)).replace(/\{total\}/g,String(l)):c("viewer.pageIndicator",{current:f,total:l}),y=jsxRuntime.jsx("div",{className:`${p}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":g?"true":"false",role:"status","aria-live":"polite",children:v});return i?a?reactDom.createPortal(y,a):null:y}var E8=[],w8=e=>e.fontSubstitutions??E8;function Bs({className:e,style:t,t:o}){let n=O(w8),{t:r}=N(),i=o??r,[a,s]=Pt.useState(null);if(n.length===0)return null;let l=n.join("\0");return a===l?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:i("editor.fontSubstitutionNotice",{fonts:n.join(", ")}).replace("{fonts}",n.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>s(l),children:i("common.dismiss")})]})}function Zp(e){return Math.round(e/1440*100)/100}function Sv(e){return Math.round(e*1440)}function D8(e,t){return e===t?true:!e||!t?false:e.editing===t.editing&&e.sectionIndex===t.sectionIndex&&e.variant===t.variant&&e.rId===t.rId&&e.partName===t.partName&&e.inherited===t.inherited&&e.titlePage===t.titlePage&&e.evenAndOddHeaders===t.evenAndOddHeaders&&e.headerDistanceTwips===t.headerDistanceTwips&&e.footerDistanceTwips===t.footerDistanceTwips}function qp(){let e=F(),t=Pt.useCallback(o=>e?.getHeaderFooterState()??null,[e]);return O(t,D8)}function _8(e,t){return t==="first"?e==="header"?"headerFooter.firstPageHeader":"headerFooter.firstPageFooter":t==="even"?e==="header"?"headerFooter.evenPageHeader":"headerFooter.evenPageFooter":e==="header"?"headerFooter.header":"headerFooter.footer"}var N8=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Mi(e){let t=F();return Pt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function L8(e){let{state:t,onMouseDown:o}=e,{t:n}=N(),r=F(),[i,a]=Pt.useState(false),s=Pt.useRef(null),[l,c]=Pt.useState(""),[d,f]=Pt.useState("");Pt.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(c(String(Zp(t.headerDistanceTwips))),f(String(Zp(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),Pt.useEffect(()=>{if(!i)return;let P=T=>{s.current?.contains(T.target)||a(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[i]);let u=Pt.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=Pt.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),m=Pt.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),p=Pt.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),v=Pt.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),y=Mi(u),x=Mi(g),h=Mi(m),b=Mi(p),S=Mi(v),C=(P,T)=>{if(!r)return;let R=Number.parseFloat(T);Number.isFinite(R)&&r.exec({type:"setHeaderFooterOptions",[P]:Sv(R)});};return jsxRuntime.jsxs("div",{ref:s,className:"docx-hf-chrome__options",onMouseDown:o,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":i,"aria-haspopup":"menu",onClick:()=>a(P=>!P),onMouseDown:o,children:n("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:o,children:[N8.map(P=>{let T={type:"insertPageField",field:P.field},R=r?.can(T);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!R?.ok,title:R&&!R.ok?R.reason:void 0,onClick:()=>{r?.exec(T),a(false);},onMouseDown:o,children:n(P.labelKey)},P.field)}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.titlePage===true,disabled:!y.enabled,title:y.reason??void 0,onChange:()=>r?.exec(u)}),jsxRuntime.jsx("span",{children:n("headerFooter.differentFirstPage")})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.evenAndOddHeaders===true,disabled:!x.enabled,title:x.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[n("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:n("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!b.enabled,title:b.reason??void 0,onClick:()=>r?.exec(p),onMouseDown:o,children:n("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!h.enabled,title:h.reason??void 0,onClick:()=>r?.exec(m),onMouseDown:o,children:n("headerFooter.linkToPrevious")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.headerDistance"),value:l,onChange:P=>c(P.target.value),onBlur:()=>C("headerDistanceTwips",l)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.footerDistance"),value:d,onChange:P=>f(P.target.value),onBlur:()=>C("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!S.enabled,title:S.reason??void 0,onClick:()=>r?.exec(v),onMouseDown:o,children:t.editing==="header"?n("headerFooter.removeHeader"):n("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),a(false);},onMouseDown:o,children:n("common.close")})]}):null]})}function Zs({className:e}){let{t}=N(),o=qp(),n=Pt.useCallback(s=>s.querySelector("[data-docx-hf-active]"),[]),r=ya(n,"story-label"),i=B;if(!o?.editing)return null;let a=_8(o.editing,o.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:ct.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),o.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(L8,{state:o,onMouseDown:i})]})}var O8={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},B8={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},Z8={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},q8={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},K8={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},W8={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:"var(--doc-z-overlay)",backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},z8={padding:"8px 12px"},$8={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},U8={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},V8={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function G8({forwardedRef:e}){let t=F(),o=Pt.useRef(null);return o.current=t,u0({ref:e,editorRef:o}),null}var j8=Pt.forwardRef(function(t,o){let{document:n,fonts:r,className:i,t:a,chrome:s=true,title:l,onTitleChange:c,renderTitleBarLeft:d,renderTitleBarRight:f,loadingIndicator:u,colorMode:g="light",author:m,locale:p,mode:v="edit",modules:y,zoom:x,zoomMode:h,revisionMarkup:b,onRevisionMarkupChange:S,reviewDisplayMode:C,fieldResults:P,onReady:T,onChange:R,onFontError:M,onOpen:E,onSave:_,hyperlinkPopup:H,contextMenu:L=true,menu:k=true,navigation:w=true,rulers:I=true}=t;!s&&u!==void 0&&Gg();let[$,W]=Pt.useState(vg);Pt.useEffect(()=>{if(g==="system")return xg(W)},[g]);let ee=yg(g,$),{t:V}=N(),se=Pt.useCallback((K,Z)=>a?a(K,Z):V(K,Z),[a,V]),U=jsxRuntime.jsxs(Zl,{className:s?ee?"dark":void 0:i,style:s?B8:void 0,children:[s?jsxRuntime.jsx(Zs,{}):null,s?jsxRuntime.jsx(fl,{}):null,jsxRuntime.jsx(Ll,{}),I&&s?jsxRuntime.jsx("div",{style:K8,children:jsxRuntime.jsx(Ds,{})}):null,t.children]}),ce=s?jsxRuntime.jsxs("div",{className:`docx-editor${ee?" dark":""}${i?` ${i}`:""}`,style:O8,children:[jsxRuntime.jsxs("div",{style:W8,children:[jsxRuntime.jsxs("div",{style:$8,children:[d?.(),jsxRuntime.jsxs("div",{style:U8,children:[c?jsxRuntime.jsx("input",{"aria-label":se("titleBar.documentNameAriaLabel"),value:l??"",placeholder:se("titleBar.untitled"),onChange:K=>c(K.target.value),style:V8}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:l??se("titleBar.untitled")}),k!==false?jsxRuntime.jsx(ci,{t:se,...l!==void 0?{fileName:l}:{},...E?{onOpen:E}:{},..._?{onSave:_}:{},...typeof k=="object"?k:{}}):null]}),f?.()]}),jsxRuntime.jsx("div",{style:z8,children:jsxRuntime.jsx(ri,{t:se})})]}),I?jsxRuntime.jsx("div",{style:q8,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(Rs,{})}):null,jsxRuntime.jsx(Bs,{t:se}),jsxRuntime.jsxs("div",{style:Z8,children:[w===false?null:jsxRuntime.jsx(Hs,{t:se,...typeof w=="object"?w:{}}),U,jsxRuntime.jsx(As.Provider,{value:se,children:jsxRuntime.jsx(Os,{})}),jsxRuntime.jsx(Hl,{overlay:true,indicator:u})]})]}):U,pe=Pt.useCallback(K=>se(K),[se]);return jsxRuntime.jsxs(Na,{popups:jf(t.popups,H,L,se),...n!==void 0?{document:n}:{},...r?{fonts:r}:{},...m!==void 0?{author:m}:{},...p!==void 0?{locale:p}:{},translate:se,mode:v,...y!==void 0?{modules:y}:{},...x!==void 0?{zoom:x}:{},revisionMarkup:b,onRevisionMarkupChange:S,reviewDisplayMode:C,...P!==void 0?{fieldResults:P}:{},...h!==void 0?{zoomMode:h}:{},tableInteractionLabel:pe,...T?{onReady:T}:{},...R?{onChange:R}:{},...M?{onFontError:M}:{},children:[jsxRuntime.jsx(G8,{forwardedRef:o}),jsxRuntime.jsx(vn.Provider,{value:s,children:ce})]})}),Y8=Pt.forwardRef(function(t,o){return jsxRuntime.jsx(Un,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(j8,{...t,ref:o})})}),X8=Object.assign(Y8,{Root:Na,Viewport:Zl,Content:Ll,Toolbar:ri,Menu:ci,Loading:Hl,ColorByChangeType:vu,RevisionMarkup:Nc,RevisionMarkupDialog:Ur,AuthorStyle:yu,HorizontalRuler:Rs,VerticalRuler:Ds,DocumentOutline:_p,Navigation:Hs,ExportDialog:Vr,PrintDialog:Gr,PageSetupDialog:Sn,ParagraphDialog:yo,TextFormFieldDialog:Ma,PageNumber:Os,FontNotice:Bs,HeaderFooterChrome:Zs,NotesChrome:fl,Equation:oa,HyperLink:Jr,ContextMenu:Pd,ContentControlWidget:ru,InvalidTextFormFieldDialog:Hd,ImageAltTextPopup:Cl,ImagePropertiesDialog:Ca,NotePropertiesDialog:gl,NotePreview:jn,NotesContextMenu:Yn,ContentControl:ta});function oI(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Wp(e){return Array.isArray(e)?e:[e]}function nI(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function Dv(e){return e!==void 0&&Wp(e).some(t=>editor.isFontResolver(t))}async function rI(e){return typeof e!="function"?await e:await e()}function aI(e,t={}){let[o,n]=Pt.useState(void 0),[r,i]=Pt.useState(void 0),[a,s]=Pt.useState(null),[l,c]=Pt.useState(e!=null),d=Dv(t.fonts),f=t.fonts===void 0?"absent":d?"on-demand":"eager",[u,g]=Pt.useState(t.fonts===void 0),m=Pt.useRef(t);m.current=t;let p=Pt.useMemo(()=>editor.defineFontResolver(v=>editor.composeFontOrigins(Wp(m.current.fonts??[]).map(nI),v)),[]);return Pt.useEffect(()=>{let v=m.current.fonts;if(v===void 0){i(void 0),g(true);return}if(Dv(v)){g(true);return}g(false);let y=true;return (async()=>{try{let x=await Promise.allSettled(Wp(v).map(rI)),h=[];for(let b of x){if(b.status==="rejected"){console.warn("[fonts] font loading failed for one origin; the others still compose",b.reason);continue}b.value!==void 0&&h.push(b.value);}y&&h.length>0&&i(editor.composeFontConfiguration(h[0],...h.slice(1)));}catch(x){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",x);}finally{y&&g(true);}})(),()=>{y=false;}},[f]),Pt.useEffect(()=>{if(e==null){n(void 0),s(null),c(false);return}let v=oI(e);if(v){n(v),s(null),c(false);return}let y=true,x=new AbortController;return c(true),s(null),(async()=>{try{let h=await fetch(String(e),{...m.current.fetchOptions,signal:x.signal});if(!h.ok)throw new Error(`could not open the document: ${h.status} ${h.statusText}`);let b=new Uint8Array(await h.arrayBuffer());if(!y)return;n(b),c(!1);}catch(h){if(!y||h instanceof Error&&h.name==="AbortError")return;s(h instanceof Error?h:new Error("could not open the document")),c(false);}})(),()=>{y=false,x.abort();}},[e]),{document:u?o:void 0,fonts:d?p:r,error:a,isLoading:l||!u}}function dI(...e){let t=Pt.useRef(e);return t.current=e,Pt.useMemo(()=>editor.defineFontResolver(o=>editor.composeFontOrigins(t.current,o)),[])}function mI(e){let o=e?.surface?.state?.().selection?.head;return o&&typeof o.paragraphId=="string"&&Number.isFinite(o.offset)?o:null}function fI(){let e=F(),t=Pt.useRef(null),o=Pt.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),n=Pt.useCallback(()=>{let r=mI(e),i=t.current;return (r===null?i===null:i!==null&&gI(i,r))?i:(t.current=r,r)},[e]);return Pt.useSyncExternalStore(o,n,()=>null)}function gI(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}var Lv=Object.freeze({applied:0,unavailable:0});function Fv(e){if(!e)return "";let{color:t,activeColor:o,activeIndex:n,className:r,priority:i}=e;return JSON.stringify([t,o,n,r,i])}function yI(e,t,o){let n=F(),[r,i]=Pt.useState(Lv),a=Pt.useRef(null),s=Pt.useRef(o);s.current=o;let l=Pt.useRef(t);l.current=t;let c=Fv(o);return Pt.useEffect(()=>{if(!n){i(Lv);return}let d=editor.watchHighlights(n,e,l.current,{...s.current,onResult:i});return a.current={watch:d,source:l.current,key:Fv(s.current)},i(d.result),()=>{d.stop(),a.current=null;}},[n,e]),Pt.useEffect(()=>{let d=a.current;!d||d.source===t&&d.key===c||(d.source=t,d.key=c,d.watch.update(t,s.current??{}));},[t,c]),r}function TI(e,t){return e===t?true:!e||!t?false:e.name===t.name&&e.index===t.index&&e.range===t.range&&e.active===t.active&&e.rect.left===t.rect.left&&e.rect.top===t.rect.top&&e.rect.width===t.rect.width&&e.rect.height===t.rect.height}function PI(e){let t=F(),[o,n]=Pt.useState(null);return Pt.useEffect(()=>{if(!t){n(null);return}let r=globalThis.document,i=0,a=null,s=()=>{i=0;let u=a?t.getHighlightsAt(a.x,a.y).find(g=>e===void 0||g.name===e)??null:null;n(g=>TI(g,u)?g:u);},l=()=>{i===0&&(i=requestAnimationFrame(s));},c=u=>{let g=u.target;a=g instanceof Element&&g.closest("[data-page-index]")!==null?{x:u.clientX,y:u.clientY}:null,l();},d=u=>{u.relatedTarget||(a=null,l());};r.addEventListener("pointermove",c,{passive:true}),r.addEventListener("pointerout",d,{passive:true}),r.addEventListener("scroll",l,{passive:true,capture:true});let f=t.on("change",l);return ()=>{r.removeEventListener("pointermove",c),r.removeEventListener("pointerout",d),r.removeEventListener("scroll",l,{capture:true}),f(),i!==0&&cancelAnimationFrame(i);}},[t,e]),o}function $p({source:e,scale:t,measurer:o,onStateChange:n,onError:r,className:i,documentFontFamily:a,ref:s}){let l=Pt.useRef(null),c=Pt.useRef(null),[d,f]=Pt.useState(null),u=Pt.useRef(n);u.current=n;let g=Pt.useRef(r);return g.current=r,Pt.useEffect(()=>{let m=l.current;if(!m)return;let p=editor.mountPaginatedSurface(m,e,{...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onChange:y=>{f(y),u.current?.(y);}});if(!p.ok){g.current?.(p.reason,p.detail);return}c.current=p.surface;let v=p.surface.state();return f(v),u.current?.(v),()=>{p.surface.destroy(),c.current=null;}},[e,o]),Pt.useImperativeHandle(s,()=>({focus:()=>c.current?.focus(),type:m=>c.current?.type(m),undo:()=>c.current?.undo(),redo:()=>c.current?.redo(),selectAll:()=>c.current?.selectAll(),navigate:(m,p)=>c.current?.navigate(m,p),toggleRunProperty:(m,p)=>c.current?.toggleRunProperty(m,p),setRunProperty:(m,p)=>c.current?.setRunProperty(m,p),setParagraphProperty:(m,p,v)=>c.current?.setParagraphProperty(m,p,v),formatting:()=>c.current?.formatting()??null,sectionProperties:()=>c.current?.sectionProperties()??null,save:()=>c.current?.save()??null}),[]),jsxRuntime.jsx("div",{ref:l,style:{margin:"24px auto",...a?{fontFamily:a}:{}},className:i?`docx-paginated-surface ${i}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Di=Pt.createContext(null);function Hv(){let e=Pt.useContext(Di);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function _I(e){return "type"in e&&e.type==="separator"}var Bv={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},NI={...Bv,background:"var(--doc-bg-hover)"},Zv={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},LI={...Zv,opacity:.4,cursor:"default"},FI={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},HI={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},AI={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function ki({label:e,items:t,disabled:o,showChevron:n=false}){let[r,i]=Pt.useState(false),[a,s]=Pt.useState(null),l=Pt.useRef(null),c=Pt.useRef(null),[d,f]=Pt.useState({top:0,left:0}),u=Pt.useCallback(()=>{i(false),s(null);},[]);Pt.useEffect(()=>{if(!r||!l.current)return;let m=l.current.getBoundingClientRect();f({top:m.bottom+2,left:m.left});},[r]),Pt.useEffect(()=>{if(!r)return;function m(y){let x=y.target;l.current&&!l.current.contains(x)&&c.current&&!c.current.contains(x)&&u();}function p(y){y.key==="Escape"&&u();}function v(){u();}return document.addEventListener("mousedown",m),document.addEventListener("keydown",p),window.addEventListener("scroll",v,true),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",p),window.removeEventListener("scroll",v,true);}},[r,u]);let g=m=>{m.disabled||m.submenuContent||m.onClick&&(m.onClick(),u());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",onClick:()=>!o&&i(!r),onMouseDown:m=>m.preventDefault(),disabled:o,style:r?NI:Bv,children:[e,n&&jsxRuntime.jsx(z,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:c,style:{position:"fixed",top:d.top,left:d.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:m=>m.preventDefault(),children:t.map((m,p)=>{if(_I(m))return jsxRuntime.jsx("div",{style:FI},`sep-${p}`);let v=m;if(v.customContent)return jsxRuntime.jsx("div",{onMouseDown:h=>h.preventDefault(),children:v.customContent},v.label);let y=!!v.submenuContent,x=a===v.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>y&&s(v.label),onMouseLeave:()=>y&&s(null),children:[jsxRuntime.jsxs("button",{type:"button",style:v.disabled?LI:Zv,onClick:()=>g(v),onMouseDown:h=>h.preventDefault(),onMouseOver:h=>{v.disabled||(h.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent";},disabled:v.disabled,children:[v.icon&&jsxRuntime.jsx(z,{name:v.icon,size:18}),jsxRuntime.jsx("span",{children:v.label}),v.shortcut&&jsxRuntime.jsx("span",{style:HI,children:v.shortcut}),y&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(z,{name:"keyboard_arrow_right",size:16})})]}),y&&x&&jsxRuntime.jsx("div",{style:AI,onMouseDown:h=>h.preventDefault(),children:v.submenuContent(u)})]},v.label)})})]})}var Gp=18,BI=2,Kv={width:Gp,height:Gp,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},ZI={...Kv,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},qI={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Wv({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[n,r]=Pt.useState(0),[i,a]=Pt.useState(0),s=Pt.useCallback(()=>{n>0&&i>0&&e(n,i);},[n,i,e]),l=[];for(let d=1;d<=t;d++)for(let f=1;f<=o;f++){let u=d<=n&&f<=i;l.push(jsxRuntime.jsx("div",{style:u?ZI:Kv,onMouseEnter:()=>{r(d),a(f);},onClick:s,role:"gridcell","aria-selected":u},`${d}-${f}`));}let c=n>0&&i>0?`${i} \xD7 ${n}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:BI,gridTemplateColumns:`repeat(${o}, ${Gp}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:l}),jsxRuntime.jsx("div",{style:qI,children:c})]})}function $I({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(o=>{let n=!o.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:n,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:n?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:n?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{n||(o.onClick?.(),t());},onMouseOver:r=>{n||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(z,{name:o.icon,size:18}),jsxRuntime.jsx("span",{children:o.label})]},o.label)})})}function UI(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Ws({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function VI(e){return e.replace(/\.docx$/i,"")}function Yp({value:e,onChange:t,placeholder:o,editable:n=true}){let{t:r}=N(),i=o??r("titleBar.untitled"),a=VI(e)??"";return n?jsxRuntime.jsx("input",{type:"text",value:a,onChange:s=>{let l=s.target.value;t?.(l.endsWith(".docx")?l:l+".docx");},placeholder:i,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:a||i})}function zs({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function $s(){let{t:e}=N(),t=Hv(),{disabled:o=false,onFormat:n,onPrint:r,onOpen:i,onSave:a,onPageSetup:s,onInsertImage:l,onInsertTable:c,showTableInsert:d=true,showHelpMenu:f=true,onInsertPageBreak:u,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:m,onInsertTOC:p,onWatermark:v,onRefocusEditor:y}=t,x=Pt.useCallback(C=>{!o&&n&&n(C);},[o,n]),h=Pt.useCallback((C,P)=>{!o&&c&&(c(C,P),requestAnimationFrame(()=>y?.()));},[o,c,y]),b=!!r||!!s,S=b||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[S&&jsxRuntime.jsx(ki,{label:e("toolbar.file"),disabled:o,items:[...i?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:i}]:[],...a?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:a}]:[],...(i||a)&&b?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...s?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:s}]:[]]}),jsxRuntime.jsx(ki,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>x("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>x("setRtl")}]}),jsxRuntime.jsx(ki,{label:e("toolbar.insert"),disabled:o,items:[...l?[{icon:"image",label:e("toolbar.image"),onClick:l}]:[],...d&&c?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:C=>jsxRuntime.jsx(Wv,{onInsert:(P,T)=>{h(P,T),C();}})}]:[],...l||d&&c?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:C=>jsxRuntime.jsx($I,{closeMenu:C,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:u},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:g},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:m}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:p,disabled:!p},...v?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:v}]:[]]}),f&&jsxRuntime.jsx(ki,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>ii()}]})]})}function Xp({children:e}){let t=null,o=null,n=[],r=[];Pt.Children.forEach(e,a=>{Pt.isValidElement(a)&&(a.type===Ws?t=a:a.type===zs?o=a:a.type===$s?r.push(a):n.push(a));});let i=Pt.useCallback(a=>{let s=a.target;s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.tagName==="OPTION"||a.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(UI,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[n.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:n}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),o&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:o})]})}var Us={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},XI={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},zv={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function JI(e,t){let o=zv[t]??zv[t.toLowerCase()]??t,r=e?.colorScheme?.[o];return typeof r=="string"&&r?r:Us[o]??"000000"}function $v(e){let t=e.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/.test(t))return t;if(/^[0-9A-F]{3}$/.test(t))return t.split("").map(o=>o+o).join("")}function Jp(e,t,o="000000"){if(!e||e.kind==="auto")return `#${o}`;if(e.kind==="hex")return `#${$v(e.value)??o}`;let n=Object.entries(t?.colorScheme??Us).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,n);return `#${r.ok?r.hex:JI(t,e.slot)}`}function So(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?$v(e.value):Jp(e,t).slice(1)}function Uv(e){if(!e||e==="none")return "";let t=XI[e];return t?`#${t}`:""}var QI=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],e_=[{type:"base",keep:1,labelSuffix:""},{type:"tint",keep:.2,labelSuffix:", Lighter 80%"},{type:"tint",keep:.4,labelSuffix:", Lighter 60%"},{type:"tint",keep:.6,labelSuffix:", Lighter 40%"},{type:"shade",keep:.75,labelSuffix:", Darker 25%"},{type:"shade",keep:.5,labelSuffix:", Darker 50%"}];function Vv(e){let t=e??Us;return e_.map(o=>QI.map(n=>{let r=t[n.slot]??Us[n.slot]??"000000",a={hex:o.type==="base"?r.toUpperCase():o.type==="tint"?editor.applyThemeTint(r,o.keep):editor.applyThemeShade(r,o.keep),themeSlot:n.slot,label:`${n.name}${o.labelSuffix}`};return o.type==="tint"?a.tint=o.keep:o.type==="shade"&&(a.shade=o.keep),a}))}function ae(...e){return clsx.clsx(e)}var n_=classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),Xe=Pt__namespace.forwardRef(({className:e,variant:t,size:o,...n},r)=>jsxRuntime.jsx("button",{className:ae(n_({variant:t,size:o,className:e})),ref:r,...n}));Xe.displayName="Button";function Dt({content:e,children:t,side:o="bottom",delayMs:n=400}){let[r,i]=Pt__namespace.useState(false),[a,s]=Pt__namespace.useState({x:0,y:0}),l=Pt__namespace.useRef(null),c=Pt__namespace.useRef(null),d=Pt__namespace.useCallback(()=>{c.current=setTimeout(()=>{if(l.current){let m=l.current.getBoundingClientRect(),p=m.left+m.width/2,v=o==="top"?m.top-8:m.bottom+8;s({x:p,y:v});}i(true);},n);},[n,o]),f=Pt__namespace.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),i(false);},[]);Pt__namespace.useEffect(()=>()=>{c.current&&clearTimeout(c.current);},[]);let u=t.props,g=Pt__namespace.cloneElement(t,{ref:l,onMouseEnter:m=>{d(),u.onMouseEnter?.(m);},onMouseLeave:m=>{f(),u.onMouseLeave?.(m);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:a.x,top:a.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var Go=Ee__namespace.Root,jo=Ee__namespace.Group,Vs=Ee__namespace.Value;function Yo({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(Ee__namespace.Trigger,{className:ae("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:r=>{r.preventDefault(),o?.(r);},...n,children:[t,jsxRuntime.jsx(Ee__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(s_,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Xo({className:e,children:t,position:o="popper",onCloseAutoFocus:n,...r}){let i=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(Ee__namespace.Portal,{children:jsxRuntime.jsx("div",{className:ae("docx-editor",i&&"dark"),children:jsxRuntime.jsx(Ee__namespace.Content,{className:ae("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:a=>{a.preventDefault(),n?.(a);},...r,children:jsxRuntime.jsx(Ee__namespace.Viewport,{className:ae("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:a=>a.preventDefault(),children:t})})})})}function Fn({className:e,...t}){return jsxRuntime.jsx(Ee__namespace.Label,{className:ae("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function kt({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(Ee__namespace.Item,{className:ae("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),o?.(r);},...n,children:[jsxRuntime.jsx(Ee__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(Ee__namespace.ItemIndicator,{children:jsxRuntime.jsx(c_,{className:"h-4 w-4"})})})]})}function Hn({className:e,...t}){return jsxRuntime.jsx(Ee__namespace.Separator,{className:ae("-mx-1 my-1 h-px bg-muted",e),...t})}function s_({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function c_({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function Qp(e){let t=e.trim();if(!t)return "";let o=null,n="";for(let r of t){if((r==='"'||r==="'")&&o===null){o=r,n+=r;continue}if(r===o){o=null,n+=r;continue}if(r===","&&o===null)break;n+=r;}return n.trim().replace(/^['"]|['"]$/g,"")}var d_=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function Yv({value:e,onChange:t,fonts:o=d_,documentFonts:n,disabled:r=false,className:i,placeholder:a="Arial",width:s=120,showPreview:l=true}){let{t:c}=N(),d=Pt__namespace.useMemo(()=>{if(!n)return [];let p=new Set(o.map(v=>v.name.toLowerCase()));return n.filter(v=>!p.has(v.name.toLowerCase()))},[n,o]),f=Pt__namespace.useMemo(()=>[...d,...o],[d,o]),u=Pt__namespace.useMemo(()=>e?f.find(v=>v.fontFamily===e||v.name.toLowerCase()===e.toLowerCase()||Qp(v.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,f,a]),g=Pt__namespace.useCallback(p=>{let v=f.find(y=>y.name===p);v&&t?.(Qp(v.fontFamily)||v.name);},[t,f]),m=Pt__namespace.useMemo(()=>{let p={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(v=>{let y=v.category||"other";p[y].push(v);}),p},[o]);return jsxRuntime.jsxs(Go,{value:u,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(Yo,{className:ae("h-8 text-sm",i),style:{minWidth:typeof s=="number"?`${s}px`:s},"aria-label":c("font.selectAriaLabel"),children:jsxRuntime.jsx(Vs,{placeholder:a,children:u})}),jsxRuntime.jsxs(Xo,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.documentFonts")}),d.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},`doc-${p.name}`))]}),jsxRuntime.jsx(Hn,{})]}),m["sans-serif"].length>0&&jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.sansSerif")}),m["sans-serif"].map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]}),m.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.serif")}),m.serif.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]}),m.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.monospace")}),m.monospace.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]}),m.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(jo,{children:m.other.map(p=>jsxRuntime.jsx(kt,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))})]})]})]})}function em(e){if(e===void 0)return;let t=e.map(o=>typeof o=="string"?{name:o,fontFamily:o,category:"other"}:o);if(jt()){let o=new Set,n=new Set;for(let r of t)n.has(r.name)&&!o.has(r.name)&&(console.warn(`[DocxEditor] Duplicate font name in fontFamilies: "${r.name}"`),o.add(r.name)),n.add(r.name);}return t}function m_(e,t,o,n){let i=Math.max(8,window.innerWidth-o-8),a=Math.max(8,window.innerHeight-n-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function bt({isOpen:e,onClose:t,align:o="left"}){let n=Pt.useRef(null),r=Pt.useRef(null),[i,a]=Pt.useState({top:0,left:0});Pt.useEffect(()=>{if(!e||!n.current)return;let c=n.current.getBoundingClientRect();o==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),f=m_(c.bottom+4,c.right-d.width,d.width,d.height);a(f);}else a({top:c.bottom+4,left:c.left});}):a({top:c.bottom+4,left:c.left});},[e,o]),Pt.useEffect(()=>{if(!e)return;let c=performance.now()+150,d=g=>{let m=g.target;n.current&&!n.current.contains(m)&&r.current&&!r.current.contains(m)&&t();},f=g=>{g.key==="Escape"&&t();},u=g=>{if(performance.now()<c)return;let m=g.target;m&&r.current&&r.current.contains(m)||m instanceof Element&&m!==document.documentElement&&m!==document.body&&n.current&&m.contains(n.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),window.addEventListener("scroll",u,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f),window.removeEventListener("scroll",u,true);}},[e,t]);let s=Pt.useCallback(c=>{c.preventDefault(),c.stopPropagation();},[]),l={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:n,dropdownRef:r,dropdownStyle:l,handleMouseDown:s}}var h_=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],b_=1,v_=400;function Qv(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function ey(e,t,o){for(let n=t.length-1;n>=0;n--)if(t[n]<e)return t[n];return Math.max(e-1,o)}function ty({value:e,onChange:t,sizes:o=h_,disabled:n=false,className:r,placeholder:i="11",minSize:a=b_,maxSize:s=v_}){let{t:l}=N(),[c,d]=Pt.useState(false),[f,u]=Pt.useState(""),[g,m]=Pt.useState(false),p=Pt.useRef(null),v=Pt.useCallback(()=>{m(false),d(false);},[]),{containerRef:y,dropdownRef:x,dropdownStyle:h}=bt({isOpen:g,onClose:v}),b=e??(parseInt(i,10)||11),S=e!==void 0?e.toString():i,C=Pt.useCallback(L=>{if(L.preventDefault(),n)return;let k=ey(b,o,a);t?.(k);},[b,o,a,n,t]),P=Pt.useCallback(L=>{if(L.preventDefault(),n)return;let k=Qv(b,o,s);t?.(k);},[b,o,s,n,t]),T=Pt.useCallback(L=>{L.preventDefault(),!n&&(d(true),u(S),m(true),requestAnimationFrame(()=>{p.current?.focus(),p.current?.select();}));},[n,S]),R=Pt.useCallback(L=>{u(L.target.value);},[]),M=Pt.useCallback(()=>{d(false);let L=parseFloat(f);if(!isNaN(L)&&L>=a&&L<=s){let k=Math.round(L*2)/2;t?.(k);}},[f,a,s,t]),E=Pt.useCallback(L=>{if(L.key==="Enter")L.preventDefault(),M(),m(false);else if(L.key==="Escape")d(false),m(false);else if(L.key==="ArrowUp"){L.preventDefault();let k=Qv(b,o,s);u(k.toString()),t?.(k);}else if(L.key==="ArrowDown"){L.preventDefault();let k=ey(b,o,a);u(k.toString()),t?.(k);}},[M,b,o,s,a,t]),_=Pt.useCallback(L=>{t?.(L),m(false),d(false);},[t]),H=Pt.useCallback(L=>{L.target.tagName!=="INPUT"&&L.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:y,className:ae("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:C,disabled:n||b<=a,"aria-label":l("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(z,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:c?jsxRuntime.jsx("input",{ref:p,type:"text",value:f,onChange:R,onBlur:M,onKeyDown:E,className:ae("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":l("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:T,className:ae("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",n&&"opacity-50 cursor-not-allowed"),disabled:n,"aria-label":l("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:S})}),g&&jsxRuntime.jsx("div",{ref:x,style:{...h,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":l("fontSize.listLabel"),children:o.map(L=>jsxRuntime.jsx("button",{type:"button",onClick:()=>_(L),className:ae("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",L===b&&"bg-muted font-medium"),role:"option","aria-selected":L===b,children:L},L))}),jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:P,disabled:n||b>=s,"aria-label":l("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(z,{name:"add",size:18})})]})}var C_=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],js=18,T_=2,P_={position:"relative",display:"inline-block"},S_={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},E_={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},nm={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},rm={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},ry={display:"grid",gap:`${T_}px`},Ys={width:`${js}px`,height:`${js}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},ay={...Ys,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},iy={...Ys,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},w_={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},M_={display:"flex",alignItems:"center",gap:"6px"},R_={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},D_={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},oy={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},k_={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},I_={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},__={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function am(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let n=Uv(e);return n||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Jp(e,o)}function ny(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let o=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (o*299+n*587+r*114)/1e3>230}function ly(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():So(e,o))===t.toUpperCase():false}function N_({matrix:e,selectedColor:t,theme:o,onSelect:n}){let[r,i]=Pt.useState(null);return jsxRuntime.jsx("div",{style:{...ry,gridTemplateColumns:`repeat(10, ${js}px)`},children:e.flatMap((a,s)=>a.map((l,c)=>{let d=`${s}-${c}`,f=r===d,u=ly(t,l.hex,o);return jsxRuntime.jsx("button",{type:"button",style:{...u?iy:f?ay:Ys,backgroundColor:`#${l.hex}`},title:l.label,"aria-label":l.label,"aria-selected":u,onClick:()=>n(l),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function L_({selectedColor:e,theme:t,onSelect:o}){let[n,r]=Pt.useState(null),{t:i}=N();return jsxRuntime.jsx("div",{style:{...ry,gridTemplateColumns:`repeat(10, ${js}px)`},children:C_.map((a,s)=>{let l=n===s,c=ly(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...c?iy:l?ay:Ys,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":c,onClick:()=>o(a.hex),onMouseDown:f=>f.preventDefault(),onMouseEnter:()=>r(s),onMouseLeave:()=>r(null)},a.hex)})})}function Bn({mode:e,value:t,onChange:o,theme:n,disabled:r=false,className:i,style:a,title:s,icon:l,autoLabel:c,splitButton:d=true,defaultColor:f}){let[u,g]=Pt.useState(false),[m,p]=Pt.useState(false),[v,y]=Pt.useState(false),[x,h]=Pt.useState(false),[b,S]=Pt.useState(""),[C,P]=Pt.useState(()=>f??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:T}=N();Pt.useEffect(()=>{let K=am(t,e,n).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(K)&&S(K.toUpperCase());},[t,e,n]);let R=Pt.useCallback(()=>g(false),[]),{containerRef:M,dropdownRef:E,dropdownStyle:_}=bt({isOpen:u,onClose:R}),H=n?.colorScheme??null,L=Pt.useMemo(()=>Vv(H),[H]),k=Pt.useMemo(()=>am(t,e,n),[t,e,n]),w=Pt.useMemo(()=>am(C,e,n),[C,e,n]),I=Pt.useCallback(()=>{r||g(K=>!K);},[r]),$=Pt.useCallback(K=>{let Z;e==="highlight"?Z=K.hex:Z={kind:"theme",slot:K.themeSlot,...K.tint!==void 0?{tint:K.tint}:{},...K.shade!==void 0?{shade:K.shade}:{}},P(Z),o?.(Z),g(false);},[e,o]),W=Pt.useCallback(K=>{let Z=e==="highlight"?K:{kind:"hex",value:K};P(Z),o?.(Z),g(false);},[e,o]),ee=Pt.useCallback(()=>{o?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,o]),V=Pt.useCallback(()=>{let K=b.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(K)){let Z=e==="highlight"?K:{kind:"hex",value:K};P(Z),o?.(Z),g(false),S("");}},[e,b,o]),se=Pt.useCallback(()=>{r||o?.(C);},[r,C,o]),U={...S_,...r?{cursor:"default",opacity:.38}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:m?{backgroundColor:"var(--doc-bg-hover)"}:{}},ce=T(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),pe=l??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:M,className:`docx-color-picker ${i||""}`,style:{...P_,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...k_,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...I_,...r?{cursor:"default"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:se,onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:r,title:s||ce,"aria-label":s||ce,children:[jsxRuntime.jsx(z,{name:pe,size:18}),jsxRuntime.jsx("div",{style:{...oy,backgroundColor:w==="transparent"?"#fff":w,outline:w==="transparent"||ny(w)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...__,...r?{cursor:"default"}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:x?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:I,onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:s||ce,"aria-label":s||ce,"aria-haspopup":"true","aria-expanded":u,children:jsxRuntime.jsx(z,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:U,onClick:I,onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),disabled:r,title:s||ce,"aria-label":s||ce,"aria-haspopup":"true","aria-expanded":u,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(z,{name:pe,size:18}),jsxRuntime.jsx("div",{style:{...oy,backgroundColor:k==="transparent"?"#fff":k,outline:k==="transparent"||ny(k)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14})]}),u&&jsxRuntime.jsx("div",{ref:E,className:"docx-color-picker-dropdown",style:{..._,...E_},role:"dialog","aria-label":`${ce} picker`,onMouseDown:K=>{K.target.tagName!=="INPUT"&&K.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:w_,onClick:ee,onMouseDown:K=>K.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),c??T(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:T("colorPicker.themeColors")}),jsxRuntime.jsx(N_,{matrix:L,selectedColor:t,theme:n,onSelect:$}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:T("colorPicker.standardColors")}),jsxRuntime.jsx(L_,{selectedColor:t,theme:n,onSelect:W}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:T("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:M_,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:R_,value:b,onChange:K=>S(K.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:K=>{K.key==="Enter"&&V();},onMouseDown:K=>{K.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...D_,opacity:/^[0-9A-Fa-f]{6}$/.test(b)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(b)?"pointer":"default"},onClick:V,onMouseDown:K=>K.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(b),children:T("common.apply")})]})]})})]})}var _i=20,im=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_left",size:_i}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_center",size:_i}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_right",size:_i}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(z,{name:"format_align_justify",size:_i}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function dy({value:e="left",onChange:t,disabled:o=false}){let{t:n}=N(),[r,i]=Pt.useState(false),a=Pt.useCallback(()=>i(false),[]),{containerRef:s,dropdownRef:l,dropdownStyle:c,handleMouseDown:d}=bt({isOpen:r,onClose:a}),f=Pt.useCallback(y=>{o||t?.(y),i(false);},[o,t]),u=im.find(y=>y.value===e)||im[0],g=n(u.labelKey),m=u.shortcutKey?n(u.shortcutKey):void 0,p=`${g}${m?` (${m})`:""}`,v=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",o&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!o&&i(y=>!y),disabled:o,"aria-label":p,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(z,{name:u.iconName,size:_i}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?v:jsxRuntime.jsx(Dt,{content:p,children:v}),r&&!o&&jsxRuntime.jsx("div",{ref:l,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:y=>y.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:im.map(y=>{let x=e===y.value,h=n(y.labelKey),b=y.shortcutKey?n(y.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${h}${b?` (${b})`:""}`,"data-testid":`alignment-${y.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:x?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:x?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{x||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=x?"var(--doc-primary-light)":"transparent";},onClick:()=>f(y.value),children:jsxRuntime.jsx(z,{name:y.iconName,size:18})},y.value)})})})]})}function Xs(){return {type:"none",level:0,isInList:false}}var B_={display:"inline-flex",alignItems:"center",gap:"4px"},uy={display:"inline-flex",alignItems:"center",gap:"4px"},tc={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},Z_={...tc,backgroundColor:"var(--doc-bg-hover)"},q_={...tc,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},K_={...tc,cursor:"default",opacity:.38},W_={width:"28px",height:"28px",padding:"2px"},z_={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Js=20;function Qs({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,style:a}){let[s,l]=Pt.useState(false),c={...t?K_:e?q_:s?Z_:tc,...a},d=f=>{f.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:c,onMouseDown:d,onClick:t?void 0:n,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:r})}function py({listState:e,onBulletList:t,onNumberedList:o,onIndent:n,onOutdent:r,disabled:i=false,className:a,style:s,showIndentButtons:l=true,compact:c=false,hasIndent:d=false}){let{t:f}=N(),u=Pt.useCallback(()=>c?{...W_}:{},[c]),g=e?.type==="bullet",m=e?.type==="numbered",v=(e?.isInList||g||m)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...B_,...s},role:"group","aria-label":f("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:uy,role:"group","aria-label":f("lists.typeAriaLabel"),children:[jsxRuntime.jsx(Qs,{active:g,disabled:i,title:f("lists.bulletList"),onClick:t,style:u(),children:jsxRuntime.jsx(z,{name:"format_list_bulleted",size:Js})}),jsxRuntime.jsx(Qs,{active:m,disabled:i,title:f("lists.numberedList"),onClick:o,style:u(),children:jsxRuntime.jsx(z,{name:"format_list_numbered",size:Js})})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:z_,role:"separator"}),jsxRuntime.jsxs("div",{style:uy,role:"group","aria-label":f("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(Qs,{active:false,disabled:i||!v,title:f("lists.decreaseIndent"),onClick:r,style:u(),children:jsxRuntime.jsx(z,{name:"format_indent_decrease",size:Js})}),jsxRuntime.jsx(Qs,{active:false,disabled:i,title:f("lists.increaseIndent"),onClick:n,style:u(),children:jsxRuntime.jsx(z,{name:"format_indent_increase",size:Js})})]})]})]})}var U_=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function fy({value:e,onChange:t,options:o=U_,disabled:n=false,className:r}){let{t:i}=N(),a=Pt__namespace.useMemo(()=>e===void 0?o[0]:o.find(c=>c.twipsValue===e)||o[0],[e,o]),s=Pt__namespace.useCallback(c=>{let d=parseInt(c,10);isNaN(d)||t?.(d);},[t]),l=c=>c.labelKey?i(c.labelKey):c.label;return jsxRuntime.jsxs(Go,{value:a.twipsValue.toString(),onValueChange:s,disabled:n,children:[jsxRuntime.jsx(Yo,{className:ae("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":i("lineSpacing.label"),title:i("lineSpacing.lineSpacingTitle",{label:l(a)}),children:jsxRuntime.jsx(kp,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Xo,{children:[o.map(c=>jsxRuntime.jsx(kt,{value:c.twipsValue.toString(),children:l(c)},c.twipsValue)),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(jo,{children:jsxRuntime.jsx(Fn,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var gy=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function hy({value:e,onChange:t,styles:o,disabled:n=false,className:r,width:i=120}){let{t:a}=N(),s=Pt__namespace.useMemo(()=>{let g=Ph(o);return g.length===0?gy:g.map(m=>({...m,type:"paragraph",nameKey:gy.find(p=>p.styleId===m.styleId)?.nameKey}))},[o]),l=Pt__namespace.useCallback(g=>{t?.(g);},[t]),c=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",f=s.find(g=>g.styleId===d),u=f?c(f):d;return jsxRuntime.jsxs(Go,{value:d,onValueChange:l,disabled:n,children:[jsxRuntime.jsx(Yo,{className:ae("h-8 text-sm",r),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":a("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:u})}),jsxRuntime.jsx(Xo,{className:"min-w-[260px] max-h-[400px]",children:s.map(g=>jsxRuntime.jsx(kt,{value:g.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:Th(g),children:c(g)})},g.styleId))})]})}var G_=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function vy({value:e=1,onChange:t,levels:o=G_,disabled:n=false,className:r,compact:i=false}){let{t:a}=N(),s=Pt__namespace.useMemo(()=>{let g=o.find(m=>Math.abs(m.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[o,e]),l=Pt__namespace.useCallback(g=>{let m=parseFloat(g);isNaN(m)||t?.(m);},[t]),c=Pt__namespace.useMemo(()=>[...o].sort((g,m)=>g.value-m.value),[o]),d=Pt__namespace.useMemo(()=>[...c].reverse().find(g=>g.value<e-.001),[c,e]),f=Pt__namespace.useMemo(()=>c.find(g=>g.value>e+.001),[c,e]),u=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(n||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:n||!d,"aria-label":a("zoom.zoomOut"),children:jsxRuntime.jsx(z,{name:"remove",size:18})}),jsxRuntime.jsxs(Go,{value:e.toString(),onValueChange:l,disabled:n,children:[jsxRuntime.jsx(Yo,{className:ae(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":a("zoom.ariaLabel",{label:s}),children:jsxRuntime.jsx(Vs,{placeholder:"100%",children:s})}),jsxRuntime.jsx(Xo,{children:o.map(g=>jsxRuntime.jsx(kt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(n||!f)&&"opacity-30 cursor-not-allowed"),onClick:()=>f&&t?.(f.value),disabled:n||!f,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx(z,{name:"add",size:18})})]})}var Y_=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function Cy({onAction:e,disabled:t=false}){let{t:o}=N(),[n,r]=Pt.useState(false),i=Pt.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:s,dropdownStyle:l,handleMouseDown:c}=bt({isOpen:n,onClose:i}),d=Pt.useCallback(u=>{e(u),r(false);},[e]),f=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&r(u=>!u),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(z,{name:"border_all",size:20}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?f:jsxRuntime.jsx(Dt,{content:o("table.borders.tooltip"),children:f}),n&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:u=>u.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:Y_.map(({action:u,icon:g,labelKey:m})=>jsxRuntime.jsx("button",{type:"button",title:o(m),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:p=>p.preventDefault(),onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:jsxRuntime.jsx(z,{name:g,size:18})},typeof u=="string"?u:u.type))})})]})}function Ty({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Pt.useCallback(a=>{if(typeof a=="string"){e({type:"borderColor",color:a.replace(/^#/,"")});return}let s=a.kind==="auto"?"000000":So(a,o);s&&e({type:"borderColor",color:s});},[e,o]);return jsxRuntime.jsx(Bn,{mode:"border",value:n,onChange:i,theme:o,disabled:t,title:r("table.borderColor")})}var e5=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function Sy({onAction:e,disabled:t=false}){let[o,n]=Pt.useState(false),{t:r}=N(),i=Pt.useCallback(()=>n(false),[]),{containerRef:a,dropdownRef:s,dropdownStyle:l,handleMouseDown:c}=bt({isOpen:o,onClose:i}),d=Pt.useCallback(u=>{e({type:"borderWidth",size:u}),n(false);},[e]),f=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&n(u=>!u),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(z,{name:"line_weight",size:20}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?f:jsxRuntime.jsx(Dt,{content:r("table.borderWidth"),children:f}),o&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:u=>u.stopPropagation(),children:e5.map(({size:u,label:g,thickness:m})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:p=>p.preventDefault(),onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(m,1),backgroundColor:"#000",borderRadius:m>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},u))})]})}function wy({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Pt.useCallback(a=>{typeof a=="string"&&e(a==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:a.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(Bn,{mode:"highlight",value:n,onChange:i,theme:o,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var o5={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},Kn={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Dy={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function ky({onAction:e,disabled:t=false,tableContext:o}){let{t:n}=N(),[r,i]=Pt.useState(false),[a,s]=Pt.useState(null),l=Pt.useCallback(()=>i(false),[]),{containerRef:c,dropdownRef:d,dropdownStyle:f,handleMouseDown:u}=bt({isOpen:r,onClose:l,align:"right"}),g=o?.table?.attrs?.justification??"left",m=Pt.useCallback(y=>{e(y),i(false);},[e]),p=(y,x,h,b,S)=>{let C=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...o5,backgroundColor:a===y&&!C?"var(--doc-bg-hover)":"transparent",color:C?"var(--doc-text-muted)":S?.danger?"var(--doc-error)":"var(--doc-text)",cursor:C?"not-allowed":"pointer"},onClick:()=>!C&&m(b),onMouseEnter:()=>s(y),onMouseLeave:()=>s(null),disabled:C,children:[jsxRuntime.jsx(z,{name:x,size:16,className:S?.danger&&!C?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:h})]},y)},v=jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:u,onClick:()=>!t&&i(y=>!y),disabled:t,"aria-label":n("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(z,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[r?v:jsxRuntime.jsx(Dt,{content:n("table.moreOptions"),children:v}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...f,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:y=>y.stopPropagation(),children:[p("addRowAbove","add",n("table.insertRowAbove"),"addRowAbove"),p("addRowBelow","add",n("table.insertRowBelow"),"addRowBelow"),p("addColumnLeft","add",n("table.insertColumnLeft"),"addColumnLeft"),p("addColumnRight","add",n("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("mergeCells","call_merge",n("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),p("splitCell","call_split",n("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("selectTable","select_all",n("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("deleteRow","delete",n("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),p("deleteColumn","delete",n("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),p("deleteTable","delete",n("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),jsxRuntime.jsx("div",{style:Dy,children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(y=>{let x={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:n({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:b=>b.preventDefault(),onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},onClick:()=>m({type:"cellVerticalAlign",align:y}),children:jsxRuntime.jsx(z,{name:x[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),jsxRuntime.jsx("div",{style:Dy,children:n("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(y=>{let x={left:"format_align_left",center:"format_align_center",right:"format_align_right"},h=g===y;return jsxRuntime.jsx("button",{type:"button",title:n({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",borderColor:h?"var(--doc-primary)":"var(--doc-border)",color:h?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:b=>b.preventDefault(),onClick:()=>m({type:"tableProperties",props:{justification:y}}),children:jsxRuntime.jsx(z,{name:x[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("headerRow","table_rows",n("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),p("distribute","view_column",n("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),p("autoFit","fit_width",n("tableAdvanced.autoFit"),{type:"autoFitContents"}),p("noWrap","wrap_text",n("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("properties","settings",n("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var r5=20;function rc({options:e,activeValue:t,triggerIcon:o,tooltipContent:n,onSelect:r,disabled:i=false,ariaLabel:a,testId:s,showLabels:l=false}){let[c,d]=Pt.useState(false),f=Pt.useCallback(()=>d(false),[]),{containerRef:u,dropdownRef:g,dropdownStyle:m,handleMouseDown:p}=bt({isOpen:c,onClose:f}),v=Pt.useCallback(x=>{i||r(x),d(false);},[i,r]),y=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:ae("text-muted-foreground hover:text-foreground hover:bg-muted/80",c&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!i&&d(x=>!x),disabled:i,"aria-label":a??n,"aria-expanded":c,"aria-haspopup":"true","data-testid":s,children:[jsxRuntime.jsx(z,{name:o,size:r5}),jsxRuntime.jsx(z,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:u,style:{position:"relative",display:"inline-block"},children:[c?y:jsxRuntime.jsx(Dt,{content:n,children:y}),c&&!i&&jsxRuntime.jsx("div",{ref:g,style:{...m,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:x=>x.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:l?"column":"row",gap:l?1:2,minWidth:l?200:void 0},children:e.map(x=>{let h=t===x.value;return jsxRuntime.jsxs("button",{type:"button",title:x.label,"data-testid":s?`${s}-${x.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:h?"var(--doc-primary)":"var(--doc-text)",...l?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:b=>b.preventDefault(),onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:b=>{b.currentTarget.style.backgroundColor=h?"var(--doc-primary-light)":"transparent";},onClick:()=>v(x.value),children:[jsxRuntime.jsx(z,{name:x.iconName,size:18}),l&&jsxRuntime.jsx("span",{style:{flex:1},children:x.label})]},x.value)})})})]})}var a5=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function i5(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function _y({imageContext:e,onChange:t,disabled:o=false}){let{t:n}=N(),r=a5.map(s=>({...s,label:n(s.labelKey)})),i=i5(e),a=r.find(s=>s.value===i)||r[0];return jsxRuntime.jsx(rc,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var s5=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function Ny({onTransform:e,disabled:t=false}){let{t:o}=N(),n=s5.map(r=>({...r,label:o(r.labelKey)}));return jsxRuntime.jsx(rc,{options:n,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var $t=18;function It({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,ariaLabel:a}){let s=a?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),l=d=>{d.preventDefault();},c=jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:ae("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",i),"data-active":e?"true":void 0,onMouseDown:l,onClick:t?void 0:n,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":a||o,"data-testid":s?`toolbar-${s}`:void 0,children:r});return o?jsxRuntime.jsx(Dt,{content:o,children:c}):c}function Ut({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:ae("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function m5(e){let t=Pt__namespace.default.useContext(Di);return t?{...t,...f5(e)}:e}function f5(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function dm(e){let{t}=N(),o=m5(e),{currentFormatting:n={},onFormat:r,onUndo:i,onRedo:a,canUndo:s=false,canRedo:l=false,disabled:c=false,className:d,style:f,enableShortcuts:u=true,editorRef:g,children:m,showFontPicker:p=true,fontFamilies:v,documentFonts:y,showFontSizePicker:x=true,showTextColorPicker:h=true,showHighlightColorPicker:b=true,showAlignmentButtons:S=true,showListButtons:C=true,showLineSpacingPicker:P=true,showStylePicker:T=true,documentStyles:R,theme:M,showZoomControl:E=true,zoom:_,onZoomChange:H,onRefocusEditor:L,imageContext:k,onImageWrapType:w,onImageTransform:I,onOpenImageProperties:$,tableContext:W,onTableAction:ee,inline:V=false}=o,se=Pt.useRef(null),U=Pt.useCallback(oe=>{!c&&r&&r(oe);},[c,r]),ce=Pt.useCallback(()=>{!c&&s&&i&&i();},[c,s,i]),pe=Pt.useCallback(()=>{!c&&l&&a&&a();},[c,l,a]),K=Pt.useCallback(oe=>{!c&&r&&r({type:"fontFamily",value:oe});},[c,r]),Z=Pt__namespace.default.useMemo(()=>em(v),[v]),be=Pt.useCallback(oe=>{!c&&r&&r({type:"fontSize",value:oe});},[c,r]),Re=Pt.useCallback(oe=>{!c&&r&&r({type:"textColor",value:oe});},[c,r]),ue=Pt.useCallback(oe=>{!c&&r&&r({type:"highlightColor",value:typeof oe=="string"?oe:""});},[c,r]),ze=Pt.useCallback(oe=>{!c&&r&&r({type:"alignment",value:oe});},[c,r]),_t=Pt.useCallback(()=>{!c&&r&&r("bulletList");},[c,r]),Je=Pt.useCallback(()=>{!c&&r&&r("numberedList");},[c,r]),ut=Pt.useCallback(()=>{!c&&r&&r("indent");},[c,r]),Pe=Pt.useCallback(()=>{!c&&r&&r("outdent");},[c,r]),co=Pt.useCallback(oe=>{!c&&r&&(r({type:"lineSpacing",value:oe}),requestAnimationFrame(()=>L?.()));},[c,r,L]),uo=Pt.useCallback(oe=>{!c&&r&&r({type:"applyStyle",value:oe});},[c,r]),po=Pt.useCallback(oe=>{!c&&ee&&(ee(oe),requestAnimationFrame(()=>L?.()));},[c,ee,L]);Pt.useEffect(()=>{if(!u)return;let oe=fe=>{if(fe.defaultPrevented)return;let yt=fe.target,zn=g?.current,ne=se.current,te=zn?.contains(yt),ve=ne?.contains(yt);if(!te&&!ve)return;if((fe.ctrlKey||fe.metaKey)&&!fe.altKey)switch(fe.key.toLowerCase()){case "b":fe.preventDefault(),U("bold");break;case "i":fe.preventDefault(),U("italic");break;case "u":fe.preventDefault(),U("underline");break;case "=":fe.shiftKey?(fe.preventDefault(),U("superscript")):(fe.preventDefault(),U("subscript"));break;case "l":fe.preventDefault(),ze("left");break;case "e":fe.preventDefault(),ze("center");break;case "r":fe.preventDefault(),ze("right");break;case "j":fe.preventDefault(),ze("both");break;case "k":fe.preventDefault(),U("insertLink");break}};return document.addEventListener("keydown",oe),()=>{document.removeEventListener("keydown",oe);}},[u,U,ze,g]);let Mo=Pt.useCallback(oe=>{let fe=oe.target;fe.tagName==="INPUT"||fe.tagName==="TEXTAREA"||fe.tagName==="SELECT"||fe.tagName==="OPTION"||oe.preventDefault();},[]),Gt=Pt.useCallback(oe=>{let fe=oe.target,yt=document.activeElement;fe.tagName==="SELECT"||fe.tagName==="OPTION"||yt?.tagName==="SELECT"||requestAnimationFrame(()=>{L?.();});},[L]);return jsxRuntime.jsxs("div",{ref:se,className:ae(!V&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:V?{display:"contents",...f}:f,role:V?void 0:"toolbar","aria-label":V?void 0:t("toolbar.ariaLabel"),"data-testid":V?void 0:"formatting-bar",onMouseDown:V?void 0:Mo,onMouseUp:V?void 0:Gt,children:[jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(It,{onClick:ce,disabled:c||!s,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(z,{name:"undo",size:$t})}),jsxRuntime.jsx(It,{onClick:pe,disabled:c||!l,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(z,{name:"redo",size:$t})})]}),E&&jsxRuntime.jsx(Ut,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(vy,{value:_,onChange:H,disabled:c,compact:true})}),T&&jsxRuntime.jsx(Ut,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(hy,{value:n.styleId||"Normal",onChange:uo,styles:R,theme:M,disabled:c,width:120})}),(p||x)&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.font"),children:[p&&jsxRuntime.jsx(Yv,{value:n.fontFamily||"Arial",onChange:K,fonts:Z,documentFonts:y,disabled:c,width:60,placeholder:"Arial"}),x&&jsxRuntime.jsx(ty,{value:n.fontSize!==void 0?hu(n.fontSize):11,onChange:be,disabled:c,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(It,{onClick:()=>U("bold"),active:n.bold,disabled:c,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(z,{name:"format_bold",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("italic"),active:n.italic,disabled:c,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(z,{name:"format_italic",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("underline"),active:n.underline,disabled:c,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(z,{name:"format_underlined",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("strikethrough"),active:n.strike,disabled:c,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(z,{name:"strikethrough_s",size:$t})}),h&&jsxRuntime.jsx(Bn,{mode:"text",value:n.color?.replace(/^#/,""),onChange:Re,theme:M,disabled:c,title:t("formattingBar.fontColor")}),b&&jsxRuntime.jsx(Bn,{mode:"highlight",value:n.highlight,onChange:ue,theme:M,disabled:c,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(It,{onClick:()=>U("insertLink"),disabled:c,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(z,{name:"link",size:$t})})]}),jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(It,{onClick:()=>U("superscript"),active:n.superscript,disabled:c,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(z,{name:"superscript",size:$t})}),jsxRuntime.jsx(It,{onClick:()=>U("subscript"),active:n.subscript,disabled:c,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(z,{name:"subscript",size:$t})})]}),S&&jsxRuntime.jsx(Ut,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(dy,{value:n.alignment||"left",onChange:ze,disabled:c})}),(C||P)&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.listFormatting"),children:[C&&jsxRuntime.jsx(py,{listState:n.listState||Xs(),onBulletList:_t,onNumberedList:Je,onIndent:ut,onOutdent:Pe,disabled:c,showIndentButtons:true,compact:true,hasIndent:(n.indentLeft??0)>0}),P&&jsxRuntime.jsx(fy,{value:n.lineSpacing,onChange:co,disabled:c})]}),k&&w&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(_y,{imageContext:k,onChange:w,disabled:c}),I&&jsxRuntime.jsx(Ny,{onTransform:I,disabled:c}),$&&jsxRuntime.jsx(It,{onClick:$,disabled:c,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(z,{name:"tune",size:$t})})]}),W?.isInTable&&ee&&jsxRuntime.jsxs(Ut,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(Cy,{onAction:po,disabled:c}),jsxRuntime.jsx(Ty,{onAction:po,disabled:c,theme:M,value:So(W?.cellBorderColor,M)}),jsxRuntime.jsx(Sy,{onAction:po,disabled:c}),jsxRuntime.jsx(wy,{onAction:po,disabled:c,theme:M,value:W?.cellBackgroundColor}),jsxRuntime.jsx(ky,{onAction:po,disabled:c,tableContext:W})]}),jsxRuntime.jsx(It,{onClick:()=>U("clearFormatting"),disabled:c,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(z,{name:"format_clear",size:$t})}),m]})}function g5({children:e,className:t,style:o,...n}){return jsxRuntime.jsx(Di.Provider,{value:n,children:jsxRuntime.jsx("div",{className:ae("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:ct.toolbar,...o},"data-testid":"editor-toolbar",children:e})})}var vt=g5;vt.TitleBar=Xp;vt.Logo=Ws;vt.DocumentName=Yp;vt.MenuBar=$s;vt.TitleBarRight=zs;vt.Toolbar=dm;var v5=new Map([["#ffff00","yellow"],["#00ff00","green"],["#00ffff","cyan"],["#ff00ff","magenta"],["#0000ff","blue"],["#ff0000","red"],["#000080","darkBlue"],["#008080","darkCyan"],["#008000","darkGreen"],["#800080","darkMagenta"],["#800000","darkRed"],["#808000","darkYellow"],["#808080","darkGray"],["#c0c0c0","lightGray"],["#ffffff","white"]]),y5=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function x5({source:e,scale:t,measurer:o,documentName:n,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:s,renderTitleBarRight:l,ref:c,colorMode:d,onZoomChange:f,documentFontFamily:u,className:g}){let m=Pt.useRef(null),[p,v]=Pt.useState(null),[y,x]=Pt.useState({}),[h,b]=Pt.useState(null),S=Pt.useCallback(R=>{v(R);let M=m.current?.formatting();M&&x({bold:M.bold,italic:M.italic,underline:M.underline,strike:M.strikethrough,superscript:M.superscript,subscript:M.subscript,...M.fontFamily?{fontFamily:M.fontFamily}:{},...M.fontSizeHalfPoints?{fontSize:M.fontSizeHalfPoints}:{},...M.alignment?{alignment:M.alignment}:{},...M.styleId?{styleId:M.styleId}:{},...M.color?{color:`#${M.color}`}:{},...M.highlight?{highlight:M.highlight}:{}}),b(m.current?.sectionProperties()??null),r?.(R);},[r]),C=Pt.useCallback(R=>{let M=m.current;if(M){if(typeof R=="string")switch(R){case "bold":return M.toggleRunProperty("b");case "italic":return M.toggleRunProperty("i");case "underline":return M.toggleRunProperty("u",{val:"single"});case "strikethrough":return M.toggleRunProperty("strike");case "superscript":return M.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return M.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":M.setRunProperty("b",{val:"0"}),M.setRunProperty("i",{val:"0"}),M.setRunProperty("u",{val:"none"}),M.setRunProperty("strike",{val:"0"}),M.setRunProperty("vertAlign",{val:"baseline"});return;case "setRtl":case "setLtr":return M.setParagraphProperty("bidi",void 0,{paragraphDirection:R==="setRtl"?"rtl":"ltr"});default:return}switch(R.type){case "fontFamily":return M.setRunProperty("rFonts",{ascii:R.value,hAnsi:R.value});case "fontSize":return M.setRunProperty("sz",{val:String(Math.round(R.value*2))});case "textColor":{let E=R.value,_=typeof E=="string"?y5(E):So(E,null)??null;return _?M.setRunProperty("color",{val:_}):void 0}case "highlightColor":{let E=R.value.trim().toLowerCase();if(E==="none"||E==="")return M.setRunProperty("highlight",{val:"none"});let _=v5.get(E.startsWith("#")?E:`#${E}`);return _?M.setRunProperty("highlight",{val:_}):void 0}case "alignment":return M.setParagraphProperty("jc",{val:String(R.value)},{physicalAlignment:true});case "lineSpacing":return M.setParagraphProperty("spacing",{line:String(Math.round(R.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return M.setParagraphProperty("pStyle",{val:R.value});default:return}}},[]);Pt.useImperativeHandle(c,()=>m.current,[]);let P=t===void 0?1:t/(96/72),T=h?{pageWidthTwips:h.pageSize.widthTwips,pageHeightTwips:h.pageSize.heightTwips,orientation:h.landscape?"landscape":"portrait",marginsTwips:{top:h.margins.topTwips,right:h.margins.rightTwips,bottom:h.margins.bottomTwips,left:h.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",g??""].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:"var(--doc-bg)",color:"var(--doc-text)"},"data-testid":"paginated-shell",children:[jsxRuntime.jsxs(vt,{currentFormatting:y,onFormat:C,onUndo:()=>m.current?.undo(),onRedo:()=>m.current?.redo(),canUndo:p?.canUndo??false,canRedo:p?.canRedo??false,zoom:P,onZoomChange:f,onSave:()=>{let R=m.current?.save();R&&a?.(R);},children:[jsxRuntime.jsxs(vt.TitleBar,{children:[s&&jsxRuntime.jsx(vt.Logo,{children:s()}),jsxRuntime.jsx(vt.DocumentName,{value:n??"Document",editable:false}),l&&jsxRuntime.jsx(vt.TitleBarRight,{children:l()}),jsxRuntime.jsx(vt.MenuBar,{})]}),jsxRuntime.jsx(vt.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[T?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(kn,{pageSetup:T,zoom:P})}):null,jsxRuntime.jsx($p,{ref:m,source:e,...u?{documentFontFamily:u}:{},...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onStateChange:S,...i?{onError:i}:{}})]})]})}var ic=class{listeners=new Set;snapshot;constructor(t){this.snapshot=t;}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t);});getSnapshot=()=>this.snapshot;setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var lc=class extends ic{notifications=[];idCounter=0;timers=new Set;constructor(){super({notifications:[]});}showError(t,o){return this.addNotification(t,"error",o)}showWarning(t,o){return this.addNotification(t,"warning",o)}showInfo(t,o){return this.addNotification(t,"info",o)}dismiss(t){this.notifications=this.notifications.map(n=>n.id===t?{...n,dismissed:true}:n),this.emitSnapshot();let o=setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(n=>n.id!==t),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,o,n){let r=`error-${++this.idCounter}-${Date.now()}`,i={id:r,message:t,severity:o,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),o!=="error"){let a=setTimeout(()=>{this.timers.delete(a),this.dismiss(r);},5e3);this.timers.add(a);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var w5=Pt.createContext(null);function Oy({children:e}){let t=Pt.useMemo(()=>new lc,[]),o=Pt.useSyncExternalStore(t.subscribe,t.getSnapshot),n=Pt.useCallback((c,d)=>{t.showError(c,d);},[t]),r=Pt.useCallback((c,d)=>{t.showWarning(c,d);},[t]),i=Pt.useCallback((c,d)=>{t.showInfo(c,d);},[t]),a=Pt.useCallback(c=>{t.dismiss(c);},[t]),s=Pt.useCallback(()=>{t.clearAll();},[t]),l=Pt.useMemo(()=>({notifications:o.notifications,showError:n,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:s}),[o.notifications,n,r,i,a,s]);return jsxRuntime.jsxs(w5.Provider,{value:l,children:[e,jsxRuntime.jsx(M5,{notifications:o.notifications,onDismiss:a})]})}function M5({notifications:e,onDismiss:t}){let o=e.filter(r=>!r.dismissed);return o.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:o.map(r=>jsxRuntime.jsx(R5,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function R5({notification:e,onDismiss:t}){let{t:o}=N(),[n,r]=Pt.useState(false),a=(p=>{switch(p){case "error":return {bg:"var(--doc-error-bg)",border:"var(--doc-error)",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"var(--doc-warning)",text:"var(--doc-warning-text)",icon:"var(--doc-warning)"};case "info":return {bg:"var(--doc-primary-light)",border:"var(--doc-primary)",text:"var(--doc-primary)",icon:"var(--doc-primary)"}}})(e.severity),s={background:a.bg,border:`1px solid ${a.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"docx-notification-slide-in 0.3s ease-out"},l={display:"flex",alignItems:"flex-start",gap:"8px"},c={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},f={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},u={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:a.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:a.text},m=p=>{switch(p){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsx("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:s,children:jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("span",{style:c,children:m(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:f,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!n),style:{...g,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:o(n?"errors.hideDetails":"errors.showDetails")}),n&&jsxRuntime.jsx("div",{style:u,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:g,title:o("common.dismiss"),children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})})}var sc=class extends Pt.Component{constructor(t){super(t),this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",t,o),this.props.onError&&this.props.onError(t,o);}resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};render(){if(this.state.hasError){let{fallback:t,showDetails:o=true}=this.props,{error:n,errorInfo:r}=this.state;return t?typeof t=="function"?t(n,this.resetError):t:jsxRuntime.jsx(D5,{error:n,errorInfo:r,showDetails:o,onReset:this.resetError})}return this.props.children}};function D5({error:e,errorInfo:t,showDetails:o,onReset:n}){let{t:r}=N(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},a={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},l={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},c={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:i,children:[jsxRuntime.jsx("div",{style:a,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:s,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:l,children:r("errors.errorDescription")}),o&&jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
3
3
 
4
- `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:n,style:d,children:r("errors.tryAgain")})]})}function Zy({onClick:e,topPx:t,scrollLeft:o=0,leftOffset:n=Hr}){let{t:r}=N();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:i=>i.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:n-o,top:t,zIndex:ct.outline},children:jsxRuntime.jsx(z,{name:"format_list_bulleted",size:20})})}function pm({currentPage:e,totalPages:t,visible:o}){let{t:n}=N();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:o?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:n("viewer.pageIndicator",{current:e,total:t})})}function k5({i18n:e,isDark:t,onEditorError:o,containerRef:n,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:s,mainContentStyle:l,editorContainerStyle:c,showRuler:d,readOnlyProp:f,showOutline:u,showOutlineButton:g,sidebarOpen:m,minLayoutWidth:p,toolbarHeight:v,editorScrollLeft:y,onScrollContainerMouseDown:x,onEditorBgMouseDown:h,onEditorContextMenu:b,horizontalRulerProps:S,verticalRulerProps:C,outlineProps:P,onToggleOutline:T,scrollPageInfo:R,toolbar:M,pagedArea:E,overlays:_,dialogs:H,fileInputs:L}){let k=d&&!f;return jsxRuntime.jsx(vn.Provider,{value:true,children:jsxRuntime.jsx(Un,{i18n:e,children:jsxRuntime.jsx(Ay,{children:jsxRuntime.jsx(sc,{onError:o,children:jsxRuntime.jsxs("div",{ref:n,className:ae("docx-editor",t&&"dark",a),style:s,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:l,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[M,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:c,onMouseDown:x,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:ct.ruler,paddingLeft:20,paddingRight:20+(m?352:0),minWidth:p,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(kn,{...S})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:p},children:jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:h,onContextMenu:b,children:[k&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:ct.ruler,paddingTop:48},children:jsxRuntime.jsx(pi,{...C})}),E]})})]}),R.totalPages>1&&jsxRuntime.jsx(pm,{currentPage:R.currentPage,totalPages:R.totalPages,visible:R.visible}),u&&jsxRuntime.jsx(fi,{...P,leftOffset:mi+(k?Fr:0)}),g&&!u&&jsxRuntime.jsx(Zy,{onClick:T,topPx:v+(d?Sp+8:0)+48,scrollLeft:y,leftOffset:Hr+(k?Fr:0)})]})}),_,H,L]})})})})})}function A5(e){let[t,o]=Pt.useState(0);return Pt.useEffect(()=>{if(!e)return;let n=()=>o(a=>a+1),r=e.on("change",n),i=e.on("selectionChange",n);return n(),()=>{r(),i();}},[e]),t}function W5({kind:e}){let t=F(),[o,n]=Pt.useState(null),r=Pt.useRef(null);Pt.useLayoutEffect(()=>{if(!t||!o)return;let a=editor.bindHistoryGroup(t,o,{kind:e});return r.current=a,()=>{a.dispose(),r.current=null;}},[t,o,e]);let i=Pt.useCallback(()=>{if(!r.current)throw new Error("history group control is not mounted");return r.current.options()},[]);return {ref:n,options:i}}Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return editor.CHROME_GROUPS}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return editor.CHROME_MENUS}});Object.defineProperty(exports,"DEFAULT_FONT",{enumerable:true,get:function(){return editor.DEFAULT_FONT}});Object.defineProperty(exports,"DocumentRefreshError",{enumerable:true,get:function(){return editor.DocumentRefreshError}});Object.defineProperty(exports,"HIGHLIGHT_REFRESH_MS",{enumerable:true,get:function(){return editor.HIGHLIGHT_REFRESH_MS}});Object.defineProperty(exports,"LOADING_SNAPSHOT",{enumerable:true,get:function(){return editor.LOADING_SNAPSHOT}});Object.defineProperty(exports,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"SEARCH_DEBOUNCE_MS",{enumerable:true,get:function(){return editor.SEARCH_DEBOUNCE_MS}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_PRIORITY",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_PRIORITY}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_SET",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_SET}});Object.defineProperty(exports,"SEARCH_MATCH_LIMIT",{enumerable:true,get:function(){return editor.SEARCH_MATCH_LIMIT}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"composeFontOrigins",{enumerable:true,get:function(){return editor.composeFontOrigins}});Object.defineProperty(exports,"createDocumentRefresh",{enumerable:true,get:function(){return editor.createDocumentRefresh}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return editor.defineFontResolver}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return editor.isFontResolver}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=ft;exports.ContextMenuCellVerticalAlignment=bn;exports.ContextMenuCopy=fa;exports.ContextMenuCopyFormatting=al;exports.ContextMenuCut=ma;exports.ContextMenuDelete=ga;exports.ContextMenuDeleteTable=br;exports.ContextMenuDeleteTableColumn=hr;exports.ContextMenuDeleteTableRow=gr;exports.ContextMenuInsertColumnLeft=mr;exports.ContextMenuInsertColumnRight=fr;exports.ContextMenuInsertRowAbove=ur;exports.ContextMenuInsertRowBelow=pr;exports.ContextMenuItem=sl;exports.ContextMenuPaste=cr;exports.ContextMenuPasteFormatting=il;exports.ContextMenuPasteWithoutFormatting=dr;exports.ContextMenuRefreshToc=vr;exports.ContextMenuRefreshTocPageNumbers=yr;exports.ContextMenuSelectAll=ha;exports.DocumentName=Yp;exports.DocumentOutline=fi;exports.DocxEditor=Y8;exports.DocxEditorAuthorStyle=yu;exports.DocxEditorColorByChangeType=vu;exports.DocxEditorContent=Ll;exports.DocxEditorContentControl=ta;exports.DocxEditorContentControlWidget=ru;exports.DocxEditorContextMenu=va;exports.DocxEditorDocumentOutline=_p;exports.DocxEditorEquation=oa;exports.DocxEditorExportDialog=Vr;exports.DocxEditorFontNotice=Bs;exports.DocxEditorHeaderFooterChrome=Zs;exports.DocxEditorHorizontalRuler=Rs;exports.DocxEditorHyperLink=Jr;exports.DocxEditorImageAltTextPopup=Cl;exports.DocxEditorImagePropertiesDialog=Ca;exports.DocxEditorInvalidTextFormFieldDialog=Hd;exports.DocxEditorLoading=Hl;exports.DocxEditorLoadingSpinner=bu;exports.DocxEditorMenu=ci;exports.DocxEditorNavigation=Bp;exports.DocxEditorNotePreview=jn;exports.DocxEditorNotePropertiesDialog=gl;exports.DocxEditorNotesChrome=fl;exports.DocxEditorNotesContextMenu=Yn;exports.DocxEditorPageNumber=Os;exports.DocxEditorPageSetupDialog=Sn;exports.DocxEditorParagraphDialog=yo;exports.DocxEditorPrintDialog=Gr;exports.DocxEditorRevisionMarkup=Nc;exports.DocxEditorRevisionMarkupDialog=Ur;exports.DocxEditorRoot=Na;exports.DocxEditorShell=k5;exports.DocxEditorTextFormFieldDialog=Ma;exports.DocxEditorToolbar=ri;exports.DocxEditorVerticalRuler=Ds;exports.DocxEditorViewport=Zl;exports.HorizontalRuler=kn;exports.ImageAltText=xl;exports.ImageInsertProvider=Qi;exports.ImageInsertTrigger=el;exports.ImagePropertiesTrigger=yl;exports.ImageWrap=Yl;exports.LocaleProvider=Un;exports.Logo=Ws;exports.MenuBar=$s;exports.NAVIGATION_PANE_GAP=Qb;exports.NAVIGATION_PANE_INSET=ks;exports.NAVIGATION_PANE_MIN_PAGE_ROOM=Lp;exports.NAVIGATION_PANE_WIDTH=Ar;exports.NavigationClose=xi;exports.NavigationFind=Ei;exports.NavigationHeader=yi;exports.NavigationHeadings=Si;exports.NavigationTab=Pi;exports.NavigationTabs=Ti;exports.NavigationTitle=Ci;exports.NavigationToggle=wi;exports.OUTLINE_BUTTON_LEFT_OFFSET=Hr;exports.OUTLINE_BUTTON_RESERVED_SPACE=Ik;exports.OUTLINE_LEFT_OFFSET=mi;exports.OUTLINE_RESERVED_SPACE=Dk;exports.PageIndicator=pm;exports.PageNumberTranslationContext=As;exports.PaginatedDocxEditor=$p;exports.PaginatedDocxEditorShell=y5;exports.REVIEW_MARKERS_GUTTER=wr;exports.REVIEW_PANE_GUTTER=La;exports.RULER_WIDTH=Fr;exports.ReviewRailContext=xt;exports.Slot=j;exports.TitleBar=Xp;exports.TitleBarRight=zs;exports.Toolbar=dm;exports.ToolbarButton=It;exports.ToolbarContext=ln;exports.ToolbarGroup=Ut;exports.ToolbarImageProperties=Cr;exports.VERSION=Uy;exports.VerticalRuler=pi;exports.definePopup=RC;exports.editorStateActiveSubscriptionCount=tx;exports.isFieldLink=Yr;exports.navigationPaneOverlays=_s;exports.navigationPaneReservation=Or;exports.navigationShift=Is;exports.normalizeImageBytes=Ji;exports.notificationYieldsToTask=xm;exports.provideDocxEditor=ew;exports.reviewGutter=a0;exports.useChromeTranslate=vm;exports.useContentControl=Qt;exports.useContentControlInstance=Ui;exports.useContentControlWidget=Qe;exports.useContextMenuTarget=If;exports.useDocumentOutline=Ns;exports.useDocumentSearch=Ls;exports.useDocxEditor=F;exports.useDocxSource=rI;exports.useEditorCaret=mI;exports.useEditorCommand=ie;exports.useEditorEvent=rp;exports.useEditorSnapshot=A5;exports.useEditorState=O;exports.useEditorValueCommand=Ta;exports.useFontFamily=ts;exports.useFonts=cI;exports.useHeaderFooterState=qp;exports.useHighlightAt=TI;exports.useHighlights=vI;exports.useHistoryGroup=W5;exports.useHyperlinkPopup=Fc;exports.useHyperlinkPopupInstance=zi;exports.useNavigationPane=Fs;exports.useNavigationShift=an;exports.useNotePropertiesState=Ed;exports.useNoteScopeState=Sd;exports.usePageSetup=Pn;exports.usePageSetupDialog=YS;exports.useParagraphDialog=cE;exports.useParagraphFormat=cu;exports.useParagraphIndent=wp;exports.useParagraphStyle=os;exports.useReviewAuthors=Aa;exports.useReviewGutter=qo;exports.useRevisionMarkupDialog=vC;exports.useScopeClassName=Ct;exports.useScopedChromeAnchor=ya;exports.useTableBorderTargetLabel=Qh;exports.useTextFormFieldDialog=FS;exports.useToolbarContext=Ix;exports.useToolbarLabel=X;exports.useToolbarLabelFor=Oi;exports.useTranslation=N;exports.useZoom=Zu;
4
+ `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:n,style:d,children:r("errors.tryAgain")})]})}function qy({onClick:e,topPx:t,scrollLeft:o=0,leftOffset:n=Hr}){let{t:r}=N();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:i=>i.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:n-o,top:t,zIndex:ct.outline},children:jsxRuntime.jsx(z,{name:"format_list_bulleted",size:20})})}function pm({currentPage:e,totalPages:t,visible:o}){let{t:n}=N();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:o?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:n("viewer.pageIndicator",{current:e,total:t})})}function I5({i18n:e,isDark:t,onEditorError:o,containerRef:n,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:s,mainContentStyle:l,editorContainerStyle:c,showRuler:d,readOnlyProp:f,showOutline:u,showOutlineButton:g,sidebarOpen:m,minLayoutWidth:p,toolbarHeight:v,editorScrollLeft:y,onScrollContainerMouseDown:x,onEditorBgMouseDown:h,onEditorContextMenu:b,horizontalRulerProps:S,verticalRulerProps:C,outlineProps:P,onToggleOutline:T,scrollPageInfo:R,toolbar:M,pagedArea:E,overlays:_,dialogs:H,fileInputs:L}){let k=d&&!f;return jsxRuntime.jsx(vn.Provider,{value:true,children:jsxRuntime.jsx(Un,{i18n:e,children:jsxRuntime.jsx(Oy,{children:jsxRuntime.jsx(sc,{onError:o,children:jsxRuntime.jsxs("div",{ref:n,className:ae("docx-editor",t&&"dark",a),style:s,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:l,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[M,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:c,onMouseDown:x,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:ct.ruler,paddingLeft:20,paddingRight:20+(m?352:0),minWidth:p,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(kn,{...S})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:p},children:jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:h,onContextMenu:b,children:[k&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:ct.ruler,paddingTop:48},children:jsxRuntime.jsx(pi,{...C})}),E]})})]}),R.totalPages>1&&jsxRuntime.jsx(pm,{currentPage:R.currentPage,totalPages:R.totalPages,visible:R.visible}),u&&jsxRuntime.jsx(fi,{...P,leftOffset:mi+(k?Fr:0)}),g&&!u&&jsxRuntime.jsx(qy,{onClick:T,topPx:v+(d?Sp+8:0)+48,scrollLeft:y,leftOffset:Hr+(k?Fr:0)})]})}),_,H,L]})})})})})}function O5(e){let[t,o]=Pt.useState(0);return Pt.useEffect(()=>{if(!e)return;let n=()=>o(a=>a+1),r=e.on("change",n),i=e.on("selectionChange",n);return n(),()=>{r(),i();}},[e]),t}function z5({kind:e}){let t=F(),[o,n]=Pt.useState(null),r=Pt.useRef(null);Pt.useLayoutEffect(()=>{if(!t||!o)return;let a=editor.bindHistoryGroup(t,o,{kind:e});return r.current=a,()=>{a.dispose(),r.current=null;}},[t,o,e]);let i=Pt.useCallback(()=>{if(!r.current)throw new Error("history group control is not mounted");return r.current.options()},[]);return {ref:n,options:i}}Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return editor.CHROME_GROUPS}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return editor.CHROME_MENUS}});Object.defineProperty(exports,"DEFAULT_FONT",{enumerable:true,get:function(){return editor.DEFAULT_FONT}});Object.defineProperty(exports,"DocumentRefreshError",{enumerable:true,get:function(){return editor.DocumentRefreshError}});Object.defineProperty(exports,"HIGHLIGHT_REFRESH_MS",{enumerable:true,get:function(){return editor.HIGHLIGHT_REFRESH_MS}});Object.defineProperty(exports,"LOADING_SNAPSHOT",{enumerable:true,get:function(){return editor.LOADING_SNAPSHOT}});Object.defineProperty(exports,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"SEARCH_DEBOUNCE_MS",{enumerable:true,get:function(){return editor.SEARCH_DEBOUNCE_MS}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_PRIORITY",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_PRIORITY}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_SET",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_SET}});Object.defineProperty(exports,"SEARCH_MATCH_LIMIT",{enumerable:true,get:function(){return editor.SEARCH_MATCH_LIMIT}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"composeFontOrigins",{enumerable:true,get:function(){return editor.composeFontOrigins}});Object.defineProperty(exports,"createDocumentRefresh",{enumerable:true,get:function(){return editor.createDocumentRefresh}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return editor.defineFontResolver}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return editor.isFontResolver}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=ft;exports.ContextMenuCellVerticalAlignment=bn;exports.ContextMenuCopy=fa;exports.ContextMenuCopyFormatting=al;exports.ContextMenuCut=ma;exports.ContextMenuDelete=ga;exports.ContextMenuDeleteTable=br;exports.ContextMenuDeleteTableColumn=hr;exports.ContextMenuDeleteTableRow=gr;exports.ContextMenuInsertColumnLeft=mr;exports.ContextMenuInsertColumnRight=fr;exports.ContextMenuInsertRowAbove=ur;exports.ContextMenuInsertRowBelow=pr;exports.ContextMenuItem=sl;exports.ContextMenuPaste=cr;exports.ContextMenuPasteFormatting=il;exports.ContextMenuPasteWithoutFormatting=dr;exports.ContextMenuRefreshToc=vr;exports.ContextMenuRefreshTocPageNumbers=yr;exports.ContextMenuSelectAll=ha;exports.DocumentName=Yp;exports.DocumentOutline=fi;exports.DocxEditor=X8;exports.DocxEditorAuthorStyle=yu;exports.DocxEditorColorByChangeType=vu;exports.DocxEditorContent=Ll;exports.DocxEditorContentControl=ta;exports.DocxEditorContentControlWidget=ru;exports.DocxEditorContextMenu=va;exports.DocxEditorDocumentOutline=_p;exports.DocxEditorEquation=oa;exports.DocxEditorExportDialog=Vr;exports.DocxEditorFontNotice=Bs;exports.DocxEditorHeaderFooterChrome=Zs;exports.DocxEditorHorizontalRuler=Rs;exports.DocxEditorHyperLink=Jr;exports.DocxEditorImageAltTextPopup=Cl;exports.DocxEditorImagePropertiesDialog=Ca;exports.DocxEditorInvalidTextFormFieldDialog=Hd;exports.DocxEditorLoading=Hl;exports.DocxEditorLoadingSpinner=bu;exports.DocxEditorMenu=ci;exports.DocxEditorNavigation=Bp;exports.DocxEditorNotePreview=jn;exports.DocxEditorNotePropertiesDialog=gl;exports.DocxEditorNotesChrome=fl;exports.DocxEditorNotesContextMenu=Yn;exports.DocxEditorPageNumber=Os;exports.DocxEditorPageSetupDialog=Sn;exports.DocxEditorParagraphDialog=yo;exports.DocxEditorPrintDialog=Gr;exports.DocxEditorRevisionMarkup=Nc;exports.DocxEditorRevisionMarkupDialog=Ur;exports.DocxEditorRoot=Na;exports.DocxEditorShell=I5;exports.DocxEditorTextFormFieldDialog=Ma;exports.DocxEditorToolbar=ri;exports.DocxEditorVerticalRuler=Ds;exports.DocxEditorViewport=Zl;exports.HorizontalRuler=kn;exports.ImageAltText=xl;exports.ImageInsertProvider=Qi;exports.ImageInsertTrigger=el;exports.ImagePropertiesTrigger=yl;exports.ImageWrap=Yl;exports.LocaleProvider=Un;exports.Logo=Ws;exports.MenuBar=$s;exports.NAVIGATION_PANE_GAP=ev;exports.NAVIGATION_PANE_INSET=ks;exports.NAVIGATION_PANE_MIN_PAGE_ROOM=Lp;exports.NAVIGATION_PANE_WIDTH=Ar;exports.NavigationClose=xi;exports.NavigationFind=Ei;exports.NavigationHeader=yi;exports.NavigationHeadings=Si;exports.NavigationTab=Pi;exports.NavigationTabs=Ti;exports.NavigationTitle=Ci;exports.NavigationToggle=wi;exports.OUTLINE_BUTTON_LEFT_OFFSET=Hr;exports.OUTLINE_BUTTON_RESERVED_SPACE=_k;exports.OUTLINE_LEFT_OFFSET=mi;exports.OUTLINE_RESERVED_SPACE=kk;exports.PageIndicator=pm;exports.PageNumberTranslationContext=As;exports.PaginatedDocxEditor=$p;exports.PaginatedDocxEditorShell=x5;exports.REVIEW_MARKERS_GUTTER=wr;exports.REVIEW_PANE_GUTTER=La;exports.RULER_WIDTH=Fr;exports.ReviewRailContext=xt;exports.Slot=j;exports.TitleBar=Xp;exports.TitleBarRight=zs;exports.Toolbar=dm;exports.ToolbarButton=It;exports.ToolbarContext=ln;exports.ToolbarGroup=Ut;exports.ToolbarImageProperties=Cr;exports.VERSION=Vy;exports.VerticalRuler=pi;exports.definePopup=DC;exports.editorStateActiveSubscriptionCount=ox;exports.isFieldLink=Yr;exports.navigationPaneOverlays=_s;exports.navigationPaneReservation=Or;exports.navigationShift=Is;exports.normalizeImageBytes=Ji;exports.notificationYieldsToTask=xm;exports.provideDocxEditor=tw;exports.reviewGutter=i0;exports.useChromeTranslate=vm;exports.useContentControl=Qt;exports.useContentControlInstance=Ui;exports.useContentControlWidget=Qe;exports.useContextMenuTarget=_f;exports.useDocumentOutline=Ns;exports.useDocumentSearch=Ls;exports.useDocxEditor=F;exports.useDocxSource=aI;exports.useEditorCaret=fI;exports.useEditorCommand=ie;exports.useEditorEvent=rp;exports.useEditorSnapshot=O5;exports.useEditorState=O;exports.useEditorValueCommand=Ta;exports.useFontFamily=ts;exports.useFonts=dI;exports.useHeaderFooterState=qp;exports.useHighlightAt=PI;exports.useHighlights=yI;exports.useHistoryGroup=z5;exports.useHyperlinkPopup=Fc;exports.useHyperlinkPopupInstance=zi;exports.useNavigationPane=Fs;exports.useNavigationShift=an;exports.useNotePropertiesState=Ed;exports.useNoteScopeState=Sd;exports.usePageSetup=Pn;exports.usePageSetupDialog=XS;exports.useParagraphDialog=dE;exports.useParagraphFormat=cu;exports.useParagraphIndent=wp;exports.useParagraphStyle=os;exports.useReviewAuthors=Aa;exports.useReviewGutter=qo;exports.useRevisionMarkupDialog=yC;exports.useScopeClassName=Ct;exports.useScopedChromeAnchor=ya;exports.useTableBorderTargetLabel=eb;exports.useTextFormFieldDialog=HS;exports.useToolbarContext=_x;exports.useToolbarLabel=X;exports.useToolbarLabelFor=Oi;exports.useTranslation=N;exports.useZoom=Zu;