efficient-shell 8.35.1 → 8.39.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 (193) hide show
  1. package/README.md +13 -2
  2. package/dist/{Browser-F67PEY2U.js → Browser-BIGK2F75.js} +14 -14
  3. package/dist/Calculator-7O7HXEKH.js +29 -0
  4. package/dist/{CurrencyConverter-Z6L7QAZU.js → CurrencyConverter-IVJJCYZ7.js} +12 -12
  5. package/dist/{Documents-MQDSI27F.js → Documents-UHTD6M24.js} +22 -22
  6. package/dist/Files-PWYUTAQW.js +87 -0
  7. package/dist/{Notepad-2IRVJ7MB.js → Notepad-54N54RYN.js} +11 -11
  8. package/dist/PdfViewer-KJCJ6EPG.js +1 -0
  9. package/dist/{PomodoroTimer-TRGMI4YT.js → PomodoroTimer-ZCJBTFV5.js} +19 -19
  10. package/dist/{Preview-PXOEKXSR.js → Preview-3LOY6L4G.js} +33 -33
  11. package/dist/Sidebar-6I4FC5AK.js +43 -0
  12. package/dist/{Spreadsheet-WROI4P6D.js → Spreadsheet-ANBJSAHB.js} +12 -12
  13. package/dist/{Stock-SUDCDSUL.js → Stock-PHY6Z26A.js} +1 -1
  14. package/dist/{Weather-WQE4ZQAL.js → Weather-YQA5CAFQ.js} +19 -19
  15. package/dist/{WorldClock-2AGEYLZP.js → WorldClock-J6L7FWI2.js} +6 -6
  16. package/dist/ai/index.d.ts +118 -3
  17. package/dist/ai/index.js +53 -43
  18. package/dist/ai.css +1 -1
  19. package/dist/apps/index.js +1 -1
  20. package/dist/bin/media-host-check.js +1 -1
  21. package/dist/bin/ui-check.js +1 -1
  22. package/dist/{chunk-ZRHQGFO5.js → chunk-3CST4ZDP.js} +2 -2
  23. package/dist/chunk-454DAGYG.js +19 -0
  24. package/dist/{chunk-TRD22FC7.js → chunk-45S6M77O.js} +6 -6
  25. package/dist/chunk-4IVT244O.js +8 -0
  26. package/dist/{chunk-G2MJTE6X.js → chunk-4OFD6ICH.js} +10 -10
  27. package/dist/{chunk-5N5DBTTF.js → chunk-4SZDP3JF.js} +12 -12
  28. package/dist/{chunk-FMKTVZAO.js → chunk-4Y4PWKMM.js} +1 -1
  29. package/dist/{chunk-DIN3EFOM.js → chunk-5BZMSSOV.js} +8 -8
  30. package/dist/chunk-5JYBYMZT.js +29 -0
  31. package/dist/{chunk-64ZHCEZN.js → chunk-5TFTSYOD.js} +1 -1
  32. package/dist/{chunk-GK3QH63P.js → chunk-63EK6S3W.js} +1 -1
  33. package/dist/{chunk-ECCUEG3J.js → chunk-6BCFVOG7.js} +1 -1
  34. package/dist/{chunk-M2KV4WKR.js → chunk-6GWZ5UPX.js} +1 -1
  35. package/dist/{chunk-EBC4XFL2.js → chunk-6SMQNPWS.js} +1 -1
  36. package/dist/{chunk-EW6FRPFJ.js → chunk-6WWAQC5V.js} +1 -1
  37. package/dist/{chunk-TTY62G5D.js → chunk-7C56GLLI.js} +16 -16
  38. package/dist/{chunk-MICWRC72.js → chunk-7MSFHQAY.js} +7 -7
  39. package/dist/{chunk-XZL3HCWH.js → chunk-7OCNF4AI.js} +1 -1
  40. package/dist/chunk-AAW27HJY.js +3 -0
  41. package/dist/{chunk-WME5DFB6.js → chunk-BIJ7ADTZ.js} +1 -1
  42. package/dist/{chunk-SEXLHFMR.js → chunk-BMPBVI7P.js} +1 -1
  43. package/dist/{chunk-TOVHLONK.js → chunk-BT3XDH3L.js} +4 -4
  44. package/dist/{chunk-JVIOAZHW.js → chunk-BUGAWNOC.js} +4 -4
  45. package/dist/{chunk-R4C3GGCS.js → chunk-BVW5U7QQ.js} +3 -3
  46. package/dist/{chunk-AF7R2MV4.js → chunk-CKZ6ZDU5.js} +1 -1
  47. package/dist/{chunk-IHEEJO5S.js → chunk-CPK7JTN3.js} +1 -1
  48. package/dist/{chunk-EVB35JP5.js → chunk-DOCUM3K7.js} +1 -1
  49. package/dist/{chunk-FKZEGBLK.js → chunk-DXTKNHWG.js} +11 -11
  50. package/dist/chunk-EEHK4IIK.js +14 -0
  51. package/dist/chunk-EGDJEY4K.js +27 -0
  52. package/dist/{chunk-G2V2ADJQ.js → chunk-EIWTOEWV.js} +2 -2
  53. package/dist/{chunk-2U2GJCSP.js → chunk-EL2RLUT6.js} +7 -7
  54. package/dist/{chunk-4GVH4ZUH.js → chunk-ET2EF5CI.js} +1 -1
  55. package/dist/{chunk-MC43PRTL.js → chunk-EXWGPXOS.js} +1 -1
  56. package/dist/{chunk-2SHYR3RA.js → chunk-FSPFV4MI.js} +9 -4
  57. package/dist/{chunk-YBB56N6X.js → chunk-G63BCOQ6.js} +1 -1
  58. package/dist/{chunk-3RPIPYLU.js → chunk-GCGKPDPN.js} +1 -1
  59. package/dist/chunk-GNPTNAZH.js +4 -0
  60. package/dist/{chunk-DG2WU3BU.js → chunk-GSBIJLTD.js} +2 -2
  61. package/dist/{chunk-ZXSMSVLU.js → chunk-I7HDD4IM.js} +1 -1
  62. package/dist/{chunk-JE6TBZGY.js → chunk-J47HXHSL.js} +7 -7
  63. package/dist/{chunk-RB2F65YJ.js → chunk-JPRJQ6B7.js} +11 -11
  64. package/dist/{chunk-PAB2ZU4F.js → chunk-KJY57QPT.js} +49 -49
  65. package/dist/{chunk-M2LLVSBR.js → chunk-KWX6NAOR.js} +1 -1
  66. package/dist/{chunk-OFKWTOXK.js → chunk-L7FDYGGF.js} +3 -3
  67. package/dist/{chunk-6ANFVX4M.js → chunk-L7IKTEOC.js} +11 -11
  68. package/dist/{chunk-EZY4CO4A.js → chunk-LGAN7DNC.js} +5 -5
  69. package/dist/{chunk-PCKYNZ5Y.js → chunk-LGLZTJ2W.js} +6 -6
  70. package/dist/{chunk-7ACSSYEZ.js → chunk-MEJK6PBN.js} +1 -1
  71. package/dist/{chunk-IUCIYWTT.js → chunk-NDO24PK6.js} +8 -8
  72. package/dist/{chunk-XDDTFV32.js → chunk-NESJOC3R.js} +1 -1
  73. package/dist/{chunk-BYCOB6WT.js → chunk-NGBT7AHL.js} +6 -6
  74. package/dist/chunk-PCQPV6MS.js +6 -0
  75. package/dist/{chunk-CCPNMYCK.js → chunk-Q23EHOXW.js} +1 -1
  76. package/dist/{chunk-ACW3J77L.js → chunk-Q7HN6T3H.js} +1 -1
  77. package/dist/{chunk-XNJMLHGK.js → chunk-QDLGU62M.js} +1 -1
  78. package/dist/{chunk-NUSSZJF2.js → chunk-REVC6YPT.js} +5 -5
  79. package/dist/{chunk-EM6BEHAD.js → chunk-RWGSMZGS.js} +1 -1
  80. package/dist/{chunk-4MO375G3.js → chunk-S2OIRC5H.js} +3 -3
  81. package/dist/{chunk-FTKKGGOQ.js → chunk-SR4XAYLC.js} +1 -1
  82. package/dist/{chunk-RPJ2GC3K.js → chunk-SRKSGUGT.js} +20 -20
  83. package/dist/{chunk-2F7ZOMKK.js → chunk-SZIENHKR.js} +1 -1
  84. package/dist/{chunk-UZ3CZQA4.js → chunk-TGLHJS3M.js} +1 -1
  85. package/dist/{chunk-O2YAB6WK.js → chunk-TIQKDAON.js} +6 -6
  86. package/dist/{chunk-TANR67XF.js → chunk-TVJRENCQ.js} +9 -9
  87. package/dist/{chunk-RJZYORCR.js → chunk-U4BMS5EV.js} +1 -1
  88. package/dist/chunk-UJOWORTR.js +1 -0
  89. package/dist/{chunk-MY755PTJ.js → chunk-UZMZ2EDW.js} +1 -1
  90. package/dist/{chunk-S4J4B7LY.js → chunk-WCKZHEFC.js} +5 -5
  91. package/dist/{chunk-AZU7YOES.js → chunk-WRORJNS5.js} +8 -8
  92. package/dist/{chunk-XB2YPUKR.js → chunk-XLD53X4P.js} +8 -8
  93. package/dist/{chunk-4HCRZHIX.js → chunk-XSPDPN5O.js} +1 -1
  94. package/dist/{chunk-TZHWF3P5.js → chunk-Y6IQYQYN.js} +2 -2
  95. package/dist/chunk-YALPQIBR.js +7 -0
  96. package/dist/{chunk-HAIMJAI4.js → chunk-ZCHBOAPA.js} +2 -2
  97. package/dist/{chunk-M2AIC7IK.js → chunk-ZEKM6HAA.js} +2 -2
  98. package/dist/{chunk-5YELPBUT.js → chunk-ZK2SULCA.js} +1 -1
  99. package/dist/{chunk-BHMUOWAE.js → chunk-ZSFUNXRD.js} +4 -4
  100. package/dist/{chunk-JDKRQG7X.js → chunk-ZWAVSUWT.js} +2 -2
  101. package/dist/data/ListLoadError.js +1 -1
  102. package/dist/format/index.js +1 -1
  103. package/dist/forms/BorderInput.js +1 -1
  104. package/dist/forms/BrandAssetEditor.js +1 -1
  105. package/dist/forms/Calendar.js +1 -1
  106. package/dist/forms/ColorPicker.js +1 -1
  107. package/dist/forms/ComposerAttachments.js +1 -1
  108. package/dist/forms/CornersInput.js +1 -1
  109. package/dist/forms/DatePicker.js +1 -1
  110. package/dist/forms/DateRangePicker.js +1 -1
  111. package/dist/forms/DisplayChips.js +1 -1
  112. package/dist/forms/FilePicker.js +1 -1
  113. package/dist/forms/IconPicker.js +1 -1
  114. package/dist/forms/InputNumber.js +1 -1
  115. package/dist/forms/LinkPicker.js +1 -1
  116. package/dist/forms/MediaLibrary.d.ts +31 -1
  117. package/dist/forms/MediaLibrary.js +1 -1
  118. package/dist/forms/MediaUploadField.js +1 -1
  119. package/dist/forms/MediaUploadGrid.d.ts +7 -1
  120. package/dist/forms/MediaUploadGrid.js +1 -1
  121. package/dist/forms/MediaUsedInList.js +1 -1
  122. package/dist/forms/PositionInput.js +1 -1
  123. package/dist/forms/Select.js +1 -1
  124. package/dist/forms/SidesInput.js +1 -1
  125. package/dist/forms/Slider.js +1 -1
  126. package/dist/forms/Snippet.js +1 -1
  127. package/dist/forms/SplitButton.js +1 -1
  128. package/dist/forms/TagInput.js +1 -1
  129. package/dist/forms/TextToolbar.js +1 -1
  130. package/dist/forms/WidthsBar.js +1 -1
  131. package/dist/forms/mediaLibraryMenu.js +1 -1
  132. package/dist/forms/textAlign.js +1 -1
  133. package/dist/icons/index.js +1 -1
  134. package/dist/index.d.ts +1 -1
  135. package/dist/index.js +162 -162
  136. package/dist/map/index.js +3 -3
  137. package/dist/markdown/index.js +1 -1
  138. package/dist/page-tabs/index.js +5 -5
  139. package/dist/pdf/index.js +1 -1
  140. package/dist/shell/Accordion.js +1 -1
  141. package/dist/shell/AppUpdateBanner.js +1 -1
  142. package/dist/shell/Banner.js +1 -1
  143. package/dist/shell/Breadcrumbs.js +1 -1
  144. package/dist/shell/ColoredBadge.js +1 -1
  145. package/dist/shell/ConfirmDialog.js +1 -1
  146. package/dist/shell/ContextMenu.js +1 -1
  147. package/dist/shell/Dialog.d.ts +13 -3
  148. package/dist/shell/Dialog.js +1 -1
  149. package/dist/shell/Drawer.js +1 -1
  150. package/dist/shell/DropdownMenu.js +1 -1
  151. package/dist/shell/EmptyState.js +1 -1
  152. package/dist/shell/HelpCenter.js +1 -1
  153. package/dist/shell/ImageLightbox.js +1 -1
  154. package/dist/shell/LanguageSelect.js +1 -1
  155. package/dist/shell/Markdown.js +1 -1
  156. package/dist/shell/PageHeader.js +1 -1
  157. package/dist/shell/PopupMenu.js +1 -1
  158. package/dist/shell/ProductionTimeline.js +1 -1
  159. package/dist/shell/Result.js +1 -1
  160. package/dist/shell/SearchableSelect.js +1 -1
  161. package/dist/shell/SettingReset.js +1 -1
  162. package/dist/shell/SettingRow.js +1 -1
  163. package/dist/shell/SidebarLayout.js +1 -1
  164. package/dist/shell/SidebarNav.js +1 -1
  165. package/dist/shell/SortableList.js +1 -1
  166. package/dist/shell/StepChain.js +1 -1
  167. package/dist/shell/Stepper.js +1 -1
  168. package/dist/shell/TopNav.js +1 -1
  169. package/dist/shell/Tree.js +1 -1
  170. package/dist/telemetry/index.js +1 -1
  171. package/dist/templates/ChatTemplate.js +1 -1
  172. package/dist/templates/CheckoutTemplate.js +1 -1
  173. package/dist/templates/DataTablePage.js +1 -1
  174. package/dist/templates/EmailTemplate.js +1 -1
  175. package/dist/templates/FormLayoutPage.js +1 -1
  176. package/dist/ui/index.d.ts +1 -1
  177. package/dist/ui/index.js +1 -1
  178. package/dist/version.js +1 -1
  179. package/package.json +1 -1
  180. package/dist/Calculator-6ZU5MKTQ.js +0 -29
  181. package/dist/Files-DEC4KVQM.js +0 -87
  182. package/dist/PdfViewer-KSLOYXMD.js +0 -1
  183. package/dist/Sidebar-QQFJJWE2.js +0 -43
  184. package/dist/chunk-2EOQDYGM.js +0 -29
  185. package/dist/chunk-2PWZNFFP.js +0 -19
  186. package/dist/chunk-5FCEBKT2.js +0 -7
  187. package/dist/chunk-F2AEP37B.js +0 -4
  188. package/dist/chunk-HMHL27AU.js +0 -6
  189. package/dist/chunk-JBQWR4SX.js +0 -8
  190. package/dist/chunk-MOD4PGVF.js +0 -27
  191. package/dist/chunk-NKZNPYDB.js +0 -3
  192. package/dist/chunk-WAZTGEMG.js +0 -1
  193. package/dist/chunk-WKRFD4E4.js +0 -14
package/README.md CHANGED
@@ -1620,7 +1620,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
1620
1620
  | `ImageLightbox`, `ZoomableImage`, `LIGHTBOX_PICTURE_FIT` | The full-screen viewer for a GALLERY (harness PAT-7; a single stored document opens in the Preview window instead, UI-18). `images` (`{ url, caption?, kind? }`), `startIndex`, `onClose`, `onIndexChange`, `onOpenFile`. A picture zooms with the wheel, a pinch and a double-click and pans with a drag (`ZoomableImage`); a video gets the player; any other file a card whose "Open file" links to it, or calls `onOpenFile` (a host that can show it in the Preview window). A `1 / 5` counter and Close top right, Previous / Next that wrap, caption and "Open original" below; ArrowLeft / ArrowRight step, and Escape closes through the shell's Escape seam, so the window behind stays open. A modal dialog with a focus trap and a scroll lock, portalled to `<body>` on the overlay layer; a click on the backdrop closes, a click on the picture does not. `LIGHTBOX_PICTURE_FIT` is the class string that fits the picture between the edge controls (the bars and the side arrows); a host that draws its own viewer round `ZoomableImage` uses it with `object-contain` instead of keeping a copy. Words: the `lightbox` section. |
1621
1621
  | `MediaUsedInList` | "Used in 7 places": a row per place that still uses a file — the host's kind word as a badge ("Page", "Email") and the place's name. A row with `onOpen` is a link-look button; a row without one is plain text, never a button that goes nowhere. It fetches nothing; the host hands over the rows. `heading` and `emptyText` replace the catalog's `media.usedIn` / `media.notUsed`. |
1622
1622
  | `mediaMoveItems`, `useMediaMoveItems` | The "Move to" list as `DropdownMenu` entries, so a bulk bar's "Move to" button and any menu that takes the same entries draw one definition. `{ count, kind, targets, onPick }`: it leads with "Move 3 images to" (`media.moveTo`), runs of targets that share a `group` get a label and a line, `depth` indents a nested folder, and a target with `disabledReason` stays in the list, off, with the reason under it. No targets says `media.moveNowhere`. The hook reads the words from the catalog; the plain function takes them as its second argument. `mediaMoveSubmenu(options)` is the same list as ONE "Move to ▸" row (a `type: 'submenu'` entry) for a menu that holds other things; `head: false` drops the "Move 3 images to" line (a folder moving). |
1623
- | `MediaLibrary`, `mediaLibraryMenu` | THE media library (harness UI-21): the Media Library window (`mode="manage"`) and the website editor's and email designer's image picker (`mode="pick"`) are this one part. Presentational: it never fetches; the host is the port (`MediaLibraryProps`). It hands over `location` (`{ place: 'files', folderId }`, `{ place: 'products', nodeId }`, `{ place: 'trash' }`) with `onLocationChange`, `folders` (`{ id, name, parentId, count, notEmpty }`, any depth), `products` (brand > design > finish, `sharedFrom` on a shared brand), `files` (what the open place holds, filtered by the host: `name`, `url`, `thumbUrl`, `usedCount`, `email`, `private`, `trashedDaysAgo`, and the detail rows), `usedIn` rows for the one chosen file, the counts, and the callbacks: `onUpload(files, folderId)`, `onNewFolder(parentId)` (return the new id and its name field opens, selected), `onRename`, `onMove`, `onTrash` (files), `onDeleteFolder(folderId)`, `onRestore`, `onDeleteForever`, `onEmptyTrash`, `onReplace`, `onCropEdit`, `onOpenInDesign`, `onChoose`, `onCancel`. A callback left out takes its action away (Replace before it exists); `denied: { action: reason }` keeps an action, off, with the reason. The tree: Products (read-only, lock, "Read-only" badge; hover, the details panel and the empty state say "Read-only. Edit these pictures in Products > Design > Media.", plus "Edited at HQ (<tenant>)." under a shared brand), All files, Trash (not in the picker). The toolbar: `Breadcrumbs`, search (`query`), Media type / Use / Sort (`filters` + `onFiltersChange`), the host's own `extraFilters`, Grid / List (`view` + `onViewChange`), New folder and Upload (off in Products with their reasons). The grid is `MediaUploadGrid` with `useGridSelection` and `useMarquee` (Ctrl/Cmd+A, Escape), marks "Used N", "Email", "Private", "N days ago"; a double click opens `ImageLightbox` (in the picker it chooses). ONE menu definition, `mediaLibraryMenu(target, context)`, feeds both a folder's ⋯ `DropdownMenu` and every right-click `ContextMenu` (a folder, 1 or N files, a file in Trash, a Products folder, a render), "Move to ▸" a submenu in both. A folder has no Trash: its danger row is "Delete folder" (the backend deletes only an empty folder), off with "Only an empty folder can be deleted." while the host sets `notEmpty`; pressing it calls `onDeleteFolder`, and the host asks through the shell destructive confirm (the part does not). With N files chosen, Rename, Replace and Copy URL are off. Drag: files onto a folder move there, a folder onto a folder nests, files from the computer upload into the open folder; Products takes nothing, and its `Tooltip` says why (`MEDIA_FILES_DRAG_TYPE`, `MEDIA_FOLDER_DRAG_TYPE`). The details panel: picture, `DescriptionList`, Copy URL, Replace / Crop & edit / Move to / Rename / Trash (Restore / Delete forever in Trash; a render: read-only `Banner` and Open in Design), `MediaUsedInList`. Two or more chosen: a bulk bar. The picker: a footer "1 selected · <name>", Cancel / Choose image; a `private` file (or one with `pickDisabledReason`) cannot be chosen. Under 640 px of its own width (or `layout="phone"`): the tree over the toolbar, three tiles a row, and the details in a bottom sheet (`Drawer side="bottom"`). Words: the `mediaLibrary` section. |
1623
+ | `MediaLibrary`, `mediaLibraryMenu` | THE media library (harness UI-21): the Media Library window (`mode="manage"`) and the website editor's and email designer's image picker (`mode="pick"`) are this one part. Presentational: it never fetches; the host is the port (`MediaLibraryProps`). It hands over `location` (`{ place: 'files', folderId }`, `{ place: 'products', nodeId }`, `{ place: 'trash' }`) with `onLocationChange`, `folders` (`{ id, name, parentId, count, notEmpty }`, any depth), `products` (brand > design > finish, `sharedFrom` on a shared brand), `files` (what the open place holds, filtered by the host: `name`, `url`, `thumbUrl`, `usedCount`, `email`, `private`, `trashedDaysAgo`, and the detail rows), `usedIn` rows for the one chosen file, the counts, and the callbacks: `onUpload(files, folderId)`, `onNewFolder(parentId)` (return the new id and its name field opens, selected), `onRename`, `onMove`, `onTrash` (files), `onDeleteFolder(folderId)`, `onRestore`, `onDeleteForever`, `onEmptyTrash`, `onReplace`, `onCropEdit`, `onOpenInDesign`, `onChoose`, `onCancel`. A callback left out takes its action away (Replace before it exists); `denied: { action: reason }` keeps an action, off, with the reason. The tree: Products (read-only, lock, "Read-only" badge; hover, the details panel and the empty state say "Read-only. Edit these pictures in Products > Design > Media.", plus "Edited at HQ (<tenant>)." under a shared brand), All files, Trash (not in the picker). The toolbar: `Breadcrumbs`, search (`query`), Media type / Use / Sort (`filters` + `onFiltersChange`), the host's own `extraFilters`, Grid / List (`view` + `onViewChange`), New folder and Upload (off in Products with their reasons). The grid is `MediaUploadGrid` with `useGridSelection` and `useMarquee` (Ctrl/Cmd+A, Escape), marks "Used N", "Email", "Private", "N days ago"; a double click opens `ImageLightbox` (in the picker it chooses). ONE menu definition, `mediaLibraryMenu(target, context)`, feeds both a folder's ⋯ `DropdownMenu` and every right-click `ContextMenu` (a folder, 1 or N files, a file in Trash, a Products folder, a render), "Move to ▸" a submenu in both. A folder has no Trash: its danger row is "Delete folder" (the backend deletes only an empty folder), off with "Only an empty folder can be deleted." while the host sets `notEmpty`; pressing it calls `onDeleteFolder`, and the host asks through the shell destructive confirm (the part does not). With N files chosen, Rename, Replace and Copy URL are off. Drag: files onto a folder move there, a folder onto a folder nests, files from the computer upload into the open folder; Products takes nothing, and its `Tooltip` says why (`MEDIA_FILES_DRAG_TYPE`, `MEDIA_FOLDER_DRAG_TYPE`). The details panel: picture, `DescriptionList`, Copy URL, Replace / Crop & edit / Move to / Rename / Trash (Restore / Delete forever in Trash; a render: read-only `Banner` and Open in Design), `MediaUsedInList`. Two or more chosen: a bulk bar. The picker: a footer "1 selected · <name>", Cancel / Choose image; a `private` file (or one with `pickDisabledReason`) cannot be chosen. With `onDragOut` (opt-in, harness UI-20 media popup) a choosable file can be dragged OUT of the picker onto an editor's canvas: it carries `{ id, url, kind, name }` under `MEDIA_FILE_DRAG_TYPE` (read it with `readMediaFileDrag(e.dataTransfer)`, which answers null for anything else), with `effectAllowed: 'link'`, and `onDragOut` hears `start`, then `dropped` or `cancelled`. Under 640 px of its own width (or `layout="phone"`): the tree over the toolbar, three tiles a row, and the details in a bottom sheet (`Drawer side="bottom"`). Words: the `mediaLibrary` section. |
1624
1624
  | `StartMenu` / `Desktop` / `WindowManagerProvider` | Used internally by `Layout`; rarely instantiated directly. |
1625
1625
  | `Modal`, `ModalActions`, `CopyButton`, `CancelButton` | Window primitive supporting standard / compact / widget styles. Every window frame is a non-modal `role="dialog"` (no `aria-modal`: a window stands beside other windows, with no scrim and no focus trap), named by the title it draws through `aria-labelledby`; a widget, a phone frame and the Home tab draw no title, so their title text is the `aria-label`. A test finds an open window with `getByRole('dialog', { name: 'Its title' })`, and a modal popup over it with `[role="dialog"][aria-modal="true"]`. |
1626
1626
  | `splitTitle(title)` | Splits a window or page title for the Sidebar layout's tab: `{ text, copy, accessories, badges, actions }` — the title's words for the tab (a badge's own text is not among them), the `CopyButton`'s text (a routed page tab's copy icon; window tabs draw none), and every badge and control (any component, `button`, `a`, `select`, …) in title order, split into `badges` (`StatusBadge`, `ColoredBadge`, or a component with `titleRole = 'badge'`) for the record bar and `actions` (everything else) for the active window tab. Inline SVG is dropped. A badge drawn as a styled `<span>` counts as words, so draw badges with `StatusBadge` / `ColoredBadge`. |
@@ -1829,7 +1829,7 @@ needs `worker-src 'self'` and nothing from a CDN. pdf.js 6 compiles nothing
1829
1829
  with `eval`; a CSP without `'wasm-unsafe-eval'` makes it load the decoders'
1830
1830
  JavaScript fallbacks from `wasmUrl` instead of the WebAssembly ones.
1831
1831
 
1832
- `Dialog`'s `size="xl"` is the width for reading a page in.
1832
+ `Dialog`'s `size="xl"` is the width for reading a page in. `size="2xl"` is the big chooser (the editors' media popup). `aside` keeps a dialog open with everything in it while its scrim and panel turn invisible and let the pointer through; the media popup sets it for the length of a drag out of it, then closes (dropped) or comes back (cancelled).
1833
1833
 
1834
1834
  ### UI kit without the window manager — `efficient-shell/ui`
1835
1835
 
@@ -4292,6 +4292,17 @@ import { AssistantChat } from 'efficient-shell/ai';
4292
4292
  which it does not send or clear). `initialQuestion` makes a NEW chat ask
4293
4293
  that question as it mounts, once; it is never sent over a restored
4294
4294
  `conversationId`. The admin portal's saved questions use all three.
4295
+ * **Attaching files.** `attachments` (`AssistantAttachmentsConfig`) puts a
4296
+ paperclip beside the composer and makes it a drop and paste target, checked
4297
+ against the host's `accept`, `maxSizeBytes` and `maxFiles` (default 5) with
4298
+ the kit's file intake. Each file goes to the host's `upload` as soon as it is
4299
+ picked and shows as a chip (uploading, stored, or the refusal the upload
4300
+ rejected with); Send waits for the uploads. A question carries its files as
4301
+ `file` parts naming the server's copies (`attachmentPart`; never the bytes),
4302
+ `buildRequestBody` sends their ids as `attachments`, and a restored thread
4303
+ rebuilds them from each message's `attachments`. Each file shows above its
4304
+ question; a click hands it to the host's `onOpen` (the admin portal: Preview,
4305
+ UI-18). Without the prop there is no paperclip and the request is unchanged.
4295
4306
  * **Rating answers.** With `onRate`, a finished answer the server named a run
4296
4307
  for (`run_id` on the stream's `finish` metadata, and on each answer of a
4297
4308
  restored thread, with the person's `rating`) gets thumbs up and down under
@@ -1,29 +1,29 @@
1
- import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-G2V2ADJQ.js";import{WindowTitle as r}from"./chunk-PAB2ZU4F.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-SEXLHFMR.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-EW6FRPFJ.js";import{confirm as n}from"./chunk-MOD4PGVF.js";import"./chunk-F2AEP37B.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4GVH4ZUH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-D323R2FT.js";import"./chunk-KC3EX26K.js";import"./chunk-WAZTGEMG.js";import"./chunk-FKZEGBLK.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import{Icon as a}from"./chunk-2SHYR3RA.js";import"./chunk-J75ZT2JQ.js";import"./chunk-VH6GB73Q.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as s,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",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=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 k(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&&b.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 g;try{const e=localStorage.getItem(d);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const u=s(void 0);void 0===u.current&&(u.current=e()),i(()=>{null!=u.current&&t(u.current)},[]);const p=u.current?k(u.current.url):"",[g,b]=l(w),[f,y]=l(p||g),[j,C]=l(f),[R,W]=l([f]),[z,L]=l(0),[E,S]=l(0),[D,G]=l(x),[T,U]=l(!1),[H,F]=l(null),J=s(null),K=s(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(D))}catch{}},[D]);const A=e=>{const t=k(e);t&&(y(t),C(t),W(e=>{const o=e.slice(0,z+1);return o.push(t),o}),L(e=>e+1),U(!1))},M=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},O=()=>{const e=H?.trim();e?(G(t=>[...t,{label:e,url:f}]),F(null)):F(null)};i(()=>{if(null===H)return;J.current?.focus(),J.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||F(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==H]);const P=e=>{G(t=>t.filter((t,o)=>o!==e))},B=z>0,Q=z<R.length-1,V=D.some(e=>e.url===f),I="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-EIWTOEWV.js";import{WindowTitle as r}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import{confirm as n}from"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-UJOWORTR.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as a}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as s,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",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=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 k(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&&b.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 g;try{const e=localStorage.getItem(d);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const u=s(void 0);void 0===u.current&&(u.current=e()),i(()=>{null!=u.current&&t(u.current)},[]);const p=u.current?k(u.current.url):"",[g,b]=l(w),[f,y]=l(p||g),[j,C]=l(f),[W,R]=l([f]),[z,T]=l(0),[E,D]=l(0),[L,S]=l(x),[U,G]=l(!1),[J,K]=l(null),O=s(null),H=s(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(L))}catch{}},[L]);const P=e=>{const t=k(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,z+1);return o.push(t),o}),T(e=>e+1),G(!1))},I=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},M=()=>{const e=J?.trim();e?(S(t=>[...t,{label:e,url:f}]),K(null)):K(null)};i(()=>{if(null===J)return;O.current?.focus(),O.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||K(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==J]);const Q=e=>{S(t=>t.filter((t,o)=>o!==e))},V=z>0,A=z<W.length-1,B=L.some(e=>e.url===f),F="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-gray-200 bg-gray-50 shrink-0",children:[
6
- /* @__PURE__ */m("button",{onClick:()=>{if(z>0){const e=z-1;L(e),y(R[e]),C(R[e]),U(!1)}},disabled:!B,className:I,title:"Back",children:/* @__PURE__ */m(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
- /* @__PURE__ */m("button",{onClick:()=>{if(z<R.length-1){const e=z+1;L(e),y(R[e]),C(R[e]),U(!1)}},disabled:!Q,className:I,title:"Forward",children:/* @__PURE__ */m(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
- /* @__PURE__ */m("button",{onClick:()=>S(e=>e+1),className:I,title:"Refresh",children:/* @__PURE__ */m(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
- /* @__PURE__ */m("button",{onClick:()=>A(g),className:I,title:"Home",children:/* @__PURE__ */m(a,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
- /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),A(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
6
+ /* @__PURE__ */m("button",{onClick:()=>{if(z>0){const e=z-1;T(e),y(W[e]),C(W[e]),G(!1)}},disabled:!V,className:F,title:"Back",children:/* @__PURE__ */m(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */m("button",{onClick:()=>{if(z<W.length-1){const e=z+1;T(e),y(W[e]),C(W[e]),G(!1)}},disabled:!A,className:F,title:"Forward",children:/* @__PURE__ */m(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */m("button",{onClick:()=>D(e=>e+1),className:F,title:"Refresh",children:/* @__PURE__ */m(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */m("button",{onClick:()=>P(g),className:F,title:"Home",children:/* @__PURE__ */m(a,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
+ /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),P(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-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
13
- /* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>V?P(D.findIndex(e=>e.url===f)):void F(v(f)),className:I+" "+(V?"text-yellow-500":""),title:V?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(a,{name:"star",className:"h-4 w-4",fill:V?"currentColor":"none",strokeWidth:1.5})}),
14
- /* @__PURE__ */m("button",{onClick:M,className:I,title:"Open in new tab",children:/* @__PURE__ */m(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
- /* @__PURE__ */m("button",{onClick:()=>U(e=>!e),className:I,title:"Embedding help",children:/* @__PURE__ */m(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==H&&/* @__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?Q(L.findIndex(e=>e.url===f)):void K(v(f)),className:F+" "+(B?"text-yellow-500":""),title:B?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(a,{name:"star",className:"h-4 w-4",fill:B?"currentColor":"none",strokeWidth:1.5})}),
14
+ /* @__PURE__ */m("button",{onClick:I,className:F,title:"Open in new tab",children:/* @__PURE__ */m(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
+ /* @__PURE__ */m("button",{onClick:()=>G(e=>!e),className:F,title:"Embedding help",children:/* @__PURE__ */m(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==J&&/* @__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-gray-500 mb-1",children:"Bookmark this page"}),
17
17
  /* @__PURE__ */m("div",{className:"text-2xs text-gray-400 truncate mb-2 font-mono",title:f,children:f}),
18
- /* @__PURE__ */m("input",{ref:J,type:"text",value:H,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key?O():"Escape"===e.key&&F(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
18
+ /* @__PURE__ */m("input",{ref:O,type:"text",value:J,onChange:e=>K(e.target.value),onKeyDown:e=>{"Enter"===e.key?M():"Escape"===e.key&&K(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 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:()=>F(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
- /* @__PURE__ */m("button",{onClick:O,disabled:!H.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===D.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),D.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>A(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"})&&P(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
20
+ /* @__PURE__ */m("button",{onClick:()=>K(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
+ /* @__PURE__ */m("button",{onClick:M,disabled:!J.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
22
+ /* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===L.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),L.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>P(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"})&&Q(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 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:()=>{b(f);try{localStorage.setItem(h,f)}catch{}},className:"px-2 py-0.5 text-2xs text-gray-500 hover:text-gray-800",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:E,iframeRef:K,openExternal:M,showHelp:T,dismissHelp:()=>U(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[d,h]=l(!1);i(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return f.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
26
+ /* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:f,iframeKey:E,iframeRef:H,openExternal:I,showHelp:U,dismissHelp:()=>G(!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:s}){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(a,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
28
28
  /* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
29
29
  /* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
@@ -0,0 +1,29 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-U4BMS5EV.js";import{useWidgetSettings as n}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as r}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.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(""),[C,f]=c([]),[v,$]=c(!1),[T,E]=c(()=>e(h)),[W,w]=c(!1),[D,J]=c(T),R=i(null);n(l(()=>{J({...T}),w(!0)},[T]));const S=l(e=>{x(""),k(t=>N||"0"===t?(j(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),G=l(()=>{k("0"),d(null),g(null),j(!1)},[]),K=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}},[]),A=l(e=>{const t=parseFloat(m);if(null!==p&&b&&!N){const e=K(p,t,b);k(String(e)),d(e),f(n=>[`${p} ${b} ${t} = ${e}`,...n].slice(0,20))}else d(t);g(e),j(!0)},[m,p,b,N,K]),B=l(()=>{if(null===p||!b)return;const e=parseFloat(m),t=K(p,e,b),n=`${p} ${b} ${e} =`;f(e=>[`${n} ${t}`,...e].slice(0,20)),x(n),k(String(t)),d(null),g(null),j(!0)},[m,p,b,K]),F=l(()=>{k(e=>String(parseFloat(e)/100))},[]),Q=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?A("+"):"-"===e.key?A("-"):"*"===e.key?A("×"):"/"===e.key?(e.preventDefault(),A("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&R.current?.contains(e.target)&&e.preventDefault(),B()):"Escape"===e.key?G():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&F())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[S,A,B,G,F]);const U="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",V=`${U} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,M=`${U} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,L=`${U} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,P=`${U} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
+ return s(a,{children:[
3
+ /* @__PURE__ */s("div",{ref:R,className:"flex flex-col h-full",style:{opacity:T.activeOpacity/100,backdropFilter:T.activeBlur>0?`blur(${T.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */s("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
5
+ /* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:C.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(y||b&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:y||`${p} ${b} ${N?"":m}`}),
6
+ /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),$(!0),setTimeout(()=>$(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,v?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
8
+ /* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(m)})]})]}),
9
+ /* @__PURE__ */s("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
10
+ /* @__PURE__ */u("button",{onClick:G,className:L,children:"AC"}),
11
+ /* @__PURE__ */u("button",{onClick:Q,className:L,children:"+/−"}),
12
+ /* @__PURE__ */u("button",{onClick:F,className:L,children:"%"}),
13
+ /* @__PURE__ */u("button",{onClick:()=>A("÷"),className:`${M} ${"÷"===b?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */u("button",{onClick:()=>S("7"),className:V,children:"7"}),
15
+ /* @__PURE__ */u("button",{onClick:()=>S("8"),className:V,children:"8"}),
16
+ /* @__PURE__ */u("button",{onClick:()=>S("9"),className:V,children:"9"}),
17
+ /* @__PURE__ */u("button",{onClick:()=>A("×"),className:`${M} ${"×"===b?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */u("button",{onClick:()=>S("4"),className:V,children:"4"}),
19
+ /* @__PURE__ */u("button",{onClick:()=>S("5"),className:V,children:"5"}),
20
+ /* @__PURE__ */u("button",{onClick:()=>S("6"),className:V,children:"6"}),
21
+ /* @__PURE__ */u("button",{onClick:()=>A("-"),className:`${M} ${"-"===b?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */u("button",{onClick:()=>S("1"),className:V,children:"1"}),
23
+ /* @__PURE__ */u("button",{onClick:()=>S("2"),className:V,children:"2"}),
24
+ /* @__PURE__ */u("button",{onClick:()=>S("3"),className:V,children:"3"}),
25
+ /* @__PURE__ */u("button",{onClick:()=>A("+"),className:`${M} ${"+"===b?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */u("button",{onClick:()=>S("0"),className:`${V} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */u("button",{onClick:()=>S("."),className:V,children:"."}),
28
+ /* @__PURE__ */u("button",{onClick:B,className:P,children:"="})]})]}),
29
+ /* @__PURE__ */u(t,{open:W,onClose:()=>w(!1),title:"Calculator Settings",appearance:D,onAppearanceChange:J,onSave:()=>{E(D),localStorage.setItem(h,JSON.stringify(D)),w(!1)}})]})}export{m as default};
@@ -1,21 +1,21 @@
1
- import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-RJZYORCR.js";import{useWidgetSettings as r}from"./chunk-PAB2ZU4F.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-SEXLHFMR.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-EW6FRPFJ.js";import"./chunk-MOD4PGVF.js";import"./chunk-F2AEP37B.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4GVH4ZUH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-D323R2FT.js";import"./chunk-KC3EX26K.js";import"./chunk-FKZEGBLK.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-2SHYR3RA.js";import"./chunk-J75ZT2JQ.js";import"./chunk-VH6GB73Q.js";import{LoadingSpinner as n}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as a,useEffect as o}from"react";import{jsxs as c,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 j(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var f={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function N(){const[u,d]=s(j),[N,y]=s(()=>t(h)),[x,b]=s({}),[D,S]=s(!1),[v,C]=s(!1),[R,U]=s([]),[J,B]=s(N),[A,G]=s("USD"),[F,K]=s("CNY");r(a(()=>{U([...u]),B({...N}),C(!0)},[u,N])),o(()=>{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-U4BMS5EV.js";import{useWidgetSettings as r}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as a,useEffect as o}from"react";import{jsxs as c,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,y]=s(()=>t(h)),[x,b]=s({}),[D,S]=s(!1),[C,v]=s(!1),[J,U]=s([]),[R,B]=s(f),[G,T]=s("USD"),[A,K]=s("CNY");r(a(()=>{U([...u]),B({...f}),v(!0)},[u,f])),o(()=>{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 c(i,{children:[
3
- /* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${N.activeOpacity/100})`,backdropFilter:N.activeBlur>0?`blur(${N.activeBlur}px)`:void 0},children:/* @__PURE__ */c("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=x[t]?.[e];/* @__PURE__ */
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__ */c("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=x[t]?.[e];/* @__PURE__ */
4
4
  return c("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(t),localStorage.setItem(p,JSON.stringify(t))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
5
5
  /* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
6
- /* @__PURE__ */l("span",{className:"text-base",children:f[t]||""}),
6
+ /* @__PURE__ */l("span",{className:"text-base",children:j[t]||""}),
7
7
  /* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:t}),
8
8
  /* @__PURE__ */l("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
9
- /* @__PURE__ */l("span",{className:"text-base",children:f[e]||""}),
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:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:B,onSave:()=>{if(0===R.length)return;const t=R.slice(0,4);d(t),y(J),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(J)),C(!1)},children:/* @__PURE__ */c("div",{children:[
12
+ /* @__PURE__ */l(e,{open:C,onClose:()=>v(!1),title:"Currency Settings",appearance:R,onAppearanceChange:B,onSave:()=>{if(0===J.length)return;const t=J.slice(0,4);d(t),y(R),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(R)),v(!1)},children:/* @__PURE__ */c("div",{children:[
13
13
  /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Currency Pairs ",
14
- /* @__PURE__ */c("span",{className:"text-2xs font-normal text-gray-400",children:["(",R.length,"/",4,")"]})]}),
15
- /* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:R.map(([t,e],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
- /* @__PURE__ */c("span",{className:"text-sm",children:[f[t]||""," ",t," → ",f[e]||""," ",e]}),
17
- /* @__PURE__ */l("button",{onClick:()=>U(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),R.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
18
- /* @__PURE__ */l("select",{value:A,onChange:t=>G(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))}),
14
+ /* @__PURE__ */c("span",{className:"text-2xs font-normal text-gray-400",children:["(",J.length,"/",4,")"]})]}),
15
+ /* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:J.map(([t,e],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
+ /* @__PURE__ */c("span",{className:"text-sm",children:[j[t]||""," ",t," → ",j[e]||""," ",e]}),
17
+ /* @__PURE__ */l("button",{onClick:()=>U(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),J.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
18
+ /* @__PURE__ */l("select",{value:G,onChange:t=>T(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
19
  /* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
20
- /* @__PURE__ */l("select",{value:F,onChange:t=>K(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:()=>{A!==F&&R.length<4&&U(t=>[...t,[A,F]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{N as default};
20
+ /* @__PURE__ */l("select",{value:A,onChange:t=>K(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:()=>{G!==A&&J.length<4&&U(t=>[...t,[G,A]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
@@ -1,25 +1,25 @@
1
- import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-G2V2ADJQ.js";import{WindowTitle as n}from"./chunk-PAB2ZU4F.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-SEXLHFMR.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-EW6FRPFJ.js";import"./chunk-MOD4PGVF.js";import"./chunk-F2AEP37B.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as r}from"./chunk-4NXMMWL6.js";import"./chunk-4GVH4ZUH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-D323R2FT.js";import"./chunk-KC3EX26K.js";import"./chunk-WAZTGEMG.js";import{PopupMenu as o,PopupMenuLabel as i,PopupMenuItem as l,PopupMenuDivider as a}from"./chunk-FKZEGBLK.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import{Icon as s}from"./chunk-2SHYR3RA.js";import"./chunk-J75ZT2JQ.js";import"./chunk-VH6GB73Q.js";import{LoadingSpinner as c}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as m,useRef as h}from"react";import{jsxs as d,jsx as u}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,w]=m(!1),[j,N]=m(!1),[C,D]=m(null),L=h(null),M=h(null),R=h(null),U=(e,t)=>{R.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=()=>{R.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))},A=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-EIWTOEWV.js";import{WindowTitle as n}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as r}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-UJOWORTR.js";import{PopupMenu as o,PopupMenuLabel as i,PopupMenuItem as l,PopupMenuDivider as a}from"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as s}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as c}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as m,useRef as h}from"react";import{jsxs as d,jsx as u}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,w]=m(!1),[j,N]=m(!1),[C,D]=m(null),M=h(null),L=h(null),W=h(null),R=(e,t)=>{W.current?.focus(),document.execCommand(e,!1,t),N(!0)},U=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{W.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(
2
2
  /* @vite-ignore */
3
- "mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},B=f?.filename?(G=f.filename).length>24?`${G.slice(0,23)}…`:G:"Untitled";var G;/* @__PURE__ */
4
- return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||w(!0)},onDragLeave:e=>{e.currentTarget===e.target&&w(!1)},onDrop:e=>{e.preventDefault(),w(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?W(t):A(t[0]))},children:[
5
- /* @__PURE__ */u(n,{title:`${B}${j?" •":""} - Documents`}),
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)}},O=f?.filename?(A=f.filename).length>24?`${A.slice(0,23)}…`:A:"Untitled";var A;/* @__PURE__ */
4
+ return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||w(!0)},onDragLeave:e=>{e.currentTarget===e.target&&w(!1)},onDrop:e=>{e.preventDefault(),w(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?U(t):B(t[0]))},children:[
5
+ /* @__PURE__ */u(n,{title:`${O}${j?" •":""} - Documents`}),
6
6
  /* @__PURE__ */u(t,{app:"documents"}),
7
7
  /* @__PURE__ */d("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
8
- /* @__PURE__ */u("input",{ref:L,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&A(t),L.current&&(L.current.value="")},className:"hidden"}),
9
- /* @__PURE__ */d("button",{onClick:()=>L.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
8
+ /* @__PURE__ */u("input",{ref:M,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&B(t),M.current&&(M.current.value="")},className:"hidden"}),
9
+ /* @__PURE__ */d("button",{onClick:()=>M.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
10
10
  /* @__PURE__ */u(s,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
11
- /* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=R.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=R.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
11
+ /* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=W.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=W.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
12
12
  /* @__PURE__ */u("span",{className:"text-2xs text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
13
13
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
14
14
  /* @__PURE__ */d("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:f.filename,children:[f.filename,j?" •":""]}),
15
15
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
16
16
  /* @__PURE__ */d("div",{className:"flex items-center gap-0.5",children:[
17
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
18
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
19
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
20
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
17
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
18
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
19
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
20
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
21
21
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
22
- /* @__PURE__ */d("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{U("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
22
+ /* @__PURE__ */d("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{R("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
23
23
  /* @__PURE__ */u("option",{value:"",disabled:!0,children:"Size"}),
24
24
  /* @__PURE__ */u("option",{value:"1",children:"XS"}),
25
25
  /* @__PURE__ */u("option",{value:"2",children:"S"}),
@@ -27,21 +27,21 @@ return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
27
27
  /* @__PURE__ */u("option",{value:"4",children:"L"}),
28
28
  /* @__PURE__ */u("option",{value:"5",children:"XL"}),
29
29
  /* @__PURE__ */u("option",{value:"6",children:"2XL"})]}),
30
- /* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>U("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
30
+ /* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>R("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
31
31
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
32
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
33
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
32
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
33
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
34
34
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
35
35
  /* @__PURE__ */d("div",{className:"flex items-center gap-0.5",children:[
36
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
37
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
38
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
36
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
37
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
38
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
40
40
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */u("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&W(Array.from(e.target.files)),M.current&&(M.current.value="")}}),
42
- /* @__PURE__ */d("button",{onClick:()=>M.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:[
41
+ /* @__PURE__ */u("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&U(Array.from(e.target.files)),L.current&&(L.current.value="")}}),
42
+ /* @__PURE__ */d("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__ */u(s,{name:"image",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
44
- /* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:k?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:R,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-white p-[1in] shadow text-sm leading-relaxed text-gray-800 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-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),b&&/* @__PURE__ */u("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__ */u("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__ */d(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>D(null),children:[
44
+ /* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:k?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:W,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(),U(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-white p-[1in] shadow text-sm leading-relaxed text-gray-800 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-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),b&&/* @__PURE__ */u("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__ */u("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__ */d(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>D(null),children:[
45
45
  /* @__PURE__ */u(i,{children:"Image width"}),
46
46
  /* @__PURE__ */u(l,{onClick:()=>T("25%"),children:"25%"}),
47
47
  /* @__PURE__ */u(l,{onClick:()=>T("50%"),children:"50%"}),
@@ -0,0 +1,87 @@
1
+ import{openPreviewFile as e}from"./chunk-ZTB6EMC7.js";import{SidebarLayout as t}from"./chunk-LGLZTJ2W.js";import"./chunk-QWK6DRSN.js";import"./chunk-KZHPX4FM.js";import{Breadcrumbs as r}from"./chunk-6SMQNPWS.js";import{formatBytes as a}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as n}from"./chunk-TGLHJS3M.js";import{AboutApp as s}from"./chunk-EIWTOEWV.js";import{peekFilesViewRequest as i,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-GSBIJLTD.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import{confirm as g,prompt as y}from"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as b}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-UJOWORTR.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as k}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as N}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import{TH_ONE_LINE as w}from"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as v,useEffect as j,useSyncExternalStore as $,useRef as C,useCallback as T}from"react";import{jsxs as D,jsx as L,Fragment as E}from"react/jsx-runtime";var R="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",W={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 S(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function M(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 P(){const P=R.replace(/\/$/,""),F=null!==n(),[I,O]=v("/"),[U,A]=v([]),[J,V]=v([]),[K,B]=v(null),[G,Q]=v(!0),[H,z]=v(!1),[X,Z]=v(null),[_,Y]=v(!1),[q,ee]=v(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});j(()=>{o()},[]);const[te,re]=v([]);j(()=>{const e=()=>{o(),ee("trash")},t=e=>{o();const t=e.detail?.folderId;t&&ee({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const ae=$(d,m,m),ne="object"==typeof q?q.desktopFolderId:null,se=ne?ae?.folders.find(e=>e.id===ne)??null:null,ie=ne&&ae?.itemsByFolder[ne]||[];j(()=>{ne&&ae&&!ae.folders.some(e=>e.id===ne)&&ee("files")},[ne,ae]);const oe=C(0),le=C(null),{openPage:ce,openEntity:de}=f(),me=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ce(e)}):"page"===t.entityType?ce(t.entityId):de(t.entityType,t.entityId,null,t.label)},he=T((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),pe=T(async()=>{try{const e=await he(`${P}/api/quota`);if(e.ok){const t=await e.json();Z({used:t.used,limit:t.limit})}}catch{}},[he,P]),ue=T(async e=>{if(B(null),F){const t=function(e){const t=n();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return A(t),O(e),z(!1),Q(!1),void("/"===e&&V(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Q(!0);try{const t=await he(`${P}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];A(a),O(r.path||e),z(!1),"/"===(r.path||e)&&V(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){z(!0)}finally{Q(!1)}pe()},[he,P,pe,F]),fe=T(async()=>{if(F)return re([]),void Q(!1);Q(!0),B(null);try{const e=await he(`${P}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();re(t.entries||[]),z(!1)}catch{z(!0)}finally{Q(!1)}pe()},[he,P,pe,F]);j(()=>{"files"===q?ue(I):"trash"===q&&fe()},[I,q]);const xe=async e=>{const t=S(I,e.name);try{const r=await he(`${P}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void b.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){b.error(e?.message||"Download failed")}},ge=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await he(`${P}/api/upload?path=${encodeURIComponent(I)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));b.error(`Quota exceeded — ${a(r)} free, ${e.name} is ${a(t.attempted||e.size)}`)}else b.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){b.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ue(I)},ye=()=>{oe.current=0,Y(!1)};if(j(()=>{const e=()=>ye();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),H)/* @__PURE__ */
2
+ return D("div",{className:"flex flex-col h-full bg-white",children:[
3
+ /* @__PURE__ */L(x,{title:"Files - offline"}),
4
+ /* @__PURE__ */L("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */D("div",{className:"max-w-md",children:[
5
+ /* @__PURE__ */L(k,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
+ /* @__PURE__ */L("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
+ /* @__PURE__ */D("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
+ /* @__PURE__ */L("span",{className:"font-mono",children:P}),". Make sure the server is running — see ",
9
+ /* @__PURE__ */L("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
+ /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===I?[]:I.split("/").filter(Boolean),ke=X&&X.limit>0?Math.min(100,Math.round(X.used/X.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>O("/")},...be.map((e,t)=>({label:e,onClick:()=>O("/"+be.slice(0,t+1).join("/"))}))],ve=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"),je=e=>/* @__PURE__ */L("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__ */L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),$e=/* @__PURE__ */D("nav",{className:"p-2",children:[
11
+ /* @__PURE__ */L("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
12
+ /* @__PURE__ */D("button",{onClick:()=>{ee("files"),O("/")},className:ve("files"===q&&"/"===I),children:[je("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__ */D("button",{onClick:()=>{ee("files"),O("/"+e)},className:ve("files"===q&&I==="/"+e),children:[je("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__ */L("span",{className:"truncate",children:e})]},e)),!F&&/* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:ve("trash"===q),children:[je("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"]}),ae&&ae.folders.length>0&&/* @__PURE__ */D(E,{children:[
14
+ /* @__PURE__ */L("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ae.folders.map(e=>/* @__PURE__ */D("button",{onClick:()=>ee({desktopFolderId:e.id}),className:ve(ne===e.id),children:[
15
+ /* @__PURE__ */L(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
+ /* @__PURE__ */L("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */L("span",{className:"ml-auto text-2xs text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
17
+ return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{F||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),oe.current++,_||Y(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{oe.current>0&&oe.current--,0===oe.current&&Y(!1)},onDrop:e=>{e.preventDefault(),ye(),F||"object"==typeof q||e.dataTransfer.files?.length&&ge(e.dataTransfer.files)},children:[
18
+ /* @__PURE__ */L(x,{title:se?`Files - ${se.name}`:"Files"+("/"===I?"":" - "+I)}),
19
+ /* @__PURE__ */L(s,{app:"files"}),
20
+ /* @__PURE__ */L("input",{ref:le,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ge(e.target.files),le.current&&(le.current.value="")}}),
21
+ /* @__PURE__ */L("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */L(t,{sidebar:$e,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */D("div",{className:"flex h-full min-w-0 flex-col",children:[
22
+ /* @__PURE__ */D("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */D(E,"files"===q?{children:[
23
+ /* @__PURE__ */L("button",{onClick:()=>O(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(I)),disabled:"/"===I,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
24
+ /* @__PURE__ */L("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */L(r,{items:we,maxItems:5})}),
25
+ /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */L(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!F&&/* @__PURE__ */D(E,{children:[
26
+ /* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
27
+ /* @__PURE__ */L(k,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
28
+ /* @__PURE__ */D("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void b.error("Folder names cannot contain slashes");const t=S(I,e),r=await he(`${P}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Create folder failed (${r.status})`)}ue(I)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
29
+ /* @__PURE__ */L(k,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
30
+ /* @__PURE__ */D("button",{onClick:()=>le.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
31
+ /* @__PURE__ */L(k,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===q?{children:[
32
+ /* @__PURE__ */L("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
33
+ /* @__PURE__ */L("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
34
+ /* @__PURE__ */L("button",{onClick:fe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */L(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
35
+ /* @__PURE__ */L("button",{onClick:async()=>{if(0===te.length)return;if(!await g({title:"Empty trash",message:`${te.length} item${1===te.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await he(`${P}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Empty trash failed (${e.status})`)}fe()},disabled:0===te.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:[
36
+ /* @__PURE__ */L("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
37
+ /* @__PURE__ */L(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
38
+ /* @__PURE__ */L("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
39
+ /* @__PURE__ */L("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),X&&/* @__PURE__ */D(E,{children:[
40
+ /* @__PURE__ */L("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
+ /* @__PURE__ */D("div",{className:"flex items-center gap-2",title:`${a(X.used)} of ${a(X.limit)} used`,children:[
42
+ /* @__PURE__ */L("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */L("div",{className:`h-full ${Ne} transition-all`,style:{width:`${ke}%`}})}),
43
+ /* @__PURE__ */D("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[a(X.used)," / ",a(X.limit)]})]})]})]}),
44
+ /* @__PURE__ */L("div",{className:"flex-1 overflow-auto",children:"object"==typeof q?0===ie.length?/* @__PURE__ */L("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__ */D("table",{className:"w-full text-sm",children:[
45
+ /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
46
+ /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
47
+ /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
48
+ /* @__PURE__ */L("th",{className:`${w} w-56`})]})}),
49
+ /* @__PURE__ */L("tbody",{children:ie.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
50
+ return D("tr",{onClick:()=>B(t),onDoubleClick:()=>me(e),className:"cursor-default border-b border-gray-100 "+(K===t?"bg-blue-50":"hover:bg-gray-50"),children:[
51
+ /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:[
52
+ /* @__PURE__ */L(p,{item:e}),
53
+ /* @__PURE__ */L("span",{className:"truncate",title:e.label,children:e.label})]}),
54
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-xs text-gray-500",children:u(e)}),
55
+ /* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
56
+ /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),me(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
57
+ /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),ae?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Move to desktop"}),
58
+ /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),ae?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?G&&0===te.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
59
+ /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
60
+ /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
61
+ /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Original location"}),
62
+ /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
63
+ /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-40`,children:"Deleted"}),
64
+ /* @__PURE__ */L("th",{className:`${w} w-44`})]})}),
65
+ /* @__PURE__ */L("tbody",{children:te.map(e=>/* @__PURE__ */D("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
66
+ /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */L(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */L(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
67
+ /* @__PURE__ */L("span",{className:"truncate",title:e.name,children:e.name})]}),
68
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
69
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:a(e.size)}),
70
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:e.deletedAt?M(e.deletedAt):"—"}),
71
+ /* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
72
+ /* @__PURE__ */L("button",{onClick:()=>(async e=>{const t=await he(`${P}/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 b.error(e.error||`Restore failed (${t.status})`)}b.success(`Restored "${e.name}"`),fe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
73
+ /* @__PURE__ */L("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 he(`${P}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${t.status})`)}fe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):G&&0===U.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===U.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!F&&/* @__PURE__ */D(E,{children:[" Drop files here or click ",
74
+ /* @__PURE__ */L("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
75
+ /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
76
+ /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
77
+ /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
78
+ /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
79
+ /* @__PURE__ */L("th",{className:`${w} w-32`})]})}),
80
+ /* @__PURE__ */L("tbody",{children:U.map(t=>/* @__PURE__ */D("tr",{onClick:()=>B(t.name),onDoubleClick:()=>{"folder"===t.kind?O(S(I,t.name)):(async t=>{if(F)return;const r=S(I,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=W[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>ce(e)}):xe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(K===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
+ /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */L(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */L(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
82
+ /* @__PURE__ */L("span",{className:"truncate",title:t.name,children:t.name})]}),
83
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":a(t.size)}),
84
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:M(t.modifiedAt)}),
85
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!F&&/* @__PURE__ */D(E,{children:["file"===t.kind&&/* @__PURE__ */L("button",{onClick:e=>{e.stopPropagation(),xe(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs",children:"Download"}),
86
+ /* @__PURE__ */L("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void b.error("Names cannot contain slashes");const r=S(I,e.name),a=S(I,t),n=await he(`${P}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:r,to:a})});if(!n.ok){const e=await n.json().catch(()=>({}));return void b.error(e.error||`Rename failed (${n.status})`)}ue(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
87
+ /* @__PURE__ */L("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=S(I,e.name),r=await he(`${P}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${r.status})`)}ue(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__ */L("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__ */L("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{P as default};