@fde-desktop/fde-core 0.4.7 → 0.4.8

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 (311) hide show
  1. package/dist/AccordionChevron-CJXAq5o5.js +26 -0
  2. package/dist/AccordionChevron-DBXp38Lm.cjs +1 -0
  3. package/dist/ActionIcon-C_SfdBfx.cjs +1 -0
  4. package/dist/ActionIcon-CtVbYlGY.js +145 -0
  5. package/dist/AppEmptyState-BTujnL_b.js +4962 -0
  6. package/dist/AppEmptyState-Dc4GaDfu.cjs +1 -0
  7. package/dist/AppIcon--qzR4sgf.cjs +1 -0
  8. package/dist/AppIcon-DCDuaU-t.js +80 -0
  9. package/dist/AppMenuBar-BiHbNg9V.cjs +9 -0
  10. package/dist/AppMenuBar-CHJy8OF0.js +2639 -0
  11. package/dist/Box-DRm8EabO.js +1593 -0
  12. package/dist/Box-D_64wv6n.cjs +1 -0
  13. package/dist/Button-D0FXpkur.cjs +1 -0
  14. package/dist/Button-k7SxX1Xl.js +178 -0
  15. package/dist/CalendarApp-C1HvuJoa.cjs +1 -0
  16. package/dist/CalendarApp-DBEQqsS_.js +1721 -0
  17. package/dist/Center-CyryG5zn.js +25 -0
  18. package/dist/Center-T4No_FAa.cjs +1 -0
  19. package/dist/CheckIcon-C3WjIR2i.js +25 -0
  20. package/dist/CheckIcon-CBMLR6Gc.cjs +1 -0
  21. package/dist/CodeServerApp-B3l5QPuG.cjs +1 -0
  22. package/dist/CodeServerApp-BpeALSaX.js +2 -0
  23. package/dist/CodeServerApp-CRjCngFv.cjs +1 -0
  24. package/dist/CodeServerApp-DY94cy1a.js +149 -0
  25. package/dist/ColorPicker-BL4UbKCV.cjs +1 -0
  26. package/dist/ColorPicker-DvRR-wlQ.js +997 -0
  27. package/dist/Colors-BxX4G8kX.cjs +1 -0
  28. package/dist/Colors-hca6raEG.js +15 -0
  29. package/dist/CreateItemApp-BU9wmjKM.cjs +1 -0
  30. package/dist/CreateItemApp-CtdH1K1g.js +400 -0
  31. package/dist/CreateItemApp-t9F-a6wD.cjs +1 -0
  32. package/dist/DeviceInfoApp-C306YvtZ.js +223 -0
  33. package/dist/DeviceInfoApp-Cdju_LIB.cjs +1 -0
  34. package/dist/DeviceInfoApp-CyB01v4D.cjs +1 -0
  35. package/dist/DownloadProgress-IRw1dzLX.cjs +1 -0
  36. package/dist/DownloadProgress-hdupSUBT.js +174 -0
  37. package/dist/FileIcon-BCpGMI5U.js +88 -0
  38. package/dist/FileIcon-BCrsxmtt.cjs +1 -0
  39. package/dist/FilePickerApp-DMGuvahM.js +409 -0
  40. package/dist/FilePickerApp-Eu0cr2Cm.cjs +1 -0
  41. package/dist/FilesApp-30OjnOuP.cjs +1 -0
  42. package/dist/FilesApp-BvlzPNuO.cjs +1 -0
  43. package/dist/FilesApp-VXrmtt63.js +225 -0
  44. package/dist/Group-BzwlMeob.js +48 -0
  45. package/dist/Group-DhwePB84.cjs +1 -0
  46. package/dist/ImageViewerApp-BOz59TGc.cjs +1 -0
  47. package/dist/ImageViewerApp-BeqY6voE.cjs +1 -0
  48. package/dist/ImageViewerApp-CWiP6zx-.js +68 -0
  49. package/dist/ImageViewerApp-DBAfJPSo.js +2 -0
  50. package/dist/ImageViewerMenuBar-BULkh_Ku.js +86 -0
  51. package/dist/ImageViewerMenuBar-Cb0Nr5-M.js +2 -0
  52. package/dist/ImageViewerMenuBar-CoEp0RxK.cjs +1 -0
  53. package/dist/ImageViewerMenuBar-zOkJtqKo.cjs +1 -0
  54. package/dist/MenuEditApp-BoKtj2GH.js +2 -0
  55. package/dist/MenuEditApp-D21sEp86.js +2615 -0
  56. package/dist/MenuEditApp-k3cPfTG9.cjs +1 -0
  57. package/dist/MenuEditApp-sz9GlLVH.cjs +5 -0
  58. package/dist/MenuEditMenuBar-6QxlIDpl.cjs +1 -0
  59. package/dist/MenuEditMenuBar-B94z4Umw.js +59 -0
  60. package/dist/MenuEditMenuBar-Bv6R42lf.js +2 -0
  61. package/dist/MenuEditMenuBar-CBsmH_-T.cjs +1 -0
  62. package/dist/NotesApp-BtR55Hva.cjs +207 -0
  63. package/dist/NotesApp-C59exz_9.js +16154 -0
  64. package/dist/NotesApp-D47I5LS_.js +2 -0
  65. package/dist/NotesApp-lOwsi2sg.cjs +1 -0
  66. package/dist/NotesMenuBar-BB4NkKGf.js +61 -0
  67. package/dist/NotesMenuBar-BZITC74y.cjs +1 -0
  68. package/dist/NotesMenuBar-Bp0sPqyR.cjs +1 -0
  69. package/dist/NotesMenuBar-xlfODmMA.js +2 -0
  70. package/dist/Paper-DtUYKmYn.js +30 -0
  71. package/dist/Paper-DwCpwWwH.cjs +1 -0
  72. package/dist/PdfApp-1XbFGfoY.cjs +1 -0
  73. package/dist/PdfApp-BhIoJWeK.cjs +1 -0
  74. package/dist/PdfApp-C5Rt1Zaw.js +2 -0
  75. package/dist/PdfApp-C8Hwxxqh.js +38 -0
  76. package/dist/PdfMenuBar-BA9rKuMP.cjs +1 -0
  77. package/dist/PdfMenuBar-JXHqwxhZ.cjs +1 -0
  78. package/dist/PdfMenuBar-R0fu7oYF.js +2 -0
  79. package/dist/PdfMenuBar-sd-9Vk3h.js +38 -0
  80. package/dist/SettingsApp-BA-5B4RA.cjs +1 -0
  81. package/dist/SettingsApp-B_rev1xh.cjs +1 -0
  82. package/dist/SettingsApp-Ck4aUXs5.js +2 -0
  83. package/dist/SettingsApp-DUMKSA3K.js +2425 -0
  84. package/dist/SettingsMenuBar-BPwv8JQK.js +41 -0
  85. package/dist/SettingsMenuBar-D8R7hOik.js +2 -0
  86. package/dist/SettingsMenuBar-DDrjZLmg.cjs +1 -0
  87. package/dist/SettingsMenuBar-DQjUa8g1.cjs +1 -0
  88. package/dist/Slider-BNO-vDFn.js +1175 -0
  89. package/dist/Slider-Bg_EIBg6.cjs +1 -0
  90. package/dist/Stack-BOaJgV3N.cjs +1 -0
  91. package/dist/Stack-CuDEaP7e.js +34 -0
  92. package/dist/StorybookApp-Bkr-7mXp.cjs +1 -0
  93. package/dist/StorybookApp-WYninkJo.js +10 -0
  94. package/dist/TerminalApp-8XbsKAWa.js +10041 -0
  95. package/dist/TerminalApp-Bq2e7QQu.cjs +1 -0
  96. package/dist/TerminalApp-CVu3Axc9.js +2 -0
  97. package/dist/TerminalApp-b7_d0jRO.cjs +36 -0
  98. package/dist/TerminalMenuBar-Cb8x9laS.js +2 -0
  99. package/dist/TerminalMenuBar-De-FH5AE.cjs +1 -0
  100. package/dist/TerminalMenuBar-iKLydNda.js +112 -0
  101. package/dist/TerminalMenuBar-yOaWd-hn.cjs +1 -0
  102. package/dist/TextInput-C3qfxxWI.js +980 -0
  103. package/dist/TextInput-DcYns3hz.cjs +1 -0
  104. package/dist/Tooltip-CAOO-qdx.js +3185 -0
  105. package/dist/Tooltip-DDh_x-CB.cjs +1 -0
  106. package/dist/UnstyledButton-CI3kyRck.js +25 -0
  107. package/dist/UnstyledButton-Cl5RuIid.cjs +1 -0
  108. package/dist/UploaderApp-BZXW75A0.cjs +1 -0
  109. package/dist/UploaderApp-C9W_yCT-.js +487 -0
  110. package/dist/UploaderApp-CPpStgP5.cjs +1 -0
  111. package/dist/UploaderApp-DHsMQN-f.js +2 -0
  112. package/dist/VscIcon-CxEmqD80.cjs +1 -0
  113. package/dist/VscIcon-DueRJVTe.js +8 -0
  114. package/dist/chunk-BQCxAhux.js +23 -0
  115. package/dist/chunk-CiTBaPhY.cjs +1 -0
  116. package/dist/create-safe-context-95P-Bfg3.cjs +1 -0
  117. package/dist/create-safe-context-XT2cxc14.js +12 -0
  118. package/dist/desktopStore-B0R1-BeA.js +1905 -0
  119. package/dist/desktopStore-Cox-Og1z.cjs +1 -0
  120. package/dist/fc-DejOsQyD.cjs +1 -0
  121. package/dist/fc-kd8WzIER.js +20536 -0
  122. package/dist/fc-xJ_v2ayq.cjs +184 -0
  123. package/dist/fi-BahYsbim.js +9993 -0
  124. package/dist/fi-BkhyTcZo.cjs +1 -0
  125. package/dist/getRuntime-BLXyQZBB.cjs +1 -0
  126. package/dist/getRuntime-CCRXVzJH.js +63 -0
  127. package/dist/iconBase-B4UCuSvv.cjs +1 -0
  128. package/dist/iconBase-D7iPes7B.js +108 -0
  129. package/dist/imageViewerStore-CH1qW6md.cjs +1 -0
  130. package/dist/imageViewerStore-CJMRXaQh.js +50 -0
  131. package/dist/index.cjs +53 -5642
  132. package/dist/index.css +2 -9192
  133. package/dist/index.d.ts +2258 -2019
  134. package/dist/index.js +8983 -4780
  135. package/dist/is-element-BocgicRg.cjs +1 -0
  136. package/dist/is-element-Bu_JY8Qy.js +7 -0
  137. package/dist/menuEditStore-C8S_EedM.js +38 -0
  138. package/dist/menuEditStore-CU7IAg3L.cjs +1 -0
  139. package/dist/notesStore-DKRgTTFn.js +36 -0
  140. package/dist/notesStore-zKmChTfF.cjs +1 -0
  141. package/dist/react-DYmzHD0X.js +27 -0
  142. package/dist/react-Dldg32sN.cjs +1 -0
  143. package/dist/settingsAppStore-BrlImdAH.cjs +1 -0
  144. package/dist/settingsAppStore-KOeWRO6h.js +29 -0
  145. package/dist/terminalStore-LWWjCvCe.js +30 -0
  146. package/dist/terminalStore-fZe5t7Ty.cjs +1 -0
  147. package/dist/use-merged-ref-BI9n1hUK.cjs +1 -0
  148. package/dist/use-merged-ref-BT8_u6vW.js +25 -0
  149. package/dist/use-resolved-styles-api-AVDygMKo.cjs +1 -0
  150. package/dist/use-resolved-styles-api-pEOi2wiK.js +21 -0
  151. package/dist/use-uncontrolled-A4hm9ATM.js +23 -0
  152. package/dist/use-uncontrolled-BPrfGv0W.cjs +1 -0
  153. package/dist/useAdaptiveDimensions-Btp0m5Pm.cjs +1 -0
  154. package/dist/useAdaptiveDimensions-CunsU0mn.js +40 -0
  155. package/dist/useCloseInterceptor-CuKAAFnj.js +51 -0
  156. package/dist/useCloseInterceptor-a_6Lcuqj.cjs +1 -0
  157. package/dist/useDynamicIcon-GJg3vWsJ.js +22 -0
  158. package/dist/useDynamicIcon-SytdL1Tu.cjs +1 -0
  159. package/dist/useMenuBarUtils-Bp5PiztD.cjs +1 -0
  160. package/dist/useMenuBarUtils-ChmpZjwu.js +6 -0
  161. package/dist/useOpenApp-BdarhIgl.cjs +1 -0
  162. package/dist/useOpenApp-JHCPTBWa.js +279 -0
  163. package/dist/useResolvedUrl-Be5ZlCX7.cjs +1 -0
  164. package/dist/useResolvedUrl-DFKXq598.js +30 -0
  165. package/dist/useTranslation-DMRGdqZi.js +279 -0
  166. package/dist/useTranslation-D_O7S4RJ.cjs +1 -0
  167. package/dist/vsc-Ciibqbxo.cjs +1 -0
  168. package/dist/vsc-DGKSpOAR.js +9574 -0
  169. package/package.json +7 -3
  170. package/dist/CalendarApp-CHLUCAI7.css +0 -744
  171. package/dist/CalendarApp-K7ZOUZ6C.js +0 -2
  172. package/dist/CalendarApp-OTGEERSS.cjs +0 -8
  173. package/dist/CodeServerApp-5KZGO7HL.css +0 -75
  174. package/dist/CodeServerApp-LUZFCQBI.js +0 -3
  175. package/dist/CodeServerApp-P3TMJPLY.cjs +0 -9
  176. package/dist/CreateItemApp-ESQ42VHH.js +0 -8
  177. package/dist/CreateItemApp-PQB5GTFG.css +0 -107
  178. package/dist/CreateItemApp-RFE3REWZ.cjs +0 -14
  179. package/dist/DeviceInfoApp-XNIS6ZY6.js +0 -5
  180. package/dist/DeviceInfoApp-ZNLQNOKI.cjs +0 -11
  181. package/dist/DeviceInfoApp-ZSMRSITP.css +0 -7
  182. package/dist/FilesApp-4GEU64QN.js +0 -8
  183. package/dist/FilesApp-E6L5W3T2.css +0 -1817
  184. package/dist/FilesApp-QSLB5IWR.cjs +0 -14
  185. package/dist/ImageViewerApp-N2Q7E7WZ.css +0 -215
  186. package/dist/ImageViewerApp-NCVDKLB3.js +0 -11
  187. package/dist/ImageViewerApp-QB373H5Z.cjs +0 -17
  188. package/dist/ImageViewerMenuBar-I3TFKQPS.cjs +0 -14
  189. package/dist/ImageViewerMenuBar-TV5C6TM2.js +0 -5
  190. package/dist/ImageViewerMenuBar-XLK4LIHW.css +0 -56
  191. package/dist/MenuEditApp-5EFYAPFC.cjs +0 -15
  192. package/dist/MenuEditApp-V5XOPIHX.js +0 -9
  193. package/dist/MenuEditApp-YA6HSAMJ.css +0 -94
  194. package/dist/MenuEditMenuBar-7VHMZNRM.css +0 -56
  195. package/dist/MenuEditMenuBar-GF6L4PGZ.cjs +0 -15
  196. package/dist/MenuEditMenuBar-IUXFPZE5.js +0 -6
  197. package/dist/NotesApp-2YNT7Y3D.js +0 -10
  198. package/dist/NotesApp-IAEE7YHU.cjs +0 -16
  199. package/dist/NotesApp-TQ6IHDNX.css +0 -302
  200. package/dist/NotesMenuBar-25LKN3SE.cjs +0 -15
  201. package/dist/NotesMenuBar-MXLOX7OT.css +0 -56
  202. package/dist/NotesMenuBar-SRV3AIAL.js +0 -6
  203. package/dist/PdfApp-67XIX6AM.js +0 -10
  204. package/dist/PdfApp-BUIC5U5H.css +0 -206
  205. package/dist/PdfApp-GZ6RHTBR.cjs +0 -16
  206. package/dist/PdfMenuBar-NLZC6JHS.js +0 -4
  207. package/dist/PdfMenuBar-QUM72EE4.css +0 -56
  208. package/dist/PdfMenuBar-WBRTKMLN.cjs +0 -13
  209. package/dist/SettingsApp-BPLMGPNK.cjs +0 -20
  210. package/dist/SettingsApp-JVOSEFH3.css +0 -283
  211. package/dist/SettingsApp-LUDIXCYY.js +0 -14
  212. package/dist/SettingsMenuBar-5CBSSMVM.css +0 -56
  213. package/dist/SettingsMenuBar-VLT6TTCM.js +0 -6
  214. package/dist/SettingsMenuBar-Y5QEXDEO.cjs +0 -15
  215. package/dist/StorybookApp-NQ244BER.css +0 -7
  216. package/dist/StorybookApp-NZDV4X3Y.js +0 -1
  217. package/dist/StorybookApp-VF3KIMU3.cjs +0 -7
  218. package/dist/TerminalApp-CDGWRBFJ.cjs +0 -10
  219. package/dist/TerminalApp-EAATMIMX.css +0 -77
  220. package/dist/TerminalApp-GCKJCM55.js +0 -4
  221. package/dist/TerminalMenuBar-3J26O26Q.css +0 -56
  222. package/dist/TerminalMenuBar-7BH7MGNJ.cjs +0 -14
  223. package/dist/TerminalMenuBar-7JAEQUZ4.js +0 -5
  224. package/dist/UploaderApp-6KV3TGCT.css +0 -1817
  225. package/dist/UploaderApp-FJC2J4I5.js +0 -10
  226. package/dist/UploaderApp-HLXJYJZQ.cjs +0 -16
  227. package/dist/chunk-2PSTHGTD.cjs +0 -42
  228. package/dist/chunk-2RQX7QBP.cjs +0 -148
  229. package/dist/chunk-43W6UDUZ.cjs +0 -19
  230. package/dist/chunk-4E45FBAH.js +0 -223
  231. package/dist/chunk-4E4U2A25.cjs +0 -237
  232. package/dist/chunk-4QHX7CMN.cjs +0 -38
  233. package/dist/chunk-4XURSNM4.js +0 -43
  234. package/dist/chunk-4ZCRYHL6.js +0 -407
  235. package/dist/chunk-5C6IQE42.cjs +0 -35
  236. package/dist/chunk-5HUYQDQF.js +0 -36
  237. package/dist/chunk-5NOHYJNH.js +0 -84
  238. package/dist/chunk-5QFZW6HW.js +0 -2241
  239. package/dist/chunk-5YH6AKEO.js +0 -146
  240. package/dist/chunk-756GPSPM.js +0 -283
  241. package/dist/chunk-7WUYUTPN.js +0 -2293
  242. package/dist/chunk-7XCMBW64.js +0 -162
  243. package/dist/chunk-7Y7HB7FB.cjs +0 -53
  244. package/dist/chunk-ABIAPZ6S.cjs +0 -45
  245. package/dist/chunk-ACHGJKCI.cjs +0 -286
  246. package/dist/chunk-BQCD5RAF.cjs +0 -48
  247. package/dist/chunk-BQL3YXMV.js +0 -17429
  248. package/dist/chunk-C3XER4N3.js +0 -442
  249. package/dist/chunk-C6BEZNAM.cjs +0 -45
  250. package/dist/chunk-CILU6BWC.cjs +0 -548
  251. package/dist/chunk-CV5PUHAE.cjs +0 -86
  252. package/dist/chunk-D5MVFFID.js +0 -42
  253. package/dist/chunk-D7R55WWT.js +0 -1601
  254. package/dist/chunk-DFYDUXWP.cjs +0 -34
  255. package/dist/chunk-DWP2SYF7.js +0 -55
  256. package/dist/chunk-E55VXNLK.cjs +0 -17498
  257. package/dist/chunk-E5FW77FG.js +0 -77
  258. package/dist/chunk-EAELL43F.js +0 -42
  259. package/dist/chunk-EX5V2ZTU.js +0 -40
  260. package/dist/chunk-FD7QZCTN.cjs +0 -2329
  261. package/dist/chunk-FH4ILMKF.js +0 -38
  262. package/dist/chunk-FRHBM2U7.js +0 -33
  263. package/dist/chunk-FX2TPX3L.cjs +0 -45
  264. package/dist/chunk-GPXNLTPI.cjs +0 -451
  265. package/dist/chunk-GRYCUBJZ.js +0 -9
  266. package/dist/chunk-HPHHS7FJ.cjs +0 -49
  267. package/dist/chunk-HWHBSAUC.js +0 -40
  268. package/dist/chunk-IDHP3R4I.js +0 -31
  269. package/dist/chunk-IHWGT3DL.js +0 -86
  270. package/dist/chunk-JEBKLIMU.cjs +0 -123
  271. package/dist/chunk-KDZLBI6F.cjs +0 -324
  272. package/dist/chunk-KQHICFX3.js +0 -121
  273. package/dist/chunk-LMJE6V4N.cjs +0 -42
  274. package/dist/chunk-MCHPDWVH.js +0 -444
  275. package/dist/chunk-MVDGM5Y4.js +0 -68
  276. package/dist/chunk-N36HBL53.cjs +0 -165
  277. package/dist/chunk-NV5GNFA3.js +0 -541
  278. package/dist/chunk-NVEGEK3N.js +0 -31
  279. package/dist/chunk-OJIDKDKF.js +0 -68
  280. package/dist/chunk-PGGNSLM7.js +0 -215
  281. package/dist/chunk-PKPQA5NR.js +0 -15
  282. package/dist/chunk-PNDBLFJW.cjs +0 -50
  283. package/dist/chunk-Q3WA72BF.cjs +0 -70
  284. package/dist/chunk-RDIDAZ3S.cjs +0 -9
  285. package/dist/chunk-RGJPRXYY.js +0 -48
  286. package/dist/chunk-RPSYXORB.cjs +0 -219
  287. package/dist/chunk-RQ6OZRUW.cjs +0 -41
  288. package/dist/chunk-SBE4SZAN.cjs +0 -226
  289. package/dist/chunk-TAFNCDUI.js +0 -234
  290. package/dist/chunk-TFIDSENE.cjs +0 -88
  291. package/dist/chunk-TGWMOHAO.js +0 -17
  292. package/dist/chunk-UA6XSTW6.js +0 -48
  293. package/dist/chunk-UIQCTAVM.cjs +0 -59
  294. package/dist/chunk-UKYESVDS.cjs +0 -50
  295. package/dist/chunk-V4N255NL.cjs +0 -2309
  296. package/dist/chunk-VO6KXO2I.js +0 -32
  297. package/dist/chunk-WXSTSC3D.cjs +0 -83
  298. package/dist/chunk-XSK7BWYO.js +0 -47
  299. package/dist/chunk-XVAPJ4PP.cjs +0 -449
  300. package/dist/chunk-XVASHRCE.cjs +0 -70
  301. package/dist/chunk-XYSMVQQD.cjs +0 -1608
  302. package/dist/chunk-YAIWI4Z5.js +0 -7
  303. package/dist/chunk-YGYOLDKR.js +0 -280
  304. package/dist/chunk-YP2PLNOF.cjs +0 -34
  305. package/dist/chunk-YSOLW4FS.cjs +0 -11
  306. package/dist/chunk-YY6OUR2U.js +0 -44
  307. package/dist/chunk-YZWS7FDT.cjs +0 -409
  308. package/dist/chunk-Z5YGWL65.cjs +0 -39
  309. package/dist/chunk-ZHNDXNL4.js +0 -45
  310. package/dist/chunk-ZX3EDZ5C.cjs +0 -17
  311. package/dist/index.d.cts +0 -2019
@@ -0,0 +1,1905 @@
1
+ import { i as e, n as t } from "./getRuntime-CCRXVzJH.js";
2
+ import { t as n } from "./react-DYmzHD0X.js";
3
+ //#region ../../node_modules/.bun/zustand@5.0.12+10f197a4cef36846/node_modules/zustand/esm/middleware.mjs
4
+ function r(e, t) {
5
+ let n;
6
+ try {
7
+ n = e();
8
+ } catch {
9
+ return;
10
+ }
11
+ return {
12
+ getItem: (e) => {
13
+ let r = (e) => e === null ? null : JSON.parse(e, t?.reviver), i = n.getItem(e) ?? null;
14
+ return i instanceof Promise ? i.then(r) : r(i);
15
+ },
16
+ setItem: (e, r) => n.setItem(e, JSON.stringify(r, t?.replacer)),
17
+ removeItem: (e) => n.removeItem(e)
18
+ };
19
+ }
20
+ var i = (e) => (t) => {
21
+ try {
22
+ let n = e(t);
23
+ return n instanceof Promise ? n : {
24
+ then(e) {
25
+ return i(e)(n);
26
+ },
27
+ catch(e) {
28
+ return this;
29
+ }
30
+ };
31
+ } catch (e) {
32
+ return {
33
+ then(e) {
34
+ return this;
35
+ },
36
+ catch(t) {
37
+ return i(t)(e);
38
+ }
39
+ };
40
+ }
41
+ }, a = (e, t) => (n, a, o) => {
42
+ let s = {
43
+ storage: r(() => window.localStorage),
44
+ partialize: (e) => e,
45
+ version: 0,
46
+ merge: (e, t) => ({
47
+ ...t,
48
+ ...e
49
+ }),
50
+ ...t
51
+ }, c = !1, l = 0, u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = s.storage;
52
+ if (!f) return e((...e) => {
53
+ console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`), n(...e);
54
+ }, a, o);
55
+ let p = () => {
56
+ let e = s.partialize({ ...a() });
57
+ return f.setItem(s.name, {
58
+ state: e,
59
+ version: s.version
60
+ });
61
+ }, m = o.setState;
62
+ o.setState = (e, t) => (m(e, t), p());
63
+ let h = e((...e) => (n(...e), p()), a, o);
64
+ o.getInitialState = () => h;
65
+ let g, _ = () => {
66
+ if (!f) return;
67
+ let e = ++l;
68
+ c = !1, u.forEach((e) => e(a() ?? h));
69
+ let t = s.onRehydrateStorage?.call(s, a() ?? h) || void 0;
70
+ return i(f.getItem.bind(f))(s.name).then((e) => {
71
+ if (e) if (typeof e.version == "number" && e.version !== s.version) {
72
+ if (s.migrate) {
73
+ let t = s.migrate(e.state, e.version);
74
+ return t instanceof Promise ? t.then((e) => [!0, e]) : [!0, t];
75
+ }
76
+ console.error("State loaded from storage couldn't be migrated since no migrate function was provided");
77
+ } else return [!1, e.state];
78
+ return [!1, void 0];
79
+ }).then((t) => {
80
+ if (e !== l) return;
81
+ let [r, i] = t;
82
+ if (g = s.merge(i, a() ?? h), n(g, !0), r) return p();
83
+ }).then(() => {
84
+ e === l && (t?.(a(), void 0), g = a(), c = !0, d.forEach((e) => e(g)));
85
+ }).catch((n) => {
86
+ e === l && t?.(void 0, n);
87
+ });
88
+ };
89
+ return o.persist = {
90
+ setOptions: (e) => {
91
+ s = {
92
+ ...s,
93
+ ...e
94
+ }, e.storage && (f = e.storage);
95
+ },
96
+ clearStorage: () => {
97
+ f?.removeItem(s.name);
98
+ },
99
+ getOptions: () => s,
100
+ rehydrate: () => _(),
101
+ hasHydrated: () => c,
102
+ onHydrate: (e) => (u.add(e), () => {
103
+ u.delete(e);
104
+ }),
105
+ onFinishHydration: (e) => (d.add(e), () => {
106
+ d.delete(e);
107
+ })
108
+ }, s.skipHydration || _(), g || h;
109
+ }, o = [];
110
+ for (let e = 0; e < 256; ++e) o.push((e + 256).toString(16).slice(1));
111
+ function s(e, t = 0) {
112
+ return (o[e[t + 0]] + o[e[t + 1]] + o[e[t + 2]] + o[e[t + 3]] + "-" + o[e[t + 4]] + o[e[t + 5]] + "-" + o[e[t + 6]] + o[e[t + 7]] + "-" + o[e[t + 8]] + o[e[t + 9]] + "-" + o[e[t + 10]] + o[e[t + 11]] + o[e[t + 12]] + o[e[t + 13]] + o[e[t + 14]] + o[e[t + 15]]).toLowerCase();
113
+ }
114
+ //#endregion
115
+ //#region ../../node_modules/.bun/uuid@13.0.0/node_modules/uuid/dist/rng.js
116
+ var c, l = new Uint8Array(16);
117
+ function u() {
118
+ if (!c) {
119
+ if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
120
+ c = crypto.getRandomValues.bind(crypto);
121
+ }
122
+ return c(l);
123
+ }
124
+ var d = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
125
+ //#endregion
126
+ //#region ../../node_modules/.bun/uuid@13.0.0/node_modules/uuid/dist/v4.js
127
+ function f(e, t, n) {
128
+ e ||= {};
129
+ let r = e.random ?? e.rng?.() ?? u();
130
+ if (r.length < 16) throw Error("Random bytes length must be >= 16");
131
+ if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
132
+ if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
133
+ for (let e = 0; e < 16; ++e) t[n + e] = r[e];
134
+ return t;
135
+ }
136
+ return s(r);
137
+ }
138
+ function p(e, t, n) {
139
+ return d.randomUUID && !t && !e ? d.randomUUID() : f(e, t, n);
140
+ }
141
+ //#endregion
142
+ //#region src/utils/uuid.ts
143
+ function m() {
144
+ return p();
145
+ }
146
+ //#endregion
147
+ //#region src/domain/entities/Window.ts
148
+ var h = (e) => ({
149
+ alwaysOnTop: !1,
150
+ ...e,
151
+ id: m(),
152
+ isOpen: !0,
153
+ state: "normal",
154
+ zIndex: 0
155
+ }), g = (e) => ({
156
+ ...e,
157
+ id: m()
158
+ }), _ = (e) => ({
159
+ id: m(),
160
+ name: e.name,
161
+ fcIcon: e.fcIcon,
162
+ appIds: e.appIds ?? [],
163
+ isExpanded: e.isExpanded ?? !1,
164
+ isPredefined: e.isPredefined ?? !1,
165
+ order: e.order ?? 0
166
+ }), ee = (e) => ({
167
+ id: m(),
168
+ name: e.name,
169
+ fcIcon: e.fcIcon,
170
+ appIds: e.appIds ?? [],
171
+ isExpanded: e.isExpanded ?? !1,
172
+ isPredefined: !0,
173
+ order: e.order ?? 0
174
+ }), te = (e, t) => ({
175
+ ...e,
176
+ ...t
177
+ }), v = (e, t = null, n = {}) => ({
178
+ id: m(),
179
+ name: e,
180
+ type: "folder",
181
+ parentId: t,
182
+ children: [],
183
+ createdAt: /* @__PURE__ */ new Date(),
184
+ updatedAt: /* @__PURE__ */ new Date(),
185
+ ...n
186
+ }), y = (e, t, n = null, r, i) => ({
187
+ id: m(),
188
+ name: e,
189
+ type: "file",
190
+ content: t,
191
+ mimeType: r,
192
+ parentId: n,
193
+ createdAt: /* @__PURE__ */ new Date(),
194
+ updatedAt: /* @__PURE__ */ new Date(),
195
+ ...i === void 0 ? {} : { url: i }
196
+ }), ne = 1e4, re = class {
197
+ windows = /* @__PURE__ */ new Map();
198
+ nextZIndex = 1;
199
+ assignZIndex(e) {
200
+ let t = this.nextZIndex++;
201
+ return e ? ne + t : t;
202
+ }
203
+ reset() {
204
+ this.windows.clear(), this.nextZIndex = 1;
205
+ }
206
+ loadWindows(e) {
207
+ this.windows.clear();
208
+ let t = 0;
209
+ for (let n of e) {
210
+ this.windows.set(n.id, n);
211
+ let e = n.alwaysOnTop ?? !1 ? n.zIndex - ne : n.zIndex;
212
+ e > t && (t = e);
213
+ }
214
+ this.nextZIndex = t + 1;
215
+ }
216
+ getAll() {
217
+ return Array.from(this.windows.values());
218
+ }
219
+ getById(e) {
220
+ return this.windows.get(e);
221
+ }
222
+ open(e) {
223
+ let t = h(e);
224
+ return t.zIndex = this.assignZIndex(t.alwaysOnTop ?? !1), this.windows.set(t.id, t), t;
225
+ }
226
+ close(e) {
227
+ this.windows.delete(e);
228
+ }
229
+ minimize(e) {
230
+ this.updateWindow(e, { state: "minimized" });
231
+ }
232
+ maximize(e) {
233
+ this.updateWindow(e, { state: "maximized" });
234
+ }
235
+ restore(e) {
236
+ this.updateWindow(e, { state: "normal" });
237
+ }
238
+ focus(e) {
239
+ let t = this.windows.get(e);
240
+ if (!t) return;
241
+ let n = this.assignZIndex(t.alwaysOnTop ?? !1);
242
+ this.updateWindow(e, { zIndex: n });
243
+ }
244
+ move(e, t, n) {
245
+ this.updateWindow(e, {
246
+ x: t,
247
+ y: n
248
+ });
249
+ }
250
+ resize(e, t, n) {
251
+ this.updateWindow(e, {
252
+ width: t,
253
+ height: n
254
+ });
255
+ }
256
+ updateWindow(e, t) {
257
+ let n = this.windows.get(e);
258
+ n && this.windows.set(e, {
259
+ ...n,
260
+ ...t
261
+ });
262
+ }
263
+ }, ie = {
264
+ ".txt": "text/plain",
265
+ ".md": "text/markdown",
266
+ ".markdown": "text/markdown",
267
+ ".pdf": "application/pdf",
268
+ ".jpg": "image/jpeg",
269
+ ".jpeg": "image/jpeg",
270
+ ".png": "image/png",
271
+ ".gif": "image/gif",
272
+ ".svg": "image/svg+xml",
273
+ ".webp": "image/webp",
274
+ ".bmp": "image/bmp",
275
+ ".html": "text/html",
276
+ ".htm": "text/html",
277
+ ".css": "text/css",
278
+ ".js": "text/javascript",
279
+ ".json": "application/json",
280
+ ".xml": "text/xml",
281
+ ".jsdos": "application/jsdos",
282
+ ".zip": "application/zip"
283
+ };
284
+ function b(e) {
285
+ let t = e.lastIndexOf(".");
286
+ if (!(t === -1 || t === e.length - 1)) return ie[e.slice(t).toLowerCase()];
287
+ }
288
+ //#endregion
289
+ //#region src/utils/hashBlob.ts
290
+ function ae(e) {
291
+ let t = 5381;
292
+ for (let n = 0; n < e.length; n++) t = (t << 5) + t ^ e[n], t >>>= 0;
293
+ return t.toString(16).padStart(8, "0") + e.length.toString(16).padStart(8, "0");
294
+ }
295
+ async function x(e) {
296
+ let t = await e.arrayBuffer(), n = new Uint8Array(t);
297
+ if (crypto?.subtle) {
298
+ let e = await crypto.subtle.digest("SHA-256", n);
299
+ return Array.from(new Uint8Array(e)).map((e) => e.toString(16).padStart(2, "0")).join("");
300
+ }
301
+ return console.warn("[hashBlob] crypto.subtle unavailable (non-secure context), using fallback hash"), ae(n);
302
+ }
303
+ //#endregion
304
+ //#region src/infrastructure/adapters/IndexedDBFileSystem.ts
305
+ var oe = "fde-desktop-fs", S = "nodes", C = "blobs", w = "metadata", se = 2, T = class {
306
+ db = null;
307
+ nodes = /* @__PURE__ */ new Map();
308
+ ready = !1;
309
+ initPromise = null;
310
+ persistQueue = [];
311
+ persistScheduled = !1;
312
+ async initialize() {
313
+ return this.initPromise ||= this.doInitialize(), this.initPromise;
314
+ }
315
+ async doInitialize() {
316
+ await this.openDatabase(), await this.loadNodes(), await this.migrateFromLocalStorage(), this.ready = !0;
317
+ }
318
+ openDatabase() {
319
+ return new Promise((e, t) => {
320
+ let n = indexedDB.open(oe, se);
321
+ n.onerror = () => t(n.error), n.onsuccess = () => {
322
+ this.db = n.result, e();
323
+ }, n.onupgradeneeded = () => {
324
+ let e = n.result;
325
+ e.objectStoreNames.contains(S) || e.createObjectStore(S), e.objectStoreNames.contains(C) || e.createObjectStore(C), e.objectStoreNames.contains(w) || e.createObjectStore(w);
326
+ };
327
+ });
328
+ }
329
+ async loadNodes() {
330
+ if (this.db) return new Promise((e, t) => {
331
+ let n = this.db.transaction(S, "readonly"), r = n.objectStore(S).getAll();
332
+ r.onsuccess = () => {
333
+ let i = n.objectStore(S).getAllKeys();
334
+ i.onsuccess = () => {
335
+ let t = r.result, n = i.result;
336
+ for (let e = 0; e < t.length; e++) {
337
+ let r = String(n[e]);
338
+ this.nodes.set(r, t[e]);
339
+ }
340
+ e();
341
+ }, i.onerror = () => t(i.error);
342
+ }, r.onerror = () => t(r.error);
343
+ });
344
+ }
345
+ async migrateFromLocalStorage() {
346
+ let e = "fran-desktop:filesystem", t = localStorage.getItem(e);
347
+ if (t && this.nodes.size === 0) try {
348
+ let n = JSON.parse(t);
349
+ for (let [e, t] of n) this.nodes.set(e, t);
350
+ await this.persistAllNodes(), localStorage.removeItem(e);
351
+ } catch {}
352
+ }
353
+ isReady() {
354
+ return this.ready;
355
+ }
356
+ async reinitialize() {
357
+ this.ready || await this.initialize();
358
+ }
359
+ persistAllNodes() {
360
+ return this.db ? new Promise((e, t) => {
361
+ let n = this.db.transaction(S, "readwrite"), r = n.objectStore(S);
362
+ for (let [e, t] of this.nodes.entries()) r.put(t, e);
363
+ n.oncomplete = () => e(), n.onerror = () => t(n.error);
364
+ }) : Promise.resolve();
365
+ }
366
+ schedulePersist() {
367
+ this.persistScheduled || (this.persistScheduled = !0, queueMicrotask(() => {
368
+ this.persistScheduled = !1, this.flushPersistQueue();
369
+ }));
370
+ }
371
+ flushPersistQueue() {
372
+ if (!this.db || this.persistQueue.length === 0) return;
373
+ let e = [...this.persistQueue];
374
+ this.persistQueue = [];
375
+ let t = this.db.transaction(S, "readwrite"), n = t.objectStore(S);
376
+ t.onerror = () => {
377
+ console.error("IndexedDB write failed", t.error);
378
+ };
379
+ for (let t of e) t.type === "set" ? n.put(t.value, t.key) : t.type === "delete" && n.delete(t.key);
380
+ }
381
+ persistNode(e, t) {
382
+ this.persistQueue.push({
383
+ type: "set",
384
+ key: e,
385
+ value: t
386
+ }), this.schedulePersist();
387
+ }
388
+ deleteNodeFromPersist(e) {
389
+ this.persistQueue.push({
390
+ type: "delete",
391
+ key: e
392
+ }), this.schedulePersist();
393
+ }
394
+ async saveBlob(e) {
395
+ this.db || await this.initialize();
396
+ let t = await x(e);
397
+ return await this.getBlob(`idb://${t}`) ? `idb://${t}` : new Promise((n, r) => {
398
+ let i = this.db.transaction(C, "readwrite").objectStore(C).put(e, t);
399
+ i.onsuccess = () => n(`idb://${t}`), i.onerror = () => r(i.error);
400
+ });
401
+ }
402
+ async getBlob(e) {
403
+ this.db || await this.initialize();
404
+ let t = e.startsWith("idb://") ? e.slice(6) : e;
405
+ return new Promise((e, n) => {
406
+ let r = this.db.transaction(C, "readonly").objectStore(C).get(t);
407
+ r.onsuccess = () => e(r.result ?? null), r.onerror = () => n(r.error);
408
+ });
409
+ }
410
+ async toBlobUrl(e) {
411
+ if (!e.startsWith("idb://")) return null;
412
+ let t = await this.getBlob(e);
413
+ return t ? URL.createObjectURL(t) : null;
414
+ }
415
+ async clearBlobs() {
416
+ if (this.db) return new Promise((e, t) => {
417
+ let n = this.db.transaction(C, "readwrite").objectStore(C).clear();
418
+ n.onsuccess = () => e(), n.onerror = () => t(n.error);
419
+ });
420
+ }
421
+ async readFile(e) {
422
+ return "";
423
+ }
424
+ async writeFile(e, t) {}
425
+ getNode(e) {
426
+ return this.nodes.get(e);
427
+ }
428
+ getChildren(e) {
429
+ let t = this.nodes.get(e);
430
+ return !t || t.type !== "folder" ? [] : t.children.map((e) => this.nodes.get(e)).filter((e) => e !== void 0);
431
+ }
432
+ getRootNodes() {
433
+ return Array.from(this.nodes.values()).filter((e) => e.parentId === null);
434
+ }
435
+ getAllNodes() {
436
+ return Array.from(this.nodes.values());
437
+ }
438
+ isEmpty() {
439
+ return this.nodes.size === 0;
440
+ }
441
+ async createFile(e, t, n, r) {
442
+ let i = y(e, t, n, b(e), r);
443
+ return this.nodes.set(i.id, i), n && this.addChildToFolder(n, i.id), this.persistNode(i.id, i), i;
444
+ }
445
+ async createFolder(e, t, n, r) {
446
+ let i = v(e, t, {
447
+ iconName: n,
448
+ iconColor: r
449
+ });
450
+ return this.nodes.set(i.id, i), t && this.addChildToFolder(t, i.id), this.persistNode(i.id, i), i;
451
+ }
452
+ async updateFile(e, t) {
453
+ let n = this.nodes.get(e);
454
+ if (!n || n.type !== "file") throw Error(`File not found: ${e}`);
455
+ let r = {
456
+ ...n,
457
+ content: t,
458
+ updatedAt: /* @__PURE__ */ new Date()
459
+ };
460
+ return this.nodes.set(e, r), this.persistNode(e, r), r;
461
+ }
462
+ async move(e, t) {
463
+ let n = this.nodes.get(e);
464
+ if (!n) throw Error(`Node not found: ${e}`);
465
+ if (t === e) throw Error("Cannot move a folder into itself");
466
+ if (t !== null) {
467
+ let n = t;
468
+ for (; n !== null;) {
469
+ if (n === e) throw Error("Cannot move a folder into one of its descendants");
470
+ n = this.nodes.get(n)?.parentId ?? null;
471
+ }
472
+ }
473
+ n.parentId && this.removeChildFromParent(n);
474
+ let r = {
475
+ ...n,
476
+ parentId: t
477
+ };
478
+ return this.nodes.set(e, r), t && this.addChildToFolder(t, e), this.persistNode(e, r), r;
479
+ }
480
+ async delete(e) {
481
+ let t = this.nodes.get(e);
482
+ t && (t.type === "folder" && this.deleteRecursive(t), this.removeChildFromParent(t), this.nodes.delete(e), this.deleteNodeFromPersist(e));
483
+ }
484
+ async getManifestSha() {
485
+ return this.db || await this.initialize(), new Promise((e, t) => {
486
+ let n = this.db.transaction(w, "readonly").objectStore(w).get("manifestSha");
487
+ n.onsuccess = () => e(n.result ?? null), n.onerror = () => t(n.error);
488
+ });
489
+ }
490
+ async saveManifestSha(e) {
491
+ return this.db || await this.initialize(), new Promise((t, n) => {
492
+ let r = this.db.transaction(w, "readwrite").objectStore(w).put(e, "manifestSha");
493
+ r.onsuccess = () => t(), r.onerror = () => n(r.error);
494
+ });
495
+ }
496
+ async clearAll() {
497
+ this.nodes.clear(), this.ready = !1, this.initPromise = null, this.db &&= (await Promise.all([
498
+ new Promise((e, t) => {
499
+ let n = this.db.transaction(S, "readwrite");
500
+ n.objectStore(S).clear(), n.oncomplete = () => e(), n.onerror = () => t(n.error);
501
+ }),
502
+ new Promise((e, t) => {
503
+ let n = this.db.transaction(C, "readwrite");
504
+ n.objectStore(C).clear(), n.oncomplete = () => e(), n.onerror = () => t(n.error);
505
+ }),
506
+ new Promise((e, t) => {
507
+ let n = this.db.transaction(w, "readwrite");
508
+ n.objectStore(w).clear(), n.oncomplete = () => e(), n.onerror = () => t(n.error);
509
+ })
510
+ ]), this.db.close(), null);
511
+ }
512
+ async seed(e) {
513
+ let t = this.buildFolderMapFromManifest(e);
514
+ for (let n of e.files) {
515
+ let e = t.get(n.folder), r = y(n.name, "", e?.id ?? null, n.mimeType, n.url);
516
+ if (this.nodes.set(r.id, r), e) {
517
+ let i = {
518
+ ...e,
519
+ children: [...e.children, r.id]
520
+ };
521
+ this.nodes.set(e.id, i), t.set(n.folder, i);
522
+ }
523
+ }
524
+ await this.persistAllNodes();
525
+ }
526
+ async mergeSeed(e) {
527
+ let t = this.buildFolderMapFromManifest(e, !0);
528
+ for (let n of e.files) {
529
+ let e = t.get(n.folder);
530
+ if (!e) continue;
531
+ let r = this.getChildren(e.id).find((e) => e.type === "file" && e.name === n.name);
532
+ if (r) {
533
+ if (r.url !== n.url) {
534
+ let e = {
535
+ ...r,
536
+ url: n.url
537
+ };
538
+ this.nodes.set(r.id, e);
539
+ }
540
+ continue;
541
+ }
542
+ let i = y(n.name, "", e.id, n.mimeType, n.url);
543
+ this.nodes.set(i.id, i);
544
+ let a = {
545
+ ...e,
546
+ children: [...e.children, i.id]
547
+ };
548
+ this.nodes.set(e.id, a), t.set(n.folder, a);
549
+ }
550
+ await this.persistAllNodes();
551
+ }
552
+ buildFolderMapFromManifest(e, t = !1) {
553
+ let n = /* @__PURE__ */ new Map(), r = [...new Set([...e.folders, ...e.files.map((e) => e.folder)])].sort((e, t) => e.split("/").length - t.split("/").length);
554
+ for (let e of r) {
555
+ let r = e.split("/"), i = r[r.length - 1], a = r.length > 1 ? r.slice(0, -1).join("/") : null, o = a ? n.get(a) : null, s = o?.id ?? null;
556
+ if (t) {
557
+ let t = (s ? this.getChildren(s) : this.getRootNodes()).find((e) => e.type === "folder" && e.name === i);
558
+ if (t) {
559
+ n.set(e, t);
560
+ continue;
561
+ }
562
+ }
563
+ let c = v(i, s);
564
+ if (this.nodes.set(c.id, c), n.set(e, c), o) {
565
+ let e = {
566
+ ...o,
567
+ children: [...o.children, c.id]
568
+ };
569
+ this.nodes.set(o.id, e), n.set(a, e);
570
+ }
571
+ }
572
+ return n;
573
+ }
574
+ addChildToFolder(e, t) {
575
+ let n = this.nodes.get(e);
576
+ if (!n || n.type !== "folder") return;
577
+ let r = {
578
+ ...n,
579
+ children: [...n.children, t]
580
+ };
581
+ this.nodes.set(e, r), this.persistNode(e, r);
582
+ }
583
+ removeChildFromParent(e) {
584
+ if (!e.parentId) return;
585
+ let t = this.nodes.get(e.parentId);
586
+ if (!t || t.type !== "folder") return;
587
+ let n = {
588
+ ...t,
589
+ children: t.children.filter((t) => t !== e.id)
590
+ };
591
+ this.nodes.set(e.parentId, n), this.persistNode(e.parentId, n);
592
+ }
593
+ deleteRecursive(e) {
594
+ for (let t of e.children) {
595
+ let e = this.nodes.get(t);
596
+ e && (e.type === "folder" && this.deleteRecursive(e), this.nodes.delete(t), this.deleteNodeFromPersist(t));
597
+ }
598
+ }
599
+ }, ce = "/api/fs", le = 6e4;
600
+ async function ue(e, t = {}, n = le) {
601
+ let r = new AbortController(), i = setTimeout(() => r.abort(), n);
602
+ try {
603
+ return await fetch(e, {
604
+ ...t,
605
+ signal: r.signal
606
+ });
607
+ } finally {
608
+ clearTimeout(i);
609
+ }
610
+ }
611
+ var E = ce;
612
+ function de(e) {
613
+ E = e;
614
+ }
615
+ var fe = class {
616
+ nodes = /* @__PURE__ */ new Map();
617
+ pathToId = /* @__PURE__ */ new Map();
618
+ ready = !1;
619
+ rootFolderId;
620
+ initPromise = null;
621
+ constructor() {
622
+ this.rootFolderId = m(), this.pathToId.set("/", this.rootFolderId);
623
+ }
624
+ async initialize() {
625
+ return this.initPromise ||= this.doInitialize(), this.initPromise;
626
+ }
627
+ async doInitialize() {
628
+ try {
629
+ let e = await fetch(`${E}?action=readdir&path=/`);
630
+ if (e.ok) {
631
+ let t = await e.json();
632
+ await this.syncFromEntries(t, null);
633
+ }
634
+ } catch (e) {
635
+ console.warn("[DockerFS] Failed to initialize from server:", e);
636
+ }
637
+ this.ready = !0;
638
+ }
639
+ async reinitialize() {
640
+ this.ready = !1, this.nodes.clear(), this.pathToId.clear(), this.rootFolderId = m(), this.pathToId.set("/", this.rootFolderId), this.initPromise = null, await this.initialize();
641
+ }
642
+ isReady() {
643
+ return this.ready;
644
+ }
645
+ isEmpty() {
646
+ return this.nodes.size === 0;
647
+ }
648
+ getNode(e) {
649
+ return this.nodes.get(e);
650
+ }
651
+ getChildren(e) {
652
+ let t = [];
653
+ for (let n of this.nodes.values()) n.parentId === e && t.push(n);
654
+ return t;
655
+ }
656
+ getRootNodes() {
657
+ return Array.from(this.nodes.values()).filter((e) => e.parentId === null);
658
+ }
659
+ getAllNodes() {
660
+ return Array.from(this.nodes.values());
661
+ }
662
+ async createFile(e, t, n, r) {
663
+ let i = m(), a = n ? this.getPathFromId(n) : "/", o = a ? `${a}/${e}`.replace("//", "/") : `/${e}`, s = r ?? `/api/fs?action=file&path=${encodeURIComponent(o)}`, c = {
664
+ ...y(e, t, n, this.getMimeType(e), s),
665
+ id: i
666
+ };
667
+ this.nodes.set(i, c), this.pathToId.set(o, i);
668
+ try {
669
+ await this.writeFileToServer(o, t);
670
+ } catch (e) {
671
+ throw this.nodes.delete(i), this.pathToId.delete(o), e;
672
+ }
673
+ return c;
674
+ }
675
+ async createFolder(e, t, n, r) {
676
+ let i = m(), a = t ? this.getPathFromId(t) : "/", o = a ? `${a}/${e}`.replace("//", "/") : `/${e}`, s = {};
677
+ n && (s.iconName = n), r && (s.iconColor = r);
678
+ let c = {
679
+ ...v(e, t, s),
680
+ id: i
681
+ };
682
+ this.nodes.set(i, c), this.pathToId.set(o, i);
683
+ try {
684
+ await this.createDirOnServer(o, s);
685
+ } catch (e) {
686
+ throw this.nodes.delete(i), this.pathToId.delete(o), e;
687
+ }
688
+ return c;
689
+ }
690
+ async updateFile(e, t) {
691
+ let n = this.nodes.get(e);
692
+ if (!n || n.type !== "file") throw Error(`File not found: ${e}`);
693
+ let r = n, i = this.getPathFromId(e), a = {
694
+ ...r,
695
+ content: t,
696
+ updatedAt: /* @__PURE__ */ new Date()
697
+ };
698
+ return this.nodes.set(e, a), i && this.writeFileToServer(i, t).catch((e) => {
699
+ console.warn("[DockerFS] Failed to update file on server:", e);
700
+ }), a;
701
+ }
702
+ async move(e, t) {
703
+ let n = this.nodes.get(e);
704
+ if (!n) throw Error(`Node not found: ${e}`);
705
+ if (t === e) throw Error("Cannot move a folder into itself");
706
+ if (t !== null) {
707
+ let n = t;
708
+ for (; n !== null;) {
709
+ if (n === e) throw Error("Cannot move a folder into one of its descendants");
710
+ n = this.nodes.get(n)?.parentId ?? null;
711
+ }
712
+ }
713
+ let r = this.getPathFromId(e), i = t ? this.getPathFromId(t) : "/", a = i ? `${i}/${n.name}`.replace("//", "/") : `/${n.name}`;
714
+ if (!r) throw Error(`Cannot determine path for node ${e}`);
715
+ if (!i && t !== null) throw Error(`Cannot determine parent path for ${t}`);
716
+ let o = await ue(`${E}?action=move&oldPath=${encodeURIComponent(r)}&newPath=${encodeURIComponent(a)}`);
717
+ if (!o.ok) {
718
+ let e = await o.json().catch(() => ({}));
719
+ throw Error(e.error || `HTTP ${o.status}`);
720
+ }
721
+ let s = {
722
+ ...n,
723
+ parentId: t
724
+ };
725
+ return this.nodes.set(e, s), this.pathToId.delete(r), this.pathToId.set(a, e), s;
726
+ }
727
+ async delete(e) {
728
+ let t = this.getPathFromId(e);
729
+ if (this.deleteRecursive(e), t) try {
730
+ await this.deleteFromServer(t);
731
+ } catch (e) {
732
+ throw console.warn(`[DockerFS] Failed to delete ${t} on server:`, e), e;
733
+ }
734
+ }
735
+ async readFile(e) {
736
+ try {
737
+ let t = await fetch(`${E}?action=read&path=${encodeURIComponent(e)}`);
738
+ if (t.ok) return (await t.json()).content;
739
+ } catch (t) {
740
+ console.warn(`[DockerFS] Failed to read file ${e}:`, t);
741
+ }
742
+ return "";
743
+ }
744
+ async writeFile(e, t) {
745
+ await this.writeFileToServer(e, t);
746
+ }
747
+ async saveBlob(e) {
748
+ let t = `/.blobs/${await x(e)}.${e.type.split("/")[1] || "bin"}`;
749
+ try {
750
+ await fetch(`${E}?action=writeBinary&path=${encodeURIComponent(t)}`, {
751
+ method: "POST",
752
+ body: e
753
+ });
754
+ } catch (e) {
755
+ console.warn(`[DockerFS] Failed to save blob ${t}:`, e);
756
+ }
757
+ return `/api/fs?action=file&path=${encodeURIComponent(t)}`;
758
+ }
759
+ async getBlob(e) {
760
+ if (!e.startsWith("/api/fs")) return null;
761
+ try {
762
+ let t = await fetch(e);
763
+ return t.ok ? await t.blob() : null;
764
+ } catch {
765
+ return null;
766
+ }
767
+ }
768
+ async toBlobUrl(e) {
769
+ if (!e.startsWith("/api/fs")) return null;
770
+ try {
771
+ let t = await fetch(e);
772
+ if (!t.ok) return null;
773
+ let n = await t.blob();
774
+ return URL.createObjectURL(n);
775
+ } catch {
776
+ return null;
777
+ }
778
+ }
779
+ async getManifestSha() {
780
+ return null;
781
+ }
782
+ async saveManifestSha(e) {}
783
+ seed(e) {
784
+ return Promise.resolve();
785
+ }
786
+ mergeSeed(e) {
787
+ return Promise.resolve();
788
+ }
789
+ async clearAll() {
790
+ this.nodes.clear(), this.pathToId.clear(), this.ready = !1, this.initPromise = null, this.rootFolderId = m(), this.pathToId.set("/", this.rootFolderId);
791
+ }
792
+ getMimeType(e) {
793
+ return b(e) || "application/octet-stream";
794
+ }
795
+ getPathFromId(e) {
796
+ if (!e) return null;
797
+ for (let [t, n] of this.pathToId.entries()) if (n === e) return t;
798
+ let t = this.nodes.get(e);
799
+ if (!t) return null;
800
+ if (!t.parentId) return `/${t.name}`;
801
+ let n = this.getPathFromId(t.parentId);
802
+ return n ? `${n}/${t.name}` : null;
803
+ }
804
+ deleteRecursive(e) {
805
+ for (let t of this.getChildren(e)) this.deleteRecursive(t.id);
806
+ this.nodes.delete(e);
807
+ for (let [t, n] of this.pathToId.entries()) n === e && this.pathToId.delete(t);
808
+ }
809
+ async syncFromEntries(e, t) {
810
+ for (let n of e) {
811
+ let e = m();
812
+ if (n.type === "directory") {
813
+ let r = v(n.name, t);
814
+ this.nodes.set(e, {
815
+ ...r,
816
+ id: e
817
+ }), this.pathToId.set(n.path, e);
818
+ let i = await this.fetchReaddir(n.path);
819
+ await this.syncFromEntries(i, e);
820
+ } else {
821
+ let r = `/api/fs?action=file&path=${encodeURIComponent(n.path)}`, i = y(n.name, "", t, this.getMimeType(n.name), r);
822
+ this.nodes.set(e, {
823
+ ...i,
824
+ id: e
825
+ }), this.pathToId.set(n.path, e);
826
+ }
827
+ }
828
+ }
829
+ async fetchReaddir(e) {
830
+ try {
831
+ let t = await fetch(`${E}?action=readdir&path=${encodeURIComponent(e)}`);
832
+ if (t.ok) return await t.json();
833
+ } catch (t) {
834
+ console.warn(`[DockerFS] Failed to readdir ${e}:`, t);
835
+ }
836
+ return [];
837
+ }
838
+ async writeFileToServer(e, t) {
839
+ let n = await fetch(`${E}`, {
840
+ method: "POST",
841
+ headers: { "Content-Type": "application/json" },
842
+ body: JSON.stringify({
843
+ path: e,
844
+ content: t
845
+ })
846
+ });
847
+ if (!n.ok) throw Error(`Failed to write file ${e}: HTTP ${n.status}`);
848
+ }
849
+ async createDirOnServer(e, t) {
850
+ let n = await fetch(`${E}`, {
851
+ method: "PUT",
852
+ headers: { "Content-Type": "application/json" },
853
+ body: JSON.stringify({
854
+ path: e,
855
+ ...t
856
+ })
857
+ });
858
+ if (!n.ok) throw Error(`Failed to create directory ${e}: HTTP ${n.status}`);
859
+ }
860
+ async deleteFromServer(e) {
861
+ try {
862
+ await fetch(`${E}?path=${encodeURIComponent(e)}`, { method: "DELETE" });
863
+ } catch (t) {
864
+ console.warn(`[DockerFS] Failed to delete ${e}:`, t);
865
+ }
866
+ }
867
+ }, pe = "launcher-folder-custom-apps", me = [
868
+ {
869
+ id: "launcher-folder-social-links",
870
+ name: "Social Links",
871
+ fcIcon: "VscAccount",
872
+ appIds: ["github", "linkedin"],
873
+ isExpanded: !1,
874
+ isPredefined: !0,
875
+ order: 0
876
+ },
877
+ {
878
+ id: "launcher-folder-office",
879
+ name: "Office and media",
880
+ fcIcon: "VscLibrary",
881
+ appIds: [
882
+ "notepad",
883
+ "pdf",
884
+ "image-viewer"
885
+ ],
886
+ isExpanded: !1,
887
+ isPredefined: !0,
888
+ order: 1
889
+ },
890
+ {
891
+ id: "launcher-folder-programming",
892
+ name: "Programming",
893
+ fcIcon: "VscGitPullRequest",
894
+ appIds: [
895
+ "terminal",
896
+ "code-server",
897
+ "device-info",
898
+ "storybook"
899
+ ],
900
+ isExpanded: !1,
901
+ isPredefined: !0,
902
+ order: 2
903
+ },
904
+ {
905
+ id: "launcher-folder-games",
906
+ name: "Games",
907
+ fcIcon: "VscGame",
908
+ appIds: ["dos-emulator", "doom"],
909
+ isExpanded: !1,
910
+ isPredefined: !0,
911
+ order: 3
912
+ },
913
+ {
914
+ id: pe,
915
+ name: "Custom Apps",
916
+ fcIcon: "VscExtensions",
917
+ appIds: [],
918
+ isExpanded: !1,
919
+ isPredefined: !0,
920
+ order: 4
921
+ }
922
+ ], D = [...me], O = null, k = null, A = 0, he = 5e3, ge = "/dist-apps/apps-manifest.json";
923
+ async function j(e = !1) {
924
+ let t = Date.now();
925
+ if (!e && O && t - A < he) return O;
926
+ if (k) return k;
927
+ let n = `${ge}?t=${t}`;
928
+ return k = fetch(n).then(async (e) => {
929
+ if (!e.ok) {
930
+ if (e.status === 404) return console.warn("[CustomApps] No apps manifest found at", ge), null;
931
+ throw Error(`Failed to fetch manifest: ${e.status}`);
932
+ }
933
+ return e.json();
934
+ }).then((e) => (O = e, A = Date.now(), k = null, console.log(`[CustomApps] Loaded manifest with ${e.apps.length} apps`), e)).catch((e) => (console.error("[CustomApps] Error fetching manifest:", e), k = null, null)), k;
935
+ }
936
+ function _e() {
937
+ return O;
938
+ }
939
+ function ve() {
940
+ O = null, A = 0;
941
+ }
942
+ function ye(e) {
943
+ if (!O) {
944
+ O = {
945
+ version: "1.0.0",
946
+ generated: (/* @__PURE__ */ new Date()).toISOString(),
947
+ apps: [e]
948
+ };
949
+ return;
950
+ }
951
+ O = O.apps.some((t) => t.id === e.id) ? {
952
+ ...O,
953
+ apps: O.apps.map((t) => t.id === e.id ? e : t)
954
+ } : {
955
+ ...O,
956
+ apps: [...O.apps, e]
957
+ };
958
+ }
959
+ function be(e) {
960
+ O &&= {
961
+ ...O,
962
+ apps: O.apps.filter((t) => t.id !== e)
963
+ };
964
+ }
965
+ async function M() {
966
+ return (await j())?.apps ?? [];
967
+ }
968
+ async function xe(e) {
969
+ return (await M()).find((t) => t.id === e);
970
+ }
971
+ function Se(e) {
972
+ return O ? O.apps.some((t) => t.id === e) : !1;
973
+ }
974
+ function Ce(e) {
975
+ return {
976
+ id: e.id,
977
+ name: e.name,
978
+ icon: e.icon,
979
+ ...e.iconUrl && { iconUrl: e.iconUrl },
980
+ defaultWidth: e.window.defaultWidth,
981
+ defaultHeight: e.window.defaultHeight,
982
+ minWidth: e.window.minWidth === !1 ? void 0 : e.window.minWidth,
983
+ minHeight: e.window.minHeight === !1 ? void 0 : e.window.minHeight,
984
+ canMaximize: e.window.canMaximize,
985
+ alwaysOnTop: e.window.alwaysOnTop
986
+ };
987
+ }
988
+ function we(e, t) {
989
+ let n = new Set(t.map((e) => e.id)), r = e.filter((e) => !n.has(e.id)), i = t.map((e) => {
990
+ let t = {
991
+ id: e.id,
992
+ name: e.name,
993
+ icon: e.icon,
994
+ defaultWidth: e.window.defaultWidth ?? 800,
995
+ defaultHeight: e.window.defaultHeight ?? 600,
996
+ minWidth: e.window.minWidth === !1 ? void 0 : e.window.minWidth,
997
+ minHeight: e.window.minHeight === !1 ? void 0 : e.window.minHeight,
998
+ canMaximize: e.window.canMaximize ?? !0,
999
+ alwaysOnTop: e.window.alwaysOnTop ?? !1
1000
+ };
1001
+ return e.iconUrl && (t.iconUrl = e.iconUrl), t;
1002
+ });
1003
+ return [...r, ...i];
1004
+ }
1005
+ async function Te(e) {
1006
+ ve();
1007
+ let t = await j(!0);
1008
+ if (!t) return {
1009
+ added: [],
1010
+ removed: [],
1011
+ manifest: null
1012
+ };
1013
+ let n = Object.keys(e), r = t.apps.map((e) => e.id);
1014
+ return {
1015
+ added: t.apps.filter((e) => !n.includes(e.id)),
1016
+ removed: n.filter((e) => !r.includes(e)),
1017
+ manifest: t
1018
+ };
1019
+ }
1020
+ //#endregion
1021
+ //#region src/utils/sortNodes.ts
1022
+ var N = (e) => {
1023
+ let t = e.filter((e) => e.type === "folder"), n = e.filter((e) => e.type === "file"), r = (e, t) => e.name.localeCompare(t.name);
1024
+ return [...t.sort(r), ...n.sort(r)];
1025
+ }, Ee = {
1026
+ BY_TYPE: "byType",
1027
+ BY_NAME: "byName",
1028
+ BY_DATE: "byDate"
1029
+ };
1030
+ function P(e) {
1031
+ return e.nodeId ? e.appId === "files" ? "folder" : "file" : "app";
1032
+ }
1033
+ var F = {
1034
+ app: 0,
1035
+ folder: 1,
1036
+ file: 2
1037
+ };
1038
+ function I(e, t) {
1039
+ return [...e].sort((e, n) => {
1040
+ let r = P(e), i = P(n);
1041
+ if (r !== i) return F[r] - F[i];
1042
+ if (r === "app") {
1043
+ if (!t) return e.name.localeCompare(n.name);
1044
+ let r = t.indexOf(e.appId), i = t.indexOf(n.appId);
1045
+ return (r === -1 ? Infinity : r) - (i === -1 ? Infinity : i);
1046
+ }
1047
+ return e.name.localeCompare(n.name);
1048
+ });
1049
+ }
1050
+ var De = (e, t) => {
1051
+ switch (t) {
1052
+ case "default": return I(e);
1053
+ case "name-asc": return [...e].sort((e, t) => e.name.localeCompare(t.name));
1054
+ case "name-desc": return [...e].sort((e, t) => t.name.localeCompare(e.name));
1055
+ case "type": return [...e].sort((e, t) => {
1056
+ let n = P(e), r = P(t);
1057
+ return n === r ? e.name.localeCompare(t.name) : F[n] - F[r];
1058
+ });
1059
+ default: return I(e);
1060
+ }
1061
+ }, Oe = (e, t) => {
1062
+ switch (t) {
1063
+ case "default":
1064
+ case "type": return N(e);
1065
+ case "name-asc": return [...e].sort((e, t) => e.name.localeCompare(t.name));
1066
+ case "name-desc": return [...e].sort((e, t) => t.name.localeCompare(e.name));
1067
+ default: return N(e);
1068
+ }
1069
+ }, L = {
1070
+ defaultWidth: 800,
1071
+ defaultHeight: 600,
1072
+ minWidth: 640,
1073
+ minHeight: 480
1074
+ }, R = [
1075
+ {
1076
+ id: "files",
1077
+ name: "FilesApp",
1078
+ icon: "📁",
1079
+ fcIcon: "FcOpenedFolder",
1080
+ hasContextMenu: !0,
1081
+ ...L
1082
+ },
1083
+ {
1084
+ id: "settings",
1085
+ name: "Settings",
1086
+ icon: "⚙️",
1087
+ fcIcon: "FcSettings",
1088
+ singleWindow: !0,
1089
+ ...L
1090
+ },
1091
+ {
1092
+ id: "notepad",
1093
+ name: "Notepad",
1094
+ icon: "📝",
1095
+ fcIcon: "FcEditImage",
1096
+ ...L
1097
+ },
1098
+ {
1099
+ id: "image-viewer",
1100
+ name: "Image Viewer",
1101
+ icon: "🖼️",
1102
+ fcIcon: "FcPicture",
1103
+ defaultWidth: 700,
1104
+ defaultHeight: 520,
1105
+ minWidth: 640,
1106
+ minHeight: 480
1107
+ },
1108
+ {
1109
+ id: "pdf",
1110
+ name: "PDF Viewer",
1111
+ icon: "📄",
1112
+ fcIcon: "FcDocument",
1113
+ defaultWidth: 780,
1114
+ defaultHeight: 580,
1115
+ minWidth: 640,
1116
+ minHeight: 480
1117
+ },
1118
+ {
1119
+ id: "uploader",
1120
+ name: "Uploader",
1121
+ icon: "📤",
1122
+ fcIcon: "FcUpload",
1123
+ ...L
1124
+ },
1125
+ {
1126
+ id: "menuedit",
1127
+ name: "MenuEdit",
1128
+ icon: "📁",
1129
+ fcIcon: "FcFolder",
1130
+ singleWindow: !0,
1131
+ ...L
1132
+ },
1133
+ {
1134
+ id: "device-info",
1135
+ name: "Device Info",
1136
+ icon: "📊",
1137
+ fcIcon: "FcBarChart",
1138
+ defaultWidth: 300,
1139
+ defaultHeight: 400,
1140
+ minWidth: 280,
1141
+ minHeight: 350,
1142
+ canMaximize: !1,
1143
+ alwaysOnTop: !0,
1144
+ singleWindow: !0
1145
+ },
1146
+ {
1147
+ id: "calendar",
1148
+ name: "Calendar",
1149
+ icon: "📅",
1150
+ fcIcon: "FcCalendar",
1151
+ defaultWidth: 320,
1152
+ defaultHeight: 370,
1153
+ minWidth: !1,
1154
+ minHeight: !1,
1155
+ canMaximize: !1,
1156
+ singleWindow: !0
1157
+ }
1158
+ ], ke = R.map((e) => e.id), z = [
1159
+ {
1160
+ id: "welcome",
1161
+ name: "Welcome",
1162
+ icon: "👋",
1163
+ fcIcon: "FcBusinessContact",
1164
+ defaultWidth: 900,
1165
+ defaultHeight: 700,
1166
+ minWidth: 600,
1167
+ minHeight: 500
1168
+ },
1169
+ {
1170
+ id: "storybook",
1171
+ name: "Storybook",
1172
+ icon: "📖",
1173
+ fcIcon: "FcReading",
1174
+ defaultWidth: 1100,
1175
+ defaultHeight: 700,
1176
+ minWidth: 640,
1177
+ minHeight: 480
1178
+ },
1179
+ {
1180
+ id: "linkedin",
1181
+ name: "LinkedinApp",
1182
+ icon: "🔗",
1183
+ fcIcon: "FiLinkedin",
1184
+ iconColor: "#0A66C2",
1185
+ defaultWidth: 1100,
1186
+ defaultHeight: 700
1187
+ },
1188
+ {
1189
+ id: "github",
1190
+ name: "GithubApp",
1191
+ icon: "🔗",
1192
+ fcIcon: "FiGithub",
1193
+ iconColor: "#000",
1194
+ defaultWidth: 640,
1195
+ defaultHeight: 480
1196
+ },
1197
+ {
1198
+ id: "terminal",
1199
+ name: "Terminal",
1200
+ icon: "💻",
1201
+ fcIcon: "FcCommandLine",
1202
+ ...L
1203
+ },
1204
+ {
1205
+ id: "code-server",
1206
+ name: "VS Code",
1207
+ icon: "📘",
1208
+ fcIcon: "FcCodesandbox",
1209
+ iconUrl: "/vscode.svg",
1210
+ defaultWidth: 1200,
1211
+ defaultHeight: 800,
1212
+ minWidth: 800,
1213
+ minHeight: 600
1214
+ },
1215
+ {
1216
+ id: "dos-emulator",
1217
+ name: "DOS Emulator",
1218
+ icon: "🎮",
1219
+ fcIcon: "FcGamepad",
1220
+ defaultWidth: 900,
1221
+ defaultHeight: 700,
1222
+ minWidth: 640,
1223
+ minHeight: 480
1224
+ },
1225
+ {
1226
+ id: "doom",
1227
+ name: "DOOM",
1228
+ icon: "🔫",
1229
+ fcIcon: "FcVideoGame",
1230
+ iconUrl: "doom.png",
1231
+ defaultWidth: 900,
1232
+ defaultHeight: 700,
1233
+ minWidth: 640,
1234
+ minHeight: 480,
1235
+ autoLoad: {
1236
+ url: "Games/doom.jsdos",
1237
+ name: "DOOM"
1238
+ }
1239
+ }
1240
+ ], Ae = z.map((e) => e.id), B = [...R, ...z], V = [
1241
+ "welcome",
1242
+ "uploader",
1243
+ "terminal",
1244
+ "code-server",
1245
+ "storybook",
1246
+ "settings",
1247
+ "notepad",
1248
+ "linkedin",
1249
+ "github",
1250
+ "files",
1251
+ "doom"
1252
+ ];
1253
+ function je(e) {
1254
+ for (let t of e) B.find((e) => e.id === t.id) || B.push(t);
1255
+ }
1256
+ function Me(e) {
1257
+ for (let t of e) V.includes(t) || V.push(t);
1258
+ }
1259
+ //#endregion
1260
+ //#region src/utils/getAppIdForMime.ts
1261
+ var Ne = [], H = (e) => {
1262
+ Ne.push(e);
1263
+ }, Pe = new Set([
1264
+ "image/jpeg",
1265
+ "image/png",
1266
+ "image/gif",
1267
+ "image/svg+xml",
1268
+ "image/webp",
1269
+ "image/bmp"
1270
+ ]), Fe = new Set([
1271
+ "text/plain",
1272
+ "text/markdown",
1273
+ "text/x-markdown",
1274
+ "application/json"
1275
+ ]);
1276
+ H({
1277
+ appId: "pdf",
1278
+ mimeTypes: ["application/pdf"],
1279
+ transformContentData: (e) => ({ src: e.url ?? e.name })
1280
+ }), H({
1281
+ appId: "image-viewer",
1282
+ mimeTypes: (e) => Pe.has(e) || e.startsWith("image/"),
1283
+ transformContentData: (e) => ({ src: e.url ?? e.name })
1284
+ }), H({
1285
+ appId: "notepad",
1286
+ mimeTypes: (e) => Fe.has(e) || e.startsWith("text/"),
1287
+ transformContentData: (e) => ({
1288
+ url: e.url,
1289
+ initialName: e.name,
1290
+ fileId: e.id
1291
+ })
1292
+ }), H({
1293
+ appId: "dos-emulator",
1294
+ mimeTypes: [
1295
+ "application/jsdos",
1296
+ "application/zip",
1297
+ "application/x-zip-compressed"
1298
+ ],
1299
+ transformContentData: (e) => ({ autoLoad: {
1300
+ url: e.url ?? e.name,
1301
+ name: e.name
1302
+ } })
1303
+ });
1304
+ function Ie(e) {
1305
+ if (!e) return null;
1306
+ for (let t of Ne) if (typeof t.mimeTypes == "function" ? t.mimeTypes(e) : t.mimeTypes.includes(e)) return t;
1307
+ return null;
1308
+ }
1309
+ function U(e) {
1310
+ if (typeof e == "string" || e === void 0) return Ie(e)?.appId ?? "files";
1311
+ let t = Ie(e.mimeType);
1312
+ return t ? {
1313
+ appId: t.appId,
1314
+ contentData: t.transformContentData(e)
1315
+ } : null;
1316
+ }
1317
+ //#endregion
1318
+ //#region src/stores/customAppStore.ts
1319
+ var W = {
1320
+ isLoaded: !1,
1321
+ isLoading: !1,
1322
+ isReady: !1,
1323
+ hasError: !1,
1324
+ error: void 0,
1325
+ mountedAt: 0,
1326
+ instance: void 0
1327
+ }, G = n((e) => ({
1328
+ mountedApps: {},
1329
+ registeredApps: {},
1330
+ hmrConnected: !1,
1331
+ hmrError: null,
1332
+ devServerOffline: !1,
1333
+ hmrRetryCount: 0,
1334
+ setAppLoading: (t) => e((e) => ({ mountedApps: {
1335
+ ...e.mountedApps,
1336
+ [t]: {
1337
+ ...W,
1338
+ isLoading: !0,
1339
+ mountedAt: Date.now()
1340
+ }
1341
+ } })),
1342
+ setAppLoaded: (t) => e((e) => ({ mountedApps: {
1343
+ ...e.mountedApps,
1344
+ [t]: {
1345
+ ...e.mountedApps[t] || W,
1346
+ isLoaded: !0,
1347
+ isLoading: !1,
1348
+ hasError: !1,
1349
+ error: void 0
1350
+ }
1351
+ } })),
1352
+ setAppReady: (t, n) => e((e) => ({ mountedApps: {
1353
+ ...e.mountedApps,
1354
+ [t]: {
1355
+ ...e.mountedApps[t] || W,
1356
+ isReady: !0,
1357
+ isLoaded: !0,
1358
+ isLoading: !1,
1359
+ instance: n ?? e.mountedApps[t]?.instance
1360
+ }
1361
+ } })),
1362
+ setAppError: (t, n) => e((e) => ({ mountedApps: {
1363
+ ...e.mountedApps,
1364
+ [t]: {
1365
+ ...e.mountedApps[t] || W,
1366
+ isLoaded: !1,
1367
+ isLoading: !1,
1368
+ isReady: !1,
1369
+ hasError: !0,
1370
+ error: n
1371
+ }
1372
+ } })),
1373
+ clearApp: (t) => e((e) => {
1374
+ let { [t]: n, ...r } = e.mountedApps;
1375
+ return { mountedApps: r };
1376
+ }),
1377
+ registerApp: (t) => e((e) => ({ registeredApps: {
1378
+ ...e.registeredApps,
1379
+ [t.id]: t
1380
+ } })),
1381
+ unregisterApp: (t) => e((e) => {
1382
+ let { [t]: n, ...r } = e.registeredApps;
1383
+ return { registeredApps: r };
1384
+ }),
1385
+ setHmrConnected: (t) => e({
1386
+ hmrConnected: t,
1387
+ devServerOffline: !t
1388
+ }),
1389
+ setHmrError: (t) => e({ hmrError: t }),
1390
+ setDevServerOffline: (t) => e({ devServerOffline: t }),
1391
+ incrementHmrRetry: () => e((e) => ({ hmrRetryCount: e.hmrRetryCount + 1 })),
1392
+ resetHmrRetry: () => e({ hmrRetryCount: 0 })
1393
+ })), Le = "/", K = null, q = null;
1394
+ function Re(e) {
1395
+ q = e, K = null;
1396
+ }
1397
+ function ze() {
1398
+ if (K !== null) return K;
1399
+ if (q !== null) return K = q, K;
1400
+ let e = document.querySelector("base[href]");
1401
+ if (e) {
1402
+ let t = e.getAttribute("href");
1403
+ if (t) return K = t, t;
1404
+ }
1405
+ return K = Le, K;
1406
+ }
1407
+ function Be() {
1408
+ K = null;
1409
+ }
1410
+ function Ve(e) {
1411
+ if (!e || e.startsWith("http://") || e.startsWith("https://") || e.startsWith("idb://") || e.startsWith("blob:") || e.startsWith("/")) return e;
1412
+ let t = ze();
1413
+ return (t.endsWith("/") ? t : `${t}/`) + e;
1414
+ }
1415
+ //#endregion
1416
+ //#region src/constants/breakpoints.ts
1417
+ var He = {
1418
+ MOBILE: 768,
1419
+ TABLET: 1024,
1420
+ DESKTOP: 1280
1421
+ }, J = {
1422
+ WIDTH: 1280,
1423
+ HEIGHT: 800
1424
+ }, Ue = 48, We = 80, Ge = 80, Ke = 20, qe = J.WIDTH, Je = J.HEIGHT, Ye = async () => {
1425
+ let e = await fetch(Ve("fs-manifest.json")), t = e.headers.get("content-type")?.includes("application/json");
1426
+ return e.ok && t ? await e.json() : null;
1427
+ }, Y = new re();
1428
+ function Xe() {
1429
+ return e() ? (console.log("[FileSystem] Using DockerFileSystemAdapter"), new fe()) : (console.log("[FileSystem] Using IndexedDBFileSystem"), new T());
1430
+ }
1431
+ var X = Xe(), Ze = () => {
1432
+ X.clearAll().catch(() => {});
1433
+ }, Qe = () => Y.reset();
1434
+ async function $e(e, t) {
1435
+ if (e.startsWith("idb://")) {
1436
+ let t = await X.getBlob(e);
1437
+ return t ? t.text() : "";
1438
+ }
1439
+ let n = e.startsWith("http") || e.startsWith("/") ? e : `/${e}`, r = await fetch(n, { signal: t });
1440
+ return r.ok ? r.text() : "";
1441
+ }
1442
+ var Z = () => X.getRootNodes().find((e) => e.type === "folder" && e.name === "Desktop")?.id ?? null, et = (e, t) => {
1443
+ let n = new Set(e.map((e) => `${e.x},${e.y}`)), r = Math.max(1, Math.floor((t - 20) / 80));
1444
+ for (let e = 0;; e++) {
1445
+ let t = 20 + e * 80;
1446
+ for (let e = 0; e < r; e++) {
1447
+ let r = 20 + e * 80;
1448
+ if (!n.has(`${t},${r}`)) return {
1449
+ x: t,
1450
+ y: r
1451
+ };
1452
+ }
1453
+ }
1454
+ }, tt = (e, t) => {
1455
+ let n = Math.max(1, Math.floor((t - 20) / 80)), r = Math.floor(e / n), i = e % n;
1456
+ return {
1457
+ x: 20 + r * 80,
1458
+ y: 20 + i * 80
1459
+ };
1460
+ }, Q = (e, t, n) => {
1461
+ let r = et(e, n);
1462
+ return [...e, g({
1463
+ ...t,
1464
+ ...r
1465
+ })];
1466
+ }, nt = () => {
1467
+ let e = Z();
1468
+ if (!e || !X.isReady()) return;
1469
+ let t = X.getChildren(e), n = new Set(t.map((e) => e.id)), r = new Set(t.map((e) => e.name)), { icons: i, viewportHeight: a } = $.getState(), o = i.filter((e) => !e.nodeId || n.has(e.nodeId) || r.has(e.name));
1470
+ for (let e of t) {
1471
+ let t = o.find((t) => t.name === e.name);
1472
+ if (t) t.nodeId !== e.id && (o = o.map((t) => t.name === e.name ? {
1473
+ ...t,
1474
+ nodeId: e.id
1475
+ } : t));
1476
+ else {
1477
+ let t = e.type === "folder", n = t ? e : null, r = t ? null : e, i = t ? "files" : r ? U(r)?.appId ?? "" : "";
1478
+ o = Q(o, {
1479
+ name: e.name,
1480
+ icon: t ? "📁" : "📄",
1481
+ iconName: n?.iconName,
1482
+ iconColor: n?.iconColor,
1483
+ appId: i,
1484
+ nodeId: e.id
1485
+ }, a);
1486
+ }
1487
+ }
1488
+ let s = I(o);
1489
+ $.setState({ icons: s.map((e, t) => ({
1490
+ ...e,
1491
+ ...tt(t, a)
1492
+ })) });
1493
+ }, $ = n()(a((e, n) => ({
1494
+ windows: [],
1495
+ openWindow: (t) => {
1496
+ let n = Y.open(t);
1497
+ e((e) => ({ windows: [...e.windows, n] }));
1498
+ },
1499
+ closeWindow: (t) => {
1500
+ Y.close(t), e((e) => ({ windows: e.windows.filter((e) => e.id !== t) }));
1501
+ },
1502
+ minimizeWindow: (t) => {
1503
+ Y.minimize(t), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
1504
+ ...e,
1505
+ state: "minimized"
1506
+ } : e) }));
1507
+ },
1508
+ maximizeWindow: (t) => {
1509
+ Y.maximize(t), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
1510
+ ...e,
1511
+ state: "maximized"
1512
+ } : e) }));
1513
+ },
1514
+ restoreWindow: (t) => {
1515
+ Y.restore(t), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
1516
+ ...e,
1517
+ state: "normal"
1518
+ } : e) }));
1519
+ },
1520
+ focusWindow: (t) => {
1521
+ Y.focus(t);
1522
+ let n = Y.getById(t);
1523
+ n && e((e) => ({ windows: e.windows.map((e) => e.id === t ? n : e) }));
1524
+ },
1525
+ moveWindow: (t, n, r) => {
1526
+ Y.move(t, n, r), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
1527
+ ...e,
1528
+ x: n,
1529
+ y: r
1530
+ } : e) }));
1531
+ },
1532
+ resizeWindow: (t, n, r) => {
1533
+ Y.resize(t, n, r), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
1534
+ ...e,
1535
+ width: n,
1536
+ height: r
1537
+ } : e) }));
1538
+ },
1539
+ icons: [],
1540
+ addIcon: (t) => {
1541
+ let n = g(t);
1542
+ e((e) => ({ icons: [...e.icons, n] }));
1543
+ },
1544
+ removeIcon: (t) => {
1545
+ e((e) => ({ icons: e.icons.filter((e) => e.id !== t) }));
1546
+ },
1547
+ fsNodes: [],
1548
+ desktopFolderId: null,
1549
+ isFsReady: !1,
1550
+ initFs: async () => {
1551
+ try {
1552
+ X.isReady() && X.reinitialize ? await X.reinitialize() : X.isReady() || await X.initialize();
1553
+ let r = await Ye();
1554
+ if (r) {
1555
+ let e = r.sha ?? null, t = await X.getManifestSha();
1556
+ X.isEmpty() ? (await X.seed(r), e && await X.saveManifestSha(e)) : t !== e && e !== null && (await X.mergeSeed(r), await X.saveManifestSha(e));
1557
+ }
1558
+ if (e({
1559
+ fsNodes: X.getAllNodes(),
1560
+ desktopFolderId: Z(),
1561
+ isFsReady: !0
1562
+ }), !t()) {
1563
+ let t = null;
1564
+ try {
1565
+ if (t = await j(), t?.apps?.length) {
1566
+ e({ customApps: t.apps });
1567
+ for (let e of t.apps) G.getState().registerApp(e);
1568
+ }
1569
+ let r = new Set(t?.apps?.map((e) => e.id) ?? []), i = n().icons.filter((e) => e.appId && !B.find((t) => t.id === e.appId) && !r.has(e.appId)).map((e) => e.appId);
1570
+ i.length > 0 && e((e) => ({
1571
+ icons: e.icons.filter((e) => !i.includes(e.appId)),
1572
+ customApps: e.customApps.filter((e) => !i.includes(e.id))
1573
+ }));
1574
+ } catch (e) {
1575
+ console.warn("[DesktopStore] Failed to load custom apps manifest:", e);
1576
+ }
1577
+ }
1578
+ for (let t of V) {
1579
+ let r = B.find((e) => e.id === t);
1580
+ r && (n().icons.some((e) => e.appId === t) || e({ icons: Q(n().icons, {
1581
+ name: r.name,
1582
+ icon: r.icon,
1583
+ appId: t
1584
+ }, n().viewportHeight) }));
1585
+ }
1586
+ if (!t()) {
1587
+ let t = n().customApps;
1588
+ if (t.length) for (let r of t) n().icons.some((e) => e.appId === r.id) || e({ icons: Q(n().icons, {
1589
+ name: r.name,
1590
+ icon: r.icon,
1591
+ appId: r.id
1592
+ }, n().viewportHeight) });
1593
+ }
1594
+ let i = Z();
1595
+ if (!i) return;
1596
+ X.getChildren(i).forEach((t) => {
1597
+ if (t.type !== "file") return;
1598
+ let r = n().icons.find((e) => e.name === t.name);
1599
+ r ? r.nodeId || e({ icons: n().icons.map((e) => e.name === t.name ? {
1600
+ ...e,
1601
+ nodeId: t.id
1602
+ } : e) }) : e({ icons: Q(n().icons, {
1603
+ name: t.name,
1604
+ icon: "📄",
1605
+ appId: U(t.mimeType),
1606
+ nodeId: t.id
1607
+ }, n().viewportHeight) });
1608
+ }), nt();
1609
+ } catch (t) {
1610
+ console.error("Failed to initialize filesystem:", t), e({ isFsReady: !0 });
1611
+ }
1612
+ },
1613
+ createFile: async (t, r, i, a) => {
1614
+ let o = await X.createFile(t, r, i, a), s = Z(), { icons: c, viewportHeight: l } = n(), u = i && i === s && !c.some((e) => e.name === o.name) ? Q(c, {
1615
+ name: o.name,
1616
+ icon: "📄",
1617
+ appId: U(o.mimeType),
1618
+ nodeId: o.id
1619
+ }, l) : c;
1620
+ return e({
1621
+ fsNodes: X.getAllNodes(),
1622
+ icons: u
1623
+ }), o;
1624
+ },
1625
+ createFolder: async (t, r, i, a) => {
1626
+ let o = await X.createFolder(t, r, i, a), s = Z(), { icons: c, viewportHeight: l } = n(), u = r && r === s && !c.some((e) => e.name === o.name) ? Q(c, {
1627
+ name: o.name,
1628
+ icon: "📁",
1629
+ iconName: o.iconName,
1630
+ iconColor: o.iconColor,
1631
+ appId: "files",
1632
+ nodeId: o.id
1633
+ }, l) : c;
1634
+ return e({
1635
+ fsNodes: X.getAllNodes(),
1636
+ icons: u
1637
+ }), o;
1638
+ },
1639
+ updateFile: async (t, n) => {
1640
+ await X.updateFile(t, n), e({ fsNodes: X.getAllNodes() });
1641
+ },
1642
+ deleteNode: async (t) => {
1643
+ let n = X.getNode(t);
1644
+ if (await X.delete(t), e({ fsNodes: X.getAllNodes() }), n?.type === "file" || n?.type === "folder") {
1645
+ let t = Z();
1646
+ n.parentId && n.parentId === t && e((e) => ({ icons: e.icons.filter((e) => e.name !== n.name) }));
1647
+ }
1648
+ },
1649
+ moveNode: async (t, n) => {
1650
+ await X.move(t, n), e({ fsNodes: X.getAllNodes() });
1651
+ },
1652
+ setFsNodes: (t) => {
1653
+ e({ fsNodes: t });
1654
+ },
1655
+ syncIcons: () => {
1656
+ nt();
1657
+ },
1658
+ clipboard: {
1659
+ content: [],
1660
+ action: null
1661
+ },
1662
+ copyToClipboard: (t) => {
1663
+ e({ clipboard: {
1664
+ content: t,
1665
+ action: "copy"
1666
+ } });
1667
+ },
1668
+ cutToClipboard: (t) => {
1669
+ e({ clipboard: {
1670
+ content: t,
1671
+ action: "cut"
1672
+ } });
1673
+ },
1674
+ clearClipboard: () => {
1675
+ e({ clipboard: {
1676
+ content: [],
1677
+ action: null
1678
+ } });
1679
+ },
1680
+ filesCurrentFolderId: null,
1681
+ setFilesCurrentFolderId: (t) => {
1682
+ e({ filesCurrentFolderId: t });
1683
+ },
1684
+ contextMenu: {
1685
+ x: 0,
1686
+ y: 0,
1687
+ owner: null
1688
+ },
1689
+ openContextMenu: (t, n, r, i) => {
1690
+ e({ contextMenu: {
1691
+ x: t,
1692
+ y: n,
1693
+ owner: r,
1694
+ targetNodeId: i
1695
+ } });
1696
+ },
1697
+ closeContextMenu: () => {
1698
+ e({ contextMenu: {
1699
+ x: 0,
1700
+ y: 0,
1701
+ owner: null,
1702
+ targetNodeId: void 0
1703
+ } });
1704
+ },
1705
+ mergeSeed: async (t) => {
1706
+ await X.mergeSeed(t), e({
1707
+ fsNodes: X.getAllNodes(),
1708
+ desktopFolderId: Z()
1709
+ });
1710
+ },
1711
+ mergeDesktopApps: (t) => {
1712
+ for (let r of t) {
1713
+ let t = B.find((e) => e.id === r);
1714
+ t && (n().icons.some((e) => e.appId === r) || e({ icons: Q(n().icons, {
1715
+ name: t.name,
1716
+ icon: t.icon,
1717
+ appId: r
1718
+ }, n().viewportHeight) }));
1719
+ }
1720
+ let r = Z();
1721
+ if (r) for (let t of X.getChildren(r)) t.type === "file" && (n().icons.some((e) => e.name === t.name) || e({ icons: Q(n().icons, {
1722
+ name: t.name,
1723
+ icon: "📄",
1724
+ appId: U(t.mimeType),
1725
+ nodeId: t.id
1726
+ }, n().viewportHeight) }));
1727
+ },
1728
+ reorderDesktopApps: (t) => {
1729
+ let r = n().icons, i = [], a = [];
1730
+ for (let e of r) e.appId && !e.nodeId ? i.push(e) : a.push(e);
1731
+ let o = [];
1732
+ for (let e of t) {
1733
+ let t = i.findIndex((t) => t.appId === e);
1734
+ t !== -1 && o.push(i[t]);
1735
+ }
1736
+ for (let e of i) o.includes(e) || o.push(e);
1737
+ let s = 20, c = 20, l = n().viewportHeight, u = Math.max(1, Math.floor((l - 48 - 20) / 80));
1738
+ for (let e = 0; e < o.length; e++) {
1739
+ let t = Math.floor(e / 1);
1740
+ t >= u && t > 0 && (c += 80, s = 20), o[e] = {
1741
+ ...o[e],
1742
+ x: c,
1743
+ y: s
1744
+ }, s += 80;
1745
+ }
1746
+ e({ icons: [...o, ...a] });
1747
+ },
1748
+ notifications: [],
1749
+ addNotification: (t) => {
1750
+ e((e) => ({ notifications: [...e.notifications, t] }));
1751
+ },
1752
+ removeNotification: (t) => {
1753
+ e((e) => ({ notifications: e.notifications.filter((e) => e.id !== t) }));
1754
+ },
1755
+ viewportWidth: qe,
1756
+ viewportHeight: Je,
1757
+ isViewportInitialized: !1,
1758
+ setViewportSize: (t, r) => {
1759
+ let i = n().viewportWidth, a = n().viewportHeight, o = n().isViewportInitialized;
1760
+ if (i === t && a === r) return;
1761
+ if (e({
1762
+ viewportWidth: t,
1763
+ viewportHeight: r
1764
+ }), !o) {
1765
+ e({ isViewportInitialized: !0 });
1766
+ return;
1767
+ }
1768
+ if (a !== r) {
1769
+ let t = Math.max(1, Math.floor((a - 20) / 80)), i = Math.max(1, Math.floor((r - 20) / 80));
1770
+ t !== i && e({ icons: n().icons.map((e, t) => {
1771
+ let n = Math.floor(t / i), r = t % i;
1772
+ return {
1773
+ ...e,
1774
+ x: 20 + n * 80,
1775
+ y: 20 + r * 80
1776
+ };
1777
+ }) });
1778
+ }
1779
+ let s = t < 768, c = n().windows.map((e) => {
1780
+ if (e.state !== "normal") return e;
1781
+ if (s) return {
1782
+ ...e,
1783
+ x: 0,
1784
+ y: 0,
1785
+ width: t,
1786
+ height: r,
1787
+ minWidth: void 0,
1788
+ minHeight: void 0
1789
+ };
1790
+ let n = i > 0 ? t / i : 1, o = a > 0 ? r / a : 1, c = Math.round(e.x * n), l = Math.round(e.y * o), u = e.width, d = e.height;
1791
+ return u > t && (u = t), d > r && (d = r), c = Math.max(0, Math.min(c, t - Math.min(u, 100))), l = Math.max(0, Math.min(l, r - Math.min(d, 40))), {
1792
+ ...e,
1793
+ x: c,
1794
+ y: l,
1795
+ width: u,
1796
+ height: d
1797
+ };
1798
+ });
1799
+ for (let e of c) Y.move(e.id, e.x, e.y), Y.resize(e.id, e.width, e.height);
1800
+ e({ windows: c });
1801
+ },
1802
+ desktopSortMode: "default",
1803
+ filesSortMode: "default",
1804
+ setDesktopSortMode: (t) => {
1805
+ e({ desktopSortMode: t });
1806
+ let r = n().icons, i = De(r, t), a = n().viewportHeight;
1807
+ e({ icons: i.map((e, t) => ({
1808
+ ...e,
1809
+ ...tt(t, a)
1810
+ })) });
1811
+ },
1812
+ setFilesSortMode: (t) => {
1813
+ e({ filesSortMode: t });
1814
+ },
1815
+ launcherFolders: D,
1816
+ setLauncherFolders: (t) => {
1817
+ e({ launcherFolders: t });
1818
+ },
1819
+ createLauncherFolder: (t) => {
1820
+ let n = _(t);
1821
+ return e((e) => ({ launcherFolders: [...e.launcherFolders, n].sort((e, t) => e.order - t.order) })), n;
1822
+ },
1823
+ updateLauncherFolder: (t, n) => {
1824
+ e((e) => ({ launcherFolders: e.launcherFolders.map((e) => e.id === t ? te(e, n) : e) }));
1825
+ },
1826
+ deleteLauncherFolder: (t) => {
1827
+ e((e) => ({ launcherFolders: e.launcherFolders.filter((e) => e.id !== t || e.isPredefined) }));
1828
+ },
1829
+ moveLauncherFolder: (t, n) => {
1830
+ e((e) => ({ launcherFolders: e.launcherFolders.map((e) => e.id === t ? {
1831
+ ...e,
1832
+ order: n
1833
+ } : e).sort((e, t) => e.order - t.order) }));
1834
+ },
1835
+ addAppToFolder: (t, n) => {
1836
+ e((e) => ({ launcherFolders: e.launcherFolders.map((e) => e.id === n && !e.appIds.includes(t) ? {
1837
+ ...e,
1838
+ appIds: [...e.appIds, t]
1839
+ } : e) }));
1840
+ },
1841
+ removeAppFromFolder: (t, n) => {
1842
+ e((e) => ({ launcherFolders: e.launcherFolders.map((e) => e.id === n ? {
1843
+ ...e,
1844
+ appIds: e.appIds.filter((e) => e !== t)
1845
+ } : e) }));
1846
+ },
1847
+ customApps: [],
1848
+ setCustomApps: (t) => {
1849
+ e({ customApps: t });
1850
+ },
1851
+ handleCustomAppRegistered: (t) => {
1852
+ e((e) => ({ customApps: e.customApps.some((e) => e.id === t.id) ? e.customApps.map((e) => e.id === t.id ? t : e) : [...e.customApps, t] })), n().icons.find((e) => e.appId === t.id) || e((e) => ({ icons: Q(e.icons, {
1853
+ name: t.name,
1854
+ icon: t.icon || "FcDataSheet",
1855
+ appId: t.id
1856
+ }, e.viewportHeight) }));
1857
+ },
1858
+ handleCustomAppUnregistered: (t) => {
1859
+ e((e) => ({ customApps: e.customApps.filter((e) => e.id !== t) })), e((e) => ({ icons: e.icons.filter((e) => e.appId !== t) })), n().windows.filter((e) => e.content === t).forEach((e) => n().closeWindow(e.id)), G.getState().clearApp(t);
1860
+ }
1861
+ }), {
1862
+ name: "fde-desktop",
1863
+ storage: r(() => localStorage),
1864
+ partialize: (e) => ({
1865
+ windows: e.windows,
1866
+ icons: e.icons,
1867
+ customApps: e.customApps,
1868
+ desktopSortMode: e.desktopSortMode,
1869
+ filesSortMode: e.filesSortMode,
1870
+ launcherFolders: e.launcherFolders,
1871
+ viewportWidth: e.viewportWidth,
1872
+ viewportHeight: e.viewportHeight
1873
+ }),
1874
+ merge: (e, t) => {
1875
+ let n = e, r = ["createItem"], i = (n.windows ?? []).filter((e) => !r.includes(e.content)).map((e) => {
1876
+ let r = B.find((t) => t.id === e.content), i = (n.customApps ?? t.customApps)?.find((t) => t.id === e.content);
1877
+ return {
1878
+ ...e,
1879
+ icon: e.icon ?? r?.icon ?? i?.icon,
1880
+ fcIcon: e.fcIcon ?? r?.fcIcon,
1881
+ iconUrl: e.iconUrl ?? r?.iconUrl,
1882
+ iconColor: r?.iconColor,
1883
+ canMaximize: r?.canMaximize ?? i?.window?.canMaximize,
1884
+ minWidth: r?.minWidth === !1 || i?.window?.minWidth === !1 ? void 0 : r?.minWidth ?? i?.window?.minWidth ?? L.minWidth,
1885
+ minHeight: r?.minHeight === !1 || i?.window?.minHeight === !1 ? void 0 : r?.minHeight ?? i?.window?.minHeight ?? L.minHeight
1886
+ };
1887
+ });
1888
+ Y.loadWindows(i);
1889
+ let a = new Set(D.map((e) => e.id)), o = (n.launcherFolders ?? []).filter((e) => !a.has(e.id)), s = [...D, ...o].sort((e, t) => e.order - t.order), c = n.viewportWidth != null && n.viewportHeight != null;
1890
+ return {
1891
+ ...t,
1892
+ ...n,
1893
+ windows: i,
1894
+ launcherFolders: s,
1895
+ viewportWidth: n.viewportWidth ?? t.viewportWidth,
1896
+ viewportHeight: n.viewportHeight ?? t.viewportHeight,
1897
+ isViewportInitialized: c ? !0 : t.isViewportInitialized
1898
+ };
1899
+ }
1900
+ }));
1901
+ typeof window < "u" && (window.__DESKTOP_STATE__ = $.getState(), $.subscribe((e) => {
1902
+ window.__DESKTOP_STATE__ = e;
1903
+ }));
1904
+ //#endregion
1905
+ export { T as $, ke as A, _e as B, B as C, z as D, Me as E, N as F, be as G, M as H, Oe as I, pe as J, Te as K, ve as L, Ee as M, I as N, Ae as O, De as P, de as Q, Ce as R, H as S, je as T, Se as U, xe as V, we as W, me as X, D as Y, fe as Z, Re as _, $e as a, _ as at, Fe as b, qe as c, g as ct, Ge as d, p as dt, x as et, Ue as f, r as ft, Ve as g, Be as h, Qe as i, v as it, L as j, R as k, We as l, h as lt, ze as m, X as n, re as nt, $ as o, ee as ot, He as p, a as pt, ye as q, Ze as r, y as rt, Je as s, te as st, Ye as t, b as tt, Ke as u, m as ut, G as v, V as w, U as x, Pe as y, j as z };