efficient-shell 10.22.0 → 10.24.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 (290) hide show
  1. package/README.md +16 -4
  2. package/dist/{Browser-XQ5GO3LJ.js → Browser-KUFFOGYK.js} +14 -14
  3. package/dist/Calculator-LENRW34X.js +29 -0
  4. package/dist/CurrencyConverter-7UMHQS2V.js +21 -0
  5. package/dist/{Documents-7GOEAIJ6.js → Documents-ODZ4AAOY.js} +20 -20
  6. package/dist/{Files-MMVUWO5F.js → Files-BRGTTI2J.js} +46 -46
  7. package/dist/Notepad-RMRDEGGU.js +24 -0
  8. package/dist/PomodoroTimer-4566W4F7.js +91 -0
  9. package/dist/{Preview-DEK7WTAU.js → Preview-7POJP7PB.js} +33 -33
  10. package/dist/Sidebar-TU4QCKYJ.js +44 -0
  11. package/dist/Spreadsheet-7T4VT5IO.js +37 -0
  12. package/dist/{Stock-XHMTFEOL.js → Stock-H73C4R3N.js} +4 -4
  13. package/dist/{Weather-X5WAHYQ3.js → Weather-WF56QCBI.js} +20 -20
  14. package/dist/{WorldClock-ARU7PMVZ.js → WorldClock-5QJNZYYS.js} +6 -6
  15. package/dist/ai/index.js +91 -91
  16. package/dist/api/shellHttp.d.ts +52 -0
  17. package/dist/api/shellHttp.js +1 -0
  18. package/dist/apps/index.js +1 -1
  19. package/dist/bin/media-host-check.js +1 -1
  20. package/dist/bin/ui-check.js +1 -1
  21. package/dist/charts/BoxPlotChart.js +1 -1
  22. package/dist/charts/CandlestickChart.js +1 -1
  23. package/dist/charts/ChartTooltip.js +1 -1
  24. package/dist/charts/ChordChart.js +1 -1
  25. package/dist/charts/ColumnChart.js +1 -1
  26. package/dist/charts/FunnelChart.js +1 -1
  27. package/dist/charts/HeatmapChart.js +1 -1
  28. package/dist/charts/HistogramChart.js +1 -1
  29. package/dist/charts/PieChart.js +1 -1
  30. package/dist/charts/RadarChart.js +1 -1
  31. package/dist/charts/RadialBarChart.js +1 -1
  32. package/dist/charts/RangeChart.js +1 -1
  33. package/dist/charts/SankeyChart.js +1 -1
  34. package/dist/charts/ScatterChart.js +1 -1
  35. package/dist/charts/SpecChart.js +1 -1
  36. package/dist/charts/SunburstChart.js +1 -1
  37. package/dist/charts/TimeSeriesChart.js +1 -1
  38. package/dist/charts/TreemapChart.js +1 -1
  39. package/dist/charts/WaterfallChart.js +1 -1
  40. package/dist/chunk-2QY5BJLA.js +2 -0
  41. package/dist/{chunk-3PO4D32J.js → chunk-36PJGT4W.js} +1 -1
  42. package/dist/{chunk-AGPPZHAH.js → chunk-36VIGB6J.js} +1 -1
  43. package/dist/{chunk-C4CAPG3D.js → chunk-3BFZVVAT.js} +1 -1
  44. package/dist/chunk-3C5NKOVF.js +1 -0
  45. package/dist/chunk-3FBDLIQW.js +99 -0
  46. package/dist/chunk-4BCFBF3C.js +9 -0
  47. package/dist/chunk-4EBJO7ER.js +15 -0
  48. package/dist/chunk-4LXCCZDM.js +1 -0
  49. package/dist/{chunk-YICFH5KO.js → chunk-4P3324KU.js} +1 -1
  50. package/dist/chunk-4P57TIFK.js +2 -0
  51. package/dist/{chunk-QDJQ43N4.js → chunk-4RGMRXYH.js} +1 -1
  52. package/dist/{chunk-6V4INP7J.js → chunk-4TYIYL56.js} +4 -4
  53. package/dist/{chunk-P22NWAFW.js → chunk-55AEZX6K.js} +1 -1
  54. package/dist/chunk-5DIGYJHD.js +1 -0
  55. package/dist/{chunk-BB6A5MGA.js → chunk-5FYDNH4Y.js} +1 -1
  56. package/dist/{chunk-U2RFKQVA.js → chunk-5H4SWQGM.js} +1 -1
  57. package/dist/{chunk-KABWJIY4.js → chunk-5PP435FL.js} +1 -1
  58. package/dist/{chunk-BWTK3NUD.js → chunk-6IOFNPR6.js} +4 -4
  59. package/dist/{chunk-OBNA7GF5.js → chunk-6M5O2P64.js} +9 -9
  60. package/dist/{chunk-P3LKCOB4.js → chunk-7FW2BQTV.js} +2 -2
  61. package/dist/{chunk-SRYX6AQ6.js → chunk-7JVGF555.js} +1 -1
  62. package/dist/{chunk-ARSOETMP.js → chunk-7KWYVQMX.js} +1 -1
  63. package/dist/chunk-7LU3H72S.js +7 -0
  64. package/dist/chunk-7RP7QTRF.js +12 -0
  65. package/dist/{chunk-AKBGUMLI.js → chunk-A6FR2D46.js} +5 -5
  66. package/dist/{chunk-RAMJFT3D.js → chunk-AFG34RBV.js} +5 -5
  67. package/dist/{chunk-5JCHYQYI.js → chunk-ALTBTO3Z.js} +3 -3
  68. package/dist/chunk-ATMJ5ZPK.js +1 -0
  69. package/dist/{chunk-PWUPLXSS.js → chunk-BBXFIBXB.js} +1 -1
  70. package/dist/{chunk-EE56C2JH.js → chunk-BMXTPJ7T.js} +5 -5
  71. package/dist/{chunk-O64PY7ZJ.js → chunk-BUO7XCYR.js} +11 -11
  72. package/dist/{chunk-LJHVEISA.js → chunk-CH3JQUDW.js} +6 -6
  73. package/dist/{chunk-DLOJSJWL.js → chunk-CIHR5ZKF.js} +1 -1
  74. package/dist/{chunk-E5H5OU3A.js → chunk-COF33H6J.js} +5 -5
  75. package/dist/{chunk-GGRD2JLB.js → chunk-CQEVJG43.js} +1 -1
  76. package/dist/{chunk-WHISJI5L.js → chunk-CX4XR4HO.js} +1 -1
  77. package/dist/{chunk-XDCHB6JA.js → chunk-DGWS4GTI.js} +1 -1
  78. package/dist/{chunk-RXO2LNIB.js → chunk-DIEH76MB.js} +1 -1
  79. package/dist/{chunk-PJBZ5B54.js → chunk-DOF56HTO.js} +5 -5
  80. package/dist/{chunk-CGP2QCIA.js → chunk-DRUQH4ZE.js} +2 -2
  81. package/dist/{chunk-KGVNRLWT.js → chunk-DVYIBJ3S.js} +2 -2
  82. package/dist/{chunk-5DIBDRB6.js → chunk-DWAA4YZV.js} +3 -3
  83. package/dist/{chunk-4BPIGS2D.js → chunk-DZOJQURG.js} +6 -6
  84. package/dist/{chunk-7SMDYBQX.js → chunk-E3EJWNNK.js} +8 -8
  85. package/dist/chunk-E6FDUFPH.js +1 -0
  86. package/dist/chunk-EH2BNSG3.js +13 -0
  87. package/dist/chunk-EOVXFXVV.js +2 -0
  88. package/dist/chunk-EXLHFM3V.js +6 -0
  89. package/dist/chunk-F3ZOO23R.js +1 -0
  90. package/dist/{chunk-L67WTASI.js → chunk-FUDUQ44A.js} +1 -1
  91. package/dist/{chunk-N2RIQ2OU.js → chunk-FZM3ZPW3.js} +1 -1
  92. package/dist/{chunk-VQIG5N6D.js → chunk-G66SG6JN.js} +9 -9
  93. package/dist/{chunk-GCC2OZDG.js → chunk-GC3DA6D6.js} +1 -1
  94. package/dist/{chunk-QA3EAJ5H.js → chunk-GOXQJCXG.js} +17 -17
  95. package/dist/{chunk-XAPHUSOR.js → chunk-H475WZPF.js} +16 -16
  96. package/dist/{chunk-53DO72B2.js → chunk-H5NIW2KS.js} +1 -1
  97. package/dist/chunk-HNVSVTNC.js +16 -0
  98. package/dist/{chunk-ET4726WV.js → chunk-IHNOWRTP.js} +2 -2
  99. package/dist/{chunk-QZMGWRZ4.js → chunk-IPO4LHSB.js} +6 -6
  100. package/dist/{chunk-E5QPXEKN.js → chunk-JFBL4PR3.js} +1 -1
  101. package/dist/chunk-JPOYR5AO.js +7 -0
  102. package/dist/{chunk-BJRJODRZ.js → chunk-LCSMBVMU.js} +1 -1
  103. package/dist/{chunk-WVCX2Y3S.js → chunk-LE5LWALR.js} +1 -1
  104. package/dist/chunk-LNXBTK7Q.js +1 -0
  105. package/dist/{chunk-HC2AM2DT.js → chunk-MCAPJSB6.js} +1 -1
  106. package/dist/{chunk-REWKL7MX.js → chunk-MDYJVXWD.js} +2 -2
  107. package/dist/chunk-MHPFBVDD.js +8 -0
  108. package/dist/{chunk-NS2HY4NL.js → chunk-N5KO2IHG.js} +4 -4
  109. package/dist/{chunk-22LRMKLV.js → chunk-NJN5IKWO.js} +6 -6
  110. package/dist/{chunk-HWKAFISI.js → chunk-NRALUW6P.js} +7 -7
  111. package/dist/{chunk-SETRKP7W.js → chunk-NWC6YCIJ.js} +10 -10
  112. package/dist/{chunk-WE3HINW3.js → chunk-NZ34BQKH.js} +1 -1
  113. package/dist/{chunk-H2C5SZKO.js → chunk-NZ7BFYCM.js} +1 -1
  114. package/dist/chunk-O3MBPAWZ.js +2 -0
  115. package/dist/{chunk-6XYGA252.js → chunk-O7RR2ZZ2.js} +6 -6
  116. package/dist/{chunk-SAGI7AWC.js → chunk-OKHKY3ZZ.js} +1 -1
  117. package/dist/{chunk-KLAKLVKE.js → chunk-OTITQ3IH.js} +12 -12
  118. package/dist/{chunk-WSMRVWWK.js → chunk-P7H2DXJB.js} +10 -10
  119. package/dist/chunk-PSR6SXCC.js +14 -0
  120. package/dist/{chunk-AFBBNGVO.js → chunk-PVDZG2U2.js} +7 -7
  121. package/dist/{chunk-Q5WPHBDB.js → chunk-QGWKM7C3.js} +5 -5
  122. package/dist/{chunk-GEDS6QO7.js → chunk-QRU55BUS.js} +2 -2
  123. package/dist/{chunk-A46WK67X.js → chunk-QWCEKHAP.js} +4 -4
  124. package/dist/{chunk-DOWE3ZQR.js → chunk-RDKIYORS.js} +1 -1
  125. package/dist/{chunk-D6ZXMKW2.js → chunk-RSOBUPLK.js} +1 -1
  126. package/dist/{chunk-F3ZH6UCW.js → chunk-RZQGPWSN.js} +1 -1
  127. package/dist/{chunk-NWUAATIX.js → chunk-S4FPYCUU.js} +3 -3
  128. package/dist/chunk-S5DYR75A.js +29 -0
  129. package/dist/chunk-STKJA4PV.js +1 -0
  130. package/dist/{chunk-OAVU46YG.js → chunk-TDAI4J27.js} +4 -4
  131. package/dist/{chunk-WJ6ZJVAX.js → chunk-TE6R53YD.js} +1 -1
  132. package/dist/{chunk-GIK62TW6.js → chunk-TFSLPAGB.js} +3 -3
  133. package/dist/chunk-TNJ2VCH4.js +8 -0
  134. package/dist/{chunk-7XNDWW3Y.js → chunk-U44DVPGB.js} +1 -1
  135. package/dist/{chunk-ZTV2BA3P.js → chunk-U6LKNGC6.js} +1 -1
  136. package/dist/chunk-UKBXQXDZ.js +1 -0
  137. package/dist/chunk-ULJQYXHB.js +1 -0
  138. package/dist/{chunk-CIYMGVZC.js → chunk-UNQ54QOF.js} +1 -1
  139. package/dist/chunk-UPXDDO3U.js +1 -0
  140. package/dist/{chunk-C2ZUYCIM.js → chunk-USVL5SLG.js} +1 -1
  141. package/dist/chunk-USWA6YNZ.js +3 -0
  142. package/dist/{chunk-CIXGYZCF.js → chunk-V2J2AHDW.js} +4 -4
  143. package/dist/chunk-VX4COEWP.js +4 -0
  144. package/dist/{chunk-VXQQQDJ3.js → chunk-VX6TKEEK.js} +1 -1
  145. package/dist/{chunk-NTVOQHRS.js → chunk-WDQEUNGE.js} +1 -1
  146. package/dist/{chunk-GLE4F5FT.js → chunk-WGLHB6WE.js} +1 -1
  147. package/dist/{chunk-MW3FT4WI.js → chunk-WL4U4MTQ.js} +3 -3
  148. package/dist/{chunk-NPGFCIHB.js → chunk-WLYYC3AP.js} +1 -1
  149. package/dist/{chunk-GCP3LGRG.js → chunk-WOAMPTZI.js} +14 -14
  150. package/dist/{chunk-FHYETY4V.js → chunk-XBHXGBJR.js} +1 -1
  151. package/dist/{chunk-VKP2WRJJ.js → chunk-XCAUDTCC.js} +8 -8
  152. package/dist/chunk-XFH64VIG.js +19 -0
  153. package/dist/chunk-XXL5RLNM.js +22 -0
  154. package/dist/{chunk-6CICYVCK.js → chunk-YQOVUH5W.js} +8 -8
  155. package/dist/{chunk-WUMPTKOG.js → chunk-Z3SLQKE6.js} +1 -1
  156. package/dist/{chunk-4UHAQMOT.js → chunk-Z44JWU75.js} +2 -2
  157. package/dist/{chunk-UXPKCDEF.js → chunk-Z6GQFTLJ.js} +1 -1
  158. package/dist/{chunk-TBQLPMW5.js → chunk-ZRLWE3JM.js} +1 -1
  159. package/dist/data/DataTable.js +1 -1
  160. package/dist/data/EntityList.d.ts +125 -0
  161. package/dist/data/EntityList.js +2 -0
  162. package/dist/data/ListLoadError.js +1 -1
  163. package/dist/data/ResizableTable.d.ts +31 -0
  164. package/dist/data/ResizableTable.js +2 -0
  165. package/dist/data/useColumnConfig.d.ts +68 -0
  166. package/dist/data/useColumnConfig.js +2 -0
  167. package/dist/data/useSort.d.ts +55 -0
  168. package/dist/data/useSort.js +2 -0
  169. package/dist/data/useTableNav.d.ts +28 -0
  170. package/dist/data/useTableNav.js +2 -0
  171. package/dist/format/index.d.ts +1 -1
  172. package/dist/format/index.js +1 -1
  173. package/dist/forms/AlignmentGrid.js +1 -1
  174. package/dist/forms/BorderInput.js +1 -1
  175. package/dist/forms/BrandAssetEditor.js +1 -1
  176. package/dist/forms/Button.js +1 -1
  177. package/dist/forms/ColorPicker.js +1 -1
  178. package/dist/forms/ComposerAttachments.js +1 -1
  179. package/dist/forms/CornersInput.js +1 -1
  180. package/dist/forms/DateRangePicker.js +1 -1
  181. package/dist/forms/DisplayChips.js +1 -1
  182. package/dist/forms/FilePicker.js +1 -1
  183. package/dist/forms/IconButton.js +1 -1
  184. package/dist/forms/IconPicker.js +1 -1
  185. package/dist/forms/InputNumber.js +1 -1
  186. package/dist/forms/LinkPicker.js +1 -1
  187. package/dist/forms/MediaLibrary.js +1 -1
  188. package/dist/forms/MediaUploadField.js +1 -1
  189. package/dist/forms/MediaUploadGrid.js +1 -1
  190. package/dist/forms/MediaUsedInList.js +1 -1
  191. package/dist/forms/NumericKeypad.js +1 -1
  192. package/dist/forms/PictureTiles.js +1 -1
  193. package/dist/forms/PositionInput.js +1 -1
  194. package/dist/forms/Segmented.js +1 -1
  195. package/dist/forms/Select.js +1 -1
  196. package/dist/forms/SidesInput.js +1 -1
  197. package/dist/forms/Slider.js +1 -1
  198. package/dist/forms/Snippet.js +1 -1
  199. package/dist/forms/SplitButton.js +1 -1
  200. package/dist/forms/TagInput.js +1 -1
  201. package/dist/forms/TextToolbar.js +1 -1
  202. package/dist/forms/WidthsBar.js +1 -1
  203. package/dist/hooks/useRootIsDark.d.ts +3 -0
  204. package/dist/hooks/useRootIsDark.js +1 -1
  205. package/dist/icons/efficient-glyphs.js +1 -1
  206. package/dist/icons/efficient-looks.js +1 -1
  207. package/dist/icons/efficient.js +1 -1
  208. package/dist/icons/index.js +1 -1
  209. package/dist/icons/looks/map.js +1 -1
  210. package/dist/icons/payment.js +1 -1
  211. package/dist/icons/sets.js +1 -1
  212. package/dist/index.d.ts +13 -317
  213. package/dist/index.js +667 -694
  214. package/dist/map/index.js +3 -3
  215. package/dist/page-tabs/index.js +5 -5
  216. package/dist/shell/AppUpdateBanner.js +1 -1
  217. package/dist/shell/ColoredBadge.js +1 -1
  218. package/dist/shell/ContextMenu.js +1 -1
  219. package/dist/shell/DropdownMenu.js +1 -1
  220. package/dist/shell/EditableGrid.js +1 -1
  221. package/dist/shell/FloatingBar.js +1 -1
  222. package/dist/shell/GlobalSearch.js +1 -1
  223. package/dist/shell/HelpCenter.js +1 -1
  224. package/dist/shell/IconRail.js +1 -1
  225. package/dist/shell/ImageLightbox.js +1 -1
  226. package/dist/shell/ItemCount.js +1 -1
  227. package/dist/shell/LanguageSelect.js +1 -1
  228. package/dist/shell/Markdown.js +1 -1
  229. package/dist/shell/PopupMenu.js +1 -1
  230. package/dist/shell/ResizeHandle.js +1 -1
  231. package/dist/shell/SearchableSelect.js +1 -1
  232. package/dist/shell/SettingReset.js +1 -1
  233. package/dist/shell/SettingRow.js +1 -1
  234. package/dist/shell/SidebarLayout.js +1 -1
  235. package/dist/shell/SidebarNav.js +1 -1
  236. package/dist/shell/SortableList.js +1 -1
  237. package/dist/shell/StatusBadge.js +1 -1
  238. package/dist/shell/Tabs.js +1 -1
  239. package/dist/shell/Tooltip.js +1 -1
  240. package/dist/shell/TopNav.js +1 -1
  241. package/dist/shell/TransferProgress.js +1 -1
  242. package/dist/shell/Tree.js +1 -1
  243. package/dist/telemetry/index.js +1 -1
  244. package/dist/templates/AuthScreen.js +1 -1
  245. package/dist/templates/ChatTemplate.js +1 -1
  246. package/dist/templates/CheckoutTemplate.js +1 -1
  247. package/dist/templates/DashboardTemplate.js +1 -1
  248. package/dist/templates/DataTablePage.js +1 -1
  249. package/dist/templates/EmailTemplate.js +1 -1
  250. package/dist/templates/ErrorBoundary.js +1 -1
  251. package/dist/templates/FormLayoutPage.js +1 -1
  252. package/dist/templates/GalleryTemplate.js +1 -1
  253. package/dist/theme/index.d.ts +2 -0
  254. package/dist/theme/index.js +2 -0
  255. package/dist/ui/index.d.ts +6 -0
  256. package/dist/ui/index.js +1 -1
  257. package/dist/utils/glass.js +1 -1
  258. package/dist/utils/rootTheme.d.ts +13 -1
  259. package/dist/utils/rootTheme.js +1 -1
  260. package/dist/version.js +1 -1
  261. package/package.json +6 -1
  262. package/dist/Calculator-X62IAKQY.js +0 -29
  263. package/dist/CurrencyConverter-PSOBQ6K2.js +0 -21
  264. package/dist/Notepad-FAQBAF36.js +0 -24
  265. package/dist/PomodoroTimer-ZLS6XCTN.js +0 -91
  266. package/dist/Sidebar-JF2KEJT2.js +0 -44
  267. package/dist/Spreadsheet-6C7Q6OQA.js +0 -37
  268. package/dist/chunk-4DO47TT5.js +0 -1
  269. package/dist/chunk-5532S4RN.js +0 -4
  270. package/dist/chunk-5R4X7MFQ.js +0 -1
  271. package/dist/chunk-5XKCOKYJ.js +0 -1
  272. package/dist/chunk-CY5N5OA3.js +0 -2
  273. package/dist/chunk-F7U5MVNH.js +0 -2
  274. package/dist/chunk-FX4KK5GE.js +0 -3
  275. package/dist/chunk-GCMCXRIN.js +0 -19
  276. package/dist/chunk-H43BVPNN.js +0 -7
  277. package/dist/chunk-IWOVB4WI.js +0 -9
  278. package/dist/chunk-LIULEXWE.js +0 -14
  279. package/dist/chunk-LQVW3SW4.js +0 -6
  280. package/dist/chunk-NGRTW6Y7.js +0 -2
  281. package/dist/chunk-PBFFKRQF.js +0 -12
  282. package/dist/chunk-QFJIMX4A.js +0 -15
  283. package/dist/chunk-QIMFBARF.js +0 -8
  284. package/dist/chunk-RRGMXY46.js +0 -29
  285. package/dist/chunk-TLJWBRLI.js +0 -8
  286. package/dist/chunk-URQWWOHM.js +0 -7
  287. package/dist/chunk-WBJ6KNUF.js +0 -1
  288. package/dist/chunk-WEPQU5W6.js +0 -22
  289. package/dist/chunk-ZT45XXIB.js +0 -100
  290. /package/dist/{chunk-CSA6CGXS.js → chunk-RKLZDVAO.js} +0 -0
@@ -1,22 +0,0 @@
1
- import{ChartBrush as t}from"./chunk-E6GDAV5R.js";import{ChartDot as e}from"./chunk-CK2YOGUS.js";import{stepPath as a,curvePath as r,areaBetween as o,areaFrom as l}from"./chunk-VFC6QUEN.js";import{ChartDefs as n,MOTION as i,stagger as s,fillFor as c,dashFor as d,maskId as m}from"./chunk-465RRWBY.js";import{ChartSkeleton as h}from"./chunk-3IUPYCW3.js";import{useHighlight as u,highlightOpacity as f}from"./chunk-CNYAHYE6.js";import{ChartTooltip as p}from"./chunk-AGPPZHAH.js";import{useDragZoom as g,DragBand as y,ChartZoomSummary as k,tooltipBesideBand as x}from"./chunk-C764JODK.js";import{pairedAxes as v,niceAxis as b,niceMax as M,linearScale as N,axisGutter as w,bandScale as j,ladderScale as $}from"./chunk-2JWPNR2U.js";import{usePlotWidth as A}from"./chunk-MAFUXCPZ.js";import{resolveSeriesColor as V,CHART_INK as z,STATUS_VARS as C}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as D}from"./chunk-TWVUQUUD.js";import{useShellStrings as R,useShellLocale as W}from"./chunk-GDQJBQ5B.js";import{formatPercent as E,formatPlain as L}from"./chunk-C3QOHMR6.js";import{useRef as S,useState as P,useId as U,useEffect as T}from"react";import{jsx as I,jsxs as B}from"react/jsx-runtime";var O=12,F=16,Q=26,Y=52,G=t=>"number"==typeof t&&Number.isFinite(t);function H({series:H,labels:J,height:K=200,stacked:Z=!1,stackMode:X="value",levels:q,curve:_="linear",tension:tt=0,max:et,yTickCount:at=4,formatValue:rt,formatTooltipValue:ot,tooltipLabels:lt,yAxisLabel:nt,referenceLines:it,labelEndpoints:st=!1,dots:ct,dotVariant:dt="border",pulse:mt=!1,brush:ht=!1,range:ut,onRangeChange:ft,zoomable:pt=!0,columnStrip:gt,onSelect:yt,loading:kt=!1,animate:xt=!0,reveal:vt="left-to-right",fillVariant:bt="gradient",gridStyle:Mt="solid",width:Nt,className:wt,emptyLabel:jt}){const $t=R().charts,At=W(),Vt=rt??(t=>L(t,At)),zt=ot??Vt,Ct=jt??$t.noData,Dt=S(null),Rt=A(Dt),Wt=Nt??Rt,[Et,Lt]=P(null),[St,Pt]=P(null),{highlighted:Ut}=u(),Tt=U(),It=ut??St,Bt=g(ht&&It?It[1]-It[0]+1:J.length,pt);if(T(()=>{if(null!==Et)return D(t=>"Escape"===t.key&&(Lt(null),!0))},[Et]),kt)/* @__PURE__ */
2
- return I("div",{className:wt,ref:Dt,children:/* @__PURE__ */I(h,{height:K,width:Nt??Rt})});const Ot=J,Ft=ut??St??[0,Math.max(0,Ot.length-1)],[Qt,Yt]=Ft,Gt=t=>Bt.slice(ht?t.slice(Qt,Yt+1):t),Ht=lt?Gt(lt):void 0,Jt=H.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(G)).map(t=>({...t,data:Gt(t.data),pointTones:t.pointTones?Gt(t.pointTones):void 0})),Kt=t=>(ht?Qt:0)+(Bt.view?.[0]??0)+t;if(J=Gt(Ot),0===Jt.length||0===J.length)/* @__PURE__ */
3
- return I("div",{className:wt,ref:Dt,children:/* @__PURE__ */I("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:K},children:Ct})});const Zt=J.map((t,e)=>Jt.reduce((t,a)=>t+(G(a.data[e])?a.data[e]:0),0)),Xt=(t,e)=>Zt[e]>0?t/Zt[e]:null,qt=[];if(Z){let t=J.map(()=>0);for(const e of Jt)t=t.map((t,a)=>t+(G(e.data[a])?e.data[a]:0)),qt.push("percent"===X?t.map((t,e)=>Xt(t,e)):[...t])}const _t=!!q&&q.length>0,te=t=>"right"===t.axis,ee=!Z&&!_t&&void 0===et&&Jt.some(te)&&Jt.some(t=>!te(t)),ae=gt&&!Z?gt:null,re=t=>!!ae&&"column"===t.mode,oe=(ee?Jt.filter(t=>!te(t)):Jt).filter(t=>!re(t)),le=ee?Jt.filter(te).flatMap(t=>t.data.filter(G)):[],ne=Z?(qt.at(-1)??[]).filter(G):oe.flatMap(t=>t.data.filter(G)),ie=ee?v([Math.min(0,...ne),Math.max(0,...ne)],[Math.min(0,...le),Math.max(0,...le)],{intervals:at+1,integerLeft:ne.every(Number.isInteger),integerRight:le.every(Number.isInteger)}):null,se=ie?ie.left:Z&&"percent"===X||_t||void 0!==et?null:b(Z?0:Math.min(0,...ne),Math.max(0,...ne),{intervals:at+1,integer:ne.every(Number.isInteger)}),ce=se?se.lo:0,de=Z&&"percent"===X?1:se?se.hi:et??M(Math.max(...ne,0)),me=Z&&"percent"===X?t=>E(Math.round(100*t),0,At):Vt,he=_t?q:se?se.ticks:N([ce,de],{from:0,to:1}).ticks(at+1),ue=w(he.map(me),Y),fe=ie?w(ie.right.ticks.map(Vt),F):F,pe={left:ue,right:Math.max(ue+1,Wt-fe),top:O,bottom:K-Q},ge=j(J.length,{from:pe.left,to:pe.right}),ye=_t?$(q,{from:pe.bottom,to:pe.top}):null,ke=N([ce,de],{from:pe.bottom,to:pe.top}),xe=ke(Math.max(ce,0)),ve=t=>ye?ye(t):ke(t),be=Jt.filter(re),Me=Math.max(0,...J.map((t,e)=>be.reduce((t,a)=>t+Math.max(0,G(a.data[e])?a.data[e]:0),0))),Ne=t=>xe-(Me>0?t/Me:0)*(pe.bottom-pe.top)*(ae??0),we=ie?N([ie.right.lo,ie.right.hi],{from:pe.bottom,to:pe.top}):null,je=t=>we&&te(t)?we:ve,$e=ye?ye.levels.map(t=>({value:t,y:ye(t)})):he.map(t=>({value:t,y:ke(t)})),Ae=t=>e=>{e.preventDefault(),Lt(e=>{const a=(e??0)+t;return Math.min(J.length-1,Math.max(0,a))})},Ve=Math.max(1,Math.ceil(J.length/Math.max(1,Math.floor(Wt/96))));/* @__PURE__ */
4
- return B("div",{className:`relative ${wt??""}`,ref:Dt,children:[
5
- /* @__PURE__ */B("svg",{width:"100%",height:K,viewBox:`0 0 ${Wt} ${K}`,role:"img","aria-label":$t.overIntervals(Jt.map(t=>t.label),J.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>Lt(null),onBlur:()=>Lt(null),style:pt?{userSelect:"none",touchAction:"pan-y"}:void 0,onKeyDown:t=>{if(yt&&null!==Et&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void yt(Kt(Et));"ArrowRight"===t.key&&Ae(1)(t),"ArrowLeft"===t.key&&Ae(-1)(t)},children:[
6
- /* @__PURE__ */I("defs",{children:/* @__PURE__ */I("clipPath",{id:Tt,children:/* @__PURE__ */I("rect",{x:pe.left,y:pe.top,width:pe.right-pe.left,height:pe.bottom-pe.top})})}),
7
- /* @__PURE__ */I(n,{id:Tt,fills:Jt.map((t,e)=>({color:V(t.slot,t.color,t.tone),variant:t.fillVariant??bt})),fadeFrom:Z?.42:.3,reveal:!!xt&&vt}),$e.map(t=>/* @__PURE__ */I("line",{x1:pe.left,y1:t.y,x2:pe.right,y2:t.y,stroke:z.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===Mt?"3 3":void 0},`grid-${t.value}`)),
8
- /* @__PURE__ */I("line",{x1:pe.left,y1:xe,x2:pe.right,y2:xe,stroke:z.axis,strokeWidth:1,shapeRendering:"crispEdges"}),$e.map(t=>/* @__PURE__ */I("text",{x:pe.left-8,y:t.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:z.label,style:{fontVariantNumeric:"tabular-nums"},children:me(t.value)},`ytick-${t.value}`)),ie&&$e.map((t,e)=>/* @__PURE__ */I("text",{x:pe.right+8,y:t.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:z.label,style:{fontVariantNumeric:"tabular-nums"},children:Vt(ie.right.ticks[e])},`ytick-r-${t.value}`)),nt&&/* @__PURE__ */I("text",{x:12,y:(pe.top+pe.bottom)/2,transform:`rotate(-90 12 ${(pe.top+pe.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:z.label,children:nt}),
9
- /* @__PURE__ */I("g",{clipPath:`url(#${Tt})`,mask:xt&&vt?`url(#${m(Tt)})`:void 0,children:Jt.map((t,e)=>{const n=V(t.slot,t.color,t.tone),m=t.mode??(Z?"area":"line"),h=f(t.key,Ut);if("step"===m){const e=J.map((e,a)=>({start:ge(a),end:ge.end(a),value:t.data[a]})).filter(t=>G(t.value)).map(e=>({start:e.start,end:e.end,y:je(t)(e.value)}));/* @__PURE__ */
10
- return I("path",{d:a(e),fill:"none",stroke:n,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:h??void 0,className:"rosh-viz-mark"},t.key)}const u=J.map((a,r)=>{const o=Z?qt[e]?.[r]:t.data[r];return G(o)?[ge.center(r),je(t)(o)]:null}).filter(t=>null!==t);if(0===u.length)return null;if("column"===m){const a=Math.max(1,.62*ge.bandwidth),r="solid"===t.fillVariant,o=je(t);return re(t)?/* @__PURE__ */I("g",{opacity:h??void 0,className:"rosh-viz-mark",children:J.map((o,l)=>{const i=t.data[l];if(!G(i)||i<=0)return null;const s=((t,e)=>be.slice(0,be.findIndex(e=>e.key===Jt[t]?.key)).reduce((t,a)=>t+Math.max(0,G(a.data[e])?a.data[e]:0),0))(e,l),c=Ne(s+i),d=Ne(s)-(s>0?1:0);/* @__PURE__ */
11
- return I("rect",{x:ge.center(l)-a/2,y:c,width:a,height:Math.max(0,d-c),rx:2,fill:t.pointTones?.[l]?C[t.pointTones[l]]:n,fillOpacity:r?1:.55},l)})},t.key):/* @__PURE__ */I("g",{opacity:h??void 0,className:"rosh-viz-mark",children:J.map((l,c)=>{const d=Z?qt[e]?.[c]:t.data[c];if(!G(d))return null;const m=o(d);/* @__PURE__ */
12
- return I("rect",{x:ge.center(c)-a/2,y:Math.min(m,xe),width:a,height:Math.abs(xe-m),rx:2,fill:n,fillOpacity:r?1:.35,className:xt?i.rise:void 0,style:xt?s(c,26):void 0},c)})},t.key)}const p=r(u,_,tt),g=Z&&e>0?J.map((t,a)=>[ge.center(a),ve(qt[e-1]?.[a]??0)-2]):null,y=g?o(p,g):l(p,u,xe);/* @__PURE__ */
13
- return B("g",{opacity:h??void 0,className:"rosh-viz-mark",children:[("area"===m||Z)&&
14
- /* @__PURE__ */I("path",{d:y,fill:c(Tt,e,t.fillVariant??bt,n),stroke:"none"}),
15
- /* @__PURE__ */I("path",{d:p,fill:"none",stroke:n,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:d(t.stroke??(t.forecast?"animated-dashed":"solid")),className:xt&&("animated-dashed"===t.stroke||t.forecast&&!t.stroke)?i.march:void 0})]},t.key)})}),it?.map((t,e)=>{const a=t.color??C[t.tone??"critical"],r=ve(t.value);/* @__PURE__ */
16
- return B("g",{children:[
17
- /* @__PURE__ */I("line",{x1:pe.left,y1:r,x2:pe.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */I("text",{x:pe.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(ct??(st?"last":"none"))&&Jt.map((t,a)=>{if("column"===t.mode)return null;const r=ct??(st?"last":"none"),o=V(t.slot,t.color,t.tone),l=[...t.data].map(G).lastIndexOf(!0),n="all"===r?J.map((t,e)=>e).filter(e=>G(Z?qt[a]?.[e]:t.data[e])):l>=0?[l]:[];/* @__PURE__ */
18
- return B("g",{children:[n.map(r=>{const n=Z?qt[a]?.[r]:t.data[r];return G(n)?/* @__PURE__ */I(e,{cx:ge.center(r),cy:je(t)(n),color:o,variant:dt,pulse:mt&&r===l,title:`${J[r]}: ${t.label} ${Vt(n)}`},r):null}),st&&l>=0&&G(Z?qt[a]?.[l]:t.data[l])&&/* @__PURE__ */I("text",{x:ge.center(l)-10,y:je(t)(Z?qt[a]?.[l]:t.data[l])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:z.label,style:{fontVariantNumeric:"tabular-nums"},children:Vt(Z?qt[a]?.[l]:t.data[l])})]},`dots-${t.key}`)}),J.map((t,e)=>e%Ve===0?/* @__PURE__ */I("text",{x:ge.center(e),y:K-8,textAnchor:"middle",fontSize:11,fill:z.label,style:{fontVariantNumeric:"tabular-nums"},children:t},`xtick-${e}`):null),null!==Et&&/* @__PURE__ */I("line",{x1:ge.center(Et),y1:pe.top,x2:ge.center(Et),y2:pe.bottom,stroke:z.axis,strokeWidth:1}),ae&&Me>0&&
19
- /* @__PURE__ */B("g",{pointerEvents:"none","data-column-strip":"true",children:[
20
- /* @__PURE__ */I("line",{x1:pe.left,y1:Ne(Me),x2:pe.right,y2:Ne(Me),stroke:z.grid,strokeWidth:1,strokeDasharray:"2 3",shapeRendering:"crispEdges"}),
21
- /* @__PURE__ */I("text",{x:pe.left+4,y:Ne(Me)-4,fontSize:11,fill:z.label,style:{fontVariantNumeric:"tabular-nums"},children:Vt(Me)})]}),Bt.drag&&/* @__PURE__ */I(y,{x0:ge(Bt.drag[0]),x1:ge(Bt.drag[1])+ge.bandwidth,top:pe.top,bottom:pe.bottom}),J.map((t,e)=>/* @__PURE__ */I("rect",{x:ge(e),y:pe.top,width:Math.max(1,ge.bandwidth),height:pe.bottom-pe.top,fill:"transparent",onMouseEnter:()=>Lt(e),onPointerDown:()=>Bt.press(e),onPointerEnter:()=>Bt.over(e),onPointerUp:Bt.release,onClick:yt?()=>yt(Kt(e)):void 0,style:yt?{cursor:"pointer"}:void 0},`hit-${e}`))]}),Bt.view&&/* @__PURE__ */I(k,{from:Ht?.[0]??J[0],to:Ht?.at(-1)??J[J.length-1],count:J.length,total:Z&&"percent"!==X?zt(Zt.reduce((t,e)=>t+e,0)):ae?zt(be.reduce((t,e)=>t+e.data.filter(G).reduce((t,e)=>t+e,0),0)):void 0,rows:(ae?be:Jt).filter(t=>t.data.some(G)).map(t=>{const e=t.data.filter(G),a=V(t.slot,t.color,t.tone);if(0===e.length)return{key:t.key,label:t.label,color:a,value:"—"};const r=e.reduce((t,e)=>t+e,0),o=Z||"column"===t.mode?zt(r):$t.zoomLevel(zt(r/e.length),zt(Math.max(...e)));return{key:t.key,label:t.label,color:a,value:o}}),onClear:Bt.clear}),ht&&Ot.length>2&&/* @__PURE__ */I(t,{className:"mt-1",labels:Ot,width:Wt,data:H[0]?.data??[],range:Ft,onRangeChange:t=>{ft?ft(t):Pt(t)}}),null!==Et&&
22
- /* @__PURE__ */I("div",{className:"pointer-events-none absolute top-2 z-10",style:x(ge.center(Et),ge.bandwidth,Wt),children:/* @__PURE__ */I(p,{title:Ht?.[Et]??J[Et],rows:Jt.map((t,e)=>({key:t.key,label:t.label,color:V(t.slot,t.color,t.tone),value:G(t.data[Et])?Z&&"percent"===X?`${E(100*(Xt(t.data[Et],Et)??0),1,At)} · ${zt(t.data[Et])}`:zt(t.data[Et]):void 0})),footnote:Z&&"percent"===X?$t.inBucket(zt(Zt[Et])):void 0})})]})}export{H as TimeSeriesChart};
@@ -1,100 +0,0 @@
1
- import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-CY5N5OA3.js";import{ROW_HEIGHTS as u}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as d}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as h}from"./chunk-JDCM2VHG.js";import{Result as m}from"./chunk-QYL26AB4.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-ZDMZM7HD.js";import{CopyButton as w}from"./chunk-2E2SUEEE.js";import{confirm as y}from"./chunk-PLK2WHZG.js";import{useShellPrefs as g}from"./chunk-KC3EX26K.js";import{ItemCount as v}from"./chunk-P22NWAFW.js";import{isInOverlayOver as b}from"./chunk-3DVNXNTF.js";import{dialogA11y as x}from"./chunk-VWGWZY7A.js";import{useIsMobile as k,useIsPhone as E}from"./chunk-UGTRSRIW.js";import{ColoredBadge as C}from"./chunk-SAGI7AWC.js";import{focusableIn as M}from"./chunk-CDAJKLGL.js";import{PopupMenu as N,PopupMenuItem as S,PopupMenuDivider as L,PopupMenuLabel as T}from"./chunk-KLAKLVKE.js";import{StatusBadge as z}from"./chunk-N2RIQ2OU.js";import{Button_default as A}from"./chunk-NGRTW6Y7.js";import{Icon as D}from"./chunk-2UO47XB4.js";import{LoadingSpinner as P}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as I}from"./chunk-62LW225J.js";import{runEscapeInterceptors as W}from"./chunk-TWVUQUUD.js";import{useShellStrings as K}from"./chunk-GDQJBQ5B.js";import{createContext as R,useContext as $,Component as O,useLayoutEffect as j,useRef as F,useEffect as q,useState as B,useSyncExternalStore as H,useCallback as U,isValidElement as Y,Fragment as X,Children as V,cloneElement as G,useMemo as _,useId as J,useReducer as Q,Suspense as Z}from"react";import{jsxs as ee,jsx as te,Fragment as ne}from"react/jsx-runtime";import{createPortal as re}from"react-dom";import{useLocation as oe}from"react-router-dom";import{useQueryClient as ie,useQuery as ae}from"@tanstack/react-query";function se(e){return"component"in e}function le(e){return"endpoint"in e}var ce={};function ue(e){ce=e}var de=new Proxy({},{get:(e,t)=>ce[t],has:(e,t)=>t in ce,ownKeys:()=>Object.keys(ce),getOwnPropertyDescriptor(e,t){if(t in ce)return{configurable:!0,enumerable:!0,value:ce[t]}}}),he=null;function me(e){he=e}function pe(){return null!==he}var fe=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),we=new Proxy({},{get:(e,t)=>he?he[t]:"string"==typeof t&&fe.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),ye=R(null);function ge(){return $(ye)?.pageSearch??""}var ve=null,be=/* @__PURE__ */new Set;function xe(e){ve!==e&&(ve=e,be.forEach(e=>e()))}function ke(){return ve}function Ee(e){return be.add(e),()=>{be.delete(e)}}var Ce=null;function Me(e){Ce=e}function Ne({error:e,onReload:t}){const n=h(e);/* @__PURE__ */
2
- return ee("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
- /* @__PURE__ */te(D,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
- /* @__PURE__ */ee("div",{className:"min-w-0",children:[
5
- /* @__PURE__ */te("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
- /* @__PURE__ */te("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__ */te("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 Se=class extends O{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),d(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */te(Ne,{error:e,onReload:this.reset}):this.props.children}},Le=R(null),Te="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function ze({className:e="",auto:t=!1}){const n=$(Le),r=K().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__ */
8
- return ee("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
- /* @__PURE__ */te("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",p):r.nothingToUndo,className:Te,children:r.undo}),
10
- /* @__PURE__ */te("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",f):r.nothingToRedo,className:Te,children:r.redo})]})}var Ae=/* @__PURE__ */new Set([408,429]);function De(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Pe(e){const t=De(e);return null!=t&&(t>=400&&t<500&&!Ae.has(t))}function Ie(e,t){return!Pe(t)&&e<3}function We(e){if("page"!==e.type)return!0;const t=e.route?de[e.route]:void 0;if(!t||!se(t))return!0;const n=t;return!n.widget&&!n.utility}function Ke(e){const t=e.route?de[e.route]:void 0;if(!t||!se(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var Re=(e,t)=>!!t&&"page"===e.type&&e.route===t;function $e(){const e=K().loading;/* @__PURE__ */
11
- return te(P,{size:"sm",padding:"p-8",label:e.label})}var Oe="flex-1 min-h-0";function je(){const e=K().record;/* @__PURE__ */
12
- return te(P,{label:e.loading,padding:"",className:Oe})}function Fe(e){return e??void 0}function qe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=K().record;if(t||e&&n)/* @__PURE__ */return te(je,{});if(r){const e=De(r);if(401===e)/* @__PURE__ */
13
- return te(m,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Oe});if(403===e)/* @__PURE__ */
14
- return te(m,{status:"403",className:Oe});if(404===e||410===e)/* @__PURE__ */
15
- return te(m,{status:"404",title:i.notFound,className:Oe});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
- return te(m,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */te(A,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Oe})}/* @__PURE__ */
17
- return te(m,{status:"404",title:i.notFound,className:Oe})}function Be({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */te(ne,{children:t(e)}):/* @__PURE__ */te(qe,{...n})}var He=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Ue(e){return"string"==typeof e&&(e.startsWith("new-")||He.test(e))}function Ye(e){if(Ue(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Xe=R({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ve=R(null);function Ge(e){const t=$(Ve),n=F(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),j(()=>{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 _e(){const e=F(/* @__PURE__ */new Map),[t,n]=B(!1);return{dirty:t,registerDirty:U((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 Je(){return $(Xe)}function Qe(e){if("page"!==e.type&&Ye(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 Ze({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=_e(),i=de[e.route];if(!i||!se(i))return null;const a=i,s=a.component;/* @__PURE__ */
18
- return te(Gr,{open:!0,onClose:t,icon:c[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__ */te(Ve.Provider,{value:o,children:/* @__PURE__ */te(Z,{fallback:/* @__PURE__ */te("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */te($e,{})}),children:/* @__PURE__ */te(s,{})})})})}function et({entityType:e,entityId:t,label:n}){const r=K(),o=ie(),{data:i}=ae({queryKey:["my-profile-sidebar"],enabled:pe(),queryFn:()=>we.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
- return te("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];we.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__ */te(D,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var tt=/* @__PURE__ */new Set,nt=()=>"hidden";function rt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=de[e.entityType];if(!o||!le(o))return null;const i=o,[a,s]=B(!1),{dirty:l,registerDirty:u}=_e(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Ue(e.entityId),p=!i.selfFetching&&!h&&!m&&pe(),f=ae({queryKey:[d,e.entityId],queryFn:()=>{return we.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Fe(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Pe(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Ie}),w=f.data,y=f.refetch;q(()=>{var t;if(p)return t=t=>{t!==e.id||tt.has(t)||y({cancelRefetch:!1})},Zn.add(t),()=>{Zn.delete(t)}},[y,e.id,p]);const g=U(()=>{a&&!l?s(!1):t()},[a,l,t]),v=(i.useEdit??nt)(w??null),b=!i.useEdit||m||h?void 0:{state:v,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},x=i.selfFetching?e.label:w?i.title(w,a,s):e.label,k=i.icon,E=k?c[k]:null,C=x,M=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */te(Z,{fallback:/* @__PURE__ */te($e,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */te(Z,{fallback:/* @__PURE__ */te(Gr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */te(je,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */te(Gr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */te(qe,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */te(Gr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:E,title:C,footer:M,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,edit:b,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */te(Ve.Provider,{value:u,children:/* @__PURE__ */te(Z,{fallback:/* @__PURE__ */te(je,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */te(Be,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function ot(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function it(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function at(e){const t=ot(e),n=t??it(e);if(!n)return;if(t&&!dr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&er(o)}function st(){const e=Mr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var lt=/* @__PURE__ */new Map;function ct(){const e=st();if(e)return lt.get(e)}function ut(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 dt="rosh-peek-style",ht=I.peek,mt=I.taskbarPreview;function pt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(dt))return;const e=document.createElement("style");e.id=dt,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:${ht}!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 ft(){"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 wt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=K(),l=F(null),[c,u]=B({w:n,h:Math.round(.75*r)}),[d,h]=B(!1);return j(()=>{const o=l.current;if(!o)return;const i=ot(e)??ut(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__ */ee("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:[
20
- /* @__PURE__ */te("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */ee("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
21
- /* @__PURE__ */te(D,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
22
- /* @__PURE__ */te("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */te("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__ */te("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__ */te(D,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function yt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=K(),s=e.length>1,l=F(null),[c,u]=B({left:-9999,top:-9999,ready:!1}),[d,h]=B(()=>"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]),q(()=>ft,[]);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 re(
23
- /* @__PURE__ */te("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:mt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ft(),i()},children:e.map(e=>{const t=ot(e.id)??ut(e.label),o=t?function(e){if(dr(e))return null;const t=e.getBoundingClientRect(),n=ir(),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__ */
24
- return ee("div",{className:"group flex flex-col items-center",onMouseEnter:()=>pt(t),children:[!m&&/* @__PURE__ */te("span",{className:p,children:e.label}),
25
- /* @__PURE__ */te(wt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */te("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */ee("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:[
26
- /* @__PURE__ */te(D,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function gt(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 vt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=K(),[a,s]=B(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 l=H(Nr,Mr),[,u]=B(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]=B(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=ut(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=B(null),[f,w]=B(null),[y,g]=B(null),b=F(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},k=e.filter(e=>!e.route||!de[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?de[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 re(
27
- /* @__PURE__ */ee(ne,{children:[E.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);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=ot(e.id)??ut(e.label);return!!t&&!dr(t)});/* @__PURE__ */
28
- return ee("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(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?g({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&&Y(n)?G(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */te(D,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
29
- /* @__PURE__ */te("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */te("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */te(v,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */te("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__ */te(D,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
30
- /* @__PURE__ */te("div",{className:"flex-1"}),k.length>=2&&/* @__PURE__ */ee("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:[
31
- /* @__PURE__ */te(D,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */ee(N,{portal:!0,minWidth:200,style:gt(y.x,y.y),onClose:()=>g(null),children:[
32
- /* @__PURE__ */te(T,{children:y.label}),
33
- /* @__PURE__ */ee(S,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=$n.get(e);t&&tr(t)}(e.id))},children:[
34
- /* @__PURE__ */te(D,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
35
- /* @__PURE__ */ee(S,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
36
- /* @__PURE__ */te("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */te("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
37
- /* @__PURE__ */te(L,{}),
38
- /* @__PURE__ */ee(S,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
39
- /* @__PURE__ */te(D,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */te(yt,{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 bt=["/login","/forgot-password","/reset-password","/force-change-password"];function xt({children:e,windowAccentForRoute:t}){const n=oe(),r=bt.some(e=>n.pathname.startsWith(e)),[o,i]=B([]),a=F(o);j(()=>{a.current=o},[o]);const s=H(Ee,ke,ke),l=F(/* @__PURE__ */new Map),c=e=>{const t=We(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(()=>{lt.clear();for(const e of o)e.route&&lt.set(e.id,e.route)},[o]);const u=U(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=U(e=>{var t;ot(e)||it(e)?(t=e,window.dispatchEvent(new CustomEvent(Sr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=Pn;t&&tt.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,(In.get(i)??-1)>a)||er(o),t&&tt.delete(e)},50)},m=(e,t,n)=>{const r=Ce;if(n||!r)return[...e,t];const o=function(e,t,n){if(!We(t))return e.length;if(t.shellOwned&&Re(t,n.home))return 0;const r=Re(t,n.home)?void 0:Ke(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{We(e)&&!Re(e,n.home)&&Ke(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!Re(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&Re(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=>We(e[t])&&!Re(e[t],n.home)?Ke(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:ke(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=U(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=U((e,t,n,r,o,a={})=>{if(!de[e]||!le(de[e]))return;const s=`${e}:${t}`,l=st();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:Fe(n),openedFrom:l},!!a.append))})},[]),w=U((e,t={})=>{if(!de[e]||!se(de[e]))return;const n=de[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Bn.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=st();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=U(()=>{},[]),g=U(()=>{},[]),v=d,b=d;/* @__PURE__ */
40
- return ee(Xe.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,
41
- /* @__PURE__ */te(vt,{openWindows:o,onRemove:d,onSplitView:Xr,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&&er(e)}})},onActivateById:at}),
42
- /* @__PURE__ */te(Vr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
43
- /* @__PURE__ */
44
- return te(ye.Provider,{value:c(e),children:/* @__PURE__ */te(Se,{fallback:(t,n)=>/* @__PURE__ */te(Gr,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */te(Ne,{error:t,onReload:n})}),children:/* @__PURE__ */te(Jt,{spec:Qe(e),children:/* @__PURE__ */te(no,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */te(Ze,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */te(rt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var kt=400;function Et({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=F(null),s=F(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=F(!1),c=F(void 0),u=F(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},kt)};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?M(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 Ct=null,Mt=/* @__PURE__ */new Set;function Nt(){return Ct}function St(e){if(Ct!==e){Ct=e;for(const e of Mt)e()}}function Lt(e){return Mt.add(e),()=>{Mt.delete(e)}}var Tt=!1,zt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},At=()=>{};function Dt(e){Tt=e,zt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Pt(e,t){Tt&&("submenu"===e?zt.submenus++:zt.menus++,zt.menuKey=t)}function It(e){if(!Tt)return At;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Tt)return;const r=performance.now()-t;"move"===e?zt.moveMs+=r:zt.resizeMs+=r}}function Wt(){const e=zt;return zt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Kt=/* @__PURE__ */new Set([z,C]),Rt=e=>Kt.has(e)||"function"==typeof e&&"badge"===e.titleRole,$t=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Ot=/* @__PURE__ */new Set(["svg"]);function jt(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Ft(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Ft(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=>Ft(e,t,n));if(!Y(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===X)return void V.toArray(r.props.children).forEach(e=>Ft(e,t,n));if("string"==typeof r.type){if(Ot.has(r.type))return;if(!$t.has(r.type))return n.push(" "),V.toArray(r.props.children).forEach(e=>Ft(e,t,n)),void n.push(" ")}const o=G(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Rt(r.type)?t.badges:t.actions).push(o)}var qt=/* @__PURE__ */new Map,Bt=/* @__PURE__ */new Set,Ht=0;function Ut(){Ht++,Bt.forEach(e=>e())}function Yt(e){return qt.get(e)}function Xt(e){return Bt.add(e),()=>{Bt.delete(e)}}function Vt(){return Ht}var Gt=R(""),_t=R(null);function Jt({spec:e,children:t}){/* @__PURE__ */
45
- return te(_t.Provider,{value:e,children:t})}var Qt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Zt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',en='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function tn(e){return nn(e).replace(/\s+/g," ").trim()}function nn(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(nn).join("");if(Y(e)){const t=e,n="string"==typeof t.type?t.type:"";return Qt.has(n)?"":` ${nn(t.props?.children)} `}return""}function rn(e){const t=$(Gt);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 on={};function an(e,t,n){const r=$(Gt);q(()=>{if(!r)return;on[r]||(on[r]=[]);const o={label:e,icon:n,onClick:t};return on[r].push(o),()=>{on[r]=(on[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function sn({title:e}){const t=F(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__ */te("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function ln(e){}var cn=R(null);function un(){return $(Gt)}function dn(){const e=H(Nr,Mr),t=$(cn);return t?.active??(zn.length<=1||null!=e)}function hn({children:e,position:t="right",quiet:n=!1}){const r=$(cn),[o,i]=B(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?re(e,o):null}function mn({onClick:e,children:t,className:n}){const r=$(cn);/* @__PURE__ */
46
- return te("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 pn="erp_window_positions",fn={};try{const e=localStorage.getItem(pn);e&&(fn=JSON.parse(e))}catch{}var wn=null;function yn(){wn&&clearTimeout(wn),wn=setTimeout(()=>{try{localStorage.setItem(pn,JSON.stringify(fn))}catch{}},500)}var gn="erp_activation_order",vn=[];try{const e=localStorage.getItem(gn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(vn=t)}catch{}var bn=null;function xn(){bn&&clearTimeout(bn),bn=setTimeout(()=>{try{localStorage.setItem(gn,JSON.stringify(vn))}catch{}},500)}function kn(e,t){fn[e]||(fn[e]=t,yn())}function En(e){return fn[e]?{...fn[e]}:null}function Cn(e,t){fn[e]=t,yn()}function Mn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(fn))n(fn[e],r,o)&&(delete fn[e],i=!0);i&&yn()}var Nn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Sn=4e3,Ln=()=>{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"},Tn={small:.8,medium:1,large:1.25,maximized:1.25},zn=[],An=/* @__PURE__ */new Set,Dn=/* @__PURE__ */new Set,Pn=0,In=/* @__PURE__ */new Map;var Wn=0;function Kn(){return Wn}function Rn(){Wn++,An.forEach(e=>e())}var $n=/* @__PURE__ */new Map,On=/* @__PURE__ */new Map,jn=/* @__PURE__ */new Map;function Fn(){for(let e=zn.length-1;e>=0;e--){const t=jn.get(zn[e]);if(t?.tab)return t.owner}return null}function qn(){return H(Nr,Fn,()=>null)}var Bn=/* @__PURE__ */new Set;var Hn=null;function Un(e){Hn=null,er(e)}function Yn(e){Hn=e;const t=$n.get(e);t&&Un(t)}var Xn=/* @__PURE__ */new Map;function Vn(e){return Xn.get(e)?.holdsChanges()??!1}function Gn(e){const t=Xn.get(e);return t?t.ask():Promise.resolve(!0)}function _n(e){Hn===e&&(Hn=null)}function Jn(e,t,n){if(n&&jn.set(e,n),t)if($n.set(t,e),On.set(e,t),Bn.delete(t)){zn.unshift(e);const n=vn.indexOf(t);-1!==n&&vn.splice(n,1),vn.unshift(t),xn()}else!function(e,t){const n=vn.indexOf(t);if(-1===n)return void zn.push(e);let r=zn.length;for(let e=0;e<zn.length;e++){const t=On.get(zn[e]);if(t&&vn.indexOf(t)>n){r=e;break}}zn.splice(r,0,e)}(e,t),-1===vn.indexOf(t)&&(vn.push(t),xn());else zn.push(e);Rn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Hn===t&&Un(e)}function Qn(e){return e?jn.get(e)?.owner??On.get(e)??null:null}var Zn=/* @__PURE__ */new Set;function er(e){const t=Qn(Mr()),n=zn.indexOf(e);-1!==n&&zn.splice(n,1),zn.push(e);const r=jn.get(e);if(r?.root)for(const[e,t]of jn){if(t.root||t.owner!==r.owner||Dn.has(e))continue;const n=zn.indexOf(e);-1!==n&&zn.splice(n,1),zn.push(e)}Dn.delete(e);const o=On.get(e);if(o){const e=vn.indexOf(o);-1!==e&&vn.splice(e,1),vn.push(o),xn(),Hn&&Hn!==o&&(Hn=null)}Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=Qn(Mr());i&&i!==t&&Zn.forEach(e=>e(i))}function tr(e){const t=zn.indexOf(e);-1!==t&&zn.splice(t,1),Dn.add(e),In.set(e,++Pn);const n=On.get(e);if(n){const e=vn.indexOf(n);-1!==e&&(vn.splice(e,1),xn())}Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var nr=/* @__PURE__ */new Set;var rr=8,or=32;function ir(){return e()}var ar=u.windowBar,sr=80,lr=384,cr=400;function ur(e,t=ir()){const n=Math.min(Math.max(e.x,t.x+sr-e.w),t.x+t.w-sr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-ar);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function dr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=ir();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 hr(e){const t=ir(),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 mr=null;function pr(e){const t=(mr||((mr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${I.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(mr)),mr);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 fr(){mr&&(mr.style.opacity="0",mr.style.display="none")}var wr=[{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"}],yr=350,gr=200;function vr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=B(!1),s=F(void 0),l=F(void 0);q(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),yr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),gr)};/* @__PURE__ */
47
- return ee("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,children:[
48
- /* @__PURE__ */te("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */te("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:wr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */te("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__ */te("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var br="rosh-gesture-style";var xr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},kr=4;function Er(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(br))return;const e=document.createElement("style");e.id=br,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=It(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Cr(e){const t=zn.indexOf(e);if(-1===t)return-1;const n=I.window+t*I.windowStep,r=jn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of jn){if(!t.root||t.owner!==r.owner)continue;const n=zn.indexOf(e);-1!==n&&(o=Math.max(o,I.window+n*I.windowStep))}return o>=n?o+2+Math.min(t,7):n}function Mr(){return zn[zn.length-1]||null}function Nr(e){return An.add(e),()=>{An.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=zn.length-1;e>=0;e--)nr.has(zn[e])||zn.splice(e,1);vn=vn.filter(e=>{const t=$n.get(e);return null!=t&&nr.has(t)}),xn(),Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Sr="modal-close-request";function Lr(e){H(Nr,Kn);const t=$(cn);if(zn.length<=1)return!0;if(e){const t=$n.get(e);if(null!=t)return Mr()===t}return t?.active??null!=Mr()}var Tr=!1,zr=/* @__PURE__ */new Set;function Ar(e){return zr.add(e),()=>zr.delete(e)}function Dr(){return Tr}function Pr(e){Tr!==e&&(Tr=e,zr.forEach(e=>e()))}function Ir(){Pr(!Tr)}function Wr(){Pr(!1)}var Kr=null,Rr=/* @__PURE__ */new Set;function $r(e){return Rr.add(e),()=>Rr.delete(e)}function Or(){return Kr}function jr(e){Kr!==e&&(Kr=e,Rr.forEach(e=>e()))}var Fr=null,qr=/* @__PURE__ */new Set;function Br(e){return qr.add(e),()=>qr.delete(e)}function Hr(){return Fr}function Ur(e){Fr!==e&&(Fr=e,qr.forEach(e=>e()))}function Yr(){if(!Fr)return void Pr(!1);jr(Fr),Ur(null),Pr(!1)}function Xr(){Pr(!Tr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Vr(){const e=H(Ar,Dr),[t,n]=B(e),[r,o]=B(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?re(
49
- /* @__PURE__ */te("div",{onMouseDown:e=>{e.stopPropagation(),Pr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:I.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 Gr({open:t,onClose:i,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:w,bodyScroll:v,onMinimize:C,initialBox:M,actions:T,actionsLeft:z,editing:P=!1,edit:R,allowPinOnTop:O,initialPosition:X,widget:V,compact:Q,appStyle:Z,flushBody:oe,autoHeight:ie,autoMinHeight:ae,autoWidth:se,widgetMenu:le,dimensions:ce,windowKey:ue,openedFromKey:de,accentRgb:he,children:me}){const[pe,fe]=B(()=>r()),we=k()&&!pe,ge=E()&&!!V,[ve,be]=B(0),[xe,ke]=B(!1),Ee=F(null),Ce=F(0);q(()=>{Ce.current=ve},[ve]);const Me=U(e=>{we&&(Ee.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},ke(!0),St(de??null))},[we,de]),Ne=H(Lt,Nt);q(()=>{if(!xe)return;const e=e=>{if(!Ee.current)return;const t=e.clientX-Ee.current.startX;if(Math.abs(e.clientY-Ee.current.startY)>Math.abs(t)+12)return Ee.current=null,ke(!1),be(0),void St(null);be(Math.max(0,t))},t=()=>{if(!Ee.current)return;const e=.3*window.innerWidth,t=Ce.current>e;Ee.current=null,ke(!1),t?(be(window.innerWidth),setTimeout(()=>{i(),be(0),St(null)},180)):(be(0),St(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)}},[xe]);const[Te,Ae]=B(c),De=K(),Pe=De.window;q(()=>{Ae(c)},[c]);const Ie=_(()=>tn(Te).trim()||void 0,[Te]),We=J(),[Ke,Re]=B(!1),$e=F(!1),[Oe,je]=B(!1),[Fe,qe]=B(null),Be=$(_t),He=$(ye),{prefs:Ue,save:Ye}=g(),Xe=!!Ue.window_accent_stripe,Ve=Ue.favorite_documents||[],_e=!!Be&&Ve.some(e=>e.entityType===Be.entityType&&e.entityId===Be.entityId),Qe=U(()=>{if(!Be)return;const e=_e?Ve.filter(e=>!(e.entityType===Be.entityType&&e.entityId===Be.entityId)):[...Ve,{entityType:Be.entityType,entityId:Be.entityId,label:Be.label}];Ye({favorite_documents:e})},[Be,_e,Ve,Ye]),[Ze,et]=B(null),[tt,nt]=B("top-right"===X?"right":"left"),rt=F(!1),ot=F(null);j(()=>{const e=ot.current;e&&(he?e.style.setProperty("--window-accent-rgb",he):e.style.removeProperty("--window-accent-rgb"))},[he]);const it=F(!1),at=F(null),st=F(null),lt=F(null),[ct,ut]=B(!1),dt=F(null),ht=F(null),mt=F(null),[pt,ft]=B(!1);j(()=>{const e=ht.current,t=mt.current;if(!e||!t)return;const n=()=>ft(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!=w&&!1!==w]);const wt=!!R&&!V&&!Q&&!Z&&(R.editing||"hidden"!==R.state),yt=!!(w||T||z)||ct||wt,gt=$(Le),vt=""!==$(Gt),bt=F(null);bt.current=He?{owner:He.key,tab:He.tab,root:!vt}:null;const xt=ue||(He&&!vt?He.key:null),kt=!!gt&&!vt&&gt.enabled&&gt.hasState&&(P||gt.declaredEditable)&&!gt.handMounted&&yt&&!V&&!Q&&!Z&&!we,Ct=/* @__PURE__ */te(D,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),Mt=u&&Y(u)?G(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Ct,Tt=()=>/* @__PURE__ */te("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();qe(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:Mt}),zt=40,{minimize:At,items:Dt,restoreIfMinimized:Pt,openWindows:It}=Je(),Wt=F(`modal-${Math.random().toString(36).slice(2,8)}`).current;q(()=>{if(V)return nr.add(Wt),()=>{nr.delete(Wt)}},[V,Wt]),q(()=>{const e=e=>{const t=e.detail;t?.id===Wt&&Ae(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Wt]);const[Kt,Rt]=B(I.window),$t=function(e){const t=H(Nr,Mr);return zn.length<=1||t===e}(Wt),Ot=F(R);Ot.current=R;const Ft=!!R&&!R.editing&&"enabled"===R.state;q(()=>{if(!t||!$t||!Ft)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(b(e.target,ot.current)||(e.preventDefault(),e.stopPropagation(),Ot.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,$t,Ft]);const Bt=function(e){return H(Nr,()=>Dn.has(e))}(Wt);Et({panelRef:ot,bodyRef:at,open:t,widget:!!V,active:$t,minimized:Bt});const Ht=H(Ar,Dr),Yt=H($r,Or),Xt=H(Br,Hr),Vt=!O&&!V,Jt=Ht&&Vt,[Qt,nn]=B(!1),rn=Jt&&Xt===Wt,[an,sn]=B(!1),ln=an&&Vt&&Yt===Wt?"picked":null,un=F(Jt);q(()=>{if(un.current&&!Jt){sn(!0);const e=setTimeout(()=>{sn(!1),Kr===Wt&&jr(null)},700);return un.current=Jt,()=>clearTimeout(e)}un.current=Jt},[Jt,Wt]),q(()=>{Jt||nn(!1)},[Jt]),q(()=>{const e=st.current,t=lt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ut(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"]')&&ot.current){const t=ot.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=st.current,n=lt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const dn=F(!1),hn=U(e,[]),mn=U(()=>{const t=e(),n=ce?ce[0]:Nn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Tn[Ln()],l=ce?Math.min(ce[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*(zn.length-1),u=Math.max(zt,(i-l)/2),d=(o-a)/2,m=t.h-zt-l-u;return"top-right"===X?{x:t.x+t.w-a-zt,y:t.y+zt,w:a,h:l}:"top-left"===X?{x:t.x+zt,y:t.y+zt,w:a,h:l}:{x:t.x+Math.max(zt,(o-a)/2+zt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),pn=F(!1);t||(pn.current=!1);const wn=ue||d||null;q(()=>{if(!t)return;Jn(Wt,wn,bt.current??void 0),ue||er(Wt),dn.current=!1,Rt(Cr(Wt));const e=()=>{Rt(Cr(Wt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===ue;if(!e.label)return!1;const t=ot.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(er(Wt),Pn.current)return;const t=ir(),n=Math.min(Un.current.w,t.w-40),o=Math.min(Un.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;bn({x:i,y:a,w:n,h:o}),Hn(!1)},i=e=>{const t=e.detail;r(t)&&(er(Wt),qe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==ue)return;er(Wt);const t=Un.current,n=function(e,t=ir()){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=ot.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)}bn(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=zn.indexOf(e);-1!==t&&(zn.splice(t,1),Rn()),Dn.delete(e),In.delete(e),jn.delete(e);const n=On.get(e);n&&(On.delete(e),$n.delete(n))}(Wt),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,Wt,wn,hn]);const gn=!V&&"maximized"===Ln(),[vn,bn]=B(()=>{if(wn&&fn[wn]){const e={...fn[wn]};return ce&&(e.w=ce[0],ie||(e.h=ce[1])),ur(e)}return M?{x:M.x,y:M.y,w:M.w,h:M.h}:gn?hn():mn()}),[xn,kn]=B(()=>!ie),En=F(pe),Cn=F(null);q(()=>{const e=()=>{const e=r();e!==En.current&&Cn.current?.(e),En.current=e,fe(e),Rt(Cr(Wt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Wt]);const Mn=pe&&!!He?.tab&&!vt&&!V&&!we,An=Mn,Pn=F(An);Pn.current=An;const Wn=qn(),Kn=pe&&!!He?.tab&&!V&&!we&&!Ht&&Wn!==He.key,Fn=!!V&&pe&&!Ht&&null!==Wn,[Bn,Hn]=B(()=>wn&&fn[wn]||M?An:An||gn),Un=F(vn);Un.current=vn;const Yn=F(Bn);j(()=>{Yn.current=Bn},[Bn]),j(()=>{if(xn||Mn)return;const e=ot.current,t=at.current;if(!e||!t)return;const n=ae??(V?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,Un.current.y)-24),g=w?Math.min(Un.current.h,y):Math.min(Math.max(n,u+p),y),v=Math.abs(g-o)>1;v&&(o=g,bn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&kn(!0)},160)))},l=new ResizeObserver(s);s(),dt.current&&l.observe(dt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[xn,V,ae,yt,Mn]),j(()=>{if(!ie||!xn||V||!t)return;const e=dt.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||Bn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ae??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Un.current.y)-24);bn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ie,xn,V,t,Bn,ae]);const Vn=!1!==se&&!V&&!Z&&!we,[Gn,_n]=B(()=>!Vn);j(()=>{if(Gn||!t)return;if(!Vn||Bn)return void _n(!0);const n=ot.current,r=at.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Un.current.w,c=0;const u=()=>_n(!0),d=()=>{c=0;const t=Un.current;if(Math.abs(t.w-i)>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)=>{a(e,w)||o.add(m[t])});const v=s(t,l(t.w,w,g),d,zt);v!==t&&(i=v.w,bn(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,Sn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Gn,t,Vn,Bn]);const Qn=F(null),Zn=!(!He?.tab||vt||V||we);Cn.current=t=>{if(!Zn)return;if(t)return Qn.current||(Qn.current={box:{...Un.current},maximized:Yn.current}),void(Yn.current=!0);const r=Qn.current;Qn.current=null;const o=e();if(r?.maximized)return Yn.current=!0,Hn(!0),void bn(o);const i=r?.box??(wn?fn[wn]:void 0);if(Yn.current=!1,Hn(!1),i&&!n(i,o,!1)){const e={...i};ce&&(e.w=ce[0],ie||(e.h=ce[1])),bn(ur(e))}else bn(mn())},q(()=>{An&&(Yn.current=!0,Hn(!0),bn(hn()))},[An,hn]),q(()=>{if(V)return;const e=()=>{const e=wn?fn[wn]:void 0;if(Yn.current=!1,Hn(!1),e){const t={...e};ce&&(t.w=ce[0],ie||(t.h=ce[1])),bn(ur(t))}else bn(mn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,mn,wn]),q(()=>{t&&wn&&!Mn&&(fn[wn]=vn,yn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[vn,t,wn,Mn]),q(()=>{if(!t)return;const e=()=>{Yn.current?bn(hn()):document.body.classList.contains("rosh-gesturing")||bn(ur)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Bn&&(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,Bn,hn]),q(()=>{if(t&&(Re(!1),$e.current=!1,rt.current=!1,_n(!Vn),!Pn.current)){if(wn&&fn[wn]){const e=fn[wn];return void bn(t=>ur({...e,...ie?{h:t.h}:{},...Vn?{x:t.x,w:t.w}:{}}))}M&&(bn({x:M.x,y:M.y,w:M.w,h:M.h}),Hn(M.maximized))}},[t]),q(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{ot.current?.contains(t.target)&&!$e.current&&($e.current=!0,e=setTimeout(()=>Re(!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 ar="auto"===m?Ke:!0===m,sr=He&&!vt?He.key:null,dr=_(()=>jt(Te),[Te]),mr=F({shortcutSpec:Be,isOnDesktop:_e,toggleDesktopShortcut:Qe,taskbarStrings:De.taskbar});j(()=>{mr.current={shortcutSpec:Be,isOnDesktop:_e,toggleDesktopShortcut:Qe,taskbarStrings:De.taskbar}});const wr=F(null);wr.current||(wr.current={open:(e,t)=>qe({x:e,y:t}),items:()=>{const e=mr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of on[Wt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),q(()=>{if(t&&sr)return()=>{return e=sr,void(qt.delete(e)&&Ut());var e}},[t,sr]),Ge(!(ue||!t)&&ar);const yr=U(()=>ar||"auto"===m&&$e.current,[ar,m]),gr=U(async e=>{if(rt.current)return!1;if(!yr())return!0;rt.current=!0;const t=Ie,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 y({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 rt.current=!1,r},[yr,Ie]),br=U(()=>rt.current?Promise.resolve():yr()?gr("close").then(e=>{e&&i()}):(i(),Promise.resolve()),[yr,gr,i]),Lr=U(async()=>{await gr("discard")&&($e.current=!1,Re(!1),Ot.current?.onDiscard())},[gr]),Tr=U(async()=>{const e=await gr("switch");return e&&($e.current=!1,Re(!1)),e},[gr]),zr=F(()=>!1);j(()=>{zr.current=yr}),j(()=>{if(!t||!ue)return;const e={holdsChanges:()=>zr.current(),ask:Tr};return Xn.set(ue,e),()=>{Xn.get(ue)===e&&Xn.delete(ue)}},[t,ue,Tr]),j(()=>{if(!t||!xt)return;const e=e=>{e.detail?.windowKey===xt&&br()};return window.addEventListener(Sr,e),()=>window.removeEventListener(Sr,e)},[t,xt,br]);const Ir=F(null),Wr=U(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(qe(null),er(Wt),Pn.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=ot.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Ir.current){const t=Ir.current;Ir.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:Un.current.x,c=s?s.top:Un.current.y,u=s?s.height:Un.current.h,d=s?s.width:Un.current.w;Hn(!1),bn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<kr&&Math.abs(e.clientY-i)<kr)return;r=Er(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)`),Un.current={...Un.current,x:s,y:u},!V){const t=function(e,t){const n=ir(),r=e<=n.x+rr,o=e>=n.x+n.w-rr,i=t<=n.y+rr,a=t>=n.y+n.h-rr,s=e<=n.x+or,l=e>=n.x+n.w-or,c=t<=n.y+or,u=t>=n.y+n.h-or;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?pr(hr(t)):fr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),fr();const e=ur({...Un.current});if(Un.current=e,!V&&h){Ir.current={x:l,y:c,w:d,h:u};const e=hr(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 bn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;nt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),bn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),Rr=U((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=ot.current,l=s?.getBoundingClientRect(),c=l?l.left:Un.current.x,u=l?l.top:Un.current.y,d=l?l.width:Un.current.w,h=l?l.height:Un.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;Hn(!1),bn({x:c,y:u,w:d,h:h}),Un.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,Un.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)<kr&&Math.abs(e.clientY-a)<kr)return;o=Er(n,r,xr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(lr,d+e)),w&&(i=Math.max(cr,h+t)),m){const t=Math.max(lr,d-e);n=c+d-t,o=t}if(p){const e=Math.max(cr,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?.(),bn({...Un.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Fr=U(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(),er(Wt),"Enter"===e.key)return void(Bn?(Hn(!1),bn(mn())):(Hn(!0),bn(hn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Ir.current||(Ir.current={...Un.current})};if(r<0)return e(),Hn(!0),void bn(hn());if(r>0){if(Bn)return Hn(!1),void bn(mn());if(Ir.current){const e=ur(Ir.current);return Ir.current=null,Un.current=e,void bn(e)}return void tr(Wt)}e(),Hn(!1);const t=hr(n<0?"left":"right");return Un.current=t,void bn(t)}if(Bn)return;const o=Un.current,i=e.shiftKey?{...o,w:Math.max(lr,o.w+24*n),h:Math.max(cr,o.h+24*r)}:ur({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Un.current=i,bn(i)},[Wt,Bn,mn,hn]),qr=U(e=>{Ir.current||(Ir.current={...Un.current}),Hn(!1);const t=hr(e);Un.current=t,bn(t),er(Wt)},[Wt]),Ur=An||Jt?{}:{tabIndex:0,role:"group","aria-label":Ie?`${Ie} — ${Pe.windowSuffix}`:Pe.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:Fr},Yr=()=>{Hn(!0),bn(hn())},Xr=U(()=>{const e=ot.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Zt);t&&!t.disabled&&t.click()}},[]);q(()=>{if(!t)return;if(V)return;const e=e=>{if(zn[zn.length-1]===Wt&&!b(e.target,ot.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&&ot.current?.contains(t)))return;if(t.closest(en))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Xr,Wt,V]),q(()=>{if(!t)return;const e=e=>{zn[zn.length-1]===Wt&&(b(e.target,ot.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Wt}})),$e.current=!1,Re(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Wt}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),q(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&zn[zn.length-1]===Wt){if(W(e))return e.preventDefault(),void e.stopPropagation();if(Mn&&!P)return;e.preventDefault(),e.stopPropagation(),br()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,br,Wt,V,Mn,P]);const Vr=t&&(void 0!==p||void 0!==f),[Gr]=B(()=>{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}),_r=Mn&&!He?.home&&dr.actions.length>0;q(()=>{t&&sr&&function(e,t){const n=qt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(qt.set(e,t),Ut())}(sr,{title:dr.text||Ie,dirty:ar,copy:dr.copy,actions:_r&&Gr?Gr:void 0,menu:wr.current??void 0})},[t,sr,Ie,ar,dr.text,dr.copy,_r,Gr]);const Jr=U(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(zn[zn.length-1]!==Wt)return;if(b(e.target,ot.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Vr&&(e.preventDefault(),p?p():Jr("bottom")),"k"===e.key&&Vr&&(e.preventDefault(),f?f():Jr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Vr,Jr,Wt]),!t||pn.current)return null;const Qr=Jt?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=ir(),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}}(Wt):null,Zr=Jt&&Qr?Math.min(Qr.w/vn.w,Qr.h/vn.h):1,eo=(()=>{if(Jt&&Qr){const e=Zr,t=vn.w*e,n=vn.h*e,r=Qr.x+(Qr.w-t)/2-vn.x,o=Qr.y+(Qr.h-n)/2-vn.y,i=Qt||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:I.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(an&&Vt){const e="picked"===ln;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:I.expose+30}:{}}}return null})(),to=x({modal:!1,titleId:!V&&(Mn?!He?.home:!we)?We:void 0,label:dr.text||Ie}),no=/* @__PURE__ */ee("div",{children:[
50
- /* @__PURE__ */ee("div",{ref:ot,"data-modal-panel":!0,"data-modal-id":Wt,"data-window-key":ue||void 0,...O?{"data-utility":""}:{},...Oe?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...He?{"data-window-owner":He.key}:{},...He&&!vt?{"data-window-root":""}:{},...Mn?{"data-window-tab":""}:{},...to,className:Mn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(V?$t?"shadow-xl":"shadow-lg":"border "+($t?"shadow-xl border-line":"shadow-lg border-line-strong")),onMouseDownCapture:e=>{if(it.current=!1,Jt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),jr(Wt),Pr(!1),void er(Wt)}if(!$t&&!V&&!Oe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ot.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),it.current=!0,qe(null),er(Wt),window.addEventListener("mouseup",()=>{setTimeout(()=>{it.current=!1},0)},{once:!0}))}},onClickCapture:e=>{it.current&&(it.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Jt)return;qe(null);e.target.closest("[data-modal-panel]")===ot.current&&(e.target.closest("button, input, a, select, textarea")||er(Wt))},style:we?{zIndex:Kt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ve}px)`,transition:xe?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...Kt<0?{display:"none"}:{},...$t||Oe||Ne&&ue===Ne?{}:{display:"none"}}:{zIndex:Oe?I.pinnedWindow:Kt+1,width:vn.w,height:vn.h,top:vn.y,...V&&"right"===tt?{right:window.innerWidth-vn.x-vn.w}:{left:vn.x},...Kt<0&&!Oe?{display:"none"}:{},...ge?{display:"none"}:{},...Kn||Fn?{visibility:"hidden",pointerEvents:"none"}:{},...eo??{}},children:[we&&!V&&/* @__PURE__ */te("div",{onPointerDown:Me,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),V?null:Mn?He?.home?null:/* @__PURE__ */ee(ne,{children:[
51
- /* @__PURE__ */te("h2",{id:We,"data-window-title":!0,className:"sr-only",children:dr.text||Ie}),_r&&Gr&&re(
52
- /* @__PURE__ */te(ne,{children:dr.actions}),Gr),dr.badges.length>0&&/* @__PURE__ */te("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:dr.badges})]}):we?null:
53
- /* @__PURE__ */ee("div",Q?{onPointerDown:Wr,"data-window-chrome":"",...Ur,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 "+($t?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:$t?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
54
- /* @__PURE__ */ee("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:$t?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
55
- /* @__PURE__ */te("span",{id:We,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[O&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:Oe?Pe.unpin:Pe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
56
- /* @__PURE__ */te("button",{type:"button",onClick:br,"aria-label":Pe.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */te(D,{name:"close",className:"h-4 w-4"})})]})]}:Z?{onPointerDown:Wr,"data-window-chrome":"",...Ur,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 "+($t?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:$t?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
57
- /* @__PURE__ */ee("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:$t?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
58
- /* @__PURE__ */te("span",{id:We,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[O&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:Oe?Pe.unpin:Pe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
59
- /* @__PURE__ */te("button",{onClick:()=>tr(Wt),title:Pe.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!An&&/* @__PURE__ */te(vr,{maximized:Bn,onToggleMax:()=>{Bn?(Hn(!1),bn(mn())):Yr()},onSnap:qr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:Pe}),
60
- /* @__PURE__ */te("button",{type:"button",onClick:br,"aria-label":Pe.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */te(D,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:Wr,"data-window-chrome":"",...Ur,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 "+($t?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:$t?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
61
- /* @__PURE__ */ee("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:$t?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
62
- /* @__PURE__ */te("span",{id:We,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[O&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:Oe?Pe.unpin:Pe.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
63
- /* @__PURE__ */te("button",{onClick:()=>tr(Wt),title:Pe.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!An&&/* @__PURE__ */te(vr,{maximized:Bn,onToggleMax:()=>{Bn?(Hn(!1),bn(mn())):Yr()},onSnap:qr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:Pe}),
64
- /* @__PURE__ */te("button",{type:"button",onClick:br,"aria-label":Pe.close,className:"rounded-(--radius-control) text-ink-faintest hover:text-gray-600",children:/* @__PURE__ */te(D,{name:"close",className:"h-5 w-5"})})]})]}),he&&Xe&&!V&&!we&&/* @__PURE__ */te("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${$t?.9:.55})`}}),
65
- /* @__PURE__ */te(Gt.Provider,{value:Wt,children:/* @__PURE__ */te(cn.Provider,{value:{rightRef:st,leftRef:lt,notify:()=>ut(!0),active:$t,isDirty:ar,footerOpen:yt&&!V&&!Q&&!Z&&!we},children:/* @__PURE__ */te("div",{ref:at,...V?{onPointerDown:Wr,onContextMenu:e=>{e.preventDefault(),et({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":Z||oe?"p-0":Q?"p-2":"p-4"} ${V||Mn?"":"backdrop-blur-sm"} ${!1===v||Z||oe?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${V?"rounded-2xl select-none":""}`,style:{...V?{touchAction:"none"}:{},backgroundColor:V?"transparent":Mn?"rgb(var(--window-content-rgb))":$t?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */te(Se,{children:me})})})}),V&&Ze&&/* @__PURE__ */ee(N,{minWidth:160,style:{left:Ze.x,top:Ze.y},onClose:()=>et(null),children:[
66
- /* @__PURE__ */te(S,{onClick:()=>{et(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Wt}))},children:"Settings"}),
67
- /* @__PURE__ */te(L,{}),le&&/* @__PURE__ */ee(ne,{children:[le,
68
- /* @__PURE__ */te(L,{})]}),
69
- /* @__PURE__ */ee(S,{onClick:()=>{et(null),je(e=>!e)},children:[
70
- /* @__PURE__ */te("span",{className:"flex-1",children:"Always on Top"}),Oe&&/* @__PURE__ */te(D,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
71
- /* @__PURE__ */te(L,{}),
72
- /* @__PURE__ */te(S,{onClick:()=>{et(null),br()},children:"Close"})]}),
73
- /* @__PURE__ */ee("div",{onPointerDown:Wr,ref:dt,"data-modal-footer":"",className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${Mn?"":" cursor-move"}${$t&&!Mn?" backdrop-blur-sm":""}${V||Q||Z||we||!yt?" hidden":""}`,style:{touchAction:"none",backgroundColor:Mn?"rgb(var(--window-footer-rgb))":$t?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
74
- /* @__PURE__ */ee("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[kt&&/* @__PURE__ */te(ze,{auto:!0}),z,
75
- /* @__PURE__ */te("div",{ref:lt,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=w&&!1!==w&&
76
- /* @__PURE__ */te("div",{ref:ht,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */te("div",{ref:mt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(pt?" invisible":""),children:w})})]}),
77
- /* @__PURE__ */ee("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[wt&&R&&(R.editing?/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Lr()},children:Pe.discard}):"object"==typeof R.state?/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:R.state.disabledReason,children:Pe.edit}):/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>R.onEdit(),children:Pe.edit})),
78
- /* @__PURE__ */te("div",{ref:st,"data-modal-actions":!0,className:"flex items-center gap-2"}),T]})]}),!V&&!we&&!Jt&&$t&&!An&&/* @__PURE__ */ee(ne,{children:[
79
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
80
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
81
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
82
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
83
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
84
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
85
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
86
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Jt&&/* @__PURE__ */te("div",{className:"absolute inset-0",style:{zIndex:I.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>nn(!0),onMouseLeave:()=>nn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),er(Wt),Pr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Qt&&/* @__PURE__ */te("button",{type:"button","data-expose-close":!0,"aria-label":De.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:I.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),br()},children:/* @__PURE__ */te(D,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Jt&&Qr&&/* @__PURE__ */te("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:I.expose+(Qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:tn(Te)})]}),ro=Fe&&/* @__PURE__ */ee(N,{style:{left:Fe.x,top:Fe.y},onClose:()=>qe(null),minWidth:160,children:[!V&&!Q&&!Mn&&/* @__PURE__ */ee(ne,{children:[
87
- /* @__PURE__ */ee(S,{onClick:()=>{tr(Wt),qe(null)},children:[
88
- /* @__PURE__ */te(D,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),Pe.minimize]}),!An&&/* @__PURE__ */ee(S,Bn?{onClick:()=>{Hn(!1),bn(mn()),qe(null)},children:[
89
- /* @__PURE__ */te("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */te("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),Pe.windowed]}:{onClick:()=>{Yr(),qe(null)},children:[
90
- /* @__PURE__ */te(D,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),Pe.maximize]})]}),O&&!Mn&&/* @__PURE__ */ee(S,{onClick:()=>{je(e=>!e),qe(null)},children:[
91
- /* @__PURE__ */te(D,{name:"bookmark-square",className:"h-4 w-4 "+(Oe?"text-blue-600":""),fill:Oe?"currentColor":"none",strokeWidth:1.5}),Oe?Pe.unpin:Pe.pinOnTop]}),Be&&/* @__PURE__ */ee(S,{onClick:()=>{qe(null),Qe()},children:[
92
- /* @__PURE__ */te(D,{name:"star",className:"h-4 w-4",fill:_e?"currentColor":"none",strokeWidth:1.5}),_e?De.taskbar.removeFromDesktop:De.taskbar.addToDesktop]}),(on[Wt]||[]).length>0&&/* @__PURE__ */te(ne,{children:(on[Wt]||[]).map((e,t)=>/* @__PURE__ */ee(S,{onClick:()=>{qe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Mn&&He?.home)&&/* @__PURE__ */ee(ne,{children:[
93
- /* @__PURE__ */te(L,{}),
94
- /* @__PURE__ */ee(S,{danger:!0,onClick:()=>{qe(null),br()},children:[
95
- /* @__PURE__ */te(D,{name:"close",className:"h-4 w-4"}),Pe.close]})]})]}),oo=!!ue&&It.some(e=>e.id===ue),io=!Bt||oo||V?null:/* @__PURE__ */ee("div",{"data-modal-restore-tab":!0,"data-modal-id":Wt,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:[
96
- /* @__PURE__ */te("button",{type:"button",onClick:()=>er(Wt),title:Pe.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:Ie||Pe.windowSuffix}),
97
- /* @__PURE__ */te("button",{type:"button",onClick:()=>er(Wt),title:Pe.restore,"aria-label":Pe.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
98
- /* @__PURE__ */te("button",{type:"button",onClick:()=>{br()},title:Pe.close,"aria-label":Pe.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 re(
99
- /* @__PURE__ */ee(_t.Provider,{value:null,children:[no,ro,io]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Tr&&"Escape"===e.key&&(Ur(null),Pr(!1))});var _r=100,Jr={past:[],future:[]};function Qr(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>_r?r.slice(r.length-_r):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:Jr}}var Zr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var eo=500,to=250;function no({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=Q(Qr,Jr),s=F(/* @__PURE__ */new Map),[l,c]=B(0),u=l>0,[d,h]=B(0),[m,p]=B(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=F(null),v=F(!1),b=U(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=U((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=U(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=U(e=>{h(t=>t+(e?1:-1))},[]),C=U(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=B(0),S=M>0,L=U(e=>{N(t=>t+(e?1:-1))},[]),T=$(Le),z=T?.claimReadOnly;q(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;q(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=F({last:0,count:0,tripped:!1}),P=F(!1),I=U((e,t,n)=>{if(v.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)||(P.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>to&&(r.count=0),r.last=o,++r.count>eo)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${eo} 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.`);g.current={values:b(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,b]),W=U(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),K=U(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};W(e.values),a({type:"undo",redoStep:t})},[o.past,b,W]),R=U(()=>{const e=o.future[0];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};W(e.values),a({type:"redo",undoStep:t})},[o.future,b,W]),[O,j]=B(0),H=F(0),Y=F(0),X=F(!1),V=U(()=>{v.current=!0,P.current=!1,g.current=null,H.current+=1,Y.current=H.current,j(H.current)},[]),G=F(void 0),J=U(e=>{void 0!==e&&(void 0!==G.current&&e!==G.current&&(X.current=!0),G.current=e),V()},[V]);q(()=>{v.current&&O===Y.current&&(v.current=!1,g.current=null,(P.current||X.current)&&a({type:"clear"}),P.current=!1,X.current=!1)},[O]);const Z=U(()=>{X.current=!0,a({type:"clear"}),V()},[V]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=Lr(r),ie=F({undo:K,redo:R,canUndo:ne,canRedo:re});ie.current={undo:K,redo:R,canUndo:ne,canRedo:re},q(()=>{if(!oe||!y)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&&Zr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=_(()=>({register:x,unregister:k,record:I,undo:K,redo:R,clear:Z,baseline:J,canUndo:ne,canRedo:re,enabled:y,hasState:u,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,I,K,R,Z,J,ne,re,y,u,S,L,E,f,C,o.past,o.future]),se=""!==un(),le=$(cn)?.footerOpen??!1,ce=se&&y&&u&&!S&&le;/* @__PURE__ */
100
- return ee(Le.Provider,{value:ae,children:[ce&&/* @__PURE__ */te(hn,{position:"left",quiet:!0,children:/* @__PURE__ */te(ze,{auto:!0})}),e]})}function ro(){const e=$(Le),t=U(()=>{},[]);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 oo(e){const t=$(Le),n=t?.claimReadOnly,r=t?.claimEditable;q(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function io(e,t,n){const r=$(Le),o=J(),i=F(e),a=F(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=F(r);c.current=r;const u=F({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 ao(e,t){const[n,r]=B(e);return io(n,e=>r(()=>e),t),[n,r]}export{mn as CancelButton,et as DocFavStar,qe as EntityWindowFallback,je as EntityWindowLoading,Be as EntityWindowState,en as KEY_ACTIVATED_SELECTOR,$e as LoadingSpinner,Zt as MODAL_SUBMIT_SELECTOR,Gr as Modal,hn as ModalActions,ze as UndoControls,no as UndoProvider,de as WINDOW_REGISTRY,Ne as WindowCrashedFallback,Se as WindowErrorBoundary,xt as WindowManagerProvider,sn as WindowTitle,at as activateWindowById,It as beginWindowGesture,_n as cancelWindowFront,we as client_default,Yr as commitExposeHighlight,Gn as confirmWindowDiscard,Wt as drainPerfEvents,Wr as exitExposeMode,Mn as forgetMaximizedWindowBoxes,Mr as getActiveModalId,ct as getActiveWindowRoute,Hr as getExposeHighlight,Vt as getWindowChromeVersion,En as getWindowPosition,Ue as isDraftEntityId,Ye as isDraftEntityWindow,le as isEntityEntry,se as isPageEntry,pe as isShellApiClientConfigured,We as isTabWindow,Pt as markMenuOpen,Yt as readWindowChrome,Yn as requestWindowFront,Ur as setExposeHighlight,Dt as setPerfCollecting,me as setShellApiClient,xe as setShellHomeRoute,Me as setShellTabStrip,ue as setShellWindowRegistry,kn as setWindowDefaultPosition,Cn as setWindowPosition,jt as splitTitle,Br as subscribeExposeHighlight,Xt as subscribeWindowChrome,Ke as tabGroupOf,Ir as toggleExposeMode,qn as useCurrentTabKey,un as useEnclosingModalId,Lr as useIsActiveWindow,dn as useModalActive,ge as usePageSearch,ro as useUndo,oo as useUndoCanEdit,io as useUndoable,ao as useUndoableState,rn as useWidgetSettings,Ge as useWindowDirty,Je as useWindowManager,an as useWindowMenuItem,ln as useWindowTitle,Vn as windowHoldsChanges};
File without changes