efficient-shell 13.6.1 → 13.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +6 -4
  2. package/dist/{Browser-T2K6P3YU.js → Browser-ATL2PGT2.js} +16 -16
  3. package/dist/Files-RHEICXXW.js +141 -0
  4. package/dist/{Notepad-2ULPEDIU.js → Notepad-QL5GJZNS.js} +7 -7
  5. package/dist/PomodoroTimer-2MFWO3KK.js +91 -0
  6. package/dist/{Preview-ZBTPZRMP.js → Preview-PP3XS7E7.js} +41 -41
  7. package/dist/{TimelineTrack-DfU_9eo6.d.ts → TimelineTrack-DCTqfW6Z.d.ts} +13 -0
  8. package/dist/Weather-377NKPA5.js +60 -0
  9. package/dist/WorldClock-M6AMXQY2.js +32 -0
  10. package/dist/ai/index.js +30 -30
  11. package/dist/apps/index.js +1 -1
  12. package/dist/bin/browser-check.js +1 -1
  13. package/dist/bin/media-host-check.js +1 -1
  14. package/dist/bin/ui-check.js +1 -1
  15. package/dist/brand.css +1 -1
  16. package/dist/charts/SpecChart.js +1 -1
  17. package/dist/{chunk-GXVWI3U5.js → chunk-5CFERCYW.js} +1 -1
  18. package/dist/{chunk-X4EJUQ6I.js → chunk-AEOCSYKL.js} +1 -1
  19. package/dist/chunk-AJMQ5SHI.js +1 -0
  20. package/dist/{chunk-PDIGCTZD.js → chunk-BKZOTBDP.js} +19 -19
  21. package/dist/{chunk-BRZ55H2G.js → chunk-F3G7S5HO.js} +50 -50
  22. package/dist/chunk-H7CIK74N.js +15 -0
  23. package/dist/chunk-HYHZEQMG.js +1 -0
  24. package/dist/{chunk-RI5QSLX3.js → chunk-IOZSLFGR.js} +1 -1
  25. package/dist/{chunk-H22D2PYM.js → chunk-LOFFHXZ4.js} +9 -9
  26. package/dist/chunk-NHKT5IH6.js +1 -0
  27. package/dist/chunk-OAKXWYZD.js +2 -0
  28. package/dist/{chunk-S6UJKSF3.js → chunk-OJI4ROSD.js} +1 -1
  29. package/dist/{chunk-7I5GD5IB.js → chunk-RK6X56ZC.js} +2 -2
  30. package/dist/{chunk-3MIIXPV6.js → chunk-SC3AQXJY.js} +8 -8
  31. package/dist/chunk-YJGA4LPG.js +2 -0
  32. package/dist/{chunk-ENCZRE3H.js → chunk-Z62HFEFS.js} +7 -7
  33. package/dist/{chunk-77HMTXDR.js → chunk-ZJ34FNRC.js} +1 -1
  34. package/dist/data/Gantt.js +1 -1
  35. package/dist/format/index.d.ts +1 -1
  36. package/dist/format/index.js +1 -1
  37. package/dist/forms/Calendar.js +1 -1
  38. package/dist/forms/DatePicker.js +1 -1
  39. package/dist/forms/DateRangePicker.js +1 -1
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.js +665 -665
  42. package/dist/shell/MilestoneTimeline.d.ts +1 -1
  43. package/dist/shell/MilestoneTimeline.js +1 -1
  44. package/dist/shell/ProductionTimeline.d.ts +23 -9
  45. package/dist/shell/ProductionTimeline.js +1 -1
  46. package/dist/shell/TimeAgo.js +1 -1
  47. package/dist/shell/TimelineTrack.d.ts +1 -1
  48. package/dist/shell/TimelineTrack.js +1 -1
  49. package/dist/shell/timelineDates.js +1 -1
  50. package/dist/telemetry/index.js +1 -1
  51. package/dist/ui/index.d.ts +2 -2
  52. package/dist/ui/index.js +1 -1
  53. package/dist/utils/date.d.ts +44 -5
  54. package/dist/utils/date.js +1 -1
  55. package/dist/utils/format.js +1 -1
  56. package/dist/version.js +1 -1
  57. package/package.json +1 -1
  58. package/dist/Files-ZFH4CV3R.js +0 -141
  59. package/dist/PomodoroTimer-57XARJRF.js +0 -91
  60. package/dist/Weather-Y4TMYOQB.js +0 -60
  61. package/dist/WorldClock-FY3UCIAW.js +0 -32
  62. package/dist/chunk-7K73G35Z.js +0 -2
  63. package/dist/chunk-COHFFGFE.js +0 -2
  64. package/dist/chunk-ECTLJTOE.js +0 -1
  65. package/dist/chunk-FBDZGO3V.js +0 -1
  66. package/dist/chunk-R3BLTWKE.js +0 -15
  67. package/dist/chunk-ZPJTLNKU.js +0 -1
@@ -1,141 +0,0 @@
1
- import{openPreviewFile as e}from"./chunk-SQ4ZFG2B.js";import{SidebarLayout as t}from"./chunk-6D6Q3ZCG.js";import"./chunk-QWK6DRSN.js";import"./chunk-PC3MYH2K.js";import{SearchableSelect as n}from"./chunk-P62QGXRW.js";import{Breadcrumbs as a}from"./chunk-YM7AWNMY.js";import{Select_default as r}from"./chunk-KITSIQCV.js";import"./chunk-EO5RLFRX.js";import"./chunk-K5YT5PMJ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-QMBMK6PP.js";import{Input_default as l}from"./chunk-PT4GMPUB.js";import{DropdownMenu as o}from"./chunk-3DSGJIC7.js";import"./chunk-UZFFSZFI.js";import{IconButton_default as c}from"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{formatBytes as d}from"./chunk-S6UJKSF3.js";import"./chunk-ZPJTLNKU.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as m,subscribeFilesChoice as h,getFilesChoice as u,holdFilesChoice as f,answerFilesChoice as p,choiceTakes as g}from"./chunk-4EFIUJ7X.js";import{AboutApp as k}from"./chunk-7I5GD5IB.js";import{getFilesStore as w,peekFilesViewRequest as y,consumeFilesViewRequest as v,FILES_SHOW_TRASH_EVENT as b,FILES_OPEN_DESKTOP_FOLDER_EVENT as x,subscribeDesktopFolders as N,getDesktopFoldersSnapshot as C,hasHostFilesStore as S,FolderGlyph as j,DesktopItemMiniIcon as D,desktopItemTypeLabel as M,FilesQuotaError as T,FILES_OFFICE_EXTENSIONS as $}from"./chunk-WBAWJIVM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as L,WindowTitle as R}from"./chunk-H4LUHKUJ.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DASRJ26L.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-GHLXZDLU.js";import{confirm as P,prompt as F}from"./chunk-KV6XCHAG.js";import{Dialog as A}from"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import{ItemCount as E}from"./chunk-PR6FNBKR.js";import"./chunk-RIG5FEVS.js";import"./chunk-NDWX5Z4D.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-ZGIAMYTI.js";import"./chunk-5LHEPE4B.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-ECTLJTOE.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as z}from"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as W}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as I}from"./chunk-R2VKEMZH.js";import{TH_ONE_LINE as K}from"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import{toast_default as O}from"./chunk-TMSSR5UH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-DEJIH3ZQ.js";import"./chunk-C3QOHMR6.js";import{useState as U,useRef as J,useEffect as G,useCallback as Y,useSyncExternalStore as B,useMemo as V}from"react";import{jsxs as H,jsx as Q,Fragment as Z}from"react/jsx-runtime";var X={doc:"document",docx:"document",odt:"document",rtf:"document",txt:"document",md:"document",xls:"spreadsheet",xlsx:"spreadsheet",ods:"spreadsheet",csv:"spreadsheet",sheet:"spreadsheet",ppt:"slides",pptx:"slides",odp:"slides",key:"slides",slides:"slides",pdf:"pdf",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",heic:"image",tif:"image",tiff:"image",mp4:"video",mov:"video",webm:"video",avi:"video",mkv:"video",mp3:"audio",wav:"audio",m4a:"audio",ogg:"audio",flac:"audio",zip:"archive",rar:"archive","7z":"archive",gz:"archive",tar:"archive",dxf:"drawing",dwg:"drawing",stp:"drawing",step:"drawing",stl:"drawing",obj:"drawing",iges:"drawing",igs:"drawing","3mf":"drawing",glb:"drawing",gltf:"drawing"};function q(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function _(e){if("folder"===e.kind)return"folder";if("document"===e.officeKind)return"document";if("spreadsheet"===e.officeKind)return"spreadsheet";if("deck"===e.officeKind)return"slides";const t=e.contentType??"";return"application/pdf"===t?"pdf":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":X[q(e.name)]??"other"}var ee={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},te={folder:{name:"folder",tone:"muted"},document:{name:"document",tone:"accent"},spreadsheet:{name:"table",tone:"success"},slides:{name:"presentation-chart-bar",tone:"warning"},pdf:{name:"document",tone:"danger"},image:{name:"image",tone:"muted"},video:{name:"play",tone:"muted"},audio:{name:"speaker-wave",tone:"muted"},archive:{name:"archive-box",tone:"muted"},drawing:{name:"cube-transparent",tone:"muted"},other:{name:"page",tone:"muted"}};function ne(e){const t=e.officeKind?$[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function ae(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":d(e.size)}function re(e,t=/* @__PURE__ */new Date){if(!e)return"—";const n=new Date(e);return isNaN(n.getTime())?"—":n.toDateString()===t.toDateString()?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.getFullYear()===t.getFullYear()?n.toLocaleDateString(void 0,{day:"numeric",month:"short"}):n.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function ie(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var se=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function le(e,t){const n="asc"===t.dir?1:-1;return[...e].sort((e,a)=>e.kind!==a.kind?"folder"===e.kind?-1:1:n*((e,n)=>{switch(t.key){case"owner":return se.compare(ie(e),ie(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return se.compare(ne(e),ne(n))}})(e,a)||se.compare(e.name,a.name))}var oe=["folder","document","spreadsheet","slides","pdf","image","video"],ce={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function de(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=new Date(t);return n.setHours(0,0,0,0),"week"===e&&n.setDate(n.getDate()-6),"month"===e&&n.setDate(n.getDate()-29),"year"===e&&n.setMonth(0,1),n.getTime()}(t.modified,n):null;return e.filter(e=>{if(t.type&&_(e)!==t.type)return!1;if(t.person){const n="owner"===(e.role??"owner");if("me"===t.person?!n:n||e.owner?.id!==t.person)return!1}return null===a||(Date.parse(e.modifiedAt)||0)>=a})}var me=[{value:"viewer",label:"Viewer"},{value:"editor",label:"Editor"}];function he({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=U(null),[o,d]=U(""),[m,h]=U([]),[u,f]=U(!1),[p,g]=U(""),[k,w]=U("viewer"),[y,v]=U(!1),b=J(/* @__PURE__ */new Map),x=t?.id??null;if(G(()=>{if(l(null),g(""),d(""),!x||!e.shares)return;let t=!0;return e.shares(x).then(e=>{t&&l(e)}).catch(e=>{t&&(O.error(e.message),l([]))}),()=>{t=!1}},[x,e]),G(()=>{if(!e.searchPeople||!x)return;let t=!0;f(!0);const n=setTimeout(()=>{e.searchPeople(o).then(e=>{if(t){for(const t of e)b.current.set(t.id,t);h(e)}}).catch(()=>{t&&h([])}).finally(()=>{t&&f(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[o,x,e]),!t)return null;const N=new Set((s??[]).map(e=>e.person.id)),C=m.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),S=async n=>{v(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){O.error(e.message)}finally{v(!1)}};/* @__PURE__ */
2
- return H(A,{open:!0,onClose:a,size:"md",title:`Share “${t.name}”`,description:"folder"===t.kind?"Everything inside this folder is shared too. Editors’ uploads count toward your quota.":"Viewers can open and download it. Editors can also replace, rename and delete it.",footer:/* @__PURE__ */Q(z,{variant:"secondary",onClick:a,children:"Done"}),children:[
3
- /* @__PURE__ */H("div",{className:"flex items-center gap-2",children:[
4
- /* @__PURE__ */Q("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */Q(n,{value:p,onChange:g,onSearchChange:d,loading:u&&0===m.length,options:C,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
5
- /* @__PURE__ */Q("div",{className:"w-28 shrink-0",children:/* @__PURE__ */Q(r,{value:k,onChange:e=>w(e),options:me,"aria-label":"Access"})}),
6
- /* @__PURE__ */Q(z,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=b.current.get(p);S(async()=>{await e.share(t.id,p,k),g(""),d(""),n&&O.success(`Shared with ${n.name}`)})},disabled:!p||y,children:"Add"})]}),
7
- /* @__PURE__ */Q("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */Q(I,{size:"sm",padding:"p-4",label:"Loading"}):/* @__PURE__ */H("ul",{className:"divide-y divide-line-subtle text-sm",children:[
8
- /* @__PURE__ */H("li",{className:"flex items-center gap-2 h-10",children:[
9
- /* @__PURE__ */Q("span",{className:"flex-1 truncate",children:"You"}),
10
- /* @__PURE__ */Q("span",{className:"text-xs text-ink-faint",children:"Owner"})]}),s.map(n=>/* @__PURE__ */H("li",{className:"flex items-center gap-2 h-10",children:[
11
- /* @__PURE__ */Q("span",{className:"flex-1 truncate",title:n.person.name,children:n.person.name}),
12
- /* @__PURE__ */Q("div",{className:"w-28 shrink-0",children:/* @__PURE__ */Q(r,{value:n.role,onChange:a=>S(()=>e.share(t.id,n.person.id,a)),options:me,"aria-label":`Access for ${n.person.name}`,disabled:y})}),
13
- /* @__PURE__ */Q(c,{"aria-label":`Remove ${n.person.name}`,variant:"ghost",size:"sm",disabled:y,onClick:()=>S(()=>e.unshare(t.id,n.person.id)),children:/* @__PURE__ */Q(W,{name:"close",className:"h-4 w-4",strokeWidth:1.8})})]},n.person.id))]})]})}function ue({store:e,items:t,from:n,onClose:a,onMove:r}){const[i,s]=U(n??null),[l,o]=U(null),[d,m]=U(!1);G(()=>{t&&s(n??null)},[t,n]),G(()=>{if(!t)return;let n=!0;return m(!0),e.list(i).then(e=>{n&&o(e)}).catch(()=>{n&&o(null)}).finally(()=>{n&&m(!1)}),()=>{n=!1}},[e,i,t]);const h=new Set((t??[]).map(e=>e.id)),u=(l?.entries??[]).filter(e=>"folder"===e.kind&&!h.has(e.id)),f=(l?.folder.path??[]).filter(e=>null!==e.id),p=f.length>1?f[f.length-2].id:null,g=l?.folder,k="viewer"!==(g?.role??"owner"),w=void 0!==n&&i===n,y=t?.length??0,v=1===y?`"${t[0].name}"`:`${y} items`;/* @__PURE__ */
14
- return H(A,{open:!!t,onClose:a,title:`Move ${v}`,size:"sm",footer:/* @__PURE__ */H(Z,{children:[
15
- /* @__PURE__ */Q(z,{variant:"secondary",onClick:a,children:"Cancel"}),
16
- /* @__PURE__ */Q(z,{variant:"primary",onClick:()=>r(i),disabled:d||!k||w,children:"Move here"})]}),children:[
17
- /* @__PURE__ */H("div",{className:"flex items-center gap-1 mb-2 min-h-8",children:[null!==i&&/* @__PURE__ */Q(c,{"aria-label":"Back",size:"sm",onClick:()=>s(p),children:/* @__PURE__ */Q(W,{name:"arrow-left",className:"h-4 w-4"})}),
18
- /* @__PURE__ */Q("span",{className:"text-sm font-medium text-ink-strong truncate",children:null===i?"My files":g?.name??""})]}),
19
- /* @__PURE__ */Q("div",{className:"border border-line rounded-(--radius-control) h-64 overflow-auto",children:d?/* @__PURE__ */Q(I,{size:"sm",padding:"p-6",label:"Loading"}):0===u.length?/* @__PURE__ */Q("div",{className:"p-6 text-center text-sm text-ink-faintest",children:"No folders here."}):/* @__PURE__ */Q("ul",{children:u.map(e=>/* @__PURE__ */Q("li",{children:/* @__PURE__ */H("button",{type:"button",onClick:()=>s(e.id),className:"flex w-full items-center gap-2 px-3 h-9 text-left text-sm hover:bg-row-hover",children:[
20
- /* @__PURE__ */Q(W,{name:"folder",look:"solid",tone:"muted",className:"h-4 w-4 shrink-0"}),
21
- /* @__PURE__ */Q("span",{className:"truncate flex-1",children:e.name}),
22
- /* @__PURE__ */Q(W,{name:"chevron-right",tone:"muted",className:"h-4 w-4 shrink-0"})]})},e.id))})}),!k&&/* @__PURE__ */Q("p",{className:"mt-2 text-xs text-ink-faint",children:"You can view this folder but not move things into it."})]})}function fe({store:e,entry:t,selectedCount:n,onClose:a}){const[r,i]=U(null),[s,l]=U(null);G(()=>{if(i(null),l(null),!t)return;let n=!0;return e.info?.(t.id).then(e=>{n&&i(e)}).catch(()=>{}),e.shares?.(t.id).then(e=>{n&&l(e)}).catch(()=>{}),()=>{n=!1}},[e,t]);const o=t?_(t):null,d=o?te[o]:null,m=r?.path.slice(0,-1).map(e=>e.name||"My files").join(" / "),h=(e,t)=>t?/* @__PURE__ */H("div",{className:"py-2",children:[
23
- /* @__PURE__ */Q("dt",{className:"text-2xs text-ink-faint",children:e}),
24
- /* @__PURE__ */Q("dd",{className:"text-sm text-ink break-words",children:t})]}):null;/* @__PURE__ */
25
- return H("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col min-h-0 bg-surface","aria-label":"Details",children:[
26
- /* @__PURE__ */H("div",{className:"flex items-center gap-2 px-3 h-12 shrink-0",children:[d&&/* @__PURE__ */Q(W,{name:d.name,tone:d.tone,className:"h-5 w-5 shrink-0"}),
27
- /* @__PURE__ */Q("span",{className:"flex-1 truncate text-sm font-medium text-ink-strong",children:t?ne(t):n>1?`${n} items selected`:"Details"}),
28
- /* @__PURE__ */Q(c,{"aria-label":"Close details",size:"sm",onClick:a,children:/* @__PURE__ */Q(W,{name:"close",className:"h-4 w-4"})})]}),
29
- /* @__PURE__ */Q("div",{className:"flex-1 overflow-auto px-4 pb-4",children:t?/* @__PURE__ */H(Z,{children:[
30
- /* @__PURE__ */Q("div",{className:"h-32 rounded-(--radius-control) bg-surface-sunken flex items-center justify-center mb-3",children:d&&/* @__PURE__ */Q(W,{name:d.name,tone:d.tone,className:"h-12 w-12"})}),s&&/* @__PURE__ */H("div",{className:"mb-3",children:[
31
- /* @__PURE__ */Q("div",{className:"text-xs font-medium text-ink-strong mb-1",children:"Who has access"}),0===s.length?/* @__PURE__ */H("p",{className:"text-sm text-ink-faint",children:["Only ","owner"!==t.role&&t.role?t.owner?.name??"its owner":"you"]}):/* @__PURE__ */Q("ul",{className:"text-sm text-ink",children:s.map(e=>/* @__PURE__ */H("li",{className:"flex justify-between py-0.5",children:[
32
- /* @__PURE__ */Q("span",{className:"truncate",children:e.person.name}),
33
- /* @__PURE__ */Q("span",{className:"text-ink-faint text-xs",children:"editor"===e.role?"Editor":"Viewer"})]},e.person.id))})]}),
34
- /* @__PURE__ */H("dl",{className:"border-t border-line pt-2",children:[h("Type",o?ee[o]:null),"file"===t.kind&&h("Size",ae(t)),h("Location",m),h("Owner","me"===ie(t)?"me":ie(t)),h("Modified",t.modifiedAt?`${re(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),h("Created",r?.createdAt?re(r.createdAt):null)]})]}):/* @__PURE__ */Q("p",{className:"pt-6 text-center text-sm text-ink-faintest",children:n>1?"Select one item to see its details.":"Select a file or folder to see its details."})})]})}var pe=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,ge="files.layout",ke={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"},we=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],ye="application/x-efficient-files";function ve(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 be(){try{return"grid"===localStorage.getItem(ge)?"grid":"list"}catch{return"list"}}function xe(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=m()??[];for(const e of n){const t=a.find(t=>"folder"===t.kind&&t.name===e);a=t?.children??[]}return{folder:{id:e,name:n[n.length-1]??"",role:"owner",path:[{id:null,name:""},...n.map((e,t)=>({id:"/"+n.slice(0,t+1).join("/"),name:e}))]},entries:a.map(e=>({id:("/"===t?"":t)+"/"+e.name,name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}}function Ne(e,t){return`Not enough space for “${e}” (${d(t.attempted)}). You've used ${d(t.used)} of ${d(t.limit)}. Empty Trash or ask an administrator for more space.`}var Ce=(e,t)=>e instanceof Error&&e.message||t;function Se(e){const t=[];for(const n of e)("divider"!==n.type||0!==t.length&&"divider"!==t[t.length-1].type)&&t.push(n);for(;t.length&&"divider"===t[t.length-1].type;)t.pop();return t}function je({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=te[_(e)];/* @__PURE__ */
35
- return Q(W,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function De({entry:e,read:t}){const[n,a]=U(null),r="image"===_(e)&&e.size<=5242880;return G(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */Q("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */Q(je,{entry:e,className:"h-10 w-10"})}function Me(){const n=w(),r=n.title??"Files",A=null!==m(),X=!A&&!!n.shares&&!!n.sharedWithMe,[_,me]=U(null),[Me,Te]=U(null),[$e,Le]=U([]),[Re,Pe]=U(()=>/* @__PURE__ */new Set),Fe=J(null),[Ae,Ee]=U(!0),[ze,We]=U(!1),[Ie,Ke]=U(null),[Oe,Ue]=U(!1),[Je,Ge]=U(null),[Ye,Be]=U(null),[Ve,He]=U(null),[Qe,Ze]=U(be),[Xe,qe]=U(!1),[_e,et]=U(""),[tt,nt]=U(""),[at,rt]=U({}),[it,st]=U({key:"name",dir:"asc"}),[lt,ot]=U(()=>{const e=y();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),ct=J("files"),dt=J(lt);dt.current=lt,G(()=>{v()},[]);const[mt,ht]=U([]),ut=e=>{Ze(e);try{localStorage.setItem(ge,e)}catch{}},ft=Y(e=>{ot(e),rt({}),st("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(et(""),nt(""))},[]);G(()=>{const e=()=>{v(),ft("trash")},t=e=>{v();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(b,e),window.addEventListener(x,t),()=>{window.removeEventListener(b,e),window.removeEventListener(x,t)}},[ft]);const pt=B(N,C,C),gt="object"==typeof lt?lt.desktopFolderId:null,kt=gt?pt?.folders.find(e=>e.id===gt)??null:null,wt=gt&&pt?.itemsByFolder[gt]||[];G(()=>{gt&&pt&&!pt.folders.some(e=>e.id===gt)&&ft("files")},[gt,pt,ft]);const yt=J(0),vt=J(null),bt=J(null),{openPage:xt,openEntity:Nt}=L(),Ct=i(),St=i(),jt=i(),Dt=B(h,u,u);G(()=>f(),[]),G(()=>{!Dt||"trash"!==lt&&"object"!=typeof lt||ft("files")},[Dt,lt,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>xt(e)}):"page"===t.entityType?xt(t.entityId):Nt(t.entityType,t.entityId,null,t.label)},Tt=Y(async()=>{if(!A)try{Ke(await n.quota())}catch{}},[n,A]),$t=Y(async(e,t)=>{Ee(!0);try{await e(),We(!1)}catch(e){e instanceof TypeError?We(!0):O.error(Ce(e,t))}finally{Ee(!1)}},[]),Lt=Y(async e=>{if(A)return Te(xe(e)),We(!1),void Ee(!1);await $t(async()=>{Te(await n.list(e))},"Failed to list"),Tt()},[n,Tt,A,$t]),Rt=Y(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=A?xe(_):await n.list(_).catch(()=>null);return Le((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void Ee(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await $t(async()=>{Le(await a())},"Failed to list files")},[n,A,_,$t]),Pt=Y(async()=>{if(A)return ht([]),void Ee(!1);await $t(async()=>{ht(await n.trash())},"Failed to list trash"),Tt()},[n,Tt,A,$t]),Ft=()=>{"files"===lt?Lt(_):pe(lt)?Rt(lt,tt):"trash"===lt&&Pt()};G(()=>{Pe(/* @__PURE__ */new Set),Fe.current=null,Ft()},[_,lt,tt]),G(()=>{const e=_e.trim();if(!e)return;const t=setTimeout(()=>{e===tt&&"search"===dt.current||("search"!==dt.current&&(ct.current=dt.current),ot("search"),rt({}),nt(e))},300);return()=>clearTimeout(t)},[_e]);const At=()=>{et(""),"search"===dt.current&&ft(ct.current)},Et=e=>{ft("files"),me(e)},zt=async(e,t)=>{try{await e()}catch(e){O.error(Ce(e,t))}Ft()},Wt=e=>zt(async()=>{await n.restore(e.id),O.success(`Restored "${e.name}"`)},"Restore failed"),It=async e=>{await P({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&zt(()=>n.purge(e.id),"Delete failed")},Kt=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){O.error(Ce(e,"Download failed"))}},Ot="files"===lt?Me?.folder??null:null,Ut=Ot?.role??"owner",Jt="owner"!==Ut,Gt="files"===lt?_:null,Yt=!A&&("files"!==lt||"viewer"!==Ut),Bt=!A&&"files"===lt&&"viewer"!==Ut,Vt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Gt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof T?O.error(Ne(r.name,e)):O.error(`Upload ${r.name}: ${Ce(e,"failed")}`)}}a>1&&O.success(`Uploaded ${a} files`),"files"===lt?Lt(_):Et(null)},Ht=async e=>{const t=ne(e),a=await F({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?O.error("Names cannot contain slashes"):zt(()=>n.rename(e.id,function(e,t){const n=e.officeKind?$[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Qt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??Me?.folder.owner)?.name??"its owner":"their owners";await P({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ne(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await zt(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),O.success(t?`"${ne(t)}" moved to trash`:`${e.length} items moved to trash`))},Zt=(e,t)=>zt(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),Xt=async(e,t)=>{He(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await zt(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),O.success(1===a.length?`Moved "${ne(a[0])}"`:`Moved ${a.length} items`))},qt=()=>{yt.current=0,Ue(!1),Ge(null)};G(()=>{const e=()=>qt();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const _t="files"===lt?Me?.entries??[]:pe(lt)?$e:[],en=V(()=>le(de(_t,at),it),[_t,at,it]),tn=V(()=>new Map(en.map(e=>[e.id,e])),[en]),nn=[...Re].map(e=>tn.get(e)).filter(e=>!!e),an=1===nn.length?nn[0]:null,rn=e=>e.role??("files"===lt?Ut:"owner"),sn=e=>!A&&"viewer"!==rn(e),ln=e=>X&&"owner"===rn(e),on=e=>!!n.move&&sn(e),cn=(e,t)=>{if(Dt){const t=tn.get(e);if(t&&"file"===t.kind&&!mn(t))return;return void Pe(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&Fe.current){const t=en.map(e=>e.id),n=t.indexOf(Fe.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Pe(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}Fe.current=e,t.metaKey||t.ctrlKey?Pe(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Pe(/* @__PURE__ */new Set([e]))},dn=()=>{Pe(/* @__PURE__ */new Set),Fe.current=null},mn=e=>!!Dt&&"file"===e.kind&&g(Dt.request,e.name),hn=e=>Dt&&"file"===e.kind&&!mn(e)?"text-ink-faintest":"",un=e=>{if(!Dt||!mn(e))return;const t="files"===lt?Me?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===lt?"Shared with me":"My files";p(Dt.id,{entry:e,folderId:"files"===lt?_:null,location:n})},fn=Dt&&an&&mn(an)?an:null,pn=t=>{"folder"===t.kind?Et(t.id):Dt?un(t):(async t=>{if(A)return;if(n.open?.(t))return;const a=ke[q(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>xt(e)}):Kt(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Dt)return t&&("folder"===t.kind||mn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */Q(W,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(sn);if(A)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */Q(W,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const s=e.some(e=>!e.starred);return Se([...t?[{key:"open",label:a,icon:/* @__PURE__ */Q(W,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */Q(W,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Kt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */Q(W,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Ht(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */Q(W,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>zt(async()=>{for(const t of e)await n.copy(t.id);O.success(1===e.length?`Copied "${ne(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&ln(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */Q(W,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Be(t)}]:[],...e.every(on)?[{key:"move",label:"Move",icon:/* @__PURE__ */Q(W,{name:"forward",className:"h-4 w-4"}),onSelect:()=>He(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */Q(W,{name:"star",className:"h-4 w-4"}),onSelect:()=>Zt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */Q(W,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Pe(/* @__PURE__ */new Set([t.id])),qe(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */Q(W,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},kn=(e,t)=>{const n=Re.has(t.id)?nn:[t];Ct.open(e,n)&&!Re.has(t.id)&&(Pe(/* @__PURE__ */new Set([t.id])),Fe.current=t.id)},wn=e=>on(e)?{draggable:!0,onDragStart:t=>{const n=Re.has(e.id)?nn:[e];t.dataTransfer.setData(ye,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},yn=e=>"folder"===e.kind&&sn(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(ye)&&(t.preventDefault(),t.stopPropagation(),Je!==e.id&&Ge(e.id))},onDragLeave:()=>{Je===e.id&&Ge(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(ye))return;t.preventDefault(),t.stopPropagation(),Ge(null);const n=JSON.parse(t.dataTransfer.getData(ye)||"[]").map(e=>tn.get(e)).filter(t=>!!t&&t.id!==e.id);Xt(n,e.id)}}:{};if(ze)/* @__PURE__ */
36
- return H("div",{className:"flex flex-col h-full bg-surface",children:[
37
- /* @__PURE__ */Q(R,{title:`${r} - offline`}),
38
- /* @__PURE__ */Q("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */H("div",{className:"max-w-md",children:[
39
- /* @__PURE__ */Q(W,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),S()?/* @__PURE__ */H(Z,{children:[
40
- /* @__PURE__ */Q("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach your files"}),
41
- /* @__PURE__ */Q("p",{className:"text-sm text-ink-faint mb-3",children:"Check your connection and try again."})]}):/* @__PURE__ */H(Z,{children:[
42
- /* @__PURE__ */Q("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
43
- /* @__PURE__ */H("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
44
- /* @__PURE__ */Q("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
45
- /* @__PURE__ */Q(z,{variant:"primary",onClick:Ft,children:"Retry"})]})})]});const vn=Ie&&Ie.limit>0?Math.min(100,Math.round(Ie.used/Ie.limit*100)):0,bn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",xn=[Jt?{label:"Shared with me",onClick:()=>ft("shared")}:{label:"My files",onClick:()=>Et(null)},...(Ot?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>Et(e.id)}))],Nn="recent"===lt?"Recent":"starred"===lt?"Starred":"shared"===lt?"Shared with me":"search"===lt?`Results for “${tt}”`:"trash"===lt?"Trash":kt?kt.name:null,Cn=Dt?`${r} - Choosing`:Nn?`${r} - ${"search"===lt?"Search":Nn}`:Ot&&null!==Ot.id?`${r} - ${Ot.name}`:r,Sn=e=>"flex w-full items-center gap-3 rounded-full px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-accent-tint font-medium text-accent-text":"text-ink hover:bg-row-hover"),jn=Se([{key:"folder",label:"New folder",icon:/* @__PURE__ */Q(W,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await F({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?O.error("Folder names cannot contain slashes"):(await zt(()=>n.createFolder(Gt,e),"Create folder failed"),"files"!==lt&&Et(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */Q(W,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */Q(W,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>bt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?we.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=te["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */Q(W,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Gt)).catch(e=>O.error(Ce(e,"Could not create it")))}}}):[]]),Dn=/* @__PURE__ */H("div",{className:"flex h-full flex-col",children:[
46
- /* @__PURE__ */Q("div",{className:"p-3 pb-2",children:/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */H(Z,{children:[
47
- /* @__PURE__ */Q(W,{name:"add",className:"h-5 w-5"}),
48
- /* @__PURE__ */Q("span",{children:"New"})]}),items:jn,align:"start","aria-label":"New",disabled:!Yt,triggerClassName:"inline-flex items-center gap-2 h-11 pl-4 pr-5 rounded-2xl bg-surface-raised border border-line shadow-sm text-sm font-medium text-ink-strong hover:bg-row-hover disabled:opacity-50 rosh-focus-ring focus-visible:ring-2"})}),
49
- /* @__PURE__ */H("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
50
- /* @__PURE__ */H("button",{onClick:()=>Et(null),className:Sn("files"===lt&&!Jt),children:[
51
- /* @__PURE__ */Q(W,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!A&&/* @__PURE__ */H("button",{onClick:()=>ft("recent"),className:Sn("recent"===lt),children:[
52
- /* @__PURE__ */Q(W,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!A&&/* @__PURE__ */H("button",{onClick:()=>ft("starred"),className:Sn("starred"===lt),children:[
53
- /* @__PURE__ */Q(W,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),X&&/* @__PURE__ */H("button",{onClick:()=>ft("shared"),className:Sn("shared"===lt||"files"===lt&&Jt),children:[
54
- /* @__PURE__ */Q(W,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!A&&/* @__PURE__ */H("button",{onClick:()=>ft("trash"),className:Sn("trash"===lt),children:[
55
- /* @__PURE__ */Q(W,{name:"trash",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Trash"]}),pt&&pt.folders.length>0&&/* @__PURE__ */H(Z,{children:[
56
- /* @__PURE__ */Q("div",{className:"px-3 pt-4 pb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),pt.folders.map(e=>/* @__PURE__ */H("button",{onClick:()=>ft({desktopFolderId:e.id}),className:Sn(gt===e.id),children:[
57
- /* @__PURE__ */Q(j,{className:"h-4 w-4 shrink-0 text-amber-500"}),
58
- /* @__PURE__ */Q("span",{className:"truncate",children:e.name}),
59
- /* @__PURE__ */Q(E,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),Ie&&/* @__PURE__ */H("div",{className:"px-5 py-3 shrink-0",title:`${d(Ie.used)} of ${d(Ie.limit)} used`,children:[
60
- /* @__PURE__ */Q("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */Q("div",{className:`h-full ${bn} transition-all`,style:{width:`${vn}%`}})}),
61
- /* @__PURE__ */H("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[d(Ie.used)," of ",d(Ie.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */H("span",{className:"inline-flex items-center gap-1",children:[e,
62
- /* @__PURE__ */Q(W,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),Tn=e=>"inline-flex items-center h-7 px-3 rounded-(--radius-control) border text-xs whitespace-nowrap rosh-focus-ring focus-visible:ring-2 "+(e?"border-accent-border bg-accent-tint text-accent-text":"border-line-strong text-ink-muted hover:bg-row-hover"),$n=pe(lt)||"files"===lt,Ln=function(e){const t=/* @__PURE__ */new Map;for(const n of e)"owner"!==(n.role??"owner")&&n.owner&&t.set(n.owner.id,n.owner.name);return[...t].map(([e,t])=>({id:e,name:t})).sort((e,t)=>se.compare(e.name,t.name))}(_t),Rn=$n&&_t.length>0?/* @__PURE__ */H("div",{className:"flex items-center gap-2 shrink-0",children:[
63
- /* @__PURE__ */Q(o,{trigger:Mn(at.type?ee[at.type]:"Type",!!at.type),"aria-label":"Type",triggerClassName:Tn(!!at.type),items:[...oe.map(e=>({type:"radio",key:e,label:ee[e],checked:at.type===e,onSelect:()=>rt(t=>({...t,type:t.type===e?null:e}))})),...at.type?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,type:null}))}]:[]]}),X&&/* @__PURE__ */Q(o,{trigger:Mn(at.person?"me"===at.person?"Owned by me":Ln.find(e=>e.id===at.person)?.name??"People":"People",!!at.person),"aria-label":"People",triggerClassName:Tn(!!at.person),items:[{type:"radio",key:"me",label:"Owned by me",checked:"me"===at.person,onSelect:()=>rt(e=>({...e,person:"me"===e.person?null:"me"}))},...Ln.map(e=>({type:"radio",key:e.id,label:e.name,checked:at.person===e.id,onSelect:()=>rt(t=>({...t,person:t.person===e.id?null:e.id}))})),...at.person?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,person:null}))}]:[]]}),
64
- /* @__PURE__ */Q(o,{trigger:Mn(at.modified?ce[at.modified]:"Modified",!!at.modified),"aria-label":"Modified",triggerClassName:Tn(!!at.modified),items:[...Object.keys(ce).map(e=>({type:"radio",key:e,label:ce[e],checked:at.modified===e,onSelect:()=>rt(t=>({...t,modified:t.modified===e?null:e}))})),...at.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,modified:null}))}]:[]]})]}):null,Pn=$n&&nn.length>0&&!Dt?/* @__PURE__ */H("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
65
- /* @__PURE__ */Q(c,{"aria-label":"Clear selection",size:"sm",onClick:dn,children:/* @__PURE__ */Q(W,{name:"close",className:"h-4 w-4"})}),
66
- /* @__PURE__ */H("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[nn.length," selected"]}),an&&ln(an)&&/* @__PURE__ */Q(c,{"aria-label":"Share",size:"sm",onClick:()=>Be(an),children:/* @__PURE__ */Q(W,{name:"add-person",className:"h-4 w-4"})}),!A&&nn.every(e=>"file"===e.kind)&&/* @__PURE__ */Q(c,{"aria-label":"Download",size:"sm",onClick:()=>nn.forEach(Kt),children:/* @__PURE__ */Q(W,{name:"download",className:"h-4 w-4"})}),nn.every(on)&&/* @__PURE__ */Q(c,{"aria-label":"Move",size:"sm",onClick:()=>He(nn),children:/* @__PURE__ */Q(W,{name:"forward",className:"h-4 w-4"})}),!A&&nn.every(sn)&&/* @__PURE__ */Q(c,{"aria-label":"Move to trash",size:"sm",onClick:()=>Qt(nn),children:/* @__PURE__ */Q(W,{name:"trash",className:"h-4 w-4"})}),
67
- /* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(W,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(nn)})]}):null,Fn=/* @__PURE__ */Q("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:Pn??/* @__PURE__ */H(Z,{children:[
68
- /* @__PURE__ */H("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===lt?/* @__PURE__ */Q("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */Q(a,{items:xn,maxItems:5})}):"trash"===lt?/* @__PURE__ */Q("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof lt?/* @__PURE__ */H(Z,{children:[
69
- /* @__PURE__ */Q(j,{className:"h-4 w-4 text-amber-500 shrink-0"}),
70
- /* @__PURE__ */Q("span",{className:"text-base font-medium text-ink-strong truncate",children:kt?.name??"Desktop folder"}),
71
- /* @__PURE__ */Q("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */Q("span",{className:"text-base font-medium text-ink-strong truncate",children:Nn}),"files"===lt&&Jt&&"viewer"===Ut&&/* @__PURE__ */H("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-0.5 text-2xs text-ink-faint whitespace-nowrap",children:[
72
- /* @__PURE__ */Q(W,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===lt&&Jt&&Ot?.owner&&/* @__PURE__ */H("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Ot.owner.name]})]}),Rn,"trash"===lt&&/* @__PURE__ */Q(z,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===mt.length)return;await P({title:"Empty trash",message:`${mt.length} item${1===mt.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&zt(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===mt.length,children:"Empty trash"})]})}),An=(e,t)=>Dt?null:/* @__PURE__ */H("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[ln(e)&&/* @__PURE__ */Q(c,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Be(e)},children:/* @__PURE__ */Q(W,{name:"add-person",className:"h-4 w-4"})}),!A&&"file"===e.kind&&/* @__PURE__ */Q(c,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Kt(e)},children:/* @__PURE__ */Q(W,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!A&&/* @__PURE__ */Q(c,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Zt([e],!e.starred)},children:/* @__PURE__ */Q(W,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
73
- /* @__PURE__ */Q("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(W,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(Re.has(e.id)&&nn.length>1?nn:[e])})})]}),En=e=>/* @__PURE__ */H("span",{className:"flex items-center gap-3 min-w-0",children:[
74
- /* @__PURE__ */Q(je,{entry:e}),
75
- /* @__PURE__ */Q("span",{className:"truncate",title:e.name,children:ne(e)}),!!e.shareCount&&/* @__PURE__ */Q("span",{className:"shrink-0",role:"img","aria-label":"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),title:"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),children:/* @__PURE__ */Q(W,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */Q("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */Q(W,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),zn=(e,t,n)=>{const a=it.key===e;/* @__PURE__ */
76
- return Q("th",{className:`${K} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===it.dir?"ascending":"descending":void 0,children:/* @__PURE__ */H("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>st(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===it.dir?/* @__PURE__ */Q(W,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */Q(W,{name:"arrow-down",className:"h-3 w-3"}))]})})},Wn="recent"===lt?"Files you and your colleagues change show here.":"starred"===lt?"Star the files and folders you want to find quickly.":"shared"===lt?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===lt?`Nothing matches “${tt}”.`:null,In=0===en.length?Ae?/* @__PURE__ */Q(I,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */Q("div",{className:"p-10 text-center text-sm text-ink-faintest",children:_t.length>0?"Nothing matches these filters.":Wn??/* @__PURE__ */H(Z,{children:["This folder is empty.",Bt&&/* @__PURE__ */H(Z,{children:[" Drop files here or choose ",
77
- /* @__PURE__ */Q("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===Qe?/* @__PURE__ */Q("div",{className:"px-4 pb-4",children:["folder","file"].map(e=>{const t=en.filter(t=>t.kind===e);return 0===t.length?null:/* @__PURE__ */H("section",{className:"mb-4",children:[
78
- /* @__PURE__ */Q("h3",{className:"text-xs font-medium text-ink-faint mb-2",children:"folder"===e?"Folders":"Files"}),
79
- /* @__PURE__ */Q("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=Re.has(t.id);/* @__PURE__ */
80
- return H("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":ne(t),onClick:e=>cn(t.id,e),onDoubleClick:()=>pn(t),onContextMenu:e=>kn(e,t),...wn(t),...yn(t),className:"group rounded-xl border cursor-default select-none outline-none focus-visible:ring-2 focus-visible:ring-accent-border "+(a||Je===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
81
- /* @__PURE__ */H("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
82
- /* @__PURE__ */Q(je,{entry:t,className:"h-4 w-4"}),
83
- /* @__PURE__ */Q("span",{className:"flex-1 truncate text-sm",title:t.name,children:ne(t)}),
84
- /* @__PURE__ */Q("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(W,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(a&&nn.length>1?nn:[t])})})]}),"file"===e&&/* @__PURE__ */H(Z,{children:[
85
- /* @__PURE__ */Q("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */Q(De,{entry:t,read:A?void 0:n.read})}),
86
- /* @__PURE__ */H("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===ie(t)?"You":ie(t)," · ",re(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */H("table",{className:"w-full text-sm table-fixed",children:[
87
- /* @__PURE__ */Q("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */H("tr",{children:[zn("name","Name","text-left"),X&&zn("owner","Owner","text-left w-32"),zn("modified","Modified","text-left w-28"),zn("size","Size","text-right w-20"),
88
- /* @__PURE__ */Q("th",{className:`${K} w-32`,children:/* @__PURE__ */Q("span",{className:"sr-only",children:"Actions"})})]})}),
89
- /* @__PURE__ */Q("tbody",{children:en.map(e=>{const t=Re.has(e.id);/* @__PURE__ */
90
- return H("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),onContextMenu:t=>kn(t,e),...wn(e),...yn(e),className:`group cursor-default select-none border-b border-line-subtle ${hn(e)} ${t||Je===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
91
- /* @__PURE__ */Q("td",{className:"px-3 h-11",children:En(e)}),X&&/* @__PURE__ */Q("td",{className:"px-3 h-11 text-ink-faint truncate",children:ie(e)}),
92
- /* @__PURE__ */Q("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:ve(e.modifiedAt),children:re(e.modifiedAt)}),
93
- /* @__PURE__ */Q("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint whitespace-nowrap",children:Dt&&"file"===e.kind&&!mn(e)&&Dt.request.otherLabel?Dt.request.otherLabel:ae(e)}),
94
- /* @__PURE__ */Q("td",{className:"px-2 h-11",children:An(e,t)})]},e.id)})})]}),Kn=Ae&&0===mt.length?/* @__PURE__ */Q(I,{size:"sm",padding:"p-6",label:"Loading"}):0===mt.length?/* @__PURE__ */Q("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */H("table",{className:"w-full text-sm table-fixed",children:[
95
- /* @__PURE__ */Q("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */H("tr",{children:[
96
- /* @__PURE__ */Q("th",{className:`${K} text-left font-medium px-3 h-9`,children:"Name"}),
97
- /* @__PURE__ */Q("th",{className:`${K} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
98
- /* @__PURE__ */Q("th",{className:`${K} text-left font-medium px-3 h-9 w-32`,children:"Deleted"}),
99
- /* @__PURE__ */Q("th",{className:`${K} text-right font-medium px-3 h-9 w-24`,children:"Size"}),
100
- /* @__PURE__ */Q("th",{className:`${K} w-28`,children:/* @__PURE__ */Q("span",{className:"sr-only",children:"Actions"})})]})}),
101
- /* @__PURE__ */Q("tbody",{children:mt.map(e=>/* @__PURE__ */H("tr",{className:"group border-b border-line-subtle hover:bg-row-hover",onContextMenu:t=>St.open(t,e),children:[
102
- /* @__PURE__ */Q("td",{className:"px-3 h-11",children:/* @__PURE__ */H("span",{className:"flex items-center gap-3 min-w-0",children:[
103
- /* @__PURE__ */Q(je,{entry:e}),
104
- /* @__PURE__ */Q("span",{className:"truncate",title:e.name,children:e.name})]})}),
105
- /* @__PURE__ */Q("td",{className:"px-3 h-11 text-ink-faint text-xs truncate",title:e.originalPath,children:e.originalPath||"—"}),
106
- /* @__PURE__ */Q("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:e.deletedAt?ve(e.deletedAt):void 0,children:e.deletedAt?re(e.deletedAt):"—"}),
107
- /* @__PURE__ */Q("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":d(e.size)}),
108
- /* @__PURE__ */Q("td",{className:"px-2 h-11",children:/* @__PURE__ */H("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
109
- /* @__PURE__ */Q(c,{"aria-label":"Restore",size:"sm",onClick:()=>Wt(e),children:/* @__PURE__ */Q(W,{name:"revert",className:"h-4 w-4"})}),
110
- /* @__PURE__ */Q(c,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>It(e),children:/* @__PURE__ */Q(W,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),On=0===wt.length?/* @__PURE__ */Q("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */H("table",{className:"w-full text-sm table-fixed",children:[
111
- /* @__PURE__ */Q("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */H("tr",{children:[
112
- /* @__PURE__ */Q("th",{className:`${K} text-left font-medium px-3 h-9`,children:"Name"}),
113
- /* @__PURE__ */Q("th",{className:`${K} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
114
- /* @__PURE__ */Q("th",{className:`${K} w-32`,children:/* @__PURE__ */Q("span",{className:"sr-only",children:"Actions"})})]})}),
115
- /* @__PURE__ */Q("tbody",{children:wt.map(e=>/* @__PURE__ */H("tr",{onDoubleClick:()=>Mt(e),onContextMenu:t=>jt.open(t,e),className:"group cursor-default border-b border-line-subtle hover:bg-row-hover",children:[
116
- /* @__PURE__ */Q("td",{className:"px-3 h-11",children:/* @__PURE__ */H("span",{className:"flex items-center gap-3 min-w-0",children:[
117
- /* @__PURE__ */Q(D,{item:e}),
118
- /* @__PURE__ */Q("span",{className:"truncate",title:e.label,children:e.label})]})}),
119
- /* @__PURE__ */Q("td",{className:"px-3 h-11 text-xs text-ink-faint",children:M(e)}),
120
- /* @__PURE__ */Q("td",{className:"px-2 h-11",children:/* @__PURE__ */H("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
121
- /* @__PURE__ */Q(c,{"aria-label":"Open",size:"sm",onClick:()=>Mt(e),children:/* @__PURE__ */Q(W,{name:"external",className:"h-4 w-4"})}),
122
- /* @__PURE__ */Q(c,{"aria-label":"Move to desktop",size:"sm",onClick:()=>pt?.moveToDesktop([e]),children:/* @__PURE__ */Q(W,{name:"desktop",className:"h-4 w-4"})}),
123
- /* @__PURE__ */Q(c,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>pt?.removeShortcuts([e]),children:/* @__PURE__ */Q(W,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
124
- return H("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Bt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),yt.current++,Oe||Ue(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{yt.current>0&&yt.current--,0===yt.current&&Ue(!1)},onDrop:e=>{e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),qt(),Bt&&e.dataTransfer.files?.length&&Vt(e.dataTransfer.files))},children:[
125
- /* @__PURE__ */Q(R,{title:Cn}),
126
- /* @__PURE__ */Q(k,{app:"files"}),
127
- /* @__PURE__ */Q("input",{ref:vt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Vt(e.target.files),vt.current&&(vt.current.value="")}}),
128
- /* @__PURE__ */Q("input",{ref:e=>{bt.current=e,e?.setAttribute("webkitdirectory","")},type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Vt(e.target.files,{withFolders:!0}),bt.current&&(bt.current.value="")}}),
129
- /* @__PURE__ */Q("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */Q(t,{sidebar:Dn,storageKey:"files.sidebarWidth",defaultWidth:220,minWidth:170,maxWidth:320,children:/* @__PURE__ */H("div",{className:"flex h-full min-w-0",children:[
130
- /* @__PURE__ */H("div",{className:"flex flex-1 min-w-0 flex-col",children:[Dt&&/* @__PURE__ */H("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-line bg-accent-tint text-accent-text text-sm shrink-0",role:"status",children:[
131
- /* @__PURE__ */Q(W,{name:"cursor",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),
132
- /* @__PURE__ */Q("span",{className:"flex-1 min-w-0 truncate",children:Dt.request.title}),
133
- /* @__PURE__ */Q(z,{variant:"secondary",size:"sm",onClick:()=>p(Dt.id,null),children:"Cancel"}),
134
- /* @__PURE__ */Q(z,{variant:"primary",size:"sm",disabled:!fn,onClick:()=>{fn&&un(fn)},children:"Open"})]}),
135
- /* @__PURE__ */H("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
136
- /* @__PURE__ */Q("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */Q(l,{type:"text",enterKeyHint:"search",value:_e,onChange:e=>{et(e.target.value),e.target.value.trim()||At()},onKeyDown:e=>{"Escape"===e.key&&_e&&(e.stopPropagation(),At())},placeholder:`Search in ${r}`,"aria-label":`Search in ${r}`,leftIcon:/* @__PURE__ */Q(W,{name:"search",className:"h-4 w-4"}),endAction:_e?{label:"Clear search",icon:/* @__PURE__ */Q(W,{name:"close",className:"h-4 w-4"}),onClick:At}:void 0})}),
137
- /* @__PURE__ */Q("div",{className:"flex-1"}),"object"!=typeof lt&&"trash"!==lt&&/* @__PURE__ */H(Z,{children:[
138
- /* @__PURE__ */Q(c,{"aria-label":"List view","aria-pressed":"list"===Qe,onClick:()=>ut("list"),children:/* @__PURE__ */Q(W,{name:"list",className:"h-4 w-4"})}),
139
- /* @__PURE__ */Q(c,{"aria-label":"Grid view","aria-pressed":"grid"===Qe,onClick:()=>ut("grid"),children:/* @__PURE__ */Q(W,{name:"grid",className:"h-4 w-4"})})]}),
140
- /* @__PURE__ */Q(c,{"aria-label":"Details","aria-pressed":Xe,onClick:()=>qe(e=>!e),children:/* @__PURE__ */Q(W,{name:"info",className:"h-4 w-4"})})]}),Fn,
141
- /* @__PURE__ */Q("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Dt?"Enter"===e.key&&fn&&(e.preventDefault(),un(fn)):("Delete"===e.key||"Backspace"===e.key)&&nn.length&&nn.every(sn)?(e.preventDefault(),Qt(nn)):"Enter"===e.key&&an?(e.preventDefault(),pn(an)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&en.length&&(e.preventDefault(),Pe(new Set(en.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&dn()},children:"object"==typeof lt?On:"trash"===lt?Kn:In})]}),Xe&&$n&&/* @__PURE__ */Q(fe,{store:n,entry:an,selectedCount:nn.length,onClose:()=>qe(!1)})]})})}),Ct.state&&/* @__PURE__ */Q(s,{...Ct.props,items:gn(Ct.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */Q(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */Q(W,{name:"revert",className:"h-4 w-4"}),onSelect:()=>Wt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */Q(W,{name:"trash",className:"h-4 w-4"}),onSelect:()=>It(St.state.data)}]}),jt.state&&/* @__PURE__ */Q(s,{...jt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */Q(W,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(jt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */Q(W,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>pt?.moveToDesktop([jt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */Q(W,{name:"close",className:"h-4 w-4"}),onSelect:()=>pt?.removeShortcuts([jt.state.data])}]}),X&&/* @__PURE__ */Q(he,{store:n,entry:Ye,onClose:()=>Be(null),onChanged:Ft}),n.move&&/* @__PURE__ */Q(ue,{store:n,items:Ve,from:"files"===lt?_:void 0,onClose:()=>He(null),onMove:e=>Ve&&Xt(Ve,e)}),Oe&&/* @__PURE__ */Q("div",{className:"absolute inset-0 bg-accent-tint border-4 border-dashed border-accent-border pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */Q("div",{className:"px-4 py-2 rounded-md bg-accent-fill text-on-accent text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{Me as default,Ne as quotaExceededMessage};
@@ -1,91 +0,0 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-XOZ5VPXF.js";import{subscribePomo as o,getPomoSnapshot as a,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as i,setPomoFocusSound as l,useTodoTasks as c,migratePomodoroTasksOnce as u,pomoSwitchMode as d,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as k,previewFocusSound as f}from"./chunk-COHFFGFE.js";import{PLACEHOLDER_INK as b}from"./chunk-AYZY3YNC.js";import{pad2 as x}from"./chunk-LF27WIN2.js";import{useWidgetSettings as v}from"./chunk-H4LUHKUJ.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DASRJ26L.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-GHLXZDLU.js";import"./chunk-KV6XCHAG.js";import"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import"./chunk-PR6FNBKR.js";import"./chunk-RIG5FEVS.js";import"./chunk-NDWX5Z4D.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-ZGIAMYTI.js";import"./chunk-5LHEPE4B.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as y}from"./chunk-KC3EX26K.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as N}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-TMSSR5UH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-DEJIH3ZQ.js";import"./chunk-C3QOHMR6.js";import{useSyncExternalStore as C,useEffect as S,useMemo as w,useState as j,useRef as B,useCallback as M}from"react";import{jsxs as T,Fragment as I,jsx as P}from"react/jsx-runtime";var D="pomodoro_appearance",A="pomodoro_active_task_id",L={focus:"Pomodoro",short:"Short Break",long:"Long Break"},V={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var R=25,F=5,$=15,E=!1,W=!1,G=4,H=!0,U=!0,J="bell",O=100,Z=1,X="none",K=50,Q=(e,t,o,a)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(o,Math.round(e))):a;function Y(){const t=C(o,a,a),{prefs:g,save:f}=y(),b=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:Q(t.focusMinutes,1,120,R),shortBreakMinutes:Q(t.shortBreakMinutes,1,120,F),longBreakMinutes:Q(t.longBreakMinutes,1,120,$),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:E,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:W,longBreakInterval:Q(t.longBreakInterval,1,20,G),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:H,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:U,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:J,alarmVolume:Q(t.alarmVolume,0,100,O),alarmRepeat:Q(t.alarmRepeat,1,5,Z),focusSound:k.some(e=>e.id===t.focusSound)?t.focusSound:X,focusVolume:Q(t.focusVolume,0,100,K)}}(g.pomodoro_settings);S(()=>{n({focus:60*b.focusMinutes,short:60*b.shortBreakMinutes,long:60*b.longBreakMinutes})},[b.focusMinutes,b.shortBreakMinutes,b.longBreakMinutes]),S(()=>{r(b.alarmSound),s(b.alarmVolume,b.alarmRepeat)},[b.alarmSound,b.alarmVolume,b.alarmRepeat]),S(()=>{i({autoStartBreaks:b.autoStartBreaks,autoStartPomodoros:b.autoStartPomodoros,longBreakInterval:b.longBreakInterval})},[b.autoStartBreaks,b.autoStartPomodoros,b.longBreakInterval]),S(()=>{l(b.focusSound,b.focusVolume)},[b.focusSound,b.focusVolume]),S(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const Y=c(),z=Y.tasks,q=w(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),ee=function(e,t){return w(()=>t?(e=>{const t=[],o=[];for(const a of e)(a.done?o:t).push(a);return[...t,...o]})(e):e,[e,t])}(w(()=>z.filter(e=>!!e.dueDate&&(e.dueDate===q||e.dueDate<q&&!e.done)),[z,q]),b.checkToBottom),[te,oe]=j(()=>localStorage.getItem(A)),[ae,ne]=j(!1),[re,se]=j(null),ie=B(!1);S(()=>{ie.current||(ie.current=!0,u(z,Y.setAllTasks))},[]),S(()=>{try{te?localStorage.setItem(A,te):localStorage.removeItem(A)}catch{}},[te]),S(()=>{if(!re)return;const e=()=>se(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[re]);const le=B(t.streak);S(()=>{if(t.streak>le.current&&te){const e=z.find(e=>e.id===te);if(e){const t=(e.completed??0)+1,o=e.estimated??0,a=b.autoCheckTasks&&o>0&&t>=o;Y.updateTask(te,{completed:t,done:e.done||a})}}le.current=t.streak},[t.streak,te,b.autoCheckTasks,z,Y]);const ue=ee.reduce((e,t)=>e+(t.completed??0),0),de=ee.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),me=ee.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),he=t.running&&"focus"===t.mode?t.remaining:0,pe=me*b.focusMinutes*60+he,ge=new Date(Date.now()+1e3*pe).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ke=(pe/3600).toFixed(1),fe=te?z.find(e=>e.id===te)??null:null,be=x(Math.floor(t.remaining/60)),xe=x(t.remaining%60),[ve,ye]=j(()=>e(D)),[Ne,Ce]=j(!1),[Se,we]=j(ve),[je,Be]=j(b);v(M(()=>{we({...ve}),Be({...b}),Ce(!0)},[ve,b]));const Me="focus"!==t.mode,Te=V[t.mode],Ie=Me?(Pe=Te,De=ve.activeOpacity/100,`rgba(${parseInt(Pe.slice(1,3),16)}, ${parseInt(Pe.slice(3,5),16)}, ${parseInt(Pe.slice(5,7),16)}, ${De})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${ve.activeOpacity/100})`;var Pe,De;const Ae={primary:Me?"text-white":"text-gray-900",secondary:Me?"text-white/85":"text-gray-700",muted:Me?"text-white/65":"text-gray-500",tabActive:Me?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Me?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Me?"border-white/30":"border-gray-200",softDivider:Me?"border-white/20":"border-gray-200",iconBtn:Me?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Me?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Le=Me?Te:"#0f172a";/* @__PURE__ */
2
- return T(I,{children:[
3
- /* @__PURE__ */T("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Ae.primary}`,style:{backgroundColor:Ie,backdropFilter:ve.activeBlur>0?`blur(${ve.activeBlur}px)`:void 0},children:[
4
- /* @__PURE__ */P("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */P("button",{onClick:()=>d(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?Ae.tabActive:Ae.tabInactive}`,children:L[e]},e))}),
5
- /* @__PURE__ */T("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[be,":",xe]}),
6
- /* @__PURE__ */P("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */P("button",{onClick:()=>t.running?m():h(),className:"bg-surface px-12 py-3 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__ */P("div",{className:"px-3 py-3 text-center",children:fe?/* @__PURE__ */T(I,{children:[
8
- /* @__PURE__ */T("div",{className:`text-xs leading-tight ${Ae.muted}`,children:["#",(fe.completed??0)+1]}),
9
- /* @__PURE__ */P("div",{className:`text-base font-medium leading-tight truncate mt-0.5 ${Ae.primary}`,children:fe.name})]}):/* @__PURE__ */P("div",{className:`text-xs italic ${Ae.muted}`,children:"No task selected"})}),
10
- /* @__PURE__ */T("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
- /* @__PURE__ */P("h3",{className:`text-base font-bold tracking-tight ${Ae.primary}`,children:"Tasks"}),
12
- /* @__PURE__ */P("button",{className:`rounded p-1 transition-colors ${Ae.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */P(N,{name:"more-vertical",look:"solid",className:"h-4 w-4"})})]}),
13
- /* @__PURE__ */P("div",{className:`border-t mx-3 mt-2 ${Ae.divider}`}),
14
- /* @__PURE__ */T("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[ee.map(e=>{const t=e.id===te;/* @__PURE__ */
15
- return T("div",{onClick:()=>oe(e.id),className:"bg-surface text-ink-strong rounded-md flex items-center pr-2 py-3 shadow-sm cursor-pointer transition-shadow hover:shadow-(--elevation-panel) "+(t?"border-l-4 border-gray-700 pl-2":"pl-3 border-l-4 border-transparent"),children:[
16
- /* @__PURE__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,Y.toggleDone(o)},className:"shrink-0",children:e.done?/* @__PURE__ */P("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Le},children:/* @__PURE__ */P("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__ */P("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */P("circle",{cx:"12",cy:"12",r:"10"})})}),
17
- /* @__PURE__ */P("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
18
- /* @__PURE__ */T("span",{className:"text-sm tabular-nums mr-2 shrink-0",children:[
19
- /* @__PURE__ */P("span",{className:"font-bold text-gray-500",children:e.completed??0}),
20
- /* @__PURE__ */P("span",{className:"text-gray-400",children:" / "}),
21
- /* @__PURE__ */P("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
22
- /* @__PURE__ */T("div",{className:"relative",children:[
23
- /* @__PURE__ */P("button",{onClick:t=>{t.stopPropagation(),se(re===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */P(N,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-ink-faint"})}),re===e.id&&/* @__PURE__ */P("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__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,Y.removeTask(o),te===o&&oe(null),se(null)},className:"block w-full px-3 h-8 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),ae?/* @__PURE__ */P(ce,{onSubmit:(e,t)=>{const o=e.trim();if(!o)return;const a=Y.addTask({name:o,estimated:t,completed:0,dueDate:q});te||oe(a),ne(!1)},onCancel:()=>ne(!1),accentColor:Le}):/* @__PURE__ */T("button",{onClick:()=>ne(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Ae.addTaskBtn}`,children:[
24
- /* @__PURE__ */P(N,{name:"add-circle",className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
25
- /* @__PURE__ */T("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${Ae.softDivider}`,children:[
26
- /* @__PURE__ */T("span",{className:Ae.secondary,children:["Pomos: ",
27
- /* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:ue}),
28
- /* @__PURE__ */P("span",{className:Ae.muted,children:" / "}),
29
- /* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:de})]}),pe>0&&/* @__PURE__ */T("span",{className:Ae.secondary,children:["Finish At: ",
30
- /* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:ge}),
31
- /* @__PURE__ */T("span",{className:Ae.muted,children:[" (",ke,"h)"]})]})]})]}),
32
- /* @__PURE__ */P(_,{open:Ne,onClose:()=>Ce(!1),onSave:()=>{ye(Se),localStorage.setItem(D,JSON.stringify(Se)),f({pomodoro_settings:je}),Ce(!1)},configAppearance:Se,setConfigAppearance:we,configPrefs:je,setConfigPrefs:Be})]})}function _({open:e,onClose:o,onSave:a,configAppearance:n,setConfigAppearance:r,configPrefs:s,setConfigPrefs:i}){const l=(e,t)=>i(o=>({...o,[e]:t}));/* @__PURE__ */
33
- return T(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:a,children:[
34
- /* @__PURE__ */T(z,{icon:/* @__PURE__ */P(se,{}),label:"TIMER",children:[
35
- /* @__PURE__ */T("div",{children:[
36
- /* @__PURE__ */P("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
37
- /* @__PURE__ */T("div",{className:"grid grid-cols-3 gap-3",children:[
38
- /* @__PURE__ */P(te,{label:"Pomodoro",value:s.focusMinutes,onChange:e=>l("focusMinutes",e),max:120}),
39
- /* @__PURE__ */P(te,{label:"Short Break",value:s.shortBreakMinutes,onChange:e=>l("shortBreakMinutes",e),max:120}),
40
- /* @__PURE__ */P(te,{label:"Long Break",value:s.longBreakMinutes,onChange:e=>l("longBreakMinutes",e),max:120})]})]}),
41
- /* @__PURE__ */P(q,{label:"Auto Start Breaks",children:/* @__PURE__ */P(ne,{checked:s.autoStartBreaks,onChange:e=>l("autoStartBreaks",e)})}),
42
- /* @__PURE__ */P(q,{label:"Auto Start Pomodoros",children:/* @__PURE__ */P(ne,{checked:s.autoStartPomodoros,onChange:e=>l("autoStartPomodoros",e)})}),
43
- /* @__PURE__ */P(q,{label:"Long Break interval",children:/* @__PURE__ */P(oe,{value:s.longBreakInterval,onChange:e=>l("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
- /* @__PURE__ */T(z,{icon:/* @__PURE__ */P(ie,{}),label:"TASK",children:[
45
- /* @__PURE__ */P(q,{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__ */P(ne,{checked:s.autoCheckTasks,onChange:e=>l("autoCheckTasks",e)})}),
46
- /* @__PURE__ */P(q,{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__ */P(ne,{checked:s.checkToBottom,onChange:e=>l("checkToBottom",e)})})]}),
47
- /* @__PURE__ */T(z,{icon:/* @__PURE__ */P(le,{}),label:"SOUND",children:[
48
- /* @__PURE__ */P(q,{label:"Alarm Sound",children:/* @__PURE__ */T("div",{className:"flex items-center gap-2",children:[
49
- /* @__PURE__ */P(ae,{value:s.alarmSound,onChange:e=>l("alarmSound",e),options:p.map(e=>({id:e.id,label:e.label}))}),"off"!==s.alarmSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>g(s.alarmSound,{volume:s.alarmVolume,repeat:1}),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
50
- /* @__PURE__ */P(ee,{value:s.alarmVolume,onChange:e=>l("alarmVolume",e)}),
51
- /* @__PURE__ */P(q,{label:"repeat",children:/* @__PURE__ */P(oe,{value:s.alarmRepeat,onChange:e=>l("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
- /* @__PURE__ */P(q,{label:"Focus Sound",children:/* @__PURE__ */T("div",{className:"flex items-center gap-2",children:[
53
- /* @__PURE__ */P(ae,{value:s.focusSound,onChange:e=>l("focusSound",e),options:k}),"none"!==s.focusSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>f(s.focusSound,s.focusVolume),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
54
- /* @__PURE__ */P(ee,{value:s.focusVolume,onChange:e=>l("focusVolume",e)})]})]})}function z({icon:e,label:t,children:o}){/* @__PURE__ */
55
- return T("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
- /* @__PURE__ */T("div",{className:"flex items-center gap-2 mb-3 text-ink-faintest",children:[e,
57
- /* @__PURE__ */P("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
58
- /* @__PURE__ */P("div",{className:"space-y-3",children:o})]})}function q({label:e,info:t,children:o}){/* @__PURE__ */
59
- return T("div",{className:"flex items-center justify-between gap-3",children:[
60
- /* @__PURE__ */T("div",{className:"flex items-center gap-2 min-w-0",children:[
61
- /* @__PURE__ */P("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */P(re,{title:t})]}),
62
- /* @__PURE__ */P("div",{className:"shrink-0",children:o})]})}function ee({value:e,onChange:t}){/* @__PURE__ */
63
- return T("div",{className:"flex items-center justify-end gap-3",children:[
64
- /* @__PURE__ */P("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
65
- /* @__PURE__ */P("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function te({label:e,value:t,onChange:o,min:a=1,max:n=99}){/* @__PURE__ */
66
- return T("label",{className:"flex flex-col",children:[
67
- /* @__PURE__ */P("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
68
- /* @__PURE__ */P(oe,{value:t,onChange:o,min:a,max:n})]})}function oe({value:e,onChange:t,min:o=1,max:a=99,className:n=""}){/* @__PURE__ */
69
- return P("input",{type:"number",min:o,max:a,value:e,onChange:e=>t(Math.max(o,Math.min(a,parseInt(e.target.value,10)||o))),className:`bg-gray-100 border-0 rounded-md px-2 h-8 text-sm font-medium text-ink-strong focus:outline-none focus:ring-2 focus:ring-blue-500 w-full ${n}`})}function ae({value:e,onChange:t,options:o}){/* @__PURE__ */
70
- return T("div",{className:"relative",children:[
71
- /* @__PURE__ */P("select",{value:e,onChange:e=>t(e.target.value),className:"appearance-none bg-gray-100 border-0 rounded-md pl-3 pr-8 h-8 text-sm font-medium text-ink-strong focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer",children:o.map(e=>/* @__PURE__ */P("option",{value:e.id,children:e.label},e.id))}),
72
- /* @__PURE__ */P(N,{name:"chevron-down",className:`absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 pointer-events-none ${b}`,strokeWidth:2.5})]})}function ne({checked:e,onChange:t}){/* @__PURE__ */
73
- return P("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__ */P("span",{className:"absolute h-5 w-5 rounded-full bg-white shadow transition-transform "+(e?"translate-x-[22px]":"translate-x-0.5")})})}function re({title:e}){/* @__PURE__ */
74
- return P("span",{title:e,className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-gray-300 text-on-accent text-3xs font-bold cursor-help",children:"i"})}function se(){/* @__PURE__ */
75
- return T("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
76
- /* @__PURE__ */P("circle",{cx:"12",cy:"12",r:"9"}),
77
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7v5l3 2"})]})}function ie(){/* @__PURE__ */
78
- return T("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
79
- /* @__PURE__ */P("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),
80
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})}function le(){/* @__PURE__ */
81
- return T("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
82
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5L6 9H2v6h4l5 4V5z"}),
83
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function ce({onSubmit:e,onCancel:t,accentColor:o}){const[a,n]=j(""),[r,s]=j(1),i=()=>e(a,r);/* @__PURE__ */
84
- return T("div",{className:"bg-surface text-ink-strong rounded-md p-3 shadow-(--elevation-panel)",children:[
85
- /* @__PURE__ */P("input",{autoFocus:!0,value:a,onChange:e=>n(e.target.value),placeholder:"What are you working on?",onKeyDown:e=>{"Enter"===e.key&&i(),"Escape"===e.key&&t()},className:"w-full text-base font-medium bg-transparent border-0 outline-none placeholder-gray-400"}),
86
- /* @__PURE__ */T("div",{className:"flex items-center justify-between mt-2",children:[
87
- /* @__PURE__ */P("span",{className:"text-xs font-semibold text-gray-500",children:"Est Pomodoros"}),
88
- /* @__PURE__ */P("input",{type:"number",min:1,max:20,value:r,onChange:e=>s(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__ */T("div",{className:"flex gap-2 mt-3 justify-end",children:[
90
- /* @__PURE__ */P("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
91
- /* @__PURE__ */P("button",{onClick:i,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:o},children:"Save"})]})]})}export{Y as default};
@@ -1,60 +0,0 @@
1
- import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-XOZ5VPXF.js";import{pad2 as s}from"./chunk-LF27WIN2.js";import{useWidgetSettings as o}from"./chunk-H4LUHKUJ.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DASRJ26L.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-GHLXZDLU.js";import"./chunk-KV6XCHAG.js";import"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import"./chunk-PR6FNBKR.js";import"./chunk-RIG5FEVS.js";import"./chunk-NDWX5Z4D.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-ZGIAMYTI.js";import"./chunk-5LHEPE4B.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as l}from"./chunk-KC3EX26K.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as c}from"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-DEJIH3ZQ.js";import"./chunk-C3QOHMR6.js";import{useState as d,useEffect as m,useCallback as h}from"react";import{jsx as p,jsxs as u,Fragment as f}from"react/jsx-runtime";var y="weather_city",g="weather_appearance",x={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function b(){const e="undefined"!=typeof localStorage?localStorage.getItem(y):null;if(e&&a[e])return e;try{const e=JSON.parse(localStorage.getItem("weather_cities")||"");if(Array.isArray(e)&&e[0]&&a[e[0]])return localStorage.setItem(y,e[0]),e[0]}catch{}return function(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;for(const[t,r]of Object.entries(a))if(r.tz===e)return t}catch{}return"London"}()}var w=r;function k(e,t=!1){try{if(t){const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!1}).formatToParts(/* @__PURE__ */new Date),a=parseInt(t.find(e=>"hour"===e.type)?.value||"0"),r=parseInt(t.find(e=>"minute"===e.type)?.value||"0");return`${s(a)}:${s(r)}`}const a=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(/* @__PURE__ */new Date),r=parseInt(a.find(e=>"hour"===e.type)?.value||"12"),n=parseInt(a.find(e=>"minute"===e.type)?.value||"0"),i=a.find(e=>"dayPeriod"===e.type)?.value||"";return`${r}:${s(n)} ${i}`}catch{return""}}function v(){/* @__PURE__ */
2
- return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
3
- /* @__PURE__ */p("div",{className:"absolute -top-5 -right-5 w-24 h-24",style:{animation:"wx-sun-rays 70s linear infinite"},children:/* @__PURE__ */p("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:Array.from({length:12}).map((e,t)=>/* @__PURE__ */p("rect",{x:49,y:3,width:2,height:14,rx:1,fill:"rgba(255, 232, 130, 0.55)",transform:`rotate(${30*t} 50 50)`},t))})}),
4
- /* @__PURE__ */p("div",{className:"absolute top-1 right-1 w-10 h-10 rounded-full",style:{background:"radial-gradient(circle at 35% 35%, #fff8cc 0%, #ffd84a 55%, #ff9e2a 100%)",boxShadow:"0 0 18px 5px rgba(255, 200, 80, 0.55)",animation:"wx-sun-pulse 4.5s ease-in-out infinite"}})]})}function N(){const e=Array.from({length:16}).map((e,t)=>({left:(53*t+11)%95+"%",top:(37*t+9)%78+"%",size:1+13*t%3,delay:.41*t%4+"s",duration:2.5+7*t%5*.6+"s"}));/* @__PURE__ */
5
- return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
6
- /* @__PURE__ */p("div",{className:"absolute top-1 right-1",children:/* @__PURE__ */u("svg",{viewBox:"0 0 40 40",className:"w-9 h-9",style:{filter:"drop-shadow(0 0 6px rgba(255,250,220,0.4))"},children:[
7
- /* @__PURE__ */p("defs",{children:/* @__PURE__ */u("radialGradient",{id:"wx-moon-grad",cx:"35%",cy:"35%",children:[
8
- /* @__PURE__ */p("stop",{offset:"0",stopColor:"#fffae0"}),
9
- /* @__PURE__ */p("stop",{offset:"1",stopColor:"#d4c98a"})]})}),
10
- /* @__PURE__ */p("circle",{cx:20,cy:20,r:13,fill:"url(#wx-moon-grad)"}),
11
- /* @__PURE__ */p("circle",{cx:26,cy:16,r:11,fill:"rgba(15,23,42,1)"})]})}),e.map((e,t)=>/* @__PURE__ */p("div",{className:"absolute rounded-full bg-white",style:{left:e.left,top:e.top,width:e.size,height:e.size,animation:`wx-twinkle ${e.duration} ease-in-out ${e.delay} infinite`}},t)),
12
- /* @__PURE__ */p("div",{className:"absolute",style:{left:"15%",top:"20%",animation:"wx-shooting-star 12s ease-out infinite"},children:/* @__PURE__ */p("div",{className:"w-12 h-px",style:{background:"linear-gradient(to right, transparent, rgba(255,255,255,0.95))",boxShadow:"0 0 4px rgba(255,255,255,0.8)"}})})]})}function j({tone:e="light"}){const t="light"===e?"rgba(255,255,255,0.78)":"rgba(220,228,240,0.45)",a=({scale:e=1})=>/* @__PURE__ */u("svg",{viewBox:"0 0 120 50",className:"w-32 h-12",style:{transform:`scale(${e})`,filter:"blur(0.6px)"},children:[
13
- /* @__PURE__ */p("ellipse",{cx:28,cy:36,rx:18,ry:11,fill:t}),
14
- /* @__PURE__ */p("ellipse",{cx:50,cy:28,rx:22,ry:15,fill:t}),
15
- /* @__PURE__ */p("ellipse",{cx:75,cy:32,rx:20,ry:12,fill:t}),
16
- /* @__PURE__ */p("ellipse",{cx:95,cy:38,rx:15,ry:9,fill:t})]});/* @__PURE__ */
17
- return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
18
- /* @__PURE__ */p("div",{className:"absolute",style:{top:"8%",animation:"wx-drift-cloud 42s linear infinite"},children:/* @__PURE__ */p(a,{scale:.9})}),
19
- /* @__PURE__ */p("div",{className:"absolute",style:{top:"40%",animation:"wx-drift-cloud 60s linear -22s infinite",opacity:.85},children:/* @__PURE__ */p(a,{scale:1.25})}),
20
- /* @__PURE__ */p("div",{className:"absolute",style:{top:"68%",animation:"wx-drift-cloud 78s linear -45s infinite",opacity:.7},children:/* @__PURE__ */p(a,{scale:.75})})]})}function D({heavy:e=!1}){const t=e?26:16,a=["wx-rain-a","wx-rain-b","wx-rain-c"],r=Array.from({length:t}).map((e,r)=>({left:(100*r/t+11*r%7)%100+"%",delay:.087*r%1.3+"s",height:12+r%4*5+"px",duration:.7+r%3*.18+"s",variant:a[r%a.length]}));/* @__PURE__ */
21
- return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:r.map((e,t)=>/* @__PURE__ */p("div",{className:"absolute",style:{left:e.left,top:"-20px",width:"1px",height:e.height,background:"linear-gradient(180deg, rgba(180,210,255,0) 0%, rgba(220,235,255,0.85) 90%, rgba(255,255,255,0.95) 100%)",transform:"rotate(8deg)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`,transformOrigin:"top"}},t))})}function S(){const e=["wx-snow-a","wx-snow-b","wx-snow-c"],t=Array.from({length:16}).map((t,a)=>({left:(100*a/16+13*a%5)%100+"%",delay:.43*a%5+"s",duration:4.5+a%5+"s",size:3+a%4*1.4,opacity:.65+7*a%4*.08,variant:e[a%e.length]}));/* @__PURE__ */
22
- return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:t.map((e,t)=>/* @__PURE__ */p("div",{className:"absolute rounded-full bg-white",style:{left:e.left,top:"-12px",width:e.size,height:e.size,opacity:e.opacity,boxShadow:"0 0 4px rgba(255,255,255,0.65)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`}},t))})}function I(){/* @__PURE__ */
23
- return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
24
- /* @__PURE__ */p(D,{heavy:!0}),
25
- /* @__PURE__ */p("div",{className:"absolute inset-0 bg-white",style:{animation:"wx-flash 6s ease-out infinite"}}),
26
- /* @__PURE__ */p("div",{className:"absolute inset-y-0 right-1/3 flex items-center justify-center pointer-events-none",style:{animation:"wx-bolt 6s ease-out infinite"},children:/* @__PURE__ */p("svg",{viewBox:"0 0 18 60",className:"h-4/5",style:{filter:"drop-shadow(0 0 6px rgba(255, 240, 150, 0.95)) drop-shadow(0 0 14px rgba(255, 220, 90, 0.7))"},children:/* @__PURE__ */p("path",{d:"M11 0 L2 28 L8 30 L4 60 L16 24 L9 22 Z",fill:"rgba(255, 250, 200, 0.98)",stroke:"rgba(255, 255, 255, 0.9)",strokeWidth:.3})})})]})}function F(){/* @__PURE__ */
27
- return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */p("div",{className:"absolute left-0 right-0",style:{top:10+22*t+"%",height:"14px",background:"linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 100%)",filter:"blur(2px)",animation:`wx-fog-drift ${10+3*t}s ease-in-out ${.7*t}s infinite alternate`}},t))})}function L({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */p(t?v:N,{}):2===e?/* @__PURE__ */u(f,{children:[/* @__PURE__ */p(t?v:N,{}),
28
- /* @__PURE__ */p(j,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */p(j,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */p(F,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */p(D,{}):[55,63,65,82].includes(e)?/* @__PURE__ */p(D,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */p(S,{}):[95,96,99].includes(e)?/* @__PURE__ */p(I,{}):null}function H(){const[r,s]=d(b),[v,N]=d(()=>n(g)),[j,D]=d(null),[S,I]=d(!0),[,F]=d(0);m(()=>{const e=setInterval(()=>F(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[H,T]=d(!1),[$,A]=d(r),[C,G]=d(v),{prefs:Z,save:X}=l(),M={...x,...Z.weather_prefs??{}},[O,J]=d(M);o(h(()=>{A(r),G({...v}),J({...M}),T(!0)},[r,v,M])),m(()=>{let t=!1;return I(!0),e(r).then(e=>{t||(D(e),I(!1))}),()=>{t=!0}},[r]);const U=e=>M.useFahrenheit?`${w(e)}°F`:`${e}°`;if(S&&!j)/* @__PURE__ */
29
- return p("div",{className:"flex items-center justify-center h-full bg-gradient-to-b from-sky-400 to-blue-500 rounded-lg text-on-accent/80 text-xs",style:{minHeight:110},children:/* @__PURE__ */p(c,{size:"sm",padding:"",label:"Loading"})});if(!j)/* @__PURE__ */
30
- return p("div",{className:"flex items-center justify-center h-full bg-slate-700 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Couldn't load weather"});const[B,W,P]=t(j.code,j.isDay);/* @__PURE__ */
31
- return u(f,{children:[
32
- /* @__PURE__ */p("style",{children:"\n@keyframes wx-rain-a { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 0.95; } 100% { transform: translate(8px,140px); opacity: 0; } }\n@keyframes wx-rain-b { 0% { transform: translate(0,-20px); opacity: 0; } 12% { opacity: 0.85; } 100% { transform: translate(12px,140px); opacity: 0; } }\n@keyframes wx-rain-c { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(5px,140px); opacity: 0; } }\n@keyframes wx-snow-a { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.9; } 50% { transform: translate(10px,55px) rotate(180deg); } 100% { transform: translate(-4px,140px) rotate(360deg); opacity: 0; } }\n@keyframes wx-snow-b { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.85; } 50% { transform: translate(-12px,55px) rotate(-180deg); } 100% { transform: translate(6px,140px) rotate(-360deg); opacity: 0; } }\n@keyframes wx-snow-c { 0% { transform: translate(0,-12px); opacity: 0; } 10% { opacity: 0.7; } 100% { transform: translate(2px,140px); opacity: 0; } }\n@keyframes wx-drift-cloud { 0% { transform: translateX(-40%); } 100% { transform: translateX(140%); } }\n@keyframes wx-twinkle { 0%, 100% { opacity: 0.25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.6); } }\n@keyframes wx-flash { 0%, 86%, 100% { opacity: 0; } 87% { opacity: 0.95; } 88% { opacity: 0.15; } 89% { opacity: 0.85; } 90% { opacity: 0; } }\n@keyframes wx-bolt { 0%, 86%, 90%, 100% { opacity: 0; } 87% { opacity: 1; } 89% { opacity: 0.85; } }\n@keyframes wx-sun-pulse { 0%, 100% { transform: scale(1); opacity: 0.65; } 50% { transform: scale(1.12); opacity: 0.95; } }\n@keyframes wx-sun-rays { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }\n@keyframes wx-fog-drift { 0% { transform: translateX(-25%); opacity: 0.3; } 50% { opacity: 0.65; } 100% { transform: translateX(25%); opacity: 0.3; } }\n@keyframes wx-shooting-star { 0%, 95% { opacity: 0; transform: translate(0,0) scale(0); } 96% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(40px,30px) scale(1); } }\n"}),
33
- /* @__PURE__ */p("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${v.activeOpacity/100})`,backdropFilter:v.activeBlur>0?`blur(${v.activeBlur}px)`:void 0},children:/* @__PURE__ */u("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${P}`,style:{height:110},children:[
34
- /* @__PURE__ */p(L,{code:j.code,isDay:j.isDay}),
35
- /* @__PURE__ */u("div",{className:"relative z-10 px-3 py-3 flex flex-col h-full justify-between",children:[
36
- /* @__PURE__ */u("div",{className:"flex items-start justify-between gap-2",children:[
37
- /* @__PURE__ */u("div",{className:"min-w-0 flex-1",children:[
38
- /* @__PURE__ */p("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:j.city}),M.showLocalTime&&/* @__PURE__ */p("div",{className:"text-2xs opacity-90 leading-tight tabular-nums drop-shadow-sm",children:k(j.timezone,M.use24Hour)})]}),
39
- /* @__PURE__ */p("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:U(j.temp)})]}),
40
- /* @__PURE__ */u("div",{className:"flex items-end justify-between gap-2",children:[
41
- /* @__PURE__ */u("div",{className:"flex items-center gap-2 min-w-0",children:[
42
- /* @__PURE__ */p("span",{className:"text-lg leading-none drop-shadow-sm",children:W}),
43
- /* @__PURE__ */p("span",{className:"text-2xs font-medium drop-shadow-sm truncate",children:B})]}),
44
- /* @__PURE__ */u("span",{className:"text-2xs opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",U(j.high)," L:",U(j.low)]})]})]})]})}),
45
- /* @__PURE__ */u(i,{open:H,onClose:()=>T(!1),title:"Weather Settings",appearance:C,onAppearanceChange:G,onSave:()=>{s($),N(C),X({weather_prefs:O}),localStorage.setItem(y,$),localStorage.setItem(g,JSON.stringify(C)),T(!1)},children:[
46
- /* @__PURE__ */p("div",{className:"space-y-3",children:/* @__PURE__ */u("div",{children:[
47
- /* @__PURE__ */p("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
48
- /* @__PURE__ */u("div",{className:"flex items-center gap-3 mb-2",children:[
49
- /* @__PURE__ */p("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
50
- /* @__PURE__ */p("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */p("button",{onClick:()=>J(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(O.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
51
- /* @__PURE__ */u("div",{className:"flex items-center gap-3 mb-2",children:[
52
- /* @__PURE__ */p("span",{className:"text-sm text-gray-600 w-24",children:"Time Format"}),
53
- /* @__PURE__ */p("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */p("button",{onClick:()=>J(t=>({...t,use24Hour:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(O.use24Hour===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
54
- /* @__PURE__ */u("label",{className:"flex items-center gap-2 cursor-pointer",children:[
55
- /* @__PURE__ */p("input",{type:"checkbox",checked:O.showLocalTime,onChange:e=>J(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
56
- /* @__PURE__ */p("span",{className:"text-sm text-gray-600",children:"Show local time"})]})]})}),
57
- /* @__PURE__ */u("div",{children:[
58
- /* @__PURE__ */p("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"City"}),
59
- /* @__PURE__ */p("select",{value:$,onChange:e=>A(e.target.value),className:"w-full bg-surface-sunken border border-line rounded px-2 h-8 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */p("option",{value:e,children:e},e))}),
60
- /* @__PURE__ */p("p",{className:"mt-1 text-2xs text-ink-faintest",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{H as default};
@@ -1,32 +0,0 @@
1
- import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as n,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as s,WidgetSettingsModal as i}from"./chunk-XOZ5VPXF.js";import{useWidgetSettings as a}from"./chunk-H4LUHKUJ.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DASRJ26L.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-GHLXZDLU.js";import"./chunk-KV6XCHAG.js";import"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import"./chunk-PR6FNBKR.js";import"./chunk-RIG5FEVS.js";import"./chunk-NDWX5Z4D.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-ZGIAMYTI.js";import"./chunk-5LHEPE4B.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as o}from"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-DEJIH3ZQ.js";import"./chunk-C3QOHMR6.js";import{useState as m,useEffect as l,useCallback as h}from"react";import{jsxs as p,Fragment as u,jsx as d}from"react/jsx-runtime";var k="world_clock_appearance",g=["London","Shanghai","New York"];function j(){const{prefs:j,save:x}=c(),[b,f]=m(()=>s(k)),[y,N]=m(!1),[v,D]=m([]),[w,F]=m(b),S={useFahrenheit:!!j.weather_prefs?.useFahrenheit},[C,G]=m(S),[U,H]=m(()=>/* @__PURE__ */new Date);l(()=>{const e=setInterval(()=>H(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const Z=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),I=j.world_clocks,J=(()=>{if(!Array.isArray(I)||0===I.length)return g;const t=[];for(const n of I){const r=e[n]?n:Z[n];r&&!t.includes(r)&&t.push(r)}return t.length?t:g})(),[L,O]=m({}),[T,A]=m(!0);l(()=>{let e=!1;return A(!0),(async()=>{const n={};await Promise.all(J.map(async e=>{const r=await t(e);r&&(n[e]=r)})),e||(O(n),A(!1))})(),()=>{e=!0}},[J.join(",")]),a(h(()=>{D([...J]),F({...b}),G({...S}),N(!0)},[J.join(","),b,S.useFahrenheit]));const M=e=>S.useFahrenheit?`${r(e)}°`:`${e}°`;/* @__PURE__ */
2
- return p(u,{children:[
3
- /* @__PURE__ */d("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${b.activeOpacity/100})`,backdropFilter:b.activeBlur>0?`blur(${b.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:"divide-y divide-gray-200",children:[T&&J.every(e=>!L[e])&&/* @__PURE__ */d(o,{size:"sm",padding:"py-6",label:"Loading"}),J.map(t=>{const r=L[t],s=e[t]?.tz??"UTC",{time:i,ampm:a}=function(e,t){try{const n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(t),r=n.find(e=>"hour"===e.type)?.value||"12";return{time:`${r}:${n.find(e=>"minute"===e.type)?.value||"00"}`,ampm:(n.find(e=>"dayPeriod"===e.type)?.value||"").toUpperCase()}}catch{return{time:"",ampm:""}}}(s,U);if(!r)/* @__PURE__ */
4
- return p("div",{className:"px-4 py-3",children:[
5
- /* @__PURE__ */p("div",{className:"flex items-baseline justify-between gap-2",children:[
6
- /* @__PURE__ */d("span",{className:"text-base font-semibold tracking-tight text-ink-strongest truncate",children:t}),
7
- /* @__PURE__ */p("span",{className:"tabular-nums text-sm font-medium text-ink-faint",children:[i,
8
- /* @__PURE__ */d("span",{className:"text-3xs ml-0.5 opacity-70",children:a})]})]}),
9
- /* @__PURE__ */d(o,{size:"sm",padding:"pt-1",label:"Loading weather"})]},t);const[c,m]=n(r.code,r.isDay);/* @__PURE__ */
10
- return p("div",{className:"px-4 py-3",children:[
11
- /* @__PURE__ */p("div",{className:"flex items-baseline justify-between gap-2",children:[
12
- /* @__PURE__ */d("span",{className:"text-base font-semibold tracking-tight text-ink-strongest truncate",children:t}),
13
- /* @__PURE__ */d("span",{className:"text-2xl font-extralight leading-none tabular-nums tracking-tight text-ink-strongest shrink-0",children:M(r.temp)})]}),
14
- /* @__PURE__ */p("div",{className:"flex items-center justify-between gap-2 mt-2 text-2xs",children:[
15
- /* @__PURE__ */p("div",{className:"flex items-center gap-2 min-w-0 text-ink-faint",children:[
16
- /* @__PURE__ */d("span",{className:"text-base leading-none shrink-0",children:m}),
17
- /* @__PURE__ */p("span",{className:"tabular-nums font-semibold text-gray-700 shrink-0",children:[i,
18
- /* @__PURE__ */d("span",{className:"text-3xs font-medium ml-0.5 opacity-70",children:a})]}),
19
- /* @__PURE__ */d("span",{className:"text-gray-300 shrink-0",children:"·"}),
20
- /* @__PURE__ */d("span",{className:"truncate",children:c})]}),
21
- /* @__PURE__ */p("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",M(r.high)," L:",M(r.low)]})]})]},t)})]})}),
22
- /* @__PURE__ */p(i,{open:y,onClose:()=>N(!1),title:"World Clock Settings",appearance:w,onAppearanceChange:F,onSave:()=>{0!==v.length&&(x({world_clocks:v,weather_prefs:{...j.weather_prefs??{},useFahrenheit:C.useFahrenheit}}),f(w),localStorage.setItem(k,JSON.stringify(w)),N(!1))},children:[
23
- /* @__PURE__ */p("div",{children:[
24
- /* @__PURE__ */d("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
25
- /* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
26
- /* @__PURE__ */d("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
27
- /* @__PURE__ */d("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */d("button",{onClick:()=>G(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(C.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
28
- /* @__PURE__ */d("p",{className:"text-2xs text-ink-faintest mt-1",children:"Shared with the Weather widget."})]}),
29
- /* @__PURE__ */p("div",{children:[
30
- /* @__PURE__ */d("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Cities"}),
31
- /* @__PURE__ */d("div",{className:"grid grid-cols-2 gap-1 max-h-56 overflow-y-auto",children:Object.keys(e).map(e=>/* @__PURE__ */p("label",{className:"flex items-center gap-2 text-sm py-1 cursor-pointer hover:bg-gray-50 rounded px-2",children:[
32
- /* @__PURE__ */d("input",{type:"checkbox",checked:v.includes(e),onChange:()=>D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500 h-3.5 w-3.5"}),e]},e))})]})]})]})}export{j as default};
@@ -1,2 +0,0 @@
1
- import{TimelineCard as e}from"./chunk-S4Z657L6.js";import{TimelineTrack as n,TimelineMilestoneIcon as s}from"./chunk-BRZ55H2G.js";import{toDayMs as i,fmtSliderDate as t}from"./chunk-GXVWI3U5.js";import{DAY_MS as a}from"./chunk-JRQMX4PK.js";import{useBrowserValueOnce as l}from"./chunk-D65T4H6J.js";import{useShellStrings as o,useShellLocale as r}from"./chunk-DEJIH3ZQ.js";import{jsx as h}from"react/jsx-runtime";function m({title:m,heading:d,subject:c,milestones:p,summary:u,endDate:g,phaseLabels:k,variant:v="card",edgeCaptions:f,highlightKeys:y=null,onHoverChange:b}){const j=l(Date.now,null),M=[],x=[],C=o().timeline,H=r();for(const e of p){const n=i(e.date??null);null===n?x.push({key:e.key,label:e.label,kind:e.kind}):M.push({...e,ms:n})}M.sort((e,n)=>e.ms-n.ms);const D=i(g??null);let w,J,K=!0;0===M.length?(J=D??j??0,w=J-30*a,K=null!==D||null!==j):(w=M[0].ms,J=D??M[M.length-1].ms,J-w<a&&(J=w+a));const L=M.length>0?Math.max(0,Math.round((J-w)/a)):0,N=u??(L>0?C.duration(L):void 0),O=[M.length>0?C.started(t(M[0].ms,H)):void 0,N,x.length>0?C.reached(M.length,p.length):void 0],Z=M.map(e=>{return{key:e.key,ms:e.ms,kind:e.kind,label:e.label,detail:e.detail,preview:e.preview,glyph:e.glyph,onClick:e.onClick,onOpen:e.onOpen,priority:(n=e.kind,"dfm"===n?1:0),caption:e.caption,provisional:e.provisional};var n}),G={};for(const e of M)e.phase&&(G[e.phase]=G[e.phase]||[]).push(e.ms);const I=Object.entries(G).filter(([,e])=>e.length>=2).map(([e,n])=>({key:e,label:k?.[e]??e,minMs:Math.min(...n),maxMs:Math.max(...n)})),Q="rail"===v,R=K&&/* @__PURE__ */h("div",{className:"select-none",children:/* @__PURE__ */h(n,{axis:Q?"spread":"compressed",labels:Q?"none":"lanes",items:Z,pending:x,phases:I,startMs:w,endMs:J,todayMs:j??void 0,edgeCaptions:f,highlightKeys:y,onHoverChange:b,ariaLabel:C.milestones(m)})});/* @__PURE__ */
2
- return h("div",Q?{className:"shrink-0","data-timeline-variant":"rail",children:R}:{className:"shrink-0",children:/* @__PURE__ */h(e,{icon:/* @__PURE__ */h(s,{}),heading:d??m,subject:c,meta:O,children:R})})}export{m as MilestoneTimeline};
@@ -1,2 +0,0 @@
1
- import{useShellPrefs as t}from"./chunk-KC3EX26K.js";import{toast_default as e}from"./chunk-TMSSR5UH.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function A(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(F(),R()):"none"!==t&&0!==m||F()}function I(){g.running||(w({running:!0}),p=setInterval(C,1e3),"focus"===g.mode&&R())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),F())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function C(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);F(),N(s,{volume:u,repeat:d});const t="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(t)}catch{}try{e.info(t)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>I(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>I(),50)}():w({remaining:g.remaining-1})}function N(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>P(t,n),2500*e)}function P(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,_={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function O(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function R(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=O(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*_[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function F(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function G(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=O(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*_[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var V="pomodoro_tasks",j="pomodoro_tasks_migrated";function E(){return Math.random().toString(36).slice(2,11)}function K(){/* @__PURE__ */
2
- return(new Date).toISOString()}var W=null,q=[],H=!1,J=null,L=/* @__PURE__ */new Set;function U(){for(const t of L)t()}function X(t){q=t,U()}function $(){const t=W;return t?J=t.list().then(e=>{W===t&&(q=e,H=!0,U())}).catch(()=>{W===t&&(H=!0,U())}).finally(()=>{J=null}):(q=[],H=!0,U(),Promise.resolve())}function z(t){W=t,q=[],H=!1,t?$():U()}function Q(t){return L.add(t),!W||H||J||$(),()=>{L.delete(t)}}function Y(){return q}function Z(){const e=function(){const{prefs:e,save:n}=t(),r=a(()=>{const t=e.todo_tasks;return Array.isArray(t)?t:[]},[e.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=E(),n=K(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:K()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(Q,Y,Y),i=o(t=>{const n=W;if(!n)return e.addTask(t);const o="tmp-"+E(),a=K(),r={done:!1,...t,name:t.name.trim(),id:o,createdAt:a,updatedAt:a};return X([...q,r]),n.create({...t,name:t.name.trim()}).then(t=>X(q.map(e=>e.id===o?{...r,...t}:e))).catch(()=>X(q.filter(t=>t.id!==o))),o},[e]),c=o((t,n)=>{const o=W;if(!o)return e.updateTask(t,n);X(q.map(e=>e.id===t?{...e,...n,id:t,updatedAt:K()}:e)),o.update(t,n).catch(()=>{$()})},[e]),l=o(t=>{const n=W;if(!n)return e.removeTask(t);const o=q;X(q.filter(e=>e.id!==t)),n.remove(t).catch(()=>X(o))},[e]),s=o(t=>{if(!W)return e.toggleDone(t);const n=q.find(e=>e.id===t);n&&c(t,{done:!n.done})},[e,c]),u=o(t=>{W||e.setAllTasks(t)},[e]);return null===W?e:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(j))return;const n=localStorage.getItem(V);if(!n)return void localStorage.setItem(j,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(V),void localStorage.setItem(j,"1");const a=K(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||E(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(V),localStorage.setItem(j,"1")}catch{try{localStorage.setItem(j,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,N as playAlarm,x as pomoPause,I as pomoStart,B as pomoSwitchMode,G as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,A as setPomoFocusSound,z as setShellTodoProvider,S as subscribePomo,Z as useTodoTasks};
@@ -1 +0,0 @@
1
- var r="13.6.1",a=r;export{a as APP_VERSION,r as VERSION};