efficient-shell 10.1.1 → 10.3.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 (374) hide show
  1. package/README.md +1 -1
  2. package/dist/{Browser-Q34VNUTL.js → Browser-LLDEI3D4.js} +14 -14
  3. package/dist/Calculator-S5OP2NS6.js +29 -0
  4. package/dist/CurrencyConverter-MQ3OOVX4.js +21 -0
  5. package/dist/Documents-R4PFEZFW.js +52 -0
  6. package/dist/Files-QN442YH7.js +88 -0
  7. package/dist/Notepad-HNO5KF7B.js +24 -0
  8. package/dist/{PdfViewer-WNKGFJD6.js → PdfViewer-Z4YKDHIH.js} +1 -1
  9. package/dist/{PomodoroTimer-X5Y3LA3V.js → PomodoroTimer-CX677P57.js} +25 -25
  10. package/dist/{Preview-3FZTC25R.js → Preview-BE4R3UND.js} +44 -44
  11. package/dist/Sidebar-QCUDD4OU.js +44 -0
  12. package/dist/Spreadsheet-2JP2EAFZ.js +37 -0
  13. package/dist/{Stock-KESFJPYD.js → Stock-PWPUDMK2.js} +4 -4
  14. package/dist/{Weather-BYGZVNNK.js → Weather-3N3MSFQV.js} +15 -15
  15. package/dist/{WorldClock-P4JVDPGE.js → WorldClock-6QYLEBLL.js} +7 -7
  16. package/dist/ai/index.js +59 -59
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/media-host-check.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/brand.css +1 -1
  21. package/dist/charts/BoxPlotChart.js +1 -1
  22. package/dist/charts/CandlestickChart.js +1 -1
  23. package/dist/charts/CartesianPlot.js +1 -1
  24. package/dist/charts/ChartBrush.js +1 -1
  25. package/dist/charts/ChartFrame.js +1 -1
  26. package/dist/charts/ChartSkeleton.js +1 -1
  27. package/dist/charts/ChartTooltip.js +1 -1
  28. package/dist/charts/ChordChart.js +1 -1
  29. package/dist/charts/ColumnChart.js +1 -1
  30. package/dist/charts/FunnelChart.js +1 -1
  31. package/dist/charts/HeatmapChart.js +1 -1
  32. package/dist/charts/HistogramChart.js +1 -1
  33. package/dist/charts/Meter.js +1 -1
  34. package/dist/charts/PieChart.js +1 -1
  35. package/dist/charts/RadarChart.js +1 -1
  36. package/dist/charts/RadialBarChart.js +1 -1
  37. package/dist/charts/RangeChart.js +1 -1
  38. package/dist/charts/RankedBars.js +1 -1
  39. package/dist/charts/SankeyChart.js +1 -1
  40. package/dist/charts/ScatterChart.js +1 -1
  41. package/dist/charts/SpecChart.js +1 -1
  42. package/dist/charts/StatTile.js +1 -1
  43. package/dist/charts/SunburstChart.js +1 -1
  44. package/dist/charts/TimeSeriesChart.js +1 -1
  45. package/dist/charts/TreemapChart.js +1 -1
  46. package/dist/charts/WaterfallChart.js +1 -1
  47. package/dist/chunk-2JG5JU4M.js +8 -0
  48. package/dist/{chunk-5VSP3TYU.js → chunk-2K2W6VIR.js} +1 -1
  49. package/dist/{chunk-QXRRAADR.js → chunk-2SY76NFO.js} +4 -4
  50. package/dist/{chunk-BMXMSAQE.js → chunk-2VTO64YC.js} +7 -7
  51. package/dist/{chunk-HL6JSDN3.js → chunk-34URULVW.js} +1 -1
  52. package/dist/{chunk-RZR3OAKV.js → chunk-35DG7Y4M.js} +1 -1
  53. package/dist/{chunk-MH6DI6YY.js → chunk-37U326EL.js} +12 -12
  54. package/dist/{chunk-YL6LLHJA.js → chunk-3CPB3WP2.js} +18 -18
  55. package/dist/chunk-3DVNXNTF.js +1 -0
  56. package/dist/{chunk-CKPVXDKX.js → chunk-3ELLBQPS.js} +3 -3
  57. package/dist/{chunk-A6RB4PIX.js → chunk-3NW5LD7D.js} +4 -4
  58. package/dist/{chunk-BNQRPLBW.js → chunk-3RORPK2J.js} +1 -1
  59. package/dist/{chunk-U5DMF2TX.js → chunk-4BYJQU37.js} +1 -1
  60. package/dist/chunk-4PAWQEXM.js +1 -0
  61. package/dist/{chunk-N6TK43YN.js → chunk-573EHCD7.js} +54 -54
  62. package/dist/{chunk-CUA6CREW.js → chunk-5S3YYN7M.js} +7 -7
  63. package/dist/{chunk-Q5YM65DZ.js → chunk-632N62BY.js} +8 -8
  64. package/dist/{chunk-LOYCPZUB.js → chunk-63L5ORRZ.js} +1 -1
  65. package/dist/{chunk-B7HW6XZD.js → chunk-67JCJ2MG.js} +1 -1
  66. package/dist/{chunk-4VDGVF5T.js → chunk-6PFZK6ED.js} +1 -1
  67. package/dist/{chunk-P6LB3I3D.js → chunk-6RX4PVBU.js} +1 -1
  68. package/dist/chunk-6XBWM453.js +6 -0
  69. package/dist/{chunk-ZG2HMC7S.js → chunk-7SMV6G4Z.js} +1 -1
  70. package/dist/{chunk-X6YT3I5F.js → chunk-7X3XNVES.js} +1 -1
  71. package/dist/{chunk-WUMHSI4U.js → chunk-7X5FABQS.js} +1 -1
  72. package/dist/{chunk-JZK3UDOT.js → chunk-7YOQS3C6.js} +1 -1
  73. package/dist/{chunk-TDLU6GF5.js → chunk-7Z4PTLDL.js} +4 -4
  74. package/dist/{chunk-2OJ3HGFY.js → chunk-A4HJDSRA.js} +6 -6
  75. package/dist/chunk-A5BV6NFA.js +7 -0
  76. package/dist/{chunk-42XMT5JN.js → chunk-AJO72CPB.js} +2 -2
  77. package/dist/{chunk-OQW42DOR.js → chunk-AKM6JBMD.js} +1 -1
  78. package/dist/chunk-AM2F5ZXH.js +2 -0
  79. package/dist/{chunk-4WZRNPIG.js → chunk-AUWTGM65.js} +1 -1
  80. package/dist/chunk-B73AXE6P.js +1 -0
  81. package/dist/{chunk-V4RYE6KA.js → chunk-C2P2Z6HU.js} +11 -11
  82. package/dist/{chunk-WKSNTMEJ.js → chunk-CAVADOJK.js} +1 -1
  83. package/dist/chunk-CBEKJTXU.js +9 -0
  84. package/dist/{chunk-Q4LBBFLO.js → chunk-CGQAKGPT.js} +6 -6
  85. package/dist/{chunk-AEQFFD5I.js → chunk-CHBRMAJV.js} +1 -1
  86. package/dist/{chunk-2OE5VVBE.js → chunk-CPZ42W2B.js} +1 -1
  87. package/dist/{chunk-BDAKGS7O.js → chunk-D7F442OZ.js} +1 -1
  88. package/dist/{chunk-BZPPDYEE.js → chunk-DDCMMOB4.js} +1 -1
  89. package/dist/{chunk-5VTRKWKO.js → chunk-DKGZPVLL.js} +1 -1
  90. package/dist/{chunk-XABYSSXW.js → chunk-DLNIRZNR.js} +1 -1
  91. package/dist/{chunk-RBIGSJ2J.js → chunk-DRDYZ633.js} +2 -2
  92. package/dist/{chunk-FS2KWQJW.js → chunk-E5MVH3SH.js} +10 -10
  93. package/dist/chunk-EU3JZGV2.js +14 -0
  94. package/dist/{chunk-GGIFS34Z.js → chunk-EYZZW6SO.js} +5 -5
  95. package/dist/{chunk-43T5JGFB.js → chunk-EZEYKCI6.js} +1 -1
  96. package/dist/{chunk-DTJRIWFR.js → chunk-F27JJHNJ.js} +1 -1
  97. package/dist/{chunk-7ILNRFEV.js → chunk-FFIQPFUR.js} +1 -1
  98. package/dist/{chunk-TLRCTNUF.js → chunk-G4GVLK44.js} +1 -1
  99. package/dist/chunk-G5NQOV7L.js +6 -0
  100. package/dist/{chunk-JB3WKDD7.js → chunk-GGK27H67.js} +1 -1
  101. package/dist/{chunk-2YLG32JY.js → chunk-GISDIVFK.js} +1 -1
  102. package/dist/{chunk-FFASZGNZ.js → chunk-GNHLVGG5.js} +3 -3
  103. package/dist/{chunk-6FPDOEOX.js → chunk-GSKLHUQ6.js} +1 -1
  104. package/dist/chunk-GTNJAKFO.js +29 -0
  105. package/dist/{chunk-GY67Y5SN.js → chunk-H4HB5OET.js} +1 -1
  106. package/dist/{chunk-6L2UAAGT.js → chunk-HNBGLF4B.js} +1 -1
  107. package/dist/{chunk-YJSX6JAC.js → chunk-I2XGPTCN.js} +1 -1
  108. package/dist/{chunk-NHH2MXFU.js → chunk-I4VIEGCX.js} +1 -1
  109. package/dist/chunk-IKNG7EFQ.js +12 -0
  110. package/dist/{chunk-RQNZ2PVW.js → chunk-INNIWRVU.js} +4 -4
  111. package/dist/{chunk-J53OQCKC.js → chunk-IOJNSX4N.js} +7 -7
  112. package/dist/{chunk-JKZJVQIB.js → chunk-IPFWXM2Y.js} +6 -6
  113. package/dist/{chunk-WMQ2URP4.js → chunk-JQYNMUZW.js} +1 -1
  114. package/dist/{chunk-K7PCBUDC.js → chunk-JRZ7PPVJ.js} +6 -6
  115. package/dist/chunk-JSGQWVYH.js +7 -0
  116. package/dist/{chunk-ZCV377AG.js → chunk-KEPJWZJZ.js} +3 -3
  117. package/dist/{chunk-JJP54OT4.js → chunk-KJ4CBZEQ.js} +1 -1
  118. package/dist/{chunk-XHMIJ7S3.js → chunk-KP2THXEI.js} +6 -6
  119. package/dist/{chunk-GKK7DR2H.js → chunk-LCJRTJXT.js} +9 -9
  120. package/dist/{chunk-Q3MNSM7W.js → chunk-LDE5IV2M.js} +4 -4
  121. package/dist/{chunk-MZ26SYFY.js → chunk-LEDUD23S.js} +1 -1
  122. package/dist/chunk-LNWQBSYD.js +5 -0
  123. package/dist/{chunk-7TONF2PM.js → chunk-LOFYSLC7.js} +9 -9
  124. package/dist/{chunk-AGLBDT7X.js → chunk-LTKXAHS3.js} +8 -8
  125. package/dist/{chunk-WP4CIYJ7.js → chunk-LYIXZFMP.js} +1 -1
  126. package/dist/{chunk-BMQCUHSD.js → chunk-M22B3Y5Y.js} +1 -1
  127. package/dist/{chunk-CLQFP42I.js → chunk-MBXLROCD.js} +1 -1
  128. package/dist/{chunk-KCV7BFKJ.js → chunk-MCDM2G4W.js} +1 -1
  129. package/dist/{chunk-R4Q5653D.js → chunk-MNXRAZJV.js} +20 -20
  130. package/dist/{chunk-VC42SDAC.js → chunk-MQU3PZUS.js} +1 -1
  131. package/dist/{chunk-OZAAIE4E.js → chunk-MVZRZTQP.js} +1 -1
  132. package/dist/{chunk-NNOA7AVG.js → chunk-MXH3UPCH.js} +5 -5
  133. package/dist/{chunk-ZLHPCPXS.js → chunk-N4DI5F74.js} +18 -18
  134. package/dist/{chunk-EIUCHQI2.js → chunk-N67QX3WW.js} +2 -2
  135. package/dist/{chunk-MLKY5ESV.js → chunk-O45WQK57.js} +1 -1
  136. package/dist/{chunk-RSIGTZMU.js → chunk-O4V5PEA3.js} +1 -1
  137. package/dist/{chunk-M554OMPA.js → chunk-O6JJIR4H.js} +1 -1
  138. package/dist/{chunk-APXQMZSV.js → chunk-O7DW2BKY.js} +26 -26
  139. package/dist/{chunk-UB5TLWZN.js → chunk-ON67HF5K.js} +8 -8
  140. package/dist/{chunk-KZQAGXME.js → chunk-ORIGX2H5.js} +4 -4
  141. package/dist/chunk-OTGQYHVC.js +9 -0
  142. package/dist/{chunk-4UEXVRBC.js → chunk-OUAOK44B.js} +1 -1
  143. package/dist/chunk-OW7MLJ3Y.js +1 -0
  144. package/dist/{chunk-JRBQLRAZ.js → chunk-OZBM2XFQ.js} +1 -1
  145. package/dist/{chunk-ZRZ5LOW3.js → chunk-PBWUEBJ5.js} +1 -1
  146. package/dist/{chunk-CMHLXELO.js → chunk-PGGBOZE5.js} +3 -3
  147. package/dist/chunk-PJQGYKN6.js +11 -0
  148. package/dist/chunk-PN65IIYN.js +8 -0
  149. package/dist/chunk-PUF75SMJ.js +1 -0
  150. package/dist/{chunk-5EX6XXUX.js → chunk-PXDDCD5X.js} +1 -1
  151. package/dist/{chunk-RKFEJ5CX.js → chunk-PXQG5EIH.js} +1 -1
  152. package/dist/{chunk-5VDT4762.js → chunk-QEKOEIOQ.js} +2 -2
  153. package/dist/{chunk-GMRZX2ET.js → chunk-QHOBK35Y.js} +1 -1
  154. package/dist/{chunk-7VCAMNCH.js → chunk-QP4UPCXQ.js} +1 -1
  155. package/dist/chunk-QQPIQCT7.js +11 -0
  156. package/dist/{chunk-GVY2X4CC.js → chunk-QWWJUYZI.js} +17 -17
  157. package/dist/{chunk-CL7SBEBQ.js → chunk-QYRMFGES.js} +1 -1
  158. package/dist/{chunk-3V6ZERBS.js → chunk-RBQWIHYD.js} +1 -1
  159. package/dist/chunk-RCPFUDPS.js +4 -0
  160. package/dist/chunk-RPYFOQM2.js +6 -0
  161. package/dist/{chunk-53KQSCMG.js → chunk-SDQIXE5M.js} +9 -9
  162. package/dist/{chunk-NW7Z3G7P.js → chunk-SF654IHN.js} +13 -13
  163. package/dist/{chunk-LPDI5NL6.js → chunk-SO6X4CII.js} +2 -2
  164. package/dist/{chunk-VP63OOO4.js → chunk-SOECV4V5.js} +3 -3
  165. package/dist/chunk-SWN3LSQX.js +12 -0
  166. package/dist/{chunk-TBPHW42V.js → chunk-TKJBZIHT.js} +1 -1
  167. package/dist/chunk-TMNAHOJ7.js +9 -0
  168. package/dist/{chunk-CBGKLHPB.js → chunk-TOVKWNI2.js} +6 -6
  169. package/dist/{chunk-PF5CKD4C.js → chunk-TVH7IZQ4.js} +2 -2
  170. package/dist/{chunk-LNARMEEZ.js → chunk-TXDA7TTP.js} +1 -1
  171. package/dist/{chunk-SKY2NBTQ.js → chunk-UBOP6HFI.js} +5 -5
  172. package/dist/{chunk-J7CIBRDS.js → chunk-UDRMZ22J.js} +1 -1
  173. package/dist/{chunk-IWJRSC7M.js → chunk-ULAGXDOL.js} +1 -1
  174. package/dist/{chunk-O6ABVKHU.js → chunk-ULXCDM7Y.js} +10 -10
  175. package/dist/{chunk-MVQMAIZM.js → chunk-UPQW4GCT.js} +1 -1
  176. package/dist/{chunk-E3RHEEA6.js → chunk-URERZUX5.js} +1 -1
  177. package/dist/{chunk-RPMWF42S.js → chunk-UTWJKSET.js} +5 -5
  178. package/dist/{chunk-SWO4VPOB.js → chunk-UWIZX3RK.js} +1 -1
  179. package/dist/{chunk-EQN65XOO.js → chunk-UYRITNQW.js} +4 -4
  180. package/dist/{chunk-QSW3YHPK.js → chunk-VKKK4WLS.js} +4 -4
  181. package/dist/{chunk-JJYAYMY7.js → chunk-VTFZ6W2D.js} +2 -2
  182. package/dist/chunk-W35N7SL3.js +8 -0
  183. package/dist/{chunk-IWEL2ZCV.js → chunk-W5CJD54C.js} +1 -1
  184. package/dist/{chunk-45XXERGA.js → chunk-W6SC3ZNO.js} +2 -2
  185. package/dist/{chunk-ZF545DXX.js → chunk-W6URVLQF.js} +14 -14
  186. package/dist/{chunk-R5EJJ6HC.js → chunk-WINNA7LS.js} +1 -1
  187. package/dist/chunk-WMEYNKXZ.js +22 -0
  188. package/dist/{chunk-DKQWFQAV.js → chunk-WN5HHHLO.js} +1 -1
  189. package/dist/chunk-WTTSB4SV.js +3 -0
  190. package/dist/{chunk-4UX6ET7G.js → chunk-XKDBYJHF.js} +1 -1
  191. package/dist/{chunk-HI6IE5HI.js → chunk-XO7URRTM.js} +1 -1
  192. package/dist/chunk-Y3R267FV.js +15 -0
  193. package/dist/chunk-YAW54RRC.js +1 -0
  194. package/dist/{chunk-Y23TGQFN.js → chunk-YCOYCPAH.js} +3 -3
  195. package/dist/chunk-YGSU5KCP.js +9 -0
  196. package/dist/{chunk-VMDBVXDJ.js → chunk-YJLLLO5R.js} +1 -1
  197. package/dist/{chunk-BDFZNLFQ.js → chunk-YWDEFPSW.js} +3 -3
  198. package/dist/{chunk-FMC2XNSP.js → chunk-ZNAVCHBV.js} +6 -6
  199. package/dist/{chunk-B7AHMB3U.js → chunk-ZURB2DCM.js} +1 -1
  200. package/dist/{chunk-NQJKANUP.js → chunk-ZUS7FXKE.js} +13 -13
  201. package/dist/{chunk-3V74SUZO.js → chunk-ZZOBG6GP.js} +17 -17
  202. package/dist/chunk-ZZVE64OI.js +2 -0
  203. package/dist/data/DataTable.js +1 -1
  204. package/dist/data/Kanban.js +1 -1
  205. package/dist/data/ListFooter.js +1 -1
  206. package/dist/data/ListLoadError.js +1 -1
  207. package/dist/data/Pagination.js +1 -1
  208. package/dist/file-intake/index.js +1 -1
  209. package/dist/format/index.js +1 -1
  210. package/dist/forms/AlignmentGrid.js +1 -1
  211. package/dist/forms/BorderInput.js +1 -1
  212. package/dist/forms/BrandAssetEditor.js +1 -1
  213. package/dist/forms/Button.js +1 -1
  214. package/dist/forms/Calendar.js +1 -1
  215. package/dist/forms/ColorPicker.js +1 -1
  216. package/dist/forms/ComposerAttachments.js +1 -1
  217. package/dist/forms/CornersInput.js +1 -1
  218. package/dist/forms/DatePicker.js +1 -1
  219. package/dist/forms/DateRangePicker.js +1 -1
  220. package/dist/forms/DateTimePicker.js +1 -1
  221. package/dist/forms/DisplayChips.js +1 -1
  222. package/dist/forms/FilePicker.js +1 -1
  223. package/dist/forms/FormErrorSummary.js +1 -1
  224. package/dist/forms/IconButton.js +1 -1
  225. package/dist/forms/IconPicker.js +1 -1
  226. package/dist/forms/ImageFocusPoint.js +1 -1
  227. package/dist/forms/InputNumber.js +1 -1
  228. package/dist/forms/LinkPicker.js +1 -1
  229. package/dist/forms/MediaLibrary.js +1 -1
  230. package/dist/forms/MediaUploadField.js +1 -1
  231. package/dist/forms/MediaUploadGrid.js +1 -1
  232. package/dist/forms/MediaUsedInList.js +1 -1
  233. package/dist/forms/NumericKeypad.js +1 -1
  234. package/dist/forms/PictureTiles.js +1 -1
  235. package/dist/forms/PositionInput.js +1 -1
  236. package/dist/forms/Segmented.js +1 -1
  237. package/dist/forms/Select.js +1 -1
  238. package/dist/forms/SidesInput.js +1 -1
  239. package/dist/forms/Slider.js +1 -1
  240. package/dist/forms/Snippet.js +1 -1
  241. package/dist/forms/SplitButton.js +1 -1
  242. package/dist/forms/TagInput.js +1 -1
  243. package/dist/forms/TextToolbar.js +1 -1
  244. package/dist/forms/TimePicker.js +1 -1
  245. package/dist/forms/WidthsBar.js +1 -1
  246. package/dist/forms/mediaLibraryMenu.js +1 -1
  247. package/dist/forms/mediaMoveItems.js +1 -1
  248. package/dist/forms/textAlign.js +1 -1
  249. package/dist/forms/useFileIntake.js +1 -1
  250. package/dist/hooks/useTheme.d.ts +1 -1
  251. package/dist/icons/efficient-glyphs.js +1 -1
  252. package/dist/icons/efficient-looks.js +1 -1
  253. package/dist/icons/efficient.js +1 -1
  254. package/dist/icons/index.js +1 -1
  255. package/dist/icons/looks/map.js +1 -1
  256. package/dist/icons/sets.js +1 -1
  257. package/dist/index.d.ts +2 -1
  258. package/dist/index.js +130 -130
  259. package/dist/locales/zh-Hans.js +1 -1
  260. package/dist/map/index.js +8 -8
  261. package/dist/page-tabs/index.js +5 -5
  262. package/dist/pdf/index.js +1 -1
  263. package/dist/shell/Accordion.js +1 -1
  264. package/dist/shell/AppUpdateBanner.js +1 -1
  265. package/dist/shell/Avatar.js +1 -1
  266. package/dist/shell/Banner.js +1 -1
  267. package/dist/shell/Breadcrumbs.js +1 -1
  268. package/dist/shell/BudgetBar.js +1 -1
  269. package/dist/shell/Card.js +1 -1
  270. package/dist/shell/ColoredBadge.js +1 -1
  271. package/dist/shell/ConfirmDialog.js +1 -1
  272. package/dist/shell/ContainerFillChart.js +1 -1
  273. package/dist/shell/ContextMenu.js +1 -1
  274. package/dist/shell/CountBadge.js +1 -1
  275. package/dist/shell/Dialog.d.ts +16 -3
  276. package/dist/shell/Dialog.js +1 -1
  277. package/dist/shell/Drawer.d.ts +6 -2
  278. package/dist/shell/Drawer.js +1 -1
  279. package/dist/shell/DropdownMenu.js +1 -1
  280. package/dist/shell/EditableGrid.js +1 -1
  281. package/dist/shell/EmptyState.js +1 -1
  282. package/dist/shell/FloatingBar.js +1 -1
  283. package/dist/shell/GlobalSearch.js +1 -1
  284. package/dist/shell/HelpCenter.js +1 -1
  285. package/dist/shell/IconRail.js +1 -1
  286. package/dist/shell/ImageLightbox.js +1 -1
  287. package/dist/shell/ItemCount.js +1 -1
  288. package/dist/shell/LanguageSelect.js +1 -1
  289. package/dist/shell/Markdown.js +1 -1
  290. package/dist/shell/MetricBar.js +1 -1
  291. package/dist/shell/MetricBarLegend.js +1 -1
  292. package/dist/shell/MilestoneTimeline.js +1 -1
  293. package/dist/shell/PageHeader.js +1 -1
  294. package/dist/shell/PopupMenu.js +1 -1
  295. package/dist/shell/ProductionTimeline.js +1 -1
  296. package/dist/shell/ResizeHandle.js +1 -1
  297. package/dist/shell/Result.js +1 -1
  298. package/dist/shell/SearchableSelect.js +1 -1
  299. package/dist/shell/SettingReset.js +1 -1
  300. package/dist/shell/SettingRow.js +1 -1
  301. package/dist/shell/SidebarLayout.js +1 -1
  302. package/dist/shell/SidebarNav.js +1 -1
  303. package/dist/shell/SortableList.js +1 -1
  304. package/dist/shell/Statistic.js +1 -1
  305. package/dist/shell/StatusBadge.js +1 -1
  306. package/dist/shell/Tabs.js +1 -1
  307. package/dist/shell/TimeAgo.js +1 -1
  308. package/dist/shell/TimelineTrack.js +1 -1
  309. package/dist/shell/Tooltip.js +1 -1
  310. package/dist/shell/TopNav.js +1 -1
  311. package/dist/shell/TransferProgress.js +1 -1
  312. package/dist/shell/Tree.js +1 -1
  313. package/dist/shell/discardGuard.d.ts +43 -0
  314. package/dist/shell/discardGuard.js +2 -0
  315. package/dist/shell/language.js +1 -1
  316. package/dist/shell/strings.d.ts +6 -0
  317. package/dist/shell/strings.js +1 -1
  318. package/dist/shell/toast.js +1 -1
  319. package/dist/telemetry/index.js +1 -1
  320. package/dist/templates/AuthScreen.js +1 -1
  321. package/dist/templates/ChatTemplate.js +1 -1
  322. package/dist/templates/CheckoutTemplate.js +1 -1
  323. package/dist/templates/DashboardTemplate.js +1 -1
  324. package/dist/templates/DataTablePage.js +1 -1
  325. package/dist/templates/EmailTemplate.js +1 -1
  326. package/dist/templates/ErrorBoundary.d.ts +1 -1
  327. package/dist/templates/ErrorBoundary.js +1 -1
  328. package/dist/templates/ErrorPage.js +1 -1
  329. package/dist/templates/FormLayoutPage.js +1 -1
  330. package/dist/templates/GalleryTemplate.js +1 -1
  331. package/dist/ui/index.d.ts +1 -0
  332. package/dist/ui/index.js +1 -1
  333. package/dist/ui.css +5 -0
  334. package/dist/utils/glass.d.ts +4 -2
  335. package/dist/utils/glass.js +1 -1
  336. package/dist/version.js +1 -1
  337. package/package.json +1 -1
  338. package/dist/Calculator-63XNC3BA.js +0 -29
  339. package/dist/CurrencyConverter-Q4HYAY4N.js +0 -21
  340. package/dist/Documents-KLVVF4KK.js +0 -52
  341. package/dist/Files-AOIBTQTE.js +0 -88
  342. package/dist/Notepad-SOUIZDKN.js +0 -24
  343. package/dist/Sidebar-4OI4LP6G.js +0 -44
  344. package/dist/Spreadsheet-RBEVCQIV.js +0 -37
  345. package/dist/chunk-2SLQD57V.js +0 -6
  346. package/dist/chunk-4X6GIVTI.js +0 -29
  347. package/dist/chunk-5GUBNCTP.js +0 -1
  348. package/dist/chunk-A3VJ4PRU.js +0 -11
  349. package/dist/chunk-ACVKU6YW.js +0 -7
  350. package/dist/chunk-AG2OLB3E.js +0 -15
  351. package/dist/chunk-AXL7VTNM.js +0 -11
  352. package/dist/chunk-BCDG4N6L.js +0 -6
  353. package/dist/chunk-DY2M6BIG.js +0 -12
  354. package/dist/chunk-F7A6K3D5.js +0 -9
  355. package/dist/chunk-GZYTCHPX.js +0 -8
  356. package/dist/chunk-IFANUMK3.js +0 -4
  357. package/dist/chunk-IGEFUHYE.js +0 -12
  358. package/dist/chunk-K64JRGNE.js +0 -6
  359. package/dist/chunk-KE5U4KKG.js +0 -4
  360. package/dist/chunk-KFRU53WD.js +0 -8
  361. package/dist/chunk-N6VP75F5.js +0 -3
  362. package/dist/chunk-OPB3I4JH.js +0 -8
  363. package/dist/chunk-QASKQDUR.js +0 -22
  364. package/dist/chunk-QMUAY24U.js +0 -8
  365. package/dist/chunk-QZ3MO3HB.js +0 -1
  366. package/dist/chunk-RUTUVS4H.js +0 -1
  367. package/dist/chunk-SDI2UGAG.js +0 -1
  368. package/dist/chunk-SKETTGCJ.js +0 -2
  369. package/dist/chunk-UP442DPT.js +0 -9
  370. package/dist/chunk-VO3ZB7C6.js +0 -14
  371. package/dist/chunk-W244OMOU.js +0 -7
  372. package/dist/chunk-X2PZMXDP.js +0 -1
  373. package/dist/chunk-YVTKTWZX.js +0 -9
  374. package/dist/chunk-ZN2BFSQR.js +0 -2
package/README.md CHANGED
@@ -1642,7 +1642,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
1642
1642
  | `DropdownMenu` | A button and the menu it opens, right under it: actions, links (`href`, drawn by `linkAs`), radios, labels and dividers, with shared dismissal and the menu-button keyboard. `align` lines it up with the trigger's left or right edge; `side="top"` suits a trigger in a bottom action bar. See [Dropdown menus](#dropdown-menus). |
1643
1643
  | `SplitButton` | A main action and its own menu as one control ("Publish ▾"): a `Button` half and a chevron half that opens a `DropdownMenu` of `items`. Two tab stops, one shape. The chevron's name `menuLabel` is required and shows in a `Tooltip`. The main half can be off with a `disabledReason` while the chevron still opens the menu. See [Split buttons](#split-buttons). |
1644
1644
  | `Popover` | A button and the panel it opens, right under it, placed by `DropdownMenu`'s rule (left edges together, or right with `align="end"`, flipping and shifting to stay on screen and in its window, never wider than a phone allows): a non-modal `role="dialog"` named by `title` or `aria-label`, for check boxes, a date, a short form. A kit popup opened inside it (a `DatePicker`'s calendar, a `Select`'s list) does not close it. Focus moves in as it opens; Tab reads it as if it sat right after its trigger; Escape closes it and gives focus back. See [Popovers](#popovers). |
1645
- | `Dialog`, `Drawer` | A modal sheet that is not a shell window — centred (`Dialog`) or pinned to an edge (`Drawer`, `side` right / left / bottom) — for a till, a routed page or a form: trapped focus, a locked page, Escape and a backdrop click to close (`blocking` turns both off), a close cross when there is no `footer`. A `Dialog` is never taller than the screen less its gutter: a longer form — on a phone, most of them — scrolls inside the panel, footer included, and a footer wider than the panel wraps. `title` names it; `description` is a line under the title that DESCRIBES it to a screen reader — without one the body does, which suits a confirm whose body is the question and not a form, whose every label would be read out. `role="alertdialog"` (Dialog) for a confirmation that interrupts. A heading or note that lives in the body — a form that loads the record its heading names — names and describes it through `aria-labelledby` / `aria-describedby`. Two open at once — the second inside the first, or beside it on `<body>` where a host portals its dialogs — each hold focus, and only the one in front moves Tab (`useFocusTrap` keeps a stack). Opened over a shell window, a key pressed in it is its own: the window behind does not take ⌘⏎ (submit), ⌘S (save), ⌥⇧D (duplicate), ⌥⇧E (edit) or J / K from it, nor Escape. Its root layer carries `data-overlay-layer`, which is how the window tells. |
1645
+ | `Dialog`, `Drawer` | A modal sheet that is not a shell window — centred (`Dialog`) or pinned to an edge (`Drawer`, `side` right / left / bottom) of the shell window that opened it, or of the screen when there is none (harness UI-50): the window it is declared in, or for `confirm()` / `prompt()` the window that had focus; it moves only as far as it takes to stay wholly on screen, and its scrim still covers the screen — for a till, a routed page or a form: trapped focus, a locked page, Escape and a backdrop click to close (`blocking` turns both off), a close cross when there is no `footer`. A `Dialog` is never taller than the screen less its gutter: a longer form — on a phone, most of them — scrolls inside the panel, footer included, and a footer wider than the panel wraps. `title` names it; `description` is a line under the title that DESCRIBES it to a screen reader — without one the body does, which suits a confirm whose body is the question and not a form, whose every label would be read out. `role="alertdialog"` (Dialog) for a confirmation that interrupts. `dirty` (`true` / `false`, or `'auto'` to latch on the first `input` or `change` inside) makes Escape, the cross and a click outside ask the `<Modal>`'s "Discard changes?" first, and Keep Editing leaves it open (harness UI-50); a save or the consumer's own Cancel closes by flipping `open` and never asks. A heading or note that lives in the body — a form that loads the record its heading names — names and describes it through `aria-labelledby` / `aria-describedby`. Two open at once — the second inside the first, or beside it on `<body>` where a host portals its dialogs — each hold focus, and only the one in front moves Tab (`useFocusTrap` keeps a stack). Opened over a shell window, a key pressed in it is its own: the window behind does not take ⌘⏎ (submit), ⌘S (save), ⌥⇧D (duplicate), ⌥⇧E (edit) or J / K from it, nor Escape. Its root layer carries `data-overlay-layer`, which is how the window tells. |
1646
1646
  | `ConfirmProvider`, `confirm` | Imperative `confirm({ title, body })` returning a Promise<boolean>. |
1647
1647
  | `GlobalSearch` | Cmd-K command palette. Pass `providers: SearchProvider[]` to add results; a provider is called `(query, { signal })` and the `signal` aborts when a newer query, closing the palette or unmount supersedes the call, so pass it to the request. Only the latest query's response is shown, whether or not a provider honours the signal. A result whose `entity_type` is `__page__` opens a page; an `entity_id` of `/path?search=text` (URL-encoded) opens that page's list with its search box filled in. Portalled to `<body>` on the overlay layer (`Z_LAYERS.overlay`), so it covers every window, pinned or not; opening it closes any open popup (`dismissPopups`). Results are grouped under a header per `result.type` (with a count), in the order each type first appears in the merged responses — providers answer best match first, so the group holding an exact match leads. ↑/↓ run through every row across groups, Tab / Shift+Tab jump to the first row of the next / previous group, Enter opens; the input is an ARIA combobox over a listbox with `role="group"` sections. With fewer than two characters typed it shows an empty state instead: **Recent** (the last 8 results picked, most recent first, deduplicated by `entity_type` + `entity_id`), **Favorites** and **Actions** — each section only when it has rows. `recent` + `onRecord` and `favorites` are props, so a routed app that passes none gets no Recent / Favorites (`pushRecentSearch(recent, picked)` keeps the list for it); `Layout` passes them from the user's preferences (`search_recent`, `favorite_documents`). Picking a result or a Recent row calls `onRecord(result)` then `onSelect(result)`; picking a Favorite or an Action does not record. **While searching**, the previous answer's rows stay drawn (with a spinner in the input row) until the next one lands; "Searching…" shows only when there is nothing to draw yet. **Failures are not "no results"**: an aborted call is silent, but a provider that rejects marks the search failed — every provider down shows `strings.search.searchFailed` instead of "No results", some down shows the rows that arrived plus a one-line `partialFailure` warning. **"See all"**: a provider may answer `SearchResult[]` or a `SearchResponse` (`{ results, truncatedTypes? }`); a group whose type is in `truncatedTypes` counts as "5+", and when `SearchConfig.listRoutes` maps its type to a `SearchListRoute` (`{ path, label }`, label the plural the consumer names its list by, e.g. `customers`) it ends in a "See all {label}" row that calls `onSelect` with a `__page__` result for `${path}?search=${encodeURIComponent(query)}` (so the page must read `usePageSearch()`); it is never recorded in Recent, and a group that is not truncated gets neither the "+" nor the row. `SearchConfig.quickActions` (`{ label, icon?, keywords?, onSelect }[]`) are the Actions: always in the empty state, and in a typed search an "Actions" group at the end for those whose label or keywords contain the query. **A result's kind and its words are separate**: `result.type` is the heading the reader sees, and an optional `result.typeKey` (`sales_order`) is the identity results group by and `typeIcons`, `listRoutes` and `truncatedTypes` are keyed by. Without `typeKey` the heading is the key, as before; a host with a translated interface sets it, because the same kind arrives under a different heading in each language. `SearchConfig.typeLabels` maps a type key to today's words, so a group's heading and the badge on a Recent row saved in another language read in the language the page is in. **⌘K / Ctrl+K is shared with the page.** A press that something nearer the user already handled (`preventDefault()`) is left alone, so an embed with its own ⌘K search keeps it. `SearchConfig.hotkey: false` (also a `GlobalSearch` prop) turns the key off altogether for a page whose handler does not claim it; the overlay still opens from a button that calls `openGlobalSearch()`, and Escape still closes it. |
1648
1648
  | `ShortcutHelp` | The keyboard cheatsheet shown on `?`. |
@@ -1,29 +1,29 @@
1
- import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-CMHLXELO.js";import{WindowTitle as r}from"./chunk-N6TK43YN.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-E3RHEEA6.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-3V6ZERBS.js";import{confirm as n}from"./chunk-GVY2X4CC.js";import"./chunk-IFANUMK3.js";import"./chunk-GMRZX2ET.js";import"./chunk-SDI2UGAG.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-RKFEJ5CX.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-QZ3MO3HB.js";import"./chunk-MH6DI6YY.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as s}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as i,useState as l}from"react";import{jsxs as c,jsx as m,Fragment as u}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],k=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function g(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&k.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var f=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(d);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const u=a(void 0);void 0===u.current&&(u.current=e()),i(()=>{null!=u.current&&t(u.current)},[]);const p=u.current?g(u.current.url):"",[b,k]=l(w),[f,y]=l(p||b),[j,C]=l(f),[R,E]=l([f]),[W,z]=l(0),[D,H]=l(0),[L,M]=l(x),[S,U]=l(!1),[G,T]=l(null),K=a(null),A=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(L))}catch{}},[L]);const X=e=>{const t=g(e);t&&(y(t),C(t),E(e=>{const o=e.slice(0,W+1);return o.push(t),o}),z(e=>e+1),U(!1))},I=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},J=()=>{const e=G?.trim();e?(M(t=>[...t,{label:e,url:f}]),T(null)):T(null)};i(()=>{if(null===G)return;K.current?.focus(),K.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||T(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==G]);const O=e=>{M(t=>t.filter((t,o)=>o!==e))},P=W>0,Z=W<R.length-1,F=L.some(e=>e.url===f),B="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
1
+ import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-PGGBOZE5.js";import{WindowTitle as r}from"./chunk-573EHCD7.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import{confirm as n}from"./chunk-QWWJUYZI.js";import"./chunk-LNWQBSYD.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-OW7MLJ3Y.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-YAW54RRC.js";import"./chunk-37U326EL.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import"./chunk-34URULVW.js";import{Icon as s}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as i,useState as l}from"react";import{jsxs as c,jsx as m,Fragment as u}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],k=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function g(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&k.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var f=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(d);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const u=a(void 0);void 0===u.current&&(u.current=e()),i(()=>{null!=u.current&&t(u.current)},[]);const p=u.current?g(u.current.url):"",[b,k]=l(w),[f,y]=l(p||b),[j,C]=l(f),[W,R]=l([f]),[z,D]=l(0),[E,U]=l(0),[L,H]=l(x),[S,T]=l(!1),[M,G]=l(null),J=a(null),P=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(L))}catch{}},[L]);const Q=e=>{const t=g(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,z+1);return o.push(t),o}),D(e=>e+1),T(!1))},X=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},I=()=>{const e=M?.trim();e?(H(t=>[...t,{label:e,url:f}]),G(null)):G(null)};i(()=>{if(null===M)return;J.current?.focus(),J.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||G(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==M]);const K=e=>{H(t=>t.filter((t,o)=>o!==e))},O=z>0,A=z<W.length-1,B=L.some(e=>e.url===f),Y="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
2
  return c("div",{className:"relative flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */m(r,{title:`Browser - ${v(f)}`}),
4
4
  /* @__PURE__ */m(o,{app:"browser"}),
5
5
  /* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
6
- /* @__PURE__ */m("button",{onClick:()=>{if(W>0){const e=W-1;z(e),y(R[e]),C(R[e]),U(!1)}},disabled:!P,className:B,title:"Back",children:/* @__PURE__ */m(s,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
- /* @__PURE__ */m("button",{onClick:()=>{if(W<R.length-1){const e=W+1;z(e),y(R[e]),C(R[e]),U(!1)}},disabled:!Z,className:B,title:"Forward",children:/* @__PURE__ */m(s,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
- /* @__PURE__ */m("button",{onClick:()=>H(e=>e+1),className:B,title:"Refresh",children:/* @__PURE__ */m(s,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
- /* @__PURE__ */m("button",{onClick:()=>X(b),className:B,title:"Home",children:/* @__PURE__ */m(s,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
- /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),X(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
6
+ /* @__PURE__ */m("button",{onClick:()=>{if(z>0){const e=z-1;D(e),y(W[e]),C(W[e]),T(!1)}},disabled:!O,className:Y,title:"Back",children:/* @__PURE__ */m(s,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */m("button",{onClick:()=>{if(z<W.length-1){const e=z+1;D(e),y(W[e]),C(W[e]),T(!1)}},disabled:!A,className:Y,title:"Forward",children:/* @__PURE__ */m(s,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */m("button",{onClick:()=>U(e=>e+1),className:Y,title:"Refresh",children:/* @__PURE__ */m(s,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */m("button",{onClick:()=>Q(b),className:Y,title:"Home",children:/* @__PURE__ */m(s,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
+ /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),Q(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
11
11
  /* @__PURE__ */m("span",{className:"px-2 text-gray-400 text-xs",children:f.startsWith("https://")?"🔒":"⚠️"}),
12
12
  /* @__PURE__ */m("input",{type:"text",value:j,onChange:e=>C(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),f!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(f),className:"px-2 text-2xs text-ink-faintest hover:text-ink",title:"Reset to current URL",children:"×"})]})}),
13
- /* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>F?O(L.findIndex(e=>e.url===f)):void T(v(f)),className:B+" "+(F?"text-yellow-500":""),title:F?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(s,{name:"star",className:"h-4 w-4",fill:F?"currentColor":"none",strokeWidth:1.5})}),
14
- /* @__PURE__ */m("button",{onClick:I,className:B,title:"Open in new tab",children:/* @__PURE__ */m(s,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
- /* @__PURE__ */m("button",{onClick:()=>U(e=>!e),className:B,title:"Embedding help",children:/* @__PURE__ */m(s,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==G&&/* @__PURE__ */c("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
13
+ /* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>B?K(L.findIndex(e=>e.url===f)):void G(v(f)),className:Y+" "+(B?"text-yellow-500":""),title:B?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(s,{name:"star",className:"h-4 w-4",fill:B?"currentColor":"none",strokeWidth:1.5})}),
14
+ /* @__PURE__ */m("button",{onClick:X,className:Y,title:"Open in new tab",children:/* @__PURE__ */m(s,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
+ /* @__PURE__ */m("button",{onClick:()=>T(e=>!e),className:Y,title:"Embedding help",children:/* @__PURE__ */m(s,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==M&&/* @__PURE__ */c("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
16
16
  /* @__PURE__ */m("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
17
17
  /* @__PURE__ */m("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:f,children:f}),
18
- /* @__PURE__ */m("input",{ref:K,type:"text",value:G,onChange:e=>T(e.target.value),onKeyDown:e=>{"Enter"===e.key?J():"Escape"===e.key&&T(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
18
+ /* @__PURE__ */m("input",{ref:J,type:"text",value:M,onChange:e=>G(e.target.value),onKeyDown:e=>{"Enter"===e.key?I():"Escape"===e.key&&G(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
19
  /* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
20
- /* @__PURE__ */m("button",{onClick:()=>T(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
- /* @__PURE__ */m("button",{onClick:J,disabled:!G.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
22
- /* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===L.length&&/* @__PURE__ */m("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),L.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>X(e.url),onContextMenu:async o=>{o.preventDefault();await n({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&O(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
20
+ /* @__PURE__ */m("button",{onClick:()=>G(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
+ /* @__PURE__ */m("button",{onClick:I,disabled:!M.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
22
+ /* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===L.length&&/* @__PURE__ */m("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),L.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>Q(e.url),onContextMenu:async o=>{o.preventDefault();await n({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&K(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
23
23
  /* @__PURE__ */m("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
24
24
  /* @__PURE__ */m("div",{className:"flex-1"}),
25
25
  /* @__PURE__ */m("button",{onClick:()=>{k(f);try{localStorage.setItem(h,f)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
26
- /* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:f,iframeKey:D,iframeRef:A,openExternal:I,showHelp:S,dismissHelp:()=>U(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,h]=l(!1);i(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return f.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
26
+ /* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:f,iframeKey:E,iframeRef:P,openExternal:X,showHelp:S,dismissHelp:()=>T(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,h]=l(!1);i(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return f.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
27
27
  /* @__PURE__ */m(s,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
28
28
  /* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
29
29
  /* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
@@ -0,0 +1,29 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-LYIXZFMP.js";import{useWidgetSettings as n}from"./chunk-573EHCD7.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import"./chunk-QWWJUYZI.js";import"./chunk-LNWQBSYD.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-OW7MLJ3Y.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-37U326EL.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import"./chunk-34URULVW.js";import{Icon as r}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as l,useEffect as o}from"react";import{jsxs as s,Fragment as a,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function m(){const[m,k]=c("0"),[p,d]=c(null),[b,g]=c(null),[N,j]=c(!1),[y,x]=c(""),[f,C]=c([]),[v,$]=c(!1),[W,E]=c(()=>e(h)),[T,D]=c(!1),[U,M]=c(W),R=i(null);n(l(()=>{M({...W}),D(!0)},[W]));const w=l(e=>{x(""),k(t=>N||"0"===t?(j(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),J=l(()=>{k("0"),d(null),g(null),j(!1)},[]),Q=l((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),X=l(e=>{const t=parseFloat(m);if(null!==p&&b&&!N){const e=Q(p,t,b);k(String(e)),d(e),C(n=>[`${p} ${b} ${t} = ${e}`,...n].slice(0,20))}else d(t);g(e),j(!0)},[m,p,b,N,Q]),H=l(()=>{if(null===p||!b)return;const e=parseFloat(m),t=Q(p,e,b),n=`${p} ${b} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),x(n),k(String(t)),d(null),g(null),j(!0)},[m,p,b,Q]),L=l(()=>{k(e=>String(parseFloat(e)/100))},[]),S=l(()=>{k(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);o(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?w(e.key):"."===e.key?w("."):"+"===e.key?X("+"):"-"===e.key?X("-"):"*"===e.key?X("×"):"/"===e.key?(e.preventDefault(),X("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&R.current?.contains(e.target)&&e.preventDefault(),H()):"Escape"===e.key?J():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&L())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w,X,H,J,L]);const A="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",F=`${A} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,P=`${A} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,Z=`${A} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,B=`${A} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
+ return s(a,{children:[
3
+ /* @__PURE__ */s("div",{ref:R,className:"flex flex-col h-full",style:{opacity:W.activeOpacity/100,backdropFilter:W.activeBlur>0?`blur(${W.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */s("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
5
+ /* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:f.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(y||b&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:y||`${p} ${b} ${N?"":m}`}),
6
+ /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),$(!0),setTimeout(()=>$(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,v?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
8
+ /* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(m)})]})]}),
9
+ /* @__PURE__ */s("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
10
+ /* @__PURE__ */u("button",{onClick:J,className:Z,children:"AC"}),
11
+ /* @__PURE__ */u("button",{onClick:S,className:Z,children:"+/−"}),
12
+ /* @__PURE__ */u("button",{onClick:L,className:Z,children:"%"}),
13
+ /* @__PURE__ */u("button",{onClick:()=>X("÷"),className:`${P} ${"÷"===b?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */u("button",{onClick:()=>w("7"),className:F,children:"7"}),
15
+ /* @__PURE__ */u("button",{onClick:()=>w("8"),className:F,children:"8"}),
16
+ /* @__PURE__ */u("button",{onClick:()=>w("9"),className:F,children:"9"}),
17
+ /* @__PURE__ */u("button",{onClick:()=>X("×"),className:`${P} ${"×"===b?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */u("button",{onClick:()=>w("4"),className:F,children:"4"}),
19
+ /* @__PURE__ */u("button",{onClick:()=>w("5"),className:F,children:"5"}),
20
+ /* @__PURE__ */u("button",{onClick:()=>w("6"),className:F,children:"6"}),
21
+ /* @__PURE__ */u("button",{onClick:()=>X("-"),className:`${P} ${"-"===b?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */u("button",{onClick:()=>w("1"),className:F,children:"1"}),
23
+ /* @__PURE__ */u("button",{onClick:()=>w("2"),className:F,children:"2"}),
24
+ /* @__PURE__ */u("button",{onClick:()=>w("3"),className:F,children:"3"}),
25
+ /* @__PURE__ */u("button",{onClick:()=>X("+"),className:`${P} ${"+"===b?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */u("button",{onClick:()=>w("0"),className:`${F} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */u("button",{onClick:()=>w("."),className:F,children:"."}),
28
+ /* @__PURE__ */u("button",{onClick:H,className:B,children:"="})]})]}),
29
+ /* @__PURE__ */u(t,{open:T,onClose:()=>D(!1),title:"Calculator Settings",appearance:U,onAppearanceChange:M,onSave:()=>{E(U),localStorage.setItem(h,JSON.stringify(U)),D(!1)}})]})}export{m as default};
@@ -0,0 +1,21 @@
1
+ import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-LYIXZFMP.js";import{useWidgetSettings as r}from"./chunk-573EHCD7.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import"./chunk-QWWJUYZI.js";import"./chunk-LNWQBSYD.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-OW7MLJ3Y.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-37U326EL.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import"./chunk-34URULVW.js";import"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as o,useEffect as c}from"react";import{jsxs as a,Fragment as i,jsx as l}from"react/jsx-runtime";var m=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",h="currency_appearance",d="currency_rates_cache";function g(t){try{const e=JSON.parse(localStorage.getItem(d)||"{}")[t];if(e&&Date.now()-e.timestamp<36e5)return e.rates}catch{}return null}function k(t,e){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[t]={rates:e,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function N(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var j={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[u,d]=s(N),[f,x]=s(()=>t(h)),[y,b]=s({}),[D,S]=s(!1),[v,C]=s(!1),[U,J]=s([]),[R,W]=s(f),[H,M]=s("USD"),[B,I]=s("CNY");r(o(()=>{J([...u]),W({...f}),C(!0)},[u,f])),c(()=>{const t=[...new Set(u.map(([t])=>t))];let e=!0;return async function(){S(!0);const r={};for(const e of t){const t=g(e);if(t)r[e]=t;else try{const t=await fetch(`https://open.er-api.com/v6/latest/${e}`),n=await t.json();n.rates&&(r[e]=n.rates,k(e,n.rates))}catch{}}e&&(b(r),S(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
2
+ return a(i,{children:[
3
+ /* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */a("div",{className:"px-4 py-3 space-y-1",children:[D&&/* @__PURE__ */l(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=y[t]?.[e];/* @__PURE__ */
4
+ return a("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(t),localStorage.setItem(p,JSON.stringify(t))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
5
+ /* @__PURE__ */a("div",{className:"flex items-center gap-2",children:[
6
+ /* @__PURE__ */l("span",{className:"text-base",children:j[t]||""}),
7
+ /* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:t}),
8
+ /* @__PURE__ */l("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
9
+ /* @__PURE__ */l("span",{className:"text-base",children:j[e]||""}),
10
+ /* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
11
+ /* @__PURE__ */l("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${t}-${e}-${r}`)})]})}),
12
+ /* @__PURE__ */l(e,{open:v,onClose:()=>C(!1),title:"Currency Settings",appearance:R,onAppearanceChange:W,onSave:()=>{if(0===U.length)return;const t=U.slice(0,4);d(t),x(R),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(R)),C(!1)},children:/* @__PURE__ */a("div",{children:[
13
+ /* @__PURE__ */a("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Currency Pairs ",
14
+ /* @__PURE__ */a("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",U.length,"/",4,")"]})]}),
15
+ /* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:U.map(([t,e],r)=>/* @__PURE__ */a("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
+ /* @__PURE__ */a("span",{className:"text-sm",children:[j[t]||""," ",t," → ",j[e]||""," ",e]}),
17
+ /* @__PURE__ */l("button",{onClick:()=>J(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),U.length<4?/* @__PURE__ */a("div",{className:"flex items-center gap-2",children:[
18
+ /* @__PURE__ */l("select",{value:H,onChange:t=>M(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(t=>/* @__PURE__ */l("option",{children:t},t))}),
19
+ /* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
20
+ /* @__PURE__ */l("select",{value:B,onChange:t=>I(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(t=>/* @__PURE__ */l("option",{children:t},t))}),
21
+ /* @__PURE__ */l("button",{onClick:()=>{H!==B&&U.length<4&&J(t=>[...t,[H,B]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */a("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
@@ -0,0 +1,52 @@
1
+ import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-PGGBOZE5.js";import{WindowTitle as n}from"./chunk-573EHCD7.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import"./chunk-QWWJUYZI.js";import"./chunk-LNWQBSYD.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-OW7MLJ3Y.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as r}from"./chunk-AKM6JBMD.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-YAW54RRC.js";import{PopupMenu as o,PopupMenuLabel as i,PopupMenuItem as l,PopupMenuDivider as a}from"./chunk-37U326EL.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import"./chunk-34URULVW.js";import{Icon as s}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as c}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useState as m,useRef as h}from"react";import{jsxs as u,jsx as d}from"react/jsx-runtime";var p=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),g=/* @__PURE__ */new Set(["docx"]),x={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function f(){const[f,y]=m(x),[k,v]=m(!1),[b,j]=m(!1),[w,N]=m(!1),[D,C]=m(null),M=h(null),L=h(null),U=h(null),R=(e,t)=>{U.current?.focus(),document.execCommand(e,!1,t),N(!0)},W=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{U.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),N(!0)},e.readAsDataURL(t)}},T=e=>{D&&(D.el.removeAttribute("width"),D.el.removeAttribute("height"),D.el.style.width=e??"",D.el.style.height=e?"auto":"",N(!0),C(null))},B=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();v(!0);try{if(p.has(n)||!g.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");y({filename:t.name,kind:"text",content:o,ext:n}),N(!1)}else if(g.has(n))try{const e=await(import(
2
+ /* @vite-ignore */
3
+ "mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},A=f?.filename?(X=f.filename).length>24?`${X.slice(0,23)}…`:X:"Untitled";var X;/* @__PURE__ */
4
+ return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||j(!0)},onDragLeave:e=>{e.currentTarget===e.target&&j(!1)},onDrop:e=>{e.preventDefault(),j(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?W(t):B(t[0]))},children:[
5
+ /* @__PURE__ */d(n,{title:`${A}${w?" •":""} - Documents`}),
6
+ /* @__PURE__ */d(t,{app:"documents"}),
7
+ /* @__PURE__ */u("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
8
+ /* @__PURE__ */d("input",{ref:M,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&B(t),M.current&&(M.current.value="")},className:"hidden"}),
9
+ /* @__PURE__ */u("button",{onClick:()=>M.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
10
+ /* @__PURE__ */d(s,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
11
+ /* @__PURE__ */d("button",{onClick:()=>{if(!f)return;const t=U.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=U.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
12
+ /* @__PURE__ */d("span",{className:"text-2xs text-ink-faintest ml-1",children:"TXT · DOCX · Code"}),
13
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
14
+ /* @__PURE__ */u("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:f.filename,children:[f.filename,w?" •":""]}),
15
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
16
+ /* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
17
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
18
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
19
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
20
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
21
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
22
+ /* @__PURE__ */u("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{R("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
23
+ /* @__PURE__ */d("option",{value:"",disabled:!0,children:"Size"}),
24
+ /* @__PURE__ */d("option",{value:"1",children:"XS"}),
25
+ /* @__PURE__ */d("option",{value:"2",children:"S"}),
26
+ /* @__PURE__ */d("option",{value:"3",children:"M"}),
27
+ /* @__PURE__ */d("option",{value:"4",children:"L"}),
28
+ /* @__PURE__ */d("option",{value:"5",children:"XL"}),
29
+ /* @__PURE__ */d("option",{value:"6",children:"2XL"})]}),
30
+ /* @__PURE__ */d("input",{type:"color",defaultValue:"#000000",onChange:e=>R("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
31
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
32
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
33
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
34
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
35
+ /* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
36
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */d("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */d("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
37
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */d("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */d("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
38
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */d("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */d("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
+ /* @__PURE__ */d("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */d("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */d("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
40
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
+ /* @__PURE__ */d("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&W(Array.from(e.target.files)),L.current&&(L.current.value="")}}),
42
+ /* @__PURE__ */u("button",{onClick:()=>L.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
43
+ /* @__PURE__ */d(s,{name:"image",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
44
+ /* @__PURE__ */d("div",{className:"flex-1 min-h-0 overflow-hidden",children:k?/* @__PURE__ */d(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */d("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */d("div",{ref:U,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>N(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),W(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),C({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:f.content},className:"docx"===f.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-surface p-[1in] shadow text-sm leading-relaxed text-ink-strong outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-sm leading-relaxed text-ink-strong bg-surface outline-none whitespace-pre-wrap"})})}),b&&/* @__PURE__ */d("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */d("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),D&&/* @__PURE__ */u(o,{minWidth:150,style:{left:D.x,top:D.y},onClose:()=>C(null),children:[
45
+ /* @__PURE__ */d(i,{children:"Image width"}),
46
+ /* @__PURE__ */d(l,{onClick:()=>T("25%"),children:"25%"}),
47
+ /* @__PURE__ */d(l,{onClick:()=>T("50%"),children:"50%"}),
48
+ /* @__PURE__ */d(l,{onClick:()=>T("75%"),children:"75%"}),
49
+ /* @__PURE__ */d(l,{onClick:()=>T("100%"),children:"100%"}),
50
+ /* @__PURE__ */d(l,{onClick:()=>T(null),children:"Original size"}),
51
+ /* @__PURE__ */d(a,{}),
52
+ /* @__PURE__ */d(l,{danger:!0,onClick:()=>{D?.el.remove(),N(!0),C(null)},children:"Remove image"})]})]})}export{f as default};
@@ -0,0 +1,88 @@
1
+ import{openPreviewFile as e}from"./chunk-MCDM2G4W.js";import{SidebarLayout as t}from"./chunk-A4HJDSRA.js";import"./chunk-QWK6DRSN.js";import"./chunk-DRDYZ633.js";import{Breadcrumbs as a}from"./chunk-O4V5PEA3.js";import{formatBytes as n}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as r}from"./chunk-MUMQ6PW7.js";import{AboutApp as i}from"./chunk-PGGBOZE5.js";import{peekFilesViewRequest as s,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as c,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-XAROKI7X.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-573EHCD7.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import{confirm as g,prompt as k}from"./chunk-QWWJUYZI.js";import"./chunk-LNWQBSYD.js";import"./chunk-KC3EX26K.js";import{ItemCount as b}from"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-OW7MLJ3Y.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as y}from"./chunk-AKM6JBMD.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-YAW54RRC.js";import"./chunk-37U326EL.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import"./chunk-34URULVW.js";import{Icon as N}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as w}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import{TH_ONE_LINE as v}from"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useState as j,useEffect as $,useSyncExternalStore as D,useRef as C,useCallback as R}from"react";import{jsxs as E,jsx as T,Fragment as L}from"react/jsx-runtime";var W="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",M={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function P(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function U(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function S(){const S=W.replace(/\/$/,""),A=null!==r(),[I,O]=j("/"),[F,J]=j([]),[V,H]=j([]),[Q,X]=j(null),[B,K]=j(!0),[G,Z]=j(!1),[z,Y]=j(null),[_,q]=j(!1),[ee,te]=j(()=>{const e=s();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});$(()=>{o()},[]);const[ae,ne]=j([]);$(()=>{const e=()=>{o(),te("trash")},t=e=>{o();const t=e.detail?.folderId;t&&te({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const re=D(d,m,m),ie="object"==typeof ee?ee.desktopFolderId:null,se=ie?re?.folders.find(e=>e.id===ie)??null:null,oe=ie&&re?.itemsByFolder[ie]||[];$(()=>{ie&&re&&!re.folders.some(e=>e.id===ie)&&te("files")},[ie,re]);const le=C(0),ce=C(null),{openPage:de,openEntity:me}=f(),he=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>de(e)}):"page"===t.entityType?de(t.entityId):me(t.entityType,t.entityId,null,t.label)},pe=R((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ue=R(async()=>{try{const e=await pe(`${S}/api/quota`);if(e.ok){const t=await e.json();Y({used:t.used,limit:t.limit})}}catch{}},[pe,S]),fe=R(async e=>{if(X(null),A){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return J(t),O(e),Z(!1),K(!1),void("/"===e&&H(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}K(!0);try{const t=await pe(`${S}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),n=a.entries||[];J(n),O(a.path||e),Z(!1),"/"===(a.path||e)&&H(n.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){Z(!0)}finally{K(!1)}ue()},[pe,S,ue,A]),xe=R(async()=>{if(A)return ne([]),void K(!1);K(!0),X(null);try{const e=await pe(`${S}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void y.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ne(t.entries||[]),Z(!1)}catch{Z(!0)}finally{K(!1)}ue()},[pe,S,ue,A]);$(()=>{"files"===ee?fe(I):"trash"===ee&&xe()},[I,ee]);const ge=async e=>{const t=P(I,e.name);try{const a=await pe(`${S}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void y.error(`Download failed (${a.status})`);const n=await a.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){y.error(e?.message||"Download failed")}},ke=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await pe(`${S}/api/upload?path=${encodeURIComponent(I)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));y.error(`Quota exceeded — ${n(a)} free, ${e.name} is ${n(t.attempted||e.size)}`)}else y.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){y.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}fe(I)},be=()=>{le.current=0,q(!1)};if($(()=>{const e=()=>be();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),G)/* @__PURE__ */
2
+ return E("div",{className:"flex flex-col h-full bg-white",children:[
3
+ /* @__PURE__ */T(x,{title:"Files - offline"}),
4
+ /* @__PURE__ */T("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */E("div",{className:"max-w-md",children:[
5
+ /* @__PURE__ */T(N,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
+ /* @__PURE__ */T("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
+ /* @__PURE__ */E("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
+ /* @__PURE__ */T("span",{className:"font-mono",children:S}),". Make sure the server is running — see ",
9
+ /* @__PURE__ */T("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
+ /* @__PURE__ */T("button",{onClick:()=>fe(I),className:"px-3 h-8 text-sm bg-blue-500 text-on-accent rounded hover:bg-blue-600",children:"Retry"})]})})]});const ye="/"===I?[]:I.split("/").filter(Boolean),Ne=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,we=Ne>90?"bg-red-500":Ne>75?"bg-amber-500":"bg-blue-500",ve=[{label:"My files",onClick:()=>O("/")},...ye.map((e,t)=>({label:e,onClick:()=>O("/"+ye.slice(0,t+1).join("/"))}))],je=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),$e=e=>/* @__PURE__ */T("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */T("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),De=/* @__PURE__ */E("nav",{className:"p-2",children:[
11
+ /* @__PURE__ */T("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Locations"}),
12
+ /* @__PURE__ */E("button",{onClick:()=>{te("files"),O("/")},className:je("files"===ee&&"/"===I),children:[$e("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),V.map(e=>/* @__PURE__ */E("button",{onClick:()=>{te("files"),O("/"+e)},className:je("files"===ee&&I==="/"+e),children:[$e("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
13
+ /* @__PURE__ */T("span",{className:"truncate",children:e})]},e)),!A&&/* @__PURE__ */E("button",{onClick:()=>te("trash"),className:je("trash"===ee),children:[$e("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),re&&re.folders.length>0&&/* @__PURE__ */E(L,{children:[
14
+ /* @__PURE__ */T("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),re.folders.map(e=>/* @__PURE__ */E("button",{onClick:()=>te({desktopFolderId:e.id}),className:je(ie===e.id),children:[
15
+ /* @__PURE__ */T(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
+ /* @__PURE__ */T("span",{className:"truncate",children:e.name}),
17
+ /* @__PURE__ */T(b,{count:e.itemCount,active:ie===e.id,className:"ml-auto"})]},e.id))]})]});/* @__PURE__ */
18
+ return E("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{A||"object"==typeof ee||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),le.current++,_||q(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{le.current>0&&le.current--,0===le.current&&q(!1)},onDrop:e=>{e.preventDefault(),be(),A||"object"==typeof ee||e.dataTransfer.files?.length&&ke(e.dataTransfer.files)},children:[
19
+ /* @__PURE__ */T(x,{title:se?`Files - ${se.name}`:"Files"+("/"===I?"":" - "+I)}),
20
+ /* @__PURE__ */T(i,{app:"files"}),
21
+ /* @__PURE__ */T("input",{ref:ce,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ke(e.target.files),ce.current&&(ce.current.value="")}}),
22
+ /* @__PURE__ */T("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */T(t,{sidebar:De,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */E("div",{className:"flex h-full min-w-0 flex-col",children:[
23
+ /* @__PURE__ */E("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0 text-xs",children:[/* @__PURE__ */E(L,"files"===ee?{children:[
24
+ /* @__PURE__ */T("button",{onClick:()=>O(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(I)),disabled:"/"===I,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
25
+ /* @__PURE__ */T("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */T(a,{items:ve,maxItems:5})}),
26
+ /* @__PURE__ */T("button",{onClick:()=>fe(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!A&&/* @__PURE__ */E(L,{children:[
27
+ /* @__PURE__ */E("button",{onClick:()=>te("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
28
+ /* @__PURE__ */T(N,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
29
+ /* @__PURE__ */E("button",{onClick:async()=>{const e=await k({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void y.error("Folder names cannot contain slashes");const t=P(I,e),a=await pe(`${S}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void y.error(e.error||`Create folder failed (${a.status})`)}fe(I)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
30
+ /* @__PURE__ */T(N,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
31
+ /* @__PURE__ */E("button",{onClick:()=>ce.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
32
+ /* @__PURE__ */T(N,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===ee?{children:[
33
+ /* @__PURE__ */T("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
34
+ /* @__PURE__ */T("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
35
+ /* @__PURE__ */T("button",{onClick:xe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
36
+ /* @__PURE__ */T("button",{onClick:async()=>{if(0===ae.length)return;if(!await g({title:"Empty trash",message:`${ae.length} item${1===ae.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await pe(`${S}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void y.error(t.error||`Empty trash failed (${e.status})`)}xe()},disabled:0===ae.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
37
+ /* @__PURE__ */T("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
38
+ /* @__PURE__ */T(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
39
+ /* @__PURE__ */T("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
40
+ /* @__PURE__ */T("span",{className:"text-2xs text-ink-faintest px-2",children:"Desktop shortcuts"})]}),z&&/* @__PURE__ */E(L,{children:[
41
+ /* @__PURE__ */T("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
42
+ /* @__PURE__ */E("div",{className:"flex items-center gap-2",title:`${n(z.used)} of ${n(z.limit)} used`,children:[
43
+ /* @__PURE__ */T("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */T("div",{className:`h-full ${we} transition-all`,style:{width:`${Ne}%`}})}),
44
+ /* @__PURE__ */E("span",{className:"text-2xs text-ink-faint tabular-nums whitespace-nowrap",children:[n(z.used)," / ",n(z.limit)]})]})]})]}),
45
+ /* @__PURE__ */T("div",{className:"flex-1 overflow-auto",children:"object"==typeof ee?0===oe.length?/* @__PURE__ */T("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */E("table",{className:"w-full text-sm",children:[
46
+ /* @__PURE__ */T("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
47
+ /* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
48
+ /* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
49
+ /* @__PURE__ */T("th",{className:`${v} w-56`})]})}),
50
+ /* @__PURE__ */T("tbody",{children:oe.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
51
+ return E("tr",{onClick:()=>X(t),onDoubleClick:()=>he(e),className:"cursor-default border-b border-gray-100 "+(Q===t?"bg-blue-50":"hover:bg-gray-50"),children:[
52
+ /* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:[
53
+ /* @__PURE__ */T(p,{item:e}),
54
+ /* @__PURE__ */T("span",{className:"truncate",title:e.label,children:e.label})]}),
55
+ /* @__PURE__ */T("td",{className:"px-3 h-8 text-xs text-ink-faint",children:u(e)}),
56
+ /* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
57
+ /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),he(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
58
+ /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),re?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs ml-1",children:"Move to desktop"}),
59
+ /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),re?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===ee?B&&0===ae.length?/* @__PURE__ */T(w,{size:"sm",padding:"p-6",label:"Loading"}):0===ae.length?/* @__PURE__ */T("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */E("table",{className:"w-full text-sm",children:[
60
+ /* @__PURE__ */T("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
61
+ /* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
62
+ /* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Original location"}),
63
+ /* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
64
+ /* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-40`,children:"Deleted"}),
65
+ /* @__PURE__ */T("th",{className:`${v} w-44`})]})}),
66
+ /* @__PURE__ */T("tbody",{children:ae.map(e=>/* @__PURE__ */E("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
67
+ /* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */T(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(N,{name:"page",className:"h-4 w-4 text-ink-faintest shrink-0",strokeWidth:1.5}),
68
+ /* @__PURE__ */T("span",{className:"truncate",title:e.name,children:e.name})]}),
69
+ /* @__PURE__ */T("td",{className:"px-3 h-8 text-ink-faint text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
70
+ /* @__PURE__ */T("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:n(e.size)}),
71
+ /* @__PURE__ */T("td",{className:"px-3 h-8 text-right text-ink-faint tabular-nums",children:e.deletedAt?U(e.deletedAt):"—"}),
72
+ /* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
73
+ /* @__PURE__ */T("button",{onClick:()=>(async e=>{const t=await pe(`${S}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Restore failed (${t.status})`)}y.success(`Restored "${e.name}"`),xe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
74
+ /* @__PURE__ */T("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await pe(`${S}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Delete failed (${t.status})`)}xe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):B&&0===F.length?/* @__PURE__ */T(w,{size:"sm",padding:"p-6",label:"Loading"}):0===F.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!A&&/* @__PURE__ */E(L,{children:[" Drop files here or click ",
75
+ /* @__PURE__ */T("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */E("table",{className:"w-full text-sm",children:[
76
+ /* @__PURE__ */T("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
77
+ /* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
78
+ /* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
79
+ /* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
80
+ /* @__PURE__ */T("th",{className:`${v} w-32`})]})}),
81
+ /* @__PURE__ */T("tbody",{children:F.map(t=>/* @__PURE__ */E("tr",{onClick:()=>X(t.name),onDoubleClick:()=>{"folder"===t.kind?O(P(I,t.name)):(async t=>{if(A)return;const a=P(I,t.name),n=(t.name.split(".").pop()||"").toLowerCase(),r=M[n];r?await e({filePath:a,filename:t.name,kind:r,onStaged:e=>de(e)}):ge(t)})(t)},className:"cursor-default border-b border-gray-100 "+(Q===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
82
+ /* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */T(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(N,{name:"page",className:"h-4 w-4 text-ink-faintest shrink-0",strokeWidth:1.5}),
83
+ /* @__PURE__ */T("span",{className:"truncate",title:t.name,children:t.name})]}),
84
+ /* @__PURE__ */T("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:"folder"===t.kind?"—":n(t.size)}),
85
+ /* @__PURE__ */T("td",{className:"px-3 h-8 text-right text-ink-faint tabular-nums",children:U(t.modifiedAt)}),
86
+ /* @__PURE__ */T("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!A&&/* @__PURE__ */E(L,{children:["file"===t.kind&&/* @__PURE__ */T("button",{onClick:e=>{e.stopPropagation(),ge(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs",children:"Download"}),
87
+ /* @__PURE__ */T("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await k({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void y.error("Names cannot contain slashes");const a=P(I,e.name),n=P(I,t),r=await pe(`${S}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:n})});if(!r.ok){const e=await r.json().catch(()=>({}));return void y.error(e.error||`Rename failed (${r.status})`)}fe(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs ml-1",children:"Rename"}),
88
+ /* @__PURE__ */T("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=P(I,e.name),a=await pe(`${S}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void y.error(e.error||`Delete failed (${a.status})`)}fe(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */T("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */T("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{S as default};
@@ -0,0 +1,24 @@
1
+ import{getNumberingConfigs as e}from"./chunk-JQYNMUZW.js";import{SidebarLayout as t}from"./chunk-A4HJDSRA.js";import"./chunk-QWK6DRSN.js";import"./chunk-DRDYZ633.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-PGGBOZE5.js";import{useWindowManager as o,client_default as i}from"./chunk-573EHCD7.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import"./chunk-QWWJUYZI.js";import"./chunk-LNWQBSYD.js";import{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-OW7MLJ3Y.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as s}from"./chunk-AKM6JBMD.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-YAW54RRC.js";import"./chunk-37U326EL.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import"./chunk-34URULVW.js";import{Icon as l}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var y=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}w.current=e},[v]);const T=j.notepad_notes||[],[_,W]=d(null),[D,C]=d(""),[X,R]=d(""),[S,U]=d("yellow"),[$,M]=d(!1),[J,Q]=d(!1),Z=a(null),E=a();p(()=>{if(!_&&T.length>0){const e=T[0];W(e.id),C(e.title),R(e.content),U(e.color)}},[T.length]);const K=m(e=>{N({notepad_notes:e})},[N]),G=m(()=>{if(!_||!$)return;const e=T.map(e=>e.id===_?{...e,title:D,content:X,color:S,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);K(e),M(!1)},[_,$,D,X,S,T,K]);p(()=>{if($)return E.current&&clearTimeout(E.current),E.current=setTimeout(G,800),()=>{E.current&&clearTimeout(E.current)}},[$,G]),p(()=>()=>{$&&G()},[]);const H=e=>{$&&G(),W(e.id),C(e.title),R(e.content),U(e.color),M(!1),Q(!1)},I=e=>{const t=X.slice(0,e),r=X.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=X.slice(e+r[0].length);R(t+n+o),M(!0)},O=async(e,t)=>{const r=w.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):s.error(`${n} not found`)}catch{s.error(`Failed to look up ${n}`)}},A="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",P=/* @__PURE__ */h(g,{children:[
2
+ /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{$&&G();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...T];K(t),W(e.id),C(""),R(""),U("yellow"),M(!1),Q(!0),setTimeout(()=>Z.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
3
+ /* @__PURE__ */x(l,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
+ /* @__PURE__ */x("div",{className:"flex-1 overflow-y-auto",children:0===T.length?/* @__PURE__ */x("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):T.map(e=>{const t=(n=e.color,y.find(e=>e.key===n)||y[0]);var n;/* @__PURE__ */
5
+ return h("button",{onClick:()=>H(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
6
+ /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */x("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
+ /* @__PURE__ */x("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
9
+ /* @__PURE__ */x("p",{className:"text-xs text-ink-faintest mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
+ /* @__PURE__ */x("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
+ return h("div",{className:"h-full",children:[
12
+ /* @__PURE__ */x(n,{app:"notepad"}),
13
+ /* @__PURE__ */x(t,{sidebar:P,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
+ /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
+ /* @__PURE__ */x("input",{value:D,onChange:e=>{C(e.target.value),M(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */x("div",{className:"flex gap-1",children:y.map(e=>/* @__PURE__ */x("button",{onClick:()=>{U(e.key),M(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${S===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */x("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(K(t),_===e){const e=t[0];e?H(e):(W(null),C(""),R(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(l,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),J?/* @__PURE__ */x("textarea",{ref:Z,value:X,onChange:e=>{R(e.target.value),M(!0)},onBlur:()=>{Q(!1),$&&G()},placeholder:A,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{Q(!0),setTimeout(()=>Z.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:X?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let s;for(;null!==(s=c.exec(e));){const e=s[1],t=s[2];if(w.current[e]){const n=s.index,o=s[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>O(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(s=b.exec(e));){const e="x"===s[1]||"X"===s[1],t=s.index,n=a+t;i.push({idx:t,len:s[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>I(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(l,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
+ return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(X):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:A})}),
19
+ /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
20
+ /* @__PURE__ */x("span",{children:"[] checkbox"}),
21
+ /* @__PURE__ */x("span",{children:"SO#35001 entity link"}),
22
+ /* @__PURE__ */x("span",{className:"ml-auto",children:J?"Editing":"Click to edit"})]})]}):/* @__PURE__ */x("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
23
+ /* @__PURE__ */x(l,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
24
+ /* @__PURE__ */x("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
@@ -1 +1 @@
1
- export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-V4RYE6KA.js";import"./chunk-OQW42DOR.js";import"./chunk-UQYNPYF4.js";import"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";
1
+ export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-C2P2Z6HU.js";import"./chunk-AKM6JBMD.js";import"./chunk-UQYNPYF4.js";import"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";