efficient-shell 4.164.0 → 4.166.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 (68) hide show
  1. package/README.md +146 -4
  2. package/dist/{Browser-AZSXQEJ2.js → Browser-2MBG34IR.js} +13 -13
  3. package/dist/Calculator-R3WJTNZ6.js +29 -0
  4. package/dist/ConfirmDialog-ZDVMT74Y.js +1 -0
  5. package/dist/{CurrencyConverter-VT2SZDA3.js → CurrencyConverter-PEXSQQUK.js} +7 -7
  6. package/dist/{Documents-WIYSUFCQ.js → Documents-YL4RIOZO.js} +10 -10
  7. package/dist/{Files-FAO4MFCO.js → Files-3ZRUTRSB.js} +30 -30
  8. package/dist/Notepad-3ZM2FR6C.js +25 -0
  9. package/dist/PdfViewer-S2B2DZYB.js +1 -0
  10. package/dist/{PomodoroTimer-4JBDIQZK.js → PomodoroTimer-5QHA5UOY.js} +40 -40
  11. package/dist/{Preview-FBVFDTPN.js → Preview-32F4DTCK.js} +23 -23
  12. package/dist/Sidebar-QQSRLMJG.js +44 -0
  13. package/dist/Spreadsheet-GOZI7I4L.js +37 -0
  14. package/dist/{Stock-NIM7MAYG.js → Stock-XJFITZZA.js} +4 -4
  15. package/dist/{Weather-RLISJWFA.js → Weather-BDC633GV.js} +18 -18
  16. package/dist/{WorldClock-G4L5OLOT.js → WorldClock-ROOVRRCJ.js} +6 -6
  17. package/dist/apps/index.js +1 -1
  18. package/dist/brand.css +1 -1
  19. package/dist/{chunk-6ZUAHFK3.js → chunk-3U47BTEV.js} +14 -14
  20. package/dist/{chunk-6NG4TM3E.js → chunk-4P3IWZUC.js} +14 -14
  21. package/dist/{chunk-Z43BI2JI.js → chunk-5J2TKKGH.js} +1 -1
  22. package/dist/{chunk-XY25UBVS.js → chunk-7TQ7NMT3.js} +1 -1
  23. package/dist/{chunk-YLJ7AZON.js → chunk-7YFAFXQG.js} +8 -8
  24. package/dist/chunk-AFYQTVZO.js +1 -0
  25. package/dist/chunk-BKDE67DB.js +12 -0
  26. package/dist/{chunk-T7DDT2Z6.js → chunk-CRI4UFBU.js} +6 -6
  27. package/dist/{chunk-DGWWPVEQ.js → chunk-DTRXR6JQ.js} +11 -11
  28. package/dist/{chunk-J5E4VMLJ.js → chunk-FZRQBHTK.js} +1 -1
  29. package/dist/chunk-G5J6YSN5.js +5 -0
  30. package/dist/{chunk-I3CQI462.js → chunk-HA2WG27U.js} +2 -2
  31. package/dist/{chunk-RKOTKWWU.js → chunk-HGG5M5AB.js} +1 -1
  32. package/dist/chunk-HZZNJHRH.js +1 -0
  33. package/dist/chunk-JKVDTKBE.js +988 -0
  34. package/dist/{chunk-IY4CP2HO.js → chunk-KSSAVLO7.js} +1 -1
  35. package/dist/chunk-M4DB7UBZ.js +29 -0
  36. package/dist/{chunk-YS57MJFM.js → chunk-NCQLGQYR.js} +1 -1
  37. package/dist/{chunk-U7ZDZXOJ.js → chunk-QASZIYLG.js} +1 -1
  38. package/dist/{chunk-37QZZRDT.js → chunk-QZG72OVX.js} +1 -1
  39. package/dist/chunk-SOI4LR67.js +27 -0
  40. package/dist/chunk-UVZIPXIA.js +10 -0
  41. package/dist/chunk-VRHUY4P4.js +1 -0
  42. package/dist/{chunk-TJ4YXVQQ.js → chunk-VXBJNMAA.js} +94 -94
  43. package/dist/chunk-X4FJ54PP.js +1 -0
  44. package/dist/file-intake/index.js +1 -1
  45. package/dist/{index-CFLEu3eh.d.ts → index-DcLqfJX3.d.ts} +285 -16
  46. package/dist/index.d.ts +3 -13
  47. package/dist/index.js +114 -114
  48. package/dist/map/index.js +6 -6
  49. package/dist/page-tabs/index.js +5 -5
  50. package/dist/pdf/index.js +1 -1
  51. package/dist/ui/index.d.ts +1 -1
  52. package/dist/ui/index.js +1 -1
  53. package/package.json +1 -1
  54. package/dist/Calculator-GRNWTZIZ.js +0 -29
  55. package/dist/ConfirmDialog-LSFNIGKM.js +0 -1
  56. package/dist/Notepad-APW5DX37.js +0 -25
  57. package/dist/PdfViewer-3NWOBXPP.js +0 -1
  58. package/dist/Sidebar-KRN5ZV3F.js +0 -44
  59. package/dist/Spreadsheet-IQF6QAWU.js +0 -37
  60. package/dist/chunk-4UCRT4ST.js +0 -5
  61. package/dist/chunk-ELSUXC3N.js +0 -1
  62. package/dist/chunk-HQREOTKI.js +0 -9
  63. package/dist/chunk-L2W5XPZ3.js +0 -1
  64. package/dist/chunk-LZIS72CF.js +0 -9
  65. package/dist/chunk-MAIHBBWT.js +0 -1
  66. package/dist/chunk-MHGFTCEA.js +0 -971
  67. package/dist/chunk-NNUE7M5G.js +0 -29
  68. package/dist/chunk-SVJN7WWF.js +0 -27
@@ -1,4 +1,4 @@
1
- import{openPreviewFile as e}from"./chunk-37QZZRDT.js";import{Breadcrumbs as t}from"./chunk-J5E4VMLJ.js";import{SidebarLayout as r}from"./chunk-LZIS72CF.js";import{getFilesDemoTree as a}from"./chunk-ILTSTULF.js";import{AboutApp as n}from"./chunk-RKOTKWWU.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-IY4CP2HO.js";import"./chunk-VTVSMRFX.js";import"./chunk-L2W5XPZ3.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-TJ4YXVQQ.js";import"./chunk-T7DDT2Z6.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import{formatBytes as g}from"./chunk-S2AZZGFF.js";import"./chunk-4UCRT4ST.js";import"./chunk-6KO2U66R.js";import{confirm as y,prompt as b}from"./chunk-NNUE7M5G.js";import"./chunk-HQREOTKI.js";import"./chunk-ELSUXC3N.js";import"./chunk-MAIHBBWT.js";import"./chunk-YS57MJFM.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 T="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",M={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function D(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=T.replace(/\/$/,""),R=null!==a(),[S,F]=k("/"),[I,P]=k([]),[W,B]=k([]),[O,U]=k(null),[V,H]=k(!0),[z,J]=k(!1),[Z,_]=k(null),[K,Q]=k(!1),[X,G]=k(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});v(()=>{o()},[]);const[Y,q]=k([]);v(()=>{const e=()=>{o(),G("trash")},t=e=>{o();const t=e.detail?.folderId;t&&G({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 X?X.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)&&G("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();_({used:t.used,limit:t.limit})}}catch{}},[de,A]),me=L(async e=>{if(U(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 P(t),F(e),J(!1),H(!1),void("/"===e&&B(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||[];P(a),F(r.path||e),J(!1),"/"===(r.path||e)&&B(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){J(!0)}finally{H(!1)}ce()},[de,A,ce,R]),he=L(async()=>{if(R)return q([]),void H(!1);H(!0),U(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{H(!1)}ce()},[de,A,ce,R]);v(()=>{"files"===X?me(S):"trash"===X&&he()},[S,X]);const pe=async e=>{const t=D(S,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(S)}`,{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(S)},fe=()=>{ne.current=0,Q(!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-QZG72OVX.js";import{Breadcrumbs as t}from"./chunk-FZRQBHTK.js";import{SidebarLayout as r}from"./chunk-G5J6YSN5.js";import{getFilesDemoTree as a}from"./chunk-ILTSTULF.js";import{AboutApp as n}from"./chunk-HGG5M5AB.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-KSSAVLO7.js";import"./chunk-VTVSMRFX.js";import"./chunk-VRHUY4P4.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-VXBJNMAA.js";import"./chunk-CRI4UFBU.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import{formatBytes as g}from"./chunk-S2AZZGFF.js";import"./chunk-BKDE67DB.js";import"./chunk-6KO2U66R.js";import{confirm as y,prompt as b}from"./chunk-M4DB7UBZ.js";import"./chunk-UVZIPXIA.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-D65T4H6J.js";import"./chunk-X4FJ54PP.js";import"./chunk-NCQLGQYR.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 A(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 E(){const E=M.replace(/\/$/,""),R=null!==a(),[B,S]=k("/"),[F,P]=k([]),[I,V]=k([]),[H,O]=k(null),[U,W]=k(!0),[z,Z]=k(!1),[J,_]=k(null),[G,K]=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(`${E}/api/quota`);if(e.ok){const t=await e.json();_({used:t.used,limit:t.limit})}}catch{}},[de,E]),me=L(async e=>{if(O(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 P(t),S(e),Z(!1),W(!1),void("/"===e&&V(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}W(!0);try{const t=await de(`${E}/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||[];P(a),S(r.path||e),Z(!1),"/"===(r.path||e)&&V(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){Z(!0)}finally{W(!1)}ce()},[de,E,ce,R]),he=L(async()=>{if(R)return q([]),void W(!1);W(!0),O(null);try{const e=await de(`${E}/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||[]),Z(!1)}catch{Z(!0)}finally{W(!1)}ce()},[de,E,ce,R]);v(()=>{"files"===Q?me(B):"trash"===Q&&he()},[B,Q]);const pe=async e=>{const t=T(B,e.name);try{const r=await de(`${E}/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(`${E}/api/upload?path=${encodeURIComponent(B)}`,{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(B)},fe=()=>{ne.current=0,K(!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:[
@@ -7,49 +7,49 @@ return j("div",{className:"flex flex-col h-full bg-white",children:[
7
7
  /* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"})]}),
8
8
  /* @__PURE__ */C("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
9
9
  /* @__PURE__ */j("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
10
- /* @__PURE__ */C("span",{className:"font-mono",children:A}),". Make sure the server is running — see ",
10
+ /* @__PURE__ */C("span",{className:"font-mono",children:E}),". 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(S),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===S?[]:S.split("/").filter(Boolean),ge=Z&&Z.limit>0?Math.min(100,Math.round(Z.used/Z.limit*100)):0,ye=ge>90?"bg-red-500":ge>75?"bg-amber-500":"bg-blue-500",be=[{label:"My files",onClick:()=>F("/")},...xe.map((e,t)=>({label:e,onClick:()=>F("/"+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(B),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===B?[]:B.split("/").filter(Boolean),ge=J&&J.limit>0?Math.min(100,Math.round(J.used/J.limit*100)):0,ye=ge>90?"bg-red-500":ge>75?"bg-amber-500":"bg-blue-500",be=[{label:"My files",onClick:()=>S("/")},...xe.map((e,t)=>({label:e,onClick:()=>S("/"+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:()=>{G("files"),F("/")},className:ke("files"===X&&"/"===S),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"]}),W.map(e=>/* @__PURE__ */j("button",{onClick:()=>{G("files"),F("/"+e)},className:ke("files"===X&&S==="/"+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:()=>G("trash"),className:ke("trash"===X),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:()=>G({desktopFolderId:e.id}),className:ke(te===e.id),children:[
14
+ /* @__PURE__ */j("button",{onClick:()=>{X("files"),S("/")},className:ke("files"===Q&&"/"===B),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"]}),I.map(e=>/* @__PURE__ */j("button",{onClick:()=>{X("files"),S("/"+e)},className:ke("files"===Q&&B==="/"+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:()=>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 X||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ne.current++,K||Q(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ne.current>0&&ne.current--,0===ne.current&&Q(!1)},onDrop:e=>{e.preventDefault(),fe(),R||"object"==typeof X||e.dataTransfer.files?.length&&ue(e.dataTransfer.files)},children:[
20
- /* @__PURE__ */C(x,{title:re?`Files - ${re.name}`:"Files"+("/"===S?"":" - "+S)}),
19
+ return j("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{R||"object"==typeof Q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ne.current++,G||K(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ne.current>0&&ne.current--,0===ne.current&&K(!1)},onDrop:e=>{e.preventDefault(),fe(),R||"object"==typeof Q||e.dataTransfer.files?.length&&ue(e.dataTransfer.files)},children:[
20
+ /* @__PURE__ */C(x,{title:re?`Files - ${re.name}`:"Files"+("/"===B?"":" - "+B)}),
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"===X?{children:[
25
- /* @__PURE__ */C("button",{onClick:()=>F(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(S)),disabled:"/"===S,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:()=>S(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(B)),disabled:"/"===B,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(S),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:()=>G("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(B),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:()=>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=D(S,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(S)},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=T(B,e),r=await de(`${E}/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(B)},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"===X?{children:[
34
- /* @__PURE__ */C("button",{onClick:()=>G("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
- /* @__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:()=>G("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"})})}),
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(`${E}/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:()=>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"})]}),Z&&/* @__PURE__ */j($,{children:[
41
+ /* @__PURE__ */C("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),J&&/* @__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(Z.used)} of ${g(Z.limit)} used`,children:[
43
+ /* @__PURE__ */j("div",{className:"flex items-center gap-1.5",title:`${g(J.used)} of ${g(J.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(Z.used)," / ",g(Z.limit)]})]})]})]}),
46
- /* @__PURE__ */C("div",{className:"flex-1 overflow-auto",children:"object"==typeof X?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(J.used)," / ",g(J.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:()=>U(t),onDoubleClick:()=>le(e),className:"cursor-default border-b border-gray-100 "+(O===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 "+(H===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:()=>U(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"===X?V&&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:()=>U(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?A(e.deletedAt):"—"}),
73
73
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
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))})]}):V&&0===I.length?/* @__PURE__ */C("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===I.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 ",
74
+ /* @__PURE__ */C("button",{onClick:()=>(async e=>{const t=await de(`${E}/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(`${E}/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.",!R&&/* @__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:I.map(t=>/* @__PURE__ */j("tr",{onClick:()=>U(t.name),onDoubleClick:()=>{"folder"===t.kind?F(D(S,t.name)):(async t=>{if(R)return;const r=D(S,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=M[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 "+(O===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?S(T(B,t.name)):(async t=>{if(R)return;const r=T(B,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 "+(H===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)}),
86
+ /* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:A(t.modifiedAt)}),
87
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=D(S,e.name),a=D(S,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(S)})(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=D(S,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(S)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),K&&/* @__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};
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(B,e.name),a=T(B,t),n=await de(`${E}/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(B)})(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(B,e.name),r=await de(`${E}/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(B)})(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{E as default};
@@ -0,0 +1,25 @@
1
+ import{getNumberingConfigs as e}from"./chunk-7TQ7NMT3.js";import{SidebarLayout as t}from"./chunk-G5J6YSN5.js";import{AboutApp as r}from"./chunk-HGG5M5AB.js";import{toast_default as n}from"./chunk-KSSAVLO7.js";import"./chunk-VRHUY4P4.js";import{useWindowManager as o,client_default as i}from"./chunk-VXBJNMAA.js";import{useShellPrefs as s}from"./chunk-CRI4UFBU.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import{timeAgo as l}from"./chunk-S2AZZGFF.js";import"./chunk-BKDE67DB.js";import"./chunk-6KO2U66R.js";import"./chunk-M4DB7UBZ.js";import"./chunk-UVZIPXIA.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-D65T4H6J.js";import"./chunk-X4FJ54PP.js";import"./chunk-NCQLGQYR.js";import{useRef as c,useEffect as a,useState as d,useCallback as p}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as m,Fragment as h,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var y={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:k,save:v}=s(),{data:N}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=c({});a(()=>{if(!N)return;const e={};for(const t of N){const r=y[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}w.current=e},[N]);const _=k.notepad_notes||[],[j,T]=d(null),[C,L]=d(""),[$,S]=d(""),[B,M]=d("yellow"),[X,W]=d(!1),[A,D]=d(!1),O=c(null),H=c(),U=_.find(e=>e.id===j);a(()=>{if(!j&&_.length>0){const e=_[0];T(e.id),L(e.title),S(e.content),M(e.color)}},[_.length]);const V=p(e=>{v({notepad_notes:e})},[v]),I=p(()=>{if(!j||!X)return;const e=_.map(e=>e.id===j?{...e,title:C,content:$,color:B,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);V(e),W(!1)},[j,X,C,$,B,_,V]);a(()=>{if(X)return H.current&&clearTimeout(H.current),H.current=setTimeout(I,800),()=>{H.current&&clearTimeout(H.current)}},[X,I]),a(()=>()=>{X&&I()},[]);const P=e=>{X&&I(),T(e.id),L(e.title),S(e.content),M(e.color),W(!1),D(!1)},Z=e=>{const t=$.slice(0,e),r=$.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=$.slice(e+r[0].length);S(t+n+o),W(!0)},F=async(e,t)=>{const r=w.current[e];if(!r)return;const o=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:o,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,o):n.error(`${o} not found`)}catch{n.error(`Failed to look up ${o}`)}},R="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",q=/* @__PURE__ */m(h,{children:[
2
+ /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */m("button",{onClick:()=>{X&&I();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,..._];V(t),T(e.id),L(""),S(""),M("yellow"),W(!1),D(!0),setTimeout(()=>O.current?.focus(),50)},className:"w-full flex items-center justify-center gap-1.5 rounded-lg bg-blue-600 text-white px-3 py-1.5 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
3
+ /* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"New Note"]})}),
4
+ /* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===_.length?/* @__PURE__ */g("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):_.map(e=>{const t=(r=e.color,x.find(e=>e.key===r)||x[0]);var r;/* @__PURE__ */
5
+ return m("button",{onClick:()=>P(e),className:"w-full text-left px-3 py-2.5 border-b border-gray-100 transition-colors "+(j===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
6
+ /* @__PURE__ */m("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */g("div",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${t.dot}`}),
8
+ /* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g("svg",{className:"h-3 w-3 text-amber-500 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})]}),
9
+ /* @__PURE__ */g("p",{className:"text-xs text-gray-400 mt-0.5 truncate ml-4.5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
+ /* @__PURE__ */g("p",{className:"text-[10px] text-gray-300 mt-0.5 ml-4.5",children:l(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
+ return m("div",{className:"h-full",children:[
12
+ /* @__PURE__ */g(r,{app:"notepad"}),
13
+ /* @__PURE__ */g(t,{sidebar:q,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:j?/* @__PURE__ */m("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
+ /* @__PURE__ */m("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
+ /* @__PURE__ */g("input",{value:C,onChange:e=>{L(e.target.value),W(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{M(e.key),W(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${B===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=_.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);V(t);const r=t.find(t=>t.id===e);n.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(j),title:U?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(U?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:U?.sticky?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})}),
18
+ /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=_.filter(t=>t.id!==e);if(V(t),j===e){const e=t[0];e?P(e):(T(null),L(""),S(""))}})(j),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("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"})})})]}),A?/* @__PURE__ */g("textarea",{ref:O,value:$,onChange:e=>{S(e.target.value),W(!0)},onBlur:()=>{D(!1),X&&I()},placeholder:R,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */g("div",{onClick:()=>{D(!0),setTimeout(()=>O.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:$?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=s.exec(e));){const e=l[1],t=l[2];if(w.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>F(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let c=0;for(let e=0;e<r;e++)c+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=c+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>Z(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */g("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:"​"},`empty-${r}`));const a=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
+ return g("div",{className:a?"line-through text-gray-400":"",children:n},r)})})($):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:R})}),
20
+ /* @__PURE__ */m("div",{className:"px-4 py-1.5 border-t border-gray-100 flex items-center gap-4 text-[10px] text-gray-400",children:[
21
+ /* @__PURE__ */g("span",{children:"[] checkbox"}),
22
+ /* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
23
+ /* @__PURE__ */g("span",{className:"ml-auto",children:A?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */m("div",{className:"text-center text-gray-400",children:[
24
+ /* @__PURE__ */g("svg",{className:"h-12 w-12 mx-auto mb-3 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:/* @__PURE__ */g("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"})}),
25
+ /* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
@@ -0,0 +1 @@
1
+ export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-3U47BTEV.js";import"./chunk-KSSAVLO7.js";import"./chunk-NCQLGQYR.js";
@@ -1,22 +1,22 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-U7ZDZXOJ.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as r,setPomoAlarm as n,setPomoAlarmConfig as l,setPomoBehaviour as s,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as g,playAlarm as p,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-I3CQI462.js";import"./chunk-IY4CP2HO.js";import{useWidgetSettings as x}from"./chunk-TJ4YXVQQ.js";import{useShellPrefs as k}from"./chunk-T7DDT2Z6.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-4UCRT4ST.js";import"./chunk-6KO2U66R.js";import"./chunk-NNUE7M5G.js";import"./chunk-HQREOTKI.js";import"./chunk-ELSUXC3N.js";import"./chunk-MAIHBBWT.js";import"./chunk-YS57MJFM.js";import"./chunk-D65T4H6J.js";import{useSyncExternalStore as v,useEffect as y,useMemo as N,useState as w,useRef as C,useCallback as S}from"react";import{jsxs as B,Fragment as M,jsx as T}from"react/jsx-runtime";var j="pomodoro_appearance",I="pomodoro_active_task_id",P={focus:"Pomodoro",short:"Short Break",long:"Long Break"},A={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var L=25,$=5,D=15,V=!1,_=!1,R=4,E=!0,O=!0,W="bell",F=100,U=1,z="none",H=50,J=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function Q(){const t=v(a,o,o),{prefs:p,save:b}=k(),Q=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:J(t.focusMinutes,1,120,L),shortBreakMinutes:J(t.shortBreakMinutes,1,120,$),longBreakMinutes:J(t.longBreakMinutes,1,120,D),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:V,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:_,longBreakInterval:J(t.longBreakInterval,1,20,R),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:E,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:O,alarmSound:g.some(e=>e.id===t.alarmSound)?t.alarmSound:W,alarmVolume:J(t.alarmVolume,0,100,F),alarmRepeat:J(t.alarmRepeat,1,5,U),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:z,focusVolume:J(t.focusVolume,0,100,H)}}(p.pomodoro_settings);y(()=>{r({focus:60*Q.focusMinutes,short:60*Q.shortBreakMinutes,long:60*Q.longBreakMinutes})},[Q.focusMinutes,Q.shortBreakMinutes,Q.longBreakMinutes]),y(()=>{n(Q.alarmSound),l(Q.alarmVolume,Q.alarmRepeat)},[Q.alarmSound,Q.alarmVolume,Q.alarmRepeat]),y(()=>{s({autoStartBreaks:Q.autoStartBreaks,autoStartPomodoros:Q.autoStartPomodoros,longBreakInterval:Q.longBreakInterval})},[Q.autoStartBreaks,Q.autoStartPomodoros,Q.longBreakInterval]),y(()=>{i(Q.focusSound,Q.focusVolume)},[Q.focusSound,Q.focusVolume]),y(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const K=c(),Y=K.tasks,Z=N(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),q=function(e,t){return N(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(N(()=>Y.filter(e=>!!e.dueDate&&(e.dueDate===Z||e.dueDate<Z&&!e.done)),[Y,Z]),Q.checkToBottom),[G,ee]=w(()=>localStorage.getItem(I)),[te,ae]=w(!1),[oe,re]=w(null),ne=C(!1);y(()=>{ne.current||(ne.current=!0,d(Y,K.setAllTasks))},[]),y(()=>{try{G?localStorage.setItem(I,G):localStorage.removeItem(I)}catch{}},[G]),y(()=>{if(!oe)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[oe]);const se=C(t.streak);y(()=>{if(t.streak>se.current&&G){const e=Y.find(e=>e.id===G);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=Q.autoCheckTasks&&a>0&&t>=a;K.updateTask(G,{completed:t,done:e.done||o})}}se.current=t.streak},[t.streak,G,Q.autoCheckTasks,Y,K]);const ie=q.reduce((e,t)=>e+(t.completed??0),0),ce=q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),de=q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),ue=t.running&&"focus"===t.mode?t.remaining:0,me=de*Q.focusMinutes*60+ue,he=new Date(Date.now()+1e3*me).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ge=(me/3600).toFixed(1),pe=G?Y.find(e=>e.id===G)??null:null,fe=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ke]=w(()=>e(j)),[ve,ye]=w(!1),[Ne,we]=w(xe),[Ce,Se]=w(Q);x(S(()=>{we({...xe}),Se({...Q}),ye(!0)},[xe,Q]));const Be="focus"!==t.mode,Me=A[t.mode],Te=Be?(je=Me,Ie=xe.activeOpacity/100,`rgba(${parseInt(je.slice(1,3),16)}, ${parseInt(je.slice(3,5),16)}, ${parseInt(je.slice(5,7),16)}, ${Ie})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var je,Ie;const Pe={primary:Be?"text-white":"text-gray-900",secondary:Be?"text-white/85":"text-gray-700",muted:Be?"text-white/65":"text-gray-500",tabActive:Be?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Be?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Be?"border-white/30":"border-gray-200",softDivider:Be?"border-white/20":"border-gray-200",iconBtn:Be?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Be?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Ae=Be?Me:"#0f172a";/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-QASZIYLG.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as r,setPomoAlarm as n,setPomoAlarmConfig as l,setPomoBehaviour as s,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as g,playAlarm as p,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-HA2WG27U.js";import"./chunk-KSSAVLO7.js";import{useWidgetSettings as x}from"./chunk-VXBJNMAA.js";import{useShellPrefs as k}from"./chunk-CRI4UFBU.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-BKDE67DB.js";import"./chunk-6KO2U66R.js";import"./chunk-M4DB7UBZ.js";import"./chunk-UVZIPXIA.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-D65T4H6J.js";import"./chunk-X4FJ54PP.js";import"./chunk-NCQLGQYR.js";import{useSyncExternalStore as v,useEffect as y,useMemo as N,useState as w,useRef as C,useCallback as S}from"react";import{jsxs as B,Fragment as M,jsx as T}from"react/jsx-runtime";var j="pomodoro_appearance",P="pomodoro_active_task_id",I={focus:"Pomodoro",short:"Short Break",long:"Long Break"},A={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var L=25,$=5,D=15,V=!1,R=!1,_=4,W=!0,F=!0,O="bell",E=100,U=1,H="none",Z=50,z=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function J(){const t=v(a,o,o),{prefs:p,save:b}=k(),J=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:z(t.focusMinutes,1,120,L),shortBreakMinutes:z(t.shortBreakMinutes,1,120,$),longBreakMinutes:z(t.longBreakMinutes,1,120,D),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:V,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:R,longBreakInterval:z(t.longBreakInterval,1,20,_),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:W,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:F,alarmSound:g.some(e=>e.id===t.alarmSound)?t.alarmSound:O,alarmVolume:z(t.alarmVolume,0,100,E),alarmRepeat:z(t.alarmRepeat,1,5,U),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:H,focusVolume:z(t.focusVolume,0,100,Z)}}(p.pomodoro_settings);y(()=>{r({focus:60*J.focusMinutes,short:60*J.shortBreakMinutes,long:60*J.longBreakMinutes})},[J.focusMinutes,J.shortBreakMinutes,J.longBreakMinutes]),y(()=>{n(J.alarmSound),l(J.alarmVolume,J.alarmRepeat)},[J.alarmSound,J.alarmVolume,J.alarmRepeat]),y(()=>{s({autoStartBreaks:J.autoStartBreaks,autoStartPomodoros:J.autoStartPomodoros,longBreakInterval:J.longBreakInterval})},[J.autoStartBreaks,J.autoStartPomodoros,J.longBreakInterval]),y(()=>{i(J.focusSound,J.focusVolume)},[J.focusSound,J.focusVolume]),y(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const Q=c(),X=Q.tasks,G=N(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),Y=function(e,t){return N(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(N(()=>X.filter(e=>!!e.dueDate&&(e.dueDate===G||e.dueDate<G&&!e.done)),[X,G]),J.checkToBottom),[q,ee]=w(()=>localStorage.getItem(P)),[te,ae]=w(!1),[oe,re]=w(null),ne=C(!1);y(()=>{ne.current||(ne.current=!0,d(X,Q.setAllTasks))},[]),y(()=>{try{q?localStorage.setItem(P,q):localStorage.removeItem(P)}catch{}},[q]),y(()=>{if(!oe)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[oe]);const se=C(t.streak);y(()=>{if(t.streak>se.current&&q){const e=X.find(e=>e.id===q);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=J.autoCheckTasks&&a>0&&t>=a;Q.updateTask(q,{completed:t,done:e.done||o})}}se.current=t.streak},[t.streak,q,J.autoCheckTasks,X,Q]);const ie=Y.reduce((e,t)=>e+(t.completed??0),0),ce=Y.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),de=Y.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),ue=t.running&&"focus"===t.mode?t.remaining:0,me=de*J.focusMinutes*60+ue,he=new Date(Date.now()+1e3*me).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ge=(me/3600).toFixed(1),pe=q?X.find(e=>e.id===q)??null:null,fe=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ke]=w(()=>e(j)),[ve,ye]=w(!1),[Ne,we]=w(xe),[Ce,Se]=w(J);x(S(()=>{we({...xe}),Se({...J}),ye(!0)},[xe,J]));const Be="focus"!==t.mode,Me=A[t.mode],Te=Be?(je=Me,Pe=xe.activeOpacity/100,`rgba(${parseInt(je.slice(1,3),16)}, ${parseInt(je.slice(3,5),16)}, ${parseInt(je.slice(5,7),16)}, ${Pe})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var je,Pe;const Ie={primary:Be?"text-white":"text-gray-900",secondary:Be?"text-white/85":"text-gray-700",muted:Be?"text-white/65":"text-gray-500",tabActive:Be?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Be?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Be?"border-white/30":"border-gray-200",softDivider:Be?"border-white/20":"border-gray-200",iconBtn:Be?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Be?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Ae=Be?Me:"#0f172a";/* @__PURE__ */
2
2
  return B(M,{children:[
3
- /* @__PURE__ */B("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Pe.primary}`,style:{backgroundColor:Te,backdropFilter:xe.activeBlur>0?`blur(${xe.activeBlur}px)`:void 0},children:[
4
- /* @__PURE__ */T("div",{className:"px-3 pt-3 flex justify-center gap-1.5",children:["focus","short","long"].map(e=>/* @__PURE__ */T("button",{onClick:()=>u(e),className:`px-2.5 py-1 text-[13px] font-bold rounded transition-colors ${t.mode===e?Pe.tabActive:Pe.tabInactive}`,children:P[e]},e))}),
3
+ /* @__PURE__ */B("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Ie.primary}`,style:{backgroundColor:Te,backdropFilter:xe.activeBlur>0?`blur(${xe.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */T("div",{className:"px-3 pt-3 flex justify-center gap-1.5",children:["focus","short","long"].map(e=>/* @__PURE__ */T("button",{onClick:()=>u(e),className:`px-2.5 py-1 text-[13px] font-bold rounded transition-colors ${t.mode===e?Ie.tabActive:Ie.tabInactive}`,children:I[e]},e))}),
5
5
  /* @__PURE__ */B("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[fe,":",be]}),
6
6
  /* @__PURE__ */T("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */T("button",{onClick:()=>t.running?m():h(),className:"bg-white px-12 py-2.5 rounded-md font-bold text-base shadow-[0_4px_0_rgba(0,0,0,0.12)] hover:shadow-[0_3px_0_rgba(0,0,0,0.12)] active:translate-y-1 active:shadow-none transition-all",style:{color:Ae,letterSpacing:"0.08em"},children:t.running?"PAUSE":"START"})}),
7
7
  /* @__PURE__ */T("div",{className:"px-3 py-3 text-center",children:pe?/* @__PURE__ */B(M,{children:[
8
- /* @__PURE__ */B("div",{className:`text-xs leading-tight ${Pe.muted}`,children:["#",(pe.completed??0)+1]}),
9
- /* @__PURE__ */T("div",{className:`text-[15px] font-medium leading-tight truncate mt-0.5 ${Pe.primary}`,children:pe.name})]}):/* @__PURE__ */T("div",{className:`text-xs italic ${Pe.muted}`,children:"No task selected"})}),
8
+ /* @__PURE__ */B("div",{className:`text-xs leading-tight ${Ie.muted}`,children:["#",(pe.completed??0)+1]}),
9
+ /* @__PURE__ */T("div",{className:`text-[15px] font-medium leading-tight truncate mt-0.5 ${Ie.primary}`,children:pe.name})]}):/* @__PURE__ */T("div",{className:`text-xs italic ${Ie.muted}`,children:"No task selected"})}),
10
10
  /* @__PURE__ */B("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
- /* @__PURE__ */T("h3",{className:`text-base font-bold tracking-tight ${Pe.primary}`,children:"Tasks"}),
12
- /* @__PURE__ */T("button",{className:`rounded p-1 transition-colors ${Pe.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */B("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[
11
+ /* @__PURE__ */T("h3",{className:`text-base font-bold tracking-tight ${Ie.primary}`,children:"Tasks"}),
12
+ /* @__PURE__ */T("button",{className:`rounded p-1 transition-colors ${Ie.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */B("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[
13
13
  /* @__PURE__ */T("circle",{cx:"12",cy:"5",r:"1.4"}),
14
14
  /* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"1.4"}),
15
15
  /* @__PURE__ */T("circle",{cx:"12",cy:"19",r:"1.4"})]})})]}),
16
- /* @__PURE__ */T("div",{className:`border-t mx-3 mt-2 ${Pe.divider}`}),
17
- /* @__PURE__ */B("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[q.map(e=>{const t=e.id===G;/* @__PURE__ */
16
+ /* @__PURE__ */T("div",{className:`border-t mx-3 mt-2 ${Ie.divider}`}),
17
+ /* @__PURE__ */B("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[Y.map(e=>{const t=e.id===q;/* @__PURE__ */
18
18
  return B("div",{onClick:()=>ee(e.id),className:"bg-white text-gray-800 rounded-md flex items-center pr-2 py-2.5 shadow-sm cursor-pointer transition-shadow hover:shadow-md "+(t?"border-l-4 border-gray-700 pl-2":"pl-3 border-l-4 border-transparent"),children:[
19
- /* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,K.toggleDone(a)},className:"shrink-0",children:e.done?/* @__PURE__ */T("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Ae},children:/* @__PURE__ */T("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */T("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"10"})})}),
19
+ /* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,Q.toggleDone(a)},className:"shrink-0",children:e.done?/* @__PURE__ */T("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Ae},children:/* @__PURE__ */T("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */T("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"10"})})}),
20
20
  /* @__PURE__ */T("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
21
21
  /* @__PURE__ */B("span",{className:"text-sm tabular-nums mr-1.5 shrink-0",children:[
22
22
  /* @__PURE__ */T("span",{className:"font-bold text-gray-500",children:e.completed??0}),
@@ -26,54 +26,54 @@ return B("div",{onClick:()=>ee(e.id),className:"bg-white text-gray-800 rounded-m
26
26
  /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),re(oe===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */B("svg",{className:"h-4 w-4 text-gray-500",viewBox:"0 0 24 24",fill:"currentColor",children:[
27
27
  /* @__PURE__ */T("circle",{cx:"12",cy:"5",r:"1.4"}),
28
28
  /* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"1.4"}),
29
- /* @__PURE__ */T("circle",{cx:"12",cy:"19",r:"1.4"})]})}),oe===e.id&&/* @__PURE__ */T("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,K.removeTask(a),G===a&&ee(null),re(null)},className:"block w-full px-3 py-1.5 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),te?/* @__PURE__ */T(le,{onSubmit:(e,t)=>{const a=e.trim();if(!a)return;const o=K.addTask({name:a,estimated:t,completed:0,dueDate:Z});G||ee(o),ae(!1)},onCancel:()=>ae(!1),accentColor:Ae}):/* @__PURE__ */B("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Pe.addTaskBtn}`,children:[
29
+ /* @__PURE__ */T("circle",{cx:"12",cy:"19",r:"1.4"})]})}),oe===e.id&&/* @__PURE__ */T("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,Q.removeTask(a),q===a&&ee(null),re(null)},className:"block w-full px-3 py-1.5 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),te?/* @__PURE__ */T(le,{onSubmit:(e,t)=>{const a=e.trim();if(!a)return;const o=Q.addTask({name:a,estimated:t,completed:0,dueDate:G});q||ee(o),ae(!1)},onCancel:()=>ae(!1),accentColor:Ae}):/* @__PURE__ */B("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Ie.addTaskBtn}`,children:[
30
30
  /* @__PURE__ */B("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
31
31
  /* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"10"}),
32
32
  /* @__PURE__ */T("path",{strokeLinecap:"round",d:"M8 12h8M12 8v8"})]}),"Add Task"]})]}),
33
- /* @__PURE__ */B("div",{className:`border-t px-3 py-2.5 flex items-center justify-center gap-5 text-sm ${Pe.softDivider}`,children:[
34
- /* @__PURE__ */B("span",{className:Pe.secondary,children:["Pomos: ",
35
- /* @__PURE__ */T("span",{className:`font-bold ${Pe.primary}`,children:ie}),
36
- /* @__PURE__ */T("span",{className:Pe.muted,children:" / "}),
37
- /* @__PURE__ */T("span",{className:`font-bold ${Pe.primary}`,children:ce})]}),me>0&&/* @__PURE__ */B("span",{className:Pe.secondary,children:["Finish At: ",
38
- /* @__PURE__ */T("span",{className:`font-bold ${Pe.primary}`,children:he}),
39
- /* @__PURE__ */B("span",{className:Pe.muted,children:[" (",ge,"h)"]})]})]})]}),
40
- /* @__PURE__ */T(X,{open:ve,onClose:()=>ye(!1),onSave:()=>{ke(Ne),localStorage.setItem(j,JSON.stringify(Ne)),b({pomodoro_settings:Ce}),ye(!1)},configAppearance:Ne,setConfigAppearance:we,configPrefs:Ce,setConfigPrefs:Se})]})}function X({open:e,onClose:a,onSave:o,configAppearance:r,setConfigAppearance:n,configPrefs:l,setConfigPrefs:s}){const i=(e,t)=>s(a=>({...a,[e]:t}));/* @__PURE__ */
33
+ /* @__PURE__ */B("div",{className:`border-t px-3 py-2.5 flex items-center justify-center gap-5 text-sm ${Ie.softDivider}`,children:[
34
+ /* @__PURE__ */B("span",{className:Ie.secondary,children:["Pomos: ",
35
+ /* @__PURE__ */T("span",{className:`font-bold ${Ie.primary}`,children:ie}),
36
+ /* @__PURE__ */T("span",{className:Ie.muted,children:" / "}),
37
+ /* @__PURE__ */T("span",{className:`font-bold ${Ie.primary}`,children:ce})]}),me>0&&/* @__PURE__ */B("span",{className:Ie.secondary,children:["Finish At: ",
38
+ /* @__PURE__ */T("span",{className:`font-bold ${Ie.primary}`,children:he}),
39
+ /* @__PURE__ */B("span",{className:Ie.muted,children:[" (",ge,"h)"]})]})]})]}),
40
+ /* @__PURE__ */T(K,{open:ve,onClose:()=>ye(!1),onSave:()=>{ke(Ne),localStorage.setItem(j,JSON.stringify(Ne)),b({pomodoro_settings:Ce}),ye(!1)},configAppearance:Ne,setConfigAppearance:we,configPrefs:Ce,setConfigPrefs:Se})]})}function K({open:e,onClose:a,onSave:o,configAppearance:r,setConfigAppearance:n,configPrefs:l,setConfigPrefs:s}){const i=(e,t)=>s(a=>({...a,[e]:t}));/* @__PURE__ */
41
41
  return B(t,{open:e,onClose:a,title:"Pomodoro Settings",appearance:r,onAppearanceChange:n,onSave:o,children:[
42
- /* @__PURE__ */B(K,{icon:/* @__PURE__ */T(oe,{}),label:"TIMER",children:[
42
+ /* @__PURE__ */B(Q,{icon:/* @__PURE__ */T(oe,{}),label:"TIMER",children:[
43
43
  /* @__PURE__ */B("div",{children:[
44
44
  /* @__PURE__ */T("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
45
45
  /* @__PURE__ */B("div",{className:"grid grid-cols-3 gap-3",children:[
46
- /* @__PURE__ */T(q,{label:"Pomodoro",value:l.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
47
- /* @__PURE__ */T(q,{label:"Short Break",value:l.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
48
- /* @__PURE__ */T(q,{label:"Long Break",value:l.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
49
- /* @__PURE__ */T(Y,{label:"Auto Start Breaks",children:/* @__PURE__ */T(te,{checked:l.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
50
- /* @__PURE__ */T(Y,{label:"Auto Start Pomodoros",children:/* @__PURE__ */T(te,{checked:l.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
51
- /* @__PURE__ */T(Y,{label:"Long Break interval",children:/* @__PURE__ */T(G,{value:l.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
52
- /* @__PURE__ */B(K,{icon:/* @__PURE__ */T(re,{}),label:"TASK",children:[
53
- /* @__PURE__ */T(Y,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */T(te,{checked:l.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
54
- /* @__PURE__ */T(Y,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */T(te,{checked:l.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
55
- /* @__PURE__ */B(K,{icon:/* @__PURE__ */T(ne,{}),label:"SOUND",children:[
56
- /* @__PURE__ */T(Y,{label:"Alarm Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
46
+ /* @__PURE__ */T(Y,{label:"Pomodoro",value:l.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
47
+ /* @__PURE__ */T(Y,{label:"Short Break",value:l.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
48
+ /* @__PURE__ */T(Y,{label:"Long Break",value:l.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
49
+ /* @__PURE__ */T(X,{label:"Auto Start Breaks",children:/* @__PURE__ */T(te,{checked:l.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
50
+ /* @__PURE__ */T(X,{label:"Auto Start Pomodoros",children:/* @__PURE__ */T(te,{checked:l.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
51
+ /* @__PURE__ */T(X,{label:"Long Break interval",children:/* @__PURE__ */T(q,{value:l.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
52
+ /* @__PURE__ */B(Q,{icon:/* @__PURE__ */T(re,{}),label:"TASK",children:[
53
+ /* @__PURE__ */T(X,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */T(te,{checked:l.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
54
+ /* @__PURE__ */T(X,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */T(te,{checked:l.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
55
+ /* @__PURE__ */B(Q,{icon:/* @__PURE__ */T(ne,{}),label:"SOUND",children:[
56
+ /* @__PURE__ */T(X,{label:"Alarm Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
57
57
  /* @__PURE__ */T(ee,{value:l.alarmSound,onChange:e=>i("alarmSound",e),options:g.map(e=>({id:e.id,label:e.label}))}),"off"!==l.alarmSound&&/* @__PURE__ */T("button",{type:"button",onClick:()=>p(l.alarmSound,{volume:l.alarmVolume,repeat:1}),className:"px-2 py-1 text-[11px] rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
58
- /* @__PURE__ */T(Z,{value:l.alarmVolume,onChange:e=>i("alarmVolume",e)}),
59
- /* @__PURE__ */T(Y,{label:"repeat",children:/* @__PURE__ */T(G,{value:l.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
60
- /* @__PURE__ */T(Y,{label:"Focus Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
58
+ /* @__PURE__ */T(G,{value:l.alarmVolume,onChange:e=>i("alarmVolume",e)}),
59
+ /* @__PURE__ */T(X,{label:"repeat",children:/* @__PURE__ */T(q,{value:l.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
60
+ /* @__PURE__ */T(X,{label:"Focus Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
61
61
  /* @__PURE__ */T(ee,{value:l.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==l.focusSound&&/* @__PURE__ */T("button",{type:"button",onClick:()=>b(l.focusSound,l.focusVolume),className:"px-2 py-1 text-[11px] rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
62
- /* @__PURE__ */T(Z,{value:l.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function K({icon:e,label:t,children:a}){/* @__PURE__ */
62
+ /* @__PURE__ */T(G,{value:l.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function Q({icon:e,label:t,children:a}){/* @__PURE__ */
63
63
  return B("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
64
64
  /* @__PURE__ */B("div",{className:"flex items-center gap-1.5 mb-3 text-gray-400",children:[e,
65
65
  /* @__PURE__ */T("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
66
- /* @__PURE__ */T("div",{className:"space-y-3",children:a})]})}function Y({label:e,info:t,children:a}){/* @__PURE__ */
66
+ /* @__PURE__ */T("div",{className:"space-y-3",children:a})]})}function X({label:e,info:t,children:a}){/* @__PURE__ */
67
67
  return B("div",{className:"flex items-center justify-between gap-3",children:[
68
68
  /* @__PURE__ */B("div",{className:"flex items-center gap-1.5 min-w-0",children:[
69
69
  /* @__PURE__ */T("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */T(ae,{title:t})]}),
70
- /* @__PURE__ */T("div",{className:"shrink-0",children:a})]})}function Z({value:e,onChange:t}){/* @__PURE__ */
70
+ /* @__PURE__ */T("div",{className:"shrink-0",children:a})]})}function G({value:e,onChange:t}){/* @__PURE__ */
71
71
  return B("div",{className:"flex items-center justify-end gap-3",children:[
72
72
  /* @__PURE__ */T("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
73
- /* @__PURE__ */T("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function q({label:e,value:t,onChange:a,min:o=1,max:r=99}){/* @__PURE__ */
73
+ /* @__PURE__ */T("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function Y({label:e,value:t,onChange:a,min:o=1,max:r=99}){/* @__PURE__ */
74
74
  return B("label",{className:"flex flex-col",children:[
75
75
  /* @__PURE__ */T("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
76
- /* @__PURE__ */T(G,{value:t,onChange:a,min:o,max:r})]})}function G({value:e,onChange:t,min:a=1,max:o=99,className:r=""}){/* @__PURE__ */
76
+ /* @__PURE__ */T(q,{value:t,onChange:a,min:o,max:r})]})}function q({value:e,onChange:t,min:a=1,max:o=99,className:r=""}){/* @__PURE__ */
77
77
  return T("input",{type:"number",min:a,max:o,value:e,onChange:e=>t(Math.max(a,Math.min(o,parseInt(e.target.value,10)||a))),className:`bg-gray-100 border-0 rounded-md px-2 py-1.5 text-sm font-medium text-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500 w-full ${r}`})}function ee({value:e,onChange:t,options:a}){/* @__PURE__ */
78
78
  return B("div",{className:"relative",children:[
79
79
  /* @__PURE__ */T("select",{value:e,onChange:e=>t(e.target.value),className:"appearance-none bg-gray-100 border-0 rounded-md pl-3 pr-8 py-1.5 text-sm font-medium text-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer",children:a.map(e=>/* @__PURE__ */T("option",{value:e.id,children:e.label},e.id))}),
@@ -96,4 +96,4 @@ return B("div",{className:"bg-white text-gray-800 rounded-md p-3 shadow-md",chil
96
96
  /* @__PURE__ */T("input",{type:"number",min:1,max:20,value:n,onChange:e=>l(Math.max(1,Math.min(20,parseInt(e.target.value,10)||1))),className:"w-16 bg-gray-100 rounded px-2 py-1 text-sm text-right border-0 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),
97
97
  /* @__PURE__ */B("div",{className:"flex gap-2 mt-3 justify-end",children:[
98
98
  /* @__PURE__ */T("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
99
- /* @__PURE__ */T("button",{onClick:s,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:a},children:"Save"})]})]})}export{Q as default};
99
+ /* @__PURE__ */T("button",{onClick:s,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:a},children:"Save"})]})]})}export{J as default};