efficient-shell 12.8.1 → 12.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 (345) hide show
  1. package/README.md +37 -2
  2. package/dist/{Browser-DEXVIONU.js → Browser-6O7SDMZ5.js} +16 -16
  3. package/dist/Calculator-ALPNISJT.js +29 -0
  4. package/dist/{CurrencyConverter-H4M35SIY.js → CurrencyConverter-KBY2OXQ2.js} +8 -8
  5. package/dist/Files-3NTP7YKY.js +126 -0
  6. package/dist/{Notepad-PSDXZTBI.js → Notepad-GF5GBZGV.js} +9 -9
  7. package/dist/PdfViewer-L4FJS3M6.js +1 -0
  8. package/dist/{PomodoroTimer-SKAUQXPO.js → PomodoroTimer-NGQPYDI3.js} +68 -68
  9. package/dist/{Preview-HBB2SWJY.js → Preview-KVV6SE3C.js} +30 -30
  10. package/dist/Sidebar-QOGK5LJ2.js +44 -0
  11. package/dist/{Stock-X7GEAET7.js → Stock-O7AQ2WUN.js} +2 -2
  12. package/dist/{Weather-OH5PIQLU.js → Weather-WHXA5TTP.js} +21 -21
  13. package/dist/{WorldClock-S5NSJ7ZX.js → WorldClock-CZCIVYKB.js} +6 -6
  14. package/dist/ai/index.js +34 -34
  15. package/dist/apps/ImageAnnotator.js +1 -1
  16. package/dist/apps/index.d.ts +55 -1
  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/FlowChart.js +1 -1
  30. package/dist/charts/FunnelChart.js +1 -1
  31. package/dist/charts/HeatmapChart.js +1 -1
  32. package/dist/charts/HistogramChart.js +1 -1
  33. package/dist/charts/Meter.js +1 -1
  34. package/dist/charts/PieChart.js +1 -1
  35. package/dist/charts/RadarChart.js +1 -1
  36. package/dist/charts/RadialBarChart.js +1 -1
  37. package/dist/charts/RangeChart.js +1 -1
  38. package/dist/charts/RankedBars.js +1 -1
  39. package/dist/charts/SankeyChart.js +1 -1
  40. package/dist/charts/ScatterChart.js +1 -1
  41. package/dist/charts/SpecChart.js +1 -1
  42. package/dist/charts/StatTile.js +1 -1
  43. package/dist/charts/SunburstChart.js +1 -1
  44. package/dist/charts/TimeSeriesChart.js +1 -1
  45. package/dist/charts/TreemapChart.js +1 -1
  46. package/dist/charts/WaterfallChart.js +1 -1
  47. package/dist/{chunk-ROM25ZMZ.js → chunk-22LU6FKN.js} +10 -10
  48. package/dist/{chunk-NC36LJCA.js → chunk-2GS2VOQT.js} +10 -10
  49. package/dist/{chunk-UK6XNW3I.js → chunk-2NZBQOA6.js} +12 -12
  50. package/dist/{chunk-4ZUV6WQT.js → chunk-2WNTDGOP.js} +1 -1
  51. package/dist/{chunk-MZG3FS5T.js → chunk-2X4U3VX2.js} +6 -6
  52. package/dist/{chunk-6JDR6T4U.js → chunk-3RDJFCIZ.js} +1 -1
  53. package/dist/{chunk-5NDONLH5.js → chunk-42BVXJZN.js} +3 -3
  54. package/dist/{chunk-3KP3EIYP.js → chunk-457SK2XV.js} +5 -5
  55. package/dist/{chunk-Z2MNXUM6.js → chunk-4GTXRVDF.js} +2 -2
  56. package/dist/{chunk-G2X5YYIQ.js → chunk-4MUE4CYB.js} +2 -2
  57. package/dist/{chunk-3CMCGOOV.js → chunk-4UQNNA4K.js} +4 -4
  58. package/dist/{chunk-NEAT7BIP.js → chunk-5G4CB3E6.js} +1 -1
  59. package/dist/{chunk-PH3P54QQ.js → chunk-5HOXR3L4.js} +1 -1
  60. package/dist/{chunk-Y4RERPFN.js → chunk-5QVCBAK2.js} +1 -1
  61. package/dist/chunk-5RT5XDHG.js +6 -0
  62. package/dist/{chunk-3UHTHQGK.js → chunk-5S4YF5XA.js} +8 -8
  63. package/dist/{chunk-OGPCFMNA.js → chunk-5WCHUZ6O.js} +1 -1
  64. package/dist/{chunk-KUUZFLT6.js → chunk-5YPCZLBW.js} +1 -1
  65. package/dist/{chunk-PT77FC5X.js → chunk-5Z6XJPAX.js} +1 -1
  66. package/dist/{chunk-B7LNSGNR.js → chunk-63J2MBXV.js} +10 -10
  67. package/dist/chunk-675RYIWR.js +7 -0
  68. package/dist/{chunk-BDWZLMIT.js → chunk-67BWG353.js} +9 -9
  69. package/dist/{chunk-SCU2CWNJ.js → chunk-6BK3KRT5.js} +18 -18
  70. package/dist/{chunk-X7APOT53.js → chunk-6BQUSUNK.js} +7 -7
  71. package/dist/{chunk-NU7LUJX5.js → chunk-6ITEA6SX.js} +1 -1
  72. package/dist/{chunk-4KJ7MLWO.js → chunk-6JLXXX4H.js} +5 -5
  73. package/dist/{chunk-C37PXEEH.js → chunk-6P7SIIG4.js} +14 -14
  74. package/dist/{chunk-CNVYM3HP.js → chunk-6YIVKPWQ.js} +1 -1
  75. package/dist/{chunk-YJIFJIXV.js → chunk-7Q4DE4CT.js} +1 -1
  76. package/dist/chunk-7XGUX3TH.js +3 -0
  77. package/dist/{chunk-NKMSGZZ3.js → chunk-A2JYBUPB.js} +5 -5
  78. package/dist/{chunk-IYPRFUTT.js → chunk-AKTEMZOT.js} +1 -1
  79. package/dist/{chunk-F6QSHKUR.js → chunk-AMSE4PMQ.js} +4 -4
  80. package/dist/{chunk-TX5FZBPQ.js → chunk-ASOVTAIT.js} +1 -1
  81. package/dist/{chunk-CD7P34VC.js → chunk-AUCNJFTP.js} +7 -7
  82. package/dist/{chunk-BGJMDP6J.js → chunk-BJAJOIVY.js} +1 -1
  83. package/dist/chunk-BR7L5NE3.js +13 -0
  84. package/dist/{chunk-DJ2XDBAO.js → chunk-BUZ5AJLR.js} +6 -6
  85. package/dist/{chunk-EOGXCGQF.js → chunk-BYDSBDVS.js} +6 -6
  86. package/dist/{chunk-YUB3TJKO.js → chunk-C3E6XFIC.js} +3 -3
  87. package/dist/{chunk-45IVWLKF.js → chunk-C7M7KYNY.js} +1 -1
  88. package/dist/chunk-CA3OC4YY.js +9 -0
  89. package/dist/{chunk-H7HRYFRQ.js → chunk-CB5FQMFB.js} +9 -9
  90. package/dist/{chunk-UOUVHHTC.js → chunk-CINGDJPM.js} +1 -1
  91. package/dist/{chunk-6LYBE7LM.js → chunk-CRRC72EE.js} +9 -9
  92. package/dist/{chunk-NS37Y5CN.js → chunk-D4K72BHN.js} +1 -1
  93. package/dist/chunk-DVYIZP7X.js +31 -0
  94. package/dist/{chunk-BFO72WQB.js → chunk-EDANELWX.js} +1 -1
  95. package/dist/chunk-EHVBJUQI.js +28 -0
  96. package/dist/{chunk-ZC3TSMFK.js → chunk-EIXMUGVZ.js} +2 -2
  97. package/dist/{chunk-7FBAZLBX.js → chunk-EVEGK57J.js} +1 -1
  98. package/dist/{chunk-7HTDD37H.js → chunk-F7BXUVN4.js} +5 -5
  99. package/dist/{chunk-XFD4BLP7.js → chunk-FOCQEWUH.js} +1 -1
  100. package/dist/chunk-FQHY6DTF.js +4 -0
  101. package/dist/{chunk-4UGFNTZ3.js → chunk-FZWAOYAM.js} +7 -7
  102. package/dist/{chunk-NEYHBQLG.js → chunk-G3VRO4CK.js} +2 -2
  103. package/dist/{chunk-FPYABAOX.js → chunk-GB2XLSR5.js} +11 -11
  104. package/dist/{chunk-TS36J7RW.js → chunk-GBEDLYND.js} +2 -2
  105. package/dist/{chunk-4EVBKID5.js → chunk-GMJ5WOB2.js} +1 -1
  106. package/dist/{chunk-4JYHS4VJ.js → chunk-GMLDGXNQ.js} +1 -1
  107. package/dist/{chunk-PPSA3QLE.js → chunk-HD7OBASH.js} +1 -1
  108. package/dist/{chunk-NPIZ2Y3P.js → chunk-HE24VQMU.js} +1 -1
  109. package/dist/{chunk-3WFJ4PYV.js → chunk-HEX3EP5F.js} +3 -3
  110. package/dist/chunk-HL3V67JZ.js +2 -0
  111. package/dist/{chunk-5Q7VFXEO.js → chunk-HRDR56SK.js} +3 -3
  112. package/dist/chunk-HULQSIX5.js +8 -0
  113. package/dist/{chunk-OY3JH66O.js → chunk-HV4VQ5XV.js} +7 -7
  114. package/dist/{chunk-E227NVFX.js → chunk-IARCNQD3.js} +1 -1
  115. package/dist/{chunk-RJKMFIM3.js → chunk-ICNGLA5O.js} +6 -6
  116. package/dist/{chunk-VVQJHQW6.js → chunk-IIMFLLYT.js} +8 -8
  117. package/dist/{chunk-GHZ4PP62.js → chunk-INFL4YZF.js} +1 -1
  118. package/dist/{chunk-Y46WPTKY.js → chunk-ISU4FCEX.js} +7 -7
  119. package/dist/chunk-ISZOD5S6.js +2 -0
  120. package/dist/{chunk-H6PFTU3L.js → chunk-J4IT5C3A.js} +1 -1
  121. package/dist/{chunk-GLJILR2Y.js → chunk-J7BMSKOM.js} +5 -5
  122. package/dist/{chunk-DW45EZHA.js → chunk-JGJWPONL.js} +5 -5
  123. package/dist/{chunk-JY2OBPVO.js → chunk-JOD5ISTB.js} +1 -1
  124. package/dist/{chunk-TRWHVG3A.js → chunk-JTZVUO3I.js} +1 -1
  125. package/dist/{chunk-YMNWUQGV.js → chunk-JVNJCRHM.js} +4 -4
  126. package/dist/{chunk-N5LVUI7R.js → chunk-KFS7WSCC.js} +11 -11
  127. package/dist/{chunk-XZH5PEML.js → chunk-KIRLSUQT.js} +5 -5
  128. package/dist/{chunk-WMLBMR4E.js → chunk-KOPTKTHN.js} +3 -3
  129. package/dist/{chunk-3LTZ4N46.js → chunk-KPHYWZXL.js} +13 -13
  130. package/dist/{chunk-HQA7SPU5.js → chunk-KRUI4LVW.js} +1 -1
  131. package/dist/chunk-KVU5IQOZ.js +7 -0
  132. package/dist/{chunk-BXU3LX44.js → chunk-KWTK6TGH.js} +1 -1
  133. package/dist/{chunk-AXTVK6LU.js → chunk-KZ7RR7EU.js} +1 -1
  134. package/dist/{chunk-ZYW4KSEE.js → chunk-LFW3CQMF.js} +4 -4
  135. package/dist/{chunk-6HH6KNJB.js → chunk-LFWRHBTM.js} +2 -2
  136. package/dist/{chunk-X5ZY35KZ.js → chunk-LS6VU6F7.js} +1 -1
  137. package/dist/{chunk-5NONOFIV.js → chunk-M4MN2GOE.js} +1 -1
  138. package/dist/{chunk-GJ23UZDQ.js → chunk-MAI2DN7N.js} +1 -1
  139. package/dist/{chunk-7B5KFESH.js → chunk-MBXCXFQO.js} +1 -1
  140. package/dist/{chunk-32WEY6O5.js → chunk-MEAJGM6F.js} +1 -1
  141. package/dist/{chunk-DNLRUZGS.js → chunk-MPTOEXED.js} +1 -1
  142. package/dist/chunk-MTP3MBZA.js +22 -0
  143. package/dist/{chunk-EUUCNDIS.js → chunk-NAWIVFAN.js} +13 -13
  144. package/dist/{chunk-54K2ADBT.js → chunk-NDAZPAQL.js} +1 -1
  145. package/dist/{chunk-SYIJRZIS.js → chunk-NOC4WIME.js} +2 -2
  146. package/dist/chunk-NOCOLZ2W.js +1 -0
  147. package/dist/{chunk-SCGBCBXP.js → chunk-NV7QRWQJ.js} +1 -1
  148. package/dist/{chunk-XK4U5MAS.js → chunk-O3YCIWHF.js} +1 -1
  149. package/dist/{chunk-MCJ4JHLE.js → chunk-OAFFHLJ4.js} +5 -5
  150. package/dist/chunk-OSNHRKX6.js +5 -0
  151. package/dist/{chunk-BTUI3MKS.js → chunk-OSQ5NRV3.js} +1 -1
  152. package/dist/{chunk-GG4ZXQXG.js → chunk-OW5LQWPU.js} +3 -3
  153. package/dist/{chunk-3I67TIGD.js → chunk-PEIRPNXT.js} +21 -21
  154. package/dist/{chunk-LGK47SEN.js → chunk-PHJFGLXB.js} +12 -12
  155. package/dist/{chunk-7FRG5CF7.js → chunk-PICRPJBL.js} +1 -1
  156. package/dist/{chunk-HS6KTFW6.js → chunk-POOPWYJL.js} +10 -10
  157. package/dist/chunk-PY7GHIYF.js +19 -0
  158. package/dist/chunk-PYBPJL5R.js +1 -0
  159. package/dist/{chunk-7HIHQR3X.js → chunk-Q3RJMQYE.js} +1 -1
  160. package/dist/{chunk-QR46K5SB.js → chunk-QBSIM4JB.js} +1 -1
  161. package/dist/{chunk-LLUHE2ZW.js → chunk-QIMMZVWV.js} +1 -1
  162. package/dist/{chunk-NHWDB7R6.js → chunk-QMNDKNK2.js} +1 -1
  163. package/dist/{chunk-RIXX6NRV.js → chunk-QQM36CYU.js} +1 -1
  164. package/dist/{chunk-J33QE4J7.js → chunk-QSK2OWT3.js} +2 -2
  165. package/dist/{chunk-2JXGTA73.js → chunk-RAQBZUU2.js} +65 -65
  166. package/dist/{chunk-YMAU4EIK.js → chunk-RGKSJBXJ.js} +8 -8
  167. package/dist/{chunk-H6IGZWC2.js → chunk-RHD4V6CE.js} +9 -9
  168. package/dist/{chunk-VQJLH2BU.js → chunk-RIF6BFEH.js} +1 -1
  169. package/dist/{chunk-TXZR5G55.js → chunk-RLGPIJHB.js} +1 -1
  170. package/dist/{chunk-R3K3LVVS.js → chunk-RQKD5AAL.js} +1 -1
  171. package/dist/{chunk-I3QFYBOP.js → chunk-SEHKTBVM.js} +1 -1
  172. package/dist/{chunk-75MSXRFY.js → chunk-SFFELHLP.js} +5 -5
  173. package/dist/{chunk-SBZCJNNP.js → chunk-SY65V6K7.js} +10 -10
  174. package/dist/{chunk-UIWGVOFH.js → chunk-T3NLFOLW.js} +2 -1
  175. package/dist/{chunk-JYD6PSDA.js → chunk-TDMZFQRB.js} +1 -1
  176. package/dist/chunk-TJSJVC6P.js +1 -0
  177. package/dist/{chunk-MX2YRSMZ.js → chunk-TKFINWY6.js} +2 -2
  178. package/dist/{chunk-MM5AFQ24.js → chunk-TVVSFXWY.js} +7 -7
  179. package/dist/{chunk-EZWWQHD3.js → chunk-UD4NESX7.js} +1 -1
  180. package/dist/{chunk-NJTFI7AA.js → chunk-UG5GKEU5.js} +1 -1
  181. package/dist/{chunk-UZZVI7EN.js → chunk-UMZJRZFN.js} +1 -1
  182. package/dist/{chunk-LTESFDTF.js → chunk-V6FHZGCL.js} +1 -1
  183. package/dist/{chunk-2UBASCOK.js → chunk-VLCHHTX6.js} +1 -1
  184. package/dist/{chunk-VROBW74Y.js → chunk-VN3A43SA.js} +1 -1
  185. package/dist/{chunk-QQXQQPCD.js → chunk-VPZOSVDF.js} +9 -9
  186. package/dist/{chunk-DPUM3H5N.js → chunk-VWNHSLFY.js} +1 -1
  187. package/dist/{chunk-HE767CVB.js → chunk-W5B7UNMJ.js} +1 -1
  188. package/dist/{chunk-H27KA5IL.js → chunk-WDAOTHX5.js} +3 -3
  189. package/dist/{chunk-R3JKZXII.js → chunk-WJBP5SND.js} +5 -5
  190. package/dist/{chunk-LLAYWMYS.js → chunk-WM2BBRT6.js} +1 -1
  191. package/dist/{chunk-XVIDD6F3.js → chunk-Y4YXZIES.js} +8 -8
  192. package/dist/chunk-YMD2F3NL.js +1 -0
  193. package/dist/{chunk-525O4AUQ.js → chunk-YRG6XJ6M.js} +8 -8
  194. package/dist/chunk-YVAJ42M2.js +8 -0
  195. package/dist/{chunk-DZBGJ6X4.js → chunk-YVIV7SKG.js} +1 -1
  196. package/dist/{chunk-53EW4M5S.js → chunk-YX4MRM7A.js} +6 -6
  197. package/dist/{chunk-EZ6SVQSV.js → chunk-Z334LCCX.js} +1 -1
  198. package/dist/{chunk-7KIDOIPY.js → chunk-Z7RXWXR5.js} +1 -1
  199. package/dist/{chunk-23WJCEYD.js → chunk-ZC6MXV4L.js} +1 -1
  200. package/dist/{chunk-7H7U3HC6.js → chunk-ZR2UWJIR.js} +4 -4
  201. package/dist/data/DataTable.js +1 -1
  202. package/dist/data/EntityList.js +1 -1
  203. package/dist/data/Kanban.js +1 -1
  204. package/dist/data/ListFooter.js +1 -1
  205. package/dist/data/ListLoadError.js +1 -1
  206. package/dist/data/Pagination.js +1 -1
  207. package/dist/data/ResizableTable.js +1 -1
  208. package/dist/file-intake/index.js +1 -1
  209. package/dist/forms/BorderInput.js +1 -1
  210. package/dist/forms/BrandAssetEditor.js +1 -1
  211. package/dist/forms/Calendar.js +1 -1
  212. package/dist/forms/ColorPicker.js +1 -1
  213. package/dist/forms/ComposerAttachments.js +1 -1
  214. package/dist/forms/CornersInput.js +1 -1
  215. package/dist/forms/DatePicker.js +1 -1
  216. package/dist/forms/DateRangePicker.js +1 -1
  217. package/dist/forms/DateTimePicker.js +1 -1
  218. package/dist/forms/DisplayChips.js +1 -1
  219. package/dist/forms/FilePicker.js +1 -1
  220. package/dist/forms/FormErrorSummary.js +1 -1
  221. package/dist/forms/IconPicker.js +1 -1
  222. package/dist/forms/ImageFocusPoint.js +1 -1
  223. package/dist/forms/Input.js +1 -1
  224. package/dist/forms/InputNumber.js +1 -1
  225. package/dist/forms/LinkPicker.js +1 -1
  226. package/dist/forms/MediaLibrary.js +1 -1
  227. package/dist/forms/MediaUploadField.js +1 -1
  228. package/dist/forms/MediaUploadGrid.js +1 -1
  229. package/dist/forms/MediaUsedInList.js +1 -1
  230. package/dist/forms/NumericKeypad.js +1 -1
  231. package/dist/forms/PositionInput.js +1 -1
  232. package/dist/forms/RenameField.js +1 -1
  233. package/dist/forms/Select.js +1 -1
  234. package/dist/forms/SidesInput.js +1 -1
  235. package/dist/forms/Slider.js +1 -1
  236. package/dist/forms/Snippet.js +1 -1
  237. package/dist/forms/SplitButton.js +1 -1
  238. package/dist/forms/TagInput.js +1 -1
  239. package/dist/forms/TextToolbar.js +1 -1
  240. package/dist/forms/TimePicker.js +1 -1
  241. package/dist/forms/UnitMenu.js +1 -1
  242. package/dist/forms/WidthsBar.js +1 -1
  243. package/dist/forms/mediaLibraryMenu.js +1 -1
  244. package/dist/forms/mediaMoveItems.js +1 -1
  245. package/dist/forms/textAlign.js +1 -1
  246. package/dist/forms/useFileIntake.js +1 -1
  247. package/dist/icons/efficient-meanings.d.ts +37 -37
  248. package/dist/icons/efficient-meanings.js +1 -1
  249. package/dist/icons/efficient.js +1 -1
  250. package/dist/icons/index.js +1 -1
  251. package/dist/index.js +665 -665
  252. package/dist/locales/zh-Hans.js +1 -1
  253. package/dist/map/index.js +2 -2
  254. package/dist/markdown/index.js +1 -1
  255. package/dist/page-tabs/index.js +5 -5
  256. package/dist/pdf/index.js +1 -1
  257. package/dist/shell/Accordion.js +1 -1
  258. package/dist/shell/AppUpdateBanner.js +1 -1
  259. package/dist/shell/Avatar.js +1 -1
  260. package/dist/shell/Banner.js +1 -1
  261. package/dist/shell/Breadcrumbs.js +1 -1
  262. package/dist/shell/BudgetBar.js +1 -1
  263. package/dist/shell/Card.js +1 -1
  264. package/dist/shell/ColoredBadge.js +1 -1
  265. package/dist/shell/ConfirmDialog.js +1 -1
  266. package/dist/shell/ContainerFillChart.js +1 -1
  267. package/dist/shell/ContextMenu.js +1 -1
  268. package/dist/shell/CountBadge.js +1 -1
  269. package/dist/shell/Dialog.js +1 -1
  270. package/dist/shell/Drawer.js +1 -1
  271. package/dist/shell/DropdownMenu.js +1 -1
  272. package/dist/shell/EditableGrid.js +1 -1
  273. package/dist/shell/EmptyState.js +1 -1
  274. package/dist/shell/GlobalSearch.js +1 -1
  275. package/dist/shell/HelpCenter.js +1 -1
  276. package/dist/shell/IconRail.js +1 -1
  277. package/dist/shell/ImageLightbox.js +1 -1
  278. package/dist/shell/ItemCount.js +1 -1
  279. package/dist/shell/LanguageSelect.js +1 -1
  280. package/dist/shell/Markdown.js +1 -1
  281. package/dist/shell/MetricBar.js +1 -1
  282. package/dist/shell/MetricBarLegend.js +1 -1
  283. package/dist/shell/MilestoneTimeline.js +1 -1
  284. package/dist/shell/PageHeader.js +1 -1
  285. package/dist/shell/PopupMenu.js +1 -1
  286. package/dist/shell/ProductionTimeline.js +1 -1
  287. package/dist/shell/ResizeHandle.js +1 -1
  288. package/dist/shell/Result.js +1 -1
  289. package/dist/shell/SearchableSelect.js +1 -1
  290. package/dist/shell/SettingReset.js +1 -1
  291. package/dist/shell/SettingRow.js +1 -1
  292. package/dist/shell/SidebarLayout.js +1 -1
  293. package/dist/shell/SidebarNav.js +1 -1
  294. package/dist/shell/SortableList.js +1 -1
  295. package/dist/shell/Statistic.js +1 -1
  296. package/dist/shell/StepChain.js +1 -1
  297. package/dist/shell/Stepper.js +1 -1
  298. package/dist/shell/TimeAgo.js +1 -1
  299. package/dist/shell/TimelineTrack.js +1 -1
  300. package/dist/shell/TopNav.js +1 -1
  301. package/dist/shell/TransferProgress.js +1 -1
  302. package/dist/shell/Tree.js +1 -1
  303. package/dist/shell/discardGuard.js +1 -1
  304. package/dist/shell/language.js +1 -1
  305. package/dist/shell/strings.d.ts +8 -0
  306. package/dist/shell/strings.js +1 -1
  307. package/dist/shell/toast.js +1 -1
  308. package/dist/telemetry/index.js +1 -1
  309. package/dist/templates/AuthScreen.js +1 -1
  310. package/dist/templates/ChatTemplate.js +1 -1
  311. package/dist/templates/CheckoutTemplate.js +1 -1
  312. package/dist/templates/DashboardTemplate.js +1 -1
  313. package/dist/templates/DataTablePage.js +1 -1
  314. package/dist/templates/EmailTemplate.js +1 -1
  315. package/dist/templates/ErrorBoundary.js +1 -1
  316. package/dist/templates/ErrorPage.js +1 -1
  317. package/dist/templates/FormLayoutPage.js +1 -1
  318. package/dist/templates/GalleryTemplate.js +1 -1
  319. package/dist/ui/index.js +1 -1
  320. package/dist/version.js +1 -1
  321. package/package.json +1 -1
  322. package/dist/Calculator-NZ2S6CAK.js +0 -29
  323. package/dist/Files-HDTNIXUC.js +0 -121
  324. package/dist/PdfViewer-GUXUWGMG.js +0 -1
  325. package/dist/Sidebar-XGAVJGOL.js +0 -44
  326. package/dist/chunk-27TJNID7.js +0 -13
  327. package/dist/chunk-43MCNASD.js +0 -1
  328. package/dist/chunk-6DZGOGB2.js +0 -1
  329. package/dist/chunk-6EHPEBGP.js +0 -5
  330. package/dist/chunk-A6WZF65N.js +0 -22
  331. package/dist/chunk-C3SE57NF.js +0 -3
  332. package/dist/chunk-GEZ45J4Z.js +0 -2
  333. package/dist/chunk-HEAGOZKJ.js +0 -6
  334. package/dist/chunk-IFIMUNID.js +0 -4
  335. package/dist/chunk-IHPAYSTJ.js +0 -8
  336. package/dist/chunk-KETGA66S.js +0 -9
  337. package/dist/chunk-KO74S3FL.js +0 -28
  338. package/dist/chunk-M54OL3YR.js +0 -2
  339. package/dist/chunk-P2C33RHT.js +0 -1
  340. package/dist/chunk-QLVH66TE.js +0 -31
  341. package/dist/chunk-SE3S362N.js +0 -7
  342. package/dist/chunk-TWFD7A3K.js +0 -1
  343. package/dist/chunk-U5DSVCWV.js +0 -8
  344. package/dist/chunk-UDVQORQM.js +0 -19
  345. package/dist/chunk-WSRM6ZQS.js +0 -7
@@ -1,99 +1,99 @@
1
- import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,scrollerIsFluid as i,growBoxToWidth as a,widthToFit as s,navIcons as l}from"./chunk-4LXCCZDM.js";import{ROW_HEIGHTS as c}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as u}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as d}from"./chunk-JDCM2VHG.js";import{Result as h}from"./chunk-Y4RERPFN.js";import{CMD_Z as m,CMD_SHIFT_Z as p}from"./chunk-ZDMZM7HD.js";import{CopyButton as f}from"./chunk-HE767CVB.js";import{confirm as w}from"./chunk-SCU2CWNJ.js";import{ItemCount as y}from"./chunk-BXU3LX44.js";import{isInOverlayOver as g}from"./chunk-3DVNXNTF.js";import{dialogA11y as v}from"./chunk-VWGWZY7A.js";import{ColoredBadge as b}from"./chunk-EZWWQHD3.js";import{LoadingSpinner as x}from"./chunk-SCGBCBXP.js";import{activationOrder as k,activeListeners as E,ModalActionsContext as C,subscribeActive as M,getActiveModalId as N,KEY_ACTIVATED_SELECTOR as S}from"./chunk-F3ZOO23R.js";import{useShellAuth as L}from"./chunk-2QY5BJLA.js";import{useIsMobile as T,useIsPhone as z}from"./chunk-UGTRSRIW.js";import{useShellPrefs as A}from"./chunk-KC3EX26K.js";import{focusableIn as D}from"./chunk-CDAJKLGL.js";import{StatusBadge as P}from"./chunk-JMGDGNM7.js";import{PopupMenu as I,PopupMenuItem as W,PopupMenuDivider as R,PopupMenuLabel as K}from"./chunk-6LYBE7LM.js";import{Button_default as $}from"./chunk-EVYD6UFQ.js";import{Icon as O}from"./chunk-UIWGVOFH.js";import{LoadingSpinner as j}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as F}from"./chunk-62LW225J.js";import{shellHttp as q,isShellHttpConfigured as B}from"./chunk-STKJA4PV.js";import{runEscapeInterceptors as H}from"./chunk-TWVUQUUD.js";import{useShellStrings as U}from"./chunk-43MCNASD.js";import{createContext as Y,createElement as X,useContext as V,Component as G,useLayoutEffect as J,useRef as _,useEffect as Z,useState as Q,useSyncExternalStore as ee,useCallback as te,isValidElement as ne,Fragment as re,Children as oe,cloneElement as ie,useMemo as ae,useId as se,useReducer as le,Suspense as ce}from"react";import{jsxs as ue,jsx as de,Fragment as he}from"react/jsx-runtime";import{createPortal as me}from"react-dom";import{useLocation as pe}from"react-router-dom";import{useQueryClient as fe,useQuery as we}from"@tanstack/react-query";function ye(e){return"component"in e}function ge(e){return"endpoint"in e}var ve={};function be(e){ve=e}var xe=new Proxy({},{get:(e,t)=>ve[t],has:(e,t)=>t in ve,ownKeys:()=>Object.keys(ve),getOwnPropertyDescriptor(e,t){if(t in ve)return{configurable:!0,enumerable:!0,value:ve[t]}}});function ke(){return B()}var Ee=q,Ce=Y({});function Me({value:e,children:t}){return X(Ce.Provider,{value:e},t)}function Ne(){return V(Ce)}var Se=Y(null);function Le(){return V(Se)?.pageSearch??""}var Te=null,ze=/* @__PURE__ */new Set;function Ae(e){Te!==e&&(Te=e,ze.forEach(e=>e()))}function De(){return Te}function Pe(e){return ze.add(e),()=>{ze.delete(e)}}var Ie=null;function We(e){Ie=e}function Re({error:e,onReload:t}){const n=d(e);/* @__PURE__ */
1
+ import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,scrollerIsFluid as i,growBoxToWidth as a,widthToFit as s,navIcons as l}from"./chunk-4LXCCZDM.js";import{ROW_HEIGHTS as c}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as u}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as d}from"./chunk-JDCM2VHG.js";import{Result as h}from"./chunk-5QVCBAK2.js";import{CMD_Z as m,CMD_SHIFT_Z as p}from"./chunk-ZDMZM7HD.js";import{CopyButton as f}from"./chunk-W5B7UNMJ.js";import{confirm as w}from"./chunk-6BK3KRT5.js";import{ItemCount as y}from"./chunk-KWTK6TGH.js";import{isInOverlayOver as g}from"./chunk-3DVNXNTF.js";import{dialogA11y as v}from"./chunk-VWGWZY7A.js";import{ColoredBadge as b}from"./chunk-UD4NESX7.js";import{LoadingSpinner as x}from"./chunk-NV7QRWQJ.js";import{activationOrder as k,activeListeners as E,ModalActionsContext as C,subscribeActive as M,getActiveModalId as N,KEY_ACTIVATED_SELECTOR as S}from"./chunk-F3ZOO23R.js";import{useShellAuth as L}from"./chunk-2QY5BJLA.js";import{useIsMobile as T,useIsPhone as z}from"./chunk-UGTRSRIW.js";import{useShellPrefs as A}from"./chunk-KC3EX26K.js";import{focusableIn as D}from"./chunk-CDAJKLGL.js";import{StatusBadge as P}from"./chunk-JMGDGNM7.js";import{PopupMenu as I,PopupMenuItem as R,PopupMenuDivider as W,PopupMenuLabel as K}from"./chunk-CRRC72EE.js";import{Button_default as $}from"./chunk-EVYD6UFQ.js";import{Icon as O}from"./chunk-T3NLFOLW.js";import{LoadingSpinner as j}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as F}from"./chunk-62LW225J.js";import{shellHttp as q,isShellHttpConfigured as B}from"./chunk-STKJA4PV.js";import{runEscapeInterceptors as H}from"./chunk-TWVUQUUD.js";import{useShellStrings as U}from"./chunk-TJSJVC6P.js";import{createContext as Y,createElement as X,useContext as V,Component as J,useLayoutEffect as G,useRef as _,useEffect as Q,useState as Z,useSyncExternalStore as ee,useCallback as te,isValidElement as ne,Fragment as re,Children as oe,cloneElement as ie,useMemo as ae,useId as se,useReducer as le,Suspense as ce}from"react";import{jsxs as ue,jsx as de,Fragment as he}from"react/jsx-runtime";import{createPortal as me}from"react-dom";import{useLocation as pe}from"react-router-dom";import{useQueryClient as fe,useQuery as we}from"@tanstack/react-query";function ye(e){return"component"in e}function ge(e){return"endpoint"in e}var ve={};function be(e){ve=e}var xe=new Proxy({},{get:(e,t)=>ve[t],has:(e,t)=>t in ve,ownKeys:()=>Object.keys(ve),getOwnPropertyDescriptor(e,t){if(t in ve)return{configurable:!0,enumerable:!0,value:ve[t]}}});function ke(){return B()}var Ee=q,Ce=Y({});function Me({value:e,children:t}){return X(Ce.Provider,{value:e},t)}function Ne(){return V(Ce)}var Se=Y(null);function Le(){return V(Se)?.pageSearch??""}var Te=null,ze=/* @__PURE__ */new Set;function Ae(e){Te!==e&&(Te=e,ze.forEach(e=>e()))}function De(){return Te}function Pe(e){return ze.add(e),()=>{ze.delete(e)}}var Ie=null;function Re(e){Ie=e}function We({error:e,onReload:t}){const n=d(e);/* @__PURE__ */
2
2
  return ue("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
3
  /* @__PURE__ */de(O,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
4
  /* @__PURE__ */ue("div",{className:"min-w-0",children:[
5
5
  /* @__PURE__ */de("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
6
  /* @__PURE__ */de("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
7
- /* @__PURE__ */de("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Ke=class extends G{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),u(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */de(Re,{error:e,onReload:this.reset}):this.props.children}},$e=Y(null),Oe="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function je({className:e="",auto:t=!1}){const n=V($e),r=U().undo,o=n?.claimOwnMount;if(J(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
7
+ /* @__PURE__ */de("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Ke=class extends J{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),u(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */de(We,{error:e,onReload:this.reset}):this.props.children}},$e=Y(null),Oe="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function je({className:e="",auto:t=!1}){const n=V($e),r=U().undo,o=n?.claimOwnMount;if(G(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
8
8
  return ue("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
9
  /* @__PURE__ */de("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",m):r.nothingToUndo,className:Oe,children:r.undo}),
10
- /* @__PURE__ */de("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",p):r.nothingToRedo,className:Oe,children:r.redo})]})}var Fe=/* @__PURE__ */new Set([408,429]);function qe(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Be(e){const t=qe(e);return null!=t&&(t>=400&&t<500&&!Fe.has(t))}function He(e,t){return!Be(t)&&e<3}function Ue(e){if("page"!==e.type)return!0;const t=e.route?xe[e.route]:void 0;if(!t||!ye(t))return!0;const n=t;return!n.widget&&!n.utility}function Ye(e){const t=e.route?xe[e.route]:void 0;if(!t||!ye(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var Xe=(e,t)=>!!t&&"page"===e.type&&e.route===t;var Ve="flex-1 min-h-0";function Ge(){const e=U().record;/* @__PURE__ */
11
- return de(j,{label:e.loading,padding:"",className:Ve})}function Je(e){return e??void 0}function _e({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=U().record;if(t||e&&n)/* @__PURE__ */return de(Ge,{});if(r){const e=qe(r);if(401===e)/* @__PURE__ */
10
+ /* @__PURE__ */de("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",p):r.nothingToRedo,className:Oe,children:r.redo})]})}var Fe=/* @__PURE__ */new Set([408,429]);function qe(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Be(e){const t=qe(e);return null!=t&&(t>=400&&t<500&&!Fe.has(t))}function He(e,t){return!Be(t)&&e<3}function Ue(e){if("page"!==e.type)return!0;const t=e.route?xe[e.route]:void 0;if(!t||!ye(t))return!0;const n=t;return!n.widget&&!n.utility}function Ye(e){const t=e.route?xe[e.route]:void 0;if(!t||!ye(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var Xe=(e,t)=>!!t&&"page"===e.type&&e.route===t;var Ve="flex-1 min-h-0";function Je(){const e=U().record;/* @__PURE__ */
11
+ return de(j,{label:e.loading,padding:"",className:Ve})}function Ge(e){return e??void 0}function _e({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=U().record;if(t||e&&n)/* @__PURE__ */return de(Je,{});if(r){const e=qe(r);if(401===e)/* @__PURE__ */
12
12
  return de(h,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Ve});if(403===e)/* @__PURE__ */
13
13
  return de(h,{status:"403",className:Ve});if(404===e||410===e)/* @__PURE__ */
14
14
  return de(h,{status:"404",title:i.notFound,className:Ve});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
15
15
  return de(h,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */de($,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Ve})}/* @__PURE__ */
16
- return de(h,{status:"404",title:i.notFound,className:Ve})}function Ze({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */de(he,{children:t(e)}):/* @__PURE__ */de(_e,{...n})}var Qe=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function et(e){return"string"==typeof e&&(e.startsWith("new-")||Qe.test(e))}function tt(e){if(et(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var nt=Y({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),rt=Y(null);function ot(e){const t=V(rt),n=_(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),J(()=>{if(t)return t(n.current,e)},[t,e]),Z(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function it(){const e=_(/* @__PURE__ */new Map),[t,n]=Q(!1);return{dirty:t,registerDirty:te((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function at(){return V(nt)}function st(e){if("page"!==e.type&&tt(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function lt({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=it(),i=xe[e.route];if(!i||!ye(i))return null;const a=i,s=a.component;/* @__PURE__ */
16
+ return de(h,{status:"404",title:i.notFound,className:Ve})}function Qe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */de(he,{children:t(e)}):/* @__PURE__ */de(_e,{...n})}var Ze=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function et(e){return"string"==typeof e&&(e.startsWith("new-")||Ze.test(e))}function tt(e){if(et(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var nt=Y({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),rt=Y(null);function ot(e){const t=V(rt),n=_(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),G(()=>{if(t)return t(n.current,e)},[t,e]),Q(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function it(){const e=_(/* @__PURE__ */new Map),[t,n]=Z(!1);return{dirty:t,registerDirty:te((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function at(){return V(nt)}function st(e){if("page"!==e.type&&tt(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function lt({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=it(),i=xe[e.route];if(!i||!ye(i))return null;const a=i,s=a.component;/* @__PURE__ */
17
17
  return de(_r,{open:!0,onClose:t,icon:l[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */de(rt.Provider,{value:o,children:/* @__PURE__ */de(ce,{fallback:/* @__PURE__ */de("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */de(x,{})}),children:/* @__PURE__ */de(s,{})})})})}function ct({entityType:e,entityId:t,label:n}){const r=U(),o=fe(),{data:i}=we({queryKey:["my-profile-sidebar"],enabled:ke(),queryFn:()=>Ee.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
18
- return de("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];Ee.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */de(O,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var ut=/* @__PURE__ */new Set,dt=()=>"hidden";function ht({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=xe[e.entityType];if(!o||!ge(o))return null;const i=o,[a,s]=Q(!1),{dirty:c,registerDirty:u}=it(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=et(e.entityId),p=Ne(),f=(w=e.id,ee(M,()=>{const e=qn.get(w);return null!=e&&Rn.has(e)}));var w;const y=!i.selfFetching&&!h&&!m&&ke(),g=we({queryKey:[d,e.entityId],queryFn:()=>{return Ee.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Je(e.entitySnapshot),initialDataUpdatedAt:0,enabled:y,staleTime:0,refetchOnWindowFocus:()=>{return void 0===(e=p.entityRefetchOnWindowFocus)||("function"==typeof e?e():e);var e},refetchOnMount:"always",refetchInterval:e=>function(e,t={}){if(Be(e))return!1;if(t.minimized)return!1;const n=t.hostInterval;if(void 0===n)return 6e4;const r="function"==typeof n?n():n;return"number"==typeof r&&r>0&&r}(e.state.error,{minimized:f,hostInterval:p.entityRefetchInterval}),refetchIntervalInBackground:!1,retry:He}),v=g.data,b=g.refetch;Z(()=>{var t;if(y)return t=t=>{t!==e.id||ut.has(t)||b({cancelRefetch:!1})},rr.add(t),()=>{rr.delete(t)}},[b,e.id,y]);const k=te(()=>{a&&!c?s(!1):t()},[a,c,t]),E=(i.useEdit??dt)(v??null),C=!i.useEdit||m||h?void 0:{state:E,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},N=i.selfFetching?e.label:v?i.title(v,a,s):e.label,S=i.icon,L=S?l[S]:null,T=N,z=!i.selfFetching&&v&&i.footer&&!h?i.footer(v):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */de(ce,{fallback:/* @__PURE__ */de(x,{}),children:i.render(v??e.entitySnapshot,t,e.entityId,a,s)}):null!=v?/* @__PURE__ */de(ce,{fallback:/* @__PURE__ */de(_r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */de(Ge,{})}),children:i.render(v,t,e.entityId,a,s)}):/* @__PURE__ */de(_r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */de(_e,{isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b})}):/* @__PURE__ */de(_r,{open:!0,onClose:k,onMinimize:n,initialBox:e.savedBox,icon:L,title:T,footer:z,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,edit:C,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */de(rt.Provider,{value:u,children:/* @__PURE__ */de(ce,{fallback:/* @__PURE__ */de(Ge,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */de(Ze,{entity:v,isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function mt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function pt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function ft(e){const t=mt(e),n=t??pt(e);if(!n)return;if(t&&!fr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&or(o)}function wt(){const e=N();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var yt=/* @__PURE__ */new Map;function gt(){const e=wt();if(e)return yt.get(e)}function vt(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var bt="rosh-peek-style",xt=F.peek,kt=F.taskbarPreview;function Et(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(bt))return;const e=document.createElement("style");e.id=bt,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${xt}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function Ct(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function Mt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=U(),l=_(null),[c,u]=Q({w:n,h:Math.round(.75*r)}),[d,h]=Q(!1);return J(()=>{const o=l.current;if(!o)return;const i=mt(e)??vt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */ue("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-line-strong shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
18
+ return de("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];Ee.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */de(O,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var ut=/* @__PURE__ */new Set,dt=()=>"hidden";function ht({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=xe[e.entityType];if(!o||!ge(o))return null;const i=o,[a,s]=Z(!1),{dirty:c,registerDirty:u}=it(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=et(e.entityId),p=Ne(),f=(w=e.id,ee(M,()=>{const e=qn.get(w);return null!=e&&Wn.has(e)}));var w;const y=!i.selfFetching&&!h&&!m&&ke(),g=we({queryKey:[d,e.entityId],queryFn:()=>{return Ee.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Ge(e.entitySnapshot),initialDataUpdatedAt:0,enabled:y,staleTime:0,refetchOnWindowFocus:()=>{return void 0===(e=p.entityRefetchOnWindowFocus)||("function"==typeof e?e():e);var e},refetchOnMount:"always",refetchInterval:e=>function(e,t={}){if(Be(e))return!1;if(t.minimized)return!1;const n=t.hostInterval;if(void 0===n)return 6e4;const r="function"==typeof n?n():n;return"number"==typeof r&&r>0&&r}(e.state.error,{minimized:f,hostInterval:p.entityRefetchInterval}),refetchIntervalInBackground:!1,retry:He}),v=g.data,b=g.refetch;Q(()=>{var t;if(y)return t=t=>{t!==e.id||ut.has(t)||b({cancelRefetch:!1})},rr.add(t),()=>{rr.delete(t)}},[b,e.id,y]);const k=te(()=>{a&&!c?s(!1):t()},[a,c,t]),E=(i.useEdit??dt)(v??null),C=!i.useEdit||m||h?void 0:{state:E,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},N=i.selfFetching?e.label:v?i.title(v,a,s):e.label,S=i.icon,L=S?l[S]:null,T=N,z=!i.selfFetching&&v&&i.footer&&!h?i.footer(v):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */de(ce,{fallback:/* @__PURE__ */de(x,{}),children:i.render(v??e.entitySnapshot,t,e.entityId,a,s)}):null!=v?/* @__PURE__ */de(ce,{fallback:/* @__PURE__ */de(_r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */de(Je,{})}),children:i.render(v,t,e.entityId,a,s)}):/* @__PURE__ */de(_r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */de(_e,{isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b})}):/* @__PURE__ */de(_r,{open:!0,onClose:k,onMinimize:n,initialBox:e.savedBox,icon:L,title:T,footer:z,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,edit:C,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */de(rt.Provider,{value:u,children:/* @__PURE__ */de(ce,{fallback:/* @__PURE__ */de(Je,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */de(Qe,{entity:v,isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function mt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function pt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function ft(e){const t=mt(e),n=t??pt(e);if(!n)return;if(t&&!fr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&or(o)}function wt(){const e=N();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var yt=/* @__PURE__ */new Map;function gt(){const e=wt();if(e)return yt.get(e)}function vt(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var bt="rosh-peek-style",xt=F.peek,kt=F.taskbarPreview;function Et(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(bt))return;const e=document.createElement("style");e.id=bt,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${xt}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function Ct(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function Mt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=U(),l=_(null),[c,u]=Z({w:n,h:Math.round(.75*r)}),[d,h]=Z(!1);return G(()=>{const o=l.current;if(!o)return;const i=mt(e)??vt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */ue("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-line-strong shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
19
19
  /* @__PURE__ */de("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */ue("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
20
20
  /* @__PURE__ */de(O,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
21
- /* @__PURE__ */de("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */de("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-on-accent bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */de("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-on-accent flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */de(O,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function Nt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=U(),s=e.length>1,l=_(null),[c,u]=Q({left:-9999,top:-9999,ready:!1}),[d,h]=Q(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");J(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),Z(()=>Ct,[]);const m="top"===d,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-ink-strongest bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return me(
21
+ /* @__PURE__ */de("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */de("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-on-accent bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */de("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-on-accent flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */de(O,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function Nt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=U(),s=e.length>1,l=_(null),[c,u]=Z({left:-9999,top:-9999,ready:!1}),[d,h]=Z(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");G(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),Q(()=>Ct,[]);const m="top"===d,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-ink-strongest bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return me(
22
22
  /* @__PURE__ */de("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:kt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{Ct(),i()},children:e.map(e=>{const t=mt(e.id)??vt(e.label),o=t?function(e){if(fr(e))return null;const t=e.getBoundingClientRect(),n=cr(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
23
23
  return ue("div",{className:"group flex flex-col items-center",onMouseEnter:()=>Et(t),children:[!m&&/* @__PURE__ */de("span",{className:p,children:e.label}),
24
24
  /* @__PURE__ */de(Mt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */de("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */ue("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-on-accent shadow-sm",children:[
25
- /* @__PURE__ */de(O,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function St(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function Lt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=U(),[a,s]=Q(null);Z(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const c=ee(M,N),[,u]=Q(0);Z(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=Q(0);Z(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=vt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=Q(null),[f,w]=Q(null),[g,v]=Q(null),b=_(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},k=e.filter(e=>!e.route||!xe[e.route]?.utility);if(!a||!a.isConnected||0===k.length)return null;const E=[],C=/* @__PURE__ */new Map;for(const e of k){const t=e.route?xe[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=C.get(r);if(void 0!==o)E[o].items.push(e);else{C.set(r,E.length);const o=n?.label??t?.label??e.label;E.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return me(
25
+ /* @__PURE__ */de(O,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function St(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function Lt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=U(),[a,s]=Z(null);Q(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const c=ee(M,N),[,u]=Z(0);Q(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=Z(0);Q(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=vt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=Z(null),[f,w]=Z(null),[g,v]=Z(null),b=_(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},k=e.filter(e=>!e.route||!xe[e.route]?.utility);if(!a||!a.isConnected||0===k.length)return null;const E=[],C=/* @__PURE__ */new Map;for(const e of k){const t=e.route?xe[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=C.get(r);if(void 0!==o)E[o].items.push(e);else{C.set(r,E.length);const o=n?.label??t?.label??e.label;E.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return me(
26
26
  /* @__PURE__ */ue(he,{children:[E.map(e=>{const n=e.route?l[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(c){const t=document.querySelector(`[data-modal-id="${c}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,u=e.items.some(e=>{const t=mt(e.id)??vt(e.label);return!!t&&!fr(t)});/* @__PURE__ */
27
27
  return ue("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(g||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:x,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),s?v({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&ne(n)?ie(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */de(O,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
28
28
  /* @__PURE__ */de("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */de("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */de(y,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */de("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */de(O,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
29
29
  /* @__PURE__ */de("div",{className:"flex-1"}),k.length>=2&&/* @__PURE__ */ue("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-accent-tint transition-colors shrink-0",children:[
30
30
  /* @__PURE__ */de(O,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),g&&/* @__PURE__ */ue(I,{portal:!0,minWidth:200,style:St(g.x,g.y),onClose:()=>v(null),children:[
31
31
  /* @__PURE__ */de(K,{children:g.label}),
32
- /* @__PURE__ */ue(W,{onClick:()=>{v(null),g.items.forEach(e=>function(e){const t=qn.get(e);t&&ir(t)}(e.id))},children:[
32
+ /* @__PURE__ */ue(R,{onClick:()=>{v(null),g.items.forEach(e=>function(e){const t=qn.get(e);t&&ir(t)}(e.id))},children:[
33
33
  /* @__PURE__ */de(O,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
34
- /* @__PURE__ */ue(W,{onClick:()=>{v(null),g.items.forEach(e=>o(e.id))},children:[
34
+ /* @__PURE__ */ue(R,{onClick:()=>{v(null),g.items.forEach(e=>o(e.id))},children:[
35
35
  /* @__PURE__ */de("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */de("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
36
- /* @__PURE__ */de(R,{}),
37
- /* @__PURE__ */ue(W,{danger:!0,onClick:()=>{v(null),g.items.forEach(e=>t(e.id))},children:[
38
- /* @__PURE__ */de(O,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${g.items.length})`]})]}),m&&f&&/* @__PURE__ */de(Nt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:x})]}),a)}var Tt=["/login","/forgot-password","/reset-password","/force-change-password"];function zt({children:e,windowAccentForRoute:t}){const n=pe(),r=Tt.some(e=>n.pathname.startsWith(e)),[o,i]=Q([]),a=_(o);J(()=>{a.current=o},[o]);const s=ee(Pe,De,De),l=_(/* @__PURE__ */new Map),c=e=>{const t=Ue(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};Z(()=>{yt.clear();for(const e of o)e.route&&yt.set(e.id,e.route)},[o]);const u=te(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=te(e=>{var t;mt(e)||pt(e)?(t=e,window.dispatchEvent(new CustomEvent(Tr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=Kn;t&&ut.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,($n.get(i)??-1)>a)||or(o),t&&ut.delete(e)},50)},m=(e,t,n)=>{const r=Ie;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Ue(t))return e.length;if(t.shellOwned&&Xe(t,n.home))return 0;const r=Xe(t,n.home)?void 0:Ye(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Ue(e)&&!Xe(e,n.home)&&Ye(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!Xe(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&Xe(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Ue(e[t])&&!Xe(e[t],n.home)?Ye(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:De(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=te(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),f=te((e,t,n,r,o,a={})=>{if(!xe[e]||!ge(xe[e]))return;const s=`${e}:${t}`,l=wt();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Je(n),openedFrom:l},!!a.append))})},[]),w=te((e,t={})=>{if(!xe[e]||!ye(xe[e]))return;const n=xe[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Xn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const p=wt();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=te(()=>{},[]),g=te(()=>{},[]),v=d,b=d;/* @__PURE__ */
36
+ /* @__PURE__ */de(W,{}),
37
+ /* @__PURE__ */ue(R,{danger:!0,onClick:()=>{v(null),g.items.forEach(e=>t(e.id))},children:[
38
+ /* @__PURE__ */de(O,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${g.items.length})`]})]}),m&&f&&/* @__PURE__ */de(Nt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:x})]}),a)}var Tt=["/login","/forgot-password","/reset-password","/force-change-password"];function zt({children:e,windowAccentForRoute:t}){const n=pe(),r=Tt.some(e=>n.pathname.startsWith(e)),[o,i]=Z([]),a=_(o);G(()=>{a.current=o},[o]);const s=ee(Pe,De,De),l=_(/* @__PURE__ */new Map),c=e=>{const t=Ue(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};Q(()=>{yt.clear();for(const e of o)e.route&&yt.set(e.id,e.route)},[o]);const u=te(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=te(e=>{var t;mt(e)||pt(e)?(t=e,window.dispatchEvent(new CustomEvent(Tr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=Kn;t&&ut.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,($n.get(i)??-1)>a)||or(o),t&&ut.delete(e)},50)},m=(e,t,n)=>{const r=Ie;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Ue(t))return e.length;if(t.shellOwned&&Xe(t,n.home))return 0;const r=Xe(t,n.home)?void 0:Ye(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Ue(e)&&!Xe(e,n.home)&&Ye(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!Xe(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&Xe(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Ue(e[t])&&!Xe(e[t],n.home)?Ye(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:De(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=te(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),f=te((e,t,n,r,o,a={})=>{if(!xe[e]||!ge(xe[e]))return;const s=`${e}:${t}`,l=wt();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Ge(n),openedFrom:l},!!a.append))})},[]),w=te((e,t={})=>{if(!xe[e]||!ye(xe[e]))return;const n=xe[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Xn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const p=wt();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=te(()=>{},[]),g=te(()=>{},[]),v=d,b=d;/* @__PURE__ */
39
39
  return ue(nt.Provider,{value:{openWindows:o,openEntity:f,openPage:w,reorderWindows:p,closeEntity:v,minimize:y,items:[],openItems:o,restore:g,remove:b,restoreIfMinimized:()=>!1},children:[e,
40
- /* @__PURE__ */de(Lt,{openWindows:o,onRemove:d,onSplitView:Gr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&or(e)}})},onActivateById:ft}),
41
- /* @__PURE__ */de(Jr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
40
+ /* @__PURE__ */de(Lt,{openWindows:o,onRemove:d,onSplitView:Jr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&or(e)}})},onActivateById:ft}),
41
+ /* @__PURE__ */de(Gr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
42
42
  /* @__PURE__ */
43
- return de(Se.Provider,{value:c(e),children:/* @__PURE__ */de(Ke,{fallback:(t,n)=>/* @__PURE__ */de(_r,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */de(Re,{error:t,onReload:n})}),children:/* @__PURE__ */de(sn,{spec:st(e),children:/* @__PURE__ */de(oo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */de(lt,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */de(ht,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var At=400;function Dt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=_(null),s=_(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=_(!1),c=_(void 0),u=_(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},At)};Z(()=>{n&&!r&&h()},[n,r]),Z(()=>{d&&n&&!r&&h()},[d]),Z(()=>()=>clearTimeout(c.current),[]),Z(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?D(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),J(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Pt=null,It=/* @__PURE__ */new Set;function Wt(){return Pt}function Rt(e){if(Pt!==e){Pt=e;for(const e of It)e()}}function Kt(e){return It.add(e),()=>{It.delete(e)}}var $t=!1,Ot={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},jt=()=>{};function Ft(e){$t=e,Ot={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function qt(e,t){$t&&("submenu"===e?Ot.submenus++:Ot.menus++,Ot.menuKey=t)}function Bt(e){if(!$t)return jt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!$t)return;const r=performance.now()-t;"move"===e?Ot.moveMs+=r:Ot.resizeMs+=r}}function Ht(){const e=Ot;return Ot={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Ut=/* @__PURE__ */new Set([P,b]),Yt=e=>Ut.has(e)||"function"==typeof e&&"badge"===e.titleRole,Xt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Vt=/* @__PURE__ */new Set(["svg"]);function Gt(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Jt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Jt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Jt(e,t,n));if(!ne(e))return;const r=e;if(r.type===f)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===re)return void oe.toArray(r.props.children).forEach(e=>Jt(e,t,n));if("string"==typeof r.type){if(Vt.has(r.type))return;if(!Xt.has(r.type))return n.push(" "),oe.toArray(r.props.children).forEach(e=>Jt(e,t,n)),void n.push(" ")}const o=ie(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Yt(r.type)?t.badges:t.actions).push(o)}var _t=/* @__PURE__ */new Map,Zt=/* @__PURE__ */new Set,Qt=0;function en(){Qt++,Zt.forEach(e=>e())}function tn(e){return _t.get(e)}function nn(e){return Zt.add(e),()=>{Zt.delete(e)}}function rn(){return Qt}var on=Y(""),an=Y(null);function sn({spec:e,children:t}){/* @__PURE__ */
44
- return de(an.Provider,{value:e,children:t})}var ln=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),cn='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function un(e){return dn(e).replace(/\s+/g," ").trim()}function dn(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(dn).join("");if(ne(e)){const t=e,n="string"==typeof t.type?t.type:"";return ln.has(n)?"":` ${dn(t.props?.children)} `}return""}function hn(e){const t=V(on);Z(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var mn={};function pn(e,t,n){const r=V(on);Z(()=>{if(!r)return;mn[r]||(mn[r]=[]);const o={label:e,icon:n,onClick:t};return mn[r].push(o),()=>{mn[r]=(mn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function fn({title:e}){const t=_(null);return Z(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */de("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function wn(e){}function yn(){return V(on)}function gn({children:e,position:t="right",quiet:n=!1}){const r=V(C),[o,i]=Q(null);return Z(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?me(e,o):null}function vn({onClick:e,children:t,className:n}){const r=V(C);/* @__PURE__ */
45
- return de("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var bn="erp_window_positions",xn={};try{const e=localStorage.getItem(bn);e&&(xn=JSON.parse(e))}catch{}var kn=null;function En(){kn&&clearTimeout(kn),kn=setTimeout(()=>{try{localStorage.setItem(bn,JSON.stringify(xn))}catch{}},500)}var Cn="erp_activation_order",Mn=[];try{const e=localStorage.getItem(Cn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Mn=t)}catch{}var Nn=null;function Sn(){Nn&&clearTimeout(Nn),Nn=setTimeout(()=>{try{localStorage.setItem(Cn,JSON.stringify(Mn))}catch{}},500)}function Ln(e,t){xn[e]||(xn[e]=t,En())}function Tn(e){return xn[e]?{...xn[e]}:null}function zn(e,t){xn[e]=t,En()}function An(){const r=e(),o=t();let i=!1;for(const e of Object.keys(xn))n(xn[e],r,o)&&(delete xn[e],i=!0);i&&En()}var Dn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Pn=4e3,In=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},Wn={small:.8,medium:1,large:1.25,maximized:1.25},Rn=/* @__PURE__ */new Set,Kn=0,$n=/* @__PURE__ */new Map;var On=0;function jn(){return On}function Fn(){On++,E.forEach(e=>e())}var qn=/* @__PURE__ */new Map,Bn=/* @__PURE__ */new Map,Hn=/* @__PURE__ */new Map;function Un(){for(let e=k.length-1;e>=0;e--){const t=Hn.get(k[e]);if(t?.tab)return t.owner}return null}function Yn(){return ee(M,Un,()=>null)}var Xn=/* @__PURE__ */new Set;var Vn=null;function Gn(e){Vn=null,or(e)}function Jn(e){Vn=e;const t=qn.get(e);t&&Gn(t)}var _n=/* @__PURE__ */new Map;function Zn(e){return _n.get(e)?.holdsChanges()??!1}function Qn(e){const t=_n.get(e);return t?t.ask():Promise.resolve(!0)}function er(e){Vn===e&&(Vn=null)}function tr(e,t,n){if(n&&Hn.set(e,n),t)if(qn.set(t,e),Bn.set(e,t),Xn.delete(t)){k.unshift(e);const n=Mn.indexOf(t);-1!==n&&Mn.splice(n,1),Mn.unshift(t),Sn()}else!function(e,t){const n=Mn.indexOf(t);if(-1===n)return void k.push(e);let r=k.length;for(let e=0;e<k.length;e++){const t=Bn.get(k[e]);if(t&&Mn.indexOf(t)>n){r=e;break}}k.splice(r,0,e)}(e,t),-1===Mn.indexOf(t)&&(Mn.push(t),Sn());else k.push(e);Fn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Vn===t&&Gn(e)}function nr(e){return e?Hn.get(e)?.owner??Bn.get(e)??null:null}var rr=/* @__PURE__ */new Set;function or(e){const t=nr(N()),n=k.indexOf(e);-1!==n&&k.splice(n,1),k.push(e);const r=Hn.get(e);if(r?.root)for(const[e,t]of Hn){if(t.root||t.owner!==r.owner||Rn.has(e))continue;const n=k.indexOf(e);-1!==n&&k.splice(n,1),k.push(e)}Rn.delete(e);const o=Bn.get(e);if(o){const e=Mn.indexOf(o);-1!==e&&Mn.splice(e,1),Mn.push(o),Sn(),Vn&&Vn!==o&&(Vn=null)}Fn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=nr(N());i&&i!==t&&rr.forEach(e=>e(i))}function ir(e){const t=k.indexOf(e);-1!==t&&k.splice(t,1),Rn.add(e),$n.set(e,++Kn);const n=Bn.get(e);if(n){const e=Mn.indexOf(n);-1!==e&&(Mn.splice(e,1),Sn())}Fn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var ar=/* @__PURE__ */new Set;var sr=8,lr=32;function cr(){return e()}var ur=c.windowBar,dr=80,hr=384,mr=400;function pr(e,t=cr()){const n=Math.min(Math.max(e.x,t.x+dr-e.w),t.x+t.w-dr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-ur);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function fr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=cr();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function wr(e){const t=cr(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var yr=null;function gr(e){const t=(yr||((yr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${F.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(yr)),yr);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function vr(){yr&&(yr.style.opacity="0",yr.style.display="none")}var br=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],xr=350,kr=200;function Er({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=Q(!1),s=_(void 0),l=_(void 0);Z(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),xr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),kr)};/* @__PURE__ */
43
+ return de(Se.Provider,{value:c(e),children:/* @__PURE__ */de(Ke,{fallback:(t,n)=>/* @__PURE__ */de(_r,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */de(We,{error:t,onReload:n})}),children:/* @__PURE__ */de(sn,{spec:st(e),children:/* @__PURE__ */de(oo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */de(lt,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */de(ht,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var At=400;function Dt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=_(null),s=_(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=_(!1),c=_(void 0),u=_(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},At)};Q(()=>{n&&!r&&h()},[n,r]),Q(()=>{d&&n&&!r&&h()},[d]),Q(()=>()=>clearTimeout(c.current),[]),Q(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?D(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),G(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Pt=null,It=/* @__PURE__ */new Set;function Rt(){return Pt}function Wt(e){if(Pt!==e){Pt=e;for(const e of It)e()}}function Kt(e){return It.add(e),()=>{It.delete(e)}}var $t=!1,Ot={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},jt=()=>{};function Ft(e){$t=e,Ot={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function qt(e,t){$t&&("submenu"===e?Ot.submenus++:Ot.menus++,Ot.menuKey=t)}function Bt(e){if(!$t)return jt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!$t)return;const r=performance.now()-t;"move"===e?Ot.moveMs+=r:Ot.resizeMs+=r}}function Ht(){const e=Ot;return Ot={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Ut=/* @__PURE__ */new Set([P,b]),Yt=e=>Ut.has(e)||"function"==typeof e&&"badge"===e.titleRole,Xt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Vt=/* @__PURE__ */new Set(["svg"]);function Jt(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Gt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Gt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Gt(e,t,n));if(!ne(e))return;const r=e;if(r.type===f)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===re)return void oe.toArray(r.props.children).forEach(e=>Gt(e,t,n));if("string"==typeof r.type){if(Vt.has(r.type))return;if(!Xt.has(r.type))return n.push(" "),oe.toArray(r.props.children).forEach(e=>Gt(e,t,n)),void n.push(" ")}const o=ie(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Yt(r.type)?t.badges:t.actions).push(o)}var _t=/* @__PURE__ */new Map,Qt=/* @__PURE__ */new Set,Zt=0;function en(){Zt++,Qt.forEach(e=>e())}function tn(e){return _t.get(e)}function nn(e){return Qt.add(e),()=>{Qt.delete(e)}}function rn(){return Zt}var on=Y(""),an=Y(null);function sn({spec:e,children:t}){/* @__PURE__ */
44
+ return de(an.Provider,{value:e,children:t})}var ln=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),cn='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function un(e){return dn(e).replace(/\s+/g," ").trim()}function dn(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(dn).join("");if(ne(e)){const t=e,n="string"==typeof t.type?t.type:"";return ln.has(n)?"":` ${dn(t.props?.children)} `}return""}function hn(e){const t=V(on);Q(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var mn={};function pn(e,t,n){const r=V(on);Q(()=>{if(!r)return;mn[r]||(mn[r]=[]);const o={label:e,icon:n,onClick:t};return mn[r].push(o),()=>{mn[r]=(mn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function fn({title:e}){const t=_(null);return Q(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */de("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function wn(e){}function yn(){return V(on)}function gn({children:e,position:t="right",quiet:n=!1}){const r=V(C),[o,i]=Z(null);return Q(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?me(e,o):null}function vn({onClick:e,children:t,className:n}){const r=V(C);/* @__PURE__ */
45
+ return de("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var bn="erp_window_positions",xn={};try{const e=localStorage.getItem(bn);e&&(xn=JSON.parse(e))}catch{}var kn=null;function En(){kn&&clearTimeout(kn),kn=setTimeout(()=>{try{localStorage.setItem(bn,JSON.stringify(xn))}catch{}},500)}var Cn="erp_activation_order",Mn=[];try{const e=localStorage.getItem(Cn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Mn=t)}catch{}var Nn=null;function Sn(){Nn&&clearTimeout(Nn),Nn=setTimeout(()=>{try{localStorage.setItem(Cn,JSON.stringify(Mn))}catch{}},500)}function Ln(e,t){xn[e]||(xn[e]=t,En())}function Tn(e){return xn[e]?{...xn[e]}:null}function zn(e,t){xn[e]=t,En()}function An(){const r=e(),o=t();let i=!1;for(const e of Object.keys(xn))n(xn[e],r,o)&&(delete xn[e],i=!0);i&&En()}var Dn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Pn=4e3,In=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},Rn={small:.8,medium:1,large:1.25,maximized:1.25},Wn=/* @__PURE__ */new Set,Kn=0,$n=/* @__PURE__ */new Map;var On=0;function jn(){return On}function Fn(){On++,E.forEach(e=>e())}var qn=/* @__PURE__ */new Map,Bn=/* @__PURE__ */new Map,Hn=/* @__PURE__ */new Map;function Un(){for(let e=k.length-1;e>=0;e--){const t=Hn.get(k[e]);if(t?.tab)return t.owner}return null}function Yn(){return ee(M,Un,()=>null)}var Xn=/* @__PURE__ */new Set;var Vn=null;function Jn(e){Vn=null,or(e)}function Gn(e){Vn=e;const t=qn.get(e);t&&Jn(t)}var _n=/* @__PURE__ */new Map;function Qn(e){return _n.get(e)?.holdsChanges()??!1}function Zn(e){const t=_n.get(e);return t?t.ask():Promise.resolve(!0)}function er(e){Vn===e&&(Vn=null)}function tr(e,t,n){if(n&&Hn.set(e,n),t)if(qn.set(t,e),Bn.set(e,t),Xn.delete(t)){k.unshift(e);const n=Mn.indexOf(t);-1!==n&&Mn.splice(n,1),Mn.unshift(t),Sn()}else!function(e,t){const n=Mn.indexOf(t);if(-1===n)return void k.push(e);let r=k.length;for(let e=0;e<k.length;e++){const t=Bn.get(k[e]);if(t&&Mn.indexOf(t)>n){r=e;break}}k.splice(r,0,e)}(e,t),-1===Mn.indexOf(t)&&(Mn.push(t),Sn());else k.push(e);Fn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Vn===t&&Jn(e)}function nr(e){return e?Hn.get(e)?.owner??Bn.get(e)??null:null}var rr=/* @__PURE__ */new Set;function or(e){const t=nr(N()),n=k.indexOf(e);-1!==n&&k.splice(n,1),k.push(e);const r=Hn.get(e);if(r?.root)for(const[e,t]of Hn){if(t.root||t.owner!==r.owner||Wn.has(e))continue;const n=k.indexOf(e);-1!==n&&k.splice(n,1),k.push(e)}Wn.delete(e);const o=Bn.get(e);if(o){const e=Mn.indexOf(o);-1!==e&&Mn.splice(e,1),Mn.push(o),Sn(),Vn&&Vn!==o&&(Vn=null)}Fn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=nr(N());i&&i!==t&&rr.forEach(e=>e(i))}function ir(e){const t=k.indexOf(e);-1!==t&&k.splice(t,1),Wn.add(e),$n.set(e,++Kn);const n=Bn.get(e);if(n){const e=Mn.indexOf(n);-1!==e&&(Mn.splice(e,1),Sn())}Fn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var ar=/* @__PURE__ */new Set;var sr=8,lr=32;function cr(){return e()}var ur=c.windowBar,dr=80,hr=384,mr=400;function pr(e,t=cr()){const n=Math.min(Math.max(e.x,t.x+dr-e.w),t.x+t.w-dr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-ur);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function fr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=cr();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function wr(e){const t=cr(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var yr=null;function gr(e){const t=(yr||((yr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${F.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(yr)),yr);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function vr(){yr&&(yr.style.opacity="0",yr.style.display="none")}var br=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],xr=350,kr=200;function Er({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=Z(!1),s=_(void 0),l=_(void 0);Q(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),xr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),kr)};/* @__PURE__ */
46
46
  return ue("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,children:[
47
- /* @__PURE__ */de("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */de("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:u,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-line bg-surface p-2 shadow-lg",children:br.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */de("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:u,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */de("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Cr="rosh-gesture-style";var Mr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},Nr=4;function Sr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(Cr))return;const e=document.createElement("style");e.id=Cr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=Bt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Lr(e){const t=k.indexOf(e);if(-1===t)return-1;const n=F.window+t*F.windowStep,r=Hn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of Hn){if(!t.root||t.owner!==r.owner)continue;const n=k.indexOf(e);-1!==n&&(o=Math.max(o,F.window+n*F.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=k.length-1;e>=0;e--)ar.has(k[e])||k.splice(e,1);Mn=Mn.filter(e=>{const t=qn.get(e);return null!=t&&ar.has(t)}),Sn(),Fn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Tr="modal-close-request";function zr(e){ee(M,jn);const t=V(C);if(k.length<=1)return!0;if(e){const t=qn.get(e);if(null!=t)return N()===t}return t?.active??null!=N()}var Ar=!1,Dr=/* @__PURE__ */new Set;function Pr(e){return Dr.add(e),()=>Dr.delete(e)}function Ir(){return Ar}function Wr(e){Ar!==e&&(Ar=e,Dr.forEach(e=>e()))}function Rr(){Wr(!Ar)}function Kr(){Wr(!1)}var $r=null,Or=/* @__PURE__ */new Set;function jr(e){return Or.add(e),()=>Or.delete(e)}function Fr(){return $r}function qr(e){$r!==e&&($r=e,Or.forEach(e=>e()))}var Br=null,Hr=/* @__PURE__ */new Set;function Ur(e){return Hr.add(e),()=>Hr.delete(e)}function Yr(){return Br}function Xr(e){Br!==e&&(Br=e,Hr.forEach(e=>e()))}function Vr(){if(!Br)return void Wr(!1);qr(Br),Xr(null),Wr(!1)}function Gr(){Wr(!Ar),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Jr(){const e=ee(Pr,Ir),[t,n]=Q(e),[r,o]=Q(e);return Z(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?me(
48
- /* @__PURE__ */de("div",{onMouseDown:e=>{e.stopPropagation(),Wr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:F.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function _r({open:t,onClose:l,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:y,bodyScroll:b,onMinimize:x,initialBox:E,actions:L,actionsLeft:D,editing:P=!1,edit:K,allowPinOnTop:j,initialPosition:q,widget:B,compact:Y,appStyle:X,flushBody:G,autoHeight:re,autoMinHeight:oe,autoWidth:le,widgetMenu:ce,dimensions:pe,windowKey:fe,openedFromKey:we,accentRgb:ye,children:ge}){const[ve,be]=Q(()=>r()),xe=T()&&!ve,ke=z()&&!!B,[Ee,Ce]=Q(0),[Me,Ne]=Q(!1),Le=_(null),Te=_(0);Z(()=>{Te.current=Ee},[Ee]);const ze=te(e=>{xe&&(Le.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Ne(!0),Rt(we??null))},[xe,we]),Ae=ee(Kt,Wt);Z(()=>{if(!Me)return;const e=e=>{if(!Le.current)return;const t=e.clientX-Le.current.startX;if(Math.abs(e.clientY-Le.current.startY)>Math.abs(t)+12)return Le.current=null,Ne(!1),Ce(0),void Rt(null);Ce(Math.max(0,t))},t=()=>{if(!Le.current)return;const e=.3*window.innerWidth,t=Te.current>e;Le.current=null,Ne(!1),t?(Ce(window.innerWidth),setTimeout(()=>{l(),Ce(0),Rt(null)},180)):(Ce(0),Rt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[Me]);const[De,Pe]=Q(c),Ie=U(),We=Ie.window;Z(()=>{Pe(c)},[c]);const Re=ae(()=>un(De).trim()||void 0,[De]),Oe=se(),[Fe,qe]=Q(!1),Be=_(!1),[He,Ue]=Q(!1),[Ye,Xe]=Q(null),Ve=V(an),Ge=V(Se),{prefs:Je,save:_e}=A(),Ze=!!Je.window_accent_stripe,Qe=Je.favorite_documents||[],et=!!Ve&&Qe.some(e=>e.entityType===Ve.entityType&&e.entityId===Ve.entityId),tt=te(()=>{if(!Ve)return;const e=et?Qe.filter(e=>!(e.entityType===Ve.entityType&&e.entityId===Ve.entityId)):[...Qe,{entityType:Ve.entityType,entityId:Ve.entityId,label:Ve.label}];_e({favorite_documents:e})},[Ve,et,Qe,_e]),[nt,rt]=Q(null),[it,st]=Q("top-right"===q?"right":"left"),lt=_(!1),ct=_(null);J(()=>{const e=ct.current;e&&(ye?e.style.setProperty("--window-accent-rgb",ye):e.style.removeProperty("--window-accent-rgb"))},[ye]);const ut=_(!1),dt=_(null),ht=_(null),mt=_(null),[pt,ft]=Q(!1),wt=_(null),yt=_(null),gt=_(null),[vt,bt]=Q(!1);J(()=>{const e=yt.current,t=gt.current;if(!e||!t)return;const n=()=>bt(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=y&&!1!==y]);const xt=!!K&&!B&&!Y&&!X&&(K.editing||"hidden"!==K.state),kt=!!(y||L||D)||pt||xt,Et=V($e),Ct=""!==V(on),Mt=_(null);Mt.current=Ge?{owner:Ge.key,tab:Ge.tab,root:!Ct}:null;const Nt=fe||(Ge&&!Ct?Ge.key:null),St=!!Et&&!Ct&&Et.enabled&&Et.hasState&&(P||Et.declaredEditable)&&!Et.handMounted&&kt&&!B&&!Y&&!X&&!xe,Lt=/* @__PURE__ */de(O,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),Tt=u&&ne(u)?ie(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Lt,zt=()=>/* @__PURE__ */de("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Xe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:Tt}),At=40,{minimize:Pt,items:It,restoreIfMinimized:$t,openWindows:Ot}=at(),jt=_(`modal-${Math.random().toString(36).slice(2,8)}`).current;Z(()=>{if(B)return ar.add(jt),()=>{ar.delete(jt)}},[B,jt]),Z(()=>{const e=e=>{const t=e.detail;t?.id===jt&&Pe(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[jt]);const[Ft,qt]=Q(F.window),Bt=function(e){const t=ee(M,N);return k.length<=1||t===e}(jt),Ht=_(K);Ht.current=K;const Ut=!!K&&!K.editing&&"enabled"===K.state;Z(()=>{if(!t||!Bt||!Ut)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(g(e.target,ct.current)||(e.preventDefault(),e.stopPropagation(),Ht.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Bt,Ut]);const Yt=function(e){return ee(M,()=>Rn.has(e))}(jt);Dt({panelRef:ct,bodyRef:dt,open:t,widget:!!B,active:Bt,minimized:Yt});const Xt=ee(Pr,Ir),Vt=ee(jr,Fr),Jt=ee(Ur,Yr),Zt=!j&&!B,Qt=Xt&&Zt,[tn,nn]=Q(!1),rn=Qt&&Jt===jt,[sn,ln]=Q(!1),dn=sn&&Zt&&Vt===jt?"picked":null,hn=_(Qt);Z(()=>{if(hn.current&&!Qt){ln(!0);const e=setTimeout(()=>{ln(!1),$r===jt&&qr(null)},700);return hn.current=Qt,()=>clearTimeout(e)}hn.current=Qt},[Qt,jt]),Z(()=>{Qt||nn(!1)},[Qt]),Z(()=>{const e=ht.current,t=mt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ft(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),Z(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ct.current){const t=ct.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ht.current,n=mt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const pn=_(!1),fn=te(e,[]),wn=te(()=>{const t=e(),n=pe?pe[0]:Dn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Wn[In()],l=pe?Math.min(pe[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(k.length-1),u=Math.max(At,(i-l)/2),d=(o-a)/2,m=t.h-At-l-u;return"top-right"===q?{x:t.x+t.w-a-At,y:t.y+At,w:a,h:l}:"top-left"===q?{x:t.x+At,y:t.y+At,w:a,h:l}:{x:t.x+Math.max(At,(o-a)/2+At)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),yn=_(!1);t||(yn.current=!1);const gn=fe||d||null;Z(()=>{if(!t)return;tr(jt,gn,Mt.current??void 0),fe||or(jt),pn.current=!1,qt(Lr(jt));const e=()=>{qt(Lr(jt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===fe;if(!e.label)return!1;const t=ct.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(or(jt),zn.current)return;const t=cr(),n=Math.min(Xn.current.w,t.w-40),o=Math.min(Xn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;kn({x:i,y:a,w:n,h:o}),Un(!1)},i=e=>{const t=e.detail;r(t)&&(or(jt),Xe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==fe)return;or(jt);const t=Xn.current,n=function(e,t=cr()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=ct.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}kn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=k.indexOf(e);-1!==t&&(k.splice(t,1),Fn()),Rn.delete(e),$n.delete(e),Hn.delete(e);const n=Bn.get(e);n&&(Bn.delete(e),qn.delete(n))}(jt),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,jt,gn,fn]);const vn=!B&&"maximized"===In(),[bn,kn]=Q(()=>{if(gn&&xn[gn]){const e={...xn[gn]};return pe&&(e.w=pe[0],re||(e.h=pe[1])),pr(e)}return E?{x:E.x,y:E.y,w:E.w,h:E.h}:vn?fn():wn()}),[Cn,Mn]=Q(()=>!re),Nn=_(ve),Sn=_(null);Z(()=>{const e=()=>{const e=r();e!==Nn.current&&Sn.current?.(e),Nn.current=e,be(e),qt(Lr(jt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[jt]);const Ln=ve&&!!Ge?.tab&&!Ct&&!B&&!xe,Tn=Ln,zn=_(Tn);zn.current=Tn;const An=Yn(),Kn=ve&&!!Ge?.tab&&!B&&!xe&&!Xt&&An!==Ge.key,On=!!B&&ve&&!Xt&&null!==An,[jn,Un]=Q(()=>gn&&xn[gn]||E?Tn:Tn||vn),Xn=_(bn);Xn.current=bn;const Vn=_(jn);J(()=>{Vn.current=jn},[jn]),J(()=>{if(Cn||Ln)return;const e=ct.current,t=dt.current;if(!e||!t)return;const n=oe??(B?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Xn.current.y)-24),g=w?Math.min(Xn.current.h,y):Math.min(Math.max(n,u+p),y),v=Math.abs(g-o)>1;v&&(o=g,kn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),B||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Mn(!0)},160)))},l=new ResizeObserver(s);s(),wt.current&&l.observe(wt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[Cn,B,oe,kt,Ln]),J(()=>{if(!re||!Cn||B||!t)return;const e=wt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||jn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=oe??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Xn.current.y)-24);kn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[re,Cn,B,t,jn,oe]);const Gn=!1!==le&&!B&&!X&&!xe,[Jn,Zn]=Q(()=>!Gn);J(()=>{if(Jn||!t)return;if(!Gn||jn)return void Zn(!0);const n=ct.current,r=dt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=Xn.current.w,c=0;const u=()=>Zn(!0),d=()=>{c=0;const t=Xn.current;if(Math.abs(t.w-l)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(m[t])});const v=a(t,s(t.w,w,g),d,At);v!==t&&(l=v.w,kn(v))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Pn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Jn,t,Gn,jn]);const Qn=_(null),er=!(!Ge?.tab||Ct||B||xe);Sn.current=t=>{if(!er)return;if(t)return Qn.current||(Qn.current={box:{...Xn.current},maximized:Vn.current}),void(Vn.current=!0);const r=Qn.current;Qn.current=null;const o=e();if(r?.maximized)return Vn.current=!0,Un(!0),void kn(o);const i=r?.box??(gn?xn[gn]:void 0);if(Vn.current=!1,Un(!1),i&&!n(i,o,!1)){const e={...i};pe&&(e.w=pe[0],re||(e.h=pe[1])),kn(pr(e))}else kn(wn())},Z(()=>{Tn&&(Vn.current=!0,Un(!0),kn(fn()))},[Tn,fn]),Z(()=>{if(B)return;const e=()=>{const e=gn?xn[gn]:void 0;if(Vn.current=!1,Un(!1),e){const t={...e};pe&&(t.w=pe[0],re||(t.h=pe[1])),kn(pr(t))}else kn(wn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[B,wn,gn]),Z(()=>{t&&gn&&!Ln&&(xn[gn]=bn,En()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[bn,t,gn,Ln]),Z(()=>{if(!t)return;const e=()=>{Vn.current?kn(fn()):document.body.classList.contains("rosh-gesturing")||kn(pr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return jn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,jn,fn]),Z(()=>{if(t&&(qe(!1),Be.current=!1,lt.current=!1,Zn(!Gn),!zn.current)){if(gn&&xn[gn]){const e=xn[gn];return void kn(t=>pr({...e,...re?{h:t.h}:{},...Gn?{x:t.x,w:t.w}:{}}))}E&&(kn({x:E.x,y:E.y,w:E.w,h:E.h}),Un(E.maximized))}},[t]),Z(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{ct.current?.contains(t.target)&&!Be.current&&(Be.current=!0,e=setTimeout(()=>qe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const nr="auto"===m?Fe:!0===m,rr=Ge&&!Ct?Ge.key:null,ur=ae(()=>Gt(De),[De]),dr=_({shortcutSpec:Ve,isOnDesktop:et,toggleDesktopShortcut:tt,taskbarStrings:Ie.taskbar});J(()=>{dr.current={shortcutSpec:Ve,isOnDesktop:et,toggleDesktopShortcut:tt,taskbarStrings:Ie.taskbar}});const fr=_(null);fr.current||(fr.current={open:(e,t)=>Xe({x:e,y:t}),items:()=>{const e=dr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of mn[jt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),Z(()=>{if(t&&rr)return()=>{return e=rr,void(_t.delete(e)&&en());var e}},[t,rr]),ot(!(fe||!t)&&nr);const yr=te(()=>nr||"auto"===m&&Be.current,[nr,m]),br=te(async e=>{if(lt.current)return!1;if(!yr())return!0;lt.current=!0;const t=Re,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await w({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return lt.current=!1,r},[yr,Re]),xr=te(()=>lt.current?Promise.resolve():yr()?br("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[yr,br,l]),kr=te(async()=>{await br("discard")&&(Be.current=!1,qe(!1),Ht.current?.onDiscard())},[br]),Cr=te(async()=>{const e=await br("switch");return e&&(Be.current=!1,qe(!1)),e},[br]),zr=_(()=>!1);J(()=>{zr.current=yr}),J(()=>{if(!t||!fe)return;const e={holdsChanges:()=>zr.current(),ask:Cr};return _n.set(fe,e),()=>{_n.get(fe)===e&&_n.delete(fe)}},[t,fe,Cr]),J(()=>{if(!t||!Nt)return;const e=e=>{e.detail?.windowKey===Nt&&xr()};return window.addEventListener(Tr,e),()=>window.removeEventListener(Tr,e)},[t,Nt,xr]);const Ar=_(null),Dr=te(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Xe(null),or(jt),zn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=ct.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Ar.current){const t=Ar.current;Ar.current=null,d=t.w,u=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Xn.current.x,c=s?s.top:Xn.current.y,u=s?s.height:Xn.current.h,d=s?s.width:Xn.current.w;Un(!1),kn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<Nr&&Math.abs(e.clientY-i)<Nr)return;r=Sr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),Xn.current={...Xn.current,x:s,y:u},!B){const t=function(e,t){const n=cr(),r=e<=n.x+sr,o=e>=n.x+n.w-sr,i=t<=n.y+sr,a=t>=n.y+n.h-sr,s=e<=n.x+lr,l=e>=n.x+n.w-lr,c=t<=n.y+lr,u=t>=n.y+n.h-lr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?gr(wr(t)):vr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),vr();const e=pr({...Xn.current});if(Xn.current=e,!B&&h){Ar.current={x:l,y:c,w:d,h:u};const e=wr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void kn(e)}if(B){const t=e.x+e.w/2,n=window.innerWidth/2;st(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),kn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),Rr=te((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=ct.current,l=s?.getBoundingClientRect(),c=l?l.left:Xn.current.x,u=l?l.top:Xn.current.y,d=l?l.width:Xn.current.w,h=l?l.height:Xn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Un(!1),kn({x:c,y:u,w:d,h:h}),Xn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Xn.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<Nr&&Math.abs(e.clientY-a)<Nr)return;o=Sr(n,r,Mr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(hr,d+e)),w&&(i=Math.max(mr,h+t)),m){const t=Math.max(hr,d-e);n=c+d-t,o=t}if(p){const e=Math.max(mr,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),kn({...Xn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Kr=te(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),or(jt),"Enter"===e.key)return void(jn?(Un(!1),kn(wn())):(Un(!0),kn(fn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Ar.current||(Ar.current={...Xn.current})};if(r<0)return e(),Un(!0),void kn(fn());if(r>0){if(jn)return Un(!1),void kn(wn());if(Ar.current){const e=pr(Ar.current);return Ar.current=null,Xn.current=e,void kn(e)}return void ir(jt)}e(),Un(!1);const t=wr(n<0?"left":"right");return Xn.current=t,void kn(t)}if(jn)return;const o=Xn.current,i=e.shiftKey?{...o,w:Math.max(hr,o.w+24*n),h:Math.max(mr,o.h+24*r)}:pr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Xn.current=i,kn(i)},[jt,jn,wn,fn]),Or=te(e=>{Ar.current||(Ar.current={...Xn.current}),Un(!1);const t=wr(e);Xn.current=t,kn(t),or(jt)},[jt]),Br=Tn||Qt?{}:{tabIndex:0,role:"group","aria-label":Re?`${Re} — ${We.windowSuffix}`:We.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:Kr},Hr=()=>{Un(!0),kn(fn())},Xr=te(()=>{const e=ct.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(cn);t&&!t.disabled&&t.click()}},[]);Z(()=>{if(!t)return;if(B)return;const e=e=>{if(k[k.length-1]===jt&&!g(e.target,ct.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Xr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ct.current?.contains(t)))return;if(t.closest(S))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Xr,jt,B]),Z(()=>{if(!t)return;const e=e=>{k[k.length-1]===jt&&(g(e.target,ct.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:jt}})),Be.current=!1,qe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:jt}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),Z(()=>{if(!t)return;if(B)return;const e=e=>{if("Escape"===e.key&&k[k.length-1]===jt){if(H(e))return e.preventDefault(),void e.stopPropagation();if(Ln&&!P)return;e.preventDefault(),e.stopPropagation(),xr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,xr,jt,B,Ln,P]);const Vr=t&&(void 0!==p||void 0!==f),[Gr]=Q(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Jr=Ln&&!Ge?.home&&ur.actions.length>0;Z(()=>{t&&rr&&function(e,t){const n=_t.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(_t.set(e,t),en())}(rr,{title:ur.text||Re,dirty:nr,copy:ur.copy,actions:Jr&&Gr?Gr:void 0,menu:fr.current??void 0})},[t,rr,Re,nr,ur.text,ur.copy,Jr,Gr]);const _r=te(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-on-accent flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(Z(()=>{if(!t)return;const e=e=>{if(k[k.length-1]!==jt)return;if(g(e.target,ct.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Vr&&(e.preventDefault(),p?p():_r("bottom")),"k"===e.key&&Vr&&(e.preventDefault(),f?f():_r("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Vr,_r,jt]),!t||yn.current)return null;const Zr=Qt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,u=cr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(jt):null,Qr=Qt&&Zr?Math.min(Zr.w/bn.w,Zr.h/bn.h):1,eo=(()=>{if(Qt&&Zr){const e=Qr,t=bn.w*e,n=bn.h*e,r=Zr.x+(Zr.w-t)/2-bn.x,o=Zr.y+(Zr.h-n)/2-bn.y,i=tn||rn;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:F.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(sn&&Zt){const e="picked"===dn;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:F.expose+30}:{}}}return null})(),to=v({modal:!1,titleId:!B&&(Ln?!Ge?.home:!xe)?Oe:void 0,label:ur.text||Re}),no=/* @__PURE__ */ue("div",{children:[
49
- /* @__PURE__ */ue("div",{ref:ct,"data-modal-panel":!0,"data-modal-id":jt,"data-window-key":fe||void 0,...j?{"data-utility":""}:{},...He?{"data-pinned-top":""}:{},...B?{"data-widget":""}:{},...Ge?{"data-window-owner":Ge.key}:{},...Ge&&!Ct?{"data-window-root":""}:{},...Ln?{"data-window-tab":""}:{},...to,className:Ln?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(B?Bt?"shadow-xl":"shadow-lg":"border "+(Bt?"shadow-xl border-line":"shadow-lg border-line-strong")),onMouseDownCapture:e=>{if(ut.current=!1,Qt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),qr(jt),Wr(!1),void or(jt)}if(!Bt&&!B&&!He&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ct.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),ut.current=!0,Xe(null),or(jt),window.addEventListener("mouseup",()=>{setTimeout(()=>{ut.current=!1},0)},{once:!0}))}},onClickCapture:e=>{ut.current&&(ut.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Qt)return;Xe(null);e.target.closest("[data-modal-panel]")===ct.current&&(e.target.closest("button, input, a, select, textarea")||or(jt))},style:xe?{zIndex:Ft+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Ee}px)`,transition:Me?"none":"transform 180ms ease-out",...B?{display:"none"}:{},...Ft<0?{display:"none"}:{},...Bt||He||Ae&&fe===Ae?{}:{display:"none"}}:{zIndex:He?F.pinnedWindow:Ft+1,width:bn.w,height:bn.h,top:bn.y,...B&&"right"===it?{right:window.innerWidth-bn.x-bn.w}:{left:bn.x},...Ft<0&&!He?{display:"none"}:{},...ke?{display:"none"}:{},...Kn||On?{visibility:"hidden",pointerEvents:"none"}:{},...eo??{}},children:[xe&&!B&&/* @__PURE__ */de("div",{onPointerDown:ze,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),B?null:Ln?Ge?.home?null:/* @__PURE__ */ue(he,{children:[
50
- /* @__PURE__ */de("h2",{id:Oe,"data-window-title":!0,className:"sr-only",children:ur.text||Re}),Jr&&Gr&&me(
51
- /* @__PURE__ */de(he,{children:ur.actions}),Gr),ur.badges.length>0&&/* @__PURE__ */de("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:ur.badges})]}):xe?null:
47
+ /* @__PURE__ */de("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */de("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:u,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-line bg-surface p-2 shadow-lg",children:br.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */de("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:u,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */de("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Cr="rosh-gesture-style";var Mr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},Nr=4;function Sr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(Cr))return;const e=document.createElement("style");e.id=Cr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=Bt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Lr(e){const t=k.indexOf(e);if(-1===t)return-1;const n=F.window+t*F.windowStep,r=Hn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of Hn){if(!t.root||t.owner!==r.owner)continue;const n=k.indexOf(e);-1!==n&&(o=Math.max(o,F.window+n*F.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=k.length-1;e>=0;e--)ar.has(k[e])||k.splice(e,1);Mn=Mn.filter(e=>{const t=qn.get(e);return null!=t&&ar.has(t)}),Sn(),Fn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Tr="modal-close-request";function zr(e){ee(M,jn);const t=V(C);if(k.length<=1)return!0;if(e){const t=qn.get(e);if(null!=t)return N()===t}return t?.active??null!=N()}var Ar=!1,Dr=/* @__PURE__ */new Set;function Pr(e){return Dr.add(e),()=>Dr.delete(e)}function Ir(){return Ar}function Rr(e){Ar!==e&&(Ar=e,Dr.forEach(e=>e()))}function Wr(){Rr(!Ar)}function Kr(){Rr(!1)}var $r=null,Or=/* @__PURE__ */new Set;function jr(e){return Or.add(e),()=>Or.delete(e)}function Fr(){return $r}function qr(e){$r!==e&&($r=e,Or.forEach(e=>e()))}var Br=null,Hr=/* @__PURE__ */new Set;function Ur(e){return Hr.add(e),()=>Hr.delete(e)}function Yr(){return Br}function Xr(e){Br!==e&&(Br=e,Hr.forEach(e=>e()))}function Vr(){if(!Br)return void Rr(!1);qr(Br),Xr(null),Rr(!1)}function Jr(){Rr(!Ar),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Gr(){const e=ee(Pr,Ir),[t,n]=Z(e),[r,o]=Z(e);return Q(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?me(
48
+ /* @__PURE__ */de("div",{onMouseDown:e=>{e.stopPropagation(),Rr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:F.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function _r({open:t,onClose:l,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:y,bodyScroll:b,onMinimize:x,initialBox:E,actions:L,actionsLeft:D,editing:P=!1,edit:K,allowPinOnTop:j,initialPosition:q,widget:B,compact:Y,appStyle:X,flushBody:J,autoHeight:re,autoMinHeight:oe,autoWidth:le,widgetMenu:ce,dimensions:pe,windowKey:fe,openedFromKey:we,accentRgb:ye,children:ge}){const[ve,be]=Z(()=>r()),xe=T()&&!ve,ke=z()&&!!B,[Ee,Ce]=Z(0),[Me,Ne]=Z(!1),Le=_(null),Te=_(0);Q(()=>{Te.current=Ee},[Ee]);const ze=te(e=>{xe&&(Le.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Ne(!0),Wt(we??null))},[xe,we]),Ae=ee(Kt,Rt);Q(()=>{if(!Me)return;const e=e=>{if(!Le.current)return;const t=e.clientX-Le.current.startX;if(Math.abs(e.clientY-Le.current.startY)>Math.abs(t)+12)return Le.current=null,Ne(!1),Ce(0),void Wt(null);Ce(Math.max(0,t))},t=()=>{if(!Le.current)return;const e=.3*window.innerWidth,t=Te.current>e;Le.current=null,Ne(!1),t?(Ce(window.innerWidth),setTimeout(()=>{l(),Ce(0),Wt(null)},180)):(Ce(0),Wt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[Me]);const[De,Pe]=Z(c),Ie=U(),Re=Ie.window;Q(()=>{Pe(c)},[c]);const We=ae(()=>un(De).trim()||void 0,[De]),Oe=se(),[Fe,qe]=Z(!1),Be=_(!1),[He,Ue]=Z(!1),[Ye,Xe]=Z(null),Ve=V(an),Je=V(Se),{prefs:Ge,save:_e}=A(),Qe=!!Ge.window_accent_stripe,Ze=Ge.favorite_documents||[],et=!!Ve&&Ze.some(e=>e.entityType===Ve.entityType&&e.entityId===Ve.entityId),tt=te(()=>{if(!Ve)return;const e=et?Ze.filter(e=>!(e.entityType===Ve.entityType&&e.entityId===Ve.entityId)):[...Ze,{entityType:Ve.entityType,entityId:Ve.entityId,label:Ve.label}];_e({favorite_documents:e})},[Ve,et,Ze,_e]),[nt,rt]=Z(null),[it,st]=Z("top-right"===q?"right":"left"),lt=_(!1),ct=_(null);G(()=>{const e=ct.current;e&&(ye?e.style.setProperty("--window-accent-rgb",ye):e.style.removeProperty("--window-accent-rgb"))},[ye]);const ut=_(!1),dt=_(null),ht=_(null),mt=_(null),[pt,ft]=Z(!1),wt=_(null),yt=_(null),gt=_(null),[vt,bt]=Z(!1);G(()=>{const e=yt.current,t=gt.current;if(!e||!t)return;const n=()=>bt(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=y&&!1!==y]);const xt=!!K&&!B&&!Y&&!X&&(K.editing||"hidden"!==K.state),kt=!!(y||L||D)||pt||xt,Et=V($e),Ct=""!==V(on),Mt=_(null);Mt.current=Je?{owner:Je.key,tab:Je.tab,root:!Ct}:null;const Nt=fe||(Je&&!Ct?Je.key:null),St=!!Et&&!Ct&&Et.enabled&&Et.hasState&&(P||Et.declaredEditable)&&!Et.handMounted&&kt&&!B&&!Y&&!X&&!xe,Lt=/* @__PURE__ */de(O,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),Tt=u&&ne(u)?ie(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Lt,zt=()=>/* @__PURE__ */de("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Xe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:Tt}),At=40,{minimize:Pt,items:It,restoreIfMinimized:$t,openWindows:Ot}=at(),jt=_(`modal-${Math.random().toString(36).slice(2,8)}`).current;Q(()=>{if(B)return ar.add(jt),()=>{ar.delete(jt)}},[B,jt]),Q(()=>{const e=e=>{const t=e.detail;t?.id===jt&&Pe(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[jt]);const[Ft,qt]=Z(F.window),Bt=function(e){const t=ee(M,N);return k.length<=1||t===e}(jt),Ht=_(K);Ht.current=K;const Ut=!!K&&!K.editing&&"enabled"===K.state;Q(()=>{if(!t||!Bt||!Ut)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(g(e.target,ct.current)||(e.preventDefault(),e.stopPropagation(),Ht.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Bt,Ut]);const Yt=function(e){return ee(M,()=>Wn.has(e))}(jt);Dt({panelRef:ct,bodyRef:dt,open:t,widget:!!B,active:Bt,minimized:Yt});const Xt=ee(Pr,Ir),Vt=ee(jr,Fr),Gt=ee(Ur,Yr),Qt=!j&&!B,Zt=Xt&&Qt,[tn,nn]=Z(!1),rn=Zt&&Gt===jt,[sn,ln]=Z(!1),dn=sn&&Qt&&Vt===jt?"picked":null,hn=_(Zt);Q(()=>{if(hn.current&&!Zt){ln(!0);const e=setTimeout(()=>{ln(!1),$r===jt&&qr(null)},700);return hn.current=Zt,()=>clearTimeout(e)}hn.current=Zt},[Zt,jt]),Q(()=>{Zt||nn(!1)},[Zt]),Q(()=>{const e=ht.current,t=mt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ft(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),Q(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ct.current){const t=ct.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ht.current,n=mt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const pn=_(!1),fn=te(e,[]),wn=te(()=>{const t=e(),n=pe?pe[0]:Dn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Rn[In()],l=pe?Math.min(pe[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(k.length-1),u=Math.max(At,(i-l)/2),d=(o-a)/2,m=t.h-At-l-u;return"top-right"===q?{x:t.x+t.w-a-At,y:t.y+At,w:a,h:l}:"top-left"===q?{x:t.x+At,y:t.y+At,w:a,h:l}:{x:t.x+Math.max(At,(o-a)/2+At)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),yn=_(!1);t||(yn.current=!1);const gn=fe||d||null;Q(()=>{if(!t)return;tr(jt,gn,Mt.current??void 0),fe||or(jt),pn.current=!1,qt(Lr(jt));const e=()=>{qt(Lr(jt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===fe;if(!e.label)return!1;const t=ct.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(or(jt),zn.current)return;const t=cr(),n=Math.min(Xn.current.w,t.w-40),o=Math.min(Xn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;kn({x:i,y:a,w:n,h:o}),Un(!1)},i=e=>{const t=e.detail;r(t)&&(or(jt),Xe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==fe)return;or(jt);const t=Xn.current,n=function(e,t=cr()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=ct.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}kn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=k.indexOf(e);-1!==t&&(k.splice(t,1),Fn()),Wn.delete(e),$n.delete(e),Hn.delete(e);const n=Bn.get(e);n&&(Bn.delete(e),qn.delete(n))}(jt),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,jt,gn,fn]);const vn=!B&&"maximized"===In(),[bn,kn]=Z(()=>{if(gn&&xn[gn]){const e={...xn[gn]};return pe&&(e.w=pe[0],re||(e.h=pe[1])),pr(e)}return E?{x:E.x,y:E.y,w:E.w,h:E.h}:vn?fn():wn()}),[Cn,Mn]=Z(()=>!re),Nn=_(ve),Sn=_(null);Q(()=>{const e=()=>{const e=r();e!==Nn.current&&Sn.current?.(e),Nn.current=e,be(e),qt(Lr(jt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[jt]);const Ln=ve&&!!Je?.tab&&!Ct&&!B&&!xe,Tn=Ln,zn=_(Tn);zn.current=Tn;const An=Yn(),Kn=ve&&!!Je?.tab&&!B&&!xe&&!Xt&&An!==Je.key,On=!!B&&ve&&!Xt&&null!==An,[jn,Un]=Z(()=>gn&&xn[gn]||E?Tn:Tn||vn),Xn=_(bn);Xn.current=bn;const Vn=_(jn);G(()=>{Vn.current=jn},[jn]),G(()=>{if(Cn||Ln)return;const e=ct.current,t=dt.current;if(!e||!t)return;const n=oe??(B?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Xn.current.y)-24),g=w?Math.min(Xn.current.h,y):Math.min(Math.max(n,u+p),y),v=Math.abs(g-o)>1;v&&(o=g,kn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),B||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Mn(!0)},160)))},l=new ResizeObserver(s);s(),wt.current&&l.observe(wt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[Cn,B,oe,kt,Ln]),G(()=>{if(!re||!Cn||B||!t)return;const e=wt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||jn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=oe??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Xn.current.y)-24);kn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[re,Cn,B,t,jn,oe]);const Jn=!1!==le&&!B&&!X&&!xe,[Gn,Qn]=Z(()=>!Jn);G(()=>{if(Gn||!t)return;if(!Jn||jn)return void Qn(!0);const n=ct.current,r=dt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=Xn.current.w,c=0;const u=()=>Qn(!0),d=()=>{c=0;const t=Xn.current;if(Math.abs(t.w-l)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(m[t])});const v=a(t,s(t.w,w,g),d,At);v!==t&&(l=v.w,kn(v))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Pn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Gn,t,Jn,jn]);const Zn=_(null),er=!(!Je?.tab||Ct||B||xe);Sn.current=t=>{if(!er)return;if(t)return Zn.current||(Zn.current={box:{...Xn.current},maximized:Vn.current}),void(Vn.current=!0);const r=Zn.current;Zn.current=null;const o=e();if(r?.maximized)return Vn.current=!0,Un(!0),void kn(o);const i=r?.box??(gn?xn[gn]:void 0);if(Vn.current=!1,Un(!1),i&&!n(i,o,!1)){const e={...i};pe&&(e.w=pe[0],re||(e.h=pe[1])),kn(pr(e))}else kn(wn())},Q(()=>{Tn&&(Vn.current=!0,Un(!0),kn(fn()))},[Tn,fn]),Q(()=>{if(B)return;const e=()=>{const e=gn?xn[gn]:void 0;if(Vn.current=!1,Un(!1),e){const t={...e};pe&&(t.w=pe[0],re||(t.h=pe[1])),kn(pr(t))}else kn(wn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[B,wn,gn]),Q(()=>{t&&gn&&!Ln&&(xn[gn]=bn,En()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[bn,t,gn,Ln]),Q(()=>{if(!t)return;const e=()=>{Vn.current?kn(fn()):document.body.classList.contains("rosh-gesturing")||kn(pr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return jn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,jn,fn]),Q(()=>{if(t&&(qe(!1),Be.current=!1,lt.current=!1,Qn(!Jn),!zn.current)){if(gn&&xn[gn]){const e=xn[gn];return void kn(t=>pr({...e,...re?{h:t.h}:{},...Jn?{x:t.x,w:t.w}:{}}))}E&&(kn({x:E.x,y:E.y,w:E.w,h:E.h}),Un(E.maximized))}},[t]),Q(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{ct.current?.contains(t.target)&&!Be.current&&(Be.current=!0,e=setTimeout(()=>qe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const nr="auto"===m?Fe:!0===m,rr=Je&&!Ct?Je.key:null,ur=ae(()=>Jt(De),[De]),dr=_({shortcutSpec:Ve,isOnDesktop:et,toggleDesktopShortcut:tt,taskbarStrings:Ie.taskbar});G(()=>{dr.current={shortcutSpec:Ve,isOnDesktop:et,toggleDesktopShortcut:tt,taskbarStrings:Ie.taskbar}});const fr=_(null);fr.current||(fr.current={open:(e,t)=>Xe({x:e,y:t}),items:()=>{const e=dr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of mn[jt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),Q(()=>{if(t&&rr)return()=>{return e=rr,void(_t.delete(e)&&en());var e}},[t,rr]),ot(!(fe||!t)&&nr);const yr=te(()=>nr||"auto"===m&&Be.current,[nr,m]),br=te(async e=>{if(lt.current)return!1;if(!yr())return!0;lt.current=!0;const t=We,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await w({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return lt.current=!1,r},[yr,We]),xr=te(()=>lt.current?Promise.resolve():yr()?br("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[yr,br,l]),kr=te(async()=>{await br("discard")&&(Be.current=!1,qe(!1),Ht.current?.onDiscard())},[br]),Cr=te(async()=>{const e=await br("switch");return e&&(Be.current=!1,qe(!1)),e},[br]),zr=_(()=>!1);G(()=>{zr.current=yr}),G(()=>{if(!t||!fe)return;const e={holdsChanges:()=>zr.current(),ask:Cr};return _n.set(fe,e),()=>{_n.get(fe)===e&&_n.delete(fe)}},[t,fe,Cr]),G(()=>{if(!t||!Nt)return;const e=e=>{e.detail?.windowKey===Nt&&xr()};return window.addEventListener(Tr,e),()=>window.removeEventListener(Tr,e)},[t,Nt,xr]);const Ar=_(null),Dr=te(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Xe(null),or(jt),zn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=ct.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Ar.current){const t=Ar.current;Ar.current=null,d=t.w,u=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Xn.current.x,c=s?s.top:Xn.current.y,u=s?s.height:Xn.current.h,d=s?s.width:Xn.current.w;Un(!1),kn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<Nr&&Math.abs(e.clientY-i)<Nr)return;r=Sr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),Xn.current={...Xn.current,x:s,y:u},!B){const t=function(e,t){const n=cr(),r=e<=n.x+sr,o=e>=n.x+n.w-sr,i=t<=n.y+sr,a=t>=n.y+n.h-sr,s=e<=n.x+lr,l=e>=n.x+n.w-lr,c=t<=n.y+lr,u=t>=n.y+n.h-lr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?gr(wr(t)):vr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),vr();const e=pr({...Xn.current});if(Xn.current=e,!B&&h){Ar.current={x:l,y:c,w:d,h:u};const e=wr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void kn(e)}if(B){const t=e.x+e.w/2,n=window.innerWidth/2;st(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),kn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),Wr=te((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=ct.current,l=s?.getBoundingClientRect(),c=l?l.left:Xn.current.x,u=l?l.top:Xn.current.y,d=l?l.width:Xn.current.w,h=l?l.height:Xn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Un(!1),kn({x:c,y:u,w:d,h:h}),Xn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Xn.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<Nr&&Math.abs(e.clientY-a)<Nr)return;o=Sr(n,r,Mr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(hr,d+e)),w&&(i=Math.max(mr,h+t)),m){const t=Math.max(hr,d-e);n=c+d-t,o=t}if(p){const e=Math.max(mr,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),kn({...Xn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Kr=te(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),or(jt),"Enter"===e.key)return void(jn?(Un(!1),kn(wn())):(Un(!0),kn(fn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Ar.current||(Ar.current={...Xn.current})};if(r<0)return e(),Un(!0),void kn(fn());if(r>0){if(jn)return Un(!1),void kn(wn());if(Ar.current){const e=pr(Ar.current);return Ar.current=null,Xn.current=e,void kn(e)}return void ir(jt)}e(),Un(!1);const t=wr(n<0?"left":"right");return Xn.current=t,void kn(t)}if(jn)return;const o=Xn.current,i=e.shiftKey?{...o,w:Math.max(hr,o.w+24*n),h:Math.max(mr,o.h+24*r)}:pr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Xn.current=i,kn(i)},[jt,jn,wn,fn]),Or=te(e=>{Ar.current||(Ar.current={...Xn.current}),Un(!1);const t=wr(e);Xn.current=t,kn(t),or(jt)},[jt]),Br=Tn||Zt?{}:{tabIndex:0,role:"group","aria-label":We?`${We} — ${Re.windowSuffix}`:Re.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:Kr},Hr=()=>{Un(!0),kn(fn())},Xr=te(()=>{const e=ct.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(cn);t&&!t.disabled&&t.click()}},[]);Q(()=>{if(!t)return;if(B)return;const e=e=>{if(k[k.length-1]===jt&&!g(e.target,ct.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Xr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ct.current?.contains(t)))return;if(t.closest(S))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Xr,jt,B]),Q(()=>{if(!t)return;const e=e=>{k[k.length-1]===jt&&(g(e.target,ct.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:jt}})),Be.current=!1,qe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:jt}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),Q(()=>{if(!t)return;if(B)return;const e=e=>{if("Escape"===e.key&&k[k.length-1]===jt){if(H(e))return e.preventDefault(),void e.stopPropagation();if(Ln&&!P)return;e.preventDefault(),e.stopPropagation(),xr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,xr,jt,B,Ln,P]);const Vr=t&&(void 0!==p||void 0!==f),[Jr]=Z(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Gr=Ln&&!Je?.home&&ur.actions.length>0;Q(()=>{t&&rr&&function(e,t){const n=_t.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(_t.set(e,t),en())}(rr,{title:ur.text||We,dirty:nr,copy:ur.copy,actions:Gr&&Jr?Jr:void 0,menu:fr.current??void 0})},[t,rr,We,nr,ur.text,ur.copy,Gr,Jr]);const _r=te(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-on-accent flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(Q(()=>{if(!t)return;const e=e=>{if(k[k.length-1]!==jt)return;if(g(e.target,ct.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Vr&&(e.preventDefault(),p?p():_r("bottom")),"k"===e.key&&Vr&&(e.preventDefault(),f?f():_r("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Vr,_r,jt]),!t||yn.current)return null;const Qr=Zt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,u=cr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(jt):null,Zr=Zt&&Qr?Math.min(Qr.w/bn.w,Qr.h/bn.h):1,eo=(()=>{if(Zt&&Qr){const e=Zr,t=bn.w*e,n=bn.h*e,r=Qr.x+(Qr.w-t)/2-bn.x,o=Qr.y+(Qr.h-n)/2-bn.y,i=tn||rn;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:F.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(sn&&Qt){const e="picked"===dn;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:F.expose+30}:{}}}return null})(),to=v({modal:!1,titleId:!B&&(Ln?!Je?.home:!xe)?Oe:void 0,label:ur.text||We}),no=/* @__PURE__ */ue("div",{children:[
49
+ /* @__PURE__ */ue("div",{ref:ct,"data-modal-panel":!0,"data-modal-id":jt,"data-window-key":fe||void 0,...j?{"data-utility":""}:{},...He?{"data-pinned-top":""}:{},...B?{"data-widget":""}:{},...Je?{"data-window-owner":Je.key}:{},...Je&&!Ct?{"data-window-root":""}:{},...Ln?{"data-window-tab":""}:{},...to,className:Ln?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(B?Bt?"shadow-xl":"shadow-lg":"border "+(Bt?"shadow-xl border-line":"shadow-lg border-line-strong")),onMouseDownCapture:e=>{if(ut.current=!1,Zt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),qr(jt),Rr(!1),void or(jt)}if(!Bt&&!B&&!He&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ct.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),ut.current=!0,Xe(null),or(jt),window.addEventListener("mouseup",()=>{setTimeout(()=>{ut.current=!1},0)},{once:!0}))}},onClickCapture:e=>{ut.current&&(ut.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Zt)return;Xe(null);e.target.closest("[data-modal-panel]")===ct.current&&(e.target.closest("button, input, a, select, textarea")||or(jt))},style:xe?{zIndex:Ft+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Ee}px)`,transition:Me?"none":"transform 180ms ease-out",...B?{display:"none"}:{},...Ft<0?{display:"none"}:{},...Bt||He||Ae&&fe===Ae?{}:{display:"none"}}:{zIndex:He?F.pinnedWindow:Ft+1,width:bn.w,height:bn.h,top:bn.y,...B&&"right"===it?{right:window.innerWidth-bn.x-bn.w}:{left:bn.x},...Ft<0&&!He?{display:"none"}:{},...ke?{display:"none"}:{},...Kn||On?{visibility:"hidden",pointerEvents:"none"}:{},...eo??{}},children:[xe&&!B&&/* @__PURE__ */de("div",{onPointerDown:ze,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),B?null:Ln?Je?.home?null:/* @__PURE__ */ue(he,{children:[
50
+ /* @__PURE__ */de("h2",{id:Oe,"data-window-title":!0,className:"sr-only",children:ur.text||We}),Gr&&Jr&&me(
51
+ /* @__PURE__ */de(he,{children:ur.actions}),Jr),ur.badges.length>0&&/* @__PURE__ */de("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:ur.badges})]}):xe?null:
52
52
  /* @__PURE__ */ue("div",Y?{onPointerDown:Dr,"data-window-chrome":"",...Br,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-line shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
53
- /* @__PURE__ */ue("div",{"data-window-title":!0,title:Re,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Qt&&zt(),
54
- /* @__PURE__ */de("span",{id:Oe,className:"truncate",children:Qt?un(De):De})]}),!Qt&&/* @__PURE__ */ue("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[j&&/* @__PURE__ */de("button",{onClick:()=>Ue(e=>!e),title:He?We.unpin:We.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */de(O,{name:"bookmark-square",className:"h-3 w-3",fill:He?"currentColor":"none",strokeWidth:1.5})}),
55
- /* @__PURE__ */de("button",{type:"button",onClick:xr,"aria-label":We.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */de(O,{name:"close",className:"h-4 w-4"})})]})]}:X?{onPointerDown:Dr,"data-window-chrome":"",...Br,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-line shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
56
- /* @__PURE__ */ue("div",{"data-window-title":!0,title:Re,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Qt&&zt(),
57
- /* @__PURE__ */de("span",{id:Oe,className:"truncate",children:Qt?un(De):De})]}),!Qt&&/* @__PURE__ */ue("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[j&&/* @__PURE__ */de("button",{onClick:()=>Ue(e=>!e),title:He?We.unpin:We.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */de(O,{name:"bookmark-square",className:"h-3 w-3",fill:He?"currentColor":"none",strokeWidth:1.5})}),
58
- /* @__PURE__ */de("button",{onClick:()=>ir(jt),title:We.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!Tn&&/* @__PURE__ */de(Er,{maximized:jn,onToggleMax:()=>{jn?(Un(!1),kn(wn())):Hr()},onSnap:Or,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:We}),
59
- /* @__PURE__ */de("button",{type:"button",onClick:xr,"aria-label":We.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */de(O,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:Dr,"data-window-chrome":"",...Br,className:"flex items-center justify-between h-(--row-height-window-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
60
- /* @__PURE__ */ue("div",{"data-window-title":!0,title:Re,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Qt&&zt(),
61
- /* @__PURE__ */de("span",{id:Oe,className:"truncate",children:Qt?un(De):De})]}),!Qt&&/* @__PURE__ */ue("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[j&&/* @__PURE__ */de("button",{onClick:()=>Ue(e=>!e),title:He?We.unpin:We.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */de(O,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:He?"currentColor":"none",strokeWidth:1.5})}),
62
- /* @__PURE__ */de("button",{onClick:()=>ir(jt),title:We.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!Tn&&/* @__PURE__ */de(Er,{maximized:jn,onToggleMax:()=>{jn?(Un(!1),kn(wn())):Hr()},onSnap:Or,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:We}),
63
- /* @__PURE__ */de("button",{type:"button",onClick:xr,"aria-label":We.close,className:"rounded-(--radius-control) text-ink-faintest hover:text-gray-600",children:/* @__PURE__ */de(O,{name:"close",className:"h-5 w-5"})})]})]}),ye&&Ze&&!B&&!xe&&/* @__PURE__ */de("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Bt?.9:.55})`}}),
64
- /* @__PURE__ */de(on.Provider,{value:jt,children:/* @__PURE__ */de(C.Provider,{value:{rightRef:ht,leftRef:mt,notify:()=>ft(!0),active:Bt,isDirty:nr,footerOpen:kt&&!B&&!Y&&!X&&!xe},children:/* @__PURE__ */de("div",{ref:dt,...B?{onPointerDown:Dr,onContextMenu:e=>{e.preventDefault(),rt({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${B?"p-0 cursor-move":X||G?"p-0":Y?"p-2":"p-4"} ${B||Ln?"":"backdrop-blur-sm"} ${!1===b||X||G?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${B?"rounded-2xl select-none":""}`,style:{...B?{touchAction:"none"}:{},backgroundColor:B?"transparent":Ln?"rgb(var(--window-content-rgb))":Bt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */de(Ke,{children:ge})})})}),B&&nt&&/* @__PURE__ */ue(I,{minWidth:160,style:{left:nt.x,top:nt.y},onClose:()=>rt(null),children:[
65
- /* @__PURE__ */de(W,{onClick:()=>{rt(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:jt}))},children:"Settings"}),
66
- /* @__PURE__ */de(R,{}),ce&&/* @__PURE__ */ue(he,{children:[ce,
67
- /* @__PURE__ */de(R,{})]}),
68
- /* @__PURE__ */ue(W,{onClick:()=>{rt(null),Ue(e=>!e)},children:[
53
+ /* @__PURE__ */ue("div",{"data-window-title":!0,title:We,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Zt&&zt(),
54
+ /* @__PURE__ */de("span",{id:Oe,className:"truncate",children:Zt?un(De):De})]}),!Zt&&/* @__PURE__ */ue("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[j&&/* @__PURE__ */de("button",{onClick:()=>Ue(e=>!e),title:He?Re.unpin:Re.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */de(O,{name:"bookmark-square",className:"h-3 w-3",fill:He?"currentColor":"none",strokeWidth:1.5})}),
55
+ /* @__PURE__ */de("button",{type:"button",onClick:xr,"aria-label":Re.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */de(O,{name:"close",className:"h-4 w-4"})})]})]}:X?{onPointerDown:Dr,"data-window-chrome":"",...Br,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-line shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
56
+ /* @__PURE__ */ue("div",{"data-window-title":!0,title:We,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Zt&&zt(),
57
+ /* @__PURE__ */de("span",{id:Oe,className:"truncate",children:Zt?un(De):De})]}),!Zt&&/* @__PURE__ */ue("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[j&&/* @__PURE__ */de("button",{onClick:()=>Ue(e=>!e),title:He?Re.unpin:Re.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */de(O,{name:"bookmark-square",className:"h-3 w-3",fill:He?"currentColor":"none",strokeWidth:1.5})}),
58
+ /* @__PURE__ */de("button",{onClick:()=>ir(jt),title:Re.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!Tn&&/* @__PURE__ */de(Er,{maximized:jn,onToggleMax:()=>{jn?(Un(!1),kn(wn())):Hr()},onSnap:Or,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:Re}),
59
+ /* @__PURE__ */de("button",{type:"button",onClick:xr,"aria-label":Re.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */de(O,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:Dr,"data-window-chrome":"",...Br,className:"flex items-center justify-between h-(--row-height-window-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
60
+ /* @__PURE__ */ue("div",{"data-window-title":!0,title:We,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Zt&&zt(),
61
+ /* @__PURE__ */de("span",{id:Oe,className:"truncate",children:Zt?un(De):De})]}),!Zt&&/* @__PURE__ */ue("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[j&&/* @__PURE__ */de("button",{onClick:()=>Ue(e=>!e),title:He?Re.unpin:Re.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */de(O,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:He?"currentColor":"none",strokeWidth:1.5})}),
62
+ /* @__PURE__ */de("button",{onClick:()=>ir(jt),title:Re.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!Tn&&/* @__PURE__ */de(Er,{maximized:jn,onToggleMax:()=>{jn?(Un(!1),kn(wn())):Hr()},onSnap:Or,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:Re}),
63
+ /* @__PURE__ */de("button",{type:"button",onClick:xr,"aria-label":Re.close,className:"rounded-(--radius-control) text-ink-faintest hover:text-gray-600",children:/* @__PURE__ */de(O,{name:"close",className:"h-5 w-5"})})]})]}),ye&&Qe&&!B&&!xe&&/* @__PURE__ */de("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Bt?.9:.55})`}}),
64
+ /* @__PURE__ */de(on.Provider,{value:jt,children:/* @__PURE__ */de(C.Provider,{value:{rightRef:ht,leftRef:mt,notify:()=>ft(!0),active:Bt,isDirty:nr,footerOpen:kt&&!B&&!Y&&!X&&!xe},children:/* @__PURE__ */de("div",{ref:dt,...B?{onPointerDown:Dr,onContextMenu:e=>{e.preventDefault(),rt({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${B?"p-0 cursor-move":X||J?"p-0":Y?"p-2":"p-4"} ${B||Ln?"":"backdrop-blur-sm"} ${!1===b||X||J?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${B?"rounded-2xl select-none":""}`,style:{...B?{touchAction:"none"}:{},backgroundColor:B?"transparent":Ln?"rgb(var(--window-content-rgb))":Bt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */de(Ke,{children:ge})})})}),B&&nt&&/* @__PURE__ */ue(I,{minWidth:160,style:{left:nt.x,top:nt.y},onClose:()=>rt(null),children:[
65
+ /* @__PURE__ */de(R,{onClick:()=>{rt(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:jt}))},children:"Settings"}),
66
+ /* @__PURE__ */de(W,{}),ce&&/* @__PURE__ */ue(he,{children:[ce,
67
+ /* @__PURE__ */de(W,{})]}),
68
+ /* @__PURE__ */ue(R,{onClick:()=>{rt(null),Ue(e=>!e)},children:[
69
69
  /* @__PURE__ */de("span",{className:"flex-1",children:"Always on Top"}),He&&/* @__PURE__ */de(O,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
70
- /* @__PURE__ */de(R,{}),
71
- /* @__PURE__ */de(W,{onClick:()=>{rt(null),xr()},children:"Close"})]}),
70
+ /* @__PURE__ */de(W,{}),
71
+ /* @__PURE__ */de(R,{onClick:()=>{rt(null),xr()},children:"Close"})]}),
72
72
  /* @__PURE__ */ue("div",{onPointerDown:Dr,ref:wt,"data-modal-footer":"",className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${Ln?"":" cursor-move"}${Bt&&!Ln?" backdrop-blur-sm":""}${B||Y||X||xe||!kt?" hidden":""}`,style:{touchAction:"none",backgroundColor:Ln?"rgb(var(--window-footer-rgb))":Bt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
73
73
  /* @__PURE__ */ue("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[St&&/* @__PURE__ */de(je,{auto:!0}),D,
74
74
  /* @__PURE__ */de("div",{ref:mt,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=y&&!1!==y&&
75
75
  /* @__PURE__ */de("div",{ref:yt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */de("div",{ref:gt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(vt?" invisible":""),children:y})})]}),
76
- /* @__PURE__ */ue("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[xt&&K&&(K.editing?/* @__PURE__ */de($,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{kr()},children:We.discard}):"object"==typeof K.state?/* @__PURE__ */de($,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:K.state.disabledReason,children:We.edit}):/* @__PURE__ */de($,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>K.onEdit(),children:We.edit})),
77
- /* @__PURE__ */de("div",{ref:ht,"data-modal-actions":!0,className:"flex items-center gap-2"}),L]})]}),!B&&!xe&&!Qt&&Bt&&!Tn&&/* @__PURE__ */ue(he,{children:[
78
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
79
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
80
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
81
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
82
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
83
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
84
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
85
- /* @__PURE__ */de("div",{onPointerDown:e=>Rr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Qt&&/* @__PURE__ */de("div",{className:"absolute inset-0",style:{zIndex:F.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>nn(!0),onMouseLeave:()=>nn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),or(jt),Wr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:tn&&/* @__PURE__ */de("button",{type:"button","data-expose-close":!0,"aria-label":Ie.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-on-accent shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Qr})`,transformOrigin:"top right",zIndex:F.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),xr()},children:/* @__PURE__ */de(O,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Qt&&Zr&&/* @__PURE__ */de("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Zr.x,top:Zr.y+Zr.h+4,width:Zr.w,zIndex:F.expose+(tn?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:un(De)})]}),ro=Ye&&/* @__PURE__ */ue(I,{style:{left:Ye.x,top:Ye.y},onClose:()=>Xe(null),minWidth:160,children:[!B&&!Y&&!Ln&&/* @__PURE__ */ue(he,{children:[
86
- /* @__PURE__ */ue(W,{onClick:()=>{ir(jt),Xe(null)},children:[
87
- /* @__PURE__ */de(O,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),We.minimize]}),!Tn&&/* @__PURE__ */ue(W,jn?{onClick:()=>{Un(!1),kn(wn()),Xe(null)},children:[
88
- /* @__PURE__ */de(O,{name:"collapse",className:"h-4 w-4",strokeWidth:1.5}),We.windowed]}:{onClick:()=>{Hr(),Xe(null)},children:[
89
- /* @__PURE__ */de(O,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),We.maximize]})]}),j&&!Ln&&/* @__PURE__ */ue(W,{onClick:()=>{Ue(e=>!e),Xe(null)},children:[
90
- /* @__PURE__ */de(O,{name:"bookmark-square",className:"h-4 w-4 "+(He?"text-blue-600":""),fill:He?"currentColor":"none",strokeWidth:1.5}),He?We.unpin:We.pinOnTop]}),Ve&&/* @__PURE__ */ue(W,{onClick:()=>{Xe(null),tt()},children:[
91
- /* @__PURE__ */de(O,{name:"star",className:"h-4 w-4",fill:et?"currentColor":"none",strokeWidth:1.5}),et?Ie.taskbar.removeFromDesktop:Ie.taskbar.addToDesktop]}),(mn[jt]||[]).length>0&&/* @__PURE__ */de(he,{children:(mn[jt]||[]).map((e,t)=>/* @__PURE__ */ue(W,{onClick:()=>{Xe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Ln&&Ge?.home)&&/* @__PURE__ */ue(he,{children:[
92
- /* @__PURE__ */de(R,{}),
93
- /* @__PURE__ */ue(W,{danger:!0,onClick:()=>{Xe(null),xr()},children:[
94
- /* @__PURE__ */de(O,{name:"close",className:"h-4 w-4"}),We.close]})]})]}),oo=!!fe&&Ot.some(e=>e.id===fe),io=!Yt||oo||B?null:/* @__PURE__ */ue("div",{"data-modal-restore-tab":!0,"data-modal-id":jt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-line-strong bg-surface px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
95
- /* @__PURE__ */de("button",{type:"button",onClick:()=>or(jt),title:We.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Re||We.windowSuffix}),
96
- /* @__PURE__ */de("button",{type:"button",onClick:()=>or(jt),title:We.restore,"aria-label":We.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
97
- /* @__PURE__ */de("button",{type:"button",onClick:()=>{xr()},title:We.close,"aria-label":We.close,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return me(
98
- /* @__PURE__ */ue(an.Provider,{value:null,children:[no,ro,io]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Ar&&"Escape"===e.key&&(Xr(null),Wr(!1))});var Zr=100,Qr={past:[],future:[]};function eo(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Zr?r.slice(r.length-Zr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Qr}}var to=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var no=500,ro=250;function oo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=le(eo,Qr),a=_(/* @__PURE__ */new Map),[s,l]=Q(0),c=s>0,[u,d]=Q(0),[h,m]=Q(0),p=h>0,{hasAnyPerm:f}=L(),w=t&&0===u&&(!(n&&n.length>0)||f(n)),y=_(null),g=_(!1),v=te(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),b=te((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),x=te(e=>{a.current.delete(e)&&l(e=>e-1)},[]),k=te(e=>{d(t=>t+(e?1:-1))},[]),E=te(e=>{m(t=>t+(e?1:-1))},[]),[M,N]=Q(0),S=M>0,T=te(e=>{N(t=>t+(e?1:-1))},[]),z=V($e),A=z?.claimReadOnly;Z(()=>{if(A&&!w)return A(!0),()=>A(!1)},[A,w]);const D=z?.claimOwnMount;Z(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const P=_({last:0,count:0,tripped:!1}),I=_(!1),W=te((e,t,n)=>{if(g.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(I.current=!0));if(!w||y.current)return;const r=P.current;if(r.tripped)return;const o=Date.now();if(o-r.last>ro&&(r.count=0),r.last=o,++r.count>no)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${no} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);y.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=y.current;y.current=null,e&&i({type:"record",step:e})})},[w,v]),R=te(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),K=te(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};R(e.values),i({type:"undo",redoStep:t})},[o.past,v,R]),$=te(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};R(e.values),i({type:"redo",undoStep:t})},[o.future,v,R]),[O,j]=Q(0),F=_(0),q=_(0),B=_(!1),H=te(()=>{g.current=!0,I.current=!1,y.current=null,F.current+=1,q.current=F.current,j(F.current)},[]),U=_(void 0),Y=te(e=>{void 0!==e&&(void 0!==U.current&&e!==U.current&&(B.current=!0),U.current=e),H()},[H]);Z(()=>{g.current&&O===q.current&&(g.current=!1,y.current=null,(I.current||B.current)&&i({type:"clear"}),I.current=!1,B.current=!1)},[O]);const X=te(()=>{B.current=!0,i({type:"clear"}),H()},[H]),G=w&&o.past.length>0,J=w&&o.future.length>0,ee=zr(r),ne=_({undo:K,redo:$,canUndo:G,canRedo:J});ne.current={undo:K,redo:$,canUndo:G,canRedo:J},Z(()=>{if(!ee||!w)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&to.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ne.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ee,w]);const re=ae(()=>({register:b,unregister:x,record:W,undo:K,redo:$,clear:X,baseline:Y,canUndo:G,canRedo:J,enabled:w,hasState:c,handMounted:S,claimOwnMount:T,claimReadOnly:k,declaredEditable:p,claimEditable:E,undoLabel:G?o.past[o.past.length-1].label:null,redoLabel:J?o.future[0].label:null}),[b,x,W,K,$,X,Y,G,J,w,c,S,T,k,p,E,o.past,o.future]),oe=""!==yn(),ie=V(C)?.footerOpen??!1,se=oe&&w&&c&&!S&&ie;/* @__PURE__ */
99
- return ue($e.Provider,{value:re,children:[se&&/* @__PURE__ */de(gn,{position:"left",quiet:!0,children:/* @__PURE__ */de(je,{auto:!0})}),e]})}function io(){const e=V($e),t=te(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function ao(e){const t=V($e),n=t?.claimReadOnly,r=t?.claimEditable;Z(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function so(e,t,n){const r=V($e),o=se(),i=_(e),a=_(t);a.current=t,Z(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=_(r);c.current=r;const u=_({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},Z(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function lo(e,t){const[n,r]=Q(e);return so(n,e=>r(()=>e),t),[n,r]}export{vn as CancelButton,Me as DesktopHostProvider,ct as DocFavStar,_e as EntityWindowFallback,Ge as EntityWindowLoading,Ze as EntityWindowState,cn as MODAL_SUBMIT_SELECTOR,_r as Modal,gn as ModalActions,je as UndoControls,oo as UndoProvider,xe as WINDOW_REGISTRY,Re as WindowCrashedFallback,Ke as WindowErrorBoundary,zt as WindowManagerProvider,fn as WindowTitle,ft as activateWindowById,Bt as beginWindowGesture,er as cancelWindowFront,Ee as client_default,Vr as commitExposeHighlight,Qn as confirmWindowDiscard,Ht as drainPerfEvents,Kr as exitExposeMode,An as forgetMaximizedWindowBoxes,gt as getActiveWindowRoute,Yr as getExposeHighlight,rn as getWindowChromeVersion,Tn as getWindowPosition,et as isDraftEntityId,tt as isDraftEntityWindow,ge as isEntityEntry,ye as isPageEntry,ke as isShellApiClientConfigured,Ue as isTabWindow,qt as markMenuOpen,tn as readWindowChrome,Jn as requestWindowFront,Xr as setExposeHighlight,Ft as setPerfCollecting,Ae as setShellHomeRoute,We as setShellTabStrip,be as setShellWindowRegistry,Ln as setWindowDefaultPosition,zn as setWindowPosition,Gt as splitTitle,Ur as subscribeExposeHighlight,nn as subscribeWindowChrome,Ye as tabGroupOf,Rr as toggleExposeMode,Yn as useCurrentTabKey,Ne as useDesktopHost,yn as useEnclosingModalId,zr as useIsActiveWindow,Le as usePageSearch,io as useUndo,ao as useUndoCanEdit,so as useUndoable,lo as useUndoableState,hn as useWidgetSettings,ot as useWindowDirty,at as useWindowManager,pn as useWindowMenuItem,wn as useWindowTitle,Zn as windowHoldsChanges};
76
+ /* @__PURE__ */ue("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[xt&&K&&(K.editing?/* @__PURE__ */de($,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{kr()},children:Re.discard}):"object"==typeof K.state?/* @__PURE__ */de($,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:K.state.disabledReason,children:Re.edit}):/* @__PURE__ */de($,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>K.onEdit(),children:Re.edit})),
77
+ /* @__PURE__ */de("div",{ref:ht,"data-modal-actions":!0,className:"flex items-center gap-2"}),L]})]}),!B&&!xe&&!Zt&&Bt&&!Tn&&/* @__PURE__ */ue(he,{children:[
78
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
79
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
80
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
81
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
82
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
83
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
84
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
85
+ /* @__PURE__ */de("div",{onPointerDown:e=>Wr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Zt&&/* @__PURE__ */de("div",{className:"absolute inset-0",style:{zIndex:F.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>nn(!0),onMouseLeave:()=>nn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),or(jt),Rr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:tn&&/* @__PURE__ */de("button",{type:"button","data-expose-close":!0,"aria-label":Ie.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-on-accent shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Zr})`,transformOrigin:"top right",zIndex:F.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),xr()},children:/* @__PURE__ */de(O,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Zt&&Qr&&/* @__PURE__ */de("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Qr.x,top:Qr.y+Qr.h+4,width:Qr.w,zIndex:F.expose+(tn?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:un(De)})]}),ro=Ye&&/* @__PURE__ */ue(I,{style:{left:Ye.x,top:Ye.y},onClose:()=>Xe(null),minWidth:160,children:[!B&&!Y&&!Ln&&/* @__PURE__ */ue(he,{children:[
86
+ /* @__PURE__ */ue(R,{onClick:()=>{ir(jt),Xe(null)},children:[
87
+ /* @__PURE__ */de(O,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),Re.minimize]}),!Tn&&/* @__PURE__ */ue(R,jn?{onClick:()=>{Un(!1),kn(wn()),Xe(null)},children:[
88
+ /* @__PURE__ */de(O,{name:"collapse",className:"h-4 w-4",strokeWidth:1.5}),Re.windowed]}:{onClick:()=>{Hr(),Xe(null)},children:[
89
+ /* @__PURE__ */de(O,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),Re.maximize]})]}),j&&!Ln&&/* @__PURE__ */ue(R,{onClick:()=>{Ue(e=>!e),Xe(null)},children:[
90
+ /* @__PURE__ */de(O,{name:"bookmark-square",className:"h-4 w-4 "+(He?"text-blue-600":""),fill:He?"currentColor":"none",strokeWidth:1.5}),He?Re.unpin:Re.pinOnTop]}),Ve&&/* @__PURE__ */ue(R,{onClick:()=>{Xe(null),tt()},children:[
91
+ /* @__PURE__ */de(O,{name:"star",className:"h-4 w-4",fill:et?"currentColor":"none",strokeWidth:1.5}),et?Ie.taskbar.removeFromDesktop:Ie.taskbar.addToDesktop]}),(mn[jt]||[]).length>0&&/* @__PURE__ */de(he,{children:(mn[jt]||[]).map((e,t)=>/* @__PURE__ */ue(R,{onClick:()=>{Xe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Ln&&Je?.home)&&/* @__PURE__ */ue(he,{children:[
92
+ /* @__PURE__ */de(W,{}),
93
+ /* @__PURE__ */ue(R,{danger:!0,onClick:()=>{Xe(null),xr()},children:[
94
+ /* @__PURE__ */de(O,{name:"close",className:"h-4 w-4"}),Re.close]})]})]}),oo=!!fe&&Ot.some(e=>e.id===fe),io=!Yt||oo||B?null:/* @__PURE__ */ue("div",{"data-modal-restore-tab":!0,"data-modal-id":jt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-line-strong bg-surface px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
95
+ /* @__PURE__ */de("button",{type:"button",onClick:()=>or(jt),title:Re.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:We||Re.windowSuffix}),
96
+ /* @__PURE__ */de("button",{type:"button",onClick:()=>or(jt),title:Re.restore,"aria-label":Re.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
97
+ /* @__PURE__ */de("button",{type:"button",onClick:()=>{xr()},title:Re.close,"aria-label":Re.close,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return me(
98
+ /* @__PURE__ */ue(an.Provider,{value:null,children:[no,ro,io]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Ar&&"Escape"===e.key&&(Xr(null),Rr(!1))});var Qr=100,Zr={past:[],future:[]};function eo(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Qr?r.slice(r.length-Qr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Zr}}var to=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var no=500,ro=250;function oo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=le(eo,Zr),a=_(/* @__PURE__ */new Map),[s,l]=Z(0),c=s>0,[u,d]=Z(0),[h,m]=Z(0),p=h>0,{hasAnyPerm:f}=L(),w=t&&0===u&&(!(n&&n.length>0)||f(n)),y=_(null),g=_(!1),v=te(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),b=te((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),x=te(e=>{a.current.delete(e)&&l(e=>e-1)},[]),k=te(e=>{d(t=>t+(e?1:-1))},[]),E=te(e=>{m(t=>t+(e?1:-1))},[]),[M,N]=Z(0),S=M>0,T=te(e=>{N(t=>t+(e?1:-1))},[]),z=V($e),A=z?.claimReadOnly;Q(()=>{if(A&&!w)return A(!0),()=>A(!1)},[A,w]);const D=z?.claimOwnMount;Q(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const P=_({last:0,count:0,tripped:!1}),I=_(!1),R=te((e,t,n)=>{if(g.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(I.current=!0));if(!w||y.current)return;const r=P.current;if(r.tripped)return;const o=Date.now();if(o-r.last>ro&&(r.count=0),r.last=o,++r.count>no)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${no} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);y.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=y.current;y.current=null,e&&i({type:"record",step:e})})},[w,v]),W=te(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),K=te(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),i({type:"undo",redoStep:t})},[o.past,v,W]),$=te(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),i({type:"redo",undoStep:t})},[o.future,v,W]),[O,j]=Z(0),F=_(0),q=_(0),B=_(!1),H=te(()=>{g.current=!0,I.current=!1,y.current=null,F.current+=1,q.current=F.current,j(F.current)},[]),U=_(void 0),Y=te(e=>{void 0!==e&&(void 0!==U.current&&e!==U.current&&(B.current=!0),U.current=e),H()},[H]);Q(()=>{g.current&&O===q.current&&(g.current=!1,y.current=null,(I.current||B.current)&&i({type:"clear"}),I.current=!1,B.current=!1)},[O]);const X=te(()=>{B.current=!0,i({type:"clear"}),H()},[H]),J=w&&o.past.length>0,G=w&&o.future.length>0,ee=zr(r),ne=_({undo:K,redo:$,canUndo:J,canRedo:G});ne.current={undo:K,redo:$,canUndo:J,canRedo:G},Q(()=>{if(!ee||!w)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&to.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ne.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ee,w]);const re=ae(()=>({register:b,unregister:x,record:R,undo:K,redo:$,clear:X,baseline:Y,canUndo:J,canRedo:G,enabled:w,hasState:c,handMounted:S,claimOwnMount:T,claimReadOnly:k,declaredEditable:p,claimEditable:E,undoLabel:J?o.past[o.past.length-1].label:null,redoLabel:G?o.future[0].label:null}),[b,x,R,K,$,X,Y,J,G,w,c,S,T,k,p,E,o.past,o.future]),oe=""!==yn(),ie=V(C)?.footerOpen??!1,se=oe&&w&&c&&!S&&ie;/* @__PURE__ */
99
+ return ue($e.Provider,{value:re,children:[se&&/* @__PURE__ */de(gn,{position:"left",quiet:!0,children:/* @__PURE__ */de(je,{auto:!0})}),e]})}function io(){const e=V($e),t=te(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function ao(e){const t=V($e),n=t?.claimReadOnly,r=t?.claimEditable;Q(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function so(e,t,n){const r=V($e),o=se(),i=_(e),a=_(t);a.current=t,Q(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=_(r);c.current=r;const u=_({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},Q(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function lo(e,t){const[n,r]=Z(e);return so(n,e=>r(()=>e),t),[n,r]}export{vn as CancelButton,Me as DesktopHostProvider,ct as DocFavStar,_e as EntityWindowFallback,Je as EntityWindowLoading,Qe as EntityWindowState,cn as MODAL_SUBMIT_SELECTOR,_r as Modal,gn as ModalActions,je as UndoControls,oo as UndoProvider,xe as WINDOW_REGISTRY,We as WindowCrashedFallback,Ke as WindowErrorBoundary,zt as WindowManagerProvider,fn as WindowTitle,ft as activateWindowById,Bt as beginWindowGesture,er as cancelWindowFront,Ee as client_default,Vr as commitExposeHighlight,Zn as confirmWindowDiscard,Ht as drainPerfEvents,Kr as exitExposeMode,An as forgetMaximizedWindowBoxes,gt as getActiveWindowRoute,Yr as getExposeHighlight,rn as getWindowChromeVersion,Tn as getWindowPosition,et as isDraftEntityId,tt as isDraftEntityWindow,ge as isEntityEntry,ye as isPageEntry,ke as isShellApiClientConfigured,Ue as isTabWindow,qt as markMenuOpen,tn as readWindowChrome,Gn as requestWindowFront,Xr as setExposeHighlight,Ft as setPerfCollecting,Ae as setShellHomeRoute,Re as setShellTabStrip,be as setShellWindowRegistry,Ln as setWindowDefaultPosition,zn as setWindowPosition,Jt as splitTitle,Ur as subscribeExposeHighlight,nn as subscribeWindowChrome,Ye as tabGroupOf,Wr as toggleExposeMode,Yn as useCurrentTabKey,Ne as useDesktopHost,yn as useEnclosingModalId,zr as useIsActiveWindow,Le as usePageSearch,io as useUndo,ao as useUndoCanEdit,so as useUndoable,lo as useUndoableState,hn as useWidgetSettings,ot as useWindowDirty,at as useWindowManager,pn as useWindowMenuItem,wn as useWindowTitle,Qn as windowHoldsChanges};