efficient-shell 4.160.0 → 4.162.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 (67) hide show
  1. package/README.md +22 -4
  2. package/dist/{Browser-3KOGROX7.js → Browser-TNUODLDN.js} +25 -25
  3. package/dist/Calculator-HHPPI72V.js +29 -0
  4. package/dist/ConfirmDialog-D46T6ZXW.js +1 -0
  5. package/dist/{CurrencyConverter-3GTKDKHH.js → CurrencyConverter-4XKRUO7Y.js} +6 -6
  6. package/dist/{Documents-FDGF7QBQ.js → Documents-VYDMJL37.js} +6 -6
  7. package/dist/{Files-TTSYOPVB.js → Files-D3D6JWSJ.js} +28 -28
  8. package/dist/{Notepad-ITHIATP2.js → Notepad-CBJIS3WA.js} +10 -10
  9. package/dist/PdfViewer-UEMING6A.js +1 -0
  10. package/dist/{PomodoroTimer-CRKL26PP.js → PomodoroTimer-PB6J2LMS.js} +18 -18
  11. package/dist/{Preview-GZTTEZWS.js → Preview-O2UZROZO.js} +17 -17
  12. package/dist/{Sidebar-ECJEQXFK.js → Sidebar-PPC3OK4H.js} +36 -36
  13. package/dist/Spreadsheet-AYV4CQP3.js +37 -0
  14. package/dist/{Stock-NAHSVLAJ.js → Stock-FGJ5HQ7H.js} +4 -4
  15. package/dist/{Weather-AY3QWBQT.js → Weather-FW3WWYCI.js} +21 -21
  16. package/dist/{WorldClock-AXNMA4PG.js → WorldClock-UC4CXE2N.js} +6 -6
  17. package/dist/apps/index.js +1 -1
  18. package/dist/brand.css +1 -1
  19. package/dist/{chunk-A6FPBD7W.js → chunk-2S73NE3L.js} +1 -1
  20. package/dist/{chunk-UPI2GKKD.js → chunk-4SQNYTO3.js} +12 -12
  21. package/dist/{chunk-XN76YBX3.js → chunk-4VMA4ALC.js} +8 -8
  22. package/dist/chunk-5A7MWTXX.js +1 -0
  23. package/dist/{chunk-HQTSPK5Q.js → chunk-5UNSI4UI.js} +1 -1
  24. package/dist/{chunk-LCB4IVEL.js → chunk-6CKRJ4YK.js} +250 -250
  25. package/dist/chunk-6KO2U66R.js +3 -0
  26. package/dist/chunk-6WLGERBO.js +27 -0
  27. package/dist/{chunk-26RS37FG.js → chunk-7EACKL5V.js} +1 -1
  28. package/dist/{chunk-HF4IZFFX.js → chunk-7ESGXPKN.js} +11 -11
  29. package/dist/{chunk-FHIF6IUV.js → chunk-A2FL26TE.js} +1 -1
  30. package/dist/{chunk-KZPQW6UL.js → chunk-C2A4PIGZ.js} +2 -2
  31. package/dist/chunk-DSSLOQDW.js +2 -0
  32. package/dist/{chunk-VNEH2Y6H.js → chunk-DYVN6C2E.js} +3 -3
  33. package/dist/{chunk-XPSADW6W.js → chunk-EU3AQ4B2.js} +1 -1
  34. package/dist/{chunk-B2TBCVHH.js → chunk-EYU4IAEZ.js} +1 -1
  35. package/dist/{chunk-PDTZTADH.js → chunk-GBL5KOGP.js} +17 -17
  36. package/dist/{chunk-T6MKFQRH.js → chunk-GTQJYE6M.js} +6 -6
  37. package/dist/chunk-HQLEQIMG.js +21 -0
  38. package/dist/{chunk-JGHRZYNV.js → chunk-ILTSTULF.js} +1 -1
  39. package/dist/chunk-LQVXGB7A.js +1 -0
  40. package/dist/{chunk-KASHUEJV.js → chunk-O46U4PVN.js} +4 -4
  41. package/dist/chunk-S2PS4IOT.js +2 -0
  42. package/dist/{chunk-ZJ66QFOH.js → chunk-S6ZIQSAF.js} +1 -1
  43. package/dist/{chunk-36QR65KW.js → chunk-STJVLCQU.js} +2 -2
  44. package/dist/chunk-UZUH5PVW.js +1 -0
  45. package/dist/chunk-ZWYKMIX7.js +112 -0
  46. package/dist/file-intake/index.js +1 -1
  47. package/dist/{index-Brl0XepS.d.ts → index-DYVoKNru.d.ts} +86 -3
  48. package/dist/index.d.ts +47 -10
  49. package/dist/index.js +645 -645
  50. package/dist/map/index.js +2 -2
  51. package/dist/page-tabs/index.d.ts +9 -1
  52. package/dist/page-tabs/index.js +5 -5
  53. package/dist/pdf/index.js +1 -1
  54. package/dist/ui/index.d.ts +1 -1
  55. package/dist/ui/index.js +1 -1
  56. package/package.json +1 -1
  57. package/dist/Calculator-QLJJ3ICT.js +0 -29
  58. package/dist/ConfirmDialog-7Q2OOU4W.js +0 -1
  59. package/dist/PdfViewer-VIT7Y55M.js +0 -1
  60. package/dist/Spreadsheet-PFKZTLSI.js +0 -37
  61. package/dist/chunk-6UXY7MPY.js +0 -2
  62. package/dist/chunk-GF2XCISN.js +0 -1
  63. package/dist/chunk-JK3IIJN5.js +0 -22
  64. package/dist/chunk-VRW5JNMR.js +0 -18
  65. package/dist/chunk-VVI77XNV.js +0 -1
  66. package/dist/chunk-X6E6UULK.js +0 -113
  67. package/dist/chunk-YKZGKYVT.js +0 -2
package/README.md CHANGED
@@ -261,8 +261,13 @@ values predate the labels and are kept so nobody's choice resets).
261
261
  - **Sidebar**: the frame the routed portals use (`efficient-shell/page-tabs`)
262
262
  — a menu rail down the left, 240px or collapsed to its icons, and a strip
263
263
  of tabs along the top, one per open window, in the taskbar's place. Every
264
- window is a full-size tab with a slim page header (title, window menu,
265
- record keys); the tab's × closes it, through its unsaved-changes guard.
264
+ window is a full-size tab, and the tab is its title bar: it names the
265
+ window, copies its number (the title's `CopyButton`), opens its window menu
266
+ (click the tab's icon; right-click lists the window's own entries) and
267
+ closes it through its unsaved-changes guard. Nothing under the strip says
268
+ the title again. What the tab cannot hold — the title's badges and buttons,
269
+ and the record keys — sits in a slim record bar, and a window with none of
270
+ that gets no bar (`splitTitle` decides which piece goes where).
266
271
  Copies of a page are separate tabs, widgets and utility apps float over the
267
272
  page, and dialogs a window opens stay above their own tab. Esc does not
268
273
  close a tab. ⌘K also finds pages by name, which is what the rail's search
@@ -533,13 +538,14 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
533
538
  | `MediaUploadGrid` | The gallery sibling: thumbnails, an Add tile, per-thumb remove, drag-and-keyboard reorder, optional cover badge. `onFiles` receives EVERY file of a multi-file drop or dialog pick; `onPick` defers to a library picker. `maxFiles` counts against the items held. |
534
539
  | `StartMenu` / `Desktop` / `WindowManagerProvider` | Used internally by `Layout`; rarely instantiated directly. |
535
540
  | `Modal`, `ModalActions`, `CopyButton`, `CancelButton` | Window primitive supporting standard / compact / widget styles. |
541
+ | `splitTitle(title)` | Splits a window or page title for the Sidebar layout's tab: `{ text, copy, accessories }` — the title's words for the tab (a badge's own text is not among them), the `CopyButton`'s text for the tab's copy icon, and every badge and control (any component, `button`, `a`, `select`, …) in title order for the record bar. Inline SVG is dropped. A badge drawn as a styled `<span>` counts as words, so draw badges with `StatusBadge` / `ColoredBadge`. |
536
542
  | `PopupMenu`, `PopupMenuItem`, `PopupMenuDivider`, `PopupMenuLabel`, `PopupSubmenu` | Right-click / context-menu primitive; `PopupSubmenu` is a row that opens a nested menu. |
537
543
  | `ShellContextMenu` | The shell-wide right-click menu, already mounted by `Layout` (`<Layout contextMenu={false}>` turns it off). Mount it yourself only on a screen rendered outside the layout. See [Right-click menu](#right-click-menu). |
538
544
  | `DropdownMenu` | A button and the menu it opens, right under it: actions, links (`href`, drawn by `linkAs`), radios, labels and dividers, with shared dismissal and the menu-button keyboard. `align` lines it up with the trigger's left or right edge; `side="top"` suits a trigger in a bottom action bar. See [Dropdown menus](#dropdown-menus). |
539
545
  | `Popover` | A button and the panel it opens, right under it, placed by `DropdownMenu`'s rule (left edges together, or right with `align="end"`, flipping and shifting to stay on screen and in its window, never wider than a phone allows): a non-modal `role="dialog"` named by `title` or `aria-label`, for check boxes, a date, a short form. A kit popup opened inside it (a `DatePicker`'s calendar, a `Select`'s list) does not close it. Focus moves in as it opens; Tab reads it as if it sat right after its trigger; Escape closes it and gives focus back. See [Popovers](#popovers). |
540
546
  | `Dialog`, `Drawer` | A modal sheet that is not a shell window — centred (`Dialog`) or pinned to an edge (`Drawer`, `side` right / left / bottom) — for a till, a routed page or a form: trapped focus, a locked page, Escape and a backdrop click to close (`blocking` turns both off), a close cross when there is no `footer`. A `Dialog` is never taller than the screen less its gutter: a longer form — on a phone, most of them — scrolls inside the panel, footer included, and a footer wider than the panel wraps. `title` names it; `description` is a line under the title that DESCRIBES it to a screen reader — without one the body does, which suits a confirm whose body is the question and not a form, whose every label would be read out. `role="alertdialog"` (Dialog) for a confirmation that interrupts. A heading or note that lives in the body — a form that loads the record its heading names — names and describes it through `aria-labelledby` / `aria-describedby`. Two open at once — the second inside the first, or beside it on `<body>` where a host portals its dialogs — each hold focus, and only the one in front moves Tab (`useFocusTrap` keeps a stack). |
541
547
  | `ConfirmProvider`, `confirm` | Imperative `confirm({ title, body })` returning a Promise<boolean>. |
542
- | `GlobalSearch` | Cmd-K command palette. Pass `providers: SearchProvider[]` to add results; a provider is called `(query, { signal })` and the `signal` aborts when a newer query, closing the palette or unmount supersedes the call, so pass it to the request. Only the latest query's response is shown, whether or not a provider honours the signal. A result whose `entity_type` is `__page__` opens a page; an `entity_id` of `/path?search=text` (URL-encoded) opens that page's list with its search box filled in. Portalled to `<body>` on the overlay layer (`Z_LAYERS.overlay`), so it covers every window, pinned or not; opening it closes any open popup (`dismissPopups`). |
548
+ | `GlobalSearch` | Cmd-K command palette. Pass `providers: SearchProvider[]` to add results; a provider is called `(query, { signal })` and the `signal` aborts when a newer query, closing the palette or unmount supersedes the call, so pass it to the request. Only the latest query's response is shown, whether or not a provider honours the signal. A result whose `entity_type` is `__page__` opens a page; an `entity_id` of `/path?search=text` (URL-encoded) opens that page's list with its search box filled in. Portalled to `<body>` on the overlay layer (`Z_LAYERS.overlay`), so it covers every window, pinned or not; opening it closes any open popup (`dismissPopups`). Results are grouped under a header per `result.type` (with a count), in the order each type first appears in the merged responses — providers answer best match first, so the group holding an exact match leads. ↑/↓ run through every row across groups, Tab / Shift+Tab jump to the first row of the next / previous group, Enter opens; the input is an ARIA combobox over a listbox with `role="group"` sections. With fewer than two characters typed it shows an empty state instead: **Recent** (the last 8 results picked, most recent first, deduplicated by `entity_type` + `entity_id`), **Favorites** and **Actions** — each section only when it has rows. `recent` + `onRecord` and `favorites` are props, so a routed app that passes none gets no Recent / Favorites (`pushRecentSearch(recent, picked)` keeps the list for it); `Layout` passes them from the user's preferences (`search_recent`, `favorite_documents`). Picking a result or a Recent row calls `onRecord(result)` then `onSelect(result)`; picking a Favorite or an Action does not record. **While searching**, the previous answer's rows stay drawn (with a spinner in the input row) until the next one lands; "Searching…" shows only when there is nothing to draw yet. **Failures are not "no results"**: an aborted call is silent, but a provider that rejects marks the search failed — every provider down shows `strings.search.searchFailed` instead of "No results", some down shows the rows that arrived plus a one-line `partialFailure` warning. **"See all"**: a provider may answer `SearchResult[]` or a `SearchResponse` (`{ results, truncatedTypes? }`); a group whose type is in `truncatedTypes` counts as "5+", and when `SearchConfig.listRoutes` maps its type to a `SearchListRoute` (`{ path, label }`, label the plural the consumer names its list by, e.g. `customers`) it ends in a "See all {label}" row that calls `onSelect` with a `__page__` result for `${path}?search=${encodeURIComponent(query)}` (so the page must read `usePageSearch()`); it is never recorded in Recent, and a group that is not truncated gets neither the "+" nor the row. `SearchConfig.quickActions` (`{ label, icon?, keywords?, onSelect }[]`) are the Actions: always in the empty state, and in a typed search an "Actions" group at the end for those whose label or keywords contain the query. |
543
549
  | `ShortcutHelp` | The keyboard cheatsheet shown on `?`. |
544
550
  | `NotificationBell` | Taskbar bell — config via `<Layout notifications={…}>`. |
545
551
  | `BugReportDetail` | Used inside an entity-window registry entry; reads from `<BugReportConfigProvider>`. |
@@ -1619,7 +1625,7 @@ with sample arguments.
1619
1625
 
1620
1626
  </details>
1621
1627
 
1622
- <details><summary><code>search</code> — 10 keys</summary>
1628
+ <details><summary><code>search</code> — 21 keys</summary>
1623
1629
 
1624
1630
  | Key | Type | English default |
1625
1631
  |---|---|---|
@@ -1633,6 +1639,17 @@ with sample arguments.
1633
1639
  | `close` | `string` | `close` |
1634
1640
  | `enterKey` | `string` | `Enter` |
1635
1641
  | `escKey` | `string` | `Esc` |
1642
+ | `recent` | `string` | `Recent` |
1643
+ | `favorites` | `string` | `Favorites` |
1644
+ | `actions` | `string` | `Actions` |
1645
+ | `listLabel` | `string` | `Search results` |
1646
+ | `groupCount` | `(count: number, more: boolean) => string` | `3` (`3+` when `more`) |
1647
+ | `groupLabel` | `(title: string, count: number, more: boolean) => string` | `Sales Order, 3` (`Sales Order, 3+` when `more`) |
1648
+ | `seeAll` | `(listLabel: string) => string` | `See all sales orders` |
1649
+ | `searchFailed` | `string` | `Search failed — check your connection and try again.` |
1650
+ | `partialFailure` | `string` | `Some results could not be loaded.` |
1651
+ | `tabKey` | `string` | `Tab` |
1652
+ | `nextGroup` | `string` | `next group` |
1636
1653
 
1637
1654
  </details>
1638
1655
 
@@ -2082,6 +2099,7 @@ cleaned up until it is shown again; on React 18 it is only hidden.
2082
2099
  | `PageTabsOutlet` | Renders `children(location)` once per open tab. The frame is the page's scroll container; scroll positions inside it come back with the tab. |
2083
2100
  | `usePageTabTitle(title)` | Name this page's tab (a record's number once loaded). |
2084
2101
  | `usePageTabDirty(dirty)` | Mark unsaved changes: closing asks first, and so does a reload. |
2102
+ | `usePageTabCopy(text)` | Give this page's tab a copy icon for the record's number, shown while the tab is active — the tab is the page's title bar. |
2085
2103
  | `usePageTab()` | `{ key, close({ to, force }) }` — a form that created its record closes itself and goes to it. |
2086
2104
  | `usePageTabs()` | The strip, from outside any one page. |
2087
2105
 
@@ -1,43 +1,43 @@
1
- import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-A6FPBD7W.js";import"./chunk-GF2XCISN.js";import{WindowTitle as r}from"./chunk-X6E6UULK.js";import"./chunk-T6MKFQRH.js";import"./chunk-6UXY7MPY.js";import"./chunk-PH3PRIFP.js";import{confirm as n}from"./chunk-PDTZTADH.js";import"./chunk-VNEH2Y6H.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-VVI77XNV.js";import"./chunk-D65T4H6J.js";import{useRef as a,useEffect as i,useState as l}from"react";import{jsxs as s,jsx as c,Fragment as m}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",u="react-os-shell:browser-homepage",h="https://en.wikipedia.org/wiki/Main_Page",p=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=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 b(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&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["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 f(){if("undefined"==typeof window)return p;try{const e=localStorage.getItem(d);if(!e)return p;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return p}function x(){return"undefined"==typeof window?h:localStorage.getItem(u)||h}function w(){const m=a(void 0);void 0===m.current&&(m.current=e()),i(()=>{null!=m.current&&t(m.current)},[]);const h=m.current?b(m.current.url):"",[p,g]=l(x),[k,w]=l(h||p),[N,L]=l(k),[C,j]=l([k]),[z,M]=l(0),[H,W]=l(0),[S,B]=l(f),[R,A]=l(!1),[D,E]=l(null),P=a(null),T=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(S))}catch{}},[S]);const I=e=>{const t=b(e);t&&(w(t),L(t),j(e=>{const o=e.slice(0,z+1);return o.push(t),o}),M(e=>e+1),A(!1))},F=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},U=()=>{const e=D?.trim();e?(B(t=>[...t,{label:e,url:k}]),E(null)):E(null)};i(()=>{if(null===D)return;P.current?.focus(),P.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||E(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==D]);const V=e=>{B(t=>t.filter((t,o)=>o!==e))},O=z>0,q=z<C.length-1,X=S.some(e=>e.url===k),K="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
- return s("div",{className:"relative flex flex-col h-full bg-white",children:[
1
+ import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-2S73NE3L.js";import"./chunk-LQVXGB7A.js";import{WindowTitle as r}from"./chunk-ZWYKMIX7.js";import"./chunk-GTQJYE6M.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-PH3PRIFP.js";import"./chunk-6KO2U66R.js";import{confirm as n}from"./chunk-GBL5KOGP.js";import"./chunk-DYVN6C2E.js";import"./chunk-D65T4H6J.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-UZUH5PVW.js";import{useRef as a,useEffect as i,useState as s}from"react";import{jsxs as l,jsx as c,Fragment as m}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",u="react-os-shell:browser-homepage",h="https://en.wikipedia.org/wiki/Main_Page",p=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=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 b(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&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["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 f(){if("undefined"==typeof window)return p;try{const e=localStorage.getItem(d);if(!e)return p;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return p}function x(){return"undefined"==typeof window?h:localStorage.getItem(u)||h}function w(){const m=a(void 0);void 0===m.current&&(m.current=e()),i(()=>{null!=m.current&&t(m.current)},[]);const h=m.current?b(m.current.url):"",[p,g]=s(x),[k,w]=s(h||p),[N,L]=s(k),[j,C]=s([k]),[z,M]=s(0),[W,S]=s(0),[B,H]=s(f),[R,A]=s(!1),[E,D]=s(null),O=a(null),P=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(B))}catch{}},[B]);const T=e=>{const t=b(e);t&&(w(t),L(t),C(e=>{const o=e.slice(0,z+1);return o.push(t),o}),M(e=>e+1),A(!1))},I=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},U=()=>{const e=E?.trim();e?(H(t=>[...t,{label:e,url:k}]),D(null)):D(null)};i(()=>{if(null===E)return;O.current?.focus(),O.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||D(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==E]);const V=e=>{H(t=>t.filter((t,o)=>o!==e))},G=z>0,q=z<j.length-1,F=B.some(e=>e.url===k),K="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
+ return l("div",{className:"relative flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */c(r,{title:`Browser - ${v(k)}`}),
4
4
  /* @__PURE__ */c(o,{app:"browser"}),
5
- /* @__PURE__ */s("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
6
- /* @__PURE__ */c("button",{onClick:()=>{if(z>0){const e=z-1;M(e),w(C[e]),L(C[e]),A(!1)}},disabled:!O,className:K,title:"Back",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}),
7
- /* @__PURE__ */c("button",{onClick:()=>{if(z<C.length-1){const e=z+1;M(e),w(C[e]),L(C[e]),A(!1)}},disabled:!q,className:K,title:"Forward",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),
8
- /* @__PURE__ */c("button",{onClick:()=>W(e=>e+1),className:K,title:"Refresh",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
9
- /* @__PURE__ */c("button",{onClick:()=>I(p),className:K,title:"Home",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0l8.954 8.955M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"})})}),
10
- /* @__PURE__ */c("form",{onSubmit:e=>{e.preventDefault(),I(N)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */s("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:[
5
+ /* @__PURE__ */l("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
6
+ /* @__PURE__ */c("button",{onClick:()=>{if(z>0){const e=z-1;M(e),w(j[e]),L(j[e]),A(!1)}},disabled:!G,className:K,title:"Back",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}),
7
+ /* @__PURE__ */c("button",{onClick:()=>{if(z<j.length-1){const e=z+1;M(e),w(j[e]),L(j[e]),A(!1)}},disabled:!q,className:K,title:"Forward",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),
8
+ /* @__PURE__ */c("button",{onClick:()=>S(e=>e+1),className:K,title:"Refresh",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
9
+ /* @__PURE__ */c("button",{onClick:()=>T(p),className:K,title:"Home",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0l8.954 8.955M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"})})}),
10
+ /* @__PURE__ */c("form",{onSubmit:e=>{e.preventDefault(),T(N)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */l("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__ */c("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
12
12
  /* @__PURE__ */c("input",{type:"text",value:N,onChange:e=>L(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…"}),k!==N&&/* @__PURE__ */c("button",{type:"button",onClick:()=>L(k),className:"px-1.5 text-[10px] text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
13
- /* @__PURE__ */c("button",{"data-bookmark-popover":!0,onClick:()=>X?V(S.findIndex(e=>e.url===k)):void E(v(k)),className:K+" "+(X?"text-yellow-500":""),title:X?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:X?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),
14
- /* @__PURE__ */c("button",{onClick:F,className:K,title:"Open in new tab",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-7.5-9L21 3m0 0v6m0-6L9.75 14.25"})})}),
15
- /* @__PURE__ */c("button",{onClick:()=>A(e=>!e),className:K,title:"Embedding help",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})})]}),null!==D&&/* @__PURE__ */s("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__ */c("button",{"data-bookmark-popover":!0,onClick:()=>F?V(B.findIndex(e=>e.url===k)):void D(v(k)),className:K+" "+(F?"text-yellow-500":""),title:F?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:F?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),
14
+ /* @__PURE__ */c("button",{onClick:I,className:K,title:"Open in new tab",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-7.5-9L21 3m0 0v6m0-6L9.75 14.25"})})}),
15
+ /* @__PURE__ */c("button",{onClick:()=>A(e=>!e),className:K,title:"Embedding help",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})})]}),null!==E&&/* @__PURE__ */l("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__ */c("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
17
17
  /* @__PURE__ */c("div",{className:"text-[11px] text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
18
- /* @__PURE__ */c("input",{ref:P,type:"text",value:D,onChange:e=>E(e.target.value),onKeyDown:e=>{"Enter"===e.key?U():"Escape"===e.key&&E(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
- /* @__PURE__ */s("div",{className:"flex justify-end gap-1 mt-2",children:[
20
- /* @__PURE__ */c("button",{onClick:()=>E(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
- /* @__PURE__ */c("button",{onClick:U,disabled:!D.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__ */s("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===S.length&&/* @__PURE__ */c("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),S.map((e,t)=>/* @__PURE__ */s("button",{onClick:()=>I(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"})&&V(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
18
+ /* @__PURE__ */c("input",{ref:O,type:"text",value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key?U():"Escape"===e.key&&D(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
+ /* @__PURE__ */l("div",{className:"flex justify-end gap-1 mt-2",children:[
20
+ /* @__PURE__ */c("button",{onClick:()=>D(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
+ /* @__PURE__ */c("button",{onClick:U,disabled:!E.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__ */l("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===B.length&&/* @__PURE__ */c("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),B.map((e,t)=>/* @__PURE__ */l("button",{onClick:()=>T(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"})&&V(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
23
23
  /* @__PURE__ */c("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__ */c("div",{className:"flex-1"}),
25
25
  /* @__PURE__ */c("button",{onClick:()=>{g(k);try{localStorage.setItem(u,k)}catch{}},className:"px-2 py-0.5 text-[11px] text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
26
- /* @__PURE__ */c("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */c(y,{url:k,iframeKey:H,iframeRef:T,openExternal:F,showHelp:R,dismissHelp:()=>A(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function y({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,u]=l(!1);i(()=>{u(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */c("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */s("div",{className:"max-w-md text-center",children:[
26
+ /* @__PURE__ */c("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */c(y,{url:k,iframeKey:W,iframeRef:P,openExternal:I,showHelp:R,dismissHelp:()=>A(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function y({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,u]=s(!1);i(()=>{u(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */c("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */l("div",{className:"max-w-md text-center",children:[
27
27
  /* @__PURE__ */c("svg",{className:"h-14 w-14 mx-auto text-gray-300 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728L5.636 5.636m12.728 12.728L21 21M5.636 5.636L3 3m9 9a9 9 0 110-18 9 9 0 010 18z"})}),
28
- /* @__PURE__ */s("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
29
- /* @__PURE__ */s("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
28
+ /* @__PURE__ */l("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
29
+ /* @__PURE__ */l("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
30
30
  /* @__PURE__ */c("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
31
31
  /* @__PURE__ */c("span",{className:"font-mono text-xs",children:"Content-Security-Policy"})," header that refuses iframe embedding. The browser blocks the load before our app can do anything about it."]}),
32
- /* @__PURE__ */s("div",{className:"flex flex-col items-center gap-2",children:[
33
- /* @__PURE__ */s("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 inline-flex items-center gap-2",children:[
32
+ /* @__PURE__ */l("div",{className:"flex flex-col items-center gap-2",children:[
33
+ /* @__PURE__ */l("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 inline-flex items-center gap-2",children:[
34
34
  /* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-7.5-9L21 3m0 0v6m0-6L9.75 14.25"})}),"Open in a new tab"]}),
35
- /* @__PURE__ */c("button",{onClick:()=>u(!0),className:"text-xs text-gray-500 hover:text-gray-800 underline",children:"Try loading it here anyway"})]})]})}):/* @__PURE__ */s(m,{children:[
36
- /* @__PURE__ */c("iframe",{ref:o,src:e,className:"absolute inset-0 w-full h-full bg-white",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals",referrerPolicy:"no-referrer-when-downgrade"},t+e),n&&/* @__PURE__ */s("div",{className:"absolute top-2 right-2 max-w-sm bg-white border border-gray-200 rounded-md shadow-lg p-3 text-xs text-gray-700 z-10",children:[
35
+ /* @__PURE__ */c("button",{onClick:()=>u(!0),className:"text-xs text-gray-500 hover:text-gray-800 underline",children:"Try loading it here anyway"})]})]})}):/* @__PURE__ */l(m,{children:[
36
+ /* @__PURE__ */c("iframe",{ref:o,src:e,className:"absolute inset-0 w-full h-full bg-white",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals",referrerPolicy:"no-referrer-when-downgrade"},t+e),n&&/* @__PURE__ */l("div",{className:"absolute top-2 right-2 max-w-sm bg-white border border-gray-200 rounded-md shadow-lg p-3 text-xs text-gray-700 z-10",children:[
37
37
  /* @__PURE__ */c("div",{className:"font-medium text-gray-900 mb-1",children:"Why is this page blank?"}),
38
- /* @__PURE__ */s("p",{className:"mb-2",children:["Most major sites (Google, GitHub, banks, news) refuse to be embedded in an iframe via ",
38
+ /* @__PURE__ */l("p",{className:"mb-2",children:["Most major sites (Google, GitHub, banks, news) refuse to be embedded in an iframe via ",
39
39
  /* @__PURE__ */c("span",{className:"font-mono",children:"X-Frame-Options"})," or Content Security Policy. There's no workaround — the browser blocks the load before our app can do anything."]}),
40
- /* @__PURE__ */s("p",{children:["Hit the ",
40
+ /* @__PURE__ */l("p",{children:["Hit the ",
41
41
  /* @__PURE__ */c("span",{className:"font-medium",children:"↗"})," button to open the page in a real new tab. Sites that ",
42
42
  /* @__PURE__ */c("em",{children:"do"})," allow embedding (Wikipedia, DevDocs, your own apps) work fine in here."]}),
43
43
  /* @__PURE__ */c("button",{onClick:a,className:"mt-2 text-[11px] text-blue-600 hover:underline",children:"Got it"})]})]})}export{w as default};
@@ -0,0 +1,29 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-EU3AQ4B2.js";import{useWidgetSettings as n}from"./chunk-ZWYKMIX7.js";import"./chunk-GTQJYE6M.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-PH3PRIFP.js";import"./chunk-6KO2U66R.js";import"./chunk-GBL5KOGP.js";import"./chunk-DYVN6C2E.js";import"./chunk-D65T4H6J.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-UZUH5PVW.js";import{useState as r,useRef as l,useCallback as o,useEffect as i}from"react";import{jsxs as a,Fragment as c,jsx as s}from"react/jsx-runtime";var u="calc_appearance";function d(){const[d,h]=r("0"),[m,b]=r(null),[k,g]=r(null),[p,v]=r(!1),[x,y]=r(""),[f,N]=r([]),[C,$]=r(!1),[j,w]=r(()=>e(u)),[E,S]=r(!1),[L,T]=r(j),W=l(null);n(o(()=>{T({...j}),S(!0)},[j]));const B=o(e=>{y(""),h(t=>p||"0"===t?(v(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[p]),A=o(()=>{h("0"),b(null),g(null),v(!1)},[]),D=o((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}},[]),F=o(e=>{const t=parseFloat(d);if(null!==m&&k&&!p){const e=D(m,t,k);h(String(e)),b(e),N(n=>[`${m} ${k} ${t} = ${e}`,...n].slice(0,20))}else b(t);g(e),v(!0)},[d,m,k,p,D]),M=o(()=>{if(null===m||!k)return;const e=parseFloat(d),t=D(m,e,k),n=`${m} ${k} ${e} =`;N(e=>[`${n} ${t}`,...e].slice(0,20)),y(n),h(String(t)),b(null),g(null),v(!0)},[d,m,k,D]),O=o(()=>{h(e=>String(parseFloat(e)/100))},[]),P=o(()=>{h(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);i(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?B(e.key):"."===e.key?B("."):"+"===e.key?F("+"):"-"===e.key?F("-"):"*"===e.key?F("×"):"/"===e.key?(e.preventDefault(),F("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&W.current?.contains(e.target)&&e.preventDefault(),M()):"Escape"===e.key?A():"Backspace"===e.key?h(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&O())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[B,F,M,A,O]);const H="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",I=`${H} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,U=`${H} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,J=`${H} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,X=`${H} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
+ return a(c,{children:[
3
+ /* @__PURE__ */a("div",{ref:W,className:"flex flex-col h-full",style:{opacity:j.activeOpacity/100,backdropFilter:j.activeBlur>0?`blur(${j.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */a("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__ */s("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:f.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */s("div",{className:"text-[11px] text-slate-400 text-right font-mono truncate",children:e},t))}),(x||k&&null!==m)&&/* @__PURE__ */s("div",{className:"text-base text-slate-600 text-right font-mono",children:x||`${m} ${k} ${p?"":d}`}),
6
+ /* @__PURE__ */a("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */s("button",{onClick:()=>{navigator.clipboard.writeText(d),$(!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__ */s("svg",C?{className:"h-5 w-5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}:{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),
8
+ /* @__PURE__ */s("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)})(d)})]})]}),
9
+ /* @__PURE__ */a("div",{className:"grid grid-cols-4 grid-rows-5 gap-1.5 flex-1 min-h-0 p-2",children:[
10
+ /* @__PURE__ */s("button",{onClick:A,className:J,children:"AC"}),
11
+ /* @__PURE__ */s("button",{onClick:P,className:J,children:"+/−"}),
12
+ /* @__PURE__ */s("button",{onClick:O,className:J,children:"%"}),
13
+ /* @__PURE__ */s("button",{onClick:()=>F("÷"),className:`${U} ${"÷"===k?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */s("button",{onClick:()=>B("7"),className:I,children:"7"}),
15
+ /* @__PURE__ */s("button",{onClick:()=>B("8"),className:I,children:"8"}),
16
+ /* @__PURE__ */s("button",{onClick:()=>B("9"),className:I,children:"9"}),
17
+ /* @__PURE__ */s("button",{onClick:()=>F("×"),className:`${U} ${"×"===k?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */s("button",{onClick:()=>B("4"),className:I,children:"4"}),
19
+ /* @__PURE__ */s("button",{onClick:()=>B("5"),className:I,children:"5"}),
20
+ /* @__PURE__ */s("button",{onClick:()=>B("6"),className:I,children:"6"}),
21
+ /* @__PURE__ */s("button",{onClick:()=>F("-"),className:`${U} ${"-"===k?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */s("button",{onClick:()=>B("1"),className:I,children:"1"}),
23
+ /* @__PURE__ */s("button",{onClick:()=>B("2"),className:I,children:"2"}),
24
+ /* @__PURE__ */s("button",{onClick:()=>B("3"),className:I,children:"3"}),
25
+ /* @__PURE__ */s("button",{onClick:()=>F("+"),className:`${U} ${"+"===k?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */s("button",{onClick:()=>B("0"),className:`${I} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */s("button",{onClick:()=>B("."),className:I,children:"."}),
28
+ /* @__PURE__ */s("button",{onClick:M,className:X,children:"="})]})]}),
29
+ /* @__PURE__ */s(t,{open:E,onClose:()=>S(!1),title:"Calculator Settings",appearance:L,onAppearanceChange:T,onSave:()=>{w(L),localStorage.setItem(u,JSON.stringify(L)),S(!1)}})]})}export{d as default};
@@ -0,0 +1 @@
1
+ export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-GBL5KOGP.js";import"./chunk-OSJ3ADF2.js";import"./chunk-UZUH5PVW.js";
@@ -1,7 +1,7 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-XPSADW6W.js";import{useWidgetSettings as r}from"./chunk-X6E6UULK.js";import"./chunk-T6MKFQRH.js";import"./chunk-6UXY7MPY.js";import"./chunk-PH3PRIFP.js";import"./chunk-PDTZTADH.js";import"./chunk-VNEH2Y6H.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-VVI77XNV.js";import"./chunk-D65T4H6J.js";import{useState as a,useCallback as n,useEffect as s}from"react";import{jsxs as c,Fragment as o,jsx as i}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],m=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],d="currency_pairs",u="currency_appearance",p="currency_rates_cache";function h(e){try{const t=JSON.parse(localStorage.getItem(p)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function g(e,t){try{const r=JSON.parse(localStorage.getItem(p)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(p,JSON.stringify(r))}catch{}}function x(){try{const e=JSON.parse(localStorage.getItem(d)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return m}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[m,p]=a(x),[f,N]=a(()=>e(u)),[b,v]=a({}),[S,D]=a(!1),[k,C]=a(!1),[j,U]=a([]),[A,H]=a(f),[P,B]=a("USD"),[I,J]=a("CNY");r(n(()=>{U([...m]),H({...f}),C(!0)},[m,f])),s(()=>{const e=[...new Set(m.map(([e])=>e))];let t=!0;return async function(){D(!0);const r={};for(const t of e){const e=h(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),a=await e.json();a.rates&&(r[t]=a.rates,g(t,a.rates))}catch{}}t&&(v(r),D(!1))}(),()=>{t=!1}},[m]);/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-EU3AQ4B2.js";import{useWidgetSettings as r}from"./chunk-ZWYKMIX7.js";import"./chunk-GTQJYE6M.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-PH3PRIFP.js";import"./chunk-6KO2U66R.js";import"./chunk-GBL5KOGP.js";import"./chunk-DYVN6C2E.js";import"./chunk-D65T4H6J.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-UZUH5PVW.js";import{useState as a,useCallback as n,useEffect as s}from"react";import{jsxs as c,Fragment as o,jsx as i}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],m=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],u="currency_pairs",d="currency_appearance",p="currency_rates_cache";function h(e){try{const t=JSON.parse(localStorage.getItem(p)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function g(e,t){try{const r=JSON.parse(localStorage.getItem(p)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(p,JSON.stringify(r))}catch{}}function x(){try{const e=JSON.parse(localStorage.getItem(u)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return m}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[m,p]=a(x),[f,N]=a(()=>e(d)),[b,v]=a({}),[S,D]=a(!1),[k,C]=a(!1),[j,U]=a([]),[B,A]=a(f),[J,I]=a("USD"),[O,P]=a("CNY");r(n(()=>{U([...m]),A({...f}),C(!0)},[m,f])),s(()=>{const e=[...new Set(m.map(([e])=>e))];let t=!0;return async function(){D(!0);const r={};for(const t of e){const e=h(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),a=await e.json();a.rates&&(r[t]=a.rates,g(t,a.rates))}catch{}}t&&(v(r),D(!1))}(),()=>{t=!1}},[m]);/* @__PURE__ */
2
2
  return c(o,{children:[
3
3
  /* @__PURE__ */i("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:[S&&/* @__PURE__ */i("div",{className:"text-xs text-gray-400 text-center py-4",children:"Loading rates..."}),m.map(([e,t],r)=>{const a=b[e]?.[t];/* @__PURE__ */
4
- return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);p(e),localStorage.setItem(d,JSON.stringify(e))},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:[
4
+ return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);p(e),localStorage.setItem(u,JSON.stringify(e))},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-1.5",children:[
6
6
  /* @__PURE__ */i("span",{className:"text-base",children:y[e]||""}),
7
7
  /* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:e}),
@@ -9,13 +9,13 @@ return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);p(e),l
9
9
  /* @__PURE__ */i("span",{className:"text-base",children:y[t]||""}),
10
10
  /* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
11
11
  /* @__PURE__ */i("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=a?a.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${e}-${t}-${r}`)})]})}),
12
- /* @__PURE__ */i(t,{open:k,onClose:()=>C(!1),title:"Currency Settings",appearance:A,onAppearanceChange:H,onSave:()=>{if(0===j.length)return;const e=j.slice(0,4);p(e),N(A),localStorage.setItem(d,JSON.stringify(e)),localStorage.setItem(u,JSON.stringify(A)),C(!1)},children:/* @__PURE__ */c("div",{children:[
12
+ /* @__PURE__ */i(t,{open:k,onClose:()=>C(!1),title:"Currency Settings",appearance:B,onAppearanceChange:A,onSave:()=>{if(0===j.length)return;const e=j.slice(0,4);p(e),N(B),localStorage.setItem(u,JSON.stringify(e)),localStorage.setItem(d,JSON.stringify(B)),C(!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
14
  /* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",j.length,"/",4,")"]})]}),
15
15
  /* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:j.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
16
  /* @__PURE__ */c("span",{className:"text-sm",children:[y[e]||""," ",e," → ",y[t]||""," ",t]}),
17
17
  /* @__PURE__ */i("button",{onClick:()=>U(e=>e.filter((e,t)=>t!==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__ */i("select",{value:P,onChange:e=>B(e.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:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
18
+ /* @__PURE__ */i("select",{value:J,onChange:e=>I(e.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:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
19
19
  /* @__PURE__ */i("span",{className:"text-gray-400",children:"→"}),
20
- /* @__PURE__ */i("select",{value:I,onChange:e=>J(e.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:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
21
- /* @__PURE__ */i("button",{onClick:()=>{P!==I&&j.length<4&&U(e=>[...e,[P,I]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-[11px] text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
20
+ /* @__PURE__ */i("select",{value:O,onChange:e=>P(e.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:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
21
+ /* @__PURE__ */i("button",{onClick:()=>{J!==O&&j.length<4&&U(e=>[...e,[J,O]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-[11px] text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
@@ -1,12 +1,12 @@
1
- import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-A6FPBD7W.js";import{toast_default as n}from"./chunk-B2TBCVHH.js";import"./chunk-GF2XCISN.js";import{WindowTitle as r}from"./chunk-X6E6UULK.js";import"./chunk-T6MKFQRH.js";import"./chunk-6UXY7MPY.js";import"./chunk-PH3PRIFP.js";import"./chunk-PDTZTADH.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-VNEH2Y6H.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-VVI77XNV.js";import"./chunk-D65T4H6J.js";import{useState as s,useRef as c}from"react";import{jsxs as d,jsx as h}from"react/jsx-runtime";var m=/* @__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"]),u=/* @__PURE__ */new Set(["docx"]),p={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function g(){const[g,x]=s(p),[f,y]=s(!1),[v,b]=s(!1),[k,w]=s(!1),[N,C]=s(null),D=c(null),j=c(null),L=c(null),M=(e,t)=>{L.current?.focus(),document.execCommand(e,!1,t),w(!0)},U=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{L.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),w(!0)},e.readAsDataURL(t)}},B=e=>{N&&(N.el.removeAttribute("width"),N.el.removeAttribute("height"),N.el.style.width=e??"",N.el.style.height=e?"auto":"",w(!0),C(null))},R=async t=>{const r=(t.name.split(".").pop()||"").toLowerCase();y(!0);try{if(m.has(r)||!u.has(r)&&t.type.startsWith("text/")){const n=await t.text(),o=e(n).replace(/\n/g,"<br>");x({filename:t.name,kind:"text",content:o,ext:r}),w(!1)}else if(u.has(r))try{const e=await(import(
1
+ import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-2S73NE3L.js";import{toast_default as n}from"./chunk-EYU4IAEZ.js";import"./chunk-LQVXGB7A.js";import{WindowTitle as r}from"./chunk-ZWYKMIX7.js";import"./chunk-GTQJYE6M.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-PH3PRIFP.js";import"./chunk-6KO2U66R.js";import"./chunk-GBL5KOGP.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-DYVN6C2E.js";import"./chunk-D65T4H6J.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-UZUH5PVW.js";import{useState as s,useRef as c}from"react";import{jsxs as d,jsx as h}from"react/jsx-runtime";var m=/* @__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"]),u=/* @__PURE__ */new Set(["docx"]),p={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function g(){const[g,x]=s(p),[f,y]=s(!1),[v,b]=s(!1),[k,w]=s(!1),[N,C]=s(null),j=c(null),D=c(null),L=c(null),M=(e,t)=>{L.current?.focus(),document.execCommand(e,!1,t),w(!0)},U=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{L.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),w(!0)},e.readAsDataURL(t)}},B=e=>{N&&(N.el.removeAttribute("width"),N.el.removeAttribute("height"),N.el.style.width=e??"",N.el.style.height=e?"auto":"",w(!0),C(null))},R=async t=>{const r=(t.name.split(".").pop()||"").toLowerCase();y(!0);try{if(m.has(r)||!u.has(r)&&t.type.startsWith("text/")){const n=await t.text(),o=e(n).replace(/\n/g,"<br>");x({filename:t.name,kind:"text",content:o,ext:r}),w(!1)}else if(u.has(r))try{const e=await(import(
2
2
  /* @vite-ignore */
3
- "mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});x({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),w(!1)}catch(e){n.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===r?n.error(".doc is the legacy Word binary format — convert to .docx first."):n.error(`Unsupported file type: .${r||"unknown"}`)}finally{y(!1)}},A=g?.filename?(T=g.filename).length>24?`${T.slice(0,23)}…`:T:"Untitled";var T;/* @__PURE__ */
3
+ "mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});x({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),w(!1)}catch(e){n.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===r?n.error(".doc is the legacy Word binary format — convert to .docx first."):n.error(`Unsupported file type: .${r||"unknown"}`)}finally{y(!1)}},A=g?.filename?(W=g.filename).length>24?`${W.slice(0,23)}…`:W:"Untitled";var W;/* @__PURE__ */
4
4
  return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),v||b(!0)},onDragLeave:e=>{e.currentTarget===e.target&&b(!1)},onDrop:e=>{e.preventDefault(),b(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?U(t):R(t[0]))},children:[
5
5
  /* @__PURE__ */h(r,{title:`${A}${k?" •":""} - Documents`}),
6
6
  /* @__PURE__ */h(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__ */h("input",{ref:D,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&&R(t),D.current&&(D.current.value="")},className:"hidden"}),
9
- /* @__PURE__ */d("button",{onClick:()=>D.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__ */h("input",{ref:j,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&&R(t),j.current&&(j.current.value="")},className:"hidden"}),
9
+ /* @__PURE__ */d("button",{onClick:()=>j.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__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),"Open"]}),
11
11
  /* @__PURE__ */h("button",{onClick:()=>{if(!g)return;const t=L.current?.innerHTML??"";if("text"===g.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(g.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=`${g.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=L.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=g.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(g.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${g.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__ */h("span",{className:"text-[10px] text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
@@ -38,8 +38,8 @@ return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
38
38
  /* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>M("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
39
  /* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>M("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
40
40
  /* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */h("input",{ref:j,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&U(Array.from(e.target.files)),j.current&&(j.current.value="")}}),
42
- /* @__PURE__ */d("button",{onClick:()=>j.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__ */h("input",{ref:D,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&U(Array.from(e.target.files)),D.current&&(D.current.value="")}}),
42
+ /* @__PURE__ */d("button",{onClick:()=>D.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__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),"Image"]})]}),
44
44
  /* @__PURE__ */h("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */h("div",f?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===g.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */h("div",{ref:L,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>w(!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(),C({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:g.content},className:"docx"===g.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-[14px] 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-[13px] leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),v&&/* @__PURE__ */h("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__ */h("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"})}),N&&/* @__PURE__ */d(o,{minWidth:150,style:{left:N.x,top:N.y},onClose:()=>C(null),children:[
45
45
  /* @__PURE__ */h(l,{children:"Image width"}),
@@ -1,4 +1,4 @@
1
- import{openPreviewFile as e}from"./chunk-ZJ66QFOH.js";import{Breadcrumbs as t}from"./chunk-26RS37FG.js";import{SidebarLayout as r}from"./chunk-KASHUEJV.js";import{getFilesDemoTree as a}from"./chunk-JGHRZYNV.js";import{AboutApp as n}from"./chunk-A6FPBD7W.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as s,FILES_OPEN_DESKTOP_FOLDER_EVENT as l,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-KZPQW6UL.js";import"./chunk-ESL5TDNA.js";import{toast_default as u}from"./chunk-B2TBCVHH.js";import"./chunk-VTVSMRFX.js";import"./chunk-GF2XCISN.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-X6E6UULK.js";import"./chunk-T6MKFQRH.js";import"./chunk-6UXY7MPY.js";import{formatBytes as g}from"./chunk-S2AZZGFF.js";import"./chunk-PH3PRIFP.js";import{confirm as y,prompt as b}from"./chunk-PDTZTADH.js";import"./chunk-VNEH2Y6H.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-VVI77XNV.js";import"./chunk-D65T4H6J.js";import{useState as k,useEffect as v,useSyncExternalStore as w,useRef as N,useCallback as L}from"react";import{jsxs as j,jsx as C,Fragment as $}from"react/jsx-runtime";var M="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",D={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 T(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function E(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 A(){const A=M.replace(/\/$/,""),R=null!==a(),[F,P]=k("/"),[H,S]=k([]),[B,V]=k([]),[I,W]=k(null),[U,O]=k(!0),[z,J]=k(!1),[_,K]=k(null),[Z,X]=k(!1),[G,Q]=k(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});v(()=>{o()},[]);const[Y,q]=k([]);v(()=>{const e=()=>{o(),Q("trash")},t=e=>{o();const t=e.detail?.folderId;t&&Q({desktopFolderId:t})};return window.addEventListener(s,e),window.addEventListener(l,t),()=>{window.removeEventListener(s,e),window.removeEventListener(l,t)}},[]);const ee=w(d,c,c),te="object"==typeof G?G.desktopFolderId:null,re=te?ee?.folders.find(e=>e.id===te)??null:null,ae=te&&ee?.itemsByFolder[te]||[];v(()=>{te&&ee&&!ee.folders.some(e=>e.id===te)&&Q("files")},[te,ee]);const ne=N(0),ie=N(null),{openPage:oe,openEntity:se}=f(),le=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>oe(e)}):"page"===t.entityType?oe(t.entityId):se(t.entityType,t.entityId,null,t.label)},de=L((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ce=L(async()=>{try{const e=await de(`${A}/api/quota`);if(e.ok){const t=await e.json();K({used:t.used,limit:t.limit})}}catch{}},[de,A]),me=L(async e=>{if(W(null),R){const t=function(e){const t=a();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 S(t),P(e),J(!1),O(!1),void("/"===e&&V(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}O(!0);try{const t=await de(`${A}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];S(a),P(r.path||e),J(!1),"/"===(r.path||e)&&V(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){J(!0)}finally{O(!1)}ce()},[de,A,ce,R]),he=L(async()=>{if(R)return q([]),void O(!1);O(!0),W(null);try{const e=await de(`${A}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void u.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();q(t.entries||[]),J(!1)}catch{J(!0)}finally{O(!1)}ce()},[de,A,ce,R]);v(()=>{"files"===G?me(F):"trash"===G&&he()},[F,G]);const pe=async e=>{const t=T(F,e.name);try{const r=await de(`${A}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void u.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){u.error(e?.message||"Download failed")}},ue=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await de(`${A}/api/upload?path=${encodeURIComponent(F)}`,{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));u.error(`Quota exceeded — ${g(r)} free, ${e.name} is ${g(t.attempted||e.size)}`)}else u.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){u.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}me(F)},fe=()=>{ne.current=0,X(!1)};if(v(()=>{const e=()=>fe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),z)/* @__PURE__ */
1
+ import{openPreviewFile as e}from"./chunk-S6ZIQSAF.js";import{Breadcrumbs as t}from"./chunk-7EACKL5V.js";import{SidebarLayout as r}from"./chunk-O46U4PVN.js";import{getFilesDemoTree as a}from"./chunk-ILTSTULF.js";import{AboutApp as n}from"./chunk-2S73NE3L.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as s,FILES_OPEN_DESKTOP_FOLDER_EVENT as l,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-C2A4PIGZ.js";import"./chunk-ESL5TDNA.js";import{toast_default as u}from"./chunk-EYU4IAEZ.js";import"./chunk-VTVSMRFX.js";import"./chunk-LQVXGB7A.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-ZWYKMIX7.js";import"./chunk-GTQJYE6M.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import{formatBytes as g}from"./chunk-S2AZZGFF.js";import"./chunk-PH3PRIFP.js";import"./chunk-6KO2U66R.js";import{confirm as y,prompt as b}from"./chunk-GBL5KOGP.js";import"./chunk-DYVN6C2E.js";import"./chunk-D65T4H6J.js";import"./chunk-OSJ3ADF2.js";import"./chunk-MAIHBBWT.js";import"./chunk-UZUH5PVW.js";import{useState as k,useEffect as v,useSyncExternalStore as w,useRef as N,useCallback as L}from"react";import{jsxs as j,jsx as C,Fragment as $}from"react/jsx-runtime";var M="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",D={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 E(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function T(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 A(){const A=M.replace(/\/$/,""),S=null!==a(),[R,P]=k("/"),[F,I]=k([]),[B,V]=k([]),[W,O]=k(null),[U,H]=k(!0),[z,_]=k(!1),[K,Z]=k(null),[G,J]=k(!1),[Q,X]=k(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});v(()=>{o()},[]);const[Y,q]=k([]);v(()=>{const e=()=>{o(),X("trash")},t=e=>{o();const t=e.detail?.folderId;t&&X({desktopFolderId:t})};return window.addEventListener(s,e),window.addEventListener(l,t),()=>{window.removeEventListener(s,e),window.removeEventListener(l,t)}},[]);const ee=w(d,c,c),te="object"==typeof Q?Q.desktopFolderId:null,re=te?ee?.folders.find(e=>e.id===te)??null:null,ae=te&&ee?.itemsByFolder[te]||[];v(()=>{te&&ee&&!ee.folders.some(e=>e.id===te)&&X("files")},[te,ee]);const ne=N(0),ie=N(null),{openPage:oe,openEntity:se}=f(),le=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>oe(e)}):"page"===t.entityType?oe(t.entityId):se(t.entityType,t.entityId,null,t.label)},de=L((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ce=L(async()=>{try{const e=await de(`${A}/api/quota`);if(e.ok){const t=await e.json();Z({used:t.used,limit:t.limit})}}catch{}},[de,A]),me=L(async e=>{if(O(null),S){const t=function(e){const t=a();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 I(t),P(e),_(!1),H(!1),void("/"===e&&V(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}H(!0);try{const t=await de(`${A}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];I(a),P(r.path||e),_(!1),"/"===(r.path||e)&&V(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){_(!0)}finally{H(!1)}ce()},[de,A,ce,S]),he=L(async()=>{if(S)return q([]),void H(!1);H(!0),O(null);try{const e=await de(`${A}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void u.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();q(t.entries||[]),_(!1)}catch{_(!0)}finally{H(!1)}ce()},[de,A,ce,S]);v(()=>{"files"===Q?me(R):"trash"===Q&&he()},[R,Q]);const pe=async e=>{const t=E(R,e.name);try{const r=await de(`${A}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void u.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){u.error(e?.message||"Download failed")}},ue=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await de(`${A}/api/upload?path=${encodeURIComponent(R)}`,{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));u.error(`Quota exceeded — ${g(r)} free, ${e.name} is ${g(t.attempted||e.size)}`)}else u.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){u.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}me(R)},fe=()=>{ne.current=0,J(!1)};if(v(()=>{const e=()=>fe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),z)/* @__PURE__ */
2
2
  return j("div",{className:"flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */C(x,{title:"Files - offline"}),
4
4
  /* @__PURE__ */C("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */j("div",{className:"max-w-md",children:[
@@ -9,47 +9,47 @@ return j("div",{className:"flex flex-col h-full bg-white",children:[
9
9
  /* @__PURE__ */j("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
10
10
  /* @__PURE__ */C("span",{className:"font-mono",children:A}),". Make sure the server is running — see ",
11
11
  /* @__PURE__ */C("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
12
- /* @__PURE__ */C("button",{onClick:()=>me(F),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===F?[]:F.split("/").filter(Boolean),ge=_&&_.limit>0?Math.min(100,Math.round(_.used/_.limit*100)):0,ye=ge>90?"bg-red-500":ge>75?"bg-amber-500":"bg-blue-500",be=[{label:"My files",onClick:()=>P("/")},...xe.map((e,t)=>({label:e,onClick:()=>P("/"+xe.slice(0,t+1).join("/"))}))],ke=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),ve=e=>/* @__PURE__ */C("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__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),we=/* @__PURE__ */j("nav",{className:"p-2",children:[
12
+ /* @__PURE__ */C("button",{onClick:()=>me(R),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===R?[]:R.split("/").filter(Boolean),ge=K&&K.limit>0?Math.min(100,Math.round(K.used/K.limit*100)):0,ye=ge>90?"bg-red-500":ge>75?"bg-amber-500":"bg-blue-500",be=[{label:"My files",onClick:()=>P("/")},...xe.map((e,t)=>({label:e,onClick:()=>P("/"+xe.slice(0,t+1).join("/"))}))],ke=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),ve=e=>/* @__PURE__ */C("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__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),we=/* @__PURE__ */j("nav",{className:"p-2",children:[
13
13
  /* @__PURE__ */C("div",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
14
- /* @__PURE__ */j("button",{onClick:()=>{Q("files"),P("/")},className:ke("files"===G&&"/"===F),children:[ve("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"]}),B.map(e=>/* @__PURE__ */j("button",{onClick:()=>{Q("files"),P("/"+e)},className:ke("files"===G&&F==="/"+e),children:[ve("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"),
15
- /* @__PURE__ */C("span",{className:"truncate",children:e})]},e)),!R&&/* @__PURE__ */j("button",{onClick:()=>Q("trash"),className:ke("trash"===G),children:[ve("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"]}),ee&&ee.folders.length>0&&/* @__PURE__ */j($,{children:[
16
- /* @__PURE__ */C("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ee.folders.map(e=>/* @__PURE__ */j("button",{onClick:()=>Q({desktopFolderId:e.id}),className:ke(te===e.id),children:[
14
+ /* @__PURE__ */j("button",{onClick:()=>{X("files"),P("/")},className:ke("files"===Q&&"/"===R),children:[ve("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"]}),B.map(e=>/* @__PURE__ */j("button",{onClick:()=>{X("files"),P("/"+e)},className:ke("files"===Q&&R==="/"+e),children:[ve("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"),
15
+ /* @__PURE__ */C("span",{className:"truncate",children:e})]},e)),!S&&/* @__PURE__ */j("button",{onClick:()=>X("trash"),className:ke("trash"===Q),children:[ve("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"]}),ee&&ee.folders.length>0&&/* @__PURE__ */j($,{children:[
16
+ /* @__PURE__ */C("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ee.folders.map(e=>/* @__PURE__ */j("button",{onClick:()=>X({desktopFolderId:e.id}),className:ke(te===e.id),children:[
17
17
  /* @__PURE__ */C(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
18
18
  /* @__PURE__ */C("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */C("span",{className:"ml-auto text-[10px] text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
19
- return j("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{R||"object"==typeof G||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ne.current++,Z||X(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ne.current>0&&ne.current--,0===ne.current&&X(!1)},onDrop:e=>{e.preventDefault(),fe(),R||"object"==typeof G||e.dataTransfer.files?.length&&ue(e.dataTransfer.files)},children:[
20
- /* @__PURE__ */C(x,{title:re?`Files - ${re.name}`:"Files"+("/"===F?"":" - "+F)}),
19
+ return j("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{S||"object"==typeof Q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ne.current++,G||J(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ne.current>0&&ne.current--,0===ne.current&&J(!1)},onDrop:e=>{e.preventDefault(),fe(),S||"object"==typeof Q||e.dataTransfer.files?.length&&ue(e.dataTransfer.files)},children:[
20
+ /* @__PURE__ */C(x,{title:re?`Files - ${re.name}`:"Files"+("/"===R?"":" - "+R)}),
21
21
  /* @__PURE__ */C(n,{app:"files"}),
22
22
  /* @__PURE__ */C("input",{ref:ie,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ue(e.target.files),ie.current&&(ie.current.value="")}}),
23
23
  /* @__PURE__ */C("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */C(r,{sidebar:we,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */j("div",{className:"flex h-full min-w-0 flex-col",children:[
24
- /* @__PURE__ */j("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */j($,"files"===G?{children:[
25
- /* @__PURE__ */C("button",{onClick:()=>P(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(F)),disabled:"/"===F,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
24
+ /* @__PURE__ */j("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */j($,"files"===Q?{children:[
25
+ /* @__PURE__ */C("button",{onClick:()=>P(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(R)),disabled:"/"===R,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
26
26
  /* @__PURE__ */C("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */C(t,{items:be,maxItems:5})}),
27
- /* @__PURE__ */C("button",{onClick:()=>me(F),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),!R&&/* @__PURE__ */j($,{children:[
28
- /* @__PURE__ */j("button",{onClick:()=>Q("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__ */C("button",{onClick:()=>me(R),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),!S&&/* @__PURE__ */j($,{children:[
28
+ /* @__PURE__ */j("button",{onClick:()=>X("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
29
29
  /* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})}),"Trash"]}),
30
- /* @__PURE__ */j("button",{onClick:async()=>{const e=await b({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void u.error("Folder names cannot contain slashes");const t=T(F,e),r=await de(`${A}/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 u.error(e.error||`Create folder failed (${r.status})`)}me(F)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
30
+ /* @__PURE__ */j("button",{onClick:async()=>{const e=await b({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void u.error("Folder names cannot contain slashes");const t=E(R,e),r=await de(`${A}/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 u.error(e.error||`Create folder failed (${r.status})`)}me(R)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
31
31
  /* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 10.5v6m3-3H9m4.06-7.19l-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"})}),"New Folder"]}),
32
32
  /* @__PURE__ */j("button",{onClick:()=>ie.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
33
- /* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 7.5L12 3m0 0l4.5 4.5M12 3v13.5"})}),"Upload"]})]})]}:"trash"===G?{children:[
34
- /* @__PURE__ */C("button",{onClick:()=>Q("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
33
+ /* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 7.5L12 3m0 0l4.5 4.5M12 3v13.5"})}),"Upload"]})]})]}:"trash"===Q?{children:[
34
+ /* @__PURE__ */C("button",{onClick:()=>X("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
35
35
  /* @__PURE__ */C("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
36
36
  /* @__PURE__ */C("button",{onClick:he,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
37
37
  /* @__PURE__ */C("button",{onClick:async()=>{if(0===Y.length)return;if(!await y({title:"Empty trash",message:`${Y.length} item${1===Y.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await de(`${A}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void u.error(t.error||`Empty trash failed (${e.status})`)}he()},disabled:0===Y.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:[
38
- /* @__PURE__ */C("button",{onClick:()=>Q("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
38
+ /* @__PURE__ */C("button",{onClick:()=>X("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
39
39
  /* @__PURE__ */C(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
40
40
  /* @__PURE__ */C("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:re?.name??"Desktop folder"}),
41
- /* @__PURE__ */C("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),_&&/* @__PURE__ */j($,{children:[
41
+ /* @__PURE__ */C("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),K&&/* @__PURE__ */j($,{children:[
42
42
  /* @__PURE__ */C("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
43
- /* @__PURE__ */j("div",{className:"flex items-center gap-1.5",title:`${g(_.used)} of ${g(_.limit)} used`,children:[
43
+ /* @__PURE__ */j("div",{className:"flex items-center gap-1.5",title:`${g(K.used)} of ${g(K.limit)} used`,children:[
44
44
  /* @__PURE__ */C("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */C("div",{className:`h-full ${ye} transition-all`,style:{width:`${ge}%`}})}),
45
- /* @__PURE__ */j("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[g(_.used)," / ",g(_.limit)]})]})]})]}),
46
- /* @__PURE__ */C("div",{className:"flex-1 overflow-auto",children:"object"==typeof G?0===ae.length?/* @__PURE__ */C("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__ */j("table",{className:"w-full text-sm",children:[
45
+ /* @__PURE__ */j("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[g(K.used)," / ",g(K.limit)]})]})]})]}),
46
+ /* @__PURE__ */C("div",{className:"flex-1 overflow-auto",children:"object"==typeof Q?0===ae.length?/* @__PURE__ */C("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__ */j("table",{className:"w-full text-sm",children:[
47
47
  /* @__PURE__ */C("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */j("tr",{children:[
48
48
  /* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
49
49
  /* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5 w-28",children:"Type"}),
50
50
  /* @__PURE__ */C("th",{className:"w-56"})]})}),
51
51
  /* @__PURE__ */C("tbody",{children:ae.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
52
- return j("tr",{onClick:()=>W(t),onDoubleClick:()=>le(e),className:"cursor-default border-b border-gray-100 "+(I===t?"bg-blue-50":"hover:bg-gray-50"),children:[
52
+ return j("tr",{onClick:()=>O(t),onDoubleClick:()=>le(e),className:"cursor-default border-b border-gray-100 "+(W===t?"bg-blue-50":"hover:bg-gray-50"),children:[
53
53
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 flex items-center gap-2",children:[
54
54
  /* @__PURE__ */C(h,{item:e}),
55
55
  /* @__PURE__ */C("span",{className:"truncate",title:e.label,children:e.label})]}),
@@ -57,7 +57,7 @@ return j("tr",{onClick:()=>W(t),onDoubleClick:()=>le(e),className:"cursor-defaul
57
57
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
58
58
  /* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),le(e)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Open"}),
59
59
  /* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),ee?.moveToDesktop([e])},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Move to desktop"}),
60
- /* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),ee?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===G?U&&0===Y.length?/* @__PURE__ */C("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===Y.length?/* @__PURE__ */C("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */j("table",{className:"w-full text-sm",children:[
60
+ /* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),ee?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===Q?U&&0===Y.length?/* @__PURE__ */C("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===Y.length?/* @__PURE__ */C("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */j("table",{className:"w-full text-sm",children:[
61
61
  /* @__PURE__ */C("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */j("tr",{children:[
62
62
  /* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
63
63
  /* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Original location"}),
@@ -69,21 +69,21 @@ return j("tr",{onClick:()=>W(t),onDoubleClick:()=>le(e),className:"cursor-defaul
69
69
  /* @__PURE__ */C("span",{className:"truncate",title:e.name,children:e.name})]}),
70
70
  /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
71
71
  /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:g(e.size)}),
72
- /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?E(e.deletedAt):"—"}),
72
+ /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?T(e.deletedAt):"—"}),
73
73
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
74
74
  /* @__PURE__ */C("button",{onClick:()=>(async e=>{const t=await de(`${A}/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 u.error(e.error||`Restore failed (${t.status})`)}u.success(`Restored "${e.name}"`),he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Restore"}),
75
- /* @__PURE__ */C("button",{onClick:()=>(async e=>{if(!await y({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await de(`${A}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${t.status})`)}he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):U&&0===H.length?/* @__PURE__ */C("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===H.length?/* @__PURE__ */j("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!R&&/* @__PURE__ */j($,{children:[" Drop files here or click ",
75
+ /* @__PURE__ */C("button",{onClick:()=>(async e=>{if(!await y({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await de(`${A}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${t.status})`)}he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):U&&0===F.length?/* @__PURE__ */C("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===F.length?/* @__PURE__ */j("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!S&&/* @__PURE__ */j($,{children:[" Drop files here or click ",
76
76
  /* @__PURE__ */C("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */j("table",{className:"w-full text-sm",children:[
77
77
  /* @__PURE__ */C("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */j("tr",{children:[
78
78
  /* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
79
79
  /* @__PURE__ */C("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
80
80
  /* @__PURE__ */C("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Modified"}),
81
81
  /* @__PURE__ */C("th",{className:"w-32"})]})}),
82
- /* @__PURE__ */C("tbody",{children:H.map(t=>/* @__PURE__ */j("tr",{onClick:()=>W(t.name),onDoubleClick:()=>{"folder"===t.kind?P(T(F,t.name)):(async t=>{if(R)return;const r=T(F,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=D[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>oe(e)}):pe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(I===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
82
+ /* @__PURE__ */C("tbody",{children:F.map(t=>/* @__PURE__ */j("tr",{onClick:()=>O(t.name),onDoubleClick:()=>{"folder"===t.kind?P(E(R,t.name)):(async t=>{if(S)return;const r=E(R,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=D[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>oe(e)}):pe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(W===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
83
83
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */C("svg",{className:"h-4 w-4 text-amber-500 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */C("path",{d:"M2.25 7.125A2.25 2.25 0 014.5 4.875h4.504c.61 0 1.193.243 1.624.673l1.494 1.494a.75.75 0 00.53.22h7.098A2.25 2.25 0 0122 9.51v8.366A2.25 2.25 0 0119.75 20.125H4.25A2.25 2.25 0 012 17.875V7.125z"})}):/* @__PURE__ */C("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),
84
84
  /* @__PURE__ */C("span",{className:"truncate",title:t.name,children:t.name})]}),
85
85
  /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":g(t.size)}),
86
- /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:E(t.modifiedAt)}),
87
- /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!R&&/* @__PURE__ */j($,{children:["file"===t.kind&&/* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),pe(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
88
- /* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await b({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void u.error("Names cannot contain slashes");const r=T(F,e.name),a=T(F,t),n=await de(`${A}/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 u.error(e.error||`Rename failed (${n.status})`)}me(F)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
89
- /* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await y({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=T(F,e.name),r=await de(`${A}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${r.status})`)}me(F)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),Z&&/* @__PURE__ */C("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__ */C("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{A as default};
86
+ /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:T(t.modifiedAt)}),
87
+ /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!S&&/* @__PURE__ */j($,{children:["file"===t.kind&&/* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),pe(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
88
+ /* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await b({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void u.error("Names cannot contain slashes");const r=E(R,e.name),a=E(R,t),n=await de(`${A}/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 u.error(e.error||`Rename failed (${n.status})`)}me(R)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
89
+ /* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await y({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=E(R,e.name),r=await de(`${A}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${r.status})`)}me(R)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),G&&/* @__PURE__ */C("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__ */C("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{A as default};