efficient-shell 5.0.0 → 5.2.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 (69) hide show
  1. package/README.md +98 -2
  2. package/dist/{Browser-5F5LWXYQ.js → Browser-FKZ6M2MK.js} +18 -18
  3. package/dist/Calculator-LBFBTFSD.js +29 -0
  4. package/dist/ConfirmDialog-JAEFVRJM.js +1 -0
  5. package/dist/{CurrencyConverter-QEG6RFAS.js → CurrencyConverter-OV5ZQIAJ.js} +7 -7
  6. package/dist/{Documents-6DEUZVVA.js → Documents-HGGL3AWI.js} +24 -24
  7. package/dist/Files-DAQKIF6W.js +87 -0
  8. package/dist/{Notepad-KNJRTYXR.js → Notepad-PO724TVP.js} +10 -10
  9. package/dist/PdfViewer-6ALXGVTV.js +1 -0
  10. package/dist/{PomodoroTimer-T6YAQFIE.js → PomodoroTimer-LN5MYRZO.js} +49 -49
  11. package/dist/{Preview-KEIDYSHF.js → Preview-CUOO5WQ7.js} +126 -126
  12. package/dist/Sidebar-T4ABK2WV.js +44 -0
  13. package/dist/{Spreadsheet-HKXSYD5B.js → Spreadsheet-2N2JXBCY.js} +14 -14
  14. package/dist/{Stock-BZFC2ROU.js → Stock-65WVUGLI.js} +4 -4
  15. package/dist/{Weather-S3N5OWYF.js → Weather-TXJICMJN.js} +18 -18
  16. package/dist/{WorldClock-ACC3S6OA.js → WorldClock-RIHLKZGC.js} +6 -6
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/brand.css +1 -1
  20. package/dist/{chunk-WNEO7TSP.js → chunk-3PTA2C74.js} +1 -1
  21. package/dist/chunk-4QBLTEFU.js +1 -0
  22. package/dist/{chunk-TKUNR5KP.js → chunk-6GV4467L.js} +2 -2
  23. package/dist/chunk-AJB5G52B.js +1 -0
  24. package/dist/{chunk-2DX65GOO.js → chunk-ASSDCWKP.js} +1 -1
  25. package/dist/{chunk-MIAJQGWE.js → chunk-BFFXVA53.js} +1 -1
  26. package/dist/{chunk-R7EBJKN2.js → chunk-BFUBBDU6.js} +30 -30
  27. package/dist/{chunk-NHIGOEZF.js → chunk-H3UEYXRA.js} +1 -1
  28. package/dist/{chunk-ZDF5AR5W.js → chunk-HIAHERCD.js} +7 -7
  29. package/dist/{chunk-XUF7VW4U.js → chunk-JJIPGAXI.js} +29 -28
  30. package/dist/{chunk-T4CFSGSL.js → chunk-KHJ5XSEH.js} +8 -8
  31. package/dist/{chunk-KDRAU4XQ.js → chunk-M4OGNYOM.js} +8 -8
  32. package/dist/{chunk-P4SGJTK3.js → chunk-ML22KF7T.js} +1 -1
  33. package/dist/{chunk-ZZKIKW62.js → chunk-MTH7EAH3.js} +21 -21
  34. package/dist/{chunk-FOEVG7RT.js → chunk-OTP5WPI4.js} +8 -8
  35. package/dist/chunk-PS6PSCOR.js +1018 -0
  36. package/dist/{chunk-5IWSOLLY.js → chunk-QZNRMJE6.js} +2 -2
  37. package/dist/{chunk-VJP3R52B.js → chunk-R3622MOL.js} +1 -1
  38. package/dist/{chunk-PQLVWCUI.js → chunk-SSBOC52S.js} +4 -4
  39. package/dist/{chunk-3DGTIWZP.js → chunk-TKFAFZRY.js} +1 -1
  40. package/dist/{chunk-SBDIHKLU.js → chunk-TLTFS2D6.js} +51 -51
  41. package/dist/{chunk-GMMTTWHB.js → chunk-UAJQB45Y.js} +1 -1
  42. package/dist/{chunk-LK7V32MR.js → chunk-UG4ZPXXU.js} +1 -1
  43. package/dist/{chunk-QRV7RNQX.js → chunk-Y553QKEH.js} +14 -14
  44. package/dist/{chunk-PE4F4MJE.js → chunk-YJ6JMGMS.js} +4 -4
  45. package/dist/{chunk-LMIQV3NB.js → chunk-YQI7KXX3.js} +2 -2
  46. package/dist/file-intake/index.js +1 -1
  47. package/dist/i18n/index.d.ts +1 -1
  48. package/dist/{index-HMDUOPnX.d.ts → index-Dk5VKml6.d.ts} +401 -3
  49. package/dist/index.d.ts +3 -3
  50. package/dist/index.js +112 -112
  51. package/dist/locales/zh-Hans.d.ts +1 -1
  52. package/dist/locales/zh-Hans.js +1 -1
  53. package/dist/map/index.js +5 -5
  54. package/dist/markdown/index.js +1 -1
  55. package/dist/page-tabs/index.js +5 -5
  56. package/dist/pdf/index.js +1 -1
  57. package/dist/{strings-ZbotP_I6.d.ts → strings-aKfRDZWB.d.ts} +56 -0
  58. package/dist/ui/index.d.ts +2 -2
  59. package/dist/ui/index.js +1 -1
  60. package/dist/ui.css +63 -0
  61. package/package.json +1 -1
  62. package/dist/Calculator-4K53PFBL.js +0 -29
  63. package/dist/ConfirmDialog-X2DPOYWO.js +0 -1
  64. package/dist/Files-2VSFXA45.js +0 -87
  65. package/dist/PdfViewer-UZGDE4HD.js +0 -1
  66. package/dist/Sidebar-3NZRIL7F.js +0 -44
  67. package/dist/chunk-67PNFBCW.js +0 -993
  68. package/dist/chunk-J3LIIIHJ.js +0 -1
  69. package/dist/chunk-YKHMAGEM.js +0 -1
@@ -0,0 +1,87 @@
1
+ import{openPreviewFile as e}from"./chunk-H3UEYXRA.js";import{Breadcrumbs as t}from"./chunk-R3622MOL.js";import{SidebarLayout as a}from"./chunk-YJ6JMGMS.js";import{getFilesDemoTree as r}from"./chunk-ML22KF7T.js";import{AboutApp as n}from"./chunk-6GV4467L.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as s,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as o,subscribeDesktopFolders as c,getDesktopFoldersSnapshot as d,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-YQI7KXX3.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as u}from"./chunk-TLTFS2D6.js";import"./chunk-DSSLOQDW.js";import"./chunk-UAJQB45Y.js";import"./chunk-4QBLTEFU.js";import{toast_default as x}from"./chunk-TKFAFZRY.js";import"./chunk-SSBOC52S.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import{confirm as g,prompt as y}from"./chunk-MTH7EAH3.js";import"./chunk-HIAHERCD.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{CloseCircleFallback as b,ArrowLeftFallback as k,RefreshFallback as N,TrashFallback as w,FolderPlusFallback as v,UploadFallbackB as j,FolderFallback as $,PageFallback as C}from"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import{formatBytes as L}from"./chunk-W32SKK3D.js";import{Icon as T}from"./chunk-YKZHOXI4.js";import{useState as D,useEffect as E,useSyncExternalStore as R,useRef as S,useCallback as F}from"react";import{jsxs as A,jsx as I,Fragment as O}from"react/jsx-runtime";var P="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 W(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function U(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function H(){const H=P.replace(/\/$/,""),J=null!==r(),[B,V]=D("/"),[X,z]=D([]),[K,Q]=D([]),[_,Y]=D(null),[G,Z]=D(!0),[q,ee]=D(!1),[te,ae]=D(null),[re,ne]=D(!1),[ie,se]=D(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});E(()=>{s()},[]);const[le,oe]=D([]);E(()=>{const e=()=>{s(),se("trash")},t=e=>{s();const t=e.detail?.folderId;t&&se({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(o,t),()=>{window.removeEventListener(l,e),window.removeEventListener(o,t)}},[]);const ce=R(c,d,d),de="object"==typeof ie?ie.desktopFolderId:null,me=de?ce?.folders.find(e=>e.id===de)??null:null,he=de&&ce?.itemsByFolder[de]||[];E(()=>{de&&ce&&!ce.folders.some(e=>e.id===de)&&se("files")},[de,ce]);const pe=S(0),fe=S(null),{openPage:ue,openEntity:xe}=f(),ge=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ue(e)}):"page"===t.entityType?ue(t.entityId):xe(t.entityType,t.entityId,null,t.label)},ye=F((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),be=F(async()=>{try{const e=await ye(`${H}/api/quota`);if(e.ok){const t=await e.json();ae({used:t.used,limit:t.limit})}}catch{}},[ye,H]),ke=F(async e=>{if(Y(null),J){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return z(t),V(e),ee(!1),Z(!1),void("/"===e&&Q(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Z(!0);try{const t=await ye(`${H}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];z(r),V(a.path||e),ee(!1),"/"===(a.path||e)&&Q(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){ee(!0)}finally{Z(!1)}be()},[ye,H,be,J]),Ne=F(async()=>{if(J)return oe([]),void Z(!1);Z(!0),Y(null);try{const e=await ye(`${H}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();oe(t.entries||[]),ee(!1)}catch{ee(!0)}finally{Z(!1)}be()},[ye,H,be,J]);E(()=>{"files"===ie?ke(B):"trash"===ie&&Ne()},[B,ie]);const we=async e=>{const t=W(B,e.name);try{const a=await ye(`${H}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void x.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},ve=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await ye(`${H}/api/upload?path=${encodeURIComponent(B)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));x.error(`Quota exceeded — ${L(a)} free, ${e.name} is ${L(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ke(B)},je=()=>{pe.current=0,ne(!1)};if(E(()=>{const e=()=>je();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),q)/* @__PURE__ */
2
+ return A("div",{className:"flex flex-col h-full bg-white",children:[
3
+ /* @__PURE__ */I(u,{title:"Files - offline"}),
4
+ /* @__PURE__ */I("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */A("div",{className:"max-w-md",children:[
5
+ /* @__PURE__ */I(T,{name:"close-circle",fallback:b,className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
+ /* @__PURE__ */I("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
+ /* @__PURE__ */A("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
+ /* @__PURE__ */I("span",{className:"font-mono",children:H}),". Make sure the server is running — see ",
9
+ /* @__PURE__ */I("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
+ /* @__PURE__ */I("button",{onClick:()=>ke(B),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const $e="/"===B?[]:B.split("/").filter(Boolean),Ce=te&&te.limit>0?Math.min(100,Math.round(te.used/te.limit*100)):0,Le=Ce>90?"bg-red-500":Ce>75?"bg-amber-500":"bg-blue-500",Te=[{label:"My files",onClick:()=>V("/")},...$e.map((e,t)=>({label:e,onClick:()=>V("/"+$e.slice(0,t+1).join("/"))}))],De=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"),Ee=e=>/* @__PURE__ */I("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__ */I("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),Re=/* @__PURE__ */A("nav",{className:"p-2",children:[
11
+ /* @__PURE__ */I("div",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
12
+ /* @__PURE__ */A("button",{onClick:()=>{se("files"),V("/")},className:De("files"===ie&&"/"===B),children:[Ee("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"]}),K.map(e=>/* @__PURE__ */A("button",{onClick:()=>{se("files"),V("/"+e)},className:De("files"===ie&&B==="/"+e),children:[Ee("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
13
+ /* @__PURE__ */I("span",{className:"truncate",children:e})]},e)),!J&&/* @__PURE__ */A("button",{onClick:()=>se("trash"),className:De("trash"===ie),children:[Ee("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"]}),ce&&ce.folders.length>0&&/* @__PURE__ */A(O,{children:[
14
+ /* @__PURE__ */I("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ce.folders.map(e=>/* @__PURE__ */A("button",{onClick:()=>se({desktopFolderId:e.id}),className:De(de===e.id),children:[
15
+ /* @__PURE__ */I(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
+ /* @__PURE__ */I("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */I("span",{className:"ml-auto text-[10px] text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
17
+ return A("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{J||"object"==typeof ie||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),pe.current++,re||ne(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{pe.current>0&&pe.current--,0===pe.current&&ne(!1)},onDrop:e=>{e.preventDefault(),je(),J||"object"==typeof ie||e.dataTransfer.files?.length&&ve(e.dataTransfer.files)},children:[
18
+ /* @__PURE__ */I(u,{title:me?`Files - ${me.name}`:"Files"+("/"===B?"":" - "+B)}),
19
+ /* @__PURE__ */I(n,{app:"files"}),
20
+ /* @__PURE__ */I("input",{ref:fe,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ve(e.target.files),fe.current&&(fe.current.value="")}}),
21
+ /* @__PURE__ */I("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */I(a,{sidebar:Re,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */A("div",{className:"flex h-full min-w-0 flex-col",children:[
22
+ /* @__PURE__ */A("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__ */A(O,"files"===ie?{children:[
23
+ /* @__PURE__ */I("button",{onClick:()=>V(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(B)),disabled:"/"===B,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */I(T,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
24
+ /* @__PURE__ */I("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */I(t,{items:Te,maxItems:5})}),
25
+ /* @__PURE__ */I("button",{onClick:()=>ke(B),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */I(T,{name:"refresh",fallback:N,className:"h-3.5 w-3.5",strokeWidth:1.8})}),!J&&/* @__PURE__ */A(O,{children:[
26
+ /* @__PURE__ */A("button",{onClick:()=>se("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__ */I(T,{name:"trash",fallback:w,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
28
+ /* @__PURE__ */A("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void x.error("Folder names cannot contain slashes");const t=W(B,e),a=await ye(`${H}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Create folder failed (${a.status})`)}ke(B)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
29
+ /* @__PURE__ */I(T,{name:"folder-plus",fallback:v,className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
30
+ /* @__PURE__ */A("button",{onClick:()=>fe.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
31
+ /* @__PURE__ */I(T,{name:"upload",fallback:j,className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===ie?{children:[
32
+ /* @__PURE__ */I("button",{onClick:()=>se("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */I(T,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
33
+ /* @__PURE__ */I("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
34
+ /* @__PURE__ */I("button",{onClick:Ne,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */I(T,{name:"refresh",fallback:N,className:"h-3.5 w-3.5",strokeWidth:1.8})}),
35
+ /* @__PURE__ */I("button",{onClick:async()=>{if(0===le.length)return;if(!await g({title:"Empty trash",message:`${le.length} item${1===le.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await ye(`${H}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Empty trash failed (${e.status})`)}Ne()},disabled:0===le.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
36
+ /* @__PURE__ */I("button",{onClick:()=>se("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */I(T,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
37
+ /* @__PURE__ */I(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
38
+ /* @__PURE__ */I("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:me?.name??"Desktop folder"}),
39
+ /* @__PURE__ */I("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),te&&/* @__PURE__ */A(O,{children:[
40
+ /* @__PURE__ */I("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
+ /* @__PURE__ */A("div",{className:"flex items-center gap-1.5",title:`${L(te.used)} of ${L(te.limit)} used`,children:[
42
+ /* @__PURE__ */I("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */I("div",{className:`h-full ${Le} transition-all`,style:{width:`${Ce}%`}})}),
43
+ /* @__PURE__ */A("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[L(te.used)," / ",L(te.limit)]})]})]})]}),
44
+ /* @__PURE__ */I("div",{className:"flex-1 overflow-auto",children:"object"==typeof ie?0===he.length?/* @__PURE__ */I("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__ */A("table",{className:"w-full text-sm",children:[
45
+ /* @__PURE__ */I("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */A("tr",{children:[
46
+ /* @__PURE__ */I("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
47
+ /* @__PURE__ */I("th",{className:"text-left font-medium px-3 py-1.5 w-28",children:"Type"}),
48
+ /* @__PURE__ */I("th",{className:"w-56"})]})}),
49
+ /* @__PURE__ */I("tbody",{children:he.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
50
+ return A("tr",{onClick:()=>Y(t),onDoubleClick:()=>ge(e),className:"cursor-default border-b border-gray-100 "+(_===t?"bg-blue-50":"hover:bg-gray-50"),children:[
51
+ /* @__PURE__ */A("td",{className:"px-3 py-1.5 flex items-center gap-2",children:[
52
+ /* @__PURE__ */I(h,{item:e}),
53
+ /* @__PURE__ */I("span",{className:"truncate",title:e.label,children:e.label})]}),
54
+ /* @__PURE__ */I("td",{className:"px-3 py-1.5 text-xs text-gray-500",children:p(e)}),
55
+ /* @__PURE__ */A("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
56
+ /* @__PURE__ */I("button",{onClick:t=>{t.stopPropagation(),ge(e)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Open"}),
57
+ /* @__PURE__ */I("button",{onClick:t=>{t.stopPropagation(),ce?.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"}),
58
+ /* @__PURE__ */I("button",{onClick:t=>{t.stopPropagation(),ce?.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"===ie?G&&0===le.length?/* @__PURE__ */I("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===le.length?/* @__PURE__ */I("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */A("table",{className:"w-full text-sm",children:[
59
+ /* @__PURE__ */I("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */A("tr",{children:[
60
+ /* @__PURE__ */I("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
61
+ /* @__PURE__ */I("th",{className:"text-left font-medium px-3 py-1.5",children:"Original location"}),
62
+ /* @__PURE__ */I("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
63
+ /* @__PURE__ */I("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Deleted"}),
64
+ /* @__PURE__ */I("th",{className:"w-44"})]})}),
65
+ /* @__PURE__ */I("tbody",{children:le.map(e=>/* @__PURE__ */A("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
66
+ /* @__PURE__ */A("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */I(T,{name:"folder",fallback:$,className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */I(T,{name:"page",fallback:C,className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
67
+ /* @__PURE__ */I("span",{className:"truncate",title:e.name,children:e.name})]}),
68
+ /* @__PURE__ */I("td",{className:"px-3 py-1.5 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
69
+ /* @__PURE__ */I("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:L(e.size)}),
70
+ /* @__PURE__ */I("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?U(e.deletedAt):"—"}),
71
+ /* @__PURE__ */A("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
72
+ /* @__PURE__ */I("button",{onClick:()=>(async e=>{const t=await ye(`${H}/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 x.error(e.error||`Restore failed (${t.status})`)}x.success(`Restored "${e.name}"`),Ne()})(e),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Restore"}),
73
+ /* @__PURE__ */I("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await ye(`${H}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${t.status})`)}Ne()})(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))})]}):G&&0===X.length?/* @__PURE__ */I("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===X.length?/* @__PURE__ */A("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!J&&/* @__PURE__ */A(O,{children:[" Drop files here or click ",
74
+ /* @__PURE__ */I("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */A("table",{className:"w-full text-sm",children:[
75
+ /* @__PURE__ */I("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */A("tr",{children:[
76
+ /* @__PURE__ */I("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
77
+ /* @__PURE__ */I("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
78
+ /* @__PURE__ */I("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Modified"}),
79
+ /* @__PURE__ */I("th",{className:"w-32"})]})}),
80
+ /* @__PURE__ */I("tbody",{children:X.map(t=>/* @__PURE__ */A("tr",{onClick:()=>Y(t.name),onDoubleClick:()=>{"folder"===t.kind?V(W(B,t.name)):(async t=>{if(J)return;const a=W(B,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=M[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>ue(e)}):we(t)})(t)},className:"cursor-default border-b border-gray-100 "+(_===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
+ /* @__PURE__ */A("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */I(T,{name:"folder",fallback:$,className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */I(T,{name:"page",fallback:C,className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
82
+ /* @__PURE__ */I("span",{className:"truncate",title:t.name,children:t.name})]}),
83
+ /* @__PURE__ */I("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":L(t.size)}),
84
+ /* @__PURE__ */I("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:U(t.modifiedAt)}),
85
+ /* @__PURE__ */I("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!J&&/* @__PURE__ */A(O,{children:["file"===t.kind&&/* @__PURE__ */I("button",{onClick:e=>{e.stopPropagation(),we(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
86
+ /* @__PURE__ */I("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void x.error("Names cannot contain slashes");const a=W(B,e.name),r=W(B,t),n=await ye(`${H}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:r})});if(!n.ok){const e=await n.json().catch(()=>({}));return void x.error(e.error||`Rename failed (${n.status})`)}ke(B)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
87
+ /* @__PURE__ */I("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=W(B,e.name),a=await ye(`${H}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${a.status})`)}ke(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))})]})})]})})}),re&&/* @__PURE__ */I("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__ */I("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{H as default};
@@ -1,8 +1,8 @@
1
- import{getNumberingConfigs as e}from"./chunk-2DX65GOO.js";import{SidebarLayout as t}from"./chunk-PE4F4MJE.js";import{AboutApp as r}from"./chunk-TKUNR5KP.js";import{useWindowManager as n,client_default as o}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-YKHMAGEM.js";import{toast_default as i}from"./chunk-3DGTIWZP.js";import{useShellPrefs as a}from"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{AddFallback as l,BookmarkFallback as s,BookmarkFallbackB as c,TrashFallback as d,PageFallback as p,CheckFallback as m}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{timeAgo as u}from"./chunk-W32SKK3D.js";import{Icon as h}from"./chunk-YKZHOXI4.js";import{useRef as y,useEffect as g,useState as x,useCallback as b}from"react";import{useQuery as f}from"@tanstack/react-query";import{jsxs as k,Fragment as v,jsx as N}from"react/jsx-runtime";var w=[{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 _={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/"}},T=/\[([ xX]?)\]/g;function j(){const{openEntity:j}=n(),{prefs:W,save:$}=a(),{data:C}=f({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),S=y({});g(()=>{if(!C)return;const e={};for(const t of C){const r=_[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})}}S.current=e},[C]);const X=W.notepad_notes||[],[I,O]=x(null),[D,K]=x(""),[H,P]=x(""),[U,Z]=x("yellow"),[F,M]=x(!1),[q,E]=x(!1),J=y(null),R=y(),A=X.find(e=>e.id===I);g(()=>{if(!I&&X.length>0){const e=X[0];O(e.id),K(e.title),P(e.content),Z(e.color)}},[X.length]);const G=b(e=>{$({notepad_notes:e})},[$]),L=b(()=>{if(!I||!F)return;const e=X.map(e=>e.id===I?{...e,title:D,content:H,color:U,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);G(e),M(!1)},[I,F,D,H,U,X,G]);g(()=>{if(F)return R.current&&clearTimeout(R.current),R.current=setTimeout(L,800),()=>{R.current&&clearTimeout(R.current)}},[F,L]),g(()=>()=>{F&&L()},[]);const Q=e=>{F&&L(),O(e.id),K(e.title),P(e.content),Z(e.color),M(!1),E(!1)},V=e=>{const t=H.slice(0,e),r=H.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=H.slice(e+r[0].length);P(t+n+o),M(!0)},B=async(e,t)=>{const r=S.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?j(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},Y="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",z=/* @__PURE__ */k(v,{children:[
2
- /* @__PURE__ */N("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */k("button",{onClick:()=>{F&&L();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,...X];G(t),O(e.id),K(""),P(""),Z("yellow"),M(!1),E(!0),setTimeout(()=>J.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:[
1
+ import{getNumberingConfigs as e}from"./chunk-ASSDCWKP.js";import{SidebarLayout as t}from"./chunk-YJ6JMGMS.js";import{AboutApp as r}from"./chunk-6GV4467L.js";import{useWindowManager as n,client_default as o}from"./chunk-TLTFS2D6.js";import"./chunk-DSSLOQDW.js";import"./chunk-UAJQB45Y.js";import"./chunk-4QBLTEFU.js";import{toast_default as i}from"./chunk-TKFAFZRY.js";import{useShellPrefs as a}from"./chunk-SSBOC52S.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-MTH7EAH3.js";import"./chunk-HIAHERCD.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{AddFallback as l,BookmarkFallback as s,BookmarkFallbackB as c,TrashFallback as d,PageFallback as p,CheckFallback as m}from"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import{timeAgo as u}from"./chunk-W32SKK3D.js";import{Icon as h}from"./chunk-YKZHOXI4.js";import{useRef as y,useEffect as g,useState as x,useCallback as b}from"react";import{useQuery as f}from"@tanstack/react-query";import{jsxs as k,Fragment as v,jsx as N}from"react/jsx-runtime";var w=[{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 _={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/"}},T=/\[([ xX]?)\]/g;function j(){const{openEntity:j}=n(),{prefs:S,save:C}=a(),{data:$}=f({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),W=y({});g(()=>{if(!$)return;const e={};for(const t of $){const r=_[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},[$]);const X=S.notepad_notes||[],[O,D]=x(null),[A,H]=x(""),[F,I]=x(""),[J,P]=x("yellow"),[K,q]=x(!1),[B,E]=x(!1),M=y(null),Q=y(),R=X.find(e=>e.id===O);g(()=>{if(!O&&X.length>0){const e=X[0];D(e.id),H(e.title),I(e.content),P(e.color)}},[X.length]);const U=b(e=>{C({notepad_notes:e})},[C]),Z=b(()=>{if(!O||!K)return;const e=X.map(e=>e.id===O?{...e,title:A,content:F,color:J,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);U(e),q(!1)},[O,K,A,F,J,X,U]);g(()=>{if(K)return Q.current&&clearTimeout(Q.current),Q.current=setTimeout(Z,800),()=>{Q.current&&clearTimeout(Q.current)}},[K,Z]),g(()=>()=>{K&&Z()},[]);const G=e=>{K&&Z(),D(e.id),H(e.title),I(e.content),P(e.color),q(!1),E(!1)},L=e=>{const t=F.slice(0,e),r=F.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=F.slice(e+r[0].length);I(t+n+o),q(!0)},Y=async(e,t)=>{const r=W.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?j(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},V="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",z=/* @__PURE__ */k(v,{children:[
2
+ /* @__PURE__ */N("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */k("button",{onClick:()=>{K&&Z();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,...X];U(t),D(e.id),H(""),I(""),P("yellow"),q(!1),E(!0),setTimeout(()=>M.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
3
  /* @__PURE__ */N(h,{name:"add",fallback:l,className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
4
  /* @__PURE__ */N("div",{className:"flex-1 overflow-y-auto",children:0===X.length?/* @__PURE__ */N("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):X.map(e=>{const t=(r=e.color,w.find(e=>e.key===r)||w[0]);var r;/* @__PURE__ */
5
- return k("button",{onClick:()=>Q(e),className:"w-full text-left px-3 py-2.5 border-b border-gray-100 transition-colors "+(I===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
5
+ return k("button",{onClick:()=>G(e),className:"w-full text-left px-3 py-2.5 border-b border-gray-100 transition-colors "+(O===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
6
6
  /* @__PURE__ */k("div",{className:"flex items-center gap-2",children:[
7
7
  /* @__PURE__ */N("div",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${t.dot}`}),
8
8
  /* @__PURE__ */N("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */N(h,{name:"bookmark",fallback:s,className:"h-3 w-3 text-amber-500 shrink-0"})]}),
@@ -10,16 +10,16 @@ return k("button",{onClick:()=>Q(e),className:"w-full text-left px-3 py-2.5 bord
10
10
  /* @__PURE__ */N("p",{className:"text-[10px] text-gray-300 mt-0.5 ml-4.5",children:u(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
11
  return k("div",{className:"h-full",children:[
12
12
  /* @__PURE__ */N(r,{app:"notepad"}),
13
- /* @__PURE__ */N(t,{sidebar:z,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:I?/* @__PURE__ */k("div",{className:"flex-1 flex flex-col min-w-0",children:[
13
+ /* @__PURE__ */N(t,{sidebar:z,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:O?/* @__PURE__ */k("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
14
  /* @__PURE__ */k("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */N("input",{value:D,onChange:e=>{K(e.target.value),M(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */N("div",{className:"flex gap-1",children:w.map(e=>/* @__PURE__ */N("button",{onClick:()=>{Z(e.key),M(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${U===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */N("button",{onClick:()=>(e=>{const t=X.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);G(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(I),title:A?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(A?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */N(h,{name:"bookmark",fallback:c,className:"h-4 w-4",fill:A?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
- /* @__PURE__ */N("button",{onClick:()=>(e=>{const t=X.filter(t=>t.id!==e);if(G(t),I===e){const e=t[0];e?Q(e):(O(null),K(""),P(""))}})(I),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */N(h,{name:"trash",fallback:d,className:"h-4 w-4",strokeWidth:1.5})})]}),q?/* @__PURE__ */N("textarea",{ref:J,value:H,onChange:e=>{P(e.target.value),M(!0)},onBlur:()=>{E(!1),F&&L()},placeholder:Y,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__ */N("div",{onClick:()=>{E(!0),setTimeout(()=>J.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:H?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],a=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=a.exec(e));){const e=l[1],t=l[2];if(S.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */N("button",{onClick:()=>B(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}T.lastIndex=0;let s=0;for(let e=0;e<r;e++)s+=t[e].length+1;for(;null!==(l=T.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=s+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */N("button",{onClick:()=>V(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__ */N(h,{name:"check",fallback:m,className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */N("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__ */N("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */N("span",{children:"​"},`empty-${r}`));const c=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
- return N("div",{className:c?"line-through text-gray-400":"",children:n},r)})})(H):/* @__PURE__ */N("p",{className:"text-gray-300 whitespace-pre-line",children:Y})}),
15
+ /* @__PURE__ */N("input",{value:A,onChange:e=>{H(e.target.value),q(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */N("div",{className:"flex gap-1",children:w.map(e=>/* @__PURE__ */N("button",{onClick:()=>{P(e.key),q(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${J===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */N("button",{onClick:()=>(e=>{const t=X.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);U(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(O),title:R?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(R?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */N(h,{name:"bookmark",fallback:c,className:"h-4 w-4",fill:R?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
+ /* @__PURE__ */N("button",{onClick:()=>(e=>{const t=X.filter(t=>t.id!==e);if(U(t),O===e){const e=t[0];e?G(e):(D(null),H(""),I(""))}})(O),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */N(h,{name:"trash",fallback:d,className:"h-4 w-4",strokeWidth:1.5})})]}),B?/* @__PURE__ */N("textarea",{ref:M,value:F,onChange:e=>{I(e.target.value),q(!0)},onBlur:()=>{E(!1),K&&Z()},placeholder:V,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */N("div",{onClick:()=>{E(!0),setTimeout(()=>M.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:F?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],a=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=a.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__ */N("button",{onClick:()=>Y(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}T.lastIndex=0;let s=0;for(let e=0;e<r;e++)s+=t[e].length+1;for(;null!==(l=T.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=s+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */N("button",{onClick:()=>L(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__ */N(h,{name:"check",fallback:m,className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */N("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__ */N("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */N("span",{children:"​"},`empty-${r}`));const c=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
+ return N("div",{className:c?"line-through text-gray-400":"",children:n},r)})})(F):/* @__PURE__ */N("p",{className:"text-gray-300 whitespace-pre-line",children:V})}),
20
20
  /* @__PURE__ */k("div",{className:"px-4 py-1.5 border-t border-gray-100 flex items-center gap-4 text-[10px] text-gray-400",children:[
21
21
  /* @__PURE__ */N("span",{children:"[] checkbox"}),
22
22
  /* @__PURE__ */N("span",{children:"SO#35001 entity link"}),
23
- /* @__PURE__ */N("span",{className:"ml-auto",children:q?"Editing":"Click to edit"})]})]}):/* @__PURE__ */N("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */k("div",{className:"text-center text-gray-400",children:[
23
+ /* @__PURE__ */N("span",{className:"ml-auto",children:B?"Editing":"Click to edit"})]})]}):/* @__PURE__ */N("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */k("div",{className:"text-center text-gray-400",children:[
24
24
  /* @__PURE__ */N(h,{name:"page",fallback:p,className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
25
25
  /* @__PURE__ */N("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{j as default};
@@ -0,0 +1 @@
1
+ export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-Y553QKEH.js";import"./chunk-TKFAFZRY.js";import"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";
@@ -1,91 +1,91 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-MIAJQGWE.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as n,setPomoAlarm as r,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 p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-5IWSOLLY.js";import{useWidgetSettings as k}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-3DGTIWZP.js";import{useShellPrefs as x}from"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{MoreVerticalFallback as v,AddCircleFallback as y,ChevronDownFallbackC as N}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{Icon as w}from"./chunk-YKZHOXI4.js";import{useSyncExternalStore as C,useEffect as S,useMemo as B,useState as M,useRef as T,useCallback as j}from"react";import{jsxs as I,Fragment as P,jsx as A}from"react/jsx-runtime";var L="pomodoro_appearance",$="pomodoro_active_task_id",D={focus:"Pomodoro",short:"Short Break",long:"Long Break"},V={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var W=25,_=5,F=15,O=!1,R=!1,H=4,E=!0,Z=!0,J="bell",U=100,K=1,Q="none",X=50,z=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function G(){const t=C(a,o,o),{prefs:g,save:b}=x(),N=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:z(t.focusMinutes,1,120,W),shortBreakMinutes:z(t.shortBreakMinutes,1,120,_),longBreakMinutes:z(t.longBreakMinutes,1,120,F),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:O,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:R,longBreakInterval:z(t.longBreakInterval,1,20,H),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:E,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:Z,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:J,alarmVolume:z(t.alarmVolume,0,100,U),alarmRepeat:z(t.alarmRepeat,1,5,K),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:Q,focusVolume:z(t.focusVolume,0,100,X)}}(g.pomodoro_settings);S(()=>{n({focus:60*N.focusMinutes,short:60*N.shortBreakMinutes,long:60*N.longBreakMinutes})},[N.focusMinutes,N.shortBreakMinutes,N.longBreakMinutes]),S(()=>{r(N.alarmSound),l(N.alarmVolume,N.alarmRepeat)},[N.alarmSound,N.alarmVolume,N.alarmRepeat]),S(()=>{s({autoStartBreaks:N.autoStartBreaks,autoStartPomodoros:N.autoStartPomodoros,longBreakInterval:N.longBreakInterval})},[N.autoStartBreaks,N.autoStartPomodoros,N.longBreakInterval]),S(()=>{i(N.focusSound,N.focusVolume)},[N.focusSound,N.focusVolume]),S(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const G=c(),q=G.tasks,ee=B(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),te=function(e,t){return B(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(B(()=>q.filter(e=>!!e.dueDate&&(e.dueDate===ee||e.dueDate<ee&&!e.done)),[q,ee]),N.checkToBottom),[ae,oe]=M(()=>localStorage.getItem($)),[ne,re]=M(!1),[le,se]=M(null),ie=T(!1);S(()=>{ie.current||(ie.current=!0,d(q,G.setAllTasks))},[]),S(()=>{try{ae?localStorage.setItem($,ae):localStorage.removeItem($)}catch{}},[ae]),S(()=>{if(!le)return;const e=()=>se(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[le]);const ce=T(t.streak);S(()=>{if(t.streak>ce.current&&ae){const e=q.find(e=>e.id===ae);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=N.autoCheckTasks&&a>0&&t>=a;G.updateTask(ae,{completed:t,done:e.done||o})}}ce.current=t.streak},[t.streak,ae,N.autoCheckTasks,q,G]);const ue=te.reduce((e,t)=>e+(t.completed??0),0),me=te.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),he=te.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),pe=t.running&&"focus"===t.mode?t.remaining:0,ge=he*N.focusMinutes*60+pe,fe=new Date(Date.now()+1e3*ge).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),be=(ge/3600).toFixed(1),ke=ae?q.find(e=>e.id===ae)??null:null,xe=String(Math.floor(t.remaining/60)).padStart(2,"0"),ve=String(t.remaining%60).padStart(2,"0"),[ye,Ne]=M(()=>e(L)),[we,Ce]=M(!1),[Se,Be]=M(ye),[Me,Te]=M(N);k(j(()=>{Be({...ye}),Te({...N}),Ce(!0)},[ye,N]));const je="focus"!==t.mode,Ie=V[t.mode],Pe=je?(Ae=Ie,Le=ye.activeOpacity/100,`rgba(${parseInt(Ae.slice(1,3),16)}, ${parseInt(Ae.slice(3,5),16)}, ${parseInt(Ae.slice(5,7),16)}, ${Le})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${ye.activeOpacity/100})`;var Ae,Le;const $e={primary:je?"text-white":"text-gray-900",secondary:je?"text-white/85":"text-gray-700",muted:je?"text-white/65":"text-gray-500",tabActive:je?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:je?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:je?"border-white/30":"border-gray-200",softDivider:je?"border-white/20":"border-gray-200",iconBtn:je?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:je?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},De=je?Ie:"#0f172a";/* @__PURE__ */
2
- return I(P,{children:[
3
- /* @__PURE__ */I("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${$e.primary}`,style:{backgroundColor:Pe,backdropFilter:ye.activeBlur>0?`blur(${ye.activeBlur}px)`:void 0},children:[
4
- /* @__PURE__ */A("div",{className:"px-3 pt-3 flex justify-center gap-1.5",children:["focus","short","long"].map(e=>/* @__PURE__ */A("button",{onClick:()=>u(e),className:`px-2.5 py-1 text-[13px] font-bold rounded transition-colors ${t.mode===e?$e.tabActive:$e.tabInactive}`,children:D[e]},e))}),
5
- /* @__PURE__ */I("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[xe,":",ve]}),
6
- /* @__PURE__ */A("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */A("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:De,letterSpacing:"0.08em"},children:t.running?"PAUSE":"START"})}),
7
- /* @__PURE__ */A("div",{className:"px-3 py-3 text-center",children:ke?/* @__PURE__ */I(P,{children:[
8
- /* @__PURE__ */I("div",{className:`text-xs leading-tight ${$e.muted}`,children:["#",(ke.completed??0)+1]}),
9
- /* @__PURE__ */A("div",{className:`text-[15px] font-medium leading-tight truncate mt-0.5 ${$e.primary}`,children:ke.name})]}):/* @__PURE__ */A("div",{className:`text-xs italic ${$e.muted}`,children:"No task selected"})}),
10
- /* @__PURE__ */I("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
- /* @__PURE__ */A("h3",{className:`text-base font-bold tracking-tight ${$e.primary}`,children:"Tasks"}),
12
- /* @__PURE__ */A("button",{className:`rounded p-1 transition-colors ${$e.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */A(w,{name:"more-vertical",fallback:v,className:"h-4 w-4"})})]}),
13
- /* @__PURE__ */A("div",{className:`border-t mx-3 mt-2 ${$e.divider}`}),
14
- /* @__PURE__ */I("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[te.map(e=>{const t=e.id===ae;/* @__PURE__ */
15
- return I("div",{onClick:()=>oe(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:[
16
- /* @__PURE__ */A("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,G.toggleDone(a)},className:"shrink-0",children:e.done?/* @__PURE__ */A("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:De},children:/* @__PURE__ */A("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__ */A("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */A("circle",{cx:"12",cy:"12",r:"10"})})}),
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-BFFXVA53.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as n,setPomoAlarm as r,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 p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-QZNRMJE6.js";import{useWidgetSettings as k}from"./chunk-TLTFS2D6.js";import"./chunk-DSSLOQDW.js";import"./chunk-UAJQB45Y.js";import"./chunk-TKFAFZRY.js";import{useShellPrefs as x}from"./chunk-SSBOC52S.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-MTH7EAH3.js";import"./chunk-HIAHERCD.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{MoreVerticalFallback as v,AddCircleFallback as y,ChevronDownFallbackC as N}from"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import{Icon as w}from"./chunk-YKZHOXI4.js";import{useSyncExternalStore as C,useEffect as S,useMemo as B,useState as M,useRef as T,useCallback as j}from"react";import{jsxs as P,Fragment as I,jsx as A}from"react/jsx-runtime";var $="pomodoro_appearance",D="pomodoro_active_task_id",L={focus:"Pomodoro",short:"Short Break",long:"Long Break"},V={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var F=25,R=5,_=15,H=!1,O=!1,E=4,W=!0,J=!0,X="bell",Q=100,Z=1,z="none",K=50,U=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function Y(){const t=C(a,o,o),{prefs:g,save:b}=x(),N=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:U(t.focusMinutes,1,120,F),shortBreakMinutes:U(t.shortBreakMinutes,1,120,R),longBreakMinutes:U(t.longBreakMinutes,1,120,_),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:H,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:O,longBreakInterval:U(t.longBreakInterval,1,20,E),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:W,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:J,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:X,alarmVolume:U(t.alarmVolume,0,100,Q),alarmRepeat:U(t.alarmRepeat,1,5,Z),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:z,focusVolume:U(t.focusVolume,0,100,K)}}(g.pomodoro_settings);S(()=>{n({focus:60*N.focusMinutes,short:60*N.shortBreakMinutes,long:60*N.longBreakMinutes})},[N.focusMinutes,N.shortBreakMinutes,N.longBreakMinutes]),S(()=>{r(N.alarmSound),l(N.alarmVolume,N.alarmRepeat)},[N.alarmSound,N.alarmVolume,N.alarmRepeat]),S(()=>{s({autoStartBreaks:N.autoStartBreaks,autoStartPomodoros:N.autoStartPomodoros,longBreakInterval:N.longBreakInterval})},[N.autoStartBreaks,N.autoStartPomodoros,N.longBreakInterval]),S(()=>{i(N.focusSound,N.focusVolume)},[N.focusSound,N.focusVolume]),S(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const Y=c(),q=Y.tasks,ee=B(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),te=function(e,t){return B(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(B(()=>q.filter(e=>!!e.dueDate&&(e.dueDate===ee||e.dueDate<ee&&!e.done)),[q,ee]),N.checkToBottom),[ae,oe]=M(()=>localStorage.getItem(D)),[ne,re]=M(!1),[le,se]=M(null),ie=T(!1);S(()=>{ie.current||(ie.current=!0,d(q,Y.setAllTasks))},[]),S(()=>{try{ae?localStorage.setItem(D,ae):localStorage.removeItem(D)}catch{}},[ae]),S(()=>{if(!le)return;const e=()=>se(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[le]);const ce=T(t.streak);S(()=>{if(t.streak>ce.current&&ae){const e=q.find(e=>e.id===ae);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=N.autoCheckTasks&&a>0&&t>=a;Y.updateTask(ae,{completed:t,done:e.done||o})}}ce.current=t.streak},[t.streak,ae,N.autoCheckTasks,q,Y]);const ue=te.reduce((e,t)=>e+(t.completed??0),0),me=te.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),he=te.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),pe=t.running&&"focus"===t.mode?t.remaining:0,ge=he*N.focusMinutes*60+pe,fe=new Date(Date.now()+1e3*ge).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),be=(ge/3600).toFixed(1),ke=ae?q.find(e=>e.id===ae)??null:null,xe=String(Math.floor(t.remaining/60)).padStart(2,"0"),ve=String(t.remaining%60).padStart(2,"0"),[ye,Ne]=M(()=>e($)),[we,Ce]=M(!1),[Se,Be]=M(ye),[Me,Te]=M(N);k(j(()=>{Be({...ye}),Te({...N}),Ce(!0)},[ye,N]));const je="focus"!==t.mode,Pe=V[t.mode],Ie=je?(Ae=Pe,$e=ye.activeOpacity/100,`rgba(${parseInt(Ae.slice(1,3),16)}, ${parseInt(Ae.slice(3,5),16)}, ${parseInt(Ae.slice(5,7),16)}, ${$e})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${ye.activeOpacity/100})`;var Ae,$e;const De={primary:je?"text-white":"text-gray-900",secondary:je?"text-white/85":"text-gray-700",muted:je?"text-white/65":"text-gray-500",tabActive:je?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:je?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:je?"border-white/30":"border-gray-200",softDivider:je?"border-white/20":"border-gray-200",iconBtn:je?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:je?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Le=je?Pe:"#0f172a";/* @__PURE__ */
2
+ return P(I,{children:[
3
+ /* @__PURE__ */P("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${De.primary}`,style:{backgroundColor:Ie,backdropFilter:ye.activeBlur>0?`blur(${ye.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */A("div",{className:"px-3 pt-3 flex justify-center gap-1.5",children:["focus","short","long"].map(e=>/* @__PURE__ */A("button",{onClick:()=>u(e),className:`px-2.5 py-1 text-[13px] font-bold rounded transition-colors ${t.mode===e?De.tabActive:De.tabInactive}`,children:L[e]},e))}),
5
+ /* @__PURE__ */P("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[xe,":",ve]}),
6
+ /* @__PURE__ */A("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */A("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:Le,letterSpacing:"0.08em"},children:t.running?"PAUSE":"START"})}),
7
+ /* @__PURE__ */A("div",{className:"px-3 py-3 text-center",children:ke?/* @__PURE__ */P(I,{children:[
8
+ /* @__PURE__ */P("div",{className:`text-xs leading-tight ${De.muted}`,children:["#",(ke.completed??0)+1]}),
9
+ /* @__PURE__ */A("div",{className:`text-[15px] font-medium leading-tight truncate mt-0.5 ${De.primary}`,children:ke.name})]}):/* @__PURE__ */A("div",{className:`text-xs italic ${De.muted}`,children:"No task selected"})}),
10
+ /* @__PURE__ */P("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
+ /* @__PURE__ */A("h3",{className:`text-base font-bold tracking-tight ${De.primary}`,children:"Tasks"}),
12
+ /* @__PURE__ */A("button",{className:`rounded p-1 transition-colors ${De.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */A(w,{name:"more-vertical",fallback:v,className:"h-4 w-4"})})]}),
13
+ /* @__PURE__ */A("div",{className:`border-t mx-3 mt-2 ${De.divider}`}),
14
+ /* @__PURE__ */P("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[te.map(e=>{const t=e.id===ae;/* @__PURE__ */
15
+ return P("div",{onClick:()=>oe(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:[
16
+ /* @__PURE__ */A("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,Y.toggleDone(a)},className:"shrink-0",children:e.done?/* @__PURE__ */A("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Le},children:/* @__PURE__ */A("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__ */A("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */A("circle",{cx:"12",cy:"12",r:"10"})})}),
17
17
  /* @__PURE__ */A("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
18
- /* @__PURE__ */I("span",{className:"text-sm tabular-nums mr-1.5 shrink-0",children:[
18
+ /* @__PURE__ */P("span",{className:"text-sm tabular-nums mr-1.5 shrink-0",children:[
19
19
  /* @__PURE__ */A("span",{className:"font-bold text-gray-500",children:e.completed??0}),
20
20
  /* @__PURE__ */A("span",{className:"text-gray-400",children:" / "}),
21
21
  /* @__PURE__ */A("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
22
- /* @__PURE__ */I("div",{className:"relative",children:[
23
- /* @__PURE__ */A("button",{onClick:t=>{t.stopPropagation(),se(le===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */A(w,{name:"more-vertical",fallback:v,className:"h-4 w-4 text-gray-500"})}),le===e.id&&/* @__PURE__ */A("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__ */A("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,G.removeTask(a),ae===a&&oe(null),se(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)}),ne?/* @__PURE__ */A(de,{onSubmit:(e,t)=>{const a=e.trim();if(!a)return;const o=G.addTask({name:a,estimated:t,completed:0,dueDate:ee});ae||oe(o),re(!1)},onCancel:()=>re(!1),accentColor:De}):/* @__PURE__ */I("button",{onClick:()=>re(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${$e.addTaskBtn}`,children:[
22
+ /* @__PURE__ */P("div",{className:"relative",children:[
23
+ /* @__PURE__ */A("button",{onClick:t=>{t.stopPropagation(),se(le===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */A(w,{name:"more-vertical",fallback:v,className:"h-4 w-4 text-gray-500"})}),le===e.id&&/* @__PURE__ */A("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__ */A("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,Y.removeTask(a),ae===a&&oe(null),se(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)}),ne?/* @__PURE__ */A(de,{onSubmit:(e,t)=>{const a=e.trim();if(!a)return;const o=Y.addTask({name:a,estimated:t,completed:0,dueDate:ee});ae||oe(o),re(!1)},onCancel:()=>re(!1),accentColor:Le}):/* @__PURE__ */P("button",{onClick:()=>re(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${De.addTaskBtn}`,children:[
24
24
  /* @__PURE__ */A(w,{name:"add-circle",fallback:y,className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
25
- /* @__PURE__ */I("div",{className:`border-t px-3 py-2.5 flex items-center justify-center gap-5 text-sm ${$e.softDivider}`,children:[
26
- /* @__PURE__ */I("span",{className:$e.secondary,children:["Pomos: ",
27
- /* @__PURE__ */A("span",{className:`font-bold ${$e.primary}`,children:ue}),
28
- /* @__PURE__ */A("span",{className:$e.muted,children:" / "}),
29
- /* @__PURE__ */A("span",{className:`font-bold ${$e.primary}`,children:me})]}),ge>0&&/* @__PURE__ */I("span",{className:$e.secondary,children:["Finish At: ",
30
- /* @__PURE__ */A("span",{className:`font-bold ${$e.primary}`,children:fe}),
31
- /* @__PURE__ */I("span",{className:$e.muted,children:[" (",be,"h)"]})]})]})]}),
32
- /* @__PURE__ */A(Y,{open:we,onClose:()=>Ce(!1),onSave:()=>{Ne(Se),localStorage.setItem(L,JSON.stringify(Se)),b({pomodoro_settings:Me}),Ce(!1)},configAppearance:Se,setConfigAppearance:Be,configPrefs:Me,setConfigPrefs:Te})]})}function Y({open:e,onClose:a,onSave:o,configAppearance:n,setConfigAppearance:r,configPrefs:l,setConfigPrefs:s}){const i=(e,t)=>s(a=>({...a,[e]:t}));/* @__PURE__ */
33
- return I(t,{open:e,onClose:a,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:o,children:[
34
- /* @__PURE__ */I(q,{icon:/* @__PURE__ */A(se,{}),label:"TIMER",children:[
35
- /* @__PURE__ */I("div",{children:[
25
+ /* @__PURE__ */P("div",{className:`border-t px-3 py-2.5 flex items-center justify-center gap-5 text-sm ${De.softDivider}`,children:[
26
+ /* @__PURE__ */P("span",{className:De.secondary,children:["Pomos: ",
27
+ /* @__PURE__ */A("span",{className:`font-bold ${De.primary}`,children:ue}),
28
+ /* @__PURE__ */A("span",{className:De.muted,children:" / "}),
29
+ /* @__PURE__ */A("span",{className:`font-bold ${De.primary}`,children:me})]}),ge>0&&/* @__PURE__ */P("span",{className:De.secondary,children:["Finish At: ",
30
+ /* @__PURE__ */A("span",{className:`font-bold ${De.primary}`,children:fe}),
31
+ /* @__PURE__ */P("span",{className:De.muted,children:[" (",be,"h)"]})]})]})]}),
32
+ /* @__PURE__ */A(G,{open:we,onClose:()=>Ce(!1),onSave:()=>{Ne(Se),localStorage.setItem($,JSON.stringify(Se)),b({pomodoro_settings:Me}),Ce(!1)},configAppearance:Se,setConfigAppearance:Be,configPrefs:Me,setConfigPrefs:Te})]})}function G({open:e,onClose:a,onSave:o,configAppearance:n,setConfigAppearance:r,configPrefs:l,setConfigPrefs:s}){const i=(e,t)=>s(a=>({...a,[e]:t}));/* @__PURE__ */
33
+ return P(t,{open:e,onClose:a,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:o,children:[
34
+ /* @__PURE__ */P(q,{icon:/* @__PURE__ */A(se,{}),label:"TIMER",children:[
35
+ /* @__PURE__ */P("div",{children:[
36
36
  /* @__PURE__ */A("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
37
- /* @__PURE__ */I("div",{className:"grid grid-cols-3 gap-3",children:[
37
+ /* @__PURE__ */P("div",{className:"grid grid-cols-3 gap-3",children:[
38
38
  /* @__PURE__ */A(ae,{label:"Pomodoro",value:l.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
39
39
  /* @__PURE__ */A(ae,{label:"Short Break",value:l.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
40
40
  /* @__PURE__ */A(ae,{label:"Long Break",value:l.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
41
41
  /* @__PURE__ */A(ee,{label:"Auto Start Breaks",children:/* @__PURE__ */A(re,{checked:l.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
42
42
  /* @__PURE__ */A(ee,{label:"Auto Start Pomodoros",children:/* @__PURE__ */A(re,{checked:l.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
43
43
  /* @__PURE__ */A(ee,{label:"Long Break interval",children:/* @__PURE__ */A(oe,{value:l.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
- /* @__PURE__ */I(q,{icon:/* @__PURE__ */A(ie,{}),label:"TASK",children:[
44
+ /* @__PURE__ */P(q,{icon:/* @__PURE__ */A(ie,{}),label:"TASK",children:[
45
45
  /* @__PURE__ */A(ee,{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__ */A(re,{checked:l.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
46
46
  /* @__PURE__ */A(ee,{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__ */A(re,{checked:l.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
47
- /* @__PURE__ */I(q,{icon:/* @__PURE__ */A(ce,{}),label:"SOUND",children:[
48
- /* @__PURE__ */A(ee,{label:"Alarm Sound",children:/* @__PURE__ */I("div",{className:"flex items-center gap-2",children:[
47
+ /* @__PURE__ */P(q,{icon:/* @__PURE__ */A(ce,{}),label:"SOUND",children:[
48
+ /* @__PURE__ */A(ee,{label:"Alarm Sound",children:/* @__PURE__ */P("div",{className:"flex items-center gap-2",children:[
49
49
  /* @__PURE__ */A(ne,{value:l.alarmSound,onChange:e=>i("alarmSound",e),options:p.map(e=>({id:e.id,label:e.label}))}),"off"!==l.alarmSound&&/* @__PURE__ */A("button",{type:"button",onClick:()=>g(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"})]})}),
50
50
  /* @__PURE__ */A(te,{value:l.alarmVolume,onChange:e=>i("alarmVolume",e)}),
51
51
  /* @__PURE__ */A(ee,{label:"repeat",children:/* @__PURE__ */A(oe,{value:l.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
- /* @__PURE__ */A(ee,{label:"Focus Sound",children:/* @__PURE__ */I("div",{className:"flex items-center gap-2",children:[
52
+ /* @__PURE__ */A(ee,{label:"Focus Sound",children:/* @__PURE__ */P("div",{className:"flex items-center gap-2",children:[
53
53
  /* @__PURE__ */A(ne,{value:l.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==l.focusSound&&/* @__PURE__ */A("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"})]})}),
54
54
  /* @__PURE__ */A(te,{value:l.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function q({icon:e,label:t,children:a}){/* @__PURE__ */
55
- return I("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
- /* @__PURE__ */I("div",{className:"flex items-center gap-1.5 mb-3 text-gray-400",children:[e,
55
+ return P("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
+ /* @__PURE__ */P("div",{className:"flex items-center gap-1.5 mb-3 text-gray-400",children:[e,
57
57
  /* @__PURE__ */A("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
58
58
  /* @__PURE__ */A("div",{className:"space-y-3",children:a})]})}function ee({label:e,info:t,children:a}){/* @__PURE__ */
59
- return I("div",{className:"flex items-center justify-between gap-3",children:[
60
- /* @__PURE__ */I("div",{className:"flex items-center gap-1.5 min-w-0",children:[
59
+ return P("div",{className:"flex items-center justify-between gap-3",children:[
60
+ /* @__PURE__ */P("div",{className:"flex items-center gap-1.5 min-w-0",children:[
61
61
  /* @__PURE__ */A("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */A(le,{title:t})]}),
62
62
  /* @__PURE__ */A("div",{className:"shrink-0",children:a})]})}function te({value:e,onChange:t}){/* @__PURE__ */
63
- return I("div",{className:"flex items-center justify-end gap-3",children:[
63
+ return P("div",{className:"flex items-center justify-end gap-3",children:[
64
64
  /* @__PURE__ */A("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
65
65
  /* @__PURE__ */A("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function ae({label:e,value:t,onChange:a,min:o=1,max:n=99}){/* @__PURE__ */
66
- return I("label",{className:"flex flex-col",children:[
66
+ return P("label",{className:"flex flex-col",children:[
67
67
  /* @__PURE__ */A("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
68
68
  /* @__PURE__ */A(oe,{value:t,onChange:a,min:o,max:n})]})}function oe({value:e,onChange:t,min:a=1,max:o=99,className:n=""}){/* @__PURE__ */
69
69
  return A("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 ${n}`})}function ne({value:e,onChange:t,options:a}){/* @__PURE__ */
70
- return I("div",{className:"relative",children:[
70
+ return P("div",{className:"relative",children:[
71
71
  /* @__PURE__ */A("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__ */A("option",{value:e.id,children:e.label},e.id))}),
72
72
  /* @__PURE__ */A(w,{name:"chevron-down",fallback:N,className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-400 pointer-events-none",strokeWidth:2.5})]})}function re({checked:e,onChange:t}){/* @__PURE__ */
73
73
  return A("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>t(!e),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(e?"bg-emerald-500":"bg-gray-300"),children:/* @__PURE__ */A("span",{className:"absolute h-5 w-5 rounded-full bg-white shadow transition-transform "+(e?"translate-x-[22px]":"translate-x-0.5")})})}function le({title:e}){/* @__PURE__ */
74
74
  return A("span",{title:e,className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-gray-300 text-white text-[10px] font-bold cursor-help",children:"i"})}function se(){/* @__PURE__ */
75
- return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
75
+ return P("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
76
76
  /* @__PURE__ */A("circle",{cx:"12",cy:"12",r:"9"}),
77
77
  /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7v5l3 2"})]})}function ie(){/* @__PURE__ */
78
- return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
78
+ return P("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
79
79
  /* @__PURE__ */A("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),
80
80
  /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})}function ce(){/* @__PURE__ */
81
- return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
81
+ return P("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
82
82
  /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5L6 9H2v6h4l5 4V5z"}),
83
83
  /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function de({onSubmit:e,onCancel:t,accentColor:a}){const[o,n]=M(""),[r,l]=M(1),s=()=>e(o,r);/* @__PURE__ */
84
- return I("div",{className:"bg-white text-gray-800 rounded-md p-3 shadow-md",children:[
84
+ return P("div",{className:"bg-white text-gray-800 rounded-md p-3 shadow-md",children:[
85
85
  /* @__PURE__ */A("input",{autoFocus:!0,value:o,onChange:e=>n(e.target.value),placeholder:"What are you working on?",onKeyDown:e=>{"Enter"===e.key&&s(),"Escape"===e.key&&t()},className:"w-full text-base font-medium bg-transparent border-0 outline-none placeholder-gray-400"}),
86
- /* @__PURE__ */I("div",{className:"flex items-center justify-between mt-2",children:[
86
+ /* @__PURE__ */P("div",{className:"flex items-center justify-between mt-2",children:[
87
87
  /* @__PURE__ */A("span",{className:"text-xs font-semibold text-gray-500",children:"Est Pomodoros"}),
88
88
  /* @__PURE__ */A("input",{type:"number",min:1,max:20,value:r,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"})]}),
89
- /* @__PURE__ */I("div",{className:"flex gap-2 mt-3 justify-end",children:[
89
+ /* @__PURE__ */P("div",{className:"flex gap-2 mt-3 justify-end",children:[
90
90
  /* @__PURE__ */A("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
91
- /* @__PURE__ */A("button",{onClick:s,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:a},children:"Save"})]})]})}export{G as default};
91
+ /* @__PURE__ */A("button",{onClick:s,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:a},children:"Save"})]})]})}export{Y as default};