efficient-shell 13.22.0 → 13.22.1

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 (42) hide show
  1. package/dist/{Browser-342OHRA2.js → Browser-ZNJ3OZSE.js} +14 -14
  2. package/dist/{Calculator-HJK5JN54.js → Calculator-BPQPQUZN.js} +23 -23
  3. package/dist/{CurrencyConverter-MPAZ6QJ3.js → CurrencyConverter-M4UJI6VQ.js} +6 -6
  4. package/dist/{Files-IPM7TRMJ.js → Files-4HACSJ7C.js} +33 -33
  5. package/dist/{Notepad-R7MUSPRC.js → Notepad-SK2E5VOK.js} +9 -9
  6. package/dist/PomodoroTimer-BR5NOA24.js +91 -0
  7. package/dist/{Preview-X64AVAUP.js → Preview-CLV2ZAU5.js} +4 -4
  8. package/dist/{Stock-GQSNYWV2.js → Stock-LZ2QHPU4.js} +3 -3
  9. package/dist/{Weather-XNMLNV7N.js → Weather-Q22ZW7ZQ.js} +18 -18
  10. package/dist/{WorldClock-AZLGM2T5.js → WorldClock-4MSSRLC7.js} +6 -6
  11. package/dist/ai/index.js +8 -8
  12. package/dist/apps/index.js +1 -1
  13. package/dist/bin/browser-check.js +1 -1
  14. package/dist/bin/media-host-check.js +1 -1
  15. package/dist/bin/ui-check.js +1 -1
  16. package/dist/{chunk-VB3UHY2J.js → chunk-3AMCLA5Q.js} +1 -1
  17. package/dist/{chunk-ODOWFVUE.js → chunk-3SIHJWR2.js} +6 -6
  18. package/dist/{chunk-P6H2B635.js → chunk-7N6CVTWO.js} +1 -1
  19. package/dist/{chunk-IM2PF6VQ.js → chunk-BUMY4LIP.js} +3 -3
  20. package/dist/{chunk-BT636U6W.js → chunk-DEE6FKE7.js} +1 -1
  21. package/dist/chunk-KUPN5WRE.js +1 -0
  22. package/dist/{chunk-JVENCUUG.js → chunk-LRMDLZMM.js} +4 -4
  23. package/dist/{chunk-TJG76Y7I.js → chunk-LUARJHUK.js} +8 -8
  24. package/dist/{chunk-5CHJA4RL.js → chunk-P3JPSO3E.js} +3 -3
  25. package/dist/{chunk-IM23VMBR.js → chunk-PHYHKDSW.js} +1 -1
  26. package/dist/{chunk-IMH5H47S.js → chunk-QJUMBOL2.js} +6 -6
  27. package/dist/{chunk-QNQNOTTS.js → chunk-SKVLTYGN.js} +1 -1
  28. package/dist/data/EntityList.js +1 -1
  29. package/dist/data/ResizableTable.js +1 -1
  30. package/dist/forms/BrandAssetEditor.js +1 -1
  31. package/dist/forms/MediaLibrary.js +1 -1
  32. package/dist/forms/MediaUploadField.js +1 -1
  33. package/dist/icons/index.js +1 -1
  34. package/dist/index.js +77 -77
  35. package/dist/shell/LanguageSelect.js +1 -1
  36. package/dist/shell/SettingRow.js +1 -1
  37. package/dist/telemetry/index.js +1 -1
  38. package/dist/ui/index.js +1 -1
  39. package/dist/version.js +1 -1
  40. package/package.json +1 -1
  41. package/dist/PomodoroTimer-VREYC3ML.js +0 -91
  42. package/dist/chunk-UUY66GLZ.js +0 -1
@@ -1,9 +1,9 @@
1
- import{openPreviewFile as e}from"./chunk-UMIRPFQJ.js";import{SidebarLayout as t}from"./chunk-W24THMLI.js";import"./chunk-QWK6DRSN.js";import"./chunk-JLSXDYS4.js";import{SearchableSelect as n}from"./chunk-OFMZ6JM6.js";import{Breadcrumbs as a}from"./chunk-WREUA43Q.js";import{Select_default as r}from"./chunk-D5PXRJHA.js";import"./chunk-EO5RLFRX.js";import"./chunk-K5YT5PMJ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-VKZC3NPM.js";import{Input_default as l}from"./chunk-J5OAQAAD.js";import{IconButton_default as o}from"./chunk-NWS5G7FE.js";import"./chunk-AYZY3YNC.js";import{formatBytes as c}from"./chunk-OJI4ROSD.js";import{dayKeyInZone as d,formatTime as m,formatDateTime as h,userToday as u,instantOnDayKey as f}from"./chunk-NHKT5IH6.js";import{EMPTY_VALUE as p}from"./chunk-36BRD5J3.js";import{fromDateKey as k,toDateKey as g}from"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as w,subscribeFilesChoice as y,getFilesChoice as b,holdFilesChoice as v,answerFilesChoice as x,choiceTakes as N}from"./chunk-CUNYWXUT.js";import{AboutApp as C}from"./chunk-IM2PF6VQ.js";import{getFilesStore as j,peekFilesViewRequest as S,consumeFilesViewRequest as D,FILES_SHOW_TRASH_EVENT as T,FILES_OPEN_DESKTOP_FOLDER_EVENT as M,subscribeDesktopFolders as $,getDesktopFoldersSnapshot as R,filesRoleWrites as L,hasHostFilesStore as A,FolderGlyph as F,DesktopItemMiniIcon as P,desktopItemTypeLabel as E,FilesQuotaError as I,FILES_OFFICE_EXTENSIONS as U,FILES_ROLE_LABELS as W}from"./chunk-KGRJSTPM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as z,WindowTitle as O}from"./chunk-BT636U6W.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as K,prompt as J}from"./chunk-XYQFTFI7.js";import{Dialog as Y}from"./chunk-MRZLFZNJ.js";import"./chunk-EIFNESXS.js";import{ItemCount as V}from"./chunk-LC2UF3AA.js";import"./chunk-CJQPC2P3.js";import"./chunk-UAXL44HH.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-AW7TOB6N.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-DPFEQQQU.js";import"./chunk-UUY66GLZ.js";import{DropdownMenu as B}from"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-YDJ5IZOU.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as Q}from"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as Z}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as H}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import{TH_ONE_LINE as G}from"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as X}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as q,useRef as _,useEffect as ee,useCallback as te,useSyncExternalStore as ne,useMemo as ae}from"react";import{jsxs as re,jsx as ie,Fragment as se}from"react/jsx-runtime";var le={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 oe(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function ce(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":le[oe(e.name)]??"other"}var de={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},me={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 he(e){const t=e.officeKind?U[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function ue(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":c(e.size)}function fe(e,t=/* @__PURE__ */new Date){const n=d(e),a=d(t.toISOString());return n&&a?n===a?m(e,{clock:{hour:"numeric",minute:"2-digit"}}):n.slice(0,4)===a.slice(0,4)?h(e,{clock:{day:"numeric",month:"short"}}):h(e,{clock:{day:"numeric",month:"short",year:"numeric"}}):p}function pe(e){return m(e,{clock:{dateStyle:"short",timeStyle:"short"}})}function ke(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var ge=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function we(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 ge.compare(ke(e),ke(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return ge.compare(he(e),he(n))}})(e,a)||ge.compare(e.name,a.name))}var ye=["folder","document","spreadsheet","slides","pdf","image","video"],be={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function ve(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=u(t),a=k(n);if(!n||!a)return Number.NEGATIVE_INFINITY;"week"===e&&a.setDate(a.getDate()-6),"month"===e&&a.setDate(a.getDate()-29),"year"===e&&a.setMonth(0,1);const r=f(g(a),{hour:0,minute:0});return r?Date.parse(r):Number.NEGATIVE_INFINITY}(t.modified,n):null;return e.filter(e=>{if(t.type&&ce(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 xe=[{value:"viewer",label:"Viewer"},{value:"commenter",label:"Commenter"},{value:"editor",label:"Editor"}];function Ne({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=q(null),[c,d]=q(""),[m,h]=q([]),[u,f]=q(!1),[p,k]=q(""),[g,w]=q("viewer"),[y,b]=q(!1),v=_(/* @__PURE__ */new Map),x=t?.id??null;if(ee(()=>{if(l(null),k(""),d(""),!x||!e.shares)return;let t=!0;return e.shares(x).then(e=>{t&&l(e)}).catch(e=>{t&&(X.error(e.message),l([]))}),()=>{t=!1}},[x,e]),ee(()=>{if(!e.searchPeople||!x)return;let t=!0;f(!0);const n=setTimeout(()=>{e.searchPeople(c).then(e=>{if(t){for(const t of e)v.current.set(t.id,t);h(e)}}).catch(()=>{t&&h([])}).finally(()=>{t&&f(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[c,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})),j=async n=>{b(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){X.error(e.message)}finally{b(!1)}};/* @__PURE__ */
1
+ import{openPreviewFile as e}from"./chunk-UMIRPFQJ.js";import{SidebarLayout as t}from"./chunk-W24THMLI.js";import"./chunk-QWK6DRSN.js";import"./chunk-JLSXDYS4.js";import{SearchableSelect as n}from"./chunk-OFMZ6JM6.js";import{Breadcrumbs as a}from"./chunk-WREUA43Q.js";import{Select_default as r}from"./chunk-D5PXRJHA.js";import"./chunk-EO5RLFRX.js";import"./chunk-K5YT5PMJ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-VKZC3NPM.js";import{Input_default as l}from"./chunk-J5OAQAAD.js";import{IconButton_default as o}from"./chunk-NWS5G7FE.js";import"./chunk-AYZY3YNC.js";import{formatBytes as c}from"./chunk-OJI4ROSD.js";import{dayKeyInZone as d,formatTime as m,formatDateTime as h,userToday as u,instantOnDayKey as f}from"./chunk-NHKT5IH6.js";import{EMPTY_VALUE as p}from"./chunk-36BRD5J3.js";import{fromDateKey as k,toDateKey as g}from"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as w,subscribeFilesChoice as y,getFilesChoice as b,holdFilesChoice as v,answerFilesChoice as x,choiceTakes as N}from"./chunk-CUNYWXUT.js";import{AboutApp as C}from"./chunk-BUMY4LIP.js";import{getFilesStore as j,peekFilesViewRequest as S,consumeFilesViewRequest as D,FILES_SHOW_TRASH_EVENT as T,FILES_OPEN_DESKTOP_FOLDER_EVENT as M,subscribeDesktopFolders as $,getDesktopFoldersSnapshot as R,filesRoleWrites as L,hasHostFilesStore as A,FolderGlyph as F,DesktopItemMiniIcon as P,desktopItemTypeLabel as E,FilesQuotaError as I,FILES_OFFICE_EXTENSIONS as W,FILES_ROLE_LABELS as z}from"./chunk-KGRJSTPM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as O,WindowTitle as U}from"./chunk-DEE6FKE7.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as K,prompt as J}from"./chunk-XYQFTFI7.js";import{Dialog as Y}from"./chunk-MRZLFZNJ.js";import"./chunk-EIFNESXS.js";import{ItemCount as V}from"./chunk-LC2UF3AA.js";import"./chunk-CJQPC2P3.js";import"./chunk-UAXL44HH.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-AW7TOB6N.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-DPFEQQQU.js";import"./chunk-KUPN5WRE.js";import{DropdownMenu as B}from"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-YDJ5IZOU.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as Q}from"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as Z}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as H}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import{TH_ONE_LINE as X}from"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as G}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as q,useRef as _,useEffect as ee,useCallback as te,useSyncExternalStore as ne,useMemo as ae}from"react";import{jsxs as re,jsx as ie,Fragment as se}from"react/jsx-runtime";var le={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 oe(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function ce(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":le[oe(e.name)]??"other"}var de={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},me={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 he(e){const t=e.officeKind?W[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function ue(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":c(e.size)}function fe(e,t=/* @__PURE__ */new Date){const n=d(e),a=d(t.toISOString());return n&&a?n===a?m(e,{clock:{hour:"numeric",minute:"2-digit"}}):n.slice(0,4)===a.slice(0,4)?h(e,{clock:{day:"numeric",month:"short"}}):h(e,{clock:{day:"numeric",month:"short",year:"numeric"}}):p}function pe(e){return m(e,{clock:{dateStyle:"short",timeStyle:"short"}})}function ke(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var ge=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function we(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 ge.compare(ke(e),ke(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return ge.compare(he(e),he(n))}})(e,a)||ge.compare(e.name,a.name))}var ye=["folder","document","spreadsheet","slides","pdf","image","video"],be={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function ve(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=u(t),a=k(n);if(!n||!a)return Number.NEGATIVE_INFINITY;"week"===e&&a.setDate(a.getDate()-6),"month"===e&&a.setDate(a.getDate()-29),"year"===e&&a.setMonth(0,1);const r=f(g(a),{hour:0,minute:0});return r?Date.parse(r):Number.NEGATIVE_INFINITY}(t.modified,n):null;return e.filter(e=>{if(t.type&&ce(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 xe=[{value:"viewer",label:"Viewer"},{value:"commenter",label:"Commenter"},{value:"editor",label:"Editor"}];function Ne({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=q(null),[c,d]=q(""),[m,h]=q([]),[u,f]=q(!1),[p,k]=q(""),[g,w]=q("viewer"),[y,b]=q(!1),v=_(/* @__PURE__ */new Map),x=t?.id??null;if(ee(()=>{if(l(null),k(""),d(""),!x||!e.shares)return;let t=!0;return e.shares(x).then(e=>{t&&l(e)}).catch(e=>{t&&(G.error(e.message),l([]))}),()=>{t=!1}},[x,e]),ee(()=>{if(!e.searchPeople||!x)return;let t=!0;f(!0);const n=setTimeout(()=>{e.searchPeople(c).then(e=>{if(t){for(const t of e)v.current.set(t.id,t);h(e)}}).catch(()=>{t&&h([])}).finally(()=>{t&&f(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[c,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})),j=async n=>{b(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){G.error(e.message)}finally{b(!1)}};/* @__PURE__ */
2
2
  return re(Y,{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__ */ie(Q,{variant:"secondary",onClick:a,children:"Done"}),children:[
3
3
  /* @__PURE__ */re("div",{className:"flex items-center gap-2",children:[
4
4
  /* @__PURE__ */ie("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */ie(n,{value:p,onChange:k,onSearchChange:d,loading:u&&0===m.length,options:C,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
5
5
  /* @__PURE__ */ie("div",{className:"w-28 shrink-0",children:/* @__PURE__ */ie(r,{value:g,onChange:e=>w(e),options:xe,"aria-label":"Access"})}),
6
- /* @__PURE__ */ie(Q,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=v.current.get(p);j(async()=>{await e.share(t.id,p,g),k(""),d(""),n&&X.success(`Shared with ${n.name}`)})},disabled:!p||y,children:"Add"})]}),
6
+ /* @__PURE__ */ie(Q,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=v.current.get(p);j(async()=>{await e.share(t.id,p,g),k(""),d(""),n&&G.success(`Shared with ${n.name}`)})},disabled:!p||y,children:"Add"})]}),
7
7
  /* @__PURE__ */ie("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */ie(H,{size:"sm",padding:"p-4",label:"Loading"}):/* @__PURE__ */re("ul",{className:"divide-y divide-line-subtle text-sm",children:[
8
8
  /* @__PURE__ */re("li",{className:"flex items-center gap-2 h-10",children:[
9
9
  /* @__PURE__ */ie("span",{className:"flex-1 truncate",children:"You"}),
@@ -30,11 +30,11 @@ return re("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col m
30
30
  /* @__PURE__ */ie("div",{className:"h-32 rounded-(--radius-control) bg-surface-sunken flex items-center justify-center mb-3",children:d&&/* @__PURE__ */ie(Z,{name:d.name,tone:d.tone,className:"h-12 w-12"})}),s&&/* @__PURE__ */re("div",{className:"mb-3",children:[
31
31
  /* @__PURE__ */ie("div",{className:"text-xs font-medium text-ink-strong mb-1",children:"Who has access"}),0===s.length?/* @__PURE__ */re("p",{className:"text-sm text-ink-faint",children:["Only ","owner"!==t.role&&t.role?t.owner?.name??"its owner":"you"]}):/* @__PURE__ */ie("ul",{className:"text-sm text-ink",children:s.map(e=>/* @__PURE__ */re("li",{className:"flex justify-between py-0.5",children:[
32
32
  /* @__PURE__ */ie("span",{className:"truncate",children:e.person.name}),
33
- /* @__PURE__ */ie("span",{className:"text-ink-faint text-xs",children:W[e.role]})]},e.person.id))})]}),
33
+ /* @__PURE__ */ie("span",{className:"text-ink-faint text-xs",children:z[e.role]})]},e.person.id))})]}),
34
34
  /* @__PURE__ */re("dl",{className:"border-t border-line pt-2",children:[h("Type",c?de[c]:null),"file"===t.kind&&h("Size",ue(t)),h("Location",m),h("Owner","me"===ke(t)?"me":ke(t)),h("Modified",t.modifiedAt?`${fe(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),h("Created",r?.createdAt?fe(r.createdAt):null)]})]}):/* @__PURE__ */ie("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 Se=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,De="files.layout",Te={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"},Me=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],$e="application/x-efficient-files";function Re(){try{return"grid"===localStorage.getItem(De)?"grid":"list"}catch{return"list"}}function Le(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=w()??[];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 Ae(e,t){return`Not enough space for “${e}” (${c(t.attempted)}). You've used ${c(t.used)} of ${c(t.limit)}. Empty Trash or ask an administrator for more space.`}var Fe=(e,t)=>e instanceof Error&&e.message||t;function Pe(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 Ee({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=me[ce(e)];/* @__PURE__ */
35
- return ie(Z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function Ie({entry:e,read:t}){const[n,a]=q(null),r="image"===ce(e)&&e.size<=5242880;return ee(()=>{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__ */ie("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */ie(Ee,{entry:e,className:"h-10 w-10"})}function Ue(){const n=j(),r=n.title??"Files",d=null!==w(),m=!d&&!!n.shares&&!!n.sharedWithMe,[h,u]=q(null),[f,p]=q(null),[k,g]=q([]),[W,Y]=q(()=>/* @__PURE__ */new Set),le=_(null),[ce,xe]=q(!0),[Ue,We]=q(!1),[ze,Oe]=q(null),[Ke,Je]=q(!1),[Ye,Ve]=q(null),[Be,Qe]=q(null),[Ze,He]=q(null),[Ge,Xe]=q(Re),[qe,_e]=q(!1),[et,tt]=q(""),[nt,at]=q(""),[rt,it]=q({}),[st,lt]=q({key:"name",dir:"asc"}),[ot,ct]=q(()=>{const e=S();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),dt=_("files"),mt=_(ot);mt.current=ot,ee(()=>{D()},[]);const[ht,ut]=q([]),ft=e=>{Xe(e);try{localStorage.setItem(De,e)}catch{}},pt=te(e=>{ct(e),it({}),lt("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(tt(""),at(""))},[]);ee(()=>{const e=()=>{D(),pt("trash")},t=e=>{D();const t=e.detail?.folderId;t&&pt({desktopFolderId:t})};return window.addEventListener(T,e),window.addEventListener(M,t),()=>{window.removeEventListener(T,e),window.removeEventListener(M,t)}},[pt]);const kt=ne($,R,R),gt="object"==typeof ot?ot.desktopFolderId:null,wt=gt?kt?.folders.find(e=>e.id===gt)??null:null,yt=gt&&kt?.itemsByFolder[gt]||[];ee(()=>{gt&&kt&&!kt.folders.some(e=>e.id===gt)&&pt("files")},[gt,kt,pt]);const bt=_(0),vt=_(null),xt=_(null),{openPage:Nt,openEntity:Ct}=z(),jt=i(),St=i(),Dt=i(),Tt=ne(y,b,b);ee(()=>v(),[]),ee(()=>{!Tt||"trash"!==ot&&"object"!=typeof ot||pt("files")},[Tt,ot,pt]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>Nt(e)}):"page"===t.entityType?Nt(t.entityId):Ct(t.entityType,t.entityId,null,t.label)},$t=te(async()=>{if(!d)try{Oe(await n.quota())}catch{}},[n,d]),Rt=te(async(e,t)=>{xe(!0);try{await e(),We(!1)}catch(e){e instanceof TypeError?We(!0):X.error(Fe(e,t))}finally{xe(!1)}},[]),Lt=te(async e=>{if(d)return p(Le(e)),We(!1),void xe(!1);await Rt(async()=>{p(await n.list(e))},"Failed to list"),$t()},[n,$t,d,Rt]),At=te(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=d?Le(h):await n.list(h).catch(()=>null);return g((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void xe(!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 Rt(async()=>{g(await a())},"Failed to list files")},[n,d,h,Rt]),Ft=te(async()=>{if(d)return ut([]),void xe(!1);await Rt(async()=>{ut(await n.trash())},"Failed to list trash"),$t()},[n,$t,d,Rt]),Pt=()=>{"files"===ot?Lt(h):Se(ot)?At(ot,nt):"trash"===ot&&Ft()};ee(()=>{Y(/* @__PURE__ */new Set),le.current=null,Pt()},[h,ot,nt]),ee(()=>{const e=et.trim();if(!e)return;const t=setTimeout(()=>{e===nt&&"search"===mt.current||("search"!==mt.current&&(dt.current=mt.current),ct("search"),it({}),at(e))},300);return()=>clearTimeout(t)},[et]);const Et=()=>{tt(""),"search"===mt.current&&pt(dt.current)},It=e=>{pt("files"),u(e)},Ut=async(e,t)=>{try{await e()}catch(e){X.error(Fe(e,t))}Pt()},Wt=e=>Ut(async()=>{await n.restore(e.id),X.success(`Restored "${e.name}"`)},"Restore failed"),zt=async e=>{await K({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Ut(()=>n.purge(e.id),"Delete failed")},Ot=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){X.error(Fe(e,"Download failed"))}},Kt="files"===ot?f?.folder??null:null,Jt=Kt?.role??"owner",Yt="owner"!==Jt,Vt="files"===ot?h:null,Bt=!d&&("files"!==ot||L(Jt)),Qt=!d&&"files"===ot&&L(Jt),Zt=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(Vt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof I?X.error(Ae(r.name,e)):X.error(`Upload ${r.name}: ${Fe(e,"failed")}`)}}a>1&&X.success(`Uploaded ${a} files`),"files"===ot?Lt(h):It(null)},Ht=async e=>{const t=he(e),a=await J({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?X.error("Names cannot contain slashes"):Ut(()=>n.rename(e.id,function(e,t){const n=e.officeKind?U[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Gt=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??f?.folder.owner)?.name??"its owner":"their owners";await K({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${he(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 Ut(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),X.success(t?`"${he(t)}" moved to trash`:`${e.length} items moved to trash`))},Xt=(e,t)=>Ut(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),qt=async(e,t)=>{He(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Ut(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),X.success(1===a.length?`Moved "${he(a[0])}"`:`Moved ${a.length} items`))},_t=()=>{bt.current=0,Je(!1),Ve(null)};ee(()=>{const e=()=>_t();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const en="files"===ot?f?.entries??[]:Se(ot)?k:[],tn=ae(()=>we(ve(en,rt),st),[en,rt,st]),nn=ae(()=>new Map(tn.map(e=>[e.id,e])),[tn]),an=[...W].map(e=>nn.get(e)).filter(e=>!!e),rn=1===an.length?an[0]:null,sn=e=>e.role??("files"===ot?Jt:"owner"),ln=e=>!d&&L(sn(e)),on=e=>m&&"owner"===sn(e),cn=e=>!!n.move&&ln(e),dn=(e,t)=>{if(Tt){const t=nn.get(e);if(t&&"file"===t.kind&&!hn(t))return;return void Y(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&le.current){const t=tn.map(e=>e.id),n=t.indexOf(le.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Y(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}le.current=e,t.metaKey||t.ctrlKey?Y(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Y(/* @__PURE__ */new Set([e]))},mn=()=>{Y(/* @__PURE__ */new Set),le.current=null},hn=e=>!!Tt&&"file"===e.kind&&N(Tt.request,e.name),un=e=>Tt&&"file"===e.kind&&!hn(e)?"text-ink-faintest":"",fn=e=>{if(!Tt||!hn(e))return;const t="files"===ot?f?.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"===ot?"Shared with me":"My files";x(Tt.id,{entry:e,folderId:"files"===ot?h:null,location:n})},pn=Tt&&rn&&hn(rn)?rn:null,kn=t=>{"folder"===t.kind?It(t.id):Tt?fn(t):(async t=>{if(d)return;if(n.open?.(t))return;const a=Te[oe(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>Nt(e)}):Ot(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Tt)return t&&("folder"===t.kind||hn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(ln);if(d)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const s=e.some(e=>!e.starred);return Pe([...t?[{key:"open",label:a,icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */ie(Z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Ot)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */ie(Z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Ht(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */ie(Z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Ut(async()=>{for(const t of e)await n.copy(t.id);X.success(1===e.length?`Copied "${he(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&on(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */ie(Z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Qe(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */ie(Z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>He(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */ie(Z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Xt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */ie(Z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Y(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */ie(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Gt(e)}]:[]])},wn=(e,t)=>{const n=W.has(t.id)?an:[t];jt.open(e,n)&&!W.has(t.id)&&(Y(/* @__PURE__ */new Set([t.id])),le.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=W.has(e.id)?an:[e];t.dataTransfer.setData($e,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},bn=e=>"folder"===e.kind&&ln(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes($e)&&(t.preventDefault(),t.stopPropagation(),Ye!==e.id&&Ve(e.id))},onDragLeave:()=>{Ye===e.id&&Ve(null)},onDrop:t=>{if(!t.dataTransfer.types.includes($e))return;t.preventDefault(),t.stopPropagation(),Ve(null);const n=JSON.parse(t.dataTransfer.getData($e)||"[]").map(e=>nn.get(e)).filter(t=>!!t&&t.id!==e.id);qt(n,e.id)}}:{};if(Ue)/* @__PURE__ */
35
+ return ie(Z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function Ie({entry:e,read:t}){const[n,a]=q(null),r="image"===ce(e)&&e.size<=5242880;return ee(()=>{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__ */ie("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */ie(Ee,{entry:e,className:"h-10 w-10"})}function We(){const n=j(),r=n.title??"Files",d=null!==w(),m=!d&&!!n.shares&&!!n.sharedWithMe,[h,u]=q(null),[f,p]=q(null),[k,g]=q([]),[z,Y]=q(()=>/* @__PURE__ */new Set),le=_(null),[ce,xe]=q(!0),[We,ze]=q(!1),[Oe,Ue]=q(null),[Ke,Je]=q(!1),[Ye,Ve]=q(null),[Be,Qe]=q(null),[Ze,He]=q(null),[Xe,Ge]=q(Re),[qe,_e]=q(!1),[et,tt]=q(""),[nt,at]=q(""),[rt,it]=q({}),[st,lt]=q({key:"name",dir:"asc"}),[ot,ct]=q(()=>{const e=S();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),dt=_("files"),mt=_(ot);mt.current=ot,ee(()=>{D()},[]);const[ht,ut]=q([]),ft=e=>{Ge(e);try{localStorage.setItem(De,e)}catch{}},pt=te(e=>{ct(e),it({}),lt("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(tt(""),at(""))},[]);ee(()=>{const e=()=>{D(),pt("trash")},t=e=>{D();const t=e.detail?.folderId;t&&pt({desktopFolderId:t})};return window.addEventListener(T,e),window.addEventListener(M,t),()=>{window.removeEventListener(T,e),window.removeEventListener(M,t)}},[pt]);const kt=ne($,R,R),gt="object"==typeof ot?ot.desktopFolderId:null,wt=gt?kt?.folders.find(e=>e.id===gt)??null:null,yt=gt&&kt?.itemsByFolder[gt]||[];ee(()=>{gt&&kt&&!kt.folders.some(e=>e.id===gt)&&pt("files")},[gt,kt,pt]);const bt=_(0),vt=_(null),xt=_(null),{openPage:Nt,openEntity:Ct}=O(),jt=i(),St=i(),Dt=i(),Tt=ne(y,b,b);ee(()=>v(),[]),ee(()=>{!Tt||"trash"!==ot&&"object"!=typeof ot||pt("files")},[Tt,ot,pt]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>Nt(e)}):"page"===t.entityType?Nt(t.entityId):Ct(t.entityType,t.entityId,null,t.label)},$t=te(async()=>{if(!d)try{Ue(await n.quota())}catch{}},[n,d]),Rt=te(async(e,t)=>{xe(!0);try{await e(),ze(!1)}catch(e){e instanceof TypeError?ze(!0):G.error(Fe(e,t))}finally{xe(!1)}},[]),Lt=te(async e=>{if(d)return p(Le(e)),ze(!1),void xe(!1);await Rt(async()=>{p(await n.list(e))},"Failed to list"),$t()},[n,$t,d,Rt]),At=te(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=d?Le(h):await n.list(h).catch(()=>null);return g((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void xe(!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 Rt(async()=>{g(await a())},"Failed to list files")},[n,d,h,Rt]),Ft=te(async()=>{if(d)return ut([]),void xe(!1);await Rt(async()=>{ut(await n.trash())},"Failed to list trash"),$t()},[n,$t,d,Rt]),Pt=()=>{"files"===ot?Lt(h):Se(ot)?At(ot,nt):"trash"===ot&&Ft()};ee(()=>{Y(/* @__PURE__ */new Set),le.current=null,Pt()},[h,ot,nt]),ee(()=>{const e=et.trim();if(!e)return;const t=setTimeout(()=>{e===nt&&"search"===mt.current||("search"!==mt.current&&(dt.current=mt.current),ct("search"),it({}),at(e))},300);return()=>clearTimeout(t)},[et]);const Et=()=>{tt(""),"search"===mt.current&&pt(dt.current)},It=e=>{pt("files"),u(e)},Wt=async(e,t)=>{try{await e()}catch(e){G.error(Fe(e,t))}Pt()},zt=e=>Wt(async()=>{await n.restore(e.id),G.success(`Restored "${e.name}"`)},"Restore failed"),Ot=async e=>{await K({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Wt(()=>n.purge(e.id),"Delete failed")},Ut=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){G.error(Fe(e,"Download failed"))}},Kt="files"===ot?f?.folder??null:null,Jt=Kt?.role??"owner",Yt="owner"!==Jt,Vt="files"===ot?h:null,Bt=!d&&("files"!==ot||L(Jt)),Qt=!d&&"files"===ot&&L(Jt),Zt=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(Vt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof I?G.error(Ae(r.name,e)):G.error(`Upload ${r.name}: ${Fe(e,"failed")}`)}}a>1&&G.success(`Uploaded ${a} files`),"files"===ot?Lt(h):It(null)},Ht=async e=>{const t=he(e),a=await J({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?G.error("Names cannot contain slashes"):Wt(()=>n.rename(e.id,function(e,t){const n=e.officeKind?W[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Xt=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??f?.folder.owner)?.name??"its owner":"their owners";await K({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${he(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 Wt(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),G.success(t?`"${he(t)}" moved to trash`:`${e.length} items moved to trash`))},Gt=(e,t)=>Wt(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),qt=async(e,t)=>{He(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Wt(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),G.success(1===a.length?`Moved "${he(a[0])}"`:`Moved ${a.length} items`))},_t=()=>{bt.current=0,Je(!1),Ve(null)};ee(()=>{const e=()=>_t();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const en="files"===ot?f?.entries??[]:Se(ot)?k:[],tn=ae(()=>we(ve(en,rt),st),[en,rt,st]),nn=ae(()=>new Map(tn.map(e=>[e.id,e])),[tn]),an=[...z].map(e=>nn.get(e)).filter(e=>!!e),rn=1===an.length?an[0]:null,sn=e=>e.role??("files"===ot?Jt:"owner"),ln=e=>!d&&L(sn(e)),on=e=>m&&"owner"===sn(e),cn=e=>!!n.move&&ln(e),dn=(e,t)=>{if(Tt){const t=nn.get(e);if(t&&"file"===t.kind&&!hn(t))return;return void Y(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&le.current){const t=tn.map(e=>e.id),n=t.indexOf(le.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Y(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}le.current=e,t.metaKey||t.ctrlKey?Y(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Y(/* @__PURE__ */new Set([e]))},mn=()=>{Y(/* @__PURE__ */new Set),le.current=null},hn=e=>!!Tt&&"file"===e.kind&&N(Tt.request,e.name),un=e=>Tt&&"file"===e.kind&&!hn(e)?"text-ink-faintest":"",fn=e=>{if(!Tt||!hn(e))return;const t="files"===ot?f?.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"===ot?"Shared with me":"My files";x(Tt.id,{entry:e,folderId:"files"===ot?h:null,location:n})},pn=Tt&&rn&&hn(rn)?rn:null,kn=t=>{"folder"===t.kind?It(t.id):Tt?fn(t):(async t=>{if(d)return;if(n.open?.(t))return;const a=Te[oe(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>Nt(e)}):Ut(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Tt)return t&&("folder"===t.kind||hn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(ln);if(d)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const s=e.some(e=>!e.starred);return Pe([...t?[{key:"open",label:a,icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */ie(Z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Ut)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */ie(Z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Ht(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */ie(Z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Wt(async()=>{for(const t of e)await n.copy(t.id);G.success(1===e.length?`Copied "${he(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&on(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */ie(Z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Qe(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */ie(Z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>He(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */ie(Z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Gt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */ie(Z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Y(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */ie(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Xt(e)}]:[]])},wn=(e,t)=>{const n=z.has(t.id)?an:[t];jt.open(e,n)&&!z.has(t.id)&&(Y(/* @__PURE__ */new Set([t.id])),le.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=z.has(e.id)?an:[e];t.dataTransfer.setData($e,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},bn=e=>"folder"===e.kind&&ln(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes($e)&&(t.preventDefault(),t.stopPropagation(),Ye!==e.id&&Ve(e.id))},onDragLeave:()=>{Ye===e.id&&Ve(null)},onDrop:t=>{if(!t.dataTransfer.types.includes($e))return;t.preventDefault(),t.stopPropagation(),Ve(null);const n=JSON.parse(t.dataTransfer.getData($e)||"[]").map(e=>nn.get(e)).filter(t=>!!t&&t.id!==e.id);qt(n,e.id)}}:{};if(We)/* @__PURE__ */
36
36
  return re("div",{className:"flex flex-col h-full bg-surface",children:[
37
- /* @__PURE__ */ie(O,{title:`${r} - offline`}),
37
+ /* @__PURE__ */ie(U,{title:`${r} - offline`}),
38
38
  /* @__PURE__ */ie("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */re("div",{className:"max-w-md",children:[
39
39
  /* @__PURE__ */ie(Z,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),A()?/* @__PURE__ */re(se,{children:[
40
40
  /* @__PURE__ */ie("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach your files"}),
@@ -42,7 +42,7 @@ return re("div",{className:"flex flex-col h-full bg-surface",children:[
42
42
  /* @__PURE__ */ie("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
43
43
  /* @__PURE__ */re("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
44
44
  /* @__PURE__ */ie("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
45
- /* @__PURE__ */ie(Q,{variant:"primary",onClick:Pt,children:"Retry"})]})})]});const vn=ze&&ze.limit>0?Math.min(100,Math.round(ze.used/ze.limit*100)):0,xn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",Nn=[Yt?{label:"Shared with me",onClick:()=>pt("shared")}:{label:"My files",onClick:()=>It(null)},...(Kt?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>It(e.id)}))],Cn="recent"===ot?"Recent":"starred"===ot?"Starred":"shared"===ot?"Shared with me":"search"===ot?`Results for “${nt}”`:"trash"===ot?"Trash":wt?wt.name:null,jn=Tt?`${r} - Choosing`:Cn?`${r} - ${"search"===ot?"Search":Cn}`:Kt&&null!==Kt.id?`${r} - ${Kt.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"),Dn=Pe([{key:"folder",label:"New folder",icon:/* @__PURE__ */ie(Z,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await J({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?X.error("Folder names cannot contain slashes"):(await Ut(()=>n.createFolder(Vt,e),"Create folder failed"),"files"!==ot&&It(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */ie(Z,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */ie(Z,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>xt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?Me.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=me["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */ie(Z,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Vt)).catch(e=>X.error(Fe(e,"Could not create it")))}}}):[]]),Tn=/* @__PURE__ */re("div",{className:"flex h-full flex-col",children:[
45
+ /* @__PURE__ */ie(Q,{variant:"primary",onClick:Pt,children:"Retry"})]})})]});const vn=Oe&&Oe.limit>0?Math.min(100,Math.round(Oe.used/Oe.limit*100)):0,xn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",Nn=[Yt?{label:"Shared with me",onClick:()=>pt("shared")}:{label:"My files",onClick:()=>It(null)},...(Kt?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>It(e.id)}))],Cn="recent"===ot?"Recent":"starred"===ot?"Starred":"shared"===ot?"Shared with me":"search"===ot?`Results for “${nt}”`:"trash"===ot?"Trash":wt?wt.name:null,jn=Tt?`${r} - Choosing`:Cn?`${r} - ${"search"===ot?"Search":Cn}`:Kt&&null!==Kt.id?`${r} - ${Kt.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"),Dn=Pe([{key:"folder",label:"New folder",icon:/* @__PURE__ */ie(Z,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await J({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?G.error("Folder names cannot contain slashes"):(await Wt(()=>n.createFolder(Vt,e),"Create folder failed"),"files"!==ot&&It(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */ie(Z,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */ie(Z,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>xt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?Me.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=me["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */ie(Z,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Vt)).catch(e=>G.error(Fe(e,"Could not create it")))}}}):[]]),Tn=/* @__PURE__ */re("div",{className:"flex h-full flex-col",children:[
46
46
  /* @__PURE__ */ie("div",{className:"p-3 pb-2",children:/* @__PURE__ */ie(B,{trigger:/* @__PURE__ */re(se,{children:[
47
47
  /* @__PURE__ */ie(Z,{name:"add",className:"h-5 w-5"}),
48
48
  /* @__PURE__ */ie("span",{children:"New"})]}),items:Dn,align:"start","aria-label":"New",disabled:!Bt,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"})}),
@@ -56,27 +56,27 @@ return re("div",{className:"flex flex-col h-full bg-surface",children:[
56
56
  /* @__PURE__ */ie("div",{className:"px-3 pt-4 pb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),kt.folders.map(e=>/* @__PURE__ */re("button",{onClick:()=>pt({desktopFolderId:e.id}),className:Sn(gt===e.id),children:[
57
57
  /* @__PURE__ */ie(F,{className:"h-4 w-4 shrink-0 text-amber-500"}),
58
58
  /* @__PURE__ */ie("span",{className:"truncate",children:e.name}),
59
- /* @__PURE__ */ie(V,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),ze&&/* @__PURE__ */re("div",{className:"px-5 py-3 shrink-0",title:`${c(ze.used)} of ${c(ze.limit)} used`,children:[
59
+ /* @__PURE__ */ie(V,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),Oe&&/* @__PURE__ */re("div",{className:"px-5 py-3 shrink-0",title:`${c(Oe.used)} of ${c(Oe.limit)} used`,children:[
60
60
  /* @__PURE__ */ie("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */ie("div",{className:`h-full ${xn} transition-all`,style:{width:`${vn}%`}})}),
61
- /* @__PURE__ */re("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[c(ze.used)," of ",c(ze.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */re("span",{className:"inline-flex items-center gap-1",children:[e,
61
+ /* @__PURE__ */re("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[c(Oe.used)," of ",c(Oe.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */re("span",{className:"inline-flex items-center gap-1",children:[e,
62
62
  /* @__PURE__ */ie(Z,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),$n=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"),Rn=Se(ot)||"files"===ot,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)=>ge.compare(e.name,t.name))}(en),An=Rn&&en.length>0?/* @__PURE__ */re("div",{className:"flex items-center gap-2 shrink-0",children:[
63
63
  /* @__PURE__ */ie(B,{trigger:Mn(rt.type?de[rt.type]:"Type",!!rt.type),"aria-label":"Type",triggerClassName:$n(!!rt.type),items:[...ye.map(e=>({type:"radio",key:e,label:de[e],checked:rt.type===e,onSelect:()=>it(t=>({...t,type:t.type===e?null:e}))})),...rt.type?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,type:null}))}]:[]]}),m&&/* @__PURE__ */ie(B,{trigger:Mn(rt.person?"me"===rt.person?"Owned by me":Ln.find(e=>e.id===rt.person)?.name??"People":"People",!!rt.person),"aria-label":"People",triggerClassName:$n(!!rt.person),items:[{type:"radio",key:"me",label:"Owned by me",checked:"me"===rt.person,onSelect:()=>it(e=>({...e,person:"me"===e.person?null:"me"}))},...Ln.map(e=>({type:"radio",key:e.id,label:e.name,checked:rt.person===e.id,onSelect:()=>it(t=>({...t,person:t.person===e.id?null:e.id}))})),...rt.person?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,person:null}))}]:[]]}),
64
64
  /* @__PURE__ */ie(B,{trigger:Mn(rt.modified?be[rt.modified]:"Modified",!!rt.modified),"aria-label":"Modified",triggerClassName:$n(!!rt.modified),items:[...Object.keys(be).map(e=>({type:"radio",key:e,label:be[e],checked:rt.modified===e,onSelect:()=>it(t=>({...t,modified:t.modified===e?null:e}))})),...rt.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,modified:null}))}]:[]]})]}):null,Fn=Rn&&an.length>0&&!Tt?/* @__PURE__ */re("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
65
65
  /* @__PURE__ */ie(o,{"aria-label":"Clear selection",size:"sm",onClick:mn,children:/* @__PURE__ */ie(Z,{name:"close",className:"h-4 w-4"})}),
66
- /* @__PURE__ */re("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[an.length," selected"]}),rn&&on(rn)&&/* @__PURE__ */ie(o,{"aria-label":"Share",size:"sm",onClick:()=>Qe(rn),children:/* @__PURE__ */ie(Z,{name:"add-person",className:"h-4 w-4"})}),!d&&an.every(e=>"file"===e.kind)&&/* @__PURE__ */ie(o,{"aria-label":"Download",size:"sm",onClick:()=>an.forEach(Ot),children:/* @__PURE__ */ie(Z,{name:"download",className:"h-4 w-4"})}),an.every(cn)&&/* @__PURE__ */ie(o,{"aria-label":"Move",size:"sm",onClick:()=>He(an),children:/* @__PURE__ */ie(Z,{name:"forward",className:"h-4 w-4"})}),!d&&an.every(ln)&&/* @__PURE__ */ie(o,{"aria-label":"Move to trash",size:"sm",onClick:()=>Gt(an),children:/* @__PURE__ */ie(Z,{name:"trash",className:"h-4 w-4"})}),
66
+ /* @__PURE__ */re("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[an.length," selected"]}),rn&&on(rn)&&/* @__PURE__ */ie(o,{"aria-label":"Share",size:"sm",onClick:()=>Qe(rn),children:/* @__PURE__ */ie(Z,{name:"add-person",className:"h-4 w-4"})}),!d&&an.every(e=>"file"===e.kind)&&/* @__PURE__ */ie(o,{"aria-label":"Download",size:"sm",onClick:()=>an.forEach(Ut),children:/* @__PURE__ */ie(Z,{name:"download",className:"h-4 w-4"})}),an.every(cn)&&/* @__PURE__ */ie(o,{"aria-label":"Move",size:"sm",onClick:()=>He(an),children:/* @__PURE__ */ie(Z,{name:"forward",className:"h-4 w-4"})}),!d&&an.every(ln)&&/* @__PURE__ */ie(o,{"aria-label":"Move to trash",size:"sm",onClick:()=>Xt(an),children:/* @__PURE__ */ie(Z,{name:"trash",className:"h-4 w-4"})}),
67
67
  /* @__PURE__ */ie(B,{trigger:/* @__PURE__ */ie(Z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(an)})]}):null,Pn=/* @__PURE__ */ie("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:Fn??/* @__PURE__ */re(se,{children:[
68
68
  /* @__PURE__ */re("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===ot?/* @__PURE__ */ie("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */ie(a,{items:Nn,maxItems:5})}):"trash"===ot?/* @__PURE__ */ie("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof ot?/* @__PURE__ */re(se,{children:[
69
69
  /* @__PURE__ */ie(F,{className:"h-4 w-4 text-amber-500 shrink-0"}),
70
70
  /* @__PURE__ */ie("span",{className:"text-base font-medium text-ink-strong truncate",children:wt?.name??"Desktop folder"}),
71
71
  /* @__PURE__ */ie("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */ie("span",{className:"text-base font-medium text-ink-strong truncate",children:Cn}),"files"===ot&&Yt&&!L(Jt)&&/* @__PURE__ */re("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__ */ie(Z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Yt&&Kt?.owner&&/* @__PURE__ */re("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Kt.owner.name]})]}),An,"trash"===ot&&/* @__PURE__ */ie(Q,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===ht.length)return;await K({title:"Empty trash",message:`${ht.length} item${1===ht.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&Ut(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===ht.length,children:"Empty trash"})]})}),En=(e,t)=>Tt?null:/* @__PURE__ */re("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[on(e)&&/* @__PURE__ */ie(o,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Qe(e)},children:/* @__PURE__ */ie(Z,{name:"add-person",className:"h-4 w-4"})}),!d&&"file"===e.kind&&/* @__PURE__ */ie(o,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Ot(e)},children:/* @__PURE__ */ie(Z,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!d&&/* @__PURE__ */ie(o,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Xt([e],!e.starred)},children:/* @__PURE__ */ie(Z,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
73
- /* @__PURE__ */ie("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ie(B,{trigger:/* @__PURE__ */ie(Z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(W.has(e.id)&&an.length>1?an:[e])})})]}),In=e=>/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
72
+ /* @__PURE__ */ie(Z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Yt&&Kt?.owner&&/* @__PURE__ */re("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Kt.owner.name]})]}),An,"trash"===ot&&/* @__PURE__ */ie(Q,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===ht.length)return;await K({title:"Empty trash",message:`${ht.length} item${1===ht.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&Wt(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===ht.length,children:"Empty trash"})]})}),En=(e,t)=>Tt?null:/* @__PURE__ */re("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[on(e)&&/* @__PURE__ */ie(o,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Qe(e)},children:/* @__PURE__ */ie(Z,{name:"add-person",className:"h-4 w-4"})}),!d&&"file"===e.kind&&/* @__PURE__ */ie(o,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Ut(e)},children:/* @__PURE__ */ie(Z,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!d&&/* @__PURE__ */ie(o,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Gt([e],!e.starred)},children:/* @__PURE__ */ie(Z,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
73
+ /* @__PURE__ */ie("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ie(B,{trigger:/* @__PURE__ */ie(Z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(z.has(e.id)&&an.length>1?an:[e])})})]}),In=e=>/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
74
74
  /* @__PURE__ */ie(Ee,{entry:e}),
75
- /* @__PURE__ */ie("span",{className:"truncate",title:e.name,children:he(e)}),!!e.shareCount&&/* @__PURE__ */ie("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__ */ie(Z,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */ie("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */ie(Z,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),Un=(e,t,n)=>{const a=st.key===e;/* @__PURE__ */
76
- return ie("th",{className:`${G} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===st.dir?"ascending":"descending":void 0,children:/* @__PURE__ */re("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>lt(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===st.dir?/* @__PURE__ */ie(Z,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */ie(Z,{name:"arrow-down",className:"h-3 w-3"}))]})})},Wn="recent"===ot?"Files you and your colleagues change show here.":"starred"===ot?"Star the files and folders you want to find quickly.":"shared"===ot?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===ot?`Nothing matches “${nt}”.`:null,zn=0===tn.length?ce?/* @__PURE__ */ie(H,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */ie("div",{className:"p-10 text-center text-sm text-ink-faintest",children:en.length>0?"Nothing matches these filters.":Wn??/* @__PURE__ */re(se,{children:["This folder is empty.",Qt&&/* @__PURE__ */re(se,{children:[" Drop files here or choose ",
77
- /* @__PURE__ */ie("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===Ge?/* @__PURE__ */ie("div",{className:"px-4 pb-4",children:["folder","file"].map(e=>{const t=tn.filter(t=>t.kind===e);return 0===t.length?null:/* @__PURE__ */re("section",{className:"mb-4",children:[
75
+ /* @__PURE__ */ie("span",{className:"truncate",title:e.name,children:he(e)}),!!e.shareCount&&/* @__PURE__ */ie("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__ */ie(Z,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */ie("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */ie(Z,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),Wn=(e,t,n)=>{const a=st.key===e;/* @__PURE__ */
76
+ return ie("th",{className:`${X} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===st.dir?"ascending":"descending":void 0,children:/* @__PURE__ */re("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>lt(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===st.dir?/* @__PURE__ */ie(Z,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */ie(Z,{name:"arrow-down",className:"h-3 w-3"}))]})})},zn="recent"===ot?"Files you and your colleagues change show here.":"starred"===ot?"Star the files and folders you want to find quickly.":"shared"===ot?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===ot?`Nothing matches “${nt}”.`:null,On=0===tn.length?ce?/* @__PURE__ */ie(H,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */ie("div",{className:"p-10 text-center text-sm text-ink-faintest",children:en.length>0?"Nothing matches these filters.":zn??/* @__PURE__ */re(se,{children:["This folder is empty.",Qt&&/* @__PURE__ */re(se,{children:[" Drop files here or choose ",
77
+ /* @__PURE__ */ie("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===Xe?/* @__PURE__ */ie("div",{className:"px-4 pb-4",children:["folder","file"].map(e=>{const t=tn.filter(t=>t.kind===e);return 0===t.length?null:/* @__PURE__ */re("section",{className:"mb-4",children:[
78
78
  /* @__PURE__ */ie("h3",{className:"text-xs font-medium text-ink-faint mb-2",children:"folder"===e?"Folders":"Files"}),
79
- /* @__PURE__ */ie("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=W.has(t.id);/* @__PURE__ */
79
+ /* @__PURE__ */ie("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=z.has(t.id);/* @__PURE__ */
80
80
  return re("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":he(t),onClick:e=>dn(t.id,e),onDoubleClick:()=>kn(t),onContextMenu:e=>wn(e,t),...yn(t),...bn(t),className:"group rounded-xl border cursor-default select-none outline-none focus-visible:ring-2 focus-visible:ring-accent-border "+(a||Ye===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
81
81
  /* @__PURE__ */re("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
82
82
  /* @__PURE__ */ie(Ee,{entry:t,className:"h-4 w-4"}),
@@ -84,20 +84,20 @@ return re("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":he(t),on
84
84
  /* @__PURE__ */ie("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ie(B,{trigger:/* @__PURE__ */ie(Z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(a&&an.length>1?an:[t])})})]}),"file"===e&&/* @__PURE__ */re(se,{children:[
85
85
  /* @__PURE__ */ie("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */ie(Ie,{entry:t,read:d?void 0:n.read})}),
86
86
  /* @__PURE__ */re("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===ke(t)?"You":ke(t)," · ",fe(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */re("table",{className:"w-full text-sm table-fixed",children:[
87
- /* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[Un("name","Name","text-left"),m&&Un("owner","Owner","text-left w-32"),Un("modified","Modified","text-left w-28"),Un("size","Size","text-right w-20"),
88
- /* @__PURE__ */ie("th",{className:`${G} w-32`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
89
- /* @__PURE__ */ie("tbody",{children:tn.map(e=>{const t=W.has(e.id);/* @__PURE__ */
87
+ /* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[Wn("name","Name","text-left"),m&&Wn("owner","Owner","text-left w-32"),Wn("modified","Modified","text-left w-28"),Wn("size","Size","text-right w-20"),
88
+ /* @__PURE__ */ie("th",{className:`${X} w-32`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
89
+ /* @__PURE__ */ie("tbody",{children:tn.map(e=>{const t=z.has(e.id);/* @__PURE__ */
90
90
  return re("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),onContextMenu:t=>wn(t,e),...yn(e),...bn(e),className:`group cursor-default select-none border-b border-line-subtle ${un(e)} ${t||Ye===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
91
91
  /* @__PURE__ */ie("td",{className:"px-3 h-11",children:In(e)}),m&&/* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint truncate",children:ke(e)}),
92
92
  /* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:pe(e.modifiedAt),children:fe(e.modifiedAt)}),
93
93
  /* @__PURE__ */ie("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint whitespace-nowrap",children:Tt&&"file"===e.kind&&!hn(e)&&Tt.request.otherLabel?Tt.request.otherLabel:ue(e)}),
94
- /* @__PURE__ */ie("td",{className:"px-2 h-11",children:En(e,t)})]},e.id)})})]}),On=ce&&0===ht.length?/* @__PURE__ */ie(H,{size:"sm",padding:"p-6",label:"Loading"}):0===ht.length?/* @__PURE__ */ie("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */re("table",{className:"w-full text-sm table-fixed",children:[
94
+ /* @__PURE__ */ie("td",{className:"px-2 h-11",children:En(e,t)})]},e.id)})})]}),Un=ce&&0===ht.length?/* @__PURE__ */ie(H,{size:"sm",padding:"p-6",label:"Loading"}):0===ht.length?/* @__PURE__ */ie("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */re("table",{className:"w-full text-sm table-fixed",children:[
95
95
  /* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[
96
- /* @__PURE__ */ie("th",{className:`${G} text-left font-medium px-3 h-9`,children:"Name"}),
97
- /* @__PURE__ */ie("th",{className:`${G} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
98
- /* @__PURE__ */ie("th",{className:`${G} text-left font-medium px-3 h-9 w-32`,children:"Deleted"}),
99
- /* @__PURE__ */ie("th",{className:`${G} text-right font-medium px-3 h-9 w-24`,children:"Size"}),
100
- /* @__PURE__ */ie("th",{className:`${G} w-28`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
96
+ /* @__PURE__ */ie("th",{className:`${X} text-left font-medium px-3 h-9`,children:"Name"}),
97
+ /* @__PURE__ */ie("th",{className:`${X} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
98
+ /* @__PURE__ */ie("th",{className:`${X} text-left font-medium px-3 h-9 w-32`,children:"Deleted"}),
99
+ /* @__PURE__ */ie("th",{className:`${X} text-right font-medium px-3 h-9 w-24`,children:"Size"}),
100
+ /* @__PURE__ */ie("th",{className:`${X} w-28`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
101
101
  /* @__PURE__ */ie("tbody",{children:ht.map(e=>/* @__PURE__ */re("tr",{className:"group border-b border-line-subtle hover:bg-row-hover",onContextMenu:t=>St.open(t,e),children:[
102
102
  /* @__PURE__ */ie("td",{className:"px-3 h-11",children:/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
103
103
  /* @__PURE__ */ie(Ee,{entry:e}),
@@ -106,12 +106,12 @@ return re("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),
106
106
  /* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:e.deletedAt?pe(e.deletedAt):void 0,children:e.deletedAt?fe(e.deletedAt):"—"}),
107
107
  /* @__PURE__ */ie("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":c(e.size)}),
108
108
  /* @__PURE__ */ie("td",{className:"px-2 h-11",children:/* @__PURE__ */re("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
109
- /* @__PURE__ */ie(o,{"aria-label":"Restore",size:"sm",onClick:()=>Wt(e),children:/* @__PURE__ */ie(Z,{name:"revert",className:"h-4 w-4"})}),
110
- /* @__PURE__ */ie(o,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>zt(e),children:/* @__PURE__ */ie(Z,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),Kn=0===yt.length?/* @__PURE__ */ie("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__ */re("table",{className:"w-full text-sm table-fixed",children:[
109
+ /* @__PURE__ */ie(o,{"aria-label":"Restore",size:"sm",onClick:()=>zt(e),children:/* @__PURE__ */ie(Z,{name:"revert",className:"h-4 w-4"})}),
110
+ /* @__PURE__ */ie(o,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>Ot(e),children:/* @__PURE__ */ie(Z,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),Kn=0===yt.length?/* @__PURE__ */ie("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__ */re("table",{className:"w-full text-sm table-fixed",children:[
111
111
  /* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[
112
- /* @__PURE__ */ie("th",{className:`${G} text-left font-medium px-3 h-9`,children:"Name"}),
113
- /* @__PURE__ */ie("th",{className:`${G} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
114
- /* @__PURE__ */ie("th",{className:`${G} w-32`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
112
+ /* @__PURE__ */ie("th",{className:`${X} text-left font-medium px-3 h-9`,children:"Name"}),
113
+ /* @__PURE__ */ie("th",{className:`${X} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
114
+ /* @__PURE__ */ie("th",{className:`${X} w-32`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
115
115
  /* @__PURE__ */ie("tbody",{children:yt.map(e=>/* @__PURE__ */re("tr",{onDoubleClick:()=>Mt(e),onContextMenu:t=>Dt.open(t,e),className:"group cursor-default border-b border-line-subtle hover:bg-row-hover",children:[
116
116
  /* @__PURE__ */ie("td",{className:"px-3 h-11",children:/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
117
117
  /* @__PURE__ */ie(P,{item:e}),
@@ -122,7 +122,7 @@ return re("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),
122
122
  /* @__PURE__ */ie(o,{"aria-label":"Move to desktop",size:"sm",onClick:()=>kt?.moveToDesktop([e]),children:/* @__PURE__ */ie(Z,{name:"desktop",className:"h-4 w-4"})}),
123
123
  /* @__PURE__ */ie(o,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>kt?.removeShortcuts([e]),children:/* @__PURE__ */ie(Z,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
124
124
  return re("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Qt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),bt.current++,Ke||Je(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{bt.current>0&&bt.current--,0===bt.current&&Je(!1)},onDrop:e=>{e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),_t(),Qt&&e.dataTransfer.files?.length&&Zt(e.dataTransfer.files))},children:[
125
- /* @__PURE__ */ie(O,{title:jn}),
125
+ /* @__PURE__ */ie(U,{title:jn}),
126
126
  /* @__PURE__ */ie(C,{app:"files"}),
127
127
  /* @__PURE__ */ie("input",{ref:vt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Zt(e.target.files),vt.current&&(vt.current.value="")}}),
128
128
  /* @__PURE__ */ie("input",{ref:e=>{xt.current=e,e?.setAttribute("webkitdirectory","")},type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Zt(e.target.files,{withFolders:!0}),xt.current&&(xt.current.value="")}}),
@@ -135,7 +135,7 @@ return re("div",{className:"relative flex flex-col h-full bg-surface",onDragEnte
135
135
  /* @__PURE__ */re("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
136
136
  /* @__PURE__ */ie("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */ie(l,{type:"text",enterKeyHint:"search",value:et,onChange:e=>{tt(e.target.value),e.target.value.trim()||Et()},onKeyDown:e=>{"Escape"===e.key&&et&&(e.stopPropagation(),Et())},placeholder:`Search in ${r}`,"aria-label":`Search in ${r}`,leftIcon:/* @__PURE__ */ie(Z,{name:"search",className:"h-4 w-4"}),endAction:et?{label:"Clear search",icon:/* @__PURE__ */ie(Z,{name:"close",className:"h-4 w-4"}),onClick:Et}:void 0})}),
137
137
  /* @__PURE__ */ie("div",{className:"flex-1"}),"object"!=typeof ot&&"trash"!==ot&&/* @__PURE__ */re(se,{children:[
138
- /* @__PURE__ */ie(o,{"aria-label":"List view","aria-pressed":"list"===Ge,onClick:()=>ft("list"),children:/* @__PURE__ */ie(Z,{name:"list",className:"h-4 w-4"})}),
139
- /* @__PURE__ */ie(o,{"aria-label":"Grid view","aria-pressed":"grid"===Ge,onClick:()=>ft("grid"),children:/* @__PURE__ */ie(Z,{name:"grid",className:"h-4 w-4"})})]}),
138
+ /* @__PURE__ */ie(o,{"aria-label":"List view","aria-pressed":"list"===Xe,onClick:()=>ft("list"),children:/* @__PURE__ */ie(Z,{name:"list",className:"h-4 w-4"})}),
139
+ /* @__PURE__ */ie(o,{"aria-label":"Grid view","aria-pressed":"grid"===Xe,onClick:()=>ft("grid"),children:/* @__PURE__ */ie(Z,{name:"grid",className:"h-4 w-4"})})]}),
140
140
  /* @__PURE__ */ie(o,{"aria-label":"Details","aria-pressed":qe,onClick:()=>_e(e=>!e),children:/* @__PURE__ */ie(Z,{name:"info",className:"h-4 w-4"})})]}),Pn,
141
- /* @__PURE__ */ie("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Tt?"Enter"===e.key&&pn&&(e.preventDefault(),fn(pn)):("Delete"===e.key||"Backspace"===e.key)&&an.length&&an.every(ln)?(e.preventDefault(),Gt(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),Y(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Kn:"trash"===ot?On:zn})]}),qe&&Rn&&/* @__PURE__ */ie(je,{store:n,entry:rn,selectedCount:an.length,onClose:()=>_e(!1)})]})})}),jt.state&&/* @__PURE__ */ie(s,{...jt.props,items:gn(jt.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */ie(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */ie(Z,{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__ */ie(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)}]}),Dt.state&&/* @__PURE__ */ie(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */ie(Z,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>kt?.moveToDesktop([Dt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */ie(Z,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),m&&/* @__PURE__ */ie(Ne,{store:n,entry:Be,onClose:()=>Qe(null),onChanged:Pt}),n.move&&/* @__PURE__ */ie(Ce,{store:n,items:Ze,from:"files"===ot?h:void 0,onClose:()=>He(null),onMove:e=>Ze&&qt(Ze,e)}),Ke&&/* @__PURE__ */ie("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__ */ie("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{Ue as default,Ae as quotaExceededMessage};
141
+ /* @__PURE__ */ie("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Tt?"Enter"===e.key&&pn&&(e.preventDefault(),fn(pn)):("Delete"===e.key||"Backspace"===e.key)&&an.length&&an.every(ln)?(e.preventDefault(),Xt(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),Y(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Kn:"trash"===ot?Un:On})]}),qe&&Rn&&/* @__PURE__ */ie(je,{store:n,entry:rn,selectedCount:an.length,onClose:()=>_e(!1)})]})})}),jt.state&&/* @__PURE__ */ie(s,{...jt.props,items:gn(jt.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */ie(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */ie(Z,{name:"revert",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */ie(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Ot(St.state.data)}]}),Dt.state&&/* @__PURE__ */ie(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */ie(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */ie(Z,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>kt?.moveToDesktop([Dt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */ie(Z,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),m&&/* @__PURE__ */ie(Ne,{store:n,entry:Be,onClose:()=>Qe(null),onChanged:Pt}),n.move&&/* @__PURE__ */ie(Ce,{store:n,items:Ze,from:"files"===ot?h:void 0,onClose:()=>He(null),onMove:e=>Ze&&qt(Ze,e)}),Ke&&/* @__PURE__ */ie("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__ */ie("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{We as default,Ae as quotaExceededMessage};
@@ -1,8 +1,8 @@
1
- import{getNumberingConfigs as e}from"./chunk-QNQNOTTS.js";import{SidebarLayout as t}from"./chunk-W24THMLI.js";import"./chunk-QWK6DRSN.js";import"./chunk-JLSXDYS4.js";import{timeAgo as r}from"./chunk-OJI4ROSD.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-IM2PF6VQ.js";import{useWindowManager as o,client_default as i}from"./chunk-BT636U6W.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-XYQFTFI7.js";import"./chunk-MRZLFZNJ.js";import"./chunk-EIFNESXS.js";import"./chunk-LC2UF3AA.js";import"./chunk-CJQPC2P3.js";import"./chunk-UAXL44HH.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-AW7TOB6N.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-DPFEQQQU.js";import"./chunk-UUY66GLZ.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-YDJ5IZOU.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as s}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as l}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var k=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var y={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=y[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}T.current=e},[v]);const w=j.notepad_notes||[],[_,C]=d(null),[D,S]=d(""),[U,W]=d(""),[R,I]=d("yellow"),[X,F]=d(!1),[Q,J]=d(!1),Z=a(null),V=a();p(()=>{if(!_&&w.length>0){const e=w[0];C(e.id),S(e.title),W(e.content),I(e.color)}},[w.length]);const $=m(e=>{N({notepad_notes:e})},[N]),P=m(()=>{if(!_||!X)return;const e=w.map(e=>e.id===_?{...e,title:D,content:U,color:R,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);$(e),F(!1)},[_,X,D,U,R,w,$]);p(()=>{if(X)return V.current&&clearTimeout(V.current),V.current=setTimeout(P,800),()=>{V.current&&clearTimeout(V.current)}},[X,P]),p(()=>()=>{X&&P()},[]);const A=e=>{X&&P(),C(e.id),S(e.title),W(e.content),I(e.color),F(!1),J(!1)},B=e=>{const t=U.slice(0,e),r=U.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=U.slice(e+r[0].length);W(t+n+o),F(!0)},H=async(e,t)=>{const r=T.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):l.error(`${n} not found`)}catch{l.error(`Failed to look up ${n}`)}},O="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",K=/* @__PURE__ */h(g,{children:[
2
- /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{X&&P();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...w];$(t),C(e.id),S(""),W(""),I("yellow"),F(!1),J(!0),setTimeout(()=>Z.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
1
+ import{getNumberingConfigs as e}from"./chunk-SKVLTYGN.js";import{SidebarLayout as t}from"./chunk-W24THMLI.js";import"./chunk-QWK6DRSN.js";import"./chunk-JLSXDYS4.js";import{timeAgo as r}from"./chunk-OJI4ROSD.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-BUMY4LIP.js";import{useWindowManager as o,client_default as i}from"./chunk-DEE6FKE7.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-XYQFTFI7.js";import"./chunk-MRZLFZNJ.js";import"./chunk-EIFNESXS.js";import"./chunk-LC2UF3AA.js";import"./chunk-CJQPC2P3.js";import"./chunk-UAXL44HH.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-AW7TOB6N.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-DPFEQQQU.js";import"./chunk-KUPN5WRE.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-YDJ5IZOU.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as s}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as l}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var k=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var y={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=y[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}T.current=e},[v]);const w=j.notepad_notes||[],[_,D]=d(null),[C,S]=d(""),[U,R]=d(""),[W,I]=d("yellow"),[X,F]=d(!1),[J,E]=d(!1),K=a(null),P=a();p(()=>{if(!_&&w.length>0){const e=w[0];D(e.id),S(e.title),R(e.content),I(e.color)}},[w.length]);const V=m(e=>{N({notepad_notes:e})},[N]),Z=m(()=>{if(!_||!X)return;const e=w.map(e=>e.id===_?{...e,title:C,content:U,color:W,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);V(e),F(!1)},[_,X,C,U,W,w,V]);p(()=>{if(X)return P.current&&clearTimeout(P.current),P.current=setTimeout(Z,800),()=>{P.current&&clearTimeout(P.current)}},[X,Z]),p(()=>()=>{X&&Z()},[]);const $=e=>{X&&Z(),D(e.id),S(e.title),R(e.content),I(e.color),F(!1),E(!1)},Q=e=>{const t=U.slice(0,e),r=U.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=U.slice(e+r[0].length);R(t+n+o),F(!0)},A=async(e,t)=>{const r=T.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):l.error(`${n} not found`)}catch{l.error(`Failed to look up ${n}`)}},B="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",H=/* @__PURE__ */h(g,{children:[
2
+ /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{X&&Z();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...w];V(t),D(e.id),S(""),R(""),I("yellow"),F(!1),E(!0),setTimeout(()=>K.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
3
3
  /* @__PURE__ */x(s,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
4
  /* @__PURE__ */x("div",{className:"flex-1 overflow-y-auto",children:0===w.length?/* @__PURE__ */x("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):w.map(e=>{const t=(n=e.color,k.find(e=>e.key===n)||k[0]);var n;/* @__PURE__ */
5
- return h("button",{onClick:()=>A(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
5
+ return h("button",{onClick:()=>$(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
6
6
  /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
7
  /* @__PURE__ */x("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
8
  /* @__PURE__ */x("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
@@ -10,15 +10,15 @@ return h("button",{onClick:()=>A(e),className:"w-full text-left px-3 py-3 border
10
10
  /* @__PURE__ */x("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
11
  return h("div",{className:"h-full",children:[
12
12
  /* @__PURE__ */x(n,{app:"notepad"}),
13
- /* @__PURE__ */x(t,{sidebar:K,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
13
+ /* @__PURE__ */x(t,{sidebar:H,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
14
  /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */x("input",{value:D,onChange:e=>{S(e.target.value),F(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */x("div",{className:"flex gap-1",children:k.map(e=>/* @__PURE__ */x("button",{onClick:()=>{I(e.key),F(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${R===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */x("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if($(t),_===e){const e=t[0];e?A(e):(C(null),S(""),W(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),Q?/* @__PURE__ */x("textarea",{ref:Z,value:U,onChange:e=>{W(e.target.value),F(!0)},onBlur:()=>{J(!1),X&&P()},placeholder:O,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{J(!0),setTimeout(()=>Z.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:U?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(T.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>H(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>B(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
- return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(U):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:O})}),
15
+ /* @__PURE__ */x("input",{value:C,onChange:e=>{S(e.target.value),F(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */x("div",{className:"flex gap-1",children:k.map(e=>/* @__PURE__ */x("button",{onClick:()=>{I(e.key),F(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${W===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */x("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if(V(t),_===e){const e=t[0];e?$(e):(D(null),S(""),R(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),J?/* @__PURE__ */x("textarea",{ref:K,value:U,onChange:e=>{R(e.target.value),F(!0)},onBlur:()=>{E(!1),X&&Z()},placeholder:B,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{E(!0),setTimeout(()=>K.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:U?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(T.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>A(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>Q(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
+ return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(U):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:B})}),
19
19
  /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
20
20
  /* @__PURE__ */x("span",{children:"[] checkbox"}),
21
21
  /* @__PURE__ */x("span",{children:"SO#35001 entity link"}),
22
- /* @__PURE__ */x("span",{className:"ml-auto",children:Q?"Editing":"Click to edit"})]})]}):/* @__PURE__ */x("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
22
+ /* @__PURE__ */x("span",{className:"ml-auto",children:J?"Editing":"Click to edit"})]})]}):/* @__PURE__ */x("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
23
23
  /* @__PURE__ */x(s,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
24
24
  /* @__PURE__ */x("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
@@ -0,0 +1,91 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-3AMCLA5Q.js";import{subscribePomo as o,getPomoSnapshot as n,setPomoDurations as a,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as i,setPomoFocusSound as l,useTodoTasks as c,pomodoroToday as u,migratePomodoroTasksOnce as d,pomoSwitchMode as m,pomoPause as h,pomoStart as p,ALARM_OPTIONS as g,playAlarm as k,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-JYR4V4AG.js";import{PLACEHOLDER_INK as x}from"./chunk-AYZY3YNC.js";import{formatTime as v}from"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import{pad2 as y}from"./chunk-LF27WIN2.js";import{useWidgetSettings as N}from"./chunk-DEE6FKE7.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-XYQFTFI7.js";import"./chunk-MRZLFZNJ.js";import"./chunk-EIFNESXS.js";import"./chunk-LC2UF3AA.js";import"./chunk-CJQPC2P3.js";import"./chunk-UAXL44HH.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-AW7TOB6N.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as C}from"./chunk-DPFEQQQU.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-YDJ5IZOU.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as j}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useSyncExternalStore as S,useEffect as w,useMemo as B,useState as M,useRef as T,useCallback as P}from"react";import{jsxs as A,Fragment as I,jsx as D}from"react/jsx-runtime";var V="pomodoro_appearance",R="pomodoro_active_task_id",F={focus:"Pomodoro",short:"Short Break",long:"Long Break"},L={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var U=25,E=5,$=15,J=!1,W=!1,Z=4,Q=!0,Y=!0,H="bell",K=100,X=1,G="none",O=50,_=(e,t,o,n)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(o,Math.round(e))):n;function z(){const t=S(o,n,n),{prefs:k,save:b}=C(),x=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:_(t.focusMinutes,1,120,U),shortBreakMinutes:_(t.shortBreakMinutes,1,120,E),longBreakMinutes:_(t.longBreakMinutes,1,120,$),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:J,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:W,longBreakInterval:_(t.longBreakInterval,1,20,Z),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:Q,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:Y,alarmSound:g.some(e=>e.id===t.alarmSound)?t.alarmSound:H,alarmVolume:_(t.alarmVolume,0,100,K),alarmRepeat:_(t.alarmRepeat,1,5,X),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:G,focusVolume:_(t.focusVolume,0,100,O)}}(k.pomodoro_settings);w(()=>{a({focus:60*x.focusMinutes,short:60*x.shortBreakMinutes,long:60*x.longBreakMinutes})},[x.focusMinutes,x.shortBreakMinutes,x.longBreakMinutes]),w(()=>{r(x.alarmSound),s(x.alarmVolume,x.alarmRepeat)},[x.alarmSound,x.alarmVolume,x.alarmRepeat]),w(()=>{i({autoStartBreaks:x.autoStartBreaks,autoStartPomodoros:x.autoStartPomodoros,longBreakInterval:x.longBreakInterval})},[x.autoStartBreaks,x.autoStartPomodoros,x.longBreakInterval]),w(()=>{l(x.focusSound,x.focusVolume)},[x.focusSound,x.focusVolume]),w(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const z=c(),ee=z.tasks,te=B(()=>u(),[]),oe=function(e,t){return B(()=>t?(e=>{const t=[],o=[];for(const n of e)(n.done?o:t).push(n);return[...t,...o]})(e):e,[e,t])}(B(()=>ee.filter(e=>!!e.dueDate&&(e.dueDate===te||e.dueDate<te&&!e.done)),[ee,te]),x.checkToBottom),[ne,ae]=M(()=>localStorage.getItem(R)),[re,se]=M(!1),[ie,le]=M(null),ce=T(!1);w(()=>{ce.current||(ce.current=!0,d(ee,z.setAllTasks))},[]),w(()=>{try{ne?localStorage.setItem(R,ne):localStorage.removeItem(R)}catch{}},[ne]),w(()=>{if(!ie)return;const e=()=>le(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ie]);const ue=T(t.streak);w(()=>{if(t.streak>ue.current&&ne){const e=ee.find(e=>e.id===ne);if(e){const t=(e.completed??0)+1,o=e.estimated??0,n=x.autoCheckTasks&&o>0&&t>=o;z.updateTask(ne,{completed:t,done:e.done||n})}}ue.current=t.streak},[t.streak,ne,x.autoCheckTasks,ee,z]);const me=oe.reduce((e,t)=>e+(t.completed??0),0),he=oe.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),pe=oe.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),ge=t.running&&"focus"===t.mode?t.remaining:0,ke=pe*x.focusMinutes*60+ge,fe=new Date(Date.now()+1e3*ke),be=v(fe.toISOString(),{clock:{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}}),xe=(ke/3600).toFixed(1),ve=ne?ee.find(e=>e.id===ne)??null:null,ye=y(Math.floor(t.remaining/60)),Ne=y(t.remaining%60),[Ce,je]=M(()=>e(V)),[Se,we]=M(!1),[Be,Me]=M(Ce),[Te,Pe]=M(x);N(P(()=>{Me({...Ce}),Pe({...x}),we(!0)},[Ce,x]));const Ae="focus"!==t.mode,Ie=L[t.mode],De=Ae?(Ve=Ie,Re=Ce.activeOpacity/100,`rgba(${parseInt(Ve.slice(1,3),16)}, ${parseInt(Ve.slice(3,5),16)}, ${parseInt(Ve.slice(5,7),16)}, ${Re})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${Ce.activeOpacity/100})`;var Ve,Re;const Fe={primary:Ae?"text-white":"text-gray-900",secondary:Ae?"text-white/85":"text-gray-700",muted:Ae?"text-white/65":"text-gray-500",tabActive:Ae?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Ae?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Ae?"border-white/30":"border-gray-200",softDivider:Ae?"border-white/20":"border-gray-200",iconBtn:Ae?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Ae?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Le=Ae?Ie:"#0f172a";/* @__PURE__ */
2
+ return A(I,{children:[
3
+ /* @__PURE__ */A("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Fe.primary}`,style:{backgroundColor:De,backdropFilter:Ce.activeBlur>0?`blur(${Ce.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */D("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */D("button",{onClick:()=>m(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?Fe.tabActive:Fe.tabInactive}`,children:F[e]},e))}),
5
+ /* @__PURE__ */A("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[ye,":",Ne]}),
6
+ /* @__PURE__ */D("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */D("button",{onClick:()=>t.running?h():p(),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__ */D("div",{className:"px-3 py-3 text-center",children:ve?/* @__PURE__ */A(I,{children:[
8
+ /* @__PURE__ */A("div",{className:`text-xs leading-tight ${Fe.muted}`,children:["#",(ve.completed??0)+1]}),
9
+ /* @__PURE__ */D("div",{className:`text-base font-medium leading-tight truncate mt-0.5 ${Fe.primary}`,children:ve.name})]}):/* @__PURE__ */D("div",{className:`text-xs italic ${Fe.muted}`,children:"No task selected"})}),
10
+ /* @__PURE__ */A("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
+ /* @__PURE__ */D("h3",{className:`text-base font-bold tracking-tight ${Fe.primary}`,children:"Tasks"}),
12
+ /* @__PURE__ */D("button",{className:`rounded p-1 transition-colors ${Fe.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */D(j,{name:"more-vertical",look:"solid",className:"h-4 w-4"})})]}),
13
+ /* @__PURE__ */D("div",{className:`border-t mx-3 mt-2 ${Fe.divider}`}),
14
+ /* @__PURE__ */A("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[oe.map(e=>{const t=e.id===ne;/* @__PURE__ */
15
+ return A("div",{onClick:()=>ae(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__ */D("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,z.toggleDone(o)},className:"shrink-0",children:e.done?/* @__PURE__ */D("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Le},children:/* @__PURE__ */D("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__ */D("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */D("circle",{cx:"12",cy:"12",r:"10"})})}),
17
+ /* @__PURE__ */D("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
18
+ /* @__PURE__ */A("span",{className:"text-sm tabular-nums mr-2 shrink-0",children:[
19
+ /* @__PURE__ */D("span",{className:"font-bold text-gray-500",children:e.completed??0}),
20
+ /* @__PURE__ */D("span",{className:"text-gray-400",children:" / "}),
21
+ /* @__PURE__ */D("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
22
+ /* @__PURE__ */A("div",{className:"relative",children:[
23
+ /* @__PURE__ */D("button",{onClick:t=>{t.stopPropagation(),le(ie===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */D(j,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-ink-faint"})}),ie===e.id&&/* @__PURE__ */D("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__ */D("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,z.removeTask(o),ne===o&&ae(null),le(null)},className:"block w-full px-3 h-8 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),re?/* @__PURE__ */D(de,{onSubmit:(e,t)=>{const o=e.trim();if(!o)return;const n=z.addTask({name:o,estimated:t,completed:0,dueDate:te});ne||ae(n),se(!1)},onCancel:()=>se(!1),accentColor:Le}):/* @__PURE__ */A("button",{onClick:()=>se(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Fe.addTaskBtn}`,children:[
24
+ /* @__PURE__ */D(j,{name:"add-circle",className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
25
+ /* @__PURE__ */A("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${Fe.softDivider}`,children:[
26
+ /* @__PURE__ */A("span",{className:Fe.secondary,children:["Pomos: ",
27
+ /* @__PURE__ */D("span",{className:`font-bold ${Fe.primary}`,children:me}),
28
+ /* @__PURE__ */D("span",{className:Fe.muted,children:" / "}),
29
+ /* @__PURE__ */D("span",{className:`font-bold ${Fe.primary}`,children:he})]}),ke>0&&/* @__PURE__ */A("span",{className:Fe.secondary,children:["Finish At: ",
30
+ /* @__PURE__ */D("span",{className:`font-bold ${Fe.primary}`,children:be}),
31
+ /* @__PURE__ */A("span",{className:Fe.muted,children:[" (",xe,"h)"]})]})]})]}),
32
+ /* @__PURE__ */D(q,{open:Se,onClose:()=>we(!1),onSave:()=>{je(Be),localStorage.setItem(V,JSON.stringify(Be)),b({pomodoro_settings:Te}),we(!1)},configAppearance:Be,setConfigAppearance:Me,configPrefs:Te,setConfigPrefs:Pe})]})}function q({open:e,onClose:o,onSave:n,configAppearance:a,setConfigAppearance:r,configPrefs:s,setConfigPrefs:i}){const l=(e,t)=>i(o=>({...o,[e]:t}));/* @__PURE__ */
33
+ return A(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:a,onAppearanceChange:r,onSave:n,children:[
34
+ /* @__PURE__ */A(ee,{icon:/* @__PURE__ */D(le,{}),label:"TIMER",children:[
35
+ /* @__PURE__ */A("div",{children:[
36
+ /* @__PURE__ */D("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
37
+ /* @__PURE__ */A("div",{className:"grid grid-cols-3 gap-3",children:[
38
+ /* @__PURE__ */D(ne,{label:"Pomodoro",value:s.focusMinutes,onChange:e=>l("focusMinutes",e),max:120}),
39
+ /* @__PURE__ */D(ne,{label:"Short Break",value:s.shortBreakMinutes,onChange:e=>l("shortBreakMinutes",e),max:120}),
40
+ /* @__PURE__ */D(ne,{label:"Long Break",value:s.longBreakMinutes,onChange:e=>l("longBreakMinutes",e),max:120})]})]}),
41
+ /* @__PURE__ */D(te,{label:"Auto Start Breaks",children:/* @__PURE__ */D(se,{checked:s.autoStartBreaks,onChange:e=>l("autoStartBreaks",e)})}),
42
+ /* @__PURE__ */D(te,{label:"Auto Start Pomodoros",children:/* @__PURE__ */D(se,{checked:s.autoStartPomodoros,onChange:e=>l("autoStartPomodoros",e)})}),
43
+ /* @__PURE__ */D(te,{label:"Long Break interval",children:/* @__PURE__ */D(ae,{value:s.longBreakInterval,onChange:e=>l("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
+ /* @__PURE__ */A(ee,{icon:/* @__PURE__ */D(ce,{}),label:"TASK",children:[
45
+ /* @__PURE__ */D(te,{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__ */D(se,{checked:s.autoCheckTasks,onChange:e=>l("autoCheckTasks",e)})}),
46
+ /* @__PURE__ */D(te,{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__ */D(se,{checked:s.checkToBottom,onChange:e=>l("checkToBottom",e)})})]}),
47
+ /* @__PURE__ */A(ee,{icon:/* @__PURE__ */D(ue,{}),label:"SOUND",children:[
48
+ /* @__PURE__ */D(te,{label:"Alarm Sound",children:/* @__PURE__ */A("div",{className:"flex items-center gap-2",children:[
49
+ /* @__PURE__ */D(re,{value:s.alarmSound,onChange:e=>l("alarmSound",e),options:g.map(e=>({id:e.id,label:e.label}))}),"off"!==s.alarmSound&&/* @__PURE__ */D("button",{type:"button",onClick:()=>k(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__ */D(oe,{value:s.alarmVolume,onChange:e=>l("alarmVolume",e)}),
51
+ /* @__PURE__ */D(te,{label:"repeat",children:/* @__PURE__ */D(ae,{value:s.alarmRepeat,onChange:e=>l("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
+ /* @__PURE__ */D(te,{label:"Focus Sound",children:/* @__PURE__ */A("div",{className:"flex items-center gap-2",children:[
53
+ /* @__PURE__ */D(re,{value:s.focusSound,onChange:e=>l("focusSound",e),options:f}),"none"!==s.focusSound&&/* @__PURE__ */D("button",{type:"button",onClick:()=>b(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__ */D(oe,{value:s.focusVolume,onChange:e=>l("focusVolume",e)})]})]})}function ee({icon:e,label:t,children:o}){/* @__PURE__ */
55
+ return A("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
+ /* @__PURE__ */A("div",{className:"flex items-center gap-2 mb-3 text-ink-faintest",children:[e,
57
+ /* @__PURE__ */D("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
58
+ /* @__PURE__ */D("div",{className:"space-y-3",children:o})]})}function te({label:e,info:t,children:o}){/* @__PURE__ */
59
+ return A("div",{className:"flex items-center justify-between gap-3",children:[
60
+ /* @__PURE__ */A("div",{className:"flex items-center gap-2 min-w-0",children:[
61
+ /* @__PURE__ */D("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */D(ie,{title:t})]}),
62
+ /* @__PURE__ */D("div",{className:"shrink-0",children:o})]})}function oe({value:e,onChange:t}){/* @__PURE__ */
63
+ return A("div",{className:"flex items-center justify-end gap-3",children:[
64
+ /* @__PURE__ */D("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
65
+ /* @__PURE__ */D("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function ne({label:e,value:t,onChange:o,min:n=1,max:a=99}){/* @__PURE__ */
66
+ return A("label",{className:"flex flex-col",children:[
67
+ /* @__PURE__ */D("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
68
+ /* @__PURE__ */D(ae,{value:t,onChange:o,min:n,max:a})]})}function ae({value:e,onChange:t,min:o=1,max:n=99,className:a=""}){/* @__PURE__ */
69
+ return D("input",{type:"number",min:o,max:n,value:e,onChange:e=>t(Math.max(o,Math.min(n,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 ${a}`})}function re({value:e,onChange:t,options:o}){/* @__PURE__ */
70
+ return A("div",{className:"relative",children:[
71
+ /* @__PURE__ */D("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__ */D("option",{value:e.id,children:e.label},e.id))}),
72
+ /* @__PURE__ */D(j,{name:"chevron-down",className:`absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 pointer-events-none ${x}`,strokeWidth:2.5})]})}function se({checked:e,onChange:t}){/* @__PURE__ */
73
+ return D("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__ */D("span",{className:"absolute h-5 w-5 rounded-full bg-white shadow transition-transform "+(e?"translate-x-[22px]":"translate-x-0.5")})})}function ie({title:e}){/* @__PURE__ */
74
+ return D("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 le(){/* @__PURE__ */
75
+ return A("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
76
+ /* @__PURE__ */D("circle",{cx:"12",cy:"12",r:"9"}),
77
+ /* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7v5l3 2"})]})}function ce(){/* @__PURE__ */
78
+ return A("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
79
+ /* @__PURE__ */D("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),
80
+ /* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})}function ue(){/* @__PURE__ */
81
+ return A("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
82
+ /* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5L6 9H2v6h4l5 4V5z"}),
83
+ /* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function de({onSubmit:e,onCancel:t,accentColor:o}){const[n,a]=M(""),[r,s]=M(1),i=()=>e(n,r);/* @__PURE__ */
84
+ return A("div",{className:"bg-surface text-ink-strong rounded-md p-3 shadow-(--elevation-panel)",children:[
85
+ /* @__PURE__ */D("input",{autoFocus:!0,value:n,onChange:e=>a(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__ */A("div",{className:"flex items-center justify-between mt-2",children:[
87
+ /* @__PURE__ */D("span",{className:"text-xs font-semibold text-gray-500",children:"Est Pomodoros"}),
88
+ /* @__PURE__ */D("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__ */A("div",{className:"flex gap-2 mt-3 justify-end",children:[
90
+ /* @__PURE__ */D("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
91
+ /* @__PURE__ */D("button",{onClick:i,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:o},children:"Save"})]})]})}export{z as default};