efficient-shell 13.24.0 → 13.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/Browser-W2WVSAEN.js +44 -0
- package/dist/Calculator-PKAM5ERT.js +29 -0
- package/dist/CurrencyConverter-VH4UVYLO.js +21 -0
- package/dist/Files-6QZFFGSH.js +141 -0
- package/dist/Notepad-YU4HIJD2.js +24 -0
- package/dist/PomodoroTimer-PBSAKRX5.js +91 -0
- package/dist/{Preview-FXOWT52M.js → Preview-H7N2MMAI.js} +39 -39
- package/dist/{Sidebar-MY66ILZY.js → Sidebar-HAIHWIJD.js} +22 -22
- package/dist/{Stock-SHKXRWJQ.js → Stock-YL732PKW.js} +5 -5
- package/dist/{Weather-WMKWOPBU.js → Weather-3CBRXNNM.js} +18 -18
- package/dist/{WorldClock-GZYOF4B2.js → WorldClock-LONNWCRG.js} +6 -6
- package/dist/ai/index.js +117 -117
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-GAEQYCLS.js → chunk-26KHYLJN.js} +1 -1
- package/dist/{chunk-SAHRIE35.js → chunk-2Y4AH7NC.js} +1 -1
- package/dist/{chunk-7G5HKAGV.js → chunk-3WUVYXCF.js} +5 -5
- package/dist/chunk-44ERJYNW.js +6 -0
- package/dist/{chunk-XYQFTFI7.js → chunk-4VFEPP2W.js} +9 -9
- package/dist/{chunk-TSCJG6UM.js → chunk-527WMFTR.js} +1 -1
- package/dist/{chunk-VLIXI42G.js → chunk-77N3REYY.js} +2 -2
- package/dist/chunk-AAFPAQXH.js +13 -0
- package/dist/{chunk-ZL654Y6H.js → chunk-AAJSE5HA.js} +1 -1
- package/dist/{chunk-J5OAQAAD.js → chunk-B5KX7PDG.js} +4 -4
- package/dist/{chunk-UJY5RUZ5.js → chunk-BQQEQCSK.js} +1 -1
- package/dist/{chunk-JJYTN72U.js → chunk-CCZHSISF.js} +3 -3
- package/dist/{chunk-WNX6EVJ4.js → chunk-EXDSYFHB.js} +1 -1
- package/dist/chunk-FLQXMCB3.js +8 -0
- package/dist/{chunk-GPU7LLTJ.js → chunk-HPKQYUQT.js} +1 -1
- package/dist/{chunk-LRMDLZMM.js → chunk-JVENCUUG.js} +4 -4
- package/dist/{chunk-23YQNCZ4.js → chunk-K4KUGKWP.js} +16 -16
- package/dist/chunk-LG6NDTHZ.js +2 -0
- package/dist/{chunk-ZBGPAUOH.js → chunk-N4LMFGRI.js} +5 -5
- package/dist/chunk-O5ZBRG2G.js +1 -0
- package/dist/{chunk-7N6CVTWO.js → chunk-P6H2B635.js} +1 -1
- package/dist/{chunk-Z6J4KXY3.js → chunk-PWOVSR7N.js} +6 -6
- package/dist/chunk-PWX64YBI.js +28 -0
- package/dist/{chunk-F3EBYHIE.js → chunk-S5MTTJ3F.js} +10 -10
- package/dist/{chunk-ONWFKCMB.js → chunk-SRI2D23Y.js} +8 -8
- package/dist/{chunk-LUARJHUK.js → chunk-TJG76Y7I.js} +8 -8
- package/dist/{chunk-TT7KXS2Q.js → chunk-UQV4TSWB.js} +1 -1
- package/dist/{chunk-AFYLMXOJ.js → chunk-UU42O5ON.js} +5 -5
- package/dist/{chunk-H2Q7G5D6.js → chunk-VGUB7LPF.js} +28 -28
- package/dist/{chunk-QPVYBN4J.js → chunk-VLBLDSA6.js} +1 -1
- package/dist/{chunk-L744YF4X.js → chunk-VMAIZU5S.js} +1 -1
- package/dist/{chunk-6CFI4YGI.js → chunk-VP2IQJUD.js} +4 -4
- package/dist/chunk-VY6OQRZA.js +1 -0
- package/dist/{chunk-FMBUR4EU.js → chunk-XC2GUCTG.js} +1 -1
- package/dist/data/EntityList.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/Input.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/RenameField.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.js +516 -516
- package/dist/page-tabs/index.js +5 -5
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/discardGuard.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Browser-NZ32TN3O.js +0 -44
- package/dist/Calculator-PHIOJNTS.js +0 -29
- package/dist/CurrencyConverter-WZXN6WTD.js +0 -21
- package/dist/Files-BKNIV43J.js +0 -141
- package/dist/Notepad-XJTIS3J5.js +0 -24
- package/dist/PomodoroTimer-WVIAWG5E.js +0 -91
- package/dist/chunk-3ZX5DC2S.js +0 -1
- package/dist/chunk-CJQPC2P3.js +0 -2
- package/dist/chunk-M36B3M2H.js +0 -8
- package/dist/chunk-MRZLFZNJ.js +0 -6
- package/dist/chunk-OFMZ6JM6.js +0 -13
- package/dist/chunk-QKVPKLDN.js +0 -28
- /package/dist/{chunk-UAXL44HH.js → chunk-4BYJABCX.js} +0 -0
package/dist/Files-BKNIV43J.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-UMIRPFQJ.js";import{SidebarLayout as t}from"./chunk-MCLVTQSF.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-VLIXI42G.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 z,FILES_ROLE_LABELS as O}from"./chunk-KGRJSTPM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as W,WindowTitle as U}from"./chunk-H2Q7G5D6.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 V}from"./chunk-MRZLFZNJ.js";import"./chunk-EIFNESXS.js";import{ItemCount as Y}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-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-3ZX5DC2S.js";import{DropdownMenu as Q}from"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.js";import{Button_default as Z}from"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as B}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?z[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
|
-
return re(V,{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(Z,{variant:"secondary",onClick:a,children:"Done"}),children:[
|
|
3
|
-
/* @__PURE__ */re("div",{className:"flex items-center gap-2",children:[
|
|
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
|
-
/* @__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(Z,{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
|
-
/* @__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
|
-
/* @__PURE__ */re("li",{className:"flex items-center gap-2 h-10",children:[
|
|
9
|
-
/* @__PURE__ */ie("span",{className:"flex-1 truncate",children:"You"}),
|
|
10
|
-
/* @__PURE__ */ie("span",{className:"text-xs text-ink-faint",children:"Owner"})]}),s.map(n=>/* @__PURE__ */re("li",{className:"flex items-center gap-2 h-10",children:[
|
|
11
|
-
/* @__PURE__ */ie("span",{className:"flex-1 truncate",title:n.person.name,children:n.person.name}),
|
|
12
|
-
/* @__PURE__ */ie("div",{className:"w-28 shrink-0",children:/* @__PURE__ */ie(r,{value:n.role,onChange:a=>j(()=>e.share(t.id,n.person.id,a)),options:xe,"aria-label":`Access for ${n.person.name}`,disabled:y})}),
|
|
13
|
-
/* @__PURE__ */ie(o,{"aria-label":`Remove ${n.person.name}`,variant:"ghost",size:"sm",disabled:y,onClick:()=>j(()=>e.unshare(t.id,n.person.id)),children:/* @__PURE__ */ie(B,{name:"close",className:"h-4 w-4",strokeWidth:1.8})})]},n.person.id))]})]})}function Ce({store:e,items:t,from:n,onClose:a,onMove:r}){const[i,s]=q(n??null),[l,c]=q(null),[d,m]=q(!1);ee(()=>{t&&s(n??null)},[t,n]),ee(()=>{if(!t)return;let n=!0;return m(!0),e.list(i).then(e=>{n&&c(e)}).catch(()=>{n&&c(null)}).finally(()=>{n&&m(!1)}),()=>{n=!1}},[e,i,t]);const h=new Set((t??[]).map(e=>e.id)),u=(l?.entries??[]).filter(e=>"folder"===e.kind&&!h.has(e.id)),f=(l?.folder.path??[]).filter(e=>null!==e.id),p=f.length>1?f[f.length-2].id:null,k=l?.folder,g=L(k?.role??"owner"),w=void 0!==n&&i===n,y=t?.length??0,b=1===y?`"${t[0].name}"`:`${y} items`;/* @__PURE__ */
|
|
14
|
-
return re(V,{open:!!t,onClose:a,title:`Move ${b}`,size:"sm",footer:/* @__PURE__ */re(se,{children:[
|
|
15
|
-
/* @__PURE__ */ie(Z,{variant:"secondary",onClick:a,children:"Cancel"}),
|
|
16
|
-
/* @__PURE__ */ie(Z,{variant:"primary",onClick:()=>r(i),disabled:d||!g||w,children:"Move here"})]}),children:[
|
|
17
|
-
/* @__PURE__ */re("div",{className:"flex items-center gap-1 mb-2 min-h-8",children:[null!==i&&/* @__PURE__ */ie(o,{"aria-label":"Back",size:"sm",onClick:()=>s(p),children:/* @__PURE__ */ie(B,{name:"arrow-left",className:"h-4 w-4"})}),
|
|
18
|
-
/* @__PURE__ */ie("span",{className:"text-sm font-medium text-ink-strong truncate",children:null===i?"My files":k?.name??""})]}),
|
|
19
|
-
/* @__PURE__ */ie("div",{className:"border border-line rounded-(--radius-control) h-64 overflow-auto",children:d?/* @__PURE__ */ie(H,{size:"sm",padding:"p-6",label:"Loading"}):0===u.length?/* @__PURE__ */ie("div",{className:"p-6 text-center text-sm text-ink-faintest",children:"No folders here."}):/* @__PURE__ */ie("ul",{children:u.map(e=>/* @__PURE__ */ie("li",{children:/* @__PURE__ */re("button",{type:"button",onClick:()=>s(e.id),className:"flex w-full items-center gap-2 px-3 h-9 text-left text-sm hover:bg-row-hover",children:[
|
|
20
|
-
/* @__PURE__ */ie(B,{name:"folder",look:"solid",tone:"muted",className:"h-4 w-4 shrink-0"}),
|
|
21
|
-
/* @__PURE__ */ie("span",{className:"truncate flex-1",children:e.name}),
|
|
22
|
-
/* @__PURE__ */ie(B,{name:"chevron-right",tone:"muted",className:"h-4 w-4 shrink-0"})]})},e.id))})}),!g&&/* @__PURE__ */ie("p",{className:"mt-2 text-xs text-ink-faint",children:"You can view this folder but not move things into it."})]})}function je({store:e,entry:t,selectedCount:n,onClose:a}){const[r,i]=q(null),[s,l]=q(null);ee(()=>{if(i(null),l(null),!t)return;let n=!0;return e.info?.(t.id).then(e=>{n&&i(e)}).catch(()=>{}),e.shares?.(t.id).then(e=>{n&&l(e)}).catch(()=>{}),()=>{n=!1}},[e,t]);const c=t?ce(t):null,d=c?me[c]:null,m=r?.path.slice(0,-1).map(e=>e.name||"My files").join(" / "),h=(e,t)=>t?/* @__PURE__ */re("div",{className:"py-2",children:[
|
|
23
|
-
/* @__PURE__ */ie("dt",{className:"text-2xs text-ink-faint",children:e}),
|
|
24
|
-
/* @__PURE__ */ie("dd",{className:"text-sm text-ink break-words",children:t})]}):null;/* @__PURE__ */
|
|
25
|
-
return re("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col min-h-0 bg-surface","aria-label":"Details",children:[
|
|
26
|
-
/* @__PURE__ */re("div",{className:"flex items-center gap-2 px-3 h-12 shrink-0",children:[d&&/* @__PURE__ */ie(B,{name:d.name,tone:d.tone,className:"h-5 w-5 shrink-0"}),
|
|
27
|
-
/* @__PURE__ */ie("span",{className:"flex-1 truncate text-sm font-medium text-ink-strong",children:t?he(t):n>1?`${n} items selected`:"Details"}),
|
|
28
|
-
/* @__PURE__ */ie(o,{"aria-label":"Close details",size:"sm",onClick:a,children:/* @__PURE__ */ie(B,{name:"close",className:"h-4 w-4"})})]}),
|
|
29
|
-
/* @__PURE__ */ie("div",{className:"flex-1 overflow-auto px-4 pb-4",children:t?/* @__PURE__ */re(se,{children:[
|
|
30
|
-
/* @__PURE__ */ie("div",{className:"h-32 rounded-(--radius-control) bg-surface-sunken flex items-center justify-center mb-3",children:d&&/* @__PURE__ */ie(B,{name:d.name,tone:d.tone,className:"h-12 w-12"})}),s&&/* @__PURE__ */re("div",{className:"mb-3",children:[
|
|
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
|
-
/* @__PURE__ */ie("span",{className:"truncate",children:e.person.name}),
|
|
33
|
-
/* @__PURE__ */ie("span",{className:"text-ink-faint text-xs",children:O[e.role]})]},e.person.id))})]}),
|
|
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(B,{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 ze(){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([]),[O,V]=q(()=>/* @__PURE__ */new Set),le=_(null),[ce,xe]=q(!0),[ze,Oe]=q(!1),[We,Ue]=q(null),[Ke,Je]=q(!1),[Ve,Ye]=q(null),[Qe,Ze]=q(null),[Be,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}=W(),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(),Oe(!1)}catch(e){e instanceof TypeError?Oe(!0):G.error(Fe(e,t))}finally{xe(!1)}},[]),Lt=te(async e=>{if(d)return p(Le(e)),Oe(!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(()=>{V(/* @__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)},zt=async(e,t)=>{try{await e()}catch(e){G.error(Fe(e,t))}Pt()},Ot=e=>zt(async()=>{await n.restore(e.id),G.success(`Restored "${e.name}"`)},"Restore failed"),Wt=async e=>{await K({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&zt(()=>n.purge(e.id),"Delete failed")},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",Vt="owner"!==Jt,Yt="files"===ot?h:null,Qt=!d&&("files"!==ot||L(Jt)),Zt=!d&&"files"===ot&&L(Jt),Bt=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(Yt,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"):zt(()=>n.rename(e.id,function(e,t){const n=e.officeKind?z[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 zt(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)=>zt(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 zt(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),Ye(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=[...O].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 V(/* @__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 V(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}le.current=e,t.metaKey||t.ctrlKey?V(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):V(/* @__PURE__ */new Set([e]))},mn=()=>{V(/* @__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(B,{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(B,{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(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */ie(B,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Ut)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */ie(B,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Ht(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */ie(B,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>zt(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(B,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Ze(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */ie(B,{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(B,{name:"star",className:"h-4 w-4"}),onSelect:()=>Gt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */ie(B,{name:"info",className:"h-4 w-4"}),onSelect:()=>{V(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */ie(B,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Xt(e)}]:[]])},wn=(e,t)=>{const n=O.has(t.id)?an:[t];jt.open(e,n)&&!O.has(t.id)&&(V(/* @__PURE__ */new Set([t.id])),le.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=O.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(),Ve!==e.id&&Ye(e.id))},onDragLeave:()=>{Ve===e.id&&Ye(null)},onDrop:t=>{if(!t.dataTransfer.types.includes($e))return;t.preventDefault(),t.stopPropagation(),Ye(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(ze)/* @__PURE__ */
|
|
36
|
-
return re("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
37
|
-
/* @__PURE__ */ie(U,{title:`${r} - offline`}),
|
|
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
|
-
/* @__PURE__ */ie(B,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),A()?/* @__PURE__ */re(se,{children:[
|
|
40
|
-
/* @__PURE__ */ie("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach your files"}),
|
|
41
|
-
/* @__PURE__ */ie("p",{className:"text-sm text-ink-faint mb-3",children:"Check your connection and try again."})]}):/* @__PURE__ */re(se,{children:[
|
|
42
|
-
/* @__PURE__ */ie("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
|
|
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
|
-
/* @__PURE__ */ie("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
|
|
45
|
-
/* @__PURE__ */ie(Z,{variant:"primary",onClick:Pt,children:"Retry"})]})})]});const vn=We&&We.limit>0?Math.min(100,Math.round(We.used/We.limit*100)):0,xn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",Nn=[Vt?{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(B,{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 zt(()=>n.createFolder(Yt,e),"Create folder failed"),"files"!==ot&&It(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */ie(B,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */ie(B,{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(B,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Yt)).catch(e=>G.error(Fe(e,"Could not create it")))}}}):[]]),Tn=/* @__PURE__ */re("div",{className:"flex h-full flex-col",children:[
|
|
46
|
-
/* @__PURE__ */ie("div",{className:"p-3 pb-2",children:/* @__PURE__ */ie(Q,{trigger:/* @__PURE__ */re(se,{children:[
|
|
47
|
-
/* @__PURE__ */ie(B,{name:"add",className:"h-5 w-5"}),
|
|
48
|
-
/* @__PURE__ */ie("span",{children:"New"})]}),items:Dn,align:"start","aria-label":"New",disabled:!Qt,triggerClassName:"inline-flex items-center gap-2 h-11 pl-4 pr-5 rounded-2xl bg-surface-raised border border-line shadow-sm text-sm font-medium text-ink-strong hover:bg-row-hover disabled:opacity-50 rosh-focus-ring focus-visible:ring-2"})}),
|
|
49
|
-
/* @__PURE__ */re("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
|
|
50
|
-
/* @__PURE__ */re("button",{onClick:()=>It(null),className:Sn("files"===ot&&!Vt),children:[
|
|
51
|
-
/* @__PURE__ */ie(B,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!d&&/* @__PURE__ */re("button",{onClick:()=>pt("recent"),className:Sn("recent"===ot),children:[
|
|
52
|
-
/* @__PURE__ */ie(B,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!d&&/* @__PURE__ */re("button",{onClick:()=>pt("starred"),className:Sn("starred"===ot),children:[
|
|
53
|
-
/* @__PURE__ */ie(B,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),m&&/* @__PURE__ */re("button",{onClick:()=>pt("shared"),className:Sn("shared"===ot||"files"===ot&&Vt),children:[
|
|
54
|
-
/* @__PURE__ */ie(B,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!d&&/* @__PURE__ */re("button",{onClick:()=>pt("trash"),className:Sn("trash"===ot),children:[
|
|
55
|
-
/* @__PURE__ */ie(B,{name:"trash",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Trash"]}),kt&&kt.folders.length>0&&/* @__PURE__ */re(se,{children:[
|
|
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
|
-
/* @__PURE__ */ie(F,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
58
|
-
/* @__PURE__ */ie("span",{className:"truncate",children:e.name}),
|
|
59
|
-
/* @__PURE__ */ie(Y,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),We&&/* @__PURE__ */re("div",{className:"px-5 py-3 shrink-0",title:`${c(We.used)} of ${c(We.limit)} used`,children:[
|
|
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(We.used)," of ",c(We.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */re("span",{className:"inline-flex items-center gap-1",children:[e,
|
|
62
|
-
/* @__PURE__ */ie(B,{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
|
-
/* @__PURE__ */ie(Q,{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(Q,{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
|
-
/* @__PURE__ */ie(Q,{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
|
-
/* @__PURE__ */ie(o,{"aria-label":"Clear selection",size:"sm",onClick:mn,children:/* @__PURE__ */ie(B,{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:()=>Ze(rn),children:/* @__PURE__ */ie(B,{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(B,{name:"download",className:"h-4 w-4"})}),an.every(cn)&&/* @__PURE__ */ie(o,{"aria-label":"Move",size:"sm",onClick:()=>He(an),children:/* @__PURE__ */ie(B,{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(B,{name:"trash",className:"h-4 w-4"})}),
|
|
67
|
-
/* @__PURE__ */ie(Q,{trigger:/* @__PURE__ */ie(B,{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
|
-
/* @__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
|
-
/* @__PURE__ */ie(F,{className:"h-4 w-4 text-amber-500 shrink-0"}),
|
|
70
|
-
/* @__PURE__ */ie("span",{className:"text-base font-medium text-ink-strong truncate",children:wt?.name??"Desktop folder"}),
|
|
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&&Vt&&!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(B,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Vt&&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(Z,{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"})&&zt(()=>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(),Ze(e)},children:/* @__PURE__ */ie(B,{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(B,{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(B,{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(Q,{trigger:/* @__PURE__ */ie(B,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(O.has(e.id)&&an.length>1?an:[e])})})]}),In=e=>/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
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(B,{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(B,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),zn=(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(B,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */ie(B,{name:"arrow-down",className:"h-3 w-3"}))]})})},On="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,Wn=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.":On??/* @__PURE__ */re(se,{children:["This folder is empty.",Zt&&/* @__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
|
-
/* @__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=O.has(t.id);/* @__PURE__ */
|
|
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||Ve===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
|
|
81
|
-
/* @__PURE__ */re("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
|
|
82
|
-
/* @__PURE__ */ie(Ee,{entry:t,className:"h-4 w-4"}),
|
|
83
|
-
/* @__PURE__ */ie("span",{className:"flex-1 truncate text-sm",title:t.name,children:he(t)}),
|
|
84
|
-
/* @__PURE__ */ie("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ie(Q,{trigger:/* @__PURE__ */ie(B,{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
|
-
/* @__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
|
-
/* @__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:[zn("name","Name","text-left"),m&&zn("owner","Owner","text-left w-32"),zn("modified","Modified","text-left w-28"),zn("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=O.has(e.id);/* @__PURE__ */
|
|
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||Ve===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
|
|
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
|
-
/* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:pe(e.modifiedAt),children:fe(e.modifiedAt)}),
|
|
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)})})]}),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
|
-
/* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[
|
|
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
|
-
/* @__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
|
-
/* @__PURE__ */ie("td",{className:"px-3 h-11",children:/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
103
|
-
/* @__PURE__ */ie(Ee,{entry:e}),
|
|
104
|
-
/* @__PURE__ */ie("span",{className:"truncate",title:e.name,children:e.name})]})}),
|
|
105
|
-
/* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint text-xs truncate",title:e.originalPath,children:e.originalPath||"—"}),
|
|
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
|
-
/* @__PURE__ */ie("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":c(e.size)}),
|
|
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:()=>Ot(e),children:/* @__PURE__ */ie(B,{name:"revert",className:"h-4 w-4"})}),
|
|
110
|
-
/* @__PURE__ */ie(o,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>Wt(e),children:/* @__PURE__ */ie(B,{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
|
-
/* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[
|
|
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
|
-
/* @__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
|
-
/* @__PURE__ */ie("td",{className:"px-3 h-11",children:/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
117
|
-
/* @__PURE__ */ie(P,{item:e}),
|
|
118
|
-
/* @__PURE__ */ie("span",{className:"truncate",title:e.label,children:e.label})]})}),
|
|
119
|
-
/* @__PURE__ */ie("td",{className:"px-3 h-11 text-xs text-ink-faint",children:E(e)}),
|
|
120
|
-
/* @__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:[
|
|
121
|
-
/* @__PURE__ */ie(o,{"aria-label":"Open",size:"sm",onClick:()=>Mt(e),children:/* @__PURE__ */ie(B,{name:"external",className:"h-4 w-4"})}),
|
|
122
|
-
/* @__PURE__ */ie(o,{"aria-label":"Move to desktop",size:"sm",onClick:()=>kt?.moveToDesktop([e]),children:/* @__PURE__ */ie(B,{name:"desktop",className:"h-4 w-4"})}),
|
|
123
|
-
/* @__PURE__ */ie(o,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>kt?.removeShortcuts([e]),children:/* @__PURE__ */ie(B,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
|
|
124
|
-
return re("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Zt&&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(),Zt&&e.dataTransfer.files?.length&&Bt(e.dataTransfer.files))},children:[
|
|
125
|
-
/* @__PURE__ */ie(U,{title:jn}),
|
|
126
|
-
/* @__PURE__ */ie(C,{app:"files"}),
|
|
127
|
-
/* @__PURE__ */ie("input",{ref:vt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Bt(e.target.files),vt.current&&(vt.current.value="")}}),
|
|
128
|
-
/* @__PURE__ */ie("input",{ref:e=>{xt.current=e,e?.setAttribute("webkitdirectory","")},type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Bt(e.target.files,{withFolders:!0}),xt.current&&(xt.current.value="")}}),
|
|
129
|
-
/* @__PURE__ */ie("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */ie(t,{sidebar:Tn,storageKey:"files.sidebarWidth",defaultWidth:220,minWidth:170,maxWidth:320,children:/* @__PURE__ */re("div",{className:"flex h-full min-w-0",children:[
|
|
130
|
-
/* @__PURE__ */re("div",{className:"flex flex-1 min-w-0 flex-col",children:[Tt&&/* @__PURE__ */re("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-line bg-accent-tint text-accent-text text-sm shrink-0",role:"status",children:[
|
|
131
|
-
/* @__PURE__ */ie(B,{name:"cursor",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),
|
|
132
|
-
/* @__PURE__ */ie("span",{className:"flex-1 min-w-0 truncate",children:Tt.request.title}),
|
|
133
|
-
/* @__PURE__ */ie(Z,{variant:"secondary",size:"sm",onClick:()=>x(Tt.id,null),children:"Cancel"}),
|
|
134
|
-
/* @__PURE__ */ie(Z,{variant:"primary",size:"sm",disabled:!pn,onClick:()=>{pn&&fn(pn)},children:"Open"})]}),
|
|
135
|
-
/* @__PURE__ */re("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
|
|
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(B,{name:"search",className:"h-4 w-4"}),endAction:et?{label:"Clear search",icon:/* @__PURE__ */ie(B,{name:"close",className:"h-4 w-4"}),onClick:Et}:void 0})}),
|
|
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"===Xe,onClick:()=>ft("list"),children:/* @__PURE__ */ie(B,{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(B,{name:"grid",className:"h-4 w-4"})})]}),
|
|
140
|
-
/* @__PURE__ */ie(o,{"aria-label":"Details","aria-pressed":qe,onClick:()=>_e(e=>!e),children:/* @__PURE__ */ie(B,{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(),Xt(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),V(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Kn:"trash"===ot?Un:Wn})]}),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(B,{name:"revert",className:"h-4 w-4"}),onSelect:()=>Ot(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */ie(B,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Wt(St.state.data)}]}),Dt.state&&/* @__PURE__ */ie(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */ie(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */ie(B,{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(B,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),m&&/* @__PURE__ */ie(Ne,{store:n,entry:Qe,onClose:()=>Ze(null),onChanged:Pt}),n.move&&/* @__PURE__ */ie(Ce,{store:n,items:Be,from:"files"===ot?h:void 0,onClose:()=>He(null),onMove:e=>Be&&qt(Be,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{ze as default,Ae as quotaExceededMessage};
|
package/dist/Notepad-XJTIS3J5.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{getNumberingConfigs as e}from"./chunk-TT7KXS2Q.js";import{SidebarLayout as t}from"./chunk-MCLVTQSF.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-VLIXI42G.js";import{useWindowManager as o,client_default as i}from"./chunk-H2Q7G5D6.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-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-3ZX5DC2S.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.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(""),[X,U]=d(""),[R,I]=d("yellow"),[W,F]=d(!1),[Q,J]=d(!1),V=a(null),Z=a();p(()=>{if(!_&&w.length>0){const e=w[0];C(e.id),S(e.title),U(e.content),I(e.color)}},[w.length]);const $=m(e=>{N({notepad_notes:e})},[N]),A=m(()=>{if(!_||!W)return;const e=w.map(e=>e.id===_?{...e,title:D,content:X,color:R,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);$(e),F(!1)},[_,W,D,X,R,w,$]);p(()=>{if(W)return Z.current&&clearTimeout(Z.current),Z.current=setTimeout(A,800),()=>{Z.current&&clearTimeout(Z.current)}},[W,A]),p(()=>()=>{W&&A()},[]);const H=e=>{W&&A(),C(e.id),S(e.title),U(e.content),I(e.color),F(!1),J(!1)},K=e=>{const t=X.slice(0,e),r=X.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=X.slice(e+r[0].length);U(t+n+o),F(!0)},P=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.)",O=/* @__PURE__ */h(g,{children:[
|
|
2
|
-
/* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{W&&A();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(""),U(""),I("yellow"),F(!1),J(!0),setTimeout(()=>V.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
|
-
/* @__PURE__ */x(s,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
|
|
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:()=>H(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
|
-
/* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
|
|
7
|
-
/* @__PURE__ */x("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
|
|
8
|
-
/* @__PURE__ */x("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
|
|
9
|
-
/* @__PURE__ */x("p",{className:"text-xs text-ink-faintest mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
|
|
10
|
-
/* @__PURE__ */x("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
|
|
11
|
-
return h("div",{className:"h-full",children:[
|
|
12
|
-
/* @__PURE__ */x(n,{app:"notepad"}),
|
|
13
|
-
/* @__PURE__ */x(t,{sidebar:O,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
|
|
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?H(e):(C(null),S(""),U(""))}})(_),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:V,value:X,onChange:e=>{U(e.target.value),F(!0)},onBlur:()=>{J(!1),W&&A()},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:()=>{J(!0),setTimeout(()=>V.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:X?(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:()=>P(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:()=>K(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)})})(X):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:B})}),
|
|
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
|
-
/* @__PURE__ */x("span",{children:"[] checkbox"}),
|
|
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:[
|
|
23
|
-
/* @__PURE__ */x(s,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
|
|
24
|
-
/* @__PURE__ */x("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-GAEQYCLS.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-H2Q7G5D6.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-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as C}from"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.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 T,useRef as M,useCallback as P}from"react";import{jsxs as I,Fragment as A,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,$=5,E=15,J=!1,W=!1,Q=4,Y=!0,Z=!0,H="bell",G=100,K=1,X="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,$),longBreakMinutes:_(t.longBreakMinutes,1,120,E),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:J,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:W,longBreakInterval:_(t.longBreakInterval,1,20,Q),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:Y,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:Z,alarmSound:g.some(e=>e.id===t.alarmSound)?t.alarmSound:H,alarmVolume:_(t.alarmVolume,0,100,G),alarmRepeat:_(t.alarmRepeat,1,5,K),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:X,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]=T(()=>localStorage.getItem(R)),[re,se]=T(!1),[ie,le]=T(null),ce=M(!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=M(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]=T(()=>e(V)),[Se,we]=T(!1),[Be,Te]=T(Ce),[Me,Pe]=T(x);N(P(()=>{Te({...Ce}),Pe({...x}),we(!0)},[Ce,x]));const Ie="focus"!==t.mode,Ae=L[t.mode],De=Ie?(Ve=Ae,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:Ie?"text-white":"text-gray-900",secondary:Ie?"text-white/85":"text-gray-700",muted:Ie?"text-white/65":"text-gray-500",tabActive:Ie?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Ie?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Ie?"border-white/30":"border-gray-200",softDivider:Ie?"border-white/20":"border-gray-200",iconBtn:Ie?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Ie?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Le=Ie?Ae:"#0f172a";/* @__PURE__ */
|
|
2
|
-
return I(A,{children:[
|
|
3
|
-
/* @__PURE__ */I("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__ */I("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__ */I(A,{children:[
|
|
8
|
-
/* @__PURE__ */I("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__ */I("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__ */I("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 I("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__ */I("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__ */I("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__ */I("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__ */I("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${Fe.softDivider}`,children:[
|
|
26
|
-
/* @__PURE__ */I("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__ */I("span",{className:Fe.secondary,children:["Finish At: ",
|
|
30
|
-
/* @__PURE__ */D("span",{className:`font-bold ${Fe.primary}`,children:be}),
|
|
31
|
-
/* @__PURE__ */I("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:Me}),we(!1)},configAppearance:Be,setConfigAppearance:Te,configPrefs:Me,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 I(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:a,onAppearanceChange:r,onSave:n,children:[
|
|
34
|
-
/* @__PURE__ */I(ee,{icon:/* @__PURE__ */D(le,{}),label:"TIMER",children:[
|
|
35
|
-
/* @__PURE__ */I("div",{children:[
|
|
36
|
-
/* @__PURE__ */D("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
|
|
37
|
-
/* @__PURE__ */I("div",{className:"grid grid-cols-3 gap-3",children:[
|
|
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__ */I(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__ */I(ee,{icon:/* @__PURE__ */D(ue,{}),label:"SOUND",children:[
|
|
48
|
-
/* @__PURE__ */D(te,{label:"Alarm Sound",children:/* @__PURE__ */I("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__ */I("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 I("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
|
|
56
|
-
/* @__PURE__ */I("div",{className:"flex items-center gap-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 I("div",{className:"flex items-center justify-between gap-3",children:[
|
|
60
|
-
/* @__PURE__ */I("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 I("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 I("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 I("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 I("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 I("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 I("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]=T(""),[r,s]=T(1),i=()=>e(n,r);/* @__PURE__ */
|
|
84
|
-
return I("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__ */I("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__ */I("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};
|
package/dist/chunk-3ZX5DC2S.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r="13.24.0",a=r;export{a as APP_VERSION,r as VERSION};
|
package/dist/chunk-CJQPC2P3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{getActiveModalId as t}from"./chunk-F3ZOO23R.js";import{Icon as e}from"./chunk-ISVODSRP.js";import{Z_LAYERS as n}from"./chunk-62LW225J.js";import{useBrowserLayoutEffect as i}from"./chunk-ZDXRSY2Y.js";import{useShellStrings as o}from"./chunk-NRHG4R2Q.js";import{createContext as r,useContext as u,useRef as s,useState as l}from"react";import{jsx as d}from"react/jsx-runtime";var h=r(void 0),c=h.Provider;function a(t){const e=u(h);return t?void 0===e?document.body:e:null}function f(t,e){if("undefined"==typeof Element||!(t instanceof Element))return!1;const n=t.closest("[data-overlay-layer]");return null!==n&&!e?.contains(n)}var w="[data-modal-panel], [data-popup-panel]",v=16;function p(t,e){const n=Math.max(0,t.left),i=Math.max(0,t.top),o=Math.min(e.width,t.left+t.width),r=Math.min(e.height,t.top+t.height);return o-n<1||r-i<1?null:{left:n,top:i,width:o-n,height:r-i}}function m(t,e,n){return n<e?e:Math.min(Math.max(t,e),n)}function b(){return{width:window.innerWidth,height:window.innerHeight}}function g(t,e){const n=s(null),o=s(!1);t&&!o.current&&(n.current="undefined"==typeof document?null:document.activeElement),o.current=t;const[r,u]=l(null);return i(()=>{if(!t)return void u(null);const i=(o=e.current,r=n.current,o?.parentElement?.closest(w)??r?.closest(w)??null);var o,r;if(!i)return void u(null);const s=()=>{const t=i.getBoundingClientRect(),e=b(),n=p({left:t.left,top:t.top,width:t.width,height:t.height},e),o=null!==n&&n.width>=e.width-1&&n.height>=e.height-1;u(t=>{const e=o?null:n;return t===e||t&&e&&t.left===e.left&&t.top===e.top&&t.width===e.width&&t.height===e.height?t:e})};s(),window.addEventListener("resize",s);const l="undefined"==typeof ResizeObserver?null:new ResizeObserver(s);return l?.observe(i),()=>{window.removeEventListener("resize",s),l?.disconnect()}},[t,e]),r}function x(t,e){const[n,o]=l(null);return i(()=>{const n=e.current;if(!t||!n)return void o(null);const i=()=>{const e=function(t,e,n,i=16){return{left:m(t.left+t.width/2-e.width/2,i,n.width-i-e.width),top:m(t.top+t.height/2-e.height/2,i,n.height-i-e.height)}}(t,{width:n.offsetWidth,height:n.offsetHeight},b());o(t=>t&&t.left===e.left&&t.top===e.top?t:e)};i(),window.addEventListener("resize",i);const r="undefined"==typeof ResizeObserver?null:new ResizeObserver(i);return r?.observe(n),()=>{window.removeEventListener("resize",i),r?.disconnect()}},[t,e]),n}var y=/* @__PURE__ */new WeakMap;function z(t){if(!t)return null;const e=t.closest("[data-overlay-layer]");return e?y.get(e)??null:t.closest("[data-modal-panel]")}var R={host:null,box:null,z:0,hidden:!1};function E(t,e){const n=s(null),o=s(!1);t&&!o.current&&(n.current="undefined"==typeof document?null:document.activeElement),o.current=t;const[r,u]=l(R);return i(()=>{if(!t)return void u(R);const i=(o=e.current,r=n.current,z(o?.parentElement)??z(r));var o,r;if(!i)return void u(R);const s=()=>{const t=i.getBoundingClientRect(),e=getComputedStyle(i),n=p({left:t.left,top:t.top,width:t.width,height:t.height},{width:window.innerWidth,height:window.innerHeight}),o=Number.parseInt(e.zIndex,10),r={host:i,box:n,z:Number.isFinite(o)?o:0,hidden:null===n||"none"===e.display||"hidden"===e.visibility};u(t=>{return n=r,(e=t).host===n.host&&e.z===n.z&&e.hidden===n.hidden&&(e.box===n.box||null!==e.box&&null!==n.box&&e.box.left===n.box.left&&e.box.top===n.box.top&&e.box.width===n.box.width&&e.box.height===n.box.height)?t:r;var e,n})};s(),window.addEventListener("resize",s);const l="undefined"==typeof ResizeObserver?null:new ResizeObserver(s);l?.observe(i);const d="undefined"==typeof MutationObserver?null:new MutationObserver(s);return d?.observe(i,{attributes:!0,attributeFilter:["style","class"]}),()=>{window.removeEventListener("resize",s),l?.disconnect(),d?.disconnect()}},[t,e]),r}function O(e,n){const i=s(null);return i.current=i=>function(t,e,n,i){const o=t.host;if(!o)return!1;if(n&&e?.contains(n))return!1;const r=o.getAttribute("data-modal-id");if(i&&r&&i!==r)return!0;const u=z(n);return null!==u&&u!==o&&!o.contains(u)}(e,n,i,t()),n&&function(t,e){y.set(t,e)}(n,e.host),i}function k(t){return t.host?{zIndex:t.z+1,...t.hidden?{visibility:"hidden"}:{}}:{zIndex:n.overlay}}function M(t){if(!t.host||!t.box)return null;const{left:e,top:n,width:i,height:o}=t.box;return{left:e,top:n,width:i,height:o}}function L(t){return null!==t.host&&!t.host.hasAttribute("data-window-tab")}function j({onClose:t,className:n=""}){const i=o().dialog;/* @__PURE__ */
|
|
2
|
-
return d("button",{type:"button",onClick:t,"aria-label":i.close,className:(n?`${n} `:"")+"rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */d(e,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})}export{j as CloseButton,c as OverlayLayerProvider,v as POPUP_GUTTER,f as isInOverlayOver,k as popupLayerStyle,L as scrimHasCorners,a as useOverlayTarget,x as usePanelPosition,g as usePopupAnchor,E as usePopupLevel,O as usePopupLevelBindings,M as windowScrimStyle};
|
package/dist/chunk-M36B3M2H.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{useOverlayTarget as e,usePopupAnchor as i,usePopupLevel as t,usePopupLevelBindings as r,windowScrimStyle as o,OverlayLayerProvider as l,scrimHasCorners as n,CloseButton as d,popupLayerStyle as a}from"./chunk-CJQPC2P3.js";import{useDiscardGuard as s}from"./chunk-UAXL44HH.js";import{dialogA11y as m}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as c}from"./chunk-UVHXVSB2.js";import{useFocusTrap as p,useScrollLock as h}from"./chunk-DWGYC7OD.js";import{HEADING_TEXT as u,DESCRIPTION_TEXT as f,PANEL_SURFACE as b}from"./chunk-BWJZTHZ6.js";import{useHydrated as y}from"./chunk-WCCS4VFE.js";import{registerModalEscapeInterceptor as v}from"./chunk-TWVUQUUD.js";import{useRef as x,useId as w,useState as g,useEffect as k}from"react";import{createPortal as j}from"react-dom";import{jsxs as N,Fragment as C,jsx as W}from"react/jsx-runtime";var H={sm:"sm:w-[320px]",md:"sm:w-[448px]",lg:"sm:w-[640px]"},U={right:"inset-y-0 right-0",left:"inset-y-0 left-0",bottom:"inset-x-0 bottom-0"};function V(e,i){const t=window.innerHeight-(i.top+i.height);if("bottom"===e)return{left:i.left,width:i.width,bottom:t};const r={top:i.top,height:i.height};return"left"===e?{...r,left:i.left}:{...r,right:window.innerWidth-(i.left+i.width)}}function $({open:$,onClose:B,side:D="right",size:Z="md",title:z,description:A,footer:E,children:F,blocking:G=!1,dirty:J=!1,initialFocus:P,"aria-label":Q,"aria-labelledby":S,"aria-describedby":T,className:X=""}){const Y=x(null),I=w(),L=w(),O=w(),q=e(y()),[K,M]=g(null),R=s({open:$,dirty:J,onClose:B,title:z,layer:K}),_=x(null),ee=i($&&null!==q,_),ie=t($&&null!==q,_),te=r(ie,K),re=o(ie),oe=null!==ie.host;if(c($),p(Y,$&&null!==q,P,te),h($),k(()=>{if($)return v(()=>!te.current?.(document.activeElement)&&(G||R(),!0),()=>Y.current)},[$,G,R,te]),!$||!q)return null;const le="bottom"===D,ne={...le?{maxHeight:"85vh"}:{},...ee?V(D,ee):{}};/* @__PURE__ */
|
|
2
|
-
return N(C,{children:[/* @__PURE__ */W("span",{ref:_,hidden:!0,"data-popup-anchor":""}),j(
|
|
3
|
-
/* @__PURE__ */W(l,{value:K,children:/* @__PURE__ */N("div",{ref:M,className:oe?"fixed inset-0 pointer-events-none":"fixed inset-0",style:a(ie),role:"presentation","data-overlay-layer":"",children:[
|
|
4
|
-
/* @__PURE__ */W("div",{className:"fixed bg-black/30 backdrop-blur-sm "+(oe?"pointer-events-auto"+(n(ie)?" rounded-(--radius-window)":""):"inset-0"),style:re??void 0,hidden:oe&&!re,onClick:G?void 0:R,"aria-hidden":"true","data-popup-scrim":oe?"window":"system"}),
|
|
5
|
-
/* @__PURE__ */N("div",{ref:Y,...m({modal:!0,titleId:z?O:void 0,labelledBy:S,label:Q}),"aria-describedby":T??(A?L:F?I:void 0),"data-drawer-side":D,"data-popup-panel":"",style:ne,className:[`fixed flex flex-col ${b}`,oe?"pointer-events-auto":"",le?"":`w-full max-w-full ${H[Z]}`,ee?"":U[D],le?"rounded-t-xl":"",X].filter(Boolean).join(" "),children:[z?/* @__PURE__ */N("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3",children:[
|
|
6
|
-
/* @__PURE__ */N("div",{className:"min-w-0",children:[
|
|
7
|
-
/* @__PURE__ */W("h2",{id:O,className:u,children:z}),A&&/* @__PURE__ */W("p",{id:L,className:`mt-0.5 ${f}`,children:A})]}),!G&&/* @__PURE__ */W(d,{onClose:R})]}):!G&&/* @__PURE__ */W("div",{className:"absolute right-2 top-2 z-10",children:/* @__PURE__ */W(d,{onClose:R})}),
|
|
8
|
-
/* @__PURE__ */N("div",{id:I,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[A&&!z&&/* @__PURE__ */W("p",{id:L,className:`mb-3 ${f} ${G?"":"pr-8"}`.trim(),children:A}),F]}),E&&/* @__PURE__ */W("div",{className:"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3",children:E})]})]})}),q)]})}export{$ as Drawer};
|
package/dist/chunk-MRZLFZNJ.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{useOverlayTarget as e,usePopupAnchor as r,usePanelPosition as l,usePopupLevel as t,usePopupLevelBindings as i,windowScrimStyle as a,OverlayLayerProvider as o,scrimHasCorners as n,CloseButton as s,popupLayerStyle as d,POPUP_GUTTER as c}from"./chunk-CJQPC2P3.js";import{useDiscardGuard as m}from"./chunk-UAXL44HH.js";import{dialogA11y as p}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as u}from"./chunk-UVHXVSB2.js";import{useFocusTrap as f,useScrollLock as h}from"./chunk-DWGYC7OD.js";import{HEADING_TEXT as x,DESCRIPTION_TEXT as v,PANEL_SURFACE as b}from"./chunk-BWJZTHZ6.js";import{useHydrated as w}from"./chunk-WCCS4VFE.js";import{registerModalEscapeInterceptor as y}from"./chunk-TWVUQUUD.js";import{useShellStrings as $}from"./chunk-NRHG4R2Q.js";import{useRef as g,useId as N,useState as j,useEffect as k}from"react";import{createPortal as C}from"react-dom";import{jsxs as H,Fragment as W,jsx as U}from"react/jsx-runtime";var V=`calc(100% - ${2*c}px)`,B="grid grid-cols-[minmax(0,1fr)_auto]",A="bg-black/30 backdrop-blur-sm",D={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl","2xl":"max-w-6xl",full:"max-w-none"};function E({open:c,onClose:E,title:G,description:Q,role:T="dialog",children:Z,footer:_,headerActions:F,blocking:J=!1,size:P="md",aside:R=!1,dirty:S=!1,initialFocus:X,"aria-label":Y,"aria-labelledby":z,"aria-describedby":I,className:L=""}){const O=g(null),q=N(),K=N(),M=!J,ee="full"===P,re=ee||null!=F,le=Boolean(G||Q),te=N();$().dialog;const ie=e(w()),[ae,oe]=j(null),ne=m({open:c,dirty:S,onClose:E,title:G,layer:ae}),se=g(null),de=r(c&&null!==ie,se),ce=l(de,O),me=t(c&&null!==ie,se),pe=i(me,ae),ue=a(me),fe=null!==me.host;if(u(c),f(O,c&&null!==ie,X,pe),h(c),k(()=>{if(c)return y(()=>!pe.current?.(document.activeElement)&&(J||ne(),!0),()=>O.current)},[c,J,ne,pe]),!c||!ie)return null;/* @__PURE__ */
|
|
2
|
-
return H(W,{children:[/* @__PURE__ */U("span",{ref:se,hidden:!0,"data-popup-anchor":""}),C(
|
|
3
|
-
/* @__PURE__ */U(o,{value:ae,children:/* @__PURE__ */H("div",{ref:oe,className:"fixed inset-0"+(R?" pointer-events-none opacity-0":fe?" pointer-events-none":""),style:d(me),role:"presentation","data-overlay-layer":"","data-aside":R?"":void 0,children:[!fe&&/* @__PURE__ */U("div",{className:`fixed inset-0 ${A}`,"aria-hidden":"true","data-popup-scrim":"system"}),ue&&/* @__PURE__ */U("div",{className:`fixed ${A}${R?"":" pointer-events-auto"}${n(me)?" rounded-(--radius-window)":""}`,style:ue,onClick:J?void 0:ne,"aria-hidden":"true","data-popup-scrim":"window"}),
|
|
4
|
-
/* @__PURE__ */U("div",{className:de?"fixed inset-0":"fixed inset-0 flex items-center justify-center p-4",onClick:J||fe?void 0:e=>{e.target===e.currentTarget&&ne()},children:/* @__PURE__ */H("div",{ref:O,"data-popup-panel":"",style:de?{left:ce?.left??0,top:ce?.top??0,visibility:ce?void 0:"hidden",width:V,[ee?"height":"maxHeight"]:V}:void 0,...p({role:T,modal:!0,titleId:G?te:void 0,labelledBy:z,label:Y}),"aria-describedby":I??(Q?K:Z?q:void 0),className:(ee?`${de?"absolute":"relative h-full w-full max-h-full"} ${D[P]} ${B} grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-(--radius-popup) ${b}`:`${de?"absolute":"relative max-h-full w-full"} ${D[P]}${re?` ${B} content-start gap-x-2`:""} overflow-y-auto overscroll-contain rounded-(--radius-card) ${b} p-6`)+`${fe&&!R?" pointer-events-auto":""} ${L}`.trimEnd(),children:[ee?le&&
|
|
5
|
-
/* @__PURE__ */H("div",{className:"col-start-1 row-start-1 flex min-h-(--row-height-window-bar) flex-col justify-center border-b border-line py-2 pl-6 pr-4",children:[G&&/* @__PURE__ */U("h2",{id:te,className:x,children:G}),Q&&/* @__PURE__ */U("p",{id:K,className:`${G?"mt-1 ":""}${v}`,children:Q})]}):G&&/* @__PURE__ */U("h2",{id:te,className:`${re?"col-start-1 row-start-1 ":M?"pr-8 ":""}${x}`,children:G}),!ee&&Q&&/* @__PURE__ */U("p",{id:K,className:`${re?"col-start-1 ":""}${G?"mt-1":M&&!re?"pr-8":""} ${v}`.trim(),children:Q}),Z&&/* @__PURE__ */U("div",{id:q,className:ee?"col-span-2 row-start-2 min-h-0 overflow-auto":(re?"col-span-2 ":"")+"mt-2 text-sm text-gray-600",children:Z}),_&&/* @__PURE__ */U("div",{className:ee?"col-span-2 row-start-3 flex flex-wrap justify-end gap-3 border-t border-line px-6 py-4":(re?"col-span-2 ":"")+"mt-6 flex flex-wrap justify-end gap-3",children:_}),re?
|
|
6
|
-
/* @__PURE__ */H("div",{className:"col-start-2 row-start-1 flex items-center gap-1 "+(ee?(le?"border-b border-line ":"")+"pr-3":"-mr-3 -mt-3 self-start"),children:[F,M&&/* @__PURE__ */U(s,{onClose:ne})]}):M&&/* @__PURE__ */U(s,{onClose:ne,className:"absolute right-3 top-3"})]})})]})}),ie)]})}export{E as Dialog};
|
package/dist/chunk-OFMZ6JM6.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{nextEnabledIndex as e}from"./chunk-EO5RLFRX.js";import{flattenOptionItems as t,filterOptionItems as n,optionMatches as r,groupedRows as l,OptionCheck as o,OptionSublabel as i}from"./chunk-K5YT5PMJ.js";import{END_ACTIONS_PAD as a,InputEndActionSlot as s,InputEndActionButton as c}from"./chunk-J5OAQAAD.js";import{INPUT_BASE_ON as u,INPUT_BASE as d}from"./chunk-AYZY3YNC.js";import{Button_default as h}from"./chunk-UTISUEO4.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import{Tooltip as f}from"./chunk-F2RAIGCG.js";import{onOverlayOpen as b}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as v,MENU_MAX_HEIGHT as w}from"./chunk-VY3UA6AR.js";import{useBrowserLayoutEffect as y}from"./chunk-ZDXRSY2Y.js";import{registerModalEscapeInterceptor as x}from"./chunk-TWVUQUUD.js";import{GLASS_DIVIDER as k,glassStyle as j}from"./chunk-5FYDNH4Y.js";import{useShellStrings as $}from"./chunk-NRHG4R2Q.js";import{useState as N,useId as D,useRef as C,useMemo as S,useEffect as R}from"react";import{createPortal as A}from"react-dom";import{jsxs as W,jsx as M}from"react/jsx-runtime";function E(e,t){const n=e.length;if(0===n||t(e.join(", ")))return{shown:n,cut:!1};if(1===n)return{shown:1,cut:!0};let r=0;for(let l=1;l<n&&t(`${e.slice(0,l).join(", ")} +${n-l}`);l+=1)r=l;return{shown:r,cut:!1}}var F=["right-2","right-8","right-16"],O=[8,32,64];function T(T){const{options:Y,placeholder:z,emptyOptionLabel:I,className:L="",disabled:U,id:H,filter:G=!1,allowFreeText:V=!1,freeTextOption:B,onSearchChange:J,loading:K=!1,error:P,onRetry:Q,rightAdornment:Z,endAction:X,renderOption:q,clearable:_=!0,"aria-label":ee,"aria-labelledby":te,"aria-describedby":ne}=T,re=!0===T.multiple,le=T.multiple?T.value:T.value?[T.value]:[],oe=T.multiple?"":T.value,ie=e=>{T.multiple?T.onChange(e):T.onChange(e[0]??"")},ae=le.length>0,se=G&&ae&&!U,ce=re||G,ue=null!=B,de=V||ue,[he,pe]=N(!1),[me,fe]=N(-1),be=D(),ge=H??`${be}-input`,ve=`${be}-listbox`,we=e=>`${be}-opt-${e}`,[ye,xe]=N(""),ke=$(),je=I??ke.select.none,$e=e=>{xe(e),fe(-1),J?.(e)},Ne=C(null),De=C(null),Ce=C(null),Se=C(null),Re=C(he);Re.current=he;const Ae=C(!1),We=e=>{Re.current&&(Re.current=!1,e&&V&&!ue&&et&&(re?le.includes(et)||ie([...le,et]):et!==oe&&ie([et])),pe(!1),$e(""))},Me=(e,t)=>{if(!e.disabled){if(re)return ie(le.includes(e.value)?le.filter(t=>t!==e.value):[...le,e.value]),void(e===tt?$e(""):fe(t));ie([e.value]),We(!1)}},[Ee,Fe]=N(null);y(()=>{if(!Z||he)return void Fe(null);const e=Se.current?.offsetWidth??0;Fe(e?e+O[Ue]+6:null)});const Oe=v(De,he,ce?{popupRef:Ce}:{matchTriggerWidth:!0}),Te=S(()=>t(Y),[Y]),Ye=le.join("\0"),ze=S(()=>{const e=[],t=/* @__PURE__ */new Set;for(const n of Te)le.includes(n.value)&&!t.has(n.value)&&(t.add(n.value),e.push(n.label));if(de)for(const n of le)t.has(n)||e.push(n);return e},[Te,Ye,de]),Ie=ze.join(", "),Le=_&&ae&&!U,Ue=(Le?1:0)+(X?1:0),[He,Ge]=N(null),Ve=C(null),Be=C(""),Je=C(()=>{});Je.current=()=>{const e=De.current,t=Ve.current;if(!re||!e||!t)return;const n=getComputedStyle(e),r=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),l=[n.fontStyle,n.fontWeight,n.fontSize,n.fontFamily,n.letterSpacing].join("|"),o=`${r}|${l}|${ze.join("\0")}`;if(o===Be.current)return;Be.current=o;let i=null;r>0&&ze.length>0&&(t.style.fontStyle=n.fontStyle,t.style.fontWeight=n.fontWeight,t.style.fontSize=n.fontSize,t.style.fontFamily=n.fontFamily,t.style.letterSpacing=n.letterSpacing,i=E(ze,e=>(t.textContent=e,t.getBoundingClientRect().width<=r)),t.textContent=""),Ge(e=>e?.shown===i?.shown&&e?.cut===i?.cut?e:i)},y(()=>{Je.current()}),R(()=>{const e=De.current;if(!re||!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Je.current());return t.observe(e),()=>t.disconnect()},[re]);const Ke=ze.length,Pe=!re||!He||He.shown>=Ke?Ie:0===He.shown?ke.select.selectedCount(Ke):`${ze.slice(0,He.shown).join(", ")} +${Ke-He.shown}`,Qe=re&&null!==He&&(He.shown<Ke||He.cut),Ze=he&&ae&&ce;R(()=>{if(!he)return;const e=e=>{const t=e.target;Ne.current?.contains(t)||Ce.current?.contains(t)||We(!0)};document.addEventListener("mousedown",e);const t=b(()=>We(!0));return()=>{document.removeEventListener("mousedown",e),t()}},[he,V,ye,Ye,T.onChange]),R(()=>{if(he)return x(e=>!("Escape"!==e.key||!Re.current)&&(We(!1),De.current?.blur(),!0),()=>Ce.current)},[he]);const Xe=S(()=>{const e=/* @__PURE__ */new Set;return n(Y,t=>!e.has(t.value)&&(e.add(t.value),!0))},[Y]),qe=S(()=>{if(J)return Xe;const e=ye.trim().toLowerCase();return e?n(Xe,t=>r(t,e)):Xe},[Xe,ye,J]),_e=S(()=>t(qe),[qe]),et=ye.trim(),tt=S(()=>ue&&et?Te.some(e=>e.label===et)||le.includes(et)?null:{value:et,label:et}:null,[ue,et,Te,Ye]),nt=S(()=>tt?[..._e,tt]:_e,[_e,tt]);/* @__PURE__ */
|
|
2
|
-
return W("div",{ref:Ne,className:"relative group",onBlur:e=>{const t=e.relatedTarget;t&&(Ne.current?.contains(t)||Ce.current?.contains(t))||Ae.current||document.activeElement!==De.current&&We(!0)},children:[(rt=/* @__PURE__ */M("input",{id:ge,ref:De,type:"text",autoComplete:"off",role:"combobox","aria-expanded":he,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":he?ve:void 0,"aria-activedescendant":he&&me>=0&&me<nt.length?we(me):void 0,"aria-label":te?void 0:ee,"aria-labelledby":te,"aria-describedby":ne,value:he?ye:Pe,onChange:e=>{$e(e.target.value),pe(!0)},onFocus:()=>{U||($e(""),pe(!0))},onKeyDown:t=>{if("ArrowDown"===t.key||"ArrowUp"===t.key){if(U)return;if(t.preventDefault(),!he)return void pe(!0);if(0===nt.length)return;const n="ArrowDown"===t.key?1:-1;return void fe(t=>e(nt,t,n))}"Enter"===t.key?(t.preventDefault(),he&&me>=0&&me<nt.length?Me(nt[me],me):1!==_e.length||_e[0].disabled?V&&!ue&&et&&(re?(le.includes(et)||ie([...le,et]),$e("")):(ie([et]),We(!1),De.current?.blur())):Me(_e[0],0)):"Escape"===t.key?(We(!1),De.current?.blur()):"Tab"===t.key&&We(!0)},placeholder:Ze?Pe:z||je,className:`${se?u:d} ${L} ${a[Ue]}${U?"bg-surface-sunken text-ink-faintest cursor-not-allowed":""} truncate${Ze?" rosh-field-shows-choice":""}`,style:Ee?{paddingRight:Ee}:void 0,disabled:U}),re?/* @__PURE__ */M(f,{content:!he&&Qe?Ie:null,className:"block",children:rt}):rt),re&&
|
|
3
|
-
/* @__PURE__ */M("div",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 w-0 overflow-hidden",children:/* @__PURE__ */M("span",{ref:Ve,className:"whitespace-pre"})}),Ue>0&&
|
|
4
|
-
/* @__PURE__ */W(s,{children:[Le&&
|
|
5
|
-
/* @__PURE__ */M("span",{onMouseDown:e=>e.preventDefault(),className:"flex opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",children:/* @__PURE__ */M(c,{action:{label:ke.select.clear,icon:/* @__PURE__ */M(p,{name:"close"}),onClick:()=>{ie([]),We(!1)}}})}),X&&/* @__PURE__ */M("span",{onMouseDown:e=>e.preventDefault(),className:"flex",children:/* @__PURE__ */M(c,{action:X})})]}),Z&&!he&&/* @__PURE__ */M("div",{ref:Se,className:`absolute top-1/2 -translate-y-1/2 ${F[Ue]} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`,children:Z}),he&&A(
|
|
6
|
-
/* @__PURE__ */W("div",{ref:Ce,onMouseDownCapture:()=>{Ae.current=!0,setTimeout(()=>{Ae.current=!1},0)},className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:g.popup,left:Oe?.left,right:Oe?.right,top:Oe?.top,bottom:Oe?.bottom,minWidth:Oe?.minWidth,width:Oe?.width,...ce&&{maxWidth:Oe?.maxWidth},visibility:Oe?void 0:"hidden",...j()},children:[re&&ae&&_&&!U&&
|
|
7
|
-
/* @__PURE__ */M("button",{type:"button",tabIndex:-1,onMouseDown:e=>{e.preventDefault(),ie([])},className:`block w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-600 hover:bg-row-hover border-b ${k}`,children:ke.select.clearAll}),K?
|
|
8
|
-
/* @__PURE__ */M(m,{size:"sm",padding:"py-2",label:ke.search.searching}):P?/* @__PURE__ */W("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600",children:[
|
|
9
|
-
/* @__PURE__ */M("span",{className:"min-w-0 flex-1",children:P}),Q&&/* @__PURE__ */M(h,{variant:"link",size:"sm",onMouseDown:e=>e.preventDefault(),onClick:Q,className:"shrink-0",children:ke.list.retry})]}):null,
|
|
10
|
-
/* @__PURE__ */W("div",{id:ve,role:nt.length?"listbox":void 0,"aria-labelledby":nt.length?te??(ee?void 0:ge):void 0,"aria-label":nt.length&&!te?ee:void 0,"aria-multiselectable":!(!nt.length||!re)||void 0,className:"overflow-y-auto",style:{maxHeight:Oe?.maxHeight??w},children:[0===nt.length?K||P?null:/* @__PURE__ */M("p",{className:"px-3 py-3 text-sm text-ink-faintest text-center",children:ke.select.noMatches}):0===_e.length?null:l(qe,(e,t)=>{const n=le.includes(e.value);/* @__PURE__ */
|
|
11
|
-
return W("button",{id:we(t),type:"button",role:"option","aria-selected":n,"aria-disabled":e.disabled||void 0,tabIndex:-1,onMouseDown:n=>{(e.disabled||re)&&n.preventDefault(),Me(e,t)},className:"w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center justify-between gap-2 whitespace-nowrap "+(e.disabled?"cursor-not-allowed text-gray-400":`hover:bg-gray-50 ${n?"text-blue-600 font-medium":"text-gray-700"} ${t===me?"bg-gray-100":n?"bg-blue-50/50":""}`),children:[re&&/* @__PURE__ */M(o,{selected:n}),
|
|
12
|
-
/* @__PURE__ */M("span",{className:`min-w-0 ${ce?"flex-auto":"flex-1"} truncate`,children:q?q(e,{selected:n,active:t===me}):e.label}),e.sublabel&&/* @__PURE__ */M(i,{grows:ce,children:e.sublabel})]},e.value)},be),tt&&B&&
|
|
13
|
-
/* @__PURE__ */M("button",{id:we(_e.length),type:"button",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:e=>{re&&e.preventDefault(),Me(tt,_e.length)},className:`w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 whitespace-nowrap text-ink hover:bg-row-hover ${_e.length?`border-t ${k}`:""} ${me===_e.length?"bg-gray-100":""}`,children:/* @__PURE__ */M("span",{className:"min-w-0 flex-1 truncate",children:B(tt.value)})},`${be}-typed`)]})]}),document.body)]});var rt}export{T as SearchableSelect,E as fitChoice};
|