efficient-shell 11.8.0 → 11.11.0

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 (342) hide show
  1. package/README.md +12 -1
  2. package/dist/{Browser-NMILHEUX.js → Browser-NRGJ53ST.js} +14 -14
  3. package/dist/{Calculator-E7AMPGD5.js → Calculator-YZEGVEQ7.js} +22 -22
  4. package/dist/{CurrencyConverter-TAWZDMT4.js → CurrencyConverter-CJQMDBQW.js} +6 -6
  5. package/dist/Documents-FIGKS36O.js +84 -0
  6. package/dist/{Files-YQWVU6KZ.js → Files-FPNJ46XY.js} +88 -88
  7. package/dist/{Notepad-DZSDABU7.js → Notepad-2XW63REV.js} +9 -9
  8. package/dist/PdfViewer-M4RTCNNE.js +1 -0
  9. package/dist/{PomodoroTimer-RAZE37BO.js → PomodoroTimer-Y5GQX37J.js} +21 -21
  10. package/dist/{Preview-6Z6K5QLK.js → Preview-K7KDM4XK.js} +24 -24
  11. package/dist/Sidebar-QP5Y7RBV.js +44 -0
  12. package/dist/Spreadsheet-RQE4OCEK.js +75 -0
  13. package/dist/{Stock-HJN2BSAD.js → Stock-IHAG62QV.js} +3 -3
  14. package/dist/{Weather-G7AOUS36.js → Weather-EQDFEBIH.js} +19 -19
  15. package/dist/{WorldClock-GE3DGYYU.js → WorldClock-VQG7G2Z2.js} +6 -6
  16. package/dist/ai/index.js +78 -78
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/media-host-check.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/brand.css +1 -1
  21. package/dist/charts/BoxPlotChart.js +1 -1
  22. package/dist/charts/CandlestickChart.js +1 -1
  23. package/dist/charts/CartesianPlot.js +1 -1
  24. package/dist/charts/ChartBrush.js +1 -1
  25. package/dist/charts/ChartFrame.js +1 -1
  26. package/dist/charts/ChartSkeleton.js +1 -1
  27. package/dist/charts/ChordChart.js +1 -1
  28. package/dist/charts/ColumnChart.js +1 -1
  29. package/dist/charts/FunnelChart.js +1 -1
  30. package/dist/charts/HeatmapChart.js +1 -1
  31. package/dist/charts/HistogramChart.js +1 -1
  32. package/dist/charts/Meter.js +1 -1
  33. package/dist/charts/PieChart.js +1 -1
  34. package/dist/charts/RadarChart.js +1 -1
  35. package/dist/charts/RadialBarChart.js +1 -1
  36. package/dist/charts/RangeChart.js +1 -1
  37. package/dist/charts/RankedBars.js +1 -1
  38. package/dist/charts/SankeyChart.js +1 -1
  39. package/dist/charts/ScatterChart.js +1 -1
  40. package/dist/charts/SpecChart.js +1 -1
  41. package/dist/charts/StatTile.js +1 -1
  42. package/dist/charts/SunburstChart.js +1 -1
  43. package/dist/charts/TimeSeriesChart.js +1 -1
  44. package/dist/charts/TreemapChart.js +1 -1
  45. package/dist/charts/WaterfallChart.js +1 -1
  46. package/dist/{chunk-LXL2UCUR.js → chunk-225LCPO7.js} +1 -1
  47. package/dist/{chunk-JFBL4PR3.js → chunk-2E3K4FSQ.js} +1 -1
  48. package/dist/chunk-2EPAXWZZ.js +14 -0
  49. package/dist/{chunk-N7U622NC.js → chunk-2HAJ33HM.js} +2 -2
  50. package/dist/{chunk-V6Y4OC6K.js → chunk-2NRNKF46.js} +8 -8
  51. package/dist/chunk-2XOH3NJZ.js +27 -0
  52. package/dist/{chunk-4EZIWLJJ.js → chunk-2XORVHF2.js} +1 -1
  53. package/dist/{chunk-OBJGUJIE.js → chunk-2ZAFRGRF.js} +1 -1
  54. package/dist/{chunk-RYLTVHCV.js → chunk-32EKHIAZ.js} +11 -11
  55. package/dist/{chunk-RHDM7HRD.js → chunk-3JCOD5L2.js} +2 -2
  56. package/dist/{chunk-X5TZHOTI.js → chunk-3OHADZYV.js} +1 -1
  57. package/dist/{chunk-O3MBPAWZ.js → chunk-3PZI2C4R.js} +1 -1
  58. package/dist/chunk-3VR5BOD4.js +8 -0
  59. package/dist/{chunk-3XTSXZAC.js → chunk-3X2W7R5B.js} +10 -10
  60. package/dist/{chunk-G3KXB7SP.js → chunk-3ZRYKZGI.js} +9 -9
  61. package/dist/{chunk-KTCM64DQ.js → chunk-42TLGG33.js} +1 -1
  62. package/dist/{chunk-SS5SQMIB.js → chunk-57WQVUBX.js} +2 -2
  63. package/dist/{chunk-3V5GSTZI.js → chunk-5B4GRLAA.js} +1 -1
  64. package/dist/{chunk-3IUPYCW3.js → chunk-5KKJAYKT.js} +1 -1
  65. package/dist/{chunk-UEISJFZH.js → chunk-5UCRYSQJ.js} +5 -5
  66. package/dist/chunk-5YP7MFPK.js +1 -0
  67. package/dist/{chunk-KGSOOXA7.js → chunk-62BDGAML.js} +4 -4
  68. package/dist/{chunk-CD7UWMPX.js → chunk-63545Z3N.js} +1 -1
  69. package/dist/{chunk-TGGUYAWA.js → chunk-6C6M3QXL.js} +1 -1
  70. package/dist/{chunk-VHF3CJVO.js → chunk-6CK44QWU.js} +28 -28
  71. package/dist/{chunk-5F2AIDPY.js → chunk-6DQANKTL.js} +8 -8
  72. package/dist/chunk-6FIYG7IH.js +28 -0
  73. package/dist/{chunk-SHO35OPO.js → chunk-6LITLCVV.js} +1 -1
  74. package/dist/{chunk-RRE2NNFS.js → chunk-6LK2BBCC.js} +5 -5
  75. package/dist/chunk-6R32KKIS.js +22 -0
  76. package/dist/{chunk-IXOL7Y3Z.js → chunk-7HLBVMMQ.js} +1 -1
  77. package/dist/{chunk-M4BPHBKI.js → chunk-7IVTGOGM.js} +1 -1
  78. package/dist/{chunk-47DO42IW.js → chunk-7R23EKON.js} +1 -1
  79. package/dist/{chunk-2UO47XB4.js → chunk-7V32O5NF.js} +30 -14
  80. package/dist/{chunk-YCWALB3A.js → chunk-A4YTWDKD.js} +1 -1
  81. package/dist/{chunk-PVPMJ5G2.js → chunk-AHITTM6W.js} +1 -1
  82. package/dist/{chunk-UGBYAVJV.js → chunk-ALJS3SYS.js} +1 -1
  83. package/dist/{chunk-ZXVJL7MS.js → chunk-AQGIK2CV.js} +1 -1
  84. package/dist/{chunk-FT3QRQWY.js → chunk-ATKFIHDP.js} +4 -4
  85. package/dist/{chunk-AWKJZSTO.js → chunk-AWQ5SOC5.js} +1 -1
  86. package/dist/{chunk-77AQNJE2.js → chunk-B2AYI45X.js} +8 -8
  87. package/dist/{chunk-PFKXPSOM.js → chunk-B2MD232O.js} +5 -5
  88. package/dist/{chunk-6EIZOX6W.js → chunk-B2SLXCMY.js} +8 -8
  89. package/dist/{chunk-F3ZFCQGP.js → chunk-BDUXF7BT.js} +3 -3
  90. package/dist/{chunk-DGNAUGZ3.js → chunk-C3UY34DC.js} +2 -2
  91. package/dist/{chunk-MDYJVXWD.js → chunk-CAIKDX2M.js} +2 -2
  92. package/dist/{chunk-FA5FBNWF.js → chunk-CDQUOCXO.js} +1 -1
  93. package/dist/{chunk-DJW7CM3W.js → chunk-CG5X5ZLV.js} +1 -1
  94. package/dist/{chunk-IDI3IOY4.js → chunk-CLAKVFOB.js} +67 -67
  95. package/dist/{chunk-VQBEZNHC.js → chunk-CSLMWGFS.js} +1 -1
  96. package/dist/{chunk-BW47XJLH.js → chunk-CT7AU2TA.js} +1 -1
  97. package/dist/{chunk-4ULRP4Y4.js → chunk-D4RVWSUT.js} +1 -1
  98. package/dist/{chunk-EOWUUOVE.js → chunk-DHMOJX2Z.js} +1 -1
  99. package/dist/{chunk-VAPSWR5Q.js → chunk-E3EHHR73.js} +9 -9
  100. package/dist/chunk-EC22ACQZ.js +11 -0
  101. package/dist/{chunk-M3JNILT2.js → chunk-ESWR7YNY.js} +15 -15
  102. package/dist/{chunk-MDV7UQJD.js → chunk-EV7VAXMO.js} +8 -8
  103. package/dist/{chunk-GELPD7EY.js → chunk-F636NDAU.js} +8 -8
  104. package/dist/{chunk-4TYIYL56.js → chunk-FFNPAJLS.js} +10 -10
  105. package/dist/{chunk-WMHZA4EO.js → chunk-FJBJUFD7.js} +3 -3
  106. package/dist/{chunk-JSG2AKCG.js → chunk-FRH2AHPI.js} +1 -1
  107. package/dist/{chunk-5H4SWQGM.js → chunk-FUHURDBL.js} +1 -1
  108. package/dist/chunk-GO6HU2O3.js +7 -0
  109. package/dist/{chunk-DQQKG46I.js → chunk-GRC46C4V.js} +7 -7
  110. package/dist/chunk-H56TNUV4.js +1 -0
  111. package/dist/{chunk-SDDV3UCN.js → chunk-HDABS36W.js} +16 -16
  112. package/dist/{chunk-LJN77RG6.js → chunk-HJBR73GS.js} +1 -1
  113. package/dist/{chunk-DU4WEVNS.js → chunk-HRG4FYVU.js} +1 -1
  114. package/dist/{chunk-4MBYFQOI.js → chunk-I5XNADZ3.js} +4 -4
  115. package/dist/chunk-IEOCUEJK.js +14 -0
  116. package/dist/{chunk-YDMXW2Q4.js → chunk-IGQZANYE.js} +11 -11
  117. package/dist/{chunk-ZGOHRLXG.js → chunk-IIKPM3F4.js} +1 -1
  118. package/dist/{chunk-XYECIBVX.js → chunk-IUG4Z2ND.js} +1 -1
  119. package/dist/{chunk-4XNVIKZZ.js → chunk-IUMFOSFJ.js} +1 -1
  120. package/dist/{chunk-EKCQ7XBZ.js → chunk-JG26ICX6.js} +2 -2
  121. package/dist/{chunk-TMMNCXQT.js → chunk-JJZAYAVL.js} +1 -1
  122. package/dist/{chunk-E6GDAV5R.js → chunk-JRCFOZEU.js} +4 -4
  123. package/dist/chunk-K6D7OSKZ.js +20 -0
  124. package/dist/{chunk-LT6PG6UW.js → chunk-K6LW2QLI.js} +1 -1
  125. package/dist/{chunk-MXGDFO6A.js → chunk-KKJ55GUZ.js} +1 -1
  126. package/dist/chunk-KU4IWX6F.js +2 -0
  127. package/dist/{chunk-7ELJQL7J.js → chunk-KVVZLEUG.js} +1 -1
  128. package/dist/{chunk-54NMFQMW.js → chunk-KYHDDVTR.js} +4 -4
  129. package/dist/{chunk-MTIP5DH2.js → chunk-KZEIQO3V.js} +3 -3
  130. package/dist/{chunk-NGLU2GKE.js → chunk-LGTYPLJM.js} +4 -4
  131. package/dist/{chunk-DUGYWX2R.js → chunk-LXOX5FGH.js} +1 -1
  132. package/dist/{chunk-OH5L6HYW.js → chunk-LXQHTY3A.js} +3 -3
  133. package/dist/{chunk-T7PVHIXI.js → chunk-M57KX3OM.js} +1 -1
  134. package/dist/chunk-MQ445O4X.js +6 -0
  135. package/dist/{chunk-4TGZODSH.js → chunk-MQE2FBJU.js} +5 -5
  136. package/dist/{chunk-SAP4YI2Y.js → chunk-NMQGAP3H.js} +1 -1
  137. package/dist/{chunk-HCXIXV4E.js → chunk-NMTS2L2B.js} +7 -7
  138. package/dist/{chunk-VAK5FQXH.js → chunk-NTUZT37J.js} +1 -1
  139. package/dist/{chunk-ORIXCEKO.js → chunk-O6VIHWYU.js} +1 -1
  140. package/dist/chunk-ODQYWMDF.js +3 -0
  141. package/dist/{chunk-2E2SUEEE.js → chunk-OLJUPBY4.js} +1 -1
  142. package/dist/chunk-OPZXVXX5.js +7 -0
  143. package/dist/{chunk-LJAYUDN2.js → chunk-OXCFRH33.js} +1 -1
  144. package/dist/chunk-OZM6DE7A.js +8 -0
  145. package/dist/{chunk-SL77N7VT.js → chunk-PDFV3YQB.js} +3 -3
  146. package/dist/{chunk-P4VKU3SL.js → chunk-PDXOGPWH.js} +1 -1
  147. package/dist/{chunk-YQFGRYEF.js → chunk-PETBAYS5.js} +11 -11
  148. package/dist/{chunk-IMDGMUE3.js → chunk-PL4HKGYP.js} +1 -1
  149. package/dist/chunk-PMA6DZ4Q.js +6 -0
  150. package/dist/{chunk-QYL26AB4.js → chunk-PMKBWDXO.js} +1 -1
  151. package/dist/{chunk-B634WHJ2.js → chunk-PVOTOUJG.js} +2 -2
  152. package/dist/{chunk-SXNQHIBY.js → chunk-PVVHWLNX.js} +1 -1
  153. package/dist/{chunk-FXOYA2VJ.js → chunk-PZHO4FEN.js} +1 -1
  154. package/dist/{chunk-ESZHN7PV.js → chunk-Q7DVGUML.js} +1 -1
  155. package/dist/{chunk-355CRSFS.js → chunk-QAIMZN7M.js} +11 -11
  156. package/dist/{chunk-WOXQODYQ.js → chunk-QEDVXD3L.js} +1 -1
  157. package/dist/{chunk-OTVK7DJM.js → chunk-QOJ2UNS5.js} +1 -1
  158. package/dist/{chunk-MS5APD3V.js → chunk-R6TDZ7T5.js} +1 -1
  159. package/dist/{chunk-C6YAFZG3.js → chunk-R72ZKZDP.js} +2 -2
  160. package/dist/chunk-R7KRBKFH.js +5 -0
  161. package/dist/{chunk-JFV5CQN4.js → chunk-RMSF4UCJ.js} +1 -1
  162. package/dist/{chunk-3NRQNKVP.js → chunk-RNBC6V2D.js} +10 -10
  163. package/dist/chunk-RQBQETXQ.js +11 -0
  164. package/dist/chunk-S43DAIIB.js +9 -0
  165. package/dist/{chunk-RDYFZHT3.js → chunk-SAASFWKB.js} +1 -1
  166. package/dist/chunk-SCZUDGRZ.js +2 -0
  167. package/dist/{chunk-AFYLVV74.js → chunk-SEP35R2E.js} +1 -1
  168. package/dist/{chunk-SXQZ5GTA.js → chunk-SGBR443F.js} +5 -5
  169. package/dist/{chunk-JH4ZCPHW.js → chunk-SKRFI6WB.js} +12 -12
  170. package/dist/chunk-SUYQ7QYB.js +13 -0
  171. package/dist/{chunk-BTRV3SMB.js → chunk-SWJXWDKX.js} +1 -1
  172. package/dist/{chunk-PCTOL2FX.js → chunk-T74FGTLW.js} +6 -6
  173. package/dist/{chunk-KQOY4RGP.js → chunk-TA4JGC5C.js} +1 -1
  174. package/dist/{chunk-GOZO6LU2.js → chunk-TXKTITMF.js} +6 -6
  175. package/dist/{chunk-CRILBBSU.js → chunk-TZXAW32T.js} +1 -1
  176. package/dist/{chunk-SX5BSWTN.js → chunk-UG42KUCT.js} +5 -5
  177. package/dist/{chunk-OPN4I565.js → chunk-UTITWGVW.js} +1 -1
  178. package/dist/{chunk-7TZV6G2F.js → chunk-UVMM7AYO.js} +1 -1
  179. package/dist/{chunk-4QK4WNPB.js → chunk-UWJNQH2X.js} +1 -1
  180. package/dist/{chunk-6UBOLLBC.js → chunk-V64CJHMY.js} +19 -19
  181. package/dist/{chunk-ZD36QKQS.js → chunk-VEGZVUHE.js} +1 -1
  182. package/dist/chunk-VEZHFONL.js +9 -0
  183. package/dist/{chunk-TQE6O2JA.js → chunk-VPEH3THH.js} +2 -2
  184. package/dist/{chunk-NU5HN3FZ.js → chunk-VU5P4ZM5.js} +11 -11
  185. package/dist/{chunk-CLTRQ7AQ.js → chunk-VVDK7XPH.js} +1 -1
  186. package/dist/{chunk-XQZL6JDD.js → chunk-VZ52KKNA.js} +6 -6
  187. package/dist/{chunk-P3RXXWXN.js → chunk-WEEQDPU3.js} +5 -5
  188. package/dist/{chunk-EN5NXWT6.js → chunk-WOOKUEED.js} +1 -1
  189. package/dist/{chunk-72LJMEL6.js → chunk-X2DUOIJP.js} +1 -1
  190. package/dist/{chunk-C764JODK.js → chunk-Y4RHGLXB.js} +1 -1
  191. package/dist/{chunk-ECJKIPWU.js → chunk-YOXR3VKO.js} +1 -1
  192. package/dist/{chunk-QVZKRROQ.js → chunk-YQLKZ5UQ.js} +1 -1
  193. package/dist/{chunk-X55LUERI.js → chunk-YUAF3FDE.js} +4 -4
  194. package/dist/{chunk-JTMEFXRL.js → chunk-ZKBGUDNB.js} +1 -1
  195. package/dist/{chunk-IBS7647X.js → chunk-ZOQVYSTB.js} +21 -21
  196. package/dist/{chunk-5CXFABVD.js → chunk-ZOQXFS3R.js} +1 -1
  197. package/dist/data/DataTable.js +1 -1
  198. package/dist/data/EntityList.js +1 -1
  199. package/dist/data/Kanban.js +1 -1
  200. package/dist/data/ListFooter.js +1 -1
  201. package/dist/data/ListLoadError.js +1 -1
  202. package/dist/data/Pagination.js +1 -1
  203. package/dist/data/ResizableTable.js +1 -1
  204. package/dist/file-intake/index.js +1 -1
  205. package/dist/format/index.js +1 -1
  206. package/dist/forms/BorderInput.js +1 -1
  207. package/dist/forms/BrandAssetEditor.js +1 -1
  208. package/dist/forms/Calendar.js +1 -1
  209. package/dist/forms/ColorPicker.js +1 -1
  210. package/dist/forms/ComposerAttachments.js +1 -1
  211. package/dist/forms/CornersInput.js +1 -1
  212. package/dist/forms/DatePicker.js +1 -1
  213. package/dist/forms/DateRangePicker.js +1 -1
  214. package/dist/forms/DateTimePicker.js +1 -1
  215. package/dist/forms/DisplayChips.js +1 -1
  216. package/dist/forms/FilePicker.js +1 -1
  217. package/dist/forms/FormErrorSummary.js +1 -1
  218. package/dist/forms/IconPicker.js +1 -1
  219. package/dist/forms/ImageFocusPoint.js +1 -1
  220. package/dist/forms/Input.js +1 -1
  221. package/dist/forms/InputNumber.js +1 -1
  222. package/dist/forms/LinkPicker.d.ts +22 -0
  223. package/dist/forms/LinkPicker.js +1 -1
  224. package/dist/forms/MediaLibrary.js +1 -1
  225. package/dist/forms/MediaUploadField.js +1 -1
  226. package/dist/forms/MediaUploadGrid.js +1 -1
  227. package/dist/forms/MediaUsedInList.js +1 -1
  228. package/dist/forms/NumericKeypad.js +1 -1
  229. package/dist/forms/PositionInput.js +1 -1
  230. package/dist/forms/RenameField.js +1 -1
  231. package/dist/forms/Select.js +1 -1
  232. package/dist/forms/SidesInput.js +1 -1
  233. package/dist/forms/Slider.js +1 -1
  234. package/dist/forms/Snippet.js +1 -1
  235. package/dist/forms/SplitButton.js +1 -1
  236. package/dist/forms/TagInput.js +1 -1
  237. package/dist/forms/TextToolbar.js +1 -1
  238. package/dist/forms/TimePicker.js +1 -1
  239. package/dist/forms/WidthsBar.js +1 -1
  240. package/dist/forms/mediaLibraryMenu.js +1 -1
  241. package/dist/forms/mediaMoveItems.js +1 -1
  242. package/dist/forms/textAlign.js +1 -1
  243. package/dist/forms/useFileIntake.js +1 -1
  244. package/dist/icons/index.js +1 -1
  245. package/dist/index.js +666 -666
  246. package/dist/locales/zh-Hans.js +1 -1
  247. package/dist/map/index.js +3 -3
  248. package/dist/markdown/index.js +1 -1
  249. package/dist/page-tabs/index.js +5 -5
  250. package/dist/pdf/index.js +1 -1
  251. package/dist/shell/Accordion.js +1 -1
  252. package/dist/shell/AppUpdateBanner.js +1 -1
  253. package/dist/shell/Avatar.js +1 -1
  254. package/dist/shell/Banner.js +1 -1
  255. package/dist/shell/Breadcrumbs.js +1 -1
  256. package/dist/shell/BudgetBar.js +1 -1
  257. package/dist/shell/Card.js +1 -1
  258. package/dist/shell/ColoredBadge.js +1 -1
  259. package/dist/shell/ConfirmDialog.js +1 -1
  260. package/dist/shell/ContainerFillChart.js +1 -1
  261. package/dist/shell/ContextMenu.js +1 -1
  262. package/dist/shell/CountBadge.js +1 -1
  263. package/dist/shell/Dialog.js +1 -1
  264. package/dist/shell/Drawer.js +1 -1
  265. package/dist/shell/DropdownMenu.js +1 -1
  266. package/dist/shell/EditableGrid.js +1 -1
  267. package/dist/shell/EmptyState.js +1 -1
  268. package/dist/shell/GlobalSearch.js +1 -1
  269. package/dist/shell/HelpCenter.js +1 -1
  270. package/dist/shell/IconRail.js +1 -1
  271. package/dist/shell/ImageLightbox.js +1 -1
  272. package/dist/shell/ItemCount.js +1 -1
  273. package/dist/shell/LanguageSelect.js +1 -1
  274. package/dist/shell/Markdown.js +1 -1
  275. package/dist/shell/MetricBar.js +1 -1
  276. package/dist/shell/MetricBarLegend.js +1 -1
  277. package/dist/shell/MilestoneTimeline.js +1 -1
  278. package/dist/shell/PageHeader.js +1 -1
  279. package/dist/shell/PopupMenu.js +1 -1
  280. package/dist/shell/ProductionTimeline.js +1 -1
  281. package/dist/shell/ResizeHandle.js +1 -1
  282. package/dist/shell/Result.js +1 -1
  283. package/dist/shell/SearchableSelect.js +1 -1
  284. package/dist/shell/SettingReset.js +1 -1
  285. package/dist/shell/SettingRow.js +1 -1
  286. package/dist/shell/SidebarLayout.js +1 -1
  287. package/dist/shell/SidebarNav.js +1 -1
  288. package/dist/shell/SortableList.js +1 -1
  289. package/dist/shell/Statistic.js +1 -1
  290. package/dist/shell/StepChain.js +1 -1
  291. package/dist/shell/Stepper.js +1 -1
  292. package/dist/shell/TimeAgo.js +1 -1
  293. package/dist/shell/TimelineTrack.js +1 -1
  294. package/dist/shell/TopNav.js +1 -1
  295. package/dist/shell/TransferProgress.js +1 -1
  296. package/dist/shell/Tree.js +1 -1
  297. package/dist/shell/discardGuard.js +1 -1
  298. package/dist/shell/language.js +1 -1
  299. package/dist/shell/strings.d.ts +263 -0
  300. package/dist/shell/strings.js +1 -1
  301. package/dist/shell/toast.js +1 -1
  302. package/dist/telemetry/index.js +1 -1
  303. package/dist/templates/AuthScreen.js +1 -1
  304. package/dist/templates/ChatTemplate.js +1 -1
  305. package/dist/templates/CheckoutTemplate.js +1 -1
  306. package/dist/templates/DashboardTemplate.js +1 -1
  307. package/dist/templates/DataTablePage.js +1 -1
  308. package/dist/templates/EmailTemplate.js +1 -1
  309. package/dist/templates/ErrorBoundary.js +1 -1
  310. package/dist/templates/ErrorPage.js +1 -1
  311. package/dist/templates/FormLayoutPage.js +1 -1
  312. package/dist/templates/GalleryTemplate.js +1 -1
  313. package/dist/ui/index.js +1 -1
  314. package/dist/version.js +1 -1
  315. package/package.json +1 -6
  316. package/dist/Documents-SDOY3ZA3.js +0 -52
  317. package/dist/PdfViewer-Y3SAVADX.js +0 -1
  318. package/dist/Sidebar-GQX7UM3M.js +0 -44
  319. package/dist/Spreadsheet-Q5N5KXGP.js +0 -37
  320. package/dist/chunk-34H3CK7R.js +0 -22
  321. package/dist/chunk-56KADF2B.js +0 -11
  322. package/dist/chunk-7GTUUBS2.js +0 -28
  323. package/dist/chunk-7INZ7O3A.js +0 -5
  324. package/dist/chunk-CZMSOB2T.js +0 -9
  325. package/dist/chunk-EUAC2T5D.js +0 -2
  326. package/dist/chunk-FO6UPEZH.js +0 -7
  327. package/dist/chunk-FSUQTN34.js +0 -14
  328. package/dist/chunk-GDQJBQ5B.js +0 -1
  329. package/dist/chunk-IYXNRNAF.js +0 -8
  330. package/dist/chunk-JNQF5CBB.js +0 -6
  331. package/dist/chunk-K4JQ3FQI.js +0 -2
  332. package/dist/chunk-L7XIGRIT.js +0 -6
  333. package/dist/chunk-LGDMGDSV.js +0 -14
  334. package/dist/chunk-LKTUUNGJ.js +0 -1
  335. package/dist/chunk-PLK2WHZG.js +0 -27
  336. package/dist/chunk-RABYGQQU.js +0 -8
  337. package/dist/chunk-RK7MN5L5.js +0 -3
  338. package/dist/chunk-RPL4H6LE.js +0 -9
  339. package/dist/chunk-UGGHQYDN.js +0 -11
  340. package/dist/chunk-WUAKIM2B.js +0 -7
  341. package/dist/chunk-XZAEEX2H.js +0 -13
  342. package/dist/chunk-ZS3TIQQ4.js +0 -20
@@ -0,0 +1,84 @@
1
+ import{RenameField as e}from"./chunk-ALJS3SYS.js";import{Select_default as t}from"./chunk-ESWR7YNY.js";import"./chunk-EO5RLFRX.js";import"./chunk-HJBR73GS.js";import{FormField as n}from"./chunk-6KBDNYRW.js";import{ColorPickerPanel as r}from"./chunk-32EKHIAZ.js";import{Popover as o}from"./chunk-7JGR7WPD.js";import"./chunk-R72ZKZDP.js";import"./chunk-2NMW66P5.js";import"./chunk-S6OB6HJB.js";import{escapeHtml as a}from"./chunk-G6DKCCWH.js";import{Checkbox_default as s}from"./chunk-CGZBDI6C.js";import{ContextMenu as i}from"./chunk-57WQVUBX.js";import{Input_default as l}from"./chunk-LGTYPLJM.js";import{DropdownMenu as c}from"./chunk-GO6HU2O3.js";import"./chunk-QOJ2UNS5.js";import"./chunk-AYZY3YNC.js";import{IconButton_default as d}from"./chunk-VCMHBUKI.js";import{AboutApp as u}from"./chunk-2HAJ33HM.js";import{useWindowDirty as p,WindowTitle as m}from"./chunk-CLAKVFOB.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PMKBWDXO.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-OLJUPBY4.js";import{confirmDestructive as f,prompt as h}from"./chunk-2XOH3NJZ.js";import{Dialog as w}from"./chunk-R7KRBKFH.js";import"./chunk-PDXOGPWH.js";import"./chunk-3DVNXNTF.js";import"./chunk-YOXR3VKO.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-CT7AU2TA.js";import"./chunk-3PZI2C4R.js";import{toast_default as g}from"./chunk-KVVZLEUG.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-F3ZOO23R.js";import"./chunk-H56TNUV4.js";import"./chunk-JPNAEN53.js";import"./chunk-CDAJKLGL.js";import{PopupMenu as b,PopupMenuLabel as y,PopupMenuItem as v,PopupMenuDivider as x}from"./chunk-3ZRYKZGI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as k}from"./chunk-7DI3VQCF.js";import"./chunk-UQYNPYF4.js";import"./chunk-XWFLIGDQ.js";import{Icon as $}from"./chunk-7V32O5NF.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as C}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-CJH2BGXY.js";import"./chunk-QQ2LDC6C.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import{registerModalEscapeInterceptor as N}from"./chunk-TWVUQUUD.js";import{useShellStrings as A,useShellLocale as S}from"./chunk-5YP7MFPK.js";import"./chunk-C3QOHMR6.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import{useRef as T,useState as L,useEffect as P,useId as j,useCallback as M,useMemo as E}from"react";import{jsxs as R,jsx as z,Fragment as O}from"react/jsx-runtime";var U={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};function D(e){return e.includes("&")?e.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(e,t)=>{if("#"!==t[0])return U[t]??e;const n="x"===t[1]?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return n<=1114111?String.fromCodePoint(n):e}):e}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f￾￿]/g,"")}var H=/([^\s=]+)\s*=\s*("([^"]*)"|'([^']*)')/g;function B(e){const t=[];let n=null,r=0;for(;r<e.length;){const o=e.indexOf("<",r);if(o<0)break;if(o>r&&t.length&&(t[t.length-1].text+=D(e.slice(r,o))),e.startsWith("\x3c!--",o)){r=F(e,"--\x3e",o);continue}if(e.startsWith("<?",o)){r=F(e,"?>",o);continue}if(e.startsWith("<![CDATA[",o)){const n=F(e,"]]>",o);t.length&&(t[t.length-1].text+=e.slice(o+9,n-3)),r=n;continue}if(e.startsWith("<!",o)){r=F(e,">",o);continue}const a=W(e,o);if("/"===e[o+1]){const n=t.pop();if(!n||n.name!==e.slice(o+2,a).trim())throw new Error("Malformed XML");n.innerEnd=o,n.end=a+1,r=a+1;continue}const s="/"===e[a-1],i=e.slice(o+1,s?a-1:a),l=i.search(/\s/),c={name:l<0?i:i.slice(0,l),attrs:{},children:[],text:"",start:o,end:a+1,innerStart:a+1,innerEnd:a+1};if(l>=0)for(const e of i.slice(l).matchAll(H))c.attrs[e[1]]=D(e[3]??e[4]??"");t.length?t[t.length-1].children.push(c):n||(n=c),s||t.push(c),r=a+1}if(!n||t.length)throw new Error("Malformed XML");return n}function F(e,t,n){const r=e.indexOf(t,n);if(r<0)throw new Error("Malformed XML");return r+t.length}function W(e,t){let n="";for(let r=t+1;r<e.length;r++){const t=e[r];if(n)t===n&&(n="");else if('"'===t||"'"===t)n=t;else if(">"===t)return r}throw new Error("Malformed XML")}var K=(e,t)=>e?.children.find(e=>e.name===t),q=(e,t)=>e?.children.filter(e=>e.name===t)??[];function G(e,t,n=[]){for(const r of e.children)t.has(r.name)&&n.push(r),G(r,t,n);return n}function V(e){if(!e)return;const t=e.attrs["w:val"];return!("0"===t||"false"===t||"off"===t||"none"===t)}var Q='xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"',J="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Y={officeDocument:`${J}/officeDocument`,styles:`${J}/styles`,numbering:`${J}/numbering`,theme:`${J}/theme`,comments:`${J}/comments`,footnotes:`${J}/footnotes`,header:`${J}/header`,footer:`${J}/footer`,image:`${J}/image`,hyperlink:`${J}/hyperlink`},X=new TextEncoder,Z=new TextDecoder,_=(e,t)=>{const n=e.get(t);return n?Z.decode(n):void 0},ee=(e,t,n)=>{e.set(t,X.encode(n))},te=e=>{const t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`};function ne(e,t){const n=_(e,te(t));return n?B(n).children.filter(e=>"Relationship"===e.name).map(e=>({id:e.attrs.Id,type:e.attrs.Type,target:e.attrs.Target,external:"External"===e.attrs.TargetMode})):[]}function re(e,t){if(t.startsWith("/"))return t.slice(1);const n=e.split("/").slice(0,-1);for(const e of t.split("/"))".."===e?n.pop():"."!==e&&n.push(e);return n.join("/")}function oe(e,t,n,r,o=!1){const a=te(t),s=_(e,a),i=new Set(ne(e,t).map(e=>e.id));let l=i.size+1;for(;i.has(`rId${l}`);)l++;const c=`rId${l}`,d=`<Relationship Id="${c}" Type="${n}" Target="${I(r)}"${o?' TargetMode="External"':""}/>`;return ee(e,a,s?s.replace(/(<\/Relationships>\s*)$/,`${d}$1`).replace(/<Relationships([^>]*)\/>\s*$/,`<Relationships$1>${d}</Relationships>`):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${d}</Relationships>`),c}function ae(e,t,n){const r=_(e,"[Content_Types].xml")??"";r.includes(`PartName="/${t}"`)||ee(e,"[Content_Types].xml",r.replace("</Types>",`<Override PartName="/${t}" ContentType="${n}"/></Types>`))}var se={a4:{width:11906,height:16838},letter:{width:12240,height:15840},legal:{width:12240,height:20160},a3:{width:16838,height:23811},a5:{width:8391,height:11906}},ie={normal:{top:1440,right:1440,bottom:1440,left:1440},narrow:{top:720,right:720,bottom:720,left:720},moderate:{top:1440,right:1080,bottom:1440,left:1080},wide:{top:1440,right:2880,bottom:1440,left:2880}},le={...se.a4,...ie.normal,header:708,footer:708};function ce(e){const t=Math.min(e.width,e.height),n=Math.max(e.width,e.height);for(const[e,r]of Object.entries(se))if(Math.abs(r.width-t)<30&&Math.abs(r.height-n)<30)return e;return null}var de={yellow:"#ffff00",green:"#00ff00",cyan:"#00ffff",magenta:"#ff00ff",blue:"#0000ff",red:"#ff0000",darkBlue:"#000080",darkCyan:"#008080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",darkGray:"#808080",lightGray:"#c0c0c0",black:"#000000",white:"#ffffff"};var ue=e=>e&&/^[0-9a-fA-F]{6}$/.test(e)?`#${e.toLowerCase()}`:void 0;function pe(e,t){const n={};if(!e)return n;const r=V(K(e,"w:b"));void 0!==r&&(n.b=r);const o=V(K(e,"w:i"));void 0!==o&&(n.i=o);const a=K(e,"w:u");a&&(n.u="none"!==a.attrs["w:val"]);const s=V(K(e,"w:strike"));void 0!==s&&(n.strike=s);const i=K(e,"w:vertAlign")?.attrs["w:val"];"subscript"===i&&(n.vert="sub"),"superscript"===i&&(n.vert="super");const l=function(e,t){if(!e)return;const n=e.attrs["w:ascii"]??e.attrs["w:hAnsi"];if(n)return n;const r=e.attrs["w:asciiTheme"]??e.attrs["w:hAnsiTheme"];return r?r.startsWith("major")?t.major:t.minor:e.attrs["w:eastAsia"]??e.attrs["w:cs"]}(K(e,"w:rFonts"),t);l&&(n.font=l);const c=Number(K(e,"w:sz")?.attrs["w:val"]);c&&(n.size=c/2);const d=ue(K(e,"w:color")?.attrs["w:val"]);d&&(n.color=d);const u=K(e,"w:highlight")?.attrs["w:val"];if(u&&de[u])n.hl=de[u];else{const t=ue(K(e,"w:shd")?.attrs["w:fill"]);t&&(n.hl=t)}return n}function me(e){const t={};if(!e)return t;const n=K(e,"w:jc")?.attrs["w:val"];"left"===n||"start"===n?t.align="left":"center"===n?t.align="center":"right"===n||"end"===n?t.align="right":"both"!==n&&"distribute"!==n||(t.align="justify");const r=K(e,"w:ind");if(r){const e=r.attrs["w:left"]??r.attrs["w:start"];void 0!==e&&(t.indentLeft=Number(e)/20),void 0!==r.attrs["w:firstLine"]&&(t.firstLine=Number(r.attrs["w:firstLine"])/20),void 0!==r.attrs["w:hanging"]&&(t.firstLine=-Number(r.attrs["w:hanging"])/20)}const o=K(e,"w:spacing");if(o){void 0!==o.attrs["w:before"]&&(t.before=Number(o.attrs["w:before"])/20),void 0!==o.attrs["w:after"]&&(t.after=Number(o.attrs["w:after"])/20);const e=Number(o.attrs["w:line"]);e&&("exact"===o.attrs["w:lineRule"]||"atLeast"===o.attrs["w:lineRule"]?t.linePoints=e/20:t.lineMultiple=e/240)}return t}var fe=e=>Math.round(100*e)/100;function he(e){const t=[];return e.align&&t.push(`text-align:${e.align}`),void 0!==e.indentLeft&&t.push(`margin-left:${fe(e.indentLeft)}pt`),void 0!==e.firstLine&&t.push(`text-indent:${fe(e.firstLine)}pt`),void 0!==e.before&&t.push(`margin-top:${fe(e.before)}pt`),void 0!==e.after&&t.push(`margin-bottom:${fe(e.after)}pt`),void 0!==e.lineMultiple&&t.push(`line-height:${fe(e.lineMultiple)}`),void 0!==e.linePoints&&t.push(`line-height:${fe(e.linePoints)}pt`),t.join(";")}function we(e){const t=[];void 0!==e.b&&t.push("font-weight:"+(e.b?700:400)),void 0!==e.i&&t.push("font-style:"+(e.i?"italic":"normal"));const n=[e.u&&"underline",e.strike&&"line-through"].filter(Boolean);return n.length&&t.push(`text-decoration-line:${n.join(" ")}`),e.font&&t.push(`font-family:${function(e){const t=e.replace(/["\\<>;]/g,"");return/mono|courier|consolas|menlo/i.test(t)?`"${t}",monospace`:/times|georgia|cambria|garamond|palatino|serif|song|ming/i.test(t)&&!/sans/i.test(t)?`"${t}",Caladea,serif`:`"${t}",Carlito,Arial,sans-serif`}(e.font)}`),e.size&&t.push(`font-size:${fe(e.size)}pt`),e.color&&t.push(`color:${e.color}`),e.hl&&t.push(`background-color:${e.hl}`),t.join(";")}var ge={Title:{name:"Title",xml:'<w:style w:type="paragraph" w:styleId="Title"><w:name w:val="Title"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:after="80" w:line="240" w:lineRule="auto"/></w:pPr><w:rPr><w:sz w:val="56"/><w:szCs w:val="56"/></w:rPr></w:style>'},Heading1:{name:"heading 1",xml:'<w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="360" w:after="80"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:color w:val="0F4761"/><w:sz w:val="40"/><w:szCs w:val="40"/></w:rPr></w:style>'},Heading2:{name:"heading 2",xml:'<w:style w:type="paragraph" w:styleId="Heading2"><w:name w:val="heading 2"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="160" w:after="80"/><w:outlineLvl w:val="1"/></w:pPr><w:rPr><w:color w:val="0F4761"/><w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr></w:style>'},Heading3:{name:"heading 3",xml:'<w:style w:type="paragraph" w:styleId="Heading3"><w:name w:val="heading 3"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="160" w:after="80"/><w:outlineLvl w:val="2"/></w:pPr><w:rPr><w:color w:val="0F4761"/><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr></w:style>'},Quote:{name:"Quote",xml:'<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:before="160"/><w:jc w:val="center"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="404040"/></w:rPr></w:style>'}},be='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';function ye(e){const t=/* @__PURE__ */new Map;ee(t,"[Content_Types].xml",`${be}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/></Types>`),ee(t,"_rels/.rels",`${be}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${Y.officeDocument}" Target="word/document.xml"/></Relationships>`);const n=le;ee(t,"word/document.xml",`${be}<w:document ${Q}><w:body><w:p/><w:sectPr><w:pgSz w:w="${n.width}" w:h="${n.height}"/><w:pgMar w:top="${n.top}" w:right="${n.right}" w:bottom="${n.bottom}" w:left="${n.left}" w:header="${n.header}" w:footer="${n.footer}" w:gutter="0"/></w:sectPr></w:body></w:document>`),ee(t,"word/_rels/document.xml.rels",`${be}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${Y.styles}" Target="styles.xml"/><Relationship Id="rId2" Type="${J}/settings" Target="settings.xml"/></Relationships>`),ee(t,"word/settings.xml",`${be}<w:settings ${Q}><w:compat><w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15"/></w:compat></w:settings>`);const r=/^[A-Za-z]{2,3}(-[A-Za-z0-9]+)*$/.test(e)?e:"en-AU";return ee(t,"word/styles.xml",`${be}<w:styles ${Q}><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Calibri" w:cs="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="${r}"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="160" w:line="259" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>${Object.values(ge).map(e=>e.xml).join("")}<w:style w:type="table" w:default="1" w:styleId="TableNormal"><w:name w:val="Normal Table"/><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style></w:styles>`),t}var ve=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function xe(e){let t=4294967295;for(let n=0;n<e.length;n++)t=ve[255&(t^e[n])]^t>>>8;return(4294967295^t)>>>0}async function ke(e,t){const n=t.writable.getWriter();return n.write(e).then(()=>n.close()).catch(()=>{}),new Uint8Array(await new Response(t.readable).arrayBuffer())}var $e={textBox:"Text box",chart:"Chart",diagram:"Diagram",equation:"Equation",picture:"Picture",object:"Object",contents:"Field"},Ce=/* @__PURE__ */new Set(["w:ins","w:del","w:moveFrom","w:moveTo","w:rPrChange","w:pPrChange","w:tcPrChange","w:trPrChange","w:tblPrChange","w:sectPrChange","w:cellIns","w:cellDel"]),Ne=/* @__PURE__ */new Set(["w:ins","w:del","w:moveFrom","w:moveTo"]),Ae={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml"},Se=/^(https?:|mailto:|tel:)/i,Te=e=>a(e);function Le(e,t){let n="";for(let t=0;t<e.length;t+=32768)n+=String.fromCharCode(...e.subarray(t,t+32768));return`data:${t};base64,${btoa(n)}`}var Pe=(e,t)=>`${t}${++e.nextId}`,je=(e,t)=>e.src.slice(t.start,t.end),Me=(e,t)=>t?je(e,t):void 0;function Ee(e,t){const n=[],r=/* @__PURE__ */new Set;let o=t;for(;o&&!r.has(o);){r.add(o);const t=e.styles.get(o);if(!t)break;n.unshift(t),o=K(t,"w:basedOn")?.attrs["w:val"]}return n}var Re=e=>`"${e.replace(/["\\\n\r]/g,"")}"`;function ze(e){return"w:t"===e.name||"w:delText"===e.name?e.text:"w:tab"===e.name?"\t":"w:instrText"===e.name||"w:instrDelText"===e.name?"":e.children.map(ze).join("")}function Oe(e,t,n,r,o=""){const s=Pe(e,"x");return e.doc.raw.set(s,t),`<span data-raw="${s}" data-kind="${n}" contenteditable="false"${o}>${a(r)}</span>`}function Ue(e,t){const n=Pe(e,"x");return e.doc.raw.set(n,t),`<span data-raw="${n}" data-kind="mark"></span>`}function De(e,t,n){const r=n(je(e,t)),o=e=>G(t,/* @__PURE__ */new Set([e])).length>0,a=K(t,"wp:inline"),s=G(t,/* @__PURE__ */new Set(["a:blip"]))[0],i=s&&e.rels.get(s.attrs["r:embed"]),l=i&&!i.external?re(e.doc.docPath,i.target):void 0,c=l?.split(".").pop()?.toLowerCase()??"",d=l?e.doc.parts.get(l):void 0;if(d&&Ae[c]&&!o("wps:txbx")){const n=Pe(e,"x");e.doc.raw.set(n,r);const o=K(a??K(t,"wp:anchor"),"wp:extent"),s=Number(o?.attrs.cx)/12700,i=Number(o?.attrs.cy)/12700,l=s&&i?` style="width:${Math.round(100*s)/100}pt;height:${Math.round(100*i)/100}pt"`:"",u=a?"":' contenteditable="false"';return a||e.doc.notices.objects++,`<img data-raw="${n}" src="${Te(e.imageUrl(d,Ae[c]))}"${l}${u} alt="">`}return e.doc.notices.objects++,o("wps:txbx")||o("w:txbxContent")?Oe(e,r,"object",`${e.labels.textBox}: ${ze(t).slice(0,80)}`):o("c:chart")?Oe(e,r,"object",e.labels.chart):o("dgm:relIds")?Oe(e,r,"object",e.labels.diagram):Oe(e,r,"object",s?e.labels.picture:e.labels.object)}function Ie(e,t){const n=K(t,"w:rPr"),r=pe(n,e.theme),o=Me(e,n)??"",s=e=>`<w:r>${o}${e}</w:r>`;let i="";for(const n of t.children)switch(n.name){case"w:rPr":case"w:lastRenderedPageBreak":case"w:commentReference":case"w:fldChar":case"w:instrText":case"w:delInstrText":break;case"w:t":case"w:delText":i+=a(n.text);break;case"w:tab":i+="\t";break;case"w:noBreakHyphen":i+="‑";break;case"w:softHyphen":i+="­";break;case"w:br":case"w:cr":"page"===n.attrs["w:type"]?i+='<span data-page-break contenteditable="false"></span>':"column"===n.attrs["w:type"]?i+=Oe(e,s(je(e,n)),"mark",""):i+="<br>";break;case"w:drawing":i+=De(e,n,s);break;case"mc:AlternateContent":case"w:pict":case"w:object":e.doc.notices.objects++,i+=Oe(e,s(je(e,n)),"object",G(n,/* @__PURE__ */new Set(["wps:txbx","w:txbxContent","v:textbox"])).length?`${e.labels.textBox}: ${ze(G(n,/* @__PURE__ */new Set(["wps:txbx","w:txbxContent","v:textbox"]))[0]).slice(0,80)}`:e.labels.object);break;case"w:footnoteReference":case"w:endnoteReference":{const t=++e.footnoteCount;e.doc.notices.footnotes++;const r=e.footnotes.get(n.attrs["w:id"]);i+=Oe(e,s(je(e,n)),"note",String(t),r?` title="${Te(r)}"`:"");break}default:i+=Oe(e,s(je(e,n)),"mark","")}if(!i)return"";if(r.vert&&(i=`<${"sub"===r.vert?"sub":"sup"}>${i}</${"sub"===r.vert?"sub":"sup"}>`),n){const t=Pe(e,"r");e.doc.runs.set(t,o);const a=we(r),s=K(n,"w:rStyle")?.attrs["w:val"];i=`<span data-r="${t}"${s?` data-rstyle="${Te(s)}"`:""}${a?` style="${Te(a)}"`:""}>${i}</span>`}for(const t of e.openComments)i=`<span data-comment="${Te(t)}" title="${Te(e.comments.get(t)??"")}">${i}</span>`;return i}function He(e,t){let n="",r=0,o=-1,s=-1,i="",l=!1;const c=()=>{o>=0&&(n+=Oe(e,e.src.slice(o,s),"field",i||e.labels.contents)),o=-1,i="",l=!1};for(const a of t){if("w:r"===a.name){const t=q(a,"w:fldChar");if(t.length||r>0){0===r&&(o=a.start,l=!1),l&&(i+=ze(a));for(const e of t){const t=e.attrs["w:fldCharType"];"begin"===t?r++:"separate"===t&&1===r?l=!0:"end"===t&&r--}s=a.end,0===r&&c();continue}n+=Ie(e,a);continue}if(r>0)s=a.end;else switch(a.name){case"w:pPr":case"w:proofErr":break;case"w:commentRangeStart":e.openComments.add(a.attrs["w:id"]);break;case"w:commentRangeEnd":e.openComments.delete(a.attrs["w:id"]);break;case"w:hyperlink":{const t=a.attrs["r:id"]?e.rels.get(a.attrs["r:id"]):void 0,r=a.attrs["w:anchor"],o=t?.target??(r?`#${r}`:""),s=Se.test(o)||o.startsWith("#"),i=`${t?` data-rel="${Te(a.attrs["r:id"])}"`:""}${r?` data-anchor="${Te(r)}"`:""}`;n+=`<a${s?` href="${Te(o)}"`:""}${i}>${He(e,a.children)}</a>`;break}case"w:ins":case"w:moveTo":n+=`<ins>${He(e,a.children)}</ins>`;break;case"w:del":case"w:moveFrom":n+=`<del>${He(e,a.children)}</del>`;break;case"w:bookmarkStart":case"w:bookmarkEnd":case"w:permStart":case"w:permEnd":default:n+=Ue(e,je(e,a));break;case"m:oMath":case"m:oMathPara":e.doc.notices.objects++,n+=Oe(e,je(e,a),"object",e.labels.equation);break;case"w:fldSimple":case"w:sdt":case"w:smartTag":case"w:customXml":n+=Oe(e,je(e,a),"field",ze(a)||e.labels.contents)}}return r>0&&(n+=a(i)),n}function Be(e){return G(e,Ce).length>0}function Fe(e,t){const n=K(t,"w:pPr"),r=K(n,"w:pStyle")?.attrs["w:val"],o=K(n,"w:numPr")??function(e,t){let n;for(const r of Ee(e,t))n=K(K(r,"w:pPr"),"w:numPr")??n;return n}(e,r),a=K(o,"w:numId")?.attrs["w:val"];if(!a||"0"===a)return null;const s=Number(K(o,"w:ilvl")?.attrs["w:val"]??0),i=e.numbering.get(a)?.get(s);return{numId:a,ilvl:s,ordered:i?.ordered??!1,marker:i?.marker??""}}function We(e){const t=[],n=K(e,"w:pBdr");for(const e of["top","bottom","left","right"]){const r=K(n,`w:${e}`);if(!r||"nil"===r.attrs["w:val"]||"none"===r.attrs["w:val"])continue;const o=/^[0-9a-fA-F]{6}$/.test(r.attrs["w:color"]??"")?`#${r.attrs["w:color"]}`:"currentcolor";t.push(`border-${e}:${(Number(r.attrs["w:sz"])||4)/8}pt solid ${o}`)}const r=K(e,"w:shd")?.attrs["w:fill"];return r&&/^[0-9a-fA-F]{6}$/.test(r)&&t.push(`background-color:#${r}`),t.join(";")}function Ke(e,t,n){const r=K(t,"w:pPr"),o=K(r,"w:pStyle")?.attrs["w:val"],a=e.fieldOpen,s=function(e){let t=0;for(const n of G(e,/* @__PURE__ */new Set(["w:fldChar"]))){const e=n.attrs["w:fldCharType"];"begin"===e?t++:"end"===e&&t--}return t}(t),i=Be(t)||a||0!==s;s>0&&(e.fieldOpen=!0),a&&s<0&&(e.fieldOpen=!1);const l=Pe(e,"p");e.doc.blocks.set(l,{xml:je(e,t),fingerprint:"",props:Me(e,r),numId:n?.numId,ilvl:n?.ilvl});const c=n?0:function(e,t){if(!t)return 0;const n=K(e.styles.get(t),"w:name")?.attrs["w:val"]??"",r=/^heading ([1-6])$/i.exec(n);return r?Number(r[1]):0}(e,o),d=n?"li":c?`h${c}`:"p",u=me(r);n&&delete u.indentLeft,n&&delete u.firstLine;const p=[he(u),We(r)].filter(Boolean).join(";");let m=i?qe(e,t):He(e,t.children);m&&!/<br>(<\/[^>]+>)*$/.test(m)||(m+="<br>");return`<${d} data-docx="${l}"${K(r,"w:pageBreakBefore")?" data-break-before":""}${o?` data-pstyle="${Te(o)}"`:""}${p?` style="${Te(p)}"`:""}${i?' data-locked contenteditable="false"':""}>${m}</${d}>`}function qe(e,t){let n="";for(const r of t.children)"w:pPr"!==r.name&&"w:rPr"!==r.name&&"w:instrText"!==r.name&&"w:delInstrText"!==r.name&&("w:ins"===r.name||"w:moveTo"===r.name?n+=`<ins>${qe(e,r)}</ins>`:"w:del"===r.name||"w:moveFrom"===r.name?n+=`<del>${qe(e,r)}</del>`:"w:commentRangeStart"===r.name?e.openComments.add(r.attrs["w:id"]):"w:commentRangeEnd"===r.name?e.openComments.delete(r.attrs["w:id"]):"w:t"===r.name||"w:delText"===r.name?n+=a(r.text):"w:tab"===r.name?n+="\t":"w:br"===r.name?n+="<br>":"w:drawing"===r.name||"mc:AlternateContent"===r.name||"w:pict"===r.name?n+=`<span data-kind="object">${a(e.labels.object)}</span>`:n+=qe(e,r));return n}function Ge(e,t){const n=Pe(e,"t"),r=K(t,"w:tblPr"),o=K(t,"w:tblGrid"),a=q(t,"w:tr"),s=a.some(e=>K(K(e,"w:trPr"),"w:gridBefore")||K(K(e,"w:trPr"),"w:gridAfter")),i=Be(t)||s;s&&e.doc.notices.objects++,e.doc.blocks.set(n,{xml:je(e,t),fingerprint:"",props:Me(e,r),tblGrid:Me(e,o)});const l=K(r,"w:tblStyle")?.attrs["w:val"],c=q(o,"w:gridCol").map(e=>Number(e.attrs["w:w"])/20),d=/* @__PURE__ */new Map,u=a.map(e=>{const t=[];let n=0;for(const r of q(e,"w:tc")){const e=K(r,"w:tcPr"),o=Number(K(e,"w:gridSpan")?.attrs["w:val"]??1),a=K(e,"w:vMerge");if(a&&"restart"!==a.attrs["w:val"]&&d.has(n))d.get(n).rowSpan++;else{const e={node:r,rowSpan:1,col:n,span:o};t.push(e),a?d.set(n,e):d.delete(n)}n+=o}return t}),p=function(e,t,n){let r=K(t,"w:tblBorders");if(!r)for(const t of Ee(e,n))r=K(K(t,"w:tblPr"),"w:tblBorders")??r;return!!r&&r.children.some(e=>!["nil","none"].includes(e.attrs["w:val"]))}(e,r,l),m=a.map((t,n)=>{const r=Pe(e,"t");e.doc.blocks.set(r,{xml:"",fingerprint:"",props:Me(e,K(t,"w:trPr"))});return`<tr data-docx="${r}">${u[n].map(t=>{const n=Pe(e,"t"),r=K(t.node,"w:tcPr");e.doc.blocks.set(n,{xml:"",fingerprint:"",props:Me(e,r)});const o=K(r,"w:shd")?.attrs["w:fill"],a=[];o&&/^[0-9a-fA-F]{6}$/.test(o)&&a.push(`background-color:#${o.toLowerCase()}`);const s=K(r,"w:vAlign")?.attrs["w:val"];return"center"===s&&a.push("vertical-align:middle"),"bottom"===s&&a.push("vertical-align:bottom"),`<td data-docx="${n}"${t.span>1?` colspan="${t.span}"`:""}${t.rowSpan>1?` rowspan="${t.rowSpan}"`:""}${a.length?` style="${a.join(";")}"`:""}>${Ve(e,t.node.children)}</td>`}).join("")}</tr>`}).join(""),f=c.length?`<colgroup>${c.map(e=>`<col style="width:${Math.round(100*e)/100}pt">`).join("")}</colgroup>`:"";return`<table data-docx="${n}"${l?` data-tstyle="${Te(l)}"`:""}${p?"":" data-no-borders"}${i?' data-locked contenteditable="false"':""}>${f}<tbody>${m}</tbody></table>`}function Ve(e,t){const n=[],r=[],o=e=>{for(;r.length>e;){const e=r.pop();n.push(`</li></${e.tag}>`)}};for(const a of t){const t="w:p"===a.name?Fe(e,a):null;if(t){for(;r.length&&r[r.length-1].ilvl>t.ilvl;)o(r.length-1);const s=r[r.length-1];!s||s.ilvl!==t.ilvl||s.numId===t.numId&&s.tag===(t.ordered?"ol":"ul")||o(r.length-1);const i=`${t.numId}:${t.ilvl}`,l=e.listCounters.get(i)??0;e.listCounters.set(i,l+1);const c=Ke(e,a,t),d=r[r.length-1];if(d&&d.ilvl===t.ilvl)n.push(`</li>${c.slice(0,c.lastIndexOf("</li>"))}`);else{const e=t.ordered?"ol":"ul",o=t.marker?` style="list-style-type:${t.marker}"`:"",a=t.ordered&&l?` start="${l+1}"`:"";n.push(`<${e} data-num-id="${Te(t.numId)}" data-ilvl="${t.ilvl}"${a}${o}>${c.slice(0,c.lastIndexOf("</li>"))}`),r.push({tag:e,numId:t.numId,ilvl:t.ilvl})}continue}if("w:tcPr"!==a.name&&"w:sectPr"!==a.name)if(o(0),"w:p"===a.name)n.push(Ke(e,a,null));else if("w:tbl"===a.name)n.push(Ge(e,a));else if("w:sdt"===a.name){const t=Pe(e,"p");e.doc.blocks.set(t,{xml:je(e,a),fingerprint:""}),e.doc.notices.objects++;const r=Ve(e,q(K(a,"w:sdtContent"),"w:p"));n.push(`<div data-docx="${t}" data-locked contenteditable="false">${r}</div>`)}else{const t=Pe(e,"p");e.doc.blocks.set(t,{xml:je(e,a),fingerprint:""}),n.push(`<div data-docx="${t}" data-locked data-hidden contenteditable="false"></div>`)}}return o(0),n.join("")}function Qe(e){if("LI"!==e.tagName)return e.outerHTML;const t=e.cloneNode(!0);return Array.from(t.children).forEach(e=>{"UL"!==e.tagName&&"OL"!==e.tagName||e.remove()}),t.outerHTML}function Je(e){const t=document.createElement("div");t.innerHTML=e.html,t.querySelectorAll("[data-docx]").forEach(t=>{const n=e.blocks.get(t.getAttribute("data-docx"));n&&(n.fingerprint=Qe(t))})}function Ye(e,t){const n=t?_(e,t):void 0;if(!n)return{text:"",editable:!0};const r=B(n),o=r.children.filter(e=>"w:p"===e.name),a=r.children.every(e=>"w:p"===e.name)&&0===G(r,/* @__PURE__ */new Set(["w:drawing","w:pict","mc:AlternateContent","w:sdt"])).length,s=o.map(e=>{let t="",n="",r=!1;const o=e=>{for(const a of e.children)if("w:t"===a.name)r||(t+=a.text);else if("w:tab"===a.name)r||(t+=" | ");else if("w:instrText"===a.name)n+=a.text;else if("w:fldChar"===a.name){const e=a.attrs["w:fldCharType"];"separate"!==e&&"end"!==e||(n&&(t+=Xe(n),n=""),r="separate"===e)}else"w:fldSimple"===a.name?t+=Xe(a.attrs["w:instr"]??"")||a.children.map(ze).join(""):"w:pPr"!==a.name&&"w:rPr"!==a.name&&o(a)};return o(e),t}).filter(Boolean);return{text:s.join(" "),editable:a&&s.length<=1,part:t}}function Xe(e){const t=e.trim().split(/\s+/)[0]?.toUpperCase();return"PAGE"===t?"{page}":"NUMPAGES"===t?"{pages}":""}async function Ze(e,t={}){const n=await async function(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let n=-1;for(let r=e.length-22;r>=Math.max(0,e.length-66e3);r--)if(101010256===t.getUint32(r,!0)){n=r;break}if(n<0)throw new Error("Not a zip file");const r=t.getUint16(n+10,!0);let o=t.getUint32(n+16,!0);const a=new TextDecoder,s=/* @__PURE__ */new Map;let i=0;for(let n=0;n<r;n++){if(33639248!==t.getUint32(o,!0))throw new Error("Damaged zip file");const n=t.getUint16(o+10,!0),r=t.getUint32(o+20,!0);if(i+=t.getUint32(o+24,!0),i>1073741824)throw new Error("Zip file too large");const l=t.getUint16(o+28,!0),c=t.getUint16(o+30,!0),d=t.getUint16(o+32,!0),u=t.getUint32(o+42,!0),p=a.decode(e.subarray(o+46,o+46+l));if(o+=46+l+c+d,p.endsWith("/"))continue;const m=u+30+t.getUint16(u+26,!0)+t.getUint16(u+28,!0),f=e.subarray(m,m+r);if(0===n)s.set(p,f.slice());else{if(8!==n)throw new Error("Unsupported zip compression");s.set(p,await ke(f,new DecompressionStream("deflate-raw")))}}return s}(e);return _e(n,e,t)}function _e(e,t,n={}){const r=ne(e,"").find(e=>e.type.endsWith("/officeDocument")),o=r?re("",r.target):"word/document.xml",a=_(e,o);if(!a)throw new Error("Not a Word document");const s=B(a),i=K(s,"w:body");if(!i)throw new Error("Not a Word document");const l=ne(e,o),c=e=>{const t=(e=>l.find(t=>t.type===e))(e);return t?re(o,t.target):void 0},d=function(e){if(!e)return{};try{const t=B(e),n=K(K(t,"a:themeElements"),"a:fontScheme");return{major:K(K(n,"a:majorFont"),"a:latin")?.attrs.typeface,minor:K(K(n,"a:minorFont"),"a:latin")?.attrs.typeface}}catch{return{}}}(c(Y.theme)?_(e,c(Y.theme)):void 0),u={parts:e,docPath:o,source:t,html:"",css:"",page:{...le},header:{text:"",editable:!0},footer:{text:"",editable:!0},blocks:/* @__PURE__ */new Map,runs:/* @__PURE__ */new Map,raw:/* @__PURE__ */new Map,notices:{comments:0,tracked:0,objects:0,footnotes:0},styles:[],theme:d},p={src:a,doc:u,labels:n.labels??$e,rels:new Map(l.map(e=>[e.id,e])),theme:d,imageUrl:n.imageUrl??Le,styles:/* @__PURE__ */new Map,numbering:/* @__PURE__ */new Map,listCounters:/* @__PURE__ */new Map,comments:/* @__PURE__ */new Map,footnotes:/* @__PURE__ */new Map,nextId:0,footnoteCount:0,openComments:/* @__PURE__ */new Set,fieldOpen:!1},m=c(Y.styles),f=m?_(e,m):void 0,h=f?B(f):void 0;for(const e of q(h,"w:style"))p.styles.set(e.attrs["w:styleId"],e);const w=new Set(p.styles.keys());for(const[e,t]of Object.entries(ge))w.has(e)||p.styles.set(e,B(t.xml));const g=K(h,"w:docDefaults");u.lang=K(K(K(g,"w:rPrDefault"),"w:rPr"),"w:lang")?.attrs["w:val"],u.css=function(e,t){const n=[],r=pe(K(K(t,"w:rPrDefault"),"w:rPr"),e.theme),o=me(K(K(t,"w:pPrDefault"),"w:pPr"));e.doc.defaultFont=r.font,e.doc.defaultSize=r.size;let a=r,s=o;for(const[t,i]of e.styles){const l=i.attrs["w:type"];if("paragraph"!==l&&"character"!==l&&"table"!==l)continue;let c={},d={};for(const n of Ee(e,t))c={...c,...pe(K(n,"w:rPr"),e.theme)},d={...d,...me(K(n,"w:pPr"))};if("paragraph"===l)n.push(`.docs-page [data-pstyle=${Re(t)}]{${[we(c),he(d)].filter(Boolean).join(";")}}`),"1"===i.attrs["w:default"]&&(a={...r,...c},s={...o,...d});else if("character"===l)n.push(`.docs-page [data-rstyle=${Re(t)}]{${we(c)}}`);else{const e=he(d);e&&n.push(`.docs-page table[data-tstyle=${Re(t)}] p{${e}}`)}}return n.unshift(`.docs-page{${we(a)}}`,`.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6,.docs-page li{${he(s)}}`),n.join("\n")}(p,g);const b=new Set(Object.keys(ge));u.styles=[...p.styles.values()].filter(e=>"paragraph"===e.attrs["w:type"]&&"1"!==e.attrs["w:default"]&&(b.has(e.attrs["w:styleId"])||K(e,"w:qFormat"))&&!K(e,"w:hidden")&&!K(e,"w:semiHidden")).map(e=>({id:e.attrs["w:styleId"],name:K(e,"w:name")?.attrs["w:val"]??e.attrs["w:styleId"]}));const y=c(Y.numbering),v=y?_(e,y):void 0;v&&function(e,t){const n=/* @__PURE__ */new Map;for(const e of q(t,"w:abstractNum")){const t=/* @__PURE__ */new Map;for(const n of q(e,"w:lvl")){const e=K(n,"w:numFmt")?.attrs["w:val"]??"decimal";t.set(Number(n.attrs["w:ilvl"]),{ordered:"bullet"!==e&&"none"!==e,marker:et[e]??""})}n.set(e.attrs["w:abstractNumId"],t)}for(const r of q(t,"w:num")){const t=n.get(K(r,"w:abstractNumId")?.attrs["w:val"]??"");t&&e.numbering.set(r.attrs["w:numId"],t)}}(p,B(v));const x=c(Y.comments),k=x?_(e,x):void 0;if(k){for(const e of q(B(k),"w:comment"))p.comments.set(e.attrs["w:id"],`${e.attrs["w:author"]??""}: ${ze(e)}`);u.notices.comments=p.comments.size}const $=c(Y.footnotes),C=$?_(e,$):void 0;if(C)for(const e of q(B(C),"w:footnote"))p.footnotes.set(e.attrs["w:id"],ze(e));u.notices.tracked=G(i,Ne).length;const N=K(i,"w:sectPr"),A=K(N,"w:pgSz"),S=K(N,"w:pgMar"),T=(e,t,n)=>{const r=Number(e?.attrs[t]);return Number.isFinite(r)&&void 0!==e?.attrs[t]?r:n};u.page={width:T(A,"w:w",le.width),height:T(A,"w:h",le.height),top:Math.abs(T(S,"w:top",le.top)),right:T(S,"w:right",le.right),bottom:Math.abs(T(S,"w:bottom",le.bottom)),left:T(S,"w:left",le.left),header:T(S,"w:header",le.header),footer:T(S,"w:footer",le.footer)};const L=e=>{const t=q(N,e).find(e=>"default"===e.attrs["w:type"]),n=t&&p.rels.get(t.attrs["r:id"]);return n?re(o,n.target):void 0};return u.header=Ye(e,L("w:headerReference")),u.footer=Ye(e,L("w:footerReference")),u.html=Ve(p,i.children),u.html||(u.html="<p><br></p>"),Je(u),u}var et={lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",decimalZero:"decimal-leading-zero"};var tt=/* @__PURE__ */new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI","TR","TABLE","UL","OL","TBODY"]);function nt(e){let t="";const n=e=>{for(const r of Array.from(e.childNodes)){if(3===r.nodeType){t+=(r.nodeValue??"").replace(/​/g,"");continue}if(1!==r.nodeType)continue;const e=r;if("BR"===e.tagName){t+="\n";continue}if("DEL"===e.tagName||e.hasAttribute("data-hidden"))continue;if("object"===e.getAttribute("data-kind")||"mark"===e.getAttribute("data-kind"))continue;if("TD"===e.tagName||"TH"===e.tagName){n(e),t=`${t.replace(/\n+$/,"")}\t`;continue}const o=tt.has(e.tagName);n(e),o&&!t.endsWith("\n")&&(t+="\n")}};return n(e),t.replace(/\t\n/g,"\n").replace(/\n+$/,"\n")}function rt(e,t,n){if(!t)return[];const r=function(e){const t=[],n=e=>{for(const r of Array.from(e.childNodes))if(3===r.nodeType)t.push(r);else if(1===r.nodeType){const e=r;if("false"===e.getAttribute("contenteditable")||e.hasAttribute("data-raw"))continue;n(e)}};return n(e),t}(e),o=t=>{let n=t.parentNode;for(;n&&n!==e&&!tt.has(n.tagName)&&"TD"!==n.tagName;)n=n.parentNode;return n},a=[];let s=0;for(;s<r.length;){const e=o(r[s]);let i=s;const l=[];for(;i<r.length&&o(r[i])===e;)l.push(r[i++]);const c=l.map(e=>e.nodeValue??"").join(""),d=n?c:c.toLowerCase(),u=n?t:t.toLowerCase(),p=d.length===c.length?d:c;for(let e=p.indexOf(u);e>=0;e=p.indexOf(u,e+u.length)){const t=[];let n=0;for(const r of l){const o=(r.nodeValue??"").length,a=Math.max(e,n),s=Math.min(e+u.length,n+o);a<s&&t.push({node:r,start:a-n,end:s-n}),n+=o}a.push(t)}s=i}return a}function ot(e,t){e.forEach((e,n)=>{const r=e.node.nodeValue??"";e.node.nodeValue=r.slice(0,e.start)+(0===n?t:"")+r.slice(e.end)})}var at=/* @__PURE__ */new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","COLGROUP","COL","B","STRONG","I","EM","U","S","STRIKE","SUB","SUP","SPAN","FONT","A","BR","IMG","PRE","HR"]),st=/* @__PURE__ */new Set(["SCRIPT","STYLE","TITLE","META","LINK","OBJECT","EMBED","IFRAME","NOSCRIPT","TEMPLATE","SVG","MATH","FORM","INPUT","BUTTON","SELECT","TEXTAREA","VIDEO","AUDIO","CANVAS"]),it=/* @__PURE__ */new Set(["color","background-color","font-weight","font-style","text-decoration-line","text-decoration","font-family","font-size","text-align","margin-left","line-height","width","height","list-style-type"]),lt=/^(https?:|mailto:|tel:|#)/i,ct=/^(data:image\/(png|jpe?g|gif|webp|bmp);base64,|blob:)/i;function dt(e){const t=document.implementation.createHTMLDocument("");t.body.innerHTML=e;const n=(e,t,r)=>{for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t.appendChild(r.createTextNode(o.nodeValue??""));continue}if(1!==o.nodeType)continue;const e=o,a=e.tagName.toUpperCase();if(st.has(a))continue;if(!at.has(a)){n(e,t,r);continue}if("IMG"===a&&!ct.test(e.getAttribute("src")??""))continue;const s=r.createElement(a),i=(e.getAttribute("style")??"").split(";").map(e=>{const t=e.indexOf(":");if(t<0)return"";const n=e.slice(0,t).trim().toLowerCase(),r=e.slice(t+1).trim();return it.has(n)&&!/url\(|expression|mso-/i.test(r)?`${n}:${r}`:""}).filter(Boolean).join(";");i&&s.setAttribute("style",i),"A"===a&&lt.test(e.getAttribute("href")??"")&&s.setAttribute("href",e.getAttribute("href")),"IMG"===a&&s.setAttribute("src",e.getAttribute("src"));for(const t of["colspan","rowspan","start","color","face","size"]){const n=e.getAttribute(t);null!==n&&s.setAttribute(t,n)}n(e,s,r),t.appendChild(s)}},r=document.createElement("div");return n(t.body,r,document),r.innerHTML}var ut=["w:rStyle","w:rFonts","w:b","w:bCs","w:i","w:iCs","w:caps","w:smallCaps","w:strike","w:dstrike","w:outline","w:shadow","w:emboss","w:imprint","w:noProof","w:snapToGrid","w:vanish","w:webHidden","w:color","w:spacing","w:w","w:kern","w:position","w:sz","w:szCs","w:highlight","w:u","w:effect","w:bdr","w:shd","w:fitText","w:vertAlign","w:rtl","w:cs","w:em","w:lang","w:eastAsianLayout","w:specVanish","w:oMath","w:rPrChange"],pt=["w:pStyle","w:keepNext","w:keepLines","w:pageBreakBefore","w:framePr","w:widowControl","w:numPr","w:suppressLineNumbers","w:pBdr","w:shd","w:tabs","w:suppressAutoHyphens","w:kinsoku","w:wordWrap","w:overflowPunct","w:topLinePunct","w:autoSpaceDE","w:autoSpaceDN","w:bidi","w:adjustRightInd","w:snapToGrid","w:spacing","w:ind","w:contextualSpacing","w:mirrorIndents","w:suppressOverlap","w:jc","w:textDirection","w:textAlignment","w:textboxTightWrap","w:outlineLvl","w:divId","w:cnfStyle","w:rPr","w:sectPr","w:pPrChange"],mt=["w:cnfStyle","w:tcW","w:gridSpan","w:hMerge","w:vMerge","w:tcBorders","w:shd","w:noWrap","w:tcMar","w:textDirection","w:tcFitText","w:vAlign","w:hideMark","w:headers","w:cellIns","w:cellDel","w:cellMerge","w:tcPrChange"],ft=["w:headerReference","w:footerReference","w:footnotePr","w:endnotePr","w:type","w:pgSz","w:pgMar","w:paperSrc","w:pgBorders","w:lnNumType","w:pgNumType","w:cols","w:formProt","w:vAlign","w:noEndnote","w:titlePg","w:textDirection","w:bidi","w:rtlGutter","w:docGrid","w:printerSettings","w:sectPrChange"];function ht(e){if(!e)return[];return B(e).children.map(t=>({name:t.name,xml:e.slice(t.start,t.end)}))}function wt(e,t){const n=e=>{const n=t.indexOf(e);return n<0?t.length:n};return e.map((e,t)=>({p:e,i:t})).sort((e,t)=>n(e.p.name)-n(t.p.name)||e.i-t.i).map(e=>e.p.xml).join("")}function gt(e){const t=/* @__PURE__ */new Map;for(const n of(e.getAttribute("style")??"").split(";")){const e=n.indexOf(":");e>0&&t.set(n.slice(0,e).trim().toLowerCase(),n.slice(e+1).trim())}return t}var bt={black:"#000000",white:"#ffffff",red:"#ff0000",blue:"#0000ff",green:"#008000",yellow:"#ffff00"};function yt(e){if(!e)return;const t=e.trim().toLowerCase();if("transparent"===t||"inherit"===t||"initial"===t||"auto"===t)return;if(bt[t])return bt[t];if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`;const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+))?\s*\)$/.exec(t);return!n||void 0!==n[4]&&0===Number(n[4])?void 0:`#${[n[1],n[2],n[3]].map(e=>Math.round(Number(e)).toString(16).padStart(2,"0")).join("")}`}function vt(e){if(!e)return;const t=/^(-?[\d.]+)(pt|px|in|cm|mm|em)?$/.exec(e.trim());if(!t)return;const n=Number(t[1]);switch(t[2]){case"pt":return n;case"px":return.75*n;case"in":return 72*n;case"cm":return 72*n/2.54;case"mm":return 72*n/25.4;default:return"0"===t[1]?0:void 0}}var xt=[10,13,16,18,24,32,48].map(e=>.75*e);var kt=(e,t)=>void 0===e||void 0===t?e===t:Math.abs(e-t)<.02,$t=e=>Math.round(20*e);function Ct(e,t){const n=ne(e.parts,e.doc.docPath).find(e=>e.type===Y.styles),r=n?_(e.parts,re(e.doc.docPath,n.target)):void 0;if(r)for(const e of B(r).children)if("w:style"===e.name&&K(e,"w:name")?.attrs["w:val"]?.toLowerCase()===t)return e.attrs["w:styleId"];return Object.entries(ge).find(([,e])=>e.name===t)?.[0]??null}var Nt=["•","o","▪"],At=["decimal","lowerLetter","lowerRoman"];function St(e){const t=ne(e.parts,e.doc.docPath).find(e=>e.type===Y.numbering);if(t){const n=re(e.doc.docPath,t.target);return{path:n,text:_(e.parts,n)??`<w:numbering ${Q}></w:numbering>`}}const n="word/numbering.xml";return oe(e.parts,e.doc.docPath,Y.numbering,"numbering.xml"),ae(e.parts,n,"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"),{path:n,text:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<w:numbering ${Q}></w:numbering>`}}function Tt(e,t){const{path:n,text:r}=St(e),o=B(r),a=o.children.filter(e=>"w:abstractNum"===e.name).map(e=>Number(e.attrs["w:abstractNumId"])),s=String((a.length?Math.max(...a):-1)+1);let i="";for(let e=0;e<9;e++){i+=`<w:lvl w:ilvl="${e}"><w:start w:val="1"/><w:numFmt w:val="${t?At[e%3]:"bullet"}"/><w:lvlText w:val="${t?`%${e+1}.`:Nt[e%3]}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(e+1)}" w:hanging="360"/></w:pPr></w:lvl>`}const l=`<w:abstractNum w:abstractNumId="${s}"><w:multiLevelType w:val="hybridMultilevel"/>${i}</w:abstractNum>`,c=o.children.find(e=>"w:num"===e.name),d=c?c.start:o.innerEnd>o.innerStart||r.includes("</w:numbering>")?r.lastIndexOf("</w:numbering>"):-1,u=d>=0?r.slice(0,d)+l+r.slice(d):r.replace(/\/>\s*$/,`>${l}</w:numbering>`);return ee(e.parts,n,u),s}function Lt(e,t,n){const{path:r,text:o}=St(e),a=B(o),s=a.children.filter(e=>"w:num"===e.name).map(e=>Number(e.attrs["w:numId"])),i=String((s.length?Math.max(...s):0)+1),l=`<w:num w:numId="${i}"><w:abstractNumId w:val="${t}"/>${n?'<w:lvlOverride w:ilvl="0"><w:startOverride w:val="1"/></w:lvlOverride>':""}</w:num>`,c=[...a.children].reverse().find(e=>"w:num"===e.name),d=c?c.end:o.lastIndexOf("</w:numbering>");return ee(e.parts,r,o.slice(0,d)+l+o.slice(d)),i}var Pt={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif","image/bmp":"bmp","image/webp":"webp","image/svg+xml":"svg"};function jt(e,t){const n=t.getAttribute("data-raw"),r=function(e,t){const n=gt(t),r=vt(n.get("width")),o=vt(n.get("height")),a=t.naturalWidth?.75*t.naturalWidth:0,s=t.naturalHeight?.75*t.naturalHeight:0,i=a&&s?s/a:o&&r?o/r:.75;let l=r??(a||e.contentWidth);return l>2*e.contentWidth&&(l=e.contentWidth),{width:l,height:o??l*i}}(e,t),o=Math.round(12700*r.width),a=Math.round(12700*r.height),s=n?e.doc.raw.get(n):void 0;if(s)return s.replace(/(<wp:extent\b[^>]*?\bcx=")\d+("[^>]*?\bcy=")\d+/,`$1${o}$2${a}`).replace(/(<a:xfrm\b[^>]*>\s*<a:off\b[^>]*\/>\s*<a:ext\b[^>]*?\bcx=")\d+("[^>]*?\bcy=")\d+/,`$1${o}$2${a}`);const i=t.getAttribute("src")??"";let l=e.mediaBySrc.get(i);if(!l){const t=e.images.get(i)??function(e){const t=/^data:([^;,]+);base64,(.*)$/s.exec(e);if(!t)return null;const n=atob(t[2]),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return{bytes:r,mime:t[1]}}(i);if(!t)return"";const n=Pt[t.mime]??"png";!function(e,t,n){const r=_(e,"[Content_Types].xml")??"";new RegExp(`Extension="${t}"`,"i").test(r)||ee(e,"[Content_Types].xml",r.replace(/(<Types[^>]*>)/,`$1<Default Extension="${t}" ContentType="${n}"/>`))}(e.parts,n,t.mime);let r=1;for(;e.parts.has(`word/media/inserted${r}.${n}`);)r++;e.parts.set(`word/media/inserted${r}.${n}`,t.bytes),l=oe(e.parts,e.doc.docPath,Y.image,`media/inserted${r}.${n}`),e.mediaBySrc.set(i,l)}const c=++e.drawingId;return`<w:r><w:drawing><wp:inline xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${o}" cy="${a}"/><wp:docPr id="${c}" name="Picture ${c}"/><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="${c}" name="Picture ${c}"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${l}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${o}" cy="${a}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`}function Mt(e,t,n,r={}){let o="",a=null;const s=()=>{a?.body&&(o+=`<w:r>${function(e,t,n){const r=n?e.runs.get(n):void 0,o=pe(r?B(r):void 0,e.theme);let a=ht(r);const s=(e,t)=>{a=a.filter(t=>!e.includes(t.name)),a.push(...t)},i=(e,t)=>void 0===t?[]:[{name:e,xml:t?`<${e}/>`:`<${e} w:val="0"/>`}];if(t.b!==o.b&&s(["w:b","w:bCs"],[...i("w:b",t.b),...i("w:bCs",t.b)]),t.i!==o.i&&s(["w:i","w:iCs"],[...i("w:i",t.i),...i("w:iCs",t.i)]),!!t.u!=!!o.u&&s(["w:u"],t.u?[{name:"w:u",xml:'<w:u w:val="single"/>'}]:o.u?[{name:"w:u",xml:'<w:u w:val="none"/>'}]:[]),t.strike!==o.strike&&!!t.strike!=!!o.strike&&s(["w:strike"],i("w:strike",t.strike)),t.vert!==o.vert&&s(["w:vertAlign"],t.vert?[{name:"w:vertAlign",xml:`<w:vertAlign w:val="${"sub"===t.vert?"subscript":"superscript"}"/>`}]:[]),t.font!==o.font){const e=I(t.font??"");s(["w:rFonts"],t.font?[{name:"w:rFonts",xml:`<w:rFonts w:ascii="${e}" w:hAnsi="${e}" w:eastAsia="${e}" w:cs="${e}"/>`}]:[])}if(t.size!==o.size){const e=t.size?Math.round(2*t.size):0;s(["w:sz","w:szCs"],e?[{name:"w:sz",xml:`<w:sz w:val="${e}"/>`},{name:"w:szCs",xml:`<w:szCs w:val="${e}"/>`}]:[])}if(t.color!==o.color&&s(["w:color"],t.color?[{name:"w:color",xml:`<w:color w:val="${t.color.slice(1).toUpperCase()}"/>`}]:[]),t.hl!==o.hl){const e=t.hl?Object.entries(de).find(([,e])=>e===t.hl)?.[0]:void 0;s(["w:highlight","w:shd"],t.hl?e?[{name:"w:highlight",xml:`<w:highlight w:val="${e}"/>`}]:[{name:"w:shd",xml:`<w:shd w:val="clear" w:color="auto" w:fill="${t.hl.slice(1).toUpperCase()}"/>`}]:[])}const l=wt(a,ut);return l?`<w:rPr>${l}</w:rPr>`:""}(e.doc,a.format,a.runId)}${a.body}</w:r>`),a=null},i=(e,t,n)=>{n&&(a&&a.runId===t&&JSON.stringify(a.format)===JSON.stringify(e)?a.body+=n:(s(),a={format:e,runId:t,body:n}))},l=(t,r,a)=>{if(3===t.nodeType)return void i(r,a,function(e){let t="",n="";const r=()=>{n&&(t+=`<w:t xml:space="preserve">${I(n)}</w:t>`),n=""};for(const o of e)"\t"===o?(r(),t+="<w:tab/>"):"\n"===o?(r(),t+="<w:br/>"):"‑"===o?(r(),t+="<w:noBreakHyphen/>"):"­"===o?(r(),t+="<w:softHyphen/>"):"​"!==o&&"\ufeff"!==o&&(n+=o);return r(),t}(t.nodeValue??""));if(1!==t.nodeType)return;const c=t,d=c.tagName;if("IMG"===d)return s(),void(o+=jt(e,c));const u=c.getAttribute("data-raw");if(u){const t=e.doc.raw.get(u);return void(t&&(s(),o+=t))}if(c.hasAttribute("data-page-break"))return void i(r,a,'<w:br w:type="page"/>');if("BR"===d)return void(function(e,t){let n=e;for(;n!==t;){let e=n.nextSibling;for(;e&&3===e.nodeType&&!e.nodeValue;)e=e.nextSibling;if(e)return!1;if(!n.parentNode)return!0;n=n.parentNode}return!0}(c,n)||i(r,a,"<w:br/>"));if("A"===d)return s(),void(o+=function(e,t,n,r){const o=t.getAttribute("data-anchor"),a=t.getAttribute("href")??"";let s=t.getAttribute("data-rel");const i=ne(e.parts,e.doc.docPath),l=s?i.find(e=>e.id===s):void 0;a&&!a.startsWith("#")&&l?.target!==a&&(s=i.find(e=>e.external&&e.target===a)?.id??oe(e.parts,e.doc.docPath,Y.hyperlink,a,!0),t.setAttribute("data-rel",s));const c=t.querySelector("[data-r]")?n:{color:"#0563c1",u:!0,...n},d=Mt(e,Array.from(t.childNodes),r,c);return`<w:hyperlink${o?` w:anchor="${I(o)}"`:s?` r:id="${I(s)}"`:a.startsWith("#")?` w:anchor="${I(a.slice(1))}"`:""} w:history="1">${d}</w:hyperlink>`}(e,c,r,n));const p=c.getAttribute("data-comment");p&&e.firstComment.get(p)===c&&(s(),o+=`<w:commentRangeStart w:id="${I(p)}"/>`);const m=c.getAttribute("data-r"),f=function(e,t){const n={...t},r=e.tagName;if("B"!==r&&"STRONG"!==r||(n.b=!0),"I"!==r&&"EM"!==r||(n.i=!0),"U"===r&&(n.u=!0),"S"!==r&&"STRIKE"!==r||(n.strike=!0),"SUB"===r&&(n.vert="sub"),"SUP"===r&&(n.vert="super"),"FONT"===r){const t=yt(e.getAttribute("color")??void 0);t&&(n.color=t);const r=e.getAttribute("face");r&&(n.font=r.split(",")[0].replace(/["']/g,"").trim());const o=Number(e.getAttribute("size"));o>=1&&o<=7&&(n.size=xt[o-1])}const o=gt(e),a=o.get("font-weight");a&&(n.b="bold"===a||"bolder"===a||Number(a)>=600);const s=o.get("font-style");s&&(n.i="italic"===s||"oblique"===s);const i=o.get("text-decoration-line")??o.get("text-decoration");i&&(/none/.test(i)?(n.u=!1,n.strike=!1):(/underline/.test(i)&&(n.u=!0),/line-through/.test(i)&&(n.strike=!0)));const l=o.get("font-family");l&&(n.font=l.split(",")[0].replace(/["']|&quot;/g,"").trim());const c=vt(o.get("font-size"));if(c&&(n.size=Math.round(2*c)/2),o.has("color")){const e=yt(o.get("color"));e?n.color=e:delete n.color}const d=o.get("background-color")??o.get("background");if(void 0!==d){const e=yt(d);e?n.hl=e:delete n.hl}return n}(c,r);for(const e of Array.from(c.childNodes))l(e,f,m??a);p&&e.lastComment.get(p)===c&&(s(),o+=`<w:commentRangeEnd w:id="${I(p)}"/><w:r><w:commentReference w:id="${I(p)}"/></w:r>`)};for(const e of t)l(e,r,null);return s(),o}function Et(e,t,n,r,o){const a=me(n?B(n):void 0),s=function(e){const t=gt(e),n={},r=t.get("text-align")??e.getAttribute("align")??void 0;"left"===r||"start"===r?n.align="left":"center"!==r&&"right"!==r&&"justify"!==r||(n.align=r);const o=vt(t.get("margin-left"));void 0!==o&&(n.indentLeft=o);const a=vt(t.get("text-indent"));void 0!==a&&(n.firstLine=a);const s=vt(t.get("margin-top"));void 0!==s&&(n.before=s);const i=vt(t.get("margin-bottom"));void 0!==i&&(n.after=i);const l=t.get("line-height");if(l){const e=vt(l);e?n.linePoints=e:Number(l)&&(n.lineMultiple=Number(l))}return n}(t);let i=ht(n);const l=(e,t)=>{i=i.filter(t=>t.name!==e),t&&i.push({name:e,xml:t})};if(l("w:pStyle",r?`<w:pStyle w:val="${I(r)}"/>`:null),l("w:numPr",o?`<w:numPr><w:ilvl w:val="${o.ilvl}"/><w:numId w:val="${I(o.numId)}"/></w:numPr>`:null),s.align!==a.align&&l("w:jc",s.align?`<w:jc w:val="${"justify"===s.align?"both":s.align}"/>`:null),!(o||kt(s.indentLeft,a.indentLeft)&&kt(s.firstLine,a.firstLine))){const e=[];void 0!==s.indentLeft&&e.push(`w:left="${$t(s.indentLeft)}"`),void 0!==s.firstLine&&e.push(s.firstLine<0?`w:hanging="${$t(-s.firstLine)}"`:`w:firstLine="${$t(s.firstLine)}"`),l("w:ind",e.length?`<w:ind ${e.join(" ")}/>`:null)}if(!(kt(s.before,a.before)&&kt(s.after,a.after)&&kt(s.lineMultiple,a.lineMultiple)&&kt(s.linePoints,a.linePoints))){const e=[];void 0!==s.before&&e.push(`w:before="${$t(s.before)}"`),void 0!==s.after&&e.push(`w:after="${$t(s.after)}"`),void 0!==s.lineMultiple&&e.push(`w:line="${Math.round(240*s.lineMultiple)}" w:lineRule="auto"`),void 0!==s.linePoints&&e.push(`w:line="${$t(s.linePoints)}" w:lineRule="exact"`),l("w:spacing",e.length?`<w:spacing ${e.join(" ")}/>`:null)}const c=wt(i,pt);return c?`<w:pPr>${c}</w:pPr>`:""}function Rt(e,t){let n=t.getAttribute("data-pstyle");if(!n){const r=/^H([1-6])$/.exec(t.tagName);r?n=Ct(e,`heading ${r[1]}`)??`Heading${r[1]}`:"BLOCKQUOTE"===t.tagName&&(n=Ct(e,"quote"))}return n&&function(e,t){const n=ne(e.parts,e.doc.docPath).find(e=>e.type===Y.styles);if(!n)return;const r=re(e.doc.docPath,n.target),o=_(e.parts,r);if(!o||new RegExp(`w:styleId="${t}"`).test(o))return;const a=ge[t];a&&ee(e.parts,r,o.replace("</w:styles>",`${a.xml}</w:styles>`))}(e,n),n}function zt(e,t,n,r){const o=t.getAttribute("data-docx"),a=o?e.doc.blocks.get(o):void 0;if(a?.xml&&a.xml.startsWith("<w:p")&&(a.fingerprint===Qe(t)||t.hasAttribute("data-locked"))&&(t.hasAttribute("data-locked")||(a.numId??null)===(r?.numId??null)&&(a.ilvl??null)===(r?.ilvl??null)))return a.xml;return`<w:p>${Et(0,t,a?.props,Rt(e,t),r)}${Mt(e,n,t)}</w:p>`}var Ot=/* @__PURE__ */new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","UL","OL","TABLE","LI","HR","SECTION","ARTICLE"]);function Ut(e,t,n,r){const o=function(e,t,n){const r=t.getAttribute("data-num-id");if(r)return r;if(n)return t.setAttribute("data-num-id",n),n;let o;return"OL"===t.tagName?(e.orderedAbstract??=Tt(e,!0),o=Lt(e,e.orderedAbstract,!0)):(e.bulletNum??=Lt(e,Tt(e,!1),!1),o=e.bulletNum),t.setAttribute("data-num-id",o),o}(e,t,n),a=t.getAttribute("data-ilvl"),s=null!==a&&Number(a)>r?Number(a):r+1;let i="";for(const n of Array.from(t.children)){if("UL"===n.tagName||"OL"===n.tagName){i+=Ut(e,n,o,s);continue}if("LI"!==n.tagName)continue;const t=Array.from(n.children).filter(e=>"UL"===e.tagName||"OL"===e.tagName);i+=zt(e,n,Array.from(n.childNodes).filter(e=>!t.includes(e)),{numId:o,ilvl:s});for(const n of t)i+=Ut(e,n,o,s)}return i}function Dt(e){return Array.from(e.children).some(e=>Ot.has(e.tagName))}function It(e,t){let n="",r=[];const o=()=>{r.some(e=>1===e.nodeType||(e.nodeValue??"").trim())&&(n+=`<w:p>${Mt(e,r,t)}</w:p>`),r=[]};for(const a of Array.from(t.childNodes)){const t=a;if(1!==a.nodeType||!Ot.has(t.tagName)){r.push(a);continue}o();const s=t.getAttribute("data-docx"),i=s?e.doc.blocks.get(s):void 0;"UL"===t.tagName||"OL"===t.tagName?n+=Ut(e,t,null,-1):"TABLE"===t.tagName?n+=Ht(e,t):t.hasAttribute("data-locked")&&i?.xml?n+=i.xml:"HR"===t.tagName?n+='<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr></w:pPr></w:p>':Dt(t)?n+=It(e,t):n+=zt(e,t,Array.from(t.childNodes),null)}return o(),n}function Ht(e,t){const n=t.getAttribute("data-docx"),r=n?e.doc.blocks.get(n):void 0;if(r?.xml&&(t.hasAttribute("data-locked")||r.fingerprint===Qe(t)))return r.xml;const o=Array.from(t.querySelectorAll(":scope > tbody > tr, :scope > tr, :scope > thead > tr, :scope > tfoot > tr")),a=[];let s=0;const i=o.map(t=>{const n=[];let r=0;const o=()=>{for(;a[r]?.left>0;){const e=a[r];e.left--,n.push({continuation:!0,span:e.span,col:r,props:e.props}),r+=e.span}};for(const s of Array.from(t.children).filter(e=>"TD"===e.tagName||"TH"===e.tagName)){o();const t=Math.max(1,Number(s.getAttribute("colspan")??1)),i=Math.max(1,Number(s.getAttribute("rowspan")??1));n.push({cell:s,span:t,col:r}),i>1&&(a[r]={left:i-1,span:t,props:e.doc.blocks.get(s.getAttribute("data-docx")??"")?.props}),r+=t}return o(),s=Math.max(s,r),n}),l=Array.from(t.querySelectorAll(":scope > colgroup > col")),c=[];for(let t=0;t<s;t++){const n=l[t]?vt(gt(l[t]).get("width")):void 0;c.push(void 0!==n&&l.length===s?$t(n):Math.round(20*e.contentWidth/Math.max(s,1)))}return`<w:tbl>${r?.props??'<w:tblPr><w:tblW w:w="5000" w:type="pct"/><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/></w:tblBorders><w:tblLook w:val="04A0"/></w:tblPr>'}${`<w:tblGrid>${c.map(e=>`<w:gridCol w:w="${e}"/>`).join("")}</w:tblGrid>`}${o.map((t,n)=>`<w:tr>${e.doc.blocks.get(t.getAttribute("data-docx")??"")?.props??""}${i[n].map(t=>{const n=t.span,r=c.slice(t.col,t.col+n).reduce((e,t)=>e+t,0);if("continuation"in t)return`<w:tc><w:tcPr>${Bt(t.props,r,n,"continue",void 0)}</w:tcPr><w:p/></w:tc>`;const o=e.doc.blocks.get(t.cell.getAttribute("data-docx")??""),a=Number(t.cell.getAttribute("rowspan")??1),s=yt(gt(t.cell).get("background-color"));let i=It(e,t.cell);return i.endsWith("</w:p>")||i.endsWith("<w:p/>")||(i+="<w:p/>"),`<w:tc><w:tcPr>${Bt(o?.props,r,n,a>1?"restart":null,s)}</w:tcPr>${i}</w:tc>`}).join("")}</w:tr>`).join("")}</w:tbl>`}function Bt(e,t,n,r,o){const a=e?B(e):void 0;let s=ht(e).filter(e=>!["w:tcW","w:gridSpan","w:vMerge"].includes(e.name));s.push({name:"w:tcW",xml:`<w:tcW w:w="${t}" w:type="dxa"/>`}),n>1&&s.push({name:"w:gridSpan",xml:`<w:gridSpan w:val="${n}"/>`}),r&&s.push({name:"w:vMerge",xml:"restart"===r?'<w:vMerge w:val="restart"/>':"<w:vMerge/>"});const i=K(a,"w:shd")?.attrs["w:fill"]?.toLowerCase();return"continue"!==r&&(o?.slice(1)??void 0)!==(i&&/^[0-9a-f]{6}$/.test(i)?i:void 0)&&(s=s.filter(e=>"w:shd"!==e.name),o&&s.push({name:"w:shd",xml:`<w:shd w:val="clear" w:color="auto" w:fill="${o.slice(1).toUpperCase()}"/>`})),wt(s,mt)}function Ft(e,t,n,r,o){let a=ht(t);const s=e.doc.page;if(Object.keys(n).some(e=>n[e]!==s[e])||!t){const e=n.width>n.height,r=`<w:pgSz w:w="${n.width}" w:h="${n.height}"${e?' w:orient="landscape"':""}/>`,o=t?B(t):void 0,s=K(o,"w:pgMar")?.attrs["w:gutter"]??"0",i=`<w:pgMar w:top="${n.top}" w:right="${n.right}" w:bottom="${n.bottom}" w:left="${n.left}" w:header="${n.header}" w:footer="${n.footer}" w:gutter="${s}"/>`;a=a.filter(e=>"w:pgSz"!==e.name&&"w:pgMar"!==e.name),a.push({name:"w:pgSz",xml:r},{name:"w:pgMar",xml:i})}const i=n.width-n.left-n.right,l=(t,n,r)=>{if(!t.editable||n===t.text)return;const o=function(e,t,n){const r=t.split(/\s*\|\s*/),o=r.length>1,a=r.map(e=>e.split(/(\{page\}|\{pages\})/).map(e=>"{page}"===e?'<w:fldSimple w:instr=" PAGE "><w:r><w:t>1</w:t></w:r></w:fldSimple>':"{pages}"===e?'<w:fldSimple w:instr=" NUMPAGES "><w:r><w:t>1</w:t></w:r></w:fldSimple>':e?`<w:r><w:t xml:space="preserve">${I(e)}</w:t></w:r>`:"").join("")).join("<w:r><w:tab/></w:r>");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<w:${e} ${Q}><w:p>${o?`<w:pPr><w:tabs><w:tab w:val="right" w:pos="${n}"/></w:tabs></w:pPr>`:""}${a}</w:p></w:${e}>`}(r,n,i);if(t.part)return void ee(e.parts,t.part,o);const s="hdr"===r?"header":"footer";let l=1;for(;e.parts.has(`word/${s}${l}.xml`);)l++;const c=`word/${s}${l}.xml`;ee(e.parts,c,o),ae(e.parts,c,`application/vnd.openxmlformats-officedocument.wordprocessingml.${s}+xml`);const d=oe(e.parts,e.doc.docPath,"hdr"===r?Y.header:Y.footer,`${s}${l}.xml`);a.push({name:`w:${s}Reference`,xml:`<w:${s}Reference w:type="default" r:id="${d}"/>`}),t.part=c};l(e.doc.header,r,"hdr"),l(e.doc.footer,o,"ftr");return`<w:sectPr${t?/^<w:sectPr\b([^>]*?)\/?>/.exec(t)?.[1]??"":""}>${wt(a,ft)}</w:sectPr>`}async function Wt(e,t,n){const r=new Map(e.parts),o=_(r,e.docPath);if(!o)throw new Error("Not a Word document");const a=B(o),s=K(a,"w:body"),i=K(s,"w:sectPr"),l={doc:e,parts:r,images:n.images??/* @__PURE__ */new Map,firstComment:/* @__PURE__ */new Map,lastComment:/* @__PURE__ */new Map,drawingId:9e4,mediaBySrc:/* @__PURE__ */new Map,contentWidth:(n.page.width-n.page.left-n.page.right)/20,bulletNum:null,orderedAbstract:null};t.querySelectorAll("[data-comment]").forEach(e=>{const t=e.getAttribute("data-comment");l.firstComment.has(t)||l.firstComment.set(t,e),l.lastComment.set(t,e)});let c=It(l,t);/<\/w:p>\s*$|<w:p\/>\s*$/.test(c)||(c+="<w:p/>"),c=function(e){const t=/* @__PURE__ */new Set,n=e.replace(/<w:commentRangeStart\b[^>]*w:id="([^"]+)"[^>]*\/>/g,(e,n)=>t.has(n)?"":(t.add(n),e)),r=/* @__PURE__ */new Set,o=[],a=n.split(/(<w:commentRangeEnd\b[^>]*\/>|<w:r>(?:<w:rPr>(?:(?!<\/w:rPr>).)*<\/w:rPr>)?<w:commentReference\b[^>]*\/><\/w:r>)/s);for(let e=a.length-1;e>=0;e--){const t=a[e],n=/^<w:commentRangeEnd\b[^>]*w:id="([^"]+)"/.exec(t)??/^<w:r>.*<w:commentReference\b[^>]*w:id="([^"]+)"/s.exec(t);if(n&&e%2==1){const e=`${t.includes("commentRangeEnd")?"e":"r"}${n[1]}`;if(r.has(e))continue;r.add(e)}o.push(t)}return o.reverse().join("")}(c);const d=Ft(l,i?o.slice(i.start,i.end):void 0,n.page,n.headerText,n.footerText),u=o.slice(a.start,a.innerStart),p=[!/\bxmlns:r=/.test(u)&&/\br:(id|embed)=/.test(c+d)?' xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"':""].join(""),m=(p?o.slice(0,a.innerStart-1)+p+">":o.slice(0,a.innerStart))+o.slice(a.innerStart,s.innerStart)+c+d+o.slice(s.innerEnd);return ee(r,e.docPath,m),e.parts=r,e.page={...n.page},e.header={...e.header,text:e.header.editable?n.headerText:e.header.text},e.footer={...e.footer,text:e.footer.editable?n.footerText:e.footer.text},async function(e){const t=new TextEncoder,n=[],r=[];let o=0;for(const[a,s]of e){const e=t.encode(a),i="undefined"==typeof CompressionStream?null:await ke(s,new CompressionStream("deflate-raw")),l=null===i||i.length>=s.length,c=l?s:i,d=xe(s),u=new Uint8Array(30+e.length),p=new DataView(u.buffer);p.setUint32(0,67324752,!0),p.setUint16(4,20,!0),p.setUint16(6,2048,!0),p.setUint16(8,l?0:8,!0),p.setUint16(12,33,!0),p.setUint32(14,d,!0),p.setUint32(18,c.length,!0),p.setUint32(22,s.length,!0),p.setUint16(26,e.length,!0),u.set(e,30);const m=new Uint8Array(46+e.length),f=new DataView(m.buffer);f.setUint32(0,33639248,!0),f.setUint16(4,20,!0),f.setUint16(6,20,!0),f.setUint16(8,2048,!0),f.setUint16(10,l?0:8,!0),f.setUint16(14,33,!0),f.setUint32(16,d,!0),f.setUint32(20,c.length,!0),f.setUint32(24,s.length,!0),f.setUint16(28,e.length,!0),f.setUint32(42,o,!0),m.set(e,46),n.push(u,c),r.push(m),o+=u.length+c.length}const a=r.reduce((e,t)=>e+t.length,0),s=new Uint8Array(22),i=new DataView(s.buffer);i.setUint32(0,101010256,!0),i.setUint16(8,e.size,!0),i.setUint16(10,e.size,!0),i.setUint32(12,a,!0),i.setUint32(16,o,!0);const l=new Uint8Array(o+a+22);let c=0;for(const e of[...n,...r,s])l.set(e,c),c+=e.length;return l}(r)}function Kt(e,t,n){const r=new Blob([e],{type:n}),o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=t,a.click(),setTimeout(()=>URL.revokeObjectURL(o),1e4)}var qt=e=>e.replace(/\.[^.]+$/,"")||e;function Gt({query:e,replacement:t,matchCase:n,current:r,total:o,onQuery:a,onReplacement:i,onMatchCase:c,onStep:u,onReplace:p,onReplaceAll:m,onClose:f}){const h=A().documents,w=T(null);return P(()=>{w.current?.focus(),w.current?.select()},[]),/* @__PURE__ */R("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-line bg-surface-sunken px-2 py-1",children:[
2
+ /* @__PURE__ */z("div",{className:"w-40",children:/* @__PURE__ */z(l,{ref:w,size:"sm","aria-label":h.find,placeholder:h.find,value:e,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),u(!e.shiftKey))}})}),
3
+ /* @__PURE__ */z("span",{className:"min-w-14 text-xs text-ink-muted","aria-live":"polite",children:e?o?h.matchCount(r+1,o):h.noMatches:""}),
4
+ /* @__PURE__ */z(d,{size:"sm",variant:"ghost","aria-label":h.previousMatch,title:h.previousMatch,onClick:()=>u(!1),children:/* @__PURE__ */z($,{name:"chevron-up",size:16})}),
5
+ /* @__PURE__ */z(d,{size:"sm",variant:"ghost","aria-label":h.nextMatch,title:h.nextMatch,onClick:()=>u(!0),children:/* @__PURE__ */z($,{name:"chevron-down",size:16})}),
6
+ /* @__PURE__ */z("div",{className:"ml-1 w-40",children:/* @__PURE__ */z(l,{size:"sm","aria-label":h.replaceWith,placeholder:h.replaceWith,value:t,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p())}})}),
7
+ /* @__PURE__ */z(k,{size:"sm",variant:"secondary",onClick:p,children:h.replace}),
8
+ /* @__PURE__ */z(k,{size:"sm",variant:"secondary",onClick:m,children:h.replaceAll}),
9
+ /* @__PURE__ */R("label",{className:"ml-1 flex items-center gap-1 text-xs text-ink-muted",children:[
10
+ /* @__PURE__ */z(s,{checked:n,onChange:c,"aria-label":h.matchCase}),h.matchCase]}),
11
+ /* @__PURE__ */z(d,{className:"ml-auto",size:"sm",variant:"ghost","aria-label":h.closeFind,title:h.closeFind,onClick:f,children:/* @__PURE__ */z($,{name:"close",size:16})})]})}var Vt=class{past=[];future=[];get canUndo(){return this.past.length>0}get canRedo(){return this.future.length>0}record(e){if(this.past[this.past.length-1]?.html===e.html)return;this.past.push(e),this.future=[];let t=this.past.reduce((e,t)=>e+t.html.length,0);for(;this.past.length>1&&(this.past.length>200||t>67108864);)t-=this.past.shift().html.length}undo(e){const t=this.past.pop();return t?(this.future.push(e),t):null}redo(e){const t=this.future.pop();return t?(this.past.push(e),t):null}};function Qt(e,t,n){const r=[];let o=t;for(;o&&o!==e;){const e=o.parentNode;if(!e)return null;r.unshift(Array.prototype.indexOf.call(e.childNodes,o)),o=e}return o===e?{path:r,offset:n}:null}function Jt(e,t){let n=e;for(const e of t.path){const t=n.childNodes[e];if(!t)return null;n=t}const r=3===n.nodeType?(n.nodeValue??"").length:n.childNodes.length;return{node:n,offset:Math.min(t.offset,r)}}var Yt="\nhtml,body{margin:0;background:#fff}\n.docs-page [data-comment]{background:none;border:0}\n.docs-page [data-locked]{background:none;box-shadow:none}\n.docs-page [data-page-break]{break-after:page;border:0;margin:0}\n.docs-page [data-break-before]{break-before:page}\n.docs-page tr,.docs-page img{break-inside:avoid}\n";function Xt(e,t){return`\n.docs-sheet{background:#fff;color:#777}\n.docs-sheet-line{border-color:#aaa}\n\n${`\n.docs-page{color:#000;background:#fff;white-space:pre-wrap;overflow-wrap:break-word;outline:none;line-height:1.08;tab-size:36pt;font-family:Calibri,Carlito,Arial,sans-serif;font-size:11pt}\n.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6{margin:0;font:inherit;font-weight:400}\n.docs-page ul,.docs-page ol{margin:0;padding-left:24pt}\n.docs-page ul{list-style-type:disc}.docs-page ol{list-style-type:decimal}\n.docs-page ul ul{list-style-type:circle}.docs-page ul ul ul{list-style-type:square}\n.docs-page a{color:#0563c1;text-decoration:underline}\n.docs-page sub,.docs-page sup{font-size:.66em}\n.docs-page img{max-width:100%}\n.docs-page table{border-collapse:collapse;table-layout:fixed;width:100%}\n.docs-page td,.docs-page th{border:.5pt solid #000;padding:0 5.4pt;vertical-align:top}\n.docs-page table[data-no-borders] td,.docs-page table[data-no-borders] th{border:.5pt dotted #bbb}\n.docs-page td p{margin-bottom:0}\n.docs-page blockquote{margin:0 0 8pt 24pt;font-style:italic}\n.docs-page hr{border:0;border-top:.75pt solid #000;margin:6pt 0}\n.docs-page [data-hidden]{display:none}\n.docs-page [data-page-break]{display:block;height:0;border-top:1pt dashed #999;margin:6pt 0;user-select:none}\n.docs-page [data-comment]{background:#fff2cc;border-bottom:1.5pt solid #e0b000}\n.docs-page [data-locked]{background:#f4f4f4;box-shadow:-5pt 0 0 #bbb;cursor:not-allowed}\n.docs-page ins{color:#c00000;text-decoration:underline}\n.docs-page del{color:#c00000;text-decoration:line-through}\n.docs-page [data-kind="object"]{display:inline-block;background:#f4f4f4;border:.75pt dashed #999;color:#555;padding:1pt 5pt;cursor:not-allowed;white-space:normal}\n.docs-page [data-kind="field"]{background:#ededed}\n.docs-page [data-kind="note"]{vertical-align:super;font-size:.66em}\n.docs-page ::highlight(docs-find){background:#ffe680}\n.docs-page ::highlight(docs-find-current){background:#ff9f1a}\n\n${e.css}`.replaceAll(".docs-page",`.docs-page[data-doc="${t}"]`)}`}function Zt(e,t){const[n,r]=function(e){return e.split(/\s*\|\s*/).map(e=>e.split(/(\{page\}|\{pages\})/).map(e=>"{page}"===e?"counter(page)":"{pages}"===e?"counter(pages)":e?`"${e.replace(/["\\\n\r]/g,"")}"`:"").filter(Boolean).join(" "))}(t),o="font:9pt Calibri,Carlito,Arial,sans-serif;color:#555";return`${n?`@${e}-left{content:${n};${o}}`:""}${r?`@${e}-right{content:${r};${o}}`:""}`}var _t=["#000000","#404040","#7f7f7f","#c00000","#ff0000","#ffc000","#00b050","#0070c0","#002060","#7030a0"],en=["#ffff00","#00ff00","#00ffff","#ff00ff","#ff0000","#c0c0c0"],tn=["#d9e2f3","#e2efd9","#fff2cc","#fbe4d5","#ededed","#bfbfbf"];function nn({value:e,headerEditable:r,footerEditable:o,onApply:a,onClose:s}){const i=A().documents,[c,d]=L(e.page),[u,p]=L(e.header),[m,f]=L(e.footer),h=c.width>c.height,g=ce(c),b=function(e){for(const[t,n]of Object.entries(ie))if(n.top===e.top&&n.right===e.right&&n.bottom===e.bottom&&n.left===e.left)return t;return null}(c),y={a4:"A4",a3:"A3",a5:"A5",letter:i.paperLetter,legal:i.paperLegal},v={normal:i.marginsNormal,narrow:i.marginsNarrow,moderate:i.marginsModerate,wide:i.marginsWide},x={value:"custom",label:i.custom};/* @__PURE__ */
12
+ return z(w,{open:!0,onClose:s,title:i.pageSetup,size:"sm",footer:/* @__PURE__ */R(O,{children:[
13
+ /* @__PURE__ */z(k,{variant:"secondary",onClick:s,children:i.cancel}),
14
+ /* @__PURE__ */z(k,{variant:"primary",onClick:()=>a({page:c,header:u,footer:m}),children:i.ok})]}),children:/* @__PURE__ */R("div",{className:"space-y-3",children:[
15
+ /* @__PURE__ */z(n,{label:i.paperSize,children:/* @__PURE__ */z(t,{value:g??"custom",onChange:e=>{if("custom"===e)return;const t=se[e];d(e=>h?{...e,width:t.height,height:t.width}:{...e,...t})},options:[...g?[]:[x],...Object.keys(se).map(e=>({value:e,label:y[e]}))]})}),
16
+ /* @__PURE__ */z(n,{label:i.orientation,children:/* @__PURE__ */z(t,{value:h?"landscape":"portrait",onChange:e=>{"landscape"===e!==h&&d(e=>({...e,width:e.height,height:e.width}))},options:[{value:"portrait",label:i.portrait},{value:"landscape",label:i.landscape}]})}),
17
+ /* @__PURE__ */z(n,{label:i.margins,children:/* @__PURE__ */z(t,{value:b??"custom",onChange:e=>{"custom"!==e&&d(t=>({...t,...ie[e]}))},options:[...b?[]:[x],...Object.keys(ie).map(e=>({value:e,label:v[e]}))]})}),
18
+ /* @__PURE__ */z(n,{label:i.header,hint:r?i.headerFooterHint:i.headerFooterLocked,children:/* @__PURE__ */z(l,{value:u,disabled:!r,onChange:e=>p(e.target.value)})}),
19
+ /* @__PURE__ */z(n,{label:i.footer,hint:o?void 0:i.headerFooterLocked,children:/* @__PURE__ */z(l,{value:m,disabled:!o,onChange:e=>f(e.target.value)})})]})})}var rn=e=>e.querySelectorAll("ul,ol").forEach(e=>e.removeAttribute("data-ilvl"));function on(e){const t=e.previousElementSibling,n=e.parentElement;if(!t||"LI"!==t.tagName||!n)return!1;const r=t.lastElementChild;let o;var a;return a=r,"UL"===a?.tagName||"OL"===a?.tagName?o=r:(o=e.ownerDocument.createElement(n.tagName),t.appendChild(o)),o.appendChild(e),rn(e),!0}function an(e){const t=e.parentElement,n=t?.parentElement;if(!t||"LI"!==n?.tagName)return!1;const r=[];for(let t=e.nextElementSibling;t;t=t.nextElementSibling)r.push(t);if(r.length){const n=e.ownerDocument.createElement(t.tagName),o=t.getAttribute("data-num-id");o&&n.setAttribute("data-num-id",o),r.forEach(e=>n.appendChild(e)),e.appendChild(n)}return n.parentElement.insertBefore(e,n.nextSibling),rn(e),t.children.length||t.remove(),!0}var sn=e=>Array.from(e.querySelectorAll(":scope > tbody > tr, :scope > tr, :scope > thead > tr, :scope > tfoot > tr")),ln=(e,t)=>Math.max(1,Number(e.getAttribute(t)??1));function cn(e){const t=sn(e),n=t.map(()=>[]);return t.forEach((e,r)=>{let o=0;for(const a of(e=>Array.from(e.children).filter(e=>"TD"===e.tagName||"TH"===e.tagName))(e)){for(;n[r][o];)o++;const e=ln(a,"colspan"),s=ln(a,"rowspan");for(let i=r;i<Math.min(r+s,t.length);i++)for(let t=o;t<o+e;t++)n[i][t]=a;o+=e}}),{table:e,slots:n,cols:Math.max(0,...n.map(e=>e.length))}}function dn(e,t){for(let n=0;n<e.slots.length;n++){const r=e.slots[n].indexOf(t);if(r>=0)return{row:n,col:r}}return null}function un(e){const t=e.createElement("td");return t.innerHTML="<p><br></p>",t}function pn(e,t,n){const r=cn(e),o=dn(r,t);if(!o)return;const a=sn(e),s=ln(t,"rowspan"),i=n?o.row+s:o.row,l=e.ownerDocument.createElement("tr"),c=/* @__PURE__ */new Set;for(let t=0;t<r.cols;t++){const n=i>0?r.slots[i-1]?.[t]:void 0,o=r.slots[i]?.[t];n&&n===o?c.has(n)||(c.add(n),n.setAttribute("rowspan",String(ln(n,"rowspan")+1))):l.appendChild(un(e.ownerDocument))}const d=a[i];d?d.parentNode.insertBefore(l,d):a[a.length-1].parentNode.appendChild(l)}function mn(e,t,n){const r=cn(e),o=dn(r,t);if(!o)return;const a=n?o.col+ln(t,"colspan"):o.col,s=/* @__PURE__ */new Set;r.slots.forEach((t,n)=>{const r=a>0?t[a-1]:void 0,o=t[a];if(r&&r===o)return void(s.has(r)||(s.add(r),r.setAttribute("colspan",String(ln(r,"colspan")+1))));if(o&&o.parentElement!==sn(e)[n])return;const i=sn(e)[n],l=t.slice(a).find(e=>e.parentElement===i);i.insertBefore(un(e.ownerDocument),l??null)}),fn(e,r.cols+1,a,null)}function fn(e,t,n,r){const o=e.querySelector(":scope > colgroup");if(!o)return;const a=Array.from(o.children);if(null!==r&&a[r]?.remove(),null!==n){const t=e.ownerDocument.createElement("col"),r=a[Math.min(n,a.length-1)];r?.getAttribute("style")&&t.setAttribute("style",r.getAttribute("style")),o.insertBefore(t,a[n]??null)}o.children.length!==t&&o.remove()}var hn=["Calibri","Arial","Cambria","Courier New","Georgia","Tahoma","Times New Roman","Verdana"],wn=[8,9,10,10.5,11,12,14,16,18,20,22,24,28,32,36,48,72],gn=[1,1.15,1.5,2,2.5,3],bn=[50,75,90,100,110,125,150,200],yn="p,h1,h2,h3,h4,h5,h6,li,blockquote,pre",vn=/^(https?:|mailto:|tel:)/i,xn={bold:!1,italic:!1,underline:!1,strike:!1,sub:!1,sup:!1,ul:!1,ol:!1,align:"left",font:"",size:null,styleId:null};function kn({sessionKey:e,doc:t,filename:n,images:s,fileEntries:l,title:u,startsDirty:p,onDirty:m,onOpenFile:f,onNewImageUrl:w}){const C=A().documents,U=S(),D=j().replace(/[^a-zA-Z0-9]/g,""),I=T(null),H=T(null),B=T(null),F=T(new Vt),W=T(null),K=T(null),q=T(null),G=T(!!p),V=T(0),Q=T(()=>{}),[J,Y]=L({page:t.page,header:t.header.text,footer:t.footer.text}),[X,Z]=L(xn),[_,ee]=L({undo:!1,redo:!1}),[te,ne]=L({words:0,pageNow:1}),[re,oe]=L([0]),[ae,se]=L(100),[ie,le]=L(!1),[de,ue]=L(!0),[pe,me]=L(!1),[fe,he]=L({rows:0,cols:0}),[we,ge]=L(null),[be,ye]=L(null),[ve,xe]=L(!1),[ke,$e]=L(""),[Ce,Ne]=L(""),[Ae,Se]=L(!1),[Te,Le]=L(0),[Pe,je]=L(0),Me=T([]),Ee=(J.page.width-J.page.left-J.page.right)/20,Re=e=>!!e&&!!H.current?.contains(e),ze=M(()=>{const e=H.current,t=document.getSelection();if(!(e&&t?.anchorNode&&t.focusNode&&Re(t.anchorNode))){const t=W.current;if(!e||!t)return null;const n=Qt(e,t.startContainer,t.startOffset),r=Qt(e,t.endContainer,t.endOffset);return n&&r?{anchor:n,focus:r}:null}const n=Qt(e,t.anchorNode,t.anchorOffset),r=Qt(e,t.focusNode,t.focusOffset);return n&&r?{anchor:n,focus:r}:null},[]),Oe=M(e=>{const t=H.current,n=document.getSelection();if(!t||!n||!e)return;const r=Jt(t,e.anchor),o=Jt(t,e.focus);r&&o&&n.setBaseAndExtent(r.node,r.offset,o.node,o.offset)},[]),Ue=M(e=>{const t=H.current;if(!t)return;const n=document.getSelection(),r=!e&&!!n&&Re(n.anchorNode);if(document.activeElement!==t&&t.focus({preventScroll:!0}),r&&n?.rangeCount)return void(W.current=n.getRangeAt(0).cloneRange());const o=e??W.current;n&&o&&(n.removeAllRanges(),n.addRange(o),W.current=o.cloneRange())},[]),De=M(()=>{const e=H.current,t=W.current;if(!e||!t)return[];const n=Array.from(e.querySelectorAll(yn)).filter(e=>!e.closest("[data-locked]"));var r;return(t.collapsed?[(r=t.startContainer,(1===r.nodeType?r:r.parentElement)?.closest(yn))].filter(Boolean):n.filter(e=>t.intersectsNode(e))).filter(e=>Re(e)&&!e.closest("[data-locked]"))},[]),Ie=M(()=>{cancelAnimationFrame(V.current),V.current=requestAnimationFrame(()=>{const e=H.current;if(!e)return;const t=e.getBoundingClientRect().height/(e.offsetHeight||1)||1,n=e.getBoundingClientRect().top+J.page.top/20*(4/3)*t,r=(J.page.height-J.page.top-J.page.bottom)/20*(4/3),o=[],a=e=>{const r=e.getBoundingClientRect();o.push({top:(r.top-n)/t,height:r.height/t,breakBefore:e.hasAttribute("data-break-before")})};for(const r of Array.from(e.children))"TABLE"===r.tagName?r.querySelectorAll("tr").forEach(a):"UL"===r.tagName||"OL"===r.tagName?r.querySelectorAll("li").forEach(a):a(r),r.querySelectorAll("[data-page-break]").forEach(e=>{const r=e.getBoundingClientRect();o.push({top:(r.bottom-n)/t,height:0,breakBefore:!0})});const s=function(e,t){const n=[0];if(t<=0)return n;let r=0;for(const o of e)if(o.breakBefore&&o.top>r&&(r=o.top,n.push(r)),!(o.top+o.height-r<=t))if(o.height<=t)o.top>r&&(r=o.top,n.push(r));else for(;o.top+o.height-r>t;)r+=t,n.push(r);return n}(o,r);oe(e=>e.length===s.length&&e.every((e,t)=>e===s[t])?e:s);const i=document.getSelection();let l=1;if(i?.rangeCount&&Re(i.anchorNode)){const e=i.getRangeAt(0).getClientRects()[0]??i.anchorNode?.getBoundingClientRect?.();if(e){const r=(e.top-n)/t;for(let e=0;e<s.length;e++)s[e]<=r+1&&(l=e+1)}}var c;ne({words:(c=nt(e),(c.match(/[぀-ヿ㐀-鿿豈-﫿]/g)?.length??0)+(c.replace(/[぀-ヿ㐀-鿿豈-﫿]/g," ").match(/\S+/g)?.length??0)),pageNow:l})})},[J.page]),He=M(()=>{const e=document.getSelection();if(!e?.anchorNode||!Re(e.anchorNode))return;const t=1===e.anchorNode.nodeType?e.anchorNode:e.anchorNode.parentElement;if(!t)return;const n=getComputedStyle(t),r=t.closest(yn),o=e=>{try{return document.queryCommandState(e)}catch{return!1}},a=n.textAlign,s=.75*parseFloat(n.fontSize);Z({bold:o("bold"),italic:o("italic"),underline:o("underline"),strike:o("strikeThrough"),sub:o("subscript"),sup:o("superscript"),ul:o("insertUnorderedList"),ol:o("insertOrderedList"),align:"center"===a||"right"===a||"justify"===a?a:"left",font:n.fontFamily.split(",")[0].replace(/["']/g,"").trim(),size:s?Math.round(2*s)/2:null,styleId:r?.getAttribute("data-pstyle")??null})},[]),Be=M(()=>{G.current=!0,m(!0),Ie(),ee({undo:F.current.canUndo,redo:F.current.canRedo})},[Ie,m]),Fe=M(()=>({html:H.current?.innerHTML??"",caret:ze()}),[ze]),We=()=>{K.current&&clearTimeout(K.current),K.current=null},Ke=M(e=>{e&&H.current&&(H.current.innerHTML=e.html,H.current.focus({preventScroll:!0}),Oe(e.caret),We(),Be(),He())},[Oe,Be,He]),qe=M(()=>Ke(F.current.undo(Fe())),[Ke,Fe]),Ge=M(()=>Ke(F.current.redo(Fe())),[Ke,Fe]),Ve=M(e=>{Ue(),We(),F.current.record(Fe()),e(),Be(),He()},[Be,He,Ue,Fe]),Qe=M((e,t)=>Ve(()=>{document.execCommand(e,!1,t)}),[Ve]),Je=e=>Ve(()=>{document.execCommand(e);const t=H.current;if(!t)return;const n=document.getSelection(),r=n?.anchorNode??null,o=n?.anchorOffset??0;let a=!1;t.querySelectorAll("p > ul, p > ol").forEach(e=>{const t=e.parentElement;Array.from(t.childNodes).some(t=>t!==e&&(1===t.nodeType||(t.nodeValue??"").trim()))||(t.replaceWith(e),a=!0)}),a&&r&&n?.collapse(r,o)});P(()=>{const e=H.current;if(!e)return;e.innerHTML=t.html;try{document.execCommand("defaultParagraphSeparator",!1,"p"),document.execCommand("styleWithCSS",!1,"true")}catch{}e.focus({preventScroll:!0});const n=e.querySelector(yn);n&&document.getSelection()?.collapse(n,0),Ie();const r=t=>"historyUndo"===t.inputType?(t.preventDefault(),void qe()):"historyRedo"===t.inputType?(t.preventDefault(),void Ge()):(K.current?clearTimeout(K.current):F.current.record({html:e.innerHTML,caret:ze()}),void(K.current=setTimeout(()=>{K.current=null},600))),o=()=>{(()=>{const t=q.current;e.querySelectorAll('font[size="7"]').forEach(e=>{const n=document.createElement("span");for(n.setAttribute("style",`font-size:${t??11}pt`);e.firstChild;)n.appendChild(e.firstChild);e.replaceWith(n),3===n.lastChild?.nodeType&&document.getSelection()?.collapse(n.lastChild,(n.lastChild.nodeValue??"").length)})})(),Be(),He()},a=()=>{const e=document.getSelection();e?.rangeCount&&Re(e.anchorNode)&&(W.current=e.getRangeAt(0).cloneRange(),He(),Ie())};e.addEventListener("beforeinput",r),e.addEventListener("input",o),document.addEventListener("selectionchange",a);const s=new ResizeObserver(()=>Ie());return s.observe(e),()=>{e.removeEventListener("beforeinput",r),e.removeEventListener("input",o),document.removeEventListener("selectionchange",a),s.disconnect(),cancelAnimationFrame(V.current),We()}},[]),P(()=>{Ie()},[Ie]),P(()=>{p&&m(!0)},[]);const Ye=e=>Ve(()=>{const n=ze(),r=e?/^heading ([1-6])$/i.exec(t.styles.find(t=>t.id===e)?.name??"")?.[1]:void 0,o=r?`H${r}`:"P";for(const t of De()){if("LI"===t.tagName){e?t.setAttribute("data-pstyle",e):t.removeAttribute("data-pstyle");continue}let n=t;if(t.tagName!==o){n=document.createElement(o);for(const e of Array.from(t.attributes))n.setAttribute(e.name,e.value);for(;t.firstChild;)n.appendChild(t.firstChild);t.replaceWith(n)}e?n.setAttribute("data-pstyle",e):n.removeAttribute("data-pstyle")}Oe(n)}),Xe=e=>Ve(()=>{const t=De(),n=t.filter(e=>"LI"===e.tagName);if(n.length){const t=document.getSelection(),r=t?.anchorNode??null,o=t?.anchorOffset??0;for(const t of e?n:[...n].reverse())e?on(t):an(t);return void(r&&t?.collapse(r,o))}for(const n of t){const t=parseFloat(n.style.marginLeft)||0,r=Math.max(0,t+(e?36:-36));n.style.marginLeft=r?`${r}pt`:""}}),Ze=e=>Qe({left:"justifyLeft",center:"justifyCenter",right:"justifyRight",justify:"justifyFull"}[e]),_e=async e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new Uint8Array(await t.arrayBuffer()),n=URL.createObjectURL(new Blob([e],{type:t.type}));w(n),s.set(n,{bytes:e,mime:t.type});const r=new Image;r.src=n,await r.decode().catch(()=>{});const o=.75*r.naturalWidth,a=Math.min(o||Ee,Ee),i=o?a*(r.naturalHeight/r.naturalWidth):0;Qe("insertHTML",`<img src="${n}" alt="" style="width:${Math.round(100*a)/100}pt${i?`;height:${Math.round(100*i)/100}pt`:""}">`)}},et=async()=>{Ue();const e=W.current?.cloneRange()??null,t=e?.startContainer?1===e.startContainer.nodeType?e.startContainer:e.startContainer.parentElement:null,n=t?.closest("a")??null,r=await h({title:C.link,message:C.linkPrompt,placeholder:"https://example.com",defaultValue:n?.getAttribute("href")??"",confirmLabel:C.ok,cancelLabel:C.cancel,allowEmpty:!0});if(await new Promise(e=>setTimeout(e,0)),Ue(e),null===r)return;const o=r.trim();if(!o)return void(n&&Qe("unlink"));const a=/^[a-z][a-z0-9+.-]*:/i.test(o)?o:`https://${o}`;if(vn.test(a))if(n)Ve(()=>{n.setAttribute("href",a)});else if(e?.collapsed){const e=document.createElement("a");e.href=a,e.textContent=o,Qe("insertHTML",e.outerHTML)}else Qe("createLink",a);else g.error(C.linkInvalid)},tt=()=>Qe("insertHTML",'<span data-page-break="" contenteditable="false"></span>​'),at=(e,t)=>{me(!1);const n=function(e,t,n,r){const o=e.createElement("table"),a=e.createElement("colgroup");for(let t=0;t<n;t++){const t=e.createElement("col");t.setAttribute("style",`width:${Math.round(r/n*100)/100}pt`),a.appendChild(t)}o.appendChild(a);const s=e.createElement("tbody");for(let r=0;r<t;r++){const t=e.createElement("tr");for(let r=0;r<n;r++)t.appendChild(un(e));s.appendChild(t)}return o.appendChild(s),o}(document,e,t,Ee);n.setAttribute("data-new",""),Qe("insertHTML",`${n.outerHTML}<p><br></p>`);const r=H.current?.querySelector("table[data-new]");if(r){r.removeAttribute("data-new");const e=r.querySelector("td p");e&&document.getSelection()?.collapse(e,0)}};Q.current=e=>{_e(e)};const st=e=>{if(!we)return;const t=we.el;Ve(()=>{const n=.75*t.naturalWidth,r=null===e?n:Ee*e,o=t.naturalWidth?t.naturalHeight/t.naturalWidth:.75;t.removeAttribute("width"),t.removeAttribute("height"),t.style.width=Math.round(100*r)/100+"pt",t.style.height=Math.round(r*o*100)/100+"pt"}),ge(null)},it=M((e,t)=>{const n=Me.current,r=e=>{const t=document.createRange();return t.setStart(e[0].node,e[0].start),t.setEnd(e[e.length-1].node,e[e.length-1].end),t},o=globalThis.CSS?.highlights,a=globalThis.Highlight;o&&a&&(o.set("docs-find",new a(...n.map(r))),o.set("docs-find-current",new a(...n[e]?[r(n[e])]:[]))),t&&n[e]&&n[e][0].node.parentElement?.scrollIntoView({block:"center"})},[]),lt=()=>{const e=globalThis.CSS?.highlights;e?.delete("docs-find"),e?.delete("docs-find-current")},ct=M((e,t,n)=>{const r=H.current,o=r?rt(r,e,t):[];Me.current=o,je(o.length);const a=o.length?Math.min(n,o.length-1):0;Le(a),it(a,!0)},[it]),ut=M(()=>{const e=Me.current[Te];xe(!1),lt();const t=H.current;t?.focus({preventScroll:!0}),e&&document.getSelection()?.setBaseAndExtent(e[0].node,e[0].start,e[e.length-1].node,e[e.length-1].end),Me.current=[]},[Te]),pt=()=>{const e=document.getSelection(),t=e&&Re(e.anchorNode)?e.toString():"";xe(!0);const n=t&&!t.includes("\n")?t:ke;$e(n),setTimeout(()=>ct(n,Ae,0),0)},mt=T(ut);mt.current=ut;const ft=T(ve);ft.current=ve,P(()=>N(()=>!(!ft.current||!I.current?.contains(document.activeElement))&&(mt.current(),!0)),[]),P(()=>()=>lt(),[]),P(()=>{const t=t=>{const{key:n,files:r}=t.detail;n===e&&Q.current(r)};return window.addEventListener("docs-insert-images",t),()=>window.removeEventListener("docs-insert-images",t)},[e]);const ht=`${qt(n)}.docx`,wt=async()=>{const e=H.current;if(e)try{const n=!G.current&&J.page===t.page&&t.source?t.source:await Wt(t,e,{page:J.page,headerText:J.header,footerText:J.footer,images:s});Kt(n,ht,"application/vnd.openxmlformats-officedocument.wordprocessingml.document"),G.current&&(t.source=n,G.current=!1,Y(e=>({...e,page:t.page}))),m(!1)}catch{g.error(C.saveFailed)}},gt=e=>function({title:e,html:t,doc:n,scope:r,page:o,header:s,footer:i}){const l=e=>Math.round(e)/20+"pt",c=`@page{size:${l(o.width)} ${l(o.height)};margin:${l(o.top)} ${l(o.right)} ${l(o.bottom)} ${l(o.left)};${Zt("top",s)}${Zt("bottom",i)}}`;return`<!doctype html><html><head><meta charset="utf-8"><meta name="generator" content="efficient-shell Documents"><title>${a(e)}</title><style>${Xt(n,r)}\n${Yt.replaceAll(".docs-page",`.docs-page[data-doc="${r}"]`)}\n${c}</style></head><body><div class="docs-page" data-doc="${r}">${t}</div></body></html>`}({title:qt(n),html:e,doc:t,scope:D,page:J.page,header:J.header,footer:J.footer}),bt=()=>{const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;width:0;height:0;border:0;left:-10px;top:-10px",document.body.appendChild(e);const t=e.contentWindow;if(!t)return void e.remove();t.document.open(),t.document.write(gt(H.current?.innerHTML??"")),t.document.close();const n=()=>{t.focus(),t.print(),setTimeout(()=>e.remove(),6e4)},r=Array.from(t.document.images).filter(e=>!e.complete);r.length?Promise.all(r.map(e=>e.decode().catch(()=>{}))).then(n):n()},yt=[...l,{type:"divider",key:"d1"},{key:"save",label:/* @__PURE__ */z($n,{label:C.saveDocx,hint:"⌘S"}),onSelect:()=>{wt()}},{type:"submenu",key:"saveAs",label:C.saveAs,items:[{key:"docx",label:C.saveAsWord,onSelect:()=>{wt()}},{key:"pdf",label:C.saveAsPdf,onSelect:bt},{key:"html",label:C.saveAsWeb,onSelect:()=>{(async()=>{const e=document.createElement("div");e.innerHTML=H.current?.innerHTML??"";for(const t of Array.from(e.querySelectorAll("img"))){const e=s.get(t.getAttribute("src")??"");if(!e)continue;let n="";for(let t=0;t<e.bytes.length;t+=32768)n+=String.fromCharCode(...e.bytes.subarray(t,t+32768));t.setAttribute("src",`data:${e.mime};base64,${btoa(n)}`)}e.querySelectorAll("[data-hidden]").forEach(e=>e.remove()),Kt(gt(e.innerHTML),`${qt(n)}.html`,"text/html")})()}},{key:"txt",label:C.saveAsText,onSelect:()=>{Kt(nt(H.current),`${qt(n)}.txt`,"text/plain")}}]},{type:"divider",key:"d2"},{key:"print",label:/* @__PURE__ */z($n,{label:C.print,hint:"⌘P"}),onSelect:bt}],vt=[{key:"table",label:C.table,onSelect:()=>me(!0)},{key:"image",label:C.image,onSelect:()=>B.current?.click()},{key:"link",label:/* @__PURE__ */z($n,{label:C.link,hint:"⌘K"}),onSelect:()=>{et()}},{key:"break",label:/* @__PURE__ */z($n,{label:C.pageBreak,hint:"⌘↵"}),onSelect:tt},{key:"number",label:C.pageNumber,onSelect:()=>le(!0)},{key:"line",label:C.horizontalLine,onSelect:()=>Qe("insertHorizontalRule")}],xt=[{key:"setup",label:C.pageSetup,onSelect:()=>le(!0)}],kt={Title:C.styleTitle,"heading 1":C.styleHeading1,"heading 2":C.styleHeading2,"heading 3":C.styleHeading3,Quote:C.styleQuote},$t=[{key:"normal",label:C.styleNormal,onSelect:()=>Ye(null)},...t.styles.map(e=>({key:e.id,label:kt[e.name]??e.name,onSelect:()=>Ye(e.id)}))],Ct=E(()=>Array.from(/* @__PURE__ */new Set([...t.defaultFont?[t.defaultFont]:[],...hn])),[t.defaultFont]).map(e=>({key:e,label:/* @__PURE__ */z("span",{style:{fontFamily:`"${e}"`},children:e}),onSelect:()=>Qe("fontName",e)})),Nt=wn.map(e=>({key:String(e),label:String(e),onSelect:()=>(e=>Ve(()=>{q.current=e,document.execCommand("styleWithCSS",!1,"false"),document.execCommand("fontSize",!1,"7"),document.execCommand("styleWithCSS",!1,"true");const t=H.current,n=[];if(t.querySelectorAll('font[size="7"]').forEach(t=>{const r=document.createElement("span");for(r.setAttribute("style",`font-size:${e}pt`);t.firstChild;)r.appendChild(t.firstChild);t.replaceWith(r),n.push(r)}),n.length){const e=document.getSelection();e?.setBaseAndExtent(n[0],0,n[n.length-1],n[n.length-1].childNodes.length)}}))(e)})),At=gn.map(e=>({key:String(e),label:e.toFixed(1.15===e?2:1),onSelect:()=>{return t=e,Ve(()=>{for(const e of De())e.style.lineHeight=String(t)});var t}})),St=e=>e.preventDefault(),Tt="rounded px-2 py-0.5 text-xs text-ink-muted hover:bg-line-subtle hover:text-ink",Lt="inline-flex h-7 items-center gap-1 rounded px-2 text-xs text-ink-muted hover:bg-line-subtle hover:text-ink",Pt=/* @__PURE__ */z("div",{className:"mx-1 h-4 w-px bg-line"}),jt=(e,t,n,r={})=>/* @__PURE__ */z(d,{"aria-label":e,title:e,size:"sm",variant:"ghost",onMouseDown:St,onClick:n,disabled:r.disabled,...void 0!==r.pressed?{"aria-pressed":r.pressed}:{},children:t}),Mt=(e,t,n,r="")=>/* @__PURE__ */z(c,{"aria-label":e,align:"start",items:n,triggerClassName:Lt,trigger:/* @__PURE__ */R("span",{title:e,className:`flex items-center justify-between gap-1 ${r}`,children:[
20
+ /* @__PURE__ */z("span",{className:"truncate",children:t}),
21
+ /* @__PURE__ */z($,{name:"chevron-down",size:12})]})}),Et=(e,t,n,a,s)=>/* @__PURE__ */z(o,{triggerLabel:e,align:"start",triggerClassName:"inline-flex h-7 w-7 flex-col items-center justify-center rounded text-ink-muted hover:bg-line-subtle hover:text-ink",trigger:/* @__PURE__ */R(O,{children:[t,
22
+ /* @__PURE__ */z("span",{className:"h-0.5 w-4 rounded-sm",style:{background:n}})]}),children:({close:t})=>/* @__PURE__ */z(r,{label:e,value:"",presets:a,clearable:!0,dragWrites:"end",onChange:e=>{"hiliteColor"===s?Qe("hiliteColor",e||"transparent"):Qe("foreColor",e||_t[0]),zt(t=>({...t,[s]:e||("hiliteColor"===s?"var(--line)":"var(--ink)")})),t()}})}),[Rt,zt]=L({foreColor:"var(--ink)",hiliteColor:"var(--line)"}),Ot=ce(J.page),Ut=Ot?{a4:"A4",a3:"A3",a5:"A5",letter:C.paperLetter,legal:C.paperLegal}[Ot]:C.custom,Dt=E(()=>{if(!t.lang)return"";try{return new Intl.DisplayNames(U?[U]:void 0,{type:"language"}).of(t.lang)??t.lang}catch{return t.lang}},[t.lang,U]),It=J.page.width/20,Ht=J.page.top/20,Bt=J.header.split(/\s*\|\s*/),Ft=J.footer.split(/\s*\|\s*/),rn=(e,t)=>e.replace(/\{page\}/g,String(t)).replace(/\{pages\}/g,String(re.length)),kn=t.notices,Cn=[kn.comments&&C.noticeComments(kn.comments),kn.tracked&&C.noticeTracked(kn.tracked),kn.objects&&C.noticeObjects(kn.objects),kn.footnotes&&C.noticeFootnotes(kn.footnotes)].filter(Boolean);/* @__PURE__ */
23
+ return R("div",{ref:I,className:"flex h-full min-h-0 flex-col",onKeyDown:e=>{const t=e.metaKey||e.ctrlKey,n=e.key.toLowerCase(),r=Re(e.target),o=()=>{e.preventDefault(),e.stopPropagation()};if(t&&!e.altKey){if("s"===n)return o(),void wt();if("o"===n)return o(),void f();if("p"===n)return o(),void bt();if("f"===n)return o(),void pt();if("k"===n)return o(),void et();if(r){if("z"===n&&!e.shiftKey)return o(),void qe();if("z"===n&&e.shiftKey||"y"===n)return o(),void Ge();if("b"===n)return o(),void Qe("bold");if("i"===n)return o(),void Qe("italic");if("u"===n)return o(),void Qe("underline");if("Enter"===e.key)return o(),void tt()}}if(r&&"Tab"===e.key&&!t&&!e.altKey){const t=document.getSelection(),n=t?.anchorNode?1===t.anchorNode.nodeType?t.anchorNode:t.anchorNode.parentElement:null,r=n?.closest("td,th");if(r)return o(),void((e,t)=>{const n=Array.from(e.closest("table").querySelectorAll("td,th")),r=n[n.indexOf(e)+(t?1:-1)];if(r){const e=document.createRange();e.selectNodeContents(r);const t=document.getSelection();t?.removeAllRanges(),t?.addRange(e)}else t&&Ve(()=>pn(e.closest("table"),e,!0))})(r,!e.shiftKey);if(n?.closest("li"))return o(),void Xe(!e.shiftKey);if(!e.shiftKey)return o(),void Qe("insertText","\t")}},children:[
24
+ /* @__PURE__ */z("style",{children:Xt(t,D)}),
25
+ /* @__PURE__ */z("input",{ref:B,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&_e(Array.from(e.target.files)),e.target.value=""}}),
26
+ /* @__PURE__ */R("div",{className:"flex shrink-0 flex-wrap items-center gap-0.5 border-b border-line bg-surface-sunken px-2 py-1",children:[u,
27
+ /* @__PURE__ */z(c,{trigger:C.menuFile,items:yt,align:"start",triggerClassName:Tt}),
28
+ /* @__PURE__ */z(c,{trigger:C.menuInsert,items:vt,align:"start",triggerClassName:Tt}),
29
+ /* @__PURE__ */z(o,{open:pe,onOpenChange:me,align:"start",triggerLabel:C.table,triggerClassName:"h-5 w-0 overflow-hidden",trigger:/* @__PURE__ */z("span",{}),children:/* @__PURE__ */R("div",{className:"p-1",children:[
30
+ /* @__PURE__ */z("div",{className:"mb-1 text-xs text-ink-muted",children:fe.rows?C.tableSize(fe.cols,fe.rows):C.table}),
31
+ /* @__PURE__ */z("div",{className:"grid gap-0.5",style:{gridTemplateColumns:"repeat(8, 1fr)"},onMouseLeave:()=>he({rows:0,cols:0}),children:Array.from({length:48},(e,t)=>{const n=Math.floor(t/8)+1,r=t%8+1,o=n<=fe.rows&&r<=fe.cols;/* @__PURE__ */
32
+ return z("button",{type:"button","aria-label":C.tableSize(r,n),onMouseEnter:()=>he({rows:n,cols:r}),onFocus:()=>he({rows:n,cols:r}),onClick:()=>at(n,r),className:"h-4 w-4 rounded-sm border "+(o?"border-accent-fill bg-accent-tint-strong":"border-line bg-surface")},t)})})]})}),
33
+ /* @__PURE__ */z(c,{trigger:C.menuLayout,items:xt,align:"start",triggerClassName:Tt}),Pt,jt(C.save,/* @__PURE__ */z($,{name:"download",size:16}),()=>{wt()}),jt(C.print,/* @__PURE__ */z($,{name:"print",size:16}),bt),jt(C.undo,/* @__PURE__ */z($,{name:"undo",size:16}),qe,{disabled:!_.undo}),jt(C.redo,/* @__PURE__ */z($,{name:"redo",size:16}),Ge,{disabled:!_.redo}),jt(C.find,/* @__PURE__ */z($,{name:"search",size:16}),()=>ve?ut():pt(),{pressed:ve})]}),
34
+ /* @__PURE__ */R("div",{className:"flex shrink-0 flex-wrap items-center gap-0.5 border-b border-line bg-surface-sunken px-2 py-1",children:[Mt(C.paragraphStyle,(e=>{if(!e)return C.styleNormal;const n=t.styles.find(t=>t.id===e);return n?kt[n.name]??n.name:e})(X.styleId),$t,"w-20"),Mt(C.font,X.font||t.defaultFont||"Calibri",Ct,"w-20"),Mt(C.fontSize,X.size??t.defaultSize??11,Nt),Pt,jt(C.bold,/* @__PURE__ */z($,{name:"bold",size:16}),()=>Qe("bold"),{pressed:X.bold}),jt(C.italic,/* @__PURE__ */z($,{name:"italic",size:16}),()=>Qe("italic"),{pressed:X.italic}),jt(C.underline,/* @__PURE__ */z($,{name:"underline",size:16}),()=>Qe("underline"),{pressed:X.underline}),jt(C.strikethrough,/* @__PURE__ */z($,{name:"strike",size:16}),()=>Qe("strikeThrough"),{pressed:X.strike}),jt(C.superscript,/* @__PURE__ */z($,{name:"superscript",size:16}),()=>Qe("superscript"),{pressed:X.sup}),jt(C.subscript,/* @__PURE__ */z($,{name:"subscript",size:16}),()=>Qe("subscript"),{pressed:X.sub}),Et(C.textColor,/* @__PURE__ */z($,{name:"text-color",size:14}),Rt.foreColor,_t,"foreColor"),Et(C.highlight,/* @__PURE__ */z($,{name:"palette",size:14}),Rt.hiliteColor,en,"hiliteColor"),jt(C.clearFormatting,/* @__PURE__ */z($,{name:"clear-marks",size:16}),()=>Ve(()=>{document.execCommand("removeFormat");for(const e of De())e.style.removeProperty("text-align"),e.style.removeProperty("line-height"),e.style.removeProperty("margin-left")})),Pt,jt(C.bulletedList,/* @__PURE__ */z($,{name:"list",size:16}),()=>Je("insertUnorderedList"),{pressed:X.ul}),jt(C.numberedList,/* @__PURE__ */z($,{name:"numbered-list",size:16}),()=>Je("insertOrderedList"),{pressed:X.ol}),jt(C.decreaseIndent,/* @__PURE__ */z($,{name:"chevron-double-left",size:16}),()=>Xe(!1)),jt(C.increaseIndent,/* @__PURE__ */z($,{name:"chevron-double-right",size:16}),()=>Xe(!0)),Pt,jt(C.alignLeft,/* @__PURE__ */z($,{name:"align-left",size:16}),()=>Ze("left"),{pressed:"left"===X.align}),jt(C.alignCenter,/* @__PURE__ */z($,{name:"align-center",size:16}),()=>Ze("center"),{pressed:"center"===X.align}),jt(C.alignRight,/* @__PURE__ */z($,{name:"align-right",size:16}),()=>Ze("right"),{pressed:"right"===X.align}),jt(C.justify,/* @__PURE__ */z($,{name:"align-justify",size:16}),()=>Ze("justify"),{pressed:"justify"===X.align}),
35
+ /* @__PURE__ */z(c,{"aria-label":C.lineSpacing,align:"start",items:At,triggerClassName:Lt,trigger:/* @__PURE__ */R("span",{title:C.lineSpacing,className:"flex items-center gap-0.5",children:[
36
+ /* @__PURE__ */z($,{name:"line-spacing",size:16}),
37
+ /* @__PURE__ */z($,{name:"chevron-down",size:12})]})})]}),de&&Cn.length>0&&/* @__PURE__ */R("div",{role:"status",className:"flex shrink-0 items-center gap-2 border-b border-status-warning-line bg-status-warning-soft px-3 py-1 text-xs text-status-warning-soft-ink",children:[
38
+ /* @__PURE__ */z($,{name:"info",size:14}),
39
+ /* @__PURE__ */z("span",{className:"min-w-0 flex-1",children:C.noticeLead(Cn)}),
40
+ /* @__PURE__ */z(d,{size:"sm",variant:"ghost",ink:"inherit","aria-label":C.dismiss,title:C.dismiss,onClick:()=>ue(!1),children:/* @__PURE__ */z($,{name:"close",size:14})})]}),ve&&/* @__PURE__ */z(Gt,{query:ke,replacement:Ce,matchCase:Ae,current:Te,total:Pe,onQuery:e=>{$e(e),ct(e,Ae,0)},onReplacement:Ne,onMatchCase:e=>{Se(e),ct(ke,e,0)},onStep:e=>{const t=Me.current.length;if(!t)return;const n=(Te+(e?1:-1)+t)%t;Le(n),it(n,!0)},onReplace:()=>{const e=Me.current[Te];e&&(F.current.record(Fe()),ot(e,Ce),Be(),ct(ke,Ae,Te))},onReplaceAll:()=>{const e=Me.current;if(e.length){F.current.record(Fe());for(let t=e.length-1;t>=0;t--)ot(e[t],Ce);Be(),g.success(C.replacedCount(e.length)),ct(ke,Ae,0)}},onClose:ut}),
41
+ /* @__PURE__ */z("div",{className:"min-h-0 flex-1 overflow-auto bg-surface-sunken px-6 py-6",children:/* @__PURE__ */R("div",{className:"docs-sheet relative mx-auto shadow",style:{width:`${It}pt`,zoom:ae/100,minHeight:J.page.height/20+"pt"},children:[J.header&&/* @__PURE__ */R("div",{className:"pointer-events-none absolute flex justify-between gap-4 text-xs","aria-hidden":"true",style:{top:J.page.header/20+"pt",left:J.page.left/20+"pt",right:J.page.right/20+"pt"},children:[
42
+ /* @__PURE__ */z("span",{children:rn(Bt[0],1)}),void 0!==Bt[1]&&/* @__PURE__ */z("span",{children:rn(Bt[1],1)})]}),
43
+ /* @__PURE__ */z("div",{ref:H,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!0,lang:t.lang,role:"textbox","aria-multiline":"true","aria-label":n,"data-doc":D,onPaste:e=>{(async e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e),n=e.clipboardData?.getData("text/html");if(n){e.preventDefault();const t=document.createElement("div");t.innerHTML=dt(n);for(const e of Array.from(t.querySelectorAll("img"))){const t=e.getAttribute("src")??"";if(t.startsWith("blob:")&&!s.has(t))try{const e=await(await fetch(t)).blob();s.set(t,{bytes:new Uint8Array(await e.arrayBuffer()),mime:e.type})}catch{e.remove()}}return void Qe("insertHTML",t.innerHTML)}t.length&&(e.preventDefault(),_e(t))})(e)},onClick:e=>{const t=e.target;if("IMG"===t.tagName&&null===t.closest('[contenteditable="false"]')&&!t.getAttribute("contenteditable"))return e.preventDefault(),void ge({x:e.clientX,y:e.clientY,el:t});const n=t.closest("a");if(n&&(e.metaKey||e.ctrlKey)){const e=n.getAttribute("href")??"";vn.test(e)&&window.open(e,"_blank","noopener,noreferrer")}},onContextMenu:e=>{const t=e.target.closest?.("td,th");t&&!e.shiftKey&&!t.closest("[data-locked]")&&Re(t)&&(e.preventDefault(),ye({x:e.clientX,y:e.clientY,cell:t}))},className:"docs-page",style:{paddingTop:`${Ht}pt`,paddingRight:J.page.right/20+"pt",paddingBottom:J.page.bottom/20+"pt",paddingLeft:J.page.left/20+"pt",minHeight:J.page.height/20+"pt",boxSizing:"border-box"}}),re.slice(1).map((e,t)=>/* @__PURE__ */z("div",{className:"docs-sheet-line pointer-events-none absolute left-0 right-0 border-t border-dashed","aria-hidden":"true",style:{top:`calc(${Ht}pt + ${e}px)`},children:/* @__PURE__ */z("span",{className:"docs-sheet absolute right-1 -top-2 px-1 text-2xs",children:C.pageLabel(t+2)})},e)),J.footer&&/* @__PURE__ */R("div",{className:"pointer-events-none absolute flex justify-between gap-4 text-xs","aria-hidden":"true",style:{bottom:J.page.footer/20+"pt",left:J.page.left/20+"pt",right:J.page.right/20+"pt"},children:[
44
+ /* @__PURE__ */z("span",{children:rn(Ft[0],re.length)}),void 0!==Ft[1]&&/* @__PURE__ */z("span",{children:rn(Ft[1],re.length)})]})]})}),
45
+ /* @__PURE__ */R("div",{className:"flex shrink-0 items-center gap-2 border-t border-line bg-surface-sunken px-3 py-1 text-xs text-ink-muted",children:[
46
+ /* @__PURE__ */z("span",{children:C.pageOf(Math.min(te.pageNow,re.length),re.length)}),
47
+ /* @__PURE__ */z("span",{children:C.wordCount(te.words)}),
48
+ /* @__PURE__ */z("span",{children:Ut}),Dt&&/* @__PURE__ */z("span",{children:Dt}),
49
+ /* @__PURE__ */R("span",{className:"ml-auto flex items-center gap-1",children:[
50
+ /* @__PURE__ */z(k,{size:"sm",variant:"ghost","aria-label":C.zoomOut,onClick:()=>se(e=>[...bn].reverse().find(t=>t<e)??e),children:"−"}),
51
+ /* @__PURE__ */R("span",{className:"w-9 text-center tabular-nums",children:[ae,"%"]}),
52
+ /* @__PURE__ */z(k,{size:"sm",variant:"ghost","aria-label":C.zoomIn,onClick:()=>se(e=>bn.find(t=>t>e)??e),children:"+"})]})]}),ie&&/* @__PURE__ */z(nn,{value:J,headerEditable:t.header.editable,footerEditable:t.footer.editable,onClose:()=>le(!1),onApply:e=>{Y(e),le(!1),Be()}}),we&&/* @__PURE__ */R(b,{minWidth:150,portal:!0,style:{position:"fixed",left:we.x,top:we.y},onClose:()=>ge(null),children:[
53
+ /* @__PURE__ */z(y,{children:C.imageWidth}),
54
+ /* @__PURE__ */z(v,{onClick:()=>st(.25),children:"25%"}),
55
+ /* @__PURE__ */z(v,{onClick:()=>st(.5),children:"50%"}),
56
+ /* @__PURE__ */z(v,{onClick:()=>st(.75),children:"75%"}),
57
+ /* @__PURE__ */z(v,{onClick:()=>st(1),children:"100%"}),
58
+ /* @__PURE__ */z(v,{onClick:()=>st(null),children:C.imageOriginalSize}),
59
+ /* @__PURE__ */z(x,{}),
60
+ /* @__PURE__ */z(v,{danger:!0,onClick:()=>{if(!we)return;const e=we.el;Ve(()=>{e.remove()}),ge(null)},children:C.imageRemove})]}),be&&/* @__PURE__ */z(i,{at:{x:be.x,y:be.y},owner:be.cell,onClose:()=>ye(null),items:(e=>{const t=e.closest("table"),n=(e,t,n,r={})=>({key:e,label:t,onSelect:()=>Ve(n),...r}),r=(e=>{const t=W.current;return t?Array.from(e.querySelectorAll("td,th")).filter(n=>n.closest("table")===e&&t.intersectsNode(n)):[]})(t);return[n("above",C.rowAbove,()=>pn(t,e,!1)),n("below",C.rowBelow,()=>pn(t,e,!0)),n("left",C.columnLeft,()=>mn(t,e,!1)),n("right",C.columnRight,()=>mn(t,e,!0)),{type:"divider",key:"d1"},n("merge",C.mergeCells,()=>{(function(e,t){if(t.length<2)return!1;const n=cn(e);let r=1/0,o=1/0,a=-1,s=-1;for(const e of t){const t=dn(n,e);if(!t)return!1;r=Math.min(r,t.row),o=Math.min(o,t.col),a=Math.max(a,t.row+ln(e,"rowspan")-1),s=Math.max(s,t.col+ln(e,"colspan")-1)}const i=/* @__PURE__ */new Set;for(let e=r;e<=a;e++)for(let t=o;t<=s;t++){const r=n.slots[e]?.[t];r&&i.add(r)}for(const e of i){const t=dn(n,e);if(t.row<r||t.col<o||t.row+ln(e,"rowspan")-1>a||t.col+ln(e,"colspan")-1>s)return!1}const l=n.slots[r][o];for(const e of i)if(e!==l){if((e.textContent??"").trim())for(;e.firstChild;)l.appendChild(e.firstChild);e.remove()}return l.setAttribute("colspan",String(s-o+1)),l.setAttribute("rowspan",String(a-r+1)),s===o&&l.removeAttribute("colspan"),a===r&&l.removeAttribute("rowspan"),!0})(t,r)||g.error(C.mergeFailed)},{disabled:r.length<2}),{type:"submenu",key:"shade",label:C.cellShading,items:[...tn.map(t=>({key:t,label:/* @__PURE__ */R("span",{className:"flex items-center gap-2",children:[
61
+ /* @__PURE__ */z("span",{className:"h-3 w-5 rounded-sm border border-line",style:{background:t}}),t.toUpperCase()]}),onSelect:()=>Ve(()=>{for(const n of r.length?r:[e])n.style.backgroundColor=t})})),{key:"none",label:C.noColor,onSelect:()=>Ve(()=>{for(const t of r.length?r:[e])t.style.removeProperty("background-color")})}]},{type:"divider",key:"d2"},n("delRow",C.deleteRow,()=>{!function(e,t){const n=cn(e),r=dn(n,t);if(!r)return!1;const o=sn(e);if(1===o.length)return e.remove(),!1;const a=/* @__PURE__ */new Set;for(let e=0;e<n.cols;e++){const t=n.slots[r.row][e];if(!t||a.has(t))continue;a.add(t);const s=ln(t,"rowspan");if(1!==s)if(t.parentElement===o[r.row]){const a=o[r.row+1],i=n.slots[r.row+1].slice(e+ln(t,"colspan")).find(e=>e.parentElement===a);t.setAttribute("rowspan",String(s-1)),a.insertBefore(t,i??null)}else t.setAttribute("rowspan",String(s-1))}o[r.row].remove()}(t,e)}),n("delCol",C.deleteColumn,()=>{!function(e,t){const n=cn(e),r=dn(n,t);if(!r)return!1;if(1===n.cols)return e.remove(),!1;const o=/* @__PURE__ */new Set;for(const e of n.slots){const t=e[r.col];if(!t||o.has(t))continue;o.add(t);const n=ln(t,"colspan");n>1?t.setAttribute("colspan",String(n-1)):t.remove()}fn(e,n.cols-1,null,r.col)}(t,e)}),n("delTable",C.deleteTable,()=>{t.remove()},{danger:!0})]})(be.cell)})]})}function $n({label:e,hint:t}){/* @__PURE__ */
62
+ return R("span",{className:"flex w-full items-center justify-between gap-4",children:[
63
+ /* @__PURE__ */z("span",{children:e}),
64
+ /* @__PURE__ */z("span",{className:"text-2xs text-ink-faint",children:t})]})}var Cn={LF:"\n",CRLF:"\r\n",CR:"\r"};function Nn(e,t){let n=1,r=-1;for(let o=e.indexOf("\n");o>=0&&o<t;o=e.indexOf("\n",o+1))n++,r=o;return{line:n,col:t-r}}function An(e){let t=1;for(let n=e.indexOf("\n");n>=0;n=e.indexOf("\n",n+1))t++;return t}function Sn({filename:e,decoded:t,bytes:n,fileEntries:r,title:o,onDirty:a,onOpenFile:s}){const i=A().documents,l=T(null),u=T(null),p=T(t.text),m=T(!1),[f,h]=L(!0),[w,b]=L({line:1,col:1,lines:An(t.text)}),[y,v]=L(!1),[x,k]=L(""),[C,S]=L(""),[j,M]=L(!1),[E,O]=L(0),[U,D]=L([]),I=()=>u.current?.value??"",H=T(null),[B,F]=L(0),W=()=>{H.current&&u.current&&(H.current.scrollTop=u.current.scrollTop,H.current.scrollLeft=u.current.scrollLeft)};P(()=>{const e=H.current?.querySelector("[data-current]"),t=u.current;if(!e||!t)return;const n=e.offsetTop-t.clientHeight/3;(e.offsetTop<t.scrollTop||e.offsetTop>t.scrollTop+t.clientHeight-42)&&(t.scrollTop=Math.max(0,n)),f||(t.scrollLeft=Math.max(0,e.offsetLeft-t.clientWidth/2)),W()},[B,E,U,f]);const K=()=>{const e=u.current;e&&b({...Nn(e.value,e.selectionStart),lines:An(e.value)})},q=(e=x,t=j)=>{const n=function(e,t,n){if(!t)return[];const r=n?e:e.toLowerCase(),o=n?t:t.toLowerCase(),a=r.length===e.length?r:e,s=[];for(let e=a.indexOf(o);e>=0;e=a.indexOf(o,e+Math.max(o.length,1)))s.push(e);return s}(I(),e,t);return D(n),n},G=(e,t,n=x)=>{const r=u.current;if(!r||!e.length)return;const o=(t%e.length+e.length)%e.length;O(o),r.setSelectionRange(e[o],e[o]+n.length),F(e=>e+1)},V=()=>{Kt(m.current?function(e,t,n){const r=e.replace(/\n/g,Cn[n]);if("utf-16le"===t||"utf-16be"===t){const e=new Uint8Array(2+2*r.length),n=new DataView(e.buffer),o="utf-16le"===t;n.setUint16(0,65279,o);for(let e=0;e<r.length;e++)n.setUint16(2+2*e,r.charCodeAt(e),o);return e}const o=(new TextEncoder).encode(r);if("utf-8-bom"!==t)return o;const a=new Uint8Array(o.length+3);return a.set([239,187,191]),a.set(o,3),a}(I(),t.encoding,t.eol):n,e,"text/plain"),m.current&&"windows-1252"===t.encoding&&g.info(i.savedAsUtf8),p.current=I(),a(!1)},Q=()=>{m.current=!0,a(I()!==p.current),K(),y&&q()},J=e=>{document.execCommand("insertText",!1,e)||u.current?.setRangeText(e,u.current.selectionStart,u.current.selectionEnd,"end"),Q()},Y=()=>{v(!1),u.current?.focus()};P(()=>{u.current?.focus(),u.current?.setSelectionRange(0,0)},[]);const X=T(y);X.current=y,P(()=>N(()=>!(!X.current||!l.current?.contains(document.activeElement))&&(Y(),!0)),[]);const Z=[...r,{type:"divider",key:"d1"},{key:"save",label:i.saveKeepType,onSelect:V}];/* @__PURE__ */
65
+ return R("div",{ref:l,className:"flex h-full flex-col",onKeyDown:e=>{const t=e.metaKey||e.ctrlKey,n=e.key.toLowerCase();if(t&&"s"===n)e.preventDefault(),V();else if(t&&"o"===n)e.preventDefault(),s();else if(t&&"f"===n){e.preventDefault(),v(!0);const t=u.current,n=t?t.value.slice(t.selectionStart,t.selectionEnd):"";n&&!n.includes("\n")&&(k(n),q(n))}else"Tab"!==e.key||t||e.shiftKey||e.target!==u.current||(e.preventDefault(),J("\t"))},children:[
66
+ /* @__PURE__ */R("div",{className:"flex shrink-0 flex-wrap items-center gap-0.5 border-b border-line bg-surface-sunken px-2 py-1",children:[o,
67
+ /* @__PURE__ */z(c,{trigger:i.menuFile,items:Z,align:"start",triggerClassName:"rounded px-2 py-0.5 text-xs text-ink-muted hover:bg-line-subtle hover:text-ink"}),
68
+ /* @__PURE__ */z("div",{className:"mx-1 h-4 w-px bg-line"}),
69
+ /* @__PURE__ */z(d,{size:"sm",variant:"ghost","aria-label":i.save,title:i.save,onClick:V,children:/* @__PURE__ */z($,{name:"download",size:16})}),
70
+ /* @__PURE__ */z(d,{size:"sm",variant:"ghost","aria-label":i.find,title:i.find,"aria-pressed":y,onClick:()=>v(e=>!e),children:/* @__PURE__ */z($,{name:"search",size:16})}),
71
+ /* @__PURE__ */z(d,{size:"sm",variant:"ghost","aria-label":i.wrapLines,title:i.wrapLines,"aria-pressed":f,onClick:()=>h(e=>!e),children:/* @__PURE__ */z($,{name:"wrap",size:16})})]}),y&&/* @__PURE__ */z(Gt,{query:x,replacement:C,matchCase:j,current:E,total:U.length,onQuery:e=>{k(e);const t=q(e);O(0),G(t,0,e)},onReplacement:S,onMatchCase:e=>{M(e);const t=q(x,e);O(0),G(t,0)},onStep:e=>G(U,E+(e?1:-1)),onReplace:()=>{const e=u.current;if(!e||!U.length)return;e.focus(),e.setSelectionRange(U[E],U[E]+x.length),J(C);const t=q();G(t,E)},onReplaceAll:()=>{const e=u.current;if(!e||!U.length)return;const t=U.length;e.focus();for(let t=U.length-1;t>=0;t--)e.setSelectionRange(U[t],U[t]+x.length),J(C);q(),O(0),g.success(i.replacedCount(t))},onClose:Y}),
72
+ /* @__PURE__ */R("div",{className:"relative min-h-0 flex-1 bg-surface",children:[y&&x&&U.length>0&&U.length<=2e3&&/* @__PURE__ */z("div",{ref:H,"aria-hidden":"true",style:{lineHeight:"21px",scrollbarGutter:"stable"},className:"pointer-events-none absolute inset-0 overflow-hidden p-4 font-mono text-sm text-transparent "+(f?"whitespace-pre-wrap break-words":"whitespace-pre"),children:(()=>{const e=I(),t=[];let n=0;return U.forEach((r,o)=>{t.push(e.slice(n,r)),n=r+x.length,t.push(/* @__PURE__ */z("mark",{...o===E?{"data-current":""}:{},className:"rounded-sm text-transparent "+(o===E?"bg-status-warning-line":"bg-status-warning-soft"),children:e.slice(r,n)},r))}),t.push(e.slice(n)),t})()}),
73
+ /* @__PURE__ */z("textarea",{ref:u,defaultValue:t.text,"aria-label":e,spellCheck:!1,wrap:f?"soft":"off",onInput:Q,onSelect:K,onKeyUp:K,onClick:K,onScroll:W,style:{lineHeight:"21px",scrollbarGutter:"stable"},className:"absolute inset-0 h-full w-full resize-none bg-transparent p-4 font-mono text-sm text-ink outline-none "+(f?"whitespace-pre-wrap break-words":"overflow-x-auto whitespace-pre")})]}),
74
+ /* @__PURE__ */R("div",{className:"flex shrink-0 items-center gap-2 border-t border-line bg-surface-sunken px-3 py-1 text-xs text-ink-muted",children:[
75
+ /* @__PURE__ */z("span",{children:e}),
76
+ /* @__PURE__ */z("span",{children:i.lineColumn(w.line,w.col)}),
77
+ /* @__PURE__ */z("span",{children:i.lineCount(w.lines)}),
78
+ /* @__PURE__ */z("span",{children:t.eol})]})]})}var Tn=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),Ln=`${Array.from(Tn,e=>`.${e}`).join(",")},.docx,text/*`,Pn=/^<!doctype html><meta charset="utf-8"><title>[^<]*<\/title>(?!<body style="font-family:ui-monospace)/,jn=()=>"undefined"!=typeof navigator&&navigator.language||"en-AU";function Mn(){const t=A().documents,n=T([]),r=T(0),o=T(null),a={textBox:t.objectTextBox,chart:t.objectChart,diagram:t.objectDiagram,equation:t.objectEquation,picture:t.objectPicture,object:t.objectOther,contents:t.objectField},s=e=>({labels:a,imageUrl:(t,r)=>{const o=URL.createObjectURL(new Blob([t],{type:r}));return n.current.push(o),e.set(o,{bytes:t,mime:r}),o}}),i=e=>{const t=/* @__PURE__ */new Map;return{key:++r.current,kind:"rich",filename:e,images:t,doc:_e(ye(jn()),null,s(t))}},[l,c]=L(()=>i(t.untitled)),[d,h]=L(!1),[w,b]=L(!1),[y,v]=L(!1),[x,k]=L(!1);p(y),P(()=>()=>{n.current.forEach(e=>URL.revokeObjectURL(e))},[]);const $=e=>{const t=n.current;if(n.current=[],"rich"===e.kind)for(const t of e.images.keys())n.current.push(t);c(e),v(!1),setTimeout(()=>t.filter(e=>!n.current.includes(e)).forEach(e=>URL.revokeObjectURL(e)),0)},N=async()=>!y||f({title:t.discardTitle(l.filename),message:t.discardMessage,confirmLabel:t.discard,cancelLabel:t.keepEditing}),S=async e=>{if(!await N())return;const n=(e.name.split(".").pop()||"").toLowerCase();h(!0);try{if("docx"===n){const n=/* @__PURE__ */new Map,o=new Uint8Array(await e.arrayBuffer());try{const t=await Ze(o,s(n));$({key:++r.current,kind:"rich",doc:t,filename:e.name,images:n})}catch{g.error(t.cannotRead(e.name))}}else if("doc"===n)g.error(t.legacyDoc);else if(Tn.has(n)||e.type.startsWith("text/")){const o=new Uint8Array(await e.arrayBuffer()),a=function(e){let t,n="utf-8";if(239===e[0]&&187===e[1]&&191===e[2])n="utf-8-bom",t=new TextDecoder("utf-8").decode(e.subarray(3));else if(255===e[0]&&254===e[1])n="utf-16le",t=new TextDecoder("utf-16le").decode(e.subarray(2));else if(254===e[0]&&255===e[1])n="utf-16be",t=new TextDecoder("utf-16be").decode(e.subarray(2));else try{t=new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{n="windows-1252",t=new TextDecoder("windows-1252").decode(e)}const r=t.match(/\r\n/g)?.length??0,o=(t.match(/\n/g)?.length??0)-r,a=(t.match(/\r/g)?.length??0)-r,s=r>o&&r>=a?"CRLF":a>o?"CR":"LF";return{text:t.replace(/\r\n?/g,"\n"),encoding:n,eol:s}}(o);if("html"!==n&&"htm"!==n||!Pn.test(a.text))$({key:++r.current,kind:"text",decoded:a,bytes:o,filename:e.name});else{const n=/* @__PURE__ */new Map,o=_e(ye(jn()),null,s(n));o.html=dt(a.text)||o.html,Je(o),$({key:++r.current,kind:"rich",doc:o,images:n,filename:e.name.replace(/\.[^.]+$/,".docx"),imported:!0}),g.info(t.openedOldSave)}}else g.error(t.unsupported(n))}finally{h(!1)}},j=async()=>{await N()&&(v(!1),o.current?.click())},M=[{key:"new",label:t.newDocument,onSelect:()=>{(async()=>{await N()&&$(i(t.untitled))})()}},{key:"open",label:/* @__PURE__ */R("span",{className:"flex w-full items-center justify-between gap-4",children:[
79
+ /* @__PURE__ */z("span",{children:t.open}),
80
+ /* @__PURE__ */z("span",{className:"text-2xs text-ink-faint",children:"⌘O"})]}),onSelect:()=>{j()}}],E=x?/* @__PURE__ */z("div",{className:"w-44",children:/* @__PURE__ */z(e,{value:l.filename,label:t.rename,onDone:e=>{k(!1),e&&c(t=>({...t,filename:e}))}})}):/* @__PURE__ */R("button",{type:"button",onClick:()=>k(!0),title:t.rename,className:"max-w-[200px] truncate rounded px-2 py-0.5 text-sm font-medium text-ink hover:bg-line-subtle",children:[l.filename,y?" •":""]});/* @__PURE__ */
81
+ return R("div",{className:"relative flex h-full flex-col bg-surface text-ink",onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),w||b(!0))},onDragLeave:e=>{e.currentTarget===e.target&&b(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes("Files"))return;e.preventDefault(),b(!1);const t=Array.from(e.dataTransfer.files??[]);"rich"===l.kind&&t.length&&t.every(e=>e.type.startsWith("image/"))?window.dispatchEvent(new CustomEvent("docs-insert-images",{detail:{key:l.key,files:t}})):t[0]&&S(t[0])},children:[
82
+ /* @__PURE__ */z(m,{title:`${O=l.filename,O.length>24?`${O.slice(0,23)}…`:O}${y?" •":""} - Documents`}),
83
+ /* @__PURE__ */z(u,{app:"documents"}),
84
+ /* @__PURE__ */z("input",{ref:o,type:"file",accept:Ln,className:"hidden",onChange:e=>{const t=e.target.files?.[0];t&&S(t),e.target.value=""}}),d?/* @__PURE__ */z(C,{size:"sm",padding:"",className:"h-full",label:t.loading}):"rich"===l.kind?/* @__PURE__ */z(kn,{sessionKey:l.key,doc:l.doc,filename:l.filename,images:l.images,fileEntries:M,title:E,startsDirty:l.imported,onDirty:v,onOpenFile:()=>{j()},onNewImageUrl:e=>{n.current.push(e)}},l.key):/* @__PURE__ */z(Sn,{filename:l.filename,decoded:l.decoded,bytes:l.bytes,fileEntries:M,title:E,onDirty:v,onOpenFile:()=>{j()}},l.key),w&&/* @__PURE__ */z("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center border-4 border-dashed border-accent-fill bg-accent-tint",children:/* @__PURE__ */z("div",{className:"rounded-md bg-accent-fill px-4 py-2 text-sm font-medium text-on-accent",children:t.dropHint})})]});var O}export{Mn as default};