efficient-shell 10.6.0 → 10.13.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 (238) hide show
  1. package/README.md +27 -2
  2. package/dist/{Browser-4ONXYI26.js → Browser-36HIDVL6.js} +13 -13
  3. package/dist/{Calculator-T35PX2QS.js → Calculator-ZFMTTDQ6.js} +23 -23
  4. package/dist/{CurrencyConverter-IQCGNNYA.js → CurrencyConverter-577XB7A3.js} +6 -6
  5. package/dist/{Documents-6H3UDVIU.js → Documents-ZS4M5I3S.js} +3 -3
  6. package/dist/Files-7XO7A4YT.js +88 -0
  7. package/dist/Notepad-6CFMSQCK.js +24 -0
  8. package/dist/PomodoroTimer-CXJVY7U3.js +91 -0
  9. package/dist/{Preview-D6MAGBWE.js → Preview-HV2KB3IU.js} +22 -22
  10. package/dist/Sidebar-7RR5WNIF.js +44 -0
  11. package/dist/{Spreadsheet-RXZR3OSI.js → Spreadsheet-J5AGNSGN.js} +13 -13
  12. package/dist/{Stock-XAZUTWT6.js → Stock-M4TDRNCI.js} +3 -3
  13. package/dist/{Weather-MLRF4QNB.js → Weather-K634BVDX.js} +41 -41
  14. package/dist/{WorldClock-IWRZVM4L.js → WorldClock-56CYOGR2.js} +6 -6
  15. package/dist/ai/index.d.ts +5 -2
  16. package/dist/ai/index.js +40 -39
  17. package/dist/ai.css +1 -1
  18. package/dist/apps/index.js +1 -1
  19. package/dist/bin/media-host-check.js +1 -1
  20. package/dist/bin/ui-check.js +1 -1
  21. package/dist/brand.css +1 -1
  22. package/dist/charts/SpecChart.js +1 -1
  23. package/dist/chunk-2HMNOLKX.js +1 -0
  24. package/dist/{chunk-OTGQYHVC.js → chunk-3BYLHJLC.js} +7 -7
  25. package/dist/chunk-3GL4OVBB.js +1 -0
  26. package/dist/chunk-3RVLLU2A.js +5 -0
  27. package/dist/chunk-44QWF5X2.js +2 -0
  28. package/dist/chunk-45VOQS5V.js +4 -0
  29. package/dist/{chunk-5S3YYN7M.js → chunk-47EYPWCB.js} +2 -2
  30. package/dist/chunk-5RE6R3XC.js +2 -0
  31. package/dist/chunk-5X4DBMS6.js +2 -0
  32. package/dist/{chunk-YCOYCPAH.js → chunk-7PUVPDUZ.js} +3 -3
  33. package/dist/chunk-7QSDPSXP.js +1 -0
  34. package/dist/{chunk-YDEIXM2A.js → chunk-7TC3LJQM.js} +1 -1
  35. package/dist/chunk-A4TFCYWN.js +2 -0
  36. package/dist/chunk-A5SPSAWW.js +2 -0
  37. package/dist/{chunk-ZUS7FXKE.js → chunk-AGG4RFXR.js} +11 -11
  38. package/dist/chunk-APLKFBJH.js +2 -0
  39. package/dist/{chunk-GNHLVGG5.js → chunk-AZ3AR7U7.js} +2 -2
  40. package/dist/chunk-BJXDOM2N.js +2 -0
  41. package/dist/{chunk-UNOQ46YW.js → chunk-BS7IPLRR.js} +1 -1
  42. package/dist/{chunk-3CPB3WP2.js → chunk-CKKUFDZ3.js} +39 -39
  43. package/dist/chunk-COJYPNKF.js +2 -0
  44. package/dist/chunk-EDKRGYZX.js +9 -0
  45. package/dist/{chunk-IOIDZC2M.js → chunk-F2MWLDN2.js} +1 -1
  46. package/dist/{chunk-7X3XNVES.js → chunk-F6JDUMM7.js} +1 -1
  47. package/dist/chunk-FIZKXNCZ.js +2 -0
  48. package/dist/{chunk-QWWJUYZI.js → chunk-GBCH3UHD.js} +16 -16
  49. package/dist/{chunk-X2S2XDZI.js → chunk-GEYM4WN3.js} +1 -1
  50. package/dist/chunk-H64JJSXC.js +4 -0
  51. package/dist/chunk-I5VYOWIX.js +2 -0
  52. package/dist/chunk-IABSP2GJ.js +2 -0
  53. package/dist/chunk-IKMWKOT5.js +1 -0
  54. package/dist/{chunk-IPFWXM2Y.js → chunk-ISJPW2FZ.js} +11 -11
  55. package/dist/chunk-IXZGA4MS.js +2 -0
  56. package/dist/{chunk-DLNIRZNR.js → chunk-JBOMPD3V.js} +1 -1
  57. package/dist/chunk-JGFY54A4.js +3 -0
  58. package/dist/chunk-KLHUKAD3.js +2 -0
  59. package/dist/chunk-KOBYM5JV.js +14 -0
  60. package/dist/chunk-KZMJE24J.js +5 -0
  61. package/dist/{chunk-XKDBYJHF.js → chunk-KZX25YEW.js} +1 -1
  62. package/dist/{chunk-QQPIQCT7.js → chunk-L3QNKCXH.js} +8 -8
  63. package/dist/chunk-LF27WIN2.js +1 -0
  64. package/dist/chunk-LYJBMVUE.js +4 -0
  65. package/dist/{chunk-O45WQK57.js → chunk-M3OYHYIS.js} +1 -1
  66. package/dist/chunk-MIOL4CDN.js +2 -0
  67. package/dist/{chunk-A224Q5ZC.js → chunk-NPK2TLIU.js} +1 -1
  68. package/dist/{chunk-WN5HHHLO.js → chunk-OOLPDASG.js} +1 -1
  69. package/dist/chunk-PGKNWSSC.js +2 -0
  70. package/dist/chunk-PJW3BL27.js +2 -0
  71. package/dist/{chunk-35DG7Y4M.js → chunk-QDQ347RL.js} +1 -1
  72. package/dist/chunk-QHUGCISZ.js +2 -0
  73. package/dist/chunk-QKWYCOMM.js +23 -0
  74. package/dist/{chunk-SF654IHN.js → chunk-QNK2I4IH.js} +12 -12
  75. package/dist/{chunk-GTNJAKFO.js → chunk-R7APUBZB.js} +13 -13
  76. package/dist/chunk-RRVBOD2U.js +2 -0
  77. package/dist/{chunk-6PFZK6ED.js → chunk-SCPCZCYQ.js} +1 -1
  78. package/dist/{chunk-LHYVPDCP.js → chunk-SMUH7NAN.js} +1 -1
  79. package/dist/chunk-STAVWXWV.js +1 -0
  80. package/dist/chunk-SVUOPZCB.js +2 -0
  81. package/dist/chunk-TNPGO42S.js +4 -0
  82. package/dist/chunk-UCWJA6LT.js +2 -0
  83. package/dist/{chunk-RZGYD2PM.js → chunk-UNRPRMQO.js} +41 -41
  84. package/dist/chunk-UWK5Q3R4.js +19 -0
  85. package/dist/{chunk-PXDDCD5X.js → chunk-VZ4PBHFN.js} +1 -1
  86. package/dist/chunk-WH6NPZ6B.js +2 -0
  87. package/dist/{chunk-G5NQOV7L.js → chunk-XBB6LSSB.js} +5 -5
  88. package/dist/chunk-XGAXRNZS.js +2 -0
  89. package/dist/chunk-XMTGZI2O.js +2 -0
  90. package/dist/chunk-Y3JW2GW5.js +1 -0
  91. package/dist/chunk-Z6KYMY3R.js +5 -0
  92. package/dist/chunk-Z7TJ5Y7T.js +2 -0
  93. package/dist/chunk-ZE5FN26Z.js +5 -0
  94. package/dist/chunk-ZTPMMNAZ.js +1 -0
  95. package/dist/format/index.d.ts +1 -0
  96. package/dist/format/index.js +1 -1
  97. package/dist/forms/BorderInput.js +1 -1
  98. package/dist/forms/Calendar.d.ts +1 -5
  99. package/dist/forms/Calendar.js +1 -1
  100. package/dist/forms/ColorPicker.js +1 -1
  101. package/dist/forms/CornersInput.js +1 -1
  102. package/dist/forms/DatePicker.js +1 -1
  103. package/dist/forms/DateRangePicker.d.ts +9 -7
  104. package/dist/forms/DateRangePicker.js +1 -1
  105. package/dist/forms/DateTimePicker.js +1 -1
  106. package/dist/forms/InputNumber.js +1 -1
  107. package/dist/forms/LinkPicker.js +1 -1
  108. package/dist/forms/MediaLibrary.js +1 -1
  109. package/dist/forms/PositionInput.js +1 -1
  110. package/dist/forms/Select.d.ts +1 -1
  111. package/dist/forms/Select.js +1 -1
  112. package/dist/forms/SidesInput.js +1 -1
  113. package/dist/forms/Slider.js +1 -1
  114. package/dist/forms/TextToolbar.d.ts +1 -1
  115. package/dist/forms/TimePicker.js +1 -1
  116. package/dist/forms/WidthsBar.js +1 -1
  117. package/dist/forms/textAlign.d.ts +1 -1
  118. package/dist/icons/efficient-glyphs.d.ts +11 -0
  119. package/dist/icons/efficient-glyphs.js +1 -1
  120. package/dist/icons/efficient-looks.d.ts +16 -0
  121. package/dist/icons/efficient-looks.js +1 -1
  122. package/dist/icons/efficient-meanings.d.ts +11 -0
  123. package/dist/icons/efficient-meanings.js +1 -1
  124. package/dist/icons/efficient.d.ts +11 -0
  125. package/dist/icons/efficient.js +1 -1
  126. package/dist/icons/glyphs/BrandAlipayIcon.d.ts +11 -0
  127. package/dist/icons/glyphs/BrandAlipayIcon.js +1 -0
  128. package/dist/icons/glyphs/BrandDinersclubIcon.d.ts +11 -0
  129. package/dist/icons/glyphs/BrandDinersclubIcon.js +1 -0
  130. package/dist/icons/glyphs/BrandJcbIcon.d.ts +11 -0
  131. package/dist/icons/glyphs/BrandJcbIcon.js +1 -0
  132. package/dist/icons/glyphs/CountUpIcon.d.ts +8 -0
  133. package/dist/icons/glyphs/CountUpIcon.js +1 -0
  134. package/dist/icons/glyphs/DurationIcon.d.ts +8 -0
  135. package/dist/icons/glyphs/DurationIcon.js +1 -0
  136. package/dist/icons/glyphs/HoverLiftIcon.d.ts +8 -0
  137. package/dist/icons/glyphs/HoverLiftIcon.js +1 -0
  138. package/dist/icons/glyphs/HoverNextImageIcon.d.ts +8 -0
  139. package/dist/icons/glyphs/HoverNextImageIcon.js +1 -0
  140. package/dist/icons/glyphs/HoverNoneIcon.d.ts +8 -0
  141. package/dist/icons/glyphs/HoverNoneIcon.js +1 -0
  142. package/dist/icons/glyphs/HoverRotateIcon.d.ts +8 -0
  143. package/dist/icons/glyphs/HoverRotateIcon.js +1 -0
  144. package/dist/icons/glyphs/HoverZoomIcon.d.ts +8 -0
  145. package/dist/icons/glyphs/HoverZoomIcon.js +1 -0
  146. package/dist/icons/glyphs/LoopIcon.d.ts +8 -0
  147. package/dist/icons/glyphs/LoopIcon.js +1 -0
  148. package/dist/icons/index.d.ts +2 -2
  149. package/dist/icons/index.js +1 -1
  150. package/dist/icons/looks/CountUpMiniIcon.d.ts +8 -0
  151. package/dist/icons/looks/CountUpMiniIcon.js +1 -0
  152. package/dist/icons/looks/CountUpSolidIcon.d.ts +8 -0
  153. package/dist/icons/looks/CountUpSolidIcon.js +1 -0
  154. package/dist/icons/looks/DurationMiniIcon.d.ts +8 -0
  155. package/dist/icons/looks/DurationMiniIcon.js +1 -0
  156. package/dist/icons/looks/DurationSolidIcon.d.ts +8 -0
  157. package/dist/icons/looks/DurationSolidIcon.js +1 -0
  158. package/dist/icons/looks/HoverLiftMiniIcon.d.ts +8 -0
  159. package/dist/icons/looks/HoverLiftMiniIcon.js +1 -0
  160. package/dist/icons/looks/HoverLiftSolidIcon.d.ts +8 -0
  161. package/dist/icons/looks/HoverLiftSolidIcon.js +1 -0
  162. package/dist/icons/looks/HoverNextImageMiniIcon.d.ts +8 -0
  163. package/dist/icons/looks/HoverNextImageMiniIcon.js +1 -0
  164. package/dist/icons/looks/HoverNextImageSolidIcon.d.ts +8 -0
  165. package/dist/icons/looks/HoverNextImageSolidIcon.js +1 -0
  166. package/dist/icons/looks/HoverNoneMiniIcon.d.ts +8 -0
  167. package/dist/icons/looks/HoverNoneMiniIcon.js +1 -0
  168. package/dist/icons/looks/HoverNoneSolidIcon.d.ts +8 -0
  169. package/dist/icons/looks/HoverNoneSolidIcon.js +1 -0
  170. package/dist/icons/looks/HoverRotateMiniIcon.d.ts +8 -0
  171. package/dist/icons/looks/HoverRotateMiniIcon.js +1 -0
  172. package/dist/icons/looks/HoverRotateSolidIcon.d.ts +8 -0
  173. package/dist/icons/looks/HoverRotateSolidIcon.js +1 -0
  174. package/dist/icons/looks/HoverZoomMiniIcon.d.ts +8 -0
  175. package/dist/icons/looks/HoverZoomMiniIcon.js +1 -0
  176. package/dist/icons/looks/HoverZoomSolidIcon.d.ts +8 -0
  177. package/dist/icons/looks/HoverZoomSolidIcon.js +1 -0
  178. package/dist/icons/looks/LoopMiniIcon.d.ts +8 -0
  179. package/dist/icons/looks/LoopMiniIcon.js +1 -0
  180. package/dist/icons/looks/LoopSolidIcon.d.ts +8 -0
  181. package/dist/icons/looks/LoopSolidIcon.js +1 -0
  182. package/dist/icons/looks/map.js +1 -1
  183. package/dist/icons/payment.d.ts +46 -0
  184. package/dist/icons/payment.js +4 -0
  185. package/dist/icons/sets.js +1 -1
  186. package/dist/index.d.ts +43 -4
  187. package/dist/index.js +694 -694
  188. package/dist/names-CwzeaUf6.d.ts +23 -0
  189. package/dist/page-tabs/index.js +5 -5
  190. package/dist/shell/ConfirmDialog.js +1 -1
  191. package/dist/shell/Dialog.js +1 -1
  192. package/dist/shell/Drawer.js +1 -1
  193. package/dist/shell/GlobalSearch.js +1 -1
  194. package/dist/shell/ImageLightbox.js +1 -1
  195. package/dist/shell/LanguageSelect.js +1 -1
  196. package/dist/shell/Markdown.d.ts +1 -1
  197. package/dist/shell/MilestoneTimeline.js +1 -1
  198. package/dist/shell/ProductionTimeline.js +1 -1
  199. package/dist/shell/TimeAgo.js +1 -1
  200. package/dist/shell/TimelineTrack.js +1 -1
  201. package/dist/shell/discardGuard.js +1 -1
  202. package/dist/shell/timelineDates.js +1 -1
  203. package/dist/telemetry/index.js +1 -1
  204. package/dist/templates/CheckoutTemplate.js +1 -1
  205. package/dist/templates/DataTablePage.js +1 -1
  206. package/dist/templates/FormLayoutPage.js +1 -1
  207. package/dist/ui/index.d.ts +3 -2
  208. package/dist/ui/index.js +1 -1
  209. package/dist/utils/date.js +1 -1
  210. package/dist/utils/dateKey.d.ts +25 -0
  211. package/dist/utils/dateKey.js +1 -0
  212. package/dist/utils/format.js +1 -1
  213. package/dist/version.js +1 -1
  214. package/package.json +6 -1
  215. package/dist/Files-3OOVEIKW.js +0 -88
  216. package/dist/Notepad-IPTDLXZZ.js +0 -24
  217. package/dist/PomodoroTimer-YF5AN5RX.js +0 -91
  218. package/dist/Sidebar-QCUDD4OU.js +0 -44
  219. package/dist/chunk-4BYJQU37.js +0 -2
  220. package/dist/chunk-5OTS2G3M.js +0 -1
  221. package/dist/chunk-632N62BY.js +0 -9
  222. package/dist/chunk-7Z4PTLDL.js +0 -4
  223. package/dist/chunk-AM2F5ZXH.js +0 -2
  224. package/dist/chunk-E5MVH3SH.js +0 -14
  225. package/dist/chunk-LNWQBSYD.js +0 -5
  226. package/dist/chunk-LPSFFJFK.js +0 -1
  227. package/dist/chunk-MNXRAZJV.js +0 -23
  228. package/dist/chunk-N4DI5F74.js +0 -19
  229. package/dist/chunk-O2GPQ2MX.js +0 -1
  230. package/dist/chunk-PKXQDCNR.js +0 -1
  231. package/dist/chunk-QEKOEIOQ.js +0 -3
  232. package/dist/chunk-TFUIOEBX.js +0 -1
  233. package/dist/chunk-XO7URRTM.js +0 -2
  234. package/dist/chunk-YJFB6CCJ.js +0 -1
  235. package/dist/names-CyfXNkce.d.ts +0 -23
  236. /package/dist/{chunk-DSIDJYH7.js → chunk-744BFBBV.js} +0 -0
  237. /package/dist/{chunk-EHPZIBOL.js → chunk-NOKZ54GD.js} +0 -0
  238. /package/dist/{chunk-OW7MLJ3Y.js → chunk-S2P74CBN.js} +0 -0
package/README.md CHANGED
@@ -4339,6 +4339,12 @@ import { AssistantChat } from 'efficient-shell/ai';
4339
4339
  chat with no `people` behaves as before: every draft is a question.
4340
4340
  `labels.assistantName` ("JARVIS") makes the bare name a mention too (an
4341
4341
  address such as `jarvis@example.com` names nobody).
4342
+ There the assistant is one of the speakers: its answers are drawn like a
4343
+ colleague's message, on the left under `labels.assistantName` (or the
4344
+ chat's title), with "Asked by …" beside the name. A message to the people
4345
+ shows in the thread the moment it is sent, and the server's row takes its
4346
+ place when it answers; one that does not send is taken back and
4347
+ `labels.sayFailed` says so.
4342
4348
  * **`assistantDecides`.** There, a draft that names nobody is not sent to the
4343
4349
  people outright: the chat first posts it to
4344
4350
  `<apiBase>/assistant/chat/<id>/addressee/` and reads `{to_assistant}`. True
@@ -4347,7 +4353,9 @@ import { AssistantChat } from 'efficient-shell/ai';
4347
4353
  The line reads `labels.assistantDecides`, and **People only**
4348
4354
  (`labels.peopleOnly`) sends to the people without asking the server until
4349
4355
  **Let the assistant decide** (`labels.letAssistantDecide`) turns it back. A
4350
- draft that names the assistant, or carries files, still always asks.
4356
+ draft that names the assistant, or carries files, still always asks. The
4357
+ draft shows in the thread at once, before the server has decided, and the
4358
+ question or the message to the people takes its place.
4351
4359
  * A host that is not a portal and does not compile this package with Tailwind
4352
4360
  imports `efficient-shell/ai.css`: only the utilities the chat is
4353
4361
  drawn with, scoped under `.rosh-assistant` (the `bubble` variant wraps itself in
@@ -4599,7 +4607,7 @@ meaning does.
4599
4607
 
4600
4608
  The default paths are copied from [Simple Icons](https://simpleicons.org):
4601
4609
  16.35.0 for the first eleven (`brand-aws` from 13.21.0, the last release that
4602
- had it), 16.34.0 for web-builder's marks (the release its lockfile draws), CC0
4610
+ had it), 16.34.0 for web-builder's marks (the release its lockfile draws) and for Alipay, JCB and Diners Club, CC0
4603
4611
  1.0. Simple Icons has no LinkedIn, so `brand-linkedin`'s default is Tabler's
4604
4612
  filled mark, cropped and sized the same way. The looks are
4605
4613
  [Tabler](https://tabler.io/icons) 3.49.0's drawings (MIT), as
@@ -4614,8 +4622,25 @@ version, is `src/icons/brands.json`; to add a mark, add its entry there and run
4614
4622
  |---|---|---|---|
4615
4623
  | `efficient-shell/icons/efficient` | each default drawing as its own export (`TrashIcon`) | a page or part that draws a few icons | nothing |
4616
4624
  | `efficient-shell/icons/efficient-looks` | each other look as its own export (`PlaySolidIcon`) | the same, in another look | nothing |
4625
+ | `efficient-shell/icons/payment` | `paymentMarks`, `PaymentMark`: a way to pay as its mark (below) | showing how a business takes money | nothing |
4617
4626
  | `efficient-shell/icons/sets` | the maps by name: `efficient`, `efficientLooks`, `efficientLookNames` | `registerIconSet`, and editors that list every icon | nothing |
4618
4627
 
4628
+ **A way to pay, as its mark (`efficient-shell/icons/payment`).** A payment
4629
+ method is the business's own name over a kind (the backend's
4630
+ `pos.PaymentMethod`: "EFTPOS" over `card`). `paymentMarks(methods)` gives what
4631
+ a customer recognises, each once, in the order given: card and app brands as
4632
+ their marks ("Visa / Mastercard" is two; "EFTPOS" is Visa and Mastercard), else
4633
+ Alipay and WeChat Pay by their kind, else cash, a transfer or a card as a glyph
4634
+ and the method's own name, else the name alone. `<PaymentMark item size>`
4635
+ draws one in the text's colour; the caller draws the frame around it.
4636
+
4637
+ ```tsx
4638
+ import { PaymentMark, paymentMarks } from 'efficient-shell/icons/payment';
4639
+
4640
+ paymentMarks([{ name: 'Cash', kind: 'cash' }, { name: 'Visa / Mastercard', kind: 'card' }])
4641
+ .map((item) => <PaymentMark key={item.label} item={item} size={18} />);
4642
+ ```
4643
+
4619
4644
  **One drawing per module, and the maps in their own entry (8.0.0).** Each
4620
4645
  drawing is its own module, and `icons/efficient` and `icons/efficient-looks`
4621
4646
  only re-export them, so a page bundles the drawings it imports and no other,
@@ -1,29 +1,29 @@
1
- import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-A224Q5ZC.js";import{WindowTitle as r}from"./chunk-RZGYD2PM.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-YJFB6CCJ.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),[U,L]=l(0),[E,H]=l(x),[M,S]=l(!1),[T,J]=l(null),Q=a(null),P=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(E))}catch{}},[E]);const G=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),S(!1))},X=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},I=()=>{const e=T?.trim();e?(H(t=>[...t,{label:e,url:f}]),J(null)):J(null)};i(()=>{if(null===T)return;Q.current?.focus(),Q.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||J(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==T]);const K=e=>{H(t=>t.filter((t,o)=>o!==e))},Y=z>0,Z=z<W.length-1,A=E.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-NPK2TLIU.js";import{WindowTitle as r}from"./chunk-UNRPRMQO.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-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-STAVWXWV.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,U]=l(0),[S,D]=l(0),[E,H]=l(x),[T,L]=l(!1),[M,P]=l(null),J=a(null),X=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(E))}catch{}},[E]);const G=e=>{const t=g(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,z+1);return o.push(t),o}),U(e=>e+1),L(!1))},K=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},Q=()=>{const e=M?.trim();e?(H(t=>[...t,{label:e,url:f}]),P(null)):P(null)};i(()=>{if(null===M)return;J.current?.focus(),J.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||P(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==M]);const I=e=>{H(t=>t.filter((t,o)=>o!==e))},V=z>0,A=z<W.length-1,B=E.some(e=>e.url===f),O="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(z>0){const e=z-1;D(e),y(W[e]),C(W[e]),S(!1)}},disabled:!Y,className:B,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]),S(!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:()=>L(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:()=>G(b),className:B,title:"Home",children:/* @__PURE__ */m(s,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
6
+ /* @__PURE__ */m("button",{onClick:()=>{if(z>0){const e=z-1;U(e),y(W[e]),C(W[e]),L(!1)}},disabled:!V,className:O,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;U(e),y(W[e]),C(W[e]),L(!1)}},disabled:!A,className:O,title:"Forward",children:/* @__PURE__ */m(s,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */m("button",{onClick:()=>D(e=>e+1),className:O,title:"Refresh",children:/* @__PURE__ */m(s,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */m("button",{onClick:()=>G(b),className:O,title:"Home",children:/* @__PURE__ */m(s,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
10
  /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),G(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:()=>A?K(E.findIndex(e=>e.url===f)):void J(v(f)),className:B+" "+(A?"text-yellow-500":""),title:A?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(s,{name:"star",className:"h-4 w-4",fill:A?"currentColor":"none",strokeWidth:1.5})}),
14
- /* @__PURE__ */m("button",{onClick:X,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:()=>S(e=>!e),className:B,title:"Embedding help",children:/* @__PURE__ */m(s,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==T&&/* @__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?I(E.findIndex(e=>e.url===f)):void P(v(f)),className:O+" "+(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:K,className:O,title:"Open in new tab",children:/* @__PURE__ */m(s,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
+ /* @__PURE__ */m("button",{onClick:()=>L(e=>!e),className:O,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:Q,type:"text",value:T,onChange:e=>J(e.target.value),onKeyDown:e=>{"Enter"===e.key?I():"Escape"===e.key&&J(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=>P(e.target.value),onKeyDown:e=>{"Enter"===e.key?Q():"Escape"===e.key&&P(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:()=>J(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:!T.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===E.length&&/* @__PURE__ */m("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),E.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>G(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:[
20
+ /* @__PURE__ */m("button",{onClick:()=>P(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
+ /* @__PURE__ */m("button",{onClick:Q,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===E.length&&/* @__PURE__ */m("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),E.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>G(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"})&&I(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:U,iframeRef:P,openExternal:X,showHelp:M,dismissHelp:()=>S(!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:S,iframeRef:X,openExternal:K,showHelp:T,dismissHelp:()=>L(!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 ",
@@ -1,29 +1,29 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-UNOQ46YW.js";import{useWidgetSettings as n}from"./chunk-RZGYD2PM.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,v]=c([]),[C,$]=c(!1),[W,E]=c(()=>e(h)),[T,U]=c(!1),[D,R]=c(W),M=i(null);n(l(()=>{R({...W}),U(!0)},[W]));const Q=l(e=>{x(""),k(t=>N||"0"===t?(j(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),w=l(()=>{k("0"),d(null),g(null),j(!1)},[]),J=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=J(p,t,b);k(String(e)),d(e),v(n=>[`${p} ${b} ${t} = ${e}`,...n].slice(0,20))}else d(t);g(e),j(!0)},[m,p,b,N,J]),S=l(()=>{if(null===p||!b)return;const e=parseFloat(m),t=J(p,e,b),n=`${p} ${b} ${e} =`;v(e=>[`${n} ${t}`,...e].slice(0,20)),x(n),k(String(t)),d(null),g(null),j(!0)},[m,p,b,J]),A=l(()=>{k(e=>String(parseFloat(e)/100))},[]),G=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"?Q(e.key):"."===e.key?Q("."):"+"===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&&M.current?.contains(e.target)&&e.preventDefault(),S()):"Escape"===e.key?w():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&A())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Q,X,S,w,A]);const H="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",L=`${H} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,P=`${H} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,Y=`${H} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,Z=`${H} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-BS7IPLRR.js";import{useWidgetSettings as n}from"./chunk-UNRPRMQO.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-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.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),[E,R]=c(()=>e(h)),[T,W]=c(!1),[U,D]=c(E),M=i(null);n(l(()=>{D({...E}),W(!0)},[E]));const S=l(e=>{x(""),k(t=>N||"0"===t?(j(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),w=l(()=>{k("0"),d(null),g(null),j(!1)},[]),J=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}},[]),P=l(e=>{const t=parseFloat(m);if(null!==p&&b&&!N){const e=J(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,J]),H=l(()=>{if(null===p||!b)return;const e=parseFloat(m),t=J(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,J]),Q=l(()=>{k(e=>String(parseFloat(e)/100))},[]),X=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"?S(e.key):"."===e.key?S("."):"+"===e.key?P("+"):"-"===e.key?P("-"):"*"===e.key?P("×"):"/"===e.key?(e.preventDefault(),P("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&M.current?.contains(e.target)&&e.preventDefault(),H()):"Escape"===e.key?w():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&Q())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[S,P,H,w,Q]);const B="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",A=`${B} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,G=`${B} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,F=`${B} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,K=`${B} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
2
  return s(a,{children:[
3
- /* @__PURE__ */s("div",{ref:M,className:"flex flex-col h-full",style:{opacity:W.activeOpacity/100,backdropFilter:W.activeBlur>0?`blur(${W.activeBlur}px)`:void 0},children:[
3
+ /* @__PURE__ */s("div",{ref:M,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
4
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
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
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,C?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
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
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
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:w,className:Y,children:"AC"}),
11
- /* @__PURE__ */u("button",{onClick:G,className:Y,children:"+/−"}),
12
- /* @__PURE__ */u("button",{onClick:A,className:Y,children:"%"}),
13
- /* @__PURE__ */u("button",{onClick:()=>X("÷"),className:`${P} ${"÷"===b?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
- /* @__PURE__ */u("button",{onClick:()=>Q("7"),className:L,children:"7"}),
15
- /* @__PURE__ */u("button",{onClick:()=>Q("8"),className:L,children:"8"}),
16
- /* @__PURE__ */u("button",{onClick:()=>Q("9"),className:L,children:"9"}),
17
- /* @__PURE__ */u("button",{onClick:()=>X("×"),className:`${P} ${"×"===b?"ring-2 ring-blue-400":""}`,children:"×"}),
18
- /* @__PURE__ */u("button",{onClick:()=>Q("4"),className:L,children:"4"}),
19
- /* @__PURE__ */u("button",{onClick:()=>Q("5"),className:L,children:"5"}),
20
- /* @__PURE__ */u("button",{onClick:()=>Q("6"),className:L,children:"6"}),
21
- /* @__PURE__ */u("button",{onClick:()=>X("-"),className:`${P} ${"-"===b?"ring-2 ring-blue-400":""}`,children:"−"}),
22
- /* @__PURE__ */u("button",{onClick:()=>Q("1"),className:L,children:"1"}),
23
- /* @__PURE__ */u("button",{onClick:()=>Q("2"),className:L,children:"2"}),
24
- /* @__PURE__ */u("button",{onClick:()=>Q("3"),className:L,children:"3"}),
25
- /* @__PURE__ */u("button",{onClick:()=>X("+"),className:`${P} ${"+"===b?"ring-2 ring-blue-400":""}`,children:"+"}),
26
- /* @__PURE__ */u("button",{onClick:()=>Q("0"),className:`${L} col-span-2`,children:"0"}),
27
- /* @__PURE__ */u("button",{onClick:()=>Q("."),className:L,children:"."}),
28
- /* @__PURE__ */u("button",{onClick:S,className:Z,children:"="})]})]}),
29
- /* @__PURE__ */u(t,{open:T,onClose:()=>U(!1),title:"Calculator Settings",appearance:D,onAppearanceChange:R,onSave:()=>{E(D),localStorage.setItem(h,JSON.stringify(D)),U(!1)}})]})}export{m as default};
10
+ /* @__PURE__ */u("button",{onClick:w,className:F,children:"AC"}),
11
+ /* @__PURE__ */u("button",{onClick:X,className:F,children:"+/−"}),
12
+ /* @__PURE__ */u("button",{onClick:Q,className:F,children:"%"}),
13
+ /* @__PURE__ */u("button",{onClick:()=>P("÷"),className:`${G} ${"÷"===b?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */u("button",{onClick:()=>S("7"),className:A,children:"7"}),
15
+ /* @__PURE__ */u("button",{onClick:()=>S("8"),className:A,children:"8"}),
16
+ /* @__PURE__ */u("button",{onClick:()=>S("9"),className:A,children:"9"}),
17
+ /* @__PURE__ */u("button",{onClick:()=>P("×"),className:`${G} ${"×"===b?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */u("button",{onClick:()=>S("4"),className:A,children:"4"}),
19
+ /* @__PURE__ */u("button",{onClick:()=>S("5"),className:A,children:"5"}),
20
+ /* @__PURE__ */u("button",{onClick:()=>S("6"),className:A,children:"6"}),
21
+ /* @__PURE__ */u("button",{onClick:()=>P("-"),className:`${G} ${"-"===b?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */u("button",{onClick:()=>S("1"),className:A,children:"1"}),
23
+ /* @__PURE__ */u("button",{onClick:()=>S("2"),className:A,children:"2"}),
24
+ /* @__PURE__ */u("button",{onClick:()=>S("3"),className:A,children:"3"}),
25
+ /* @__PURE__ */u("button",{onClick:()=>P("+"),className:`${G} ${"+"===b?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */u("button",{onClick:()=>S("0"),className:`${A} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */u("button",{onClick:()=>S("."),className:A,children:"."}),
28
+ /* @__PURE__ */u("button",{onClick:H,className:K,children:"="})]})]}),
29
+ /* @__PURE__ */u(t,{open:T,onClose:()=>W(!1),title:"Calculator Settings",appearance:U,onAppearanceChange:D,onSave:()=>{R(U),localStorage.setItem(h,JSON.stringify(U)),W(!1)}})]})}export{m as default};
@@ -1,4 +1,4 @@
1
- import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-UNOQ46YW.js";import{useWidgetSettings as r}from"./chunk-RZGYD2PM.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,U]=s(!1),[C,J]=s([]),[R,W]=s(f),[M,Y]=s("USD"),[B,H]=s("CNY");r(o(()=>{J([...u]),W({...f}),U(!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__ */
1
+ import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-BS7IPLRR.js";import{useWidgetSettings as r}from"./chunk-UNRPRMQO.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-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.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,U]=s(!1),[C,R]=s([]),[J,P]=s(f),[B,H]=s("USD"),[M,A]=s("CNY");r(o(()=>{R([...u]),P({...f}),U(!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
2
  return a(i,{children:[
3
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
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:[
@@ -9,13 +9,13 @@ return a("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(t),l
9
9
  /* @__PURE__ */l("span",{className:"text-base",children:j[e]||""}),
10
10
  /* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
11
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:()=>U(!1),title:"Currency Settings",appearance:R,onAppearanceChange:W,onSave:()=>{if(0===C.length)return;const t=C.slice(0,4);d(t),x(R),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(R)),U(!1)},children:/* @__PURE__ */a("div",{children:[
12
+ /* @__PURE__ */l(e,{open:v,onClose:()=>U(!1),title:"Currency Settings",appearance:J,onAppearanceChange:P,onSave:()=>{if(0===C.length)return;const t=C.slice(0,4);d(t),x(J),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(J)),U(!1)},children:/* @__PURE__ */a("div",{children:[
13
13
  /* @__PURE__ */a("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Currency Pairs ",
14
14
  /* @__PURE__ */a("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",C.length,"/",4,")"]})]}),
15
15
  /* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:C.map(([t,e],r)=>/* @__PURE__ */a("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
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))}),C.length<4?/* @__PURE__ */a("div",{className:"flex items-center gap-2",children:[
18
- /* @__PURE__ */l("select",{value:M,onChange:t=>Y(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:"→"}),
17
+ /* @__PURE__ */l("button",{onClick:()=>R(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),C.length<4?/* @__PURE__ */a("div",{className:"flex items-center gap-2",children:[
20
18
  /* @__PURE__ */l("select",{value:B,onChange:t=>H(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:()=>{M!==B&&C.length<4&&J(t=>[...t,[M,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};
19
+ /* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
20
+ /* @__PURE__ */l("select",{value:M,onChange:t=>A(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:()=>{B!==M&&C.length<4&&R(t=>[...t,[B,M]])},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};
@@ -1,4 +1,4 @@
1
- import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-A224Q5ZC.js";import{WindowTitle as n}from"./chunk-RZGYD2PM.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-YJFB6CCJ.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),[C,D]=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=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",N(!0),D(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(
1
+ import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-NPK2TLIU.js";import{WindowTitle as n}from"./chunk-UNRPRMQO.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-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import{toast_default as r}from"./chunk-AKM6JBMD.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-STAVWXWV.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
2
  /* @vite-ignore */
3
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
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:[
@@ -41,7 +41,7 @@ return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
41
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
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
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(),D({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"})}),C&&/* @__PURE__ */u(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>D(null),children:[
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
45
  /* @__PURE__ */d(i,{children:"Image width"}),
46
46
  /* @__PURE__ */d(l,{onClick:()=>T("25%"),children:"25%"}),
47
47
  /* @__PURE__ */d(l,{onClick:()=>T("50%"),children:"50%"}),
@@ -49,4 +49,4 @@ return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
49
49
  /* @__PURE__ */d(l,{onClick:()=>T("100%"),children:"100%"}),
50
50
  /* @__PURE__ */d(l,{onClick:()=>T(null),children:"Original size"}),
51
51
  /* @__PURE__ */d(a,{}),
52
- /* @__PURE__ */d(l,{danger:!0,onClick:()=>{C?.el.remove(),N(!0),D(null)},children:"Remove image"})]})]})}export{f as default};
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-GEYM4WN3.js";import"./chunk-Y3JW2GW5.js";import"./chunk-36BRD5J3.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as r}from"./chunk-MUMQ6PW7.js";import{AboutApp as i}from"./chunk-NPK2TLIU.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-UNRPRMQO.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-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-KC3EX26K.js";import{ItemCount as b}from"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import{toast_default as y}from"./chunk-AKM6JBMD.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-STAVWXWV.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 T}from"react";import{jsxs as E,jsx as R,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,F]=j("/"),[O,V]=j([]),[J,H]=j([]),[K,B]=j(null),[Q,X]=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=T((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ue=T(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=T(async e=>{if(B(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 V(t),F(e),z(!1),X(!1),void("/"===e&&H(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}X(!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||[];V(n),F(a.path||e),z(!1),"/"===(a.path||e)&&H(n.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){z(!0)}finally{X(!1)}ue()},[pe,S,ue,A]),xe=T(async()=>{if(A)return ne([]),void X(!1);X(!0),B(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{X(!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__ */R(x,{title:"Files - offline"}),
4
+ /* @__PURE__ */R("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */E("div",{className:"max-w-md",children:[
5
+ /* @__PURE__ */R(N,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
+ /* @__PURE__ */R("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__ */R("span",{className:"font-mono",children:S}),". Make sure the server is running — see ",
9
+ /* @__PURE__ */R("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
+ /* @__PURE__ */R("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:()=>F("/")},...ye.map((e,t)=>({label:e,onClick:()=>F("/"+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__ */R("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__ */R("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),De=/* @__PURE__ */E("nav",{className:"p-2",children:[
11
+ /* @__PURE__ */R("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"),F("/")},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"]}),J.map(e=>/* @__PURE__ */E("button",{onClick:()=>{te("files"),F("/"+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__ */R("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__ */R("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__ */R(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
+ /* @__PURE__ */R("span",{className:"truncate",children:e.name}),
17
+ /* @__PURE__ */R(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__ */R(x,{title:se?`Files - ${se.name}`:"Files"+("/"===I?"":" - "+I)}),
20
+ /* @__PURE__ */R(i,{app:"files"}),
21
+ /* @__PURE__ */R("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__ */R("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */R(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__ */R("button",{onClick:()=>F(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__ */R(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
25
+ /* @__PURE__ */R("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */R(a,{items:ve,maxItems:5})}),
26
+ /* @__PURE__ */R("button",{onClick:()=>fe(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */R(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__ */R(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__ */R(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__ */R(N,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===ee?{children:[
33
+ /* @__PURE__ */R("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */R(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
34
+ /* @__PURE__ */R("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
35
+ /* @__PURE__ */R("button",{onClick:xe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */R(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
36
+ /* @__PURE__ */R("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__ */R("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */R(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
38
+ /* @__PURE__ */R(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
39
+ /* @__PURE__ */R("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
40
+ /* @__PURE__ */R("span",{className:"text-2xs text-ink-faintest px-2",children:"Desktop shortcuts"})]}),Z&&/* @__PURE__ */E(L,{children:[
41
+ /* @__PURE__ */R("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__ */R("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */R("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__ */R("div",{className:"flex-1 overflow-auto",children:"object"==typeof ee?0===oe.length?/* @__PURE__ */R("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__ */R("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
47
+ /* @__PURE__ */R("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
48
+ /* @__PURE__ */R("th",{className:`${v} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
49
+ /* @__PURE__ */R("th",{className:`${v} w-56`})]})}),
50
+ /* @__PURE__ */R("tbody",{children:oe.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
51
+ return E("tr",{onClick:()=>B(t),onDoubleClick:()=>he(e),className:"cursor-default border-b border-gray-100 "+(K===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__ */R(p,{item:e}),
54
+ /* @__PURE__ */R("span",{className:"truncate",title:e.label,children:e.label})]}),
55
+ /* @__PURE__ */R("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__ */R("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__ */R("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__ */R("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?Q&&0===ae.length?/* @__PURE__ */R(w,{size:"sm",padding:"p-6",label:"Loading"}):0===ae.length?/* @__PURE__ */R("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__ */R("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
61
+ /* @__PURE__ */R("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
62
+ /* @__PURE__ */R("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Original location"}),
63
+ /* @__PURE__ */R("th",{className:`${v} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
64
+ /* @__PURE__ */R("th",{className:`${v} text-right font-medium px-3 h-8 w-40`,children:"Deleted"}),
65
+ /* @__PURE__ */R("th",{className:`${v} w-44`})]})}),
66
+ /* @__PURE__ */R("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__ */R(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */R(N,{name:"page",className:"h-4 w-4 text-ink-faintest shrink-0",strokeWidth:1.5}),
68
+ /* @__PURE__ */R("span",{className:"truncate",title:e.name,children:e.name})]}),
69
+ /* @__PURE__ */R("td",{className:"px-3 h-8 text-ink-faint text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
70
+ /* @__PURE__ */R("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:n(e.size)}),
71
+ /* @__PURE__ */R("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__ */R("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__ */R("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))})]}):Q&&0===O.length?/* @__PURE__ */R(w,{size:"sm",padding:"p-6",label:"Loading"}):0===O.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__ */R("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */E("table",{className:"w-full text-sm",children:[
76
+ /* @__PURE__ */R("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
77
+ /* @__PURE__ */R("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
78
+ /* @__PURE__ */R("th",{className:`${v} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
79
+ /* @__PURE__ */R("th",{className:`${v} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
80
+ /* @__PURE__ */R("th",{className:`${v} w-32`})]})}),
81
+ /* @__PURE__ */R("tbody",{children:O.map(t=>/* @__PURE__ */E("tr",{onClick:()=>B(t.name),onDoubleClick:()=>{"folder"===t.kind?F(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 "+(K===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__ */R(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */R(N,{name:"page",className:"h-4 w-4 text-ink-faintest shrink-0",strokeWidth:1.5}),
83
+ /* @__PURE__ */R("span",{className:"truncate",title:t.name,children:t.name})]}),
84
+ /* @__PURE__ */R("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:"folder"===t.kind?"—":n(t.size)}),
85
+ /* @__PURE__ */R("td",{className:"px-3 h-8 text-right text-ink-faint tabular-nums",children:U(t.modifiedAt)}),
86
+ /* @__PURE__ */R("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!A&&/* @__PURE__ */E(L,{children:["file"===t.kind&&/* @__PURE__ */R("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__ */R("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__ */R("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__ */R("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__ */R("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-SMUH7NAN.js";import{SidebarLayout as t}from"./chunk-A4HJDSRA.js";import"./chunk-QWK6DRSN.js";import"./chunk-DRDYZ633.js";import{timeAgo as r}from"./chunk-GEYM4WN3.js";import"./chunk-Y3JW2GW5.js";import"./chunk-36BRD5J3.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-NPK2TLIU.js";import{useWindowManager as o,client_default as i}from"./chunk-UNRPRMQO.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-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import{toast_default as s}from"./chunk-AKM6JBMD.js";import"./chunk-UGTRSRIW.js";import"./chunk-PXQG5EIH.js";import"./chunk-CDAJKLGL.js";import"./chunk-STAVWXWV.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:N,save:j}=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=N.notepad_notes||[],[_,W]=d(null),[D,C]=d(""),[S,U]=d(""),[X,M]=d("yellow"),[R,$]=d(!1),[J,H]=d(!1),K=a(null),P=a();p(()=>{if(!_&&T.length>0){const e=T[0];W(e.id),C(e.title),U(e.content),M(e.color)}},[T.length]);const E=m(e=>{j({notepad_notes:e})},[j]),Q=m(()=>{if(!_||!R)return;const e=T.map(e=>e.id===_?{...e,title:D,content:S,color:X,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);E(e),$(!1)},[_,R,D,S,X,T,E]);p(()=>{if(R)return P.current&&clearTimeout(P.current),P.current=setTimeout(Q,800),()=>{P.current&&clearTimeout(P.current)}},[R,Q]),p(()=>()=>{R&&Q()},[]);const A=e=>{R&&Q(),W(e.id),C(e.title),U(e.content),M(e.color),$(!1),H(!1)},G=e=>{const t=S.slice(0,e),r=S.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=S.slice(e+r[0].length);U(t+n+o),$(!0)},I=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}`)}},V="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.)",Z=/* @__PURE__ */h(g,{children:[
2
+ /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{R&&Q();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];E(t),W(e.id),C(""),U(""),M("yellow"),$(!1),H(!0),setTimeout(()=>K.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:()=>A(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:Z,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),$(!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:()=>{M(e.key),$(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${X===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(E(t),_===e){const e=t[0];e?A(e):(W(null),C(""),U(""))}})(_),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:K,value:S,onChange:e=>{U(e.target.value),$(!0)},onBlur:()=>{H(!1),R&&Q()},placeholder:V,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:()=>{H(!0),setTimeout(()=>K.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:S?(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:()=>I(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:()=>G(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)})})(S):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:V})}),
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};