efficient-shell 4.180.0 → 5.0.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 +13 -1
- package/dist/Browser-5F5LWXYQ.js +43 -0
- package/dist/Calculator-4K53PFBL.js +29 -0
- package/dist/ConfirmDialog-X2DPOYWO.js +1 -0
- package/dist/{CurrencyConverter-AMXUOQR2.js → CurrencyConverter-QEG6RFAS.js} +9 -9
- package/dist/Documents-6DEUZVVA.js +52 -0
- package/dist/Files-2VSFXA45.js +87 -0
- package/dist/Notepad-KNJRTYXR.js +25 -0
- package/dist/PdfViewer-UZGDE4HD.js +1 -0
- package/dist/PomodoroTimer-T6YAQFIE.js +91 -0
- package/dist/Preview-KEIDYSHF.js +182 -0
- package/dist/Sidebar-3NZRIL7F.js +44 -0
- package/dist/Spreadsheet-HKXSYD5B.js +37 -0
- package/dist/{Stock-GWVG2INU.js → Stock-BZFC2ROU.js} +6 -6
- package/dist/{Weather-APBCG4TO.js → Weather-S3N5OWYF.js} +17 -17
- package/dist/{WorldClock-2LMZYKWR.js → WorldClock-ACC3S6OA.js} +4 -4
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-FORN7LG7.js → chunk-2DX65GOO.js} +1 -1
- package/dist/{chunk-6CFBF543.js → chunk-5IWSOLLY.js} +2 -2
- package/dist/chunk-67PNFBCW.js +993 -0
- package/dist/chunk-FOEVG7RT.js +21 -0
- package/dist/chunk-GMMTTWHB.js +3 -0
- package/dist/chunk-LMIQV3NB.js +13 -0
- package/dist/{chunk-SVO3ES2E.js → chunk-MIAJQGWE.js} +1 -1
- package/dist/{chunk-ILTSTULF.js → chunk-P4SGJTK3.js} +1 -1
- package/dist/chunk-PQLVWCUI.js +11 -0
- package/dist/chunk-QRV7RNQX.js +24 -0
- package/dist/chunk-SBDIHKLU.js +108 -0
- package/dist/chunk-TKUNR5KP.js +9 -0
- package/dist/chunk-VJP3R52B.js +6 -0
- package/dist/chunk-XUF7VW4U.js +136 -0
- package/dist/chunk-YKHMAGEM.js +1 -0
- package/dist/chunk-ZDF5AR5W.js +10 -0
- package/dist/chunk-ZZKIKW62.js +29 -0
- package/dist/{index-HAwjA-hn.d.ts → index-HMDUOPnX.d.ts} +29 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +639 -656
- package/dist/map/index.js +22 -22
- package/dist/markdown/index.js +6 -6
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Browser-RZFOKBSF.js +0 -43
- package/dist/Calculator-R5OEHQ67.js +0 -29
- package/dist/ConfirmDialog-CMNQZQA3.js +0 -1
- package/dist/Documents-VD32HWDQ.js +0 -52
- package/dist/Files-NAY3WK6O.js +0 -89
- package/dist/Notepad-AHRPMF57.js +0 -25
- package/dist/PdfViewer-3SC3LE4U.js +0 -1
- package/dist/PomodoroTimer-LE6J2KUU.js +0 -99
- package/dist/Preview-OKR5QRQP.js +0 -188
- package/dist/Sidebar-BQ4P5LBI.js +0 -44
- package/dist/Spreadsheet-RME4IQ43.js +0 -37
- package/dist/chunk-4VTHXNGZ.js +0 -1003
- package/dist/chunk-5ZDM6WIC.js +0 -24
- package/dist/chunk-7WZEFHPS.js +0 -6
- package/dist/chunk-AA4TMQOS.js +0 -10
- package/dist/chunk-BSJIBRWC.js +0 -1
- package/dist/chunk-C2A4PIGZ.js +0 -13
- package/dist/chunk-CIXQKCFA.js +0 -11
- package/dist/chunk-KVOFUFPP.js +0 -3
- package/dist/chunk-N6STBYXR.js +0 -112
- package/dist/chunk-RQOP5JAJ.js +0 -9
- package/dist/chunk-UAIVAA5X.js +0 -21
- package/dist/chunk-ZAE6ROV7.js +0 -29
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{useCopyText as e,CopyGlyph as t}from"./chunk-GMMTTWHB.js";import{PopupMenu as n,PopupMenuItem as r,PopupMenuDivider as l}from"./chunk-ZDF5AR5W.js";import{CloseFallbackC as i}from"./chunk-XUF7VW4U.js";import{useShellStrings as a}from"./chunk-J3LIIIHJ.js";import{Icon as o}from"./chunk-YKZHOXI4.js";import{useState as s,useEffect as c,Fragment as d}from"react";import{jsxs as m,jsx as u,Fragment as p}from"react/jsx-runtime";var y="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500";function h(){/* @__PURE__ */
|
|
2
|
+
return u(o,{name:"close",fallback:i,"aria-hidden":"true",className:"size-3.5"})}function b({text:n,label:r,copiedLabel:l}){const{copied:i,copy:a}=e(n);/* @__PURE__ */
|
|
3
|
+
return u("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */u(t,{copied:i,className:"size-3.5"})})}function f({tabs:e,activeKey:t,idFor:i,panelMounted:o,onActivate:f,onClose:g,onCloseMany:x,label:k,className:v,activeClassName:w,end:N,onIconMenu:C,menuItems:I}){const j=a().pageTabs,[$,z]=s(null),M=e.length;c(()=>{if(!t)return;const e=document.getElementById(i(t,"tab"));e?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[i,t,M]);const D=e.some(e=>e.key===t)?t:e[0]?.key,A=t=>{const n=e[(t+e.length)%e.length];n&&document.getElementById(i(n.key,"tab"))?.focus()},_=$?e.find(e=>e.key===$.key):void 0,B=_&&I?I(_.key):[],T=_?e.indexOf(_):-1,E=e=>e.some(e=>!e.pinned),F=e=>()=>{z(null),e()};/* @__PURE__ */
|
|
4
|
+
return m("div",{className:v??"relative flex h-10 shrink-0 items-end gap-3 bg-gray-100 px-3",children:[
|
|
5
|
+
/* @__PURE__ */u("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-px bg-gray-200"}),
|
|
6
|
+
/* @__PURE__ */u("div",{role:"tablist","aria-label":k,onKeyDown:t=>{const n=e.findIndex(e=>document.getElementById(i(e.key,"tab"))===t.target);if(!(n<0)){if("ArrowRight"===t.key)A(n+1);else if("ArrowLeft"===t.key)A(n-1);else if("Home"===t.key)A(0);else if("End"===t.key)A(e.length-1);else{if("Delete"!==t.key||e[n].pinned)return;g(e[n].key)}t.preventDefault()}},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map((n,r)=>{const l=n.key===t,a=!!n.dirty,s=n.icon,c=l?w??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",p=r>0&&!l&&e[r-1].key!==t,x={type:"button",role:"tab",id:i(n.key,"tab"),"aria-selected":l,"aria-controls":o?.(n.key)?i(n.key,"panel"):void 0,tabIndex:n.key===D?0:-1,title:n.title,onClick:()=>f(n.key)},k={onContextMenu:e=>((e,t)=>{e.preventDefault(),z({x:e.clientX,y:e.clientY,key:t.key})})(e,n),onAuxClick:e=>((e,t)=>{1!==e.button||t.pinned||(e.preventDefault(),g(t.key))})(e,n),onMouseDown:e=>{1===e.button&&e.preventDefault()}},v=s&&
|
|
7
|
+
/* @__PURE__ */m("span",{className:"relative flex size-4 shrink-0 items-center justify-center text-gray-500 [&>svg]:size-4","aria-hidden":"true",children:[s,a&&!l&&!n.pinned&&
|
|
8
|
+
/* @__PURE__ */u("span",{className:"absolute -right-1 -top-1 hidden size-2 rounded-full bg-gray-500 ring-2 ring-gray-100 @max-[6.5rem]:block @max-[6.5rem]:group-hover:hidden"})]}),N=l&&!!C&&!!s;return n.pinned?/* @__PURE__ */u("div",{role:"presentation",className:`group relative flex h-9 flex-none items-center justify-center rounded-t-md border border-b-0 transition-colors ${s?"w-10":""} ${c}`,...k,children:/* @__PURE__ */m("button",{...x,className:`flex h-full items-center justify-center rounded-t-md ${s?"w-full":"px-3"} ${y}`,children:[v,
|
|
9
|
+
/* @__PURE__ */u("span",{className:s?"sr-only":"whitespace-nowrap text-[13px]",children:n.title})]})},n.key):/* @__PURE__ */m(d,{children:[p&&/* @__PURE__ */u("span",{"aria-hidden":"true",className:"mb-2.5 h-4 w-px shrink-0 self-end border-l border-gray-300"}),
|
|
10
|
+
/* @__PURE__ */m("div",{role:"presentation",className:`group @container relative flex h-9 items-center rounded-t-md border border-b-0 text-[13px] transition-colors ${l&&(n.copy||N)?"flex-[0_1_20rem]":"flex-[0_1_15rem]"} ${l?"min-w-[4.25rem]":"min-w-[2.75rem]"} ${c}`,...k,children:[N&&
|
|
11
|
+
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-label":j.tabMenu,title:j.tabMenu,onClick:e=>{const t=e.currentTarget.getBoundingClientRect();C?.(n.key,t.left,t.bottom+4)},className:`ml-2 flex size-6 shrink-0 items-center justify-center rounded hover:bg-gray-200 @max-[5rem]:ml-1.5 ${y}`,children:v}),
|
|
12
|
+
/* @__PURE__ */m("button",{...x,className:`flex h-full min-w-0 flex-1 items-center gap-2 rounded-t-md pr-1 text-left ${N?"pl-1.5":"pl-3"} ${y} ${l?N?"":"@max-[5rem]:pl-2.5":"@max-[6.5rem]:pr-3 @max-[6.5rem]:group-hover:pr-1 @max-[4.5rem]:justify-center @max-[4.5rem]:px-0 @max-[4.5rem]:group-hover:pl-1.5"}`,children:[!N&&v,
|
|
13
|
+
/* @__PURE__ */u("span",{className:"min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] "+(s?l?"@max-[5rem]:sr-only":"@max-[4.5rem]:sr-only":""),children:n.title})]}),l&&n.copy&&/* @__PURE__ */u(b,{text:n.copy,label:j.copy(n.copy),copiedLabel:j.copied}),
|
|
14
|
+
/* @__PURE__ */m("span",{className:"mr-1.5 flex size-5 shrink-0 items-center justify-center "+(l?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[a&&/* @__PURE__ */u("span",{role:"img","aria-label":j.unsaved,className:"size-2 rounded-full bg-gray-500 group-hover:hidden"}),
|
|
15
|
+
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-label":j.closeTab?.(n.title)??`${j.close} ${n.title}`,onClick:()=>g(n.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(a?"hidden group-hover:flex":l?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */u(h,{})})]})]})]},n.key)})}),N&&/* @__PURE__ */u("div",{className:"flex shrink-0 items-center gap-2 self-center",children:N}),$&&_&&/* @__PURE__ */m(n,{portal:!0,style:{left:$.x,top:$.y},onClose:()=>z(null),children:[B.length>0&&/* @__PURE__ */m(p,{children:[B.map((e,t)=>/* @__PURE__ */m(r,{onClick:F(e.onSelect),children:[e.icon,e.label]},t)),
|
|
16
|
+
/* @__PURE__ */u(l,{})]}),
|
|
17
|
+
/* @__PURE__ */u(r,{disabled:_.pinned,onClick:F(()=>g(_.key)),children:j.close}),
|
|
18
|
+
/* @__PURE__ */u(l,{}),
|
|
19
|
+
/* @__PURE__ */u(r,{disabled:!E(e.filter(e=>e.key!==_.key)),onClick:F(()=>x("others",_.key)),children:j.closeOthers}),
|
|
20
|
+
/* @__PURE__ */u(r,{disabled:!E(e.slice(T+1)),onClick:F(()=>x("right",_.key)),children:j.closeRight}),
|
|
21
|
+
/* @__PURE__ */u(r,{disabled:!E(e),onClick:F(()=>x("all",null)),children:j.closeAll})]})]})}export{f as TabStrip};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{CheckFallbackC as e,CopyFallback as t}from"./chunk-XUF7VW4U.js";import{useShellStrings as r}from"./chunk-J3LIIIHJ.js";import{Icon as o}from"./chunk-YKZHOXI4.js";import{useState as c,useRef as a,useEffect as i,useCallback as n}from"react";import{jsx as u}from"react/jsx-runtime";function m(e){const[t,r]=c(!1),o=a(void 0);i(()=>()=>clearTimeout(o.current),[]);return{copied:t,copy:n(t=>{t?.stopPropagation(),navigator.clipboard?.writeText(e).then(()=>{r(!0),clearTimeout(o.current),o.current=setTimeout(()=>r(!1),1500)},()=>{})},[e])}}function p({copied:r,className:c="w-4 h-4"}){/* @__PURE__ */
|
|
2
|
+
return u(o,r?{name:"check",fallback:e,className:`${c} text-green-600`,"aria-hidden":"true"}:{name:"copy",fallback:t,className:c,"aria-hidden":"true"})}function s({text:e}){const{copied:t,copy:o}=m(e),c=r().copy;/* @__PURE__ */
|
|
3
|
+
return u("button",{onClick:o,title:t?c.copiedValue:c.copyValue(e),className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:/* @__PURE__ */u(p,{copied:t})})}export{s as CopyButton,p as CopyGlyph,m as useCopyText};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{navIcons as e}from"./chunk-DSSLOQDW.js";import{FolderFallback as t,PageFallback as r}from"./chunk-XUF7VW4U.js";import{Icon as n}from"./chunk-YKZHOXI4.js";import{isValidElement as o,cloneElement as i}from"react";import{jsx as l,jsxs as a}from"react/jsx-runtime";var d=["from-blue-500 to-blue-700","from-indigo-500 to-purple-600","from-purple-500 to-pink-600","from-pink-500 to-rose-600","from-red-500 to-rose-600","from-orange-500 to-red-600","from-amber-500 to-orange-600","from-yellow-500 to-amber-500","from-lime-500 to-green-600","from-green-500 to-emerald-600","from-emerald-500 to-teal-600","from-teal-500 to-cyan-600","from-cyan-500 to-sky-600","from-sky-500 to-blue-600","from-violet-500 to-fuchsia-600"];function s(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r);return d[Math.abs(t)%d.length]}var c={order:"text-blue-600",purchase_order:"text-purple-600",invoice:"text-green-600",client:"text-indigo-600",manufacturer:"text-orange-600",shipment:"text-teal-600",part_number:"text-gray-600",project:"text-pink-600",mould:"text-red-600",design:"text-cyan-600",brand:"text-amber-600",price_sheet:"text-emerald-600",folder:"text-yellow-600",page:"text-blue-500"},f={order:"SO",purchase_order:"PO",invoice:"INV",client:"CLI",manufacturer:"MFR",shipment:"DN",part_number:"PN",project:"PRJ",mould:"MLD",design:"DSN",brand:"BRD",price_sheet:"PS",vendor_invoice:"VI",vendor_payment:"VP",warranty_claim:"WC",qc_report:"QC",vendor_shipment:"GRN",bank_account:"BA",wheel_finish:"WF",weight_log:"WL",production_progress:"PP",vendor_price_sheet:"VPS",proposal:"PR",folder:"FLD"},p={pdf:"PDF",dxf:"DXF","3d":"STP",image:"IMG",csv:"CSV"},u={pdf:"text-red-600",dxf:"text-blue-600","3d":"text-purple-600",image:"text-emerald-600",csv:"text-green-600"};function m({className:e}){/* @__PURE__ */
|
|
2
|
+
return l(n,{name:"folder",fallback:t,className:e})}function h(t,r){return r&&e[r]||(t?e[t]:void 0)}var w=/* @__PURE__ */l("svg",{className:"h-7 w-7",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6z"})});function g({entityType:e,isSelected:t,entityId:r,label:n,fileKind:d}){const g="preview-file"===e&&d,y=g?u[d]:null,x=g?p[d]:null;if("folder"===e)/* @__PURE__ */
|
|
3
|
+
return l("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */l(m,{className:"h-12 w-12 text-amber-500 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]"})});if("page"===e){const e=h(r,n),a=s(r||n||"page");/* @__PURE__ */
|
|
4
|
+
return l("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */l("span",{className:`h-11 w-11 rounded-xl bg-gradient-to-br ${a} flex items-center justify-center text-white border border-white/30 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]`,children:e&&o(e)?i(e,{className:"h-7 w-7 text-white"}):w})})}/* @__PURE__ */
|
|
5
|
+
return a("div",{className:"w-12 h-12 relative flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:[
|
|
6
|
+
/* @__PURE__ */a("svg",{className:`w-10 h-12 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)] ${y??c[e]??"text-gray-500"}`,viewBox:"0 0 40 48",fill:"none",children:[
|
|
7
|
+
/* @__PURE__ */l("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",fill:"white",fillOpacity:"0.92"}),
|
|
8
|
+
/* @__PURE__ */l("path",{d:"M26 0l10 10H30a4 4 0 01-4-4V0z",fill:"currentColor",fillOpacity:"0.2"}),
|
|
9
|
+
/* @__PURE__ */l("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",stroke:"currentColor",strokeWidth:"1.5",strokeOpacity:"0.5"})]}),
|
|
10
|
+
/* @__PURE__ */l("span",{className:`absolute inset-0 flex items-center justify-center text-[9px] font-bold pt-2 ${y??c[e]??"text-gray-600"}`,children:x??f[e]??e.slice(0,3).toUpperCase()})]})}function y({item:e}){if("folder"===e.entityType)/* @__PURE__ */
|
|
11
|
+
return l(m,{className:"h-4 w-4 shrink-0 text-amber-500"});if("page"===e.entityType){const t=h(e.entityId,e.label);/* @__PURE__ */
|
|
12
|
+
return l("span",{className:`h-4 w-4 rounded bg-gradient-to-br ${s(e.entityId||e.label||"page")} flex items-center justify-center text-white shrink-0`,children:t&&o(t)?i(t,{className:"h-3 w-3 text-white"}):/* @__PURE__ */l("span",{className:"h-1.5 w-1.5 rounded-[2px] border border-white/80"})})}const t=("preview-file"===e.entityType&&e.fileKind?u[e.fileKind]:c[e.entityType])??"text-gray-400";/* @__PURE__ */
|
|
13
|
+
return l(n,{name:"page",fallback:r,className:`h-4 w-4 shrink-0 ${t}`,strokeWidth:1.5})}function x(e){return"preview-file"===e.entityType&&e.fileKind?p[e.fileKind]:"page"===e.entityType?"App":"folder"===e.entityType?"Folder":f[e.entityType]??e.entityType.slice(0,3).toUpperCase()}var b=null,v=/* @__PURE__ */new Set;function _(e){b=e,v.forEach(e=>e())}function k(e){return v.add(e),()=>{v.delete(e)}}function N(){return b}var j="__REACT_OS_SHELL_FILES_VIEW__",C="react-os-shell:files-show-trash",I="react-os-shell:files-open-desktop-folder";function S(){"undefined"!=typeof window&&(window[j]="trash",window.dispatchEvent(new CustomEvent(C)))}function T(e){"undefined"!=typeof window&&(window[j]={view:"desktop-folder",folderId:e},window.dispatchEvent(new CustomEvent(I,{detail:{folderId:e}})))}function P(){if("undefined"==typeof window)return null;const e=window[j];return"trash"===e?"trash":e&&"object"==typeof e&&"desktop-folder"===e.view&&"string"==typeof e.folderId?e:null}function V(){const e=P();return"undefined"!=typeof window&&(window[j]=null),e}export{y as DesktopItemMiniIcon,I as FILES_OPEN_DESKTOP_FOLDER_EVENT,C as FILES_SHOW_TRASH_EVENT,g as FileIconTile,m as FolderGlyph,V as consumeFilesViewRequest,x as desktopItemTypeLabel,N as getDesktopFoldersSnapshot,P as peekFilesViewRequest,_ as publishDesktopFolders,T as requestFilesDesktopFolderView,S as requestFilesTrashView,k as subscribeDesktopFolders};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-SBDIHKLU.js";import{keepsNativeMenu as a}from"./chunk-ZDF5AR5W.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
|
|
2
2
|
return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
|
|
3
3
|
/* @__PURE__ */n("div",{children:[
|
|
4
4
|
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{requestFilesTrashView as n}from"./chunk-
|
|
1
|
+
import{requestFilesTrashView as n}from"./chunk-LMIQV3NB.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{useHydrated as e,useBrowserState as t}from"./chunk-D65T4H6J.js";import{InfoFallback as r,ErrorFallback as n,CloseFallback as o,CheckFallback as i}from"./chunk-XUF7VW4U.js";import{useShellStrings as a}from"./chunk-J3LIIIHJ.js";import{Icon as s}from"./chunk-YKZHOXI4.js";import{createContext as c,useSyncExternalStore as l,useCallback as u,useContext as d,useMemo as f}from"react";import{jsxs as m,jsx as h}from"react/jsx-runtime";var w="(max-width: 767px), (pointer: coarse)";function p(){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(w).matches}function g(){return!1}function y(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(w);return t.addEventListener?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):(t.addListener(e),()=>t.removeListener(e))}function v(){return l(y,p,g)}var x={success:"success",error:"error",warning:"warning",info:"info",404:"info",403:"warning",500:"error"},b={success:"text-green-600 bg-green-100",error:"text-red-600 bg-red-100",warning:"text-amber-600 bg-amber-100",info:"text-blue-600 bg-blue-100"},_={404:e=>e.notFound,403:e=>e.noAccess,500:e=>e.serverError};function N({tone:e}){const t={className:"h-6 w-6",strokeWidth:1.5,"aria-hidden":!0};switch(e){case"success":/* @__PURE__ */
|
|
2
|
+
return h(s,{name:"check",fallback:i,...t});case"error":/* @__PURE__ */
|
|
3
|
+
return h(s,{name:"close",fallback:o,...t});case"warning":/* @__PURE__ */
|
|
4
|
+
return h(s,{name:"error",fallback:n,...t});default:/* @__PURE__ */
|
|
5
|
+
return h(s,{name:"info",fallback:r,...t})}}function S({status:e="info",title:t,subTitle:r,extra:n,icon:o,children:i,className:s=""}){const c=x[e],l=a().errors;/* @__PURE__ */
|
|
6
|
+
return m("div",{role:"error"===c?"alert":void 0,className:`flex flex-col items-center justify-center px-6 py-12 text-center ${s}`.trim(),children:[
|
|
7
|
+
/* @__PURE__ */h("div",{className:`flex h-14 w-14 items-center justify-center rounded-full ${b[c]}`,children:o??/* @__PURE__ */h(N,{tone:c})}),
|
|
8
|
+
/* @__PURE__ */h("h2",{className:"mt-4 text-lg font-semibold text-gray-900",children:t??_[e]?.(l)??""}),r&&/* @__PURE__ */h("p",{className:"mt-1 max-w-md text-sm text-gray-500",children:r}),i&&/* @__PURE__ */h("div",{className:"mt-4 w-full max-w-md text-left",children:i}),n&&/* @__PURE__ */h("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:n})]})}function C({size:e="md",padding:t="py-12",label:r,className:n=""}){const o=/* @__PURE__ */h("div",{className:`${"sm"===e?"h-5 w-5":"lg"===e?"h-12 w-12":"h-8 w-8"} animate-spin rounded-full border-2 border-gray-200 border-t-blue-600`});return null==r?/* @__PURE__ */h("div",{className:`flex items-center justify-center ${t} ${n}`,children:o}):/* @__PURE__ */m("div",{role:"status",className:`flex flex-col items-center justify-center gap-3 ${t} ${n}`,children:[o,
|
|
9
|
+
/* @__PURE__ */h("p",{className:"text-sm text-gray-500",children:r})]})}var D="undefined"!=typeof window&&"undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),E={MOD:["⌘","Ctrl"],ALT:["⌥","Alt"],CMD_ENTER:["⌘⏎","Ctrl⏎"],CMD_S:["⌘S","Ctrl+S"],CMD_K:["⌘K","Ctrl+K"],CMD_DOT:["⌘.","Ctrl+."],CMD_A:["⌘A","Ctrl+A"],CMD_Z:["⌘Z","Ctrl+Z"],CMD_SHIFT_Z:["⌘⇧Z","Ctrl+Shift+Z"],ALT_SHIFT_D:["⌥⇧D","Alt+Shift+D"],ALT_SHIFT_E:["⌥⇧E","Alt+Shift+E"],ALT_SHIFT_N:["⌥⇧N","Alt+Shift+N"]},L=D?0:1,M=E.MOD[L],T=E.ALT[L],k="⇧",A="⏎",I=E.CMD_ENTER[L],H=E.CMD_S[L],j=E.CMD_K[L],F=E.CMD_DOT[L],Z=E.CMD_A[L],O=E.CMD_Z[L],P=E.CMD_SHIFT_Z[L],$=E.ALT_SHIFT_D[L],J=E.ALT_SHIFT_E[L],K=E.ALT_SHIFT_N[L],U=new Map(D?Object.values(E).map(([e,t])=>[e,t]):[]);function z(t){return e()?t:U.get(t)??t}var R="inline-flex items-center justify-center rounded border border-gray-200 bg-gray-50 font-medium text-gray-500",W={sm:"px-1 py-0.5 text-[10px]",md:"px-1.5 py-0.5 text-[11px]"};function X({keys:e,size:t="md",className:r=""}){const n=z(e);/* @__PURE__ */
|
|
10
|
+
return h("kbd",{className:[R,W[t],r].filter(Boolean).join(" "),children:n})}var B=c(null);function V({value:e,children:t}){/* @__PURE__ */
|
|
11
|
+
return h(B.Provider,{value:e,children:t})}function Y(e="react-os-shell:prefs",r){const[n,o]=t(()=>{try{const t=JSON.parse(localStorage.getItem(e)||"{}");return{...r??{},...t}}catch{return{...r??{}}}},{...r??{}});return{prefs:n,save:u(t=>{o(r=>{const n={...r,...t};try{localStorage.setItem(e,JSON.stringify(n))}catch{}return n})},[e])}}var q={prefs:{},save:()=>{}};function G(){return d(B)??q}function Q(){const{prefs:e,save:t}=G(),r=u(e=>{const r=t(e);return r&&"function"==typeof r.then?r.catch(()=>{}):r},[t]);return f(()=>({prefs:e,save:r}),[e,r])}var ee="react-os-shell:stale-chunk-reload-at",te=3e4,re="vite:preloadError",ne="/_next/static/",oe=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed|Unable to preload CSS/i;function ie(e){if(e instanceof Error&&"ChunkLoadError"===e.name)return!0;const t=e instanceof Error?e.message:"string"==typeof e?e:"";return oe.test(t)}function ae(e={}){if("undefined"==typeof window)return()=>{};const t=e.cooldownMs??3e4,r=e.reload??(()=>window.location.reload()),n=e.now??Date.now,o=void 0===e.storage?function(){try{const e=window.sessionStorage;return e.getItem(ee),e}catch{return null}}():e.storage,i=void 0===e.chunkPathPrefix?ne:e.chunkPathPrefix,a=e=>{const r=n(),i=function(e){if(!e)return null;try{const t=e.getItem(ee),r=null===t?NaN:Number(t);return Number.isFinite(r)?r:null}catch{return null}}(o);return null!==i&&r-i<t?(console.error("[efficient-shell] a lazy chunk is still missing after a reload; letting the failure through:",e),!1):(function(e,t){if(e)try{e.setItem(ee,String(t))}catch{}}(o,r),console.warn("[efficient-shell] a lazy chunk is no longer on the server (new deploy?); reloading onto the current build:",e),!0)},s=e=>{const t=e.payload;ie(t)&&a(t)&&(e.preventDefault(),r())};let c=!0,l=!1;const u=/* @__PURE__ */new Set,d=null===i?null:e=>{const t=function(e,t){const r=e.target;let n="";if(r instanceof window.HTMLScriptElement?n=r.src:r instanceof window.HTMLLinkElement&&function(e){const t=e.rel.toLowerCase().split(/\s+/);if(t.includes("stylesheet")||t.includes("modulepreload"))return!0;const r=(e.getAttribute("as")??"").toLowerCase();return t.includes("preload")&&("script"===r||"style"===r)}(r)?n=r.href:e instanceof window.ErrorEvent&&"SyntaxError"===e.error?.name&&(n=e.filename),!n)return null;try{const e=new URL(t,window.location.origin).href,r=new URL(n,window.location.href).href;return r.startsWith(e)?r:null}catch{return null}}(e,i);!t||l||u.has(t)||(u.add(t),async function(e){try{const t=await fetch(e,{method:"HEAD",cache:"no-store"});return 404===t.status||410===t.status||t.ok&&/\btext\/html\b/i.test(t.headers.get("content-type")??"")}catch{return!1}}(t).then(e=>{u.delete(t),e&&c&&!l&&a(t)&&(l=!0,r())}))};return window.addEventListener(re,s),d&&window.addEventListener("error",d,!0),()=>{c=!1,window.removeEventListener(re,s),d&&window.removeEventListener("error",d,!0)}}export{T as ALT,$ as ALT_SHIFT_D,J as ALT_SHIFT_E,K as ALT_SHIFT_N,Z as CMD_A,F as CMD_DOT,I as CMD_ENTER,j as CMD_K,H as CMD_S,P as CMD_SHIFT_Z,O as CMD_Z,A as ENTER,X as Kbd,C as LoadingSpinner,M as MOD,ne as NEXT_CHUNK_PATH_PREFIX,S as Result,k as SHIFT,te as STALE_CHUNK_RELOAD_COOLDOWN_MS,ee as STALE_CHUNK_RELOAD_KEY,V as ShellPrefsProvider,re as VITE_PRELOAD_ERROR_EVENT,ae as installStaleChunkReload,D as isMac,ie as isStaleChunkError,v as useIsMobile,Y as useLocalStoragePrefs,Q as useShellPrefs,G as useShellPrefsAdapter,z as useShortcutLabel};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{toast_default as e}from"./chunk-3DGTIWZP.js";import{ChevronLeftFallback as t,ChevronRightFallback as n,PrintFallback as r,DownloadFallback as a,EmailFallback as o}from"./chunk-XUF7VW4U.js";import{useShellStrings as i}from"./chunk-J3LIIIHJ.js";import{Icon as l}from"./chunk-YKZHOXI4.js";import{createContext as s,useContext as c,useRef as d,useState as u,useEffect as m}from"react";import*as h from"pdfjs-dist";import{createPortal as p}from"react-dom";import{jsx as f,jsxs as g}from"react/jsx-runtime";function w(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var y=s(null);function b({children:e}){const t=c(y);return t?p(e,t):
|
|
2
|
+
/* @__PURE__ */f("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||h.GlobalWorkerOptions.workerSrc||(h.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${h.version}/build/pdf.worker.min.mjs`);var v={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},x=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=v[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw w(n,t,a);return a}};function k(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:x}}var C=[50,75,100,125,150,200,300,400];function N(e,t,n){const r=(t.width-40)/n.width,a="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(a,.3),4)}function j({url:s,filename:c,fit:p="width",onDownload:w,onEmail:y,workerSrc:v,wasmUrl:x}){const j=i().pdf,M=d(null),E=d(null),P=d(null),[W,_]=u(null),[z,D]=u(1),[L,S]=u(0),[T,$]=u(1),[O,A]=u(!0),[U,H]=u(!0),I=d(j.loadFailed);I.current=j.loadFailed,m(()=>{let t=!1;return H(!0),D(1),v&&(h.GlobalWorkerOptions.workerSrc=v),h.getDocument({url:s,...k(x)}).promise.then(e=>{t||(_(e),S(e.numPages),H(!1))}).catch(()=>{t||(e.error(I.current),H(!1))}),()=>{t=!0}},[s,v,x]),m(()=>{if(!W||!O||!P.current)return;const e=()=>{const e=P.current;e&&W.getPage(z).then(t=>{if(!P.current)return;const n=t.getViewport({scale:1}),r=N(p,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});$(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(P.current),()=>t.disconnect()},[W,z,O,p]),m(()=>{if(!W||!M.current)return;let e=!1,t=null,n=null;return W.getPage(z).then(r=>{if(e||!M.current)return;const a=r.getViewport({scale:T}),o=M.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const l=E.current;l&&(l.replaceChildren(),l.style.setProperty("--total-scale-factor",String(a.scale)),n=new h.TextLayer({textContentSource:r.streamTextContent(),container:l,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",l.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[W,z,T]),m(()=>{const e=()=>E.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const F="page"===p?j.fitPage:j.fitWidth,R="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
3
|
+
return g("div",{className:"flex flex-col h-full",children:[
|
|
4
|
+
/* @__PURE__ */g(b,{children:[
|
|
5
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.previousPage,onClick:()=>D(e=>Math.max(1,e-1)),disabled:z<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */f(l,{name:"chevron-left",fallback:t,className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
6
|
+
/* @__PURE__ */f("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:j.pageOf(z,L)}),
|
|
7
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.nextPage,onClick:()=>D(e=>Math.min(L,e+1)),disabled:z>=L,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */f(l,{name:"chevron-right",fallback:n,className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */f("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
9
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.zoomOut,title:j.zoomOut,onClick:()=>{A(!1),$(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:R,children:/* @__PURE__ */f("span",{"aria-hidden":"true",children:"−"})}),
|
|
10
|
+
/* @__PURE__ */g("select",{value:O?"fit":C.includes(Math.round(100*T))?Math.round(100*T):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(A(!1),$(Number(t)/100)):A(!0)},className:"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400","aria-label":j.zoom,title:j.zoom,children:[
|
|
11
|
+
/* @__PURE__ */f("option",{value:"fit",children:F}),!O&&!C.includes(Math.round(100*T))&&/* @__PURE__ */g("option",{value:"custom",children:[Math.round(100*T),"%"]}),C.map(e=>/* @__PURE__ */g("option",{value:e,children:[e,"%"]},e))]}),
|
|
12
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.zoomIn,title:j.zoomIn,onClick:()=>{A(!1),$(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:R,children:/* @__PURE__ */f("span",{"aria-hidden":"true",children:"+"})}),
|
|
13
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>A(!0),"aria-pressed":O,className:R+(O?" bg-gray-200 text-gray-900":""),title:j.fitHint,children:j.fit}),
|
|
14
|
+
/* @__PURE__ */f("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
15
|
+
/* @__PURE__ */g("button",{type:"button",onClick:()=>{if(!W)return;const t=window.open("","_blank");if(!t)return void e.error(j.allowPopups);const n=[];for(let e=1;e<=L;e++)n.push(W.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(n).then(e=>{var n;t.document.write(`<html><head><title>${n=c,n.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),t.document.write(e.map(e=>`<img src="${e}"/>`).join("")),t.document.write("</body></html>"),t.document.close(),setTimeout(()=>{t.print(),t.close()},300)})},className:R,children:[
|
|
16
|
+
/* @__PURE__ */f(l,{name:"print",fallback:r,className:"h-3.5 w-3.5",strokeWidth:1.5}),j.print]}),
|
|
17
|
+
/* @__PURE__ */g("button",{type:"button",onClick:w??(()=>{const e=document.createElement("a");e.href=s,e.download=c,e.click()}),className:R,children:[
|
|
18
|
+
/* @__PURE__ */f(l,{name:"download",fallback:a,className:"h-3.5 w-3.5",strokeWidth:1.5}),j.download]}),y&&/* @__PURE__ */g("button",{type:"button",onClick:y,className:R,children:[
|
|
19
|
+
/* @__PURE__ */f(l,{name:"email",fallback:o,className:"h-3.5 w-3.5",strokeWidth:1.5}),j.email]})]}),
|
|
20
|
+
/* @__PURE__ */f("div",{ref:P,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!W)return;if(e.ctrlKey||e.metaKey)return;const t=P.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&z<L?(e.preventDefault(),D(e=>Math.min(L,e+1)),requestAnimationFrame(()=>{P.current&&(P.current.scrollTop=0)})):e.deltaY<0&&n&&z>1&&(e.preventDefault(),D(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{P.current&&(P.current.scrollTop=P.current.scrollHeight)}))},onKeyDown:e=>{if(!W)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?z<L&&(e.preventDefault(),D(e=>Math.min(L,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?z>1&&(e.preventDefault(),D(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),D(1)):"End"===e.key&&(e.preventDefault(),D(L)))},children:U?/* @__PURE__ */f("div",{className:"flex items-center justify-center h-full text-gray-500 text-sm",role:"status",children:j.loading}):/* @__PURE__ */g("div",{className:"min-h-full flex items-center justify-center p-4",children:[
|
|
21
|
+
/* @__PURE__ */f("style",{children:'\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role="img"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n'}),
|
|
22
|
+
/* @__PURE__ */g("div",{className:"relative shadow-lg rounded",children:[
|
|
23
|
+
/* @__PURE__ */f("canvas",{ref:M,className:"block rounded"}),
|
|
24
|
+
/* @__PURE__ */f("div",{ref:E,className:"preview-pdf-textlayer",onPointerDown:e=>e.currentTarget.classList.add("selecting")})]})]})})]})}export{b as PanelActions,j as PdfViewer,y as ToolbarSlotContext,N as fitScale,k as pdfWasmParams};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as l,widthToFit as s,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-GMMTTWHB.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,LoadingSpinner as p,Result as f,useIsMobile as w,useShellPrefs as y}from"./chunk-PQLVWCUI.js";import{Button_default as g}from"./chunk-OGXU7QFW.js";import{confirm as b}from"./chunk-ZZKIKW62.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-ZDF5AR5W.js";import{Z_LAYERS as C,runEscapeInterceptors as M}from"./chunk-X4FJ54PP.js";import{WarningFallback as N,StarFallback as S,BookmarkSquareFallback as L,CheckFallbackB as T,CloseFallback as z,RemoveFallback as A,ExpandFallback as D,WindowFallback as I,ExpandFallbackB as P,GridFallbackC as W,ArrowRightFallbackB as K}from"./chunk-XUF7VW4U.js";import{useShellStrings as O}from"./chunk-J3LIIIHJ.js";import{Icon as $}from"./chunk-YKZHOXI4.js";import{createContext as R,useContext as F,Component as q,useLayoutEffect as j,useRef as B,useEffect as H,useState as Y,useSyncExternalStore as U,useCallback as X,isValidElement as V,Fragment as _,Children as J,cloneElement as G,useMemo as Q,useReducer as Z,useId as ee,Suspense as te}from"react";import{jsxs as ne,jsx as re,Fragment as oe}from"react/jsx-runtime";import{createPortal as ie}from"react-dom";import{XMarkIcon as ae}from"@heroicons/react/24/outline";import{useLocation as le}from"react-router-dom";import{useQueryClient as se,useQuery as ce}from"@tanstack/react-query";function de(e){return"component"in e}function ue(e){return"endpoint"in e}var he={};function me(e){he=e}var pe=new Proxy({},{get:(e,t)=>he[t],has:(e,t)=>t in he,ownKeys:()=>Object.keys(he),getOwnPropertyDescriptor(e,t){if(t in he)return{configurable:!0,enumerable:!0,value:he[t]}}}),fe=null;function we(e){fe=e}function ye(){return null!==fe}var ge=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),be=new Proxy({},{get:(e,t)=>fe?fe[t]:"string"==typeof t&&ge.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),ve=R(null);function xe(){return F(ve)?.pageSearch??""}var ke=null,Ee=/* @__PURE__ */new Set;function Ce(e){ke!==e&&(ke=e,Ee.forEach(e=>e()))}function Me(){return ke}function Ne(e){return Ee.add(e),()=>{Ee.delete(e)}}function Se({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
|
|
2
|
+
return ne("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
+
/* @__PURE__ */re($,{name:"warning",fallback:N,className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
|
+
/* @__PURE__ */ne("div",{className:"min-w-0",children:[
|
|
5
|
+
/* @__PURE__ */re("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */re("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
|
|
7
|
+
/* @__PURE__ */re("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Le=class extends q{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */re(Se,{error:e,onReload:this.reset}):this.props.children}},Te=R(null),ze="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ae({className:e="",auto:t=!1}){const n=F(Te),r=O().undo,o=n?.claimOwnMount;if(j(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:l,canRedo:s,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
|
|
8
|
+
return ne("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */re("button",{type:"button",onClick:i,disabled:!l,title:l?r.undoStep(c??"",h):r.nothingToUndo,className:ze,children:r.undo}),
|
|
10
|
+
/* @__PURE__ */re("button",{type:"button",onClick:a,disabled:!s,title:s?r.redoStep(d??"",m):r.nothingToRedo,className:ze,children:r.redo})]})}var De=/* @__PURE__ */new Set([408,429]);function Ie(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Pe(e){const t=Ie(e);return null!=t&&(t>=400&&t<500&&!De.has(t))}function We(e,t){return!Pe(t)&&e<3}function Ke(){const e=O().loading;/* @__PURE__ */
|
|
11
|
+
return re("div",{className:"flex items-center justify-center p-8 text-sm text-gray-400",children:e.label})}var Oe="flex-1 min-h-0";function $e(){const e=O().record;/* @__PURE__ */
|
|
12
|
+
return re(p,{label:e.loading,padding:"",className:Oe})}function Re(e){return e??void 0}function Fe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=O().record;if(t||e&&n)/* @__PURE__ */return re($e,{});if(r){const e=Ie(r);if(401===e)/* @__PURE__ */
|
|
13
|
+
return re(f,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Oe});if(403===e)/* @__PURE__ */
|
|
14
|
+
return re(f,{status:"403",className:Oe});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return re(f,{status:"404",title:i.notFound,className:Oe});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
|
+
return re(f,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */re(g,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Oe})}/* @__PURE__ */
|
|
17
|
+
return re(f,{status:"404",title:i.notFound,className:Oe})}function qe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */re(oe,{children:t(e)}):/* @__PURE__ */re(Fe,{...n})}var je=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Be(e){return"string"==typeof e&&(e.startsWith("new-")||je.test(e))}function He(e){if(Be(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Ye=R({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ue=R(null);function Xe(e){const t=F(Ue),n=B(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),j(()=>{if(t)return t(n.current,e)},[t,e]),H(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Ve(){const e=B(/* @__PURE__ */new Map),[t,n]=Y(!1);return{dirty:t,registerDirty:X((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function _e(){return F(Ye)}function Je(e){if("page"!==e.type&&He(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Ge({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Ve(),i=pe[e.route];if(!i||!de(i))return null;const a=i,l=a.component;/* @__PURE__ */
|
|
18
|
+
return re($r,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */re(Ue.Provider,{value:o,children:/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */re(Ke,{})}),children:/* @__PURE__ */re(l,{})})})})}function Qe({entityType:e,entityId:t,label:n}){const r=O(),o=se(),{data:i}=ce({queryKey:["my-profile-sidebar"],enabled:ye(),queryFn:()=>be.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],l=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
19
|
+
return re("button",{onClick:()=>{const r=l?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];be.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:l?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(l?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */re($,{name:"star",fallback:S,className:"h-4 w-4",fill:l?"currentColor":"none",strokeWidth:1.5})})}var Ze=/* @__PURE__ */new Set;function et({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=pe[e.entityType];if(!o||!ue(o))return null;const i=o,[a,l]=Y(!1),{dirty:s,registerDirty:d}=Ve(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Be(e.entityId),p=!i.selfFetching&&!h&&!m&&ye(),f=ce({queryKey:[u,e.entityId],queryFn:()=>{return be.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Re(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Pe(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:We}),w=f.data,y=f.refetch;H(()=>{var t;if(p)return t=t=>{t!==e.id||Ze.has(t)||y({cancelRefetch:!1})},jn.add(t),()=>{jn.delete(t)}},[y,e.id,p]);const g=X(()=>{a&&!s?l(!1):t()},[a,s,t]),b=i.selfFetching?e.label:w?i.title(w,a,l):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re(Ke,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,l)}):null!=w?/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re($r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */re($e,{})}),children:i.render(w,t,e.entityId,a,l)}):/* @__PURE__ */re($r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */re(Fe,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */re($r,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:s,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */re(Ue.Provider,{value:d,children:/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re($e,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,l):/* @__PURE__ */re(qe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,l)})})})})}function tt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function nt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function rt(e){const t=tt(e),n=t??nt(e);if(!n)return;if(t&&!er(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Bn(o)}function ot(e){if("page"!==e.type)return!0;const t=e.route?pe[e.route]:void 0;if(!t||!de(t))return!0;const n=t;return!n.widget&&!n.utility}function it(){const e=pr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var at=/* @__PURE__ */new Map;function lt(){const e=it();if(e)return at.get(e)}function st(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var ct="rosh-peek-style";function dt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(ct))return;const e=document.createElement("style");e.id=ct,e.textContent="body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:249!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}",document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function ut(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function ht({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const l=O(),s=B(null),[c,d]=Y({w:n,h:Math.round(.75*r)}),[u,h]=Y(!1);return j(()=>{const o=s.current;if(!o)return;const i=tt(e)??st(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const l=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*l)),u=Math.max(60,Math.round(a.height*l));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${l})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */ne("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-md cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
20
|
+
/* @__PURE__ */re("div",{ref:s,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */ne("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
|
+
/* @__PURE__ */re($,{name:"window",fallback:I,className:"h-6 w-6",strokeWidth:1.5}),
|
|
22
|
+
/* @__PURE__ */re("span",{className:"mt-1 text-[10px] uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */re("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-[10px] font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */re("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:l.taskbar.closeWindow,children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-3 w-3",strokeWidth:3})})]})}function mt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=O(),l=e.length>1,s=B(null),[c,d]=Y({left:-9999,top:-9999,ready:!1}),[u,h]=Y(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");j(()=>{const e=s.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),H(()=>ut,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-[11px] font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return ie(
|
|
23
|
+
/* @__PURE__ */re("div",{ref:s,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:300,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:l?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ut(),i()},children:e.map(e=>{const t=tt(e.id)??st(e.label),o=t?function(e){if(er(e))return null;const t=e.getBoundingClientRect(),n=Vn(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
|
|
24
|
+
return ne("div",{className:"group flex flex-col items-center",onMouseEnter:()=>dt(t),children:[!m&&/* @__PURE__ */re("span",{className:p,children:e.label}),
|
|
25
|
+
/* @__PURE__ */re(ht,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */re("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */ne("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-1.5 py-0.5 text-[10px] font-semibold text-white shadow-sm",children:[
|
|
26
|
+
/* @__PURE__ */re($,{name:"arrow-right",fallback:K,className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function pt(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function ft({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=O(),[a,l]=Y(null);H(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return l(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const s=U(fr,pr),[,d]=Y(0);H(()=>{const e=()=>d(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=Y(0);H(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=st(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=Y(null),[f,w]=Y(null),[y,g]=Y(null),b=B(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!pe[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?pe[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return ie(
|
|
27
|
+
/* @__PURE__ */ne(oe,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(s){const t=document.querySelector(`[data-modal-id="${s}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const l=e.items.length>1,d=e.items.some(e=>{const t=tt(e.id)??st(e.label);return!!t&&!er(t)});/* @__PURE__ */
|
|
28
|
+
return ne("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),l?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-1.5 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&V(n)?G(n,{className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400")}):/* @__PURE__ */re($,{name:"expand",fallback:P,className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400"),strokeWidth:2}),
|
|
29
|
+
/* @__PURE__ */re("span",{className:"truncate flex-1",children:l?e.label:h(r.label)}),d&&/* @__PURE__ */re("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),l&&/* @__PURE__ */re("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-blue-500/80 text-white text-[10px] font-bold leading-none",children:e.items.length}),!l&&/* @__PURE__ */re("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
30
|
+
/* @__PURE__ */re("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */ne("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
|
|
31
|
+
/* @__PURE__ */re($,{name:"grid",fallback:W,className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */ne(v,{portal:!0,minWidth:200,style:pt(y.x,y.y),onClose:()=>g(null),children:[
|
|
32
|
+
/* @__PURE__ */re(E,{children:y.label}),
|
|
33
|
+
/* @__PURE__ */ne(x,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=zn.get(e);t&&Hn(t)}(e.id))},children:[
|
|
34
|
+
/* @__PURE__ */re($,{name:"remove",fallback:A,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
35
|
+
/* @__PURE__ */ne(x,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
|
|
36
|
+
/* @__PURE__ */re("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */re("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
37
|
+
/* @__PURE__ */re(k,{}),
|
|
38
|
+
/* @__PURE__ */ne(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
39
|
+
/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */re(mt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:C})]}),a)}var wt=["/login","/forgot-password","/reset-password","/force-change-password"];function yt({children:e,windowAccentForRoute:t}){const n=le(),r=wt.some(e=>n.pathname.startsWith(e)),[o,i]=Y([]),a=B(o);j(()=>{a.current=o},[o]);const l=U(Ne,Me,Me),s=B(/* @__PURE__ */new Map),c=e=>{const t=ot(e),n=!!l&&"page"===e.type&&e.route===l,r=e.pageSearch||void 0,o=s.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return s.current.set(e.id,i),i};H(()=>{at.clear();for(const e of o)e.route&&at.set(e.id,e.route)},[o]);const d=X(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=X(e=>{var t;tt(e)||nt(e)?(t=e,window.dispatchEvent(new CustomEvent(wr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=Mn;t&&Ze.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(Nn.get(i)??-1)>a)||Bn(o),t&&Ze.delete(e)},50)},m=X((e,t,n,r,o)=>{if(!pe[e]||!ue(pe[e]))return;const a=`${e}:${t}`,l=it();i(i=>{const s=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return s?(h(s.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Re(n),openedFrom:l}])})},[]),p=X((e,t={})=>{if(!pe[e]||!de(pe[e]))return;const n=pe[e],{reuse:r=!1,background:o=!1,shellOwned:l,search:s}=t,c=e=>{var t;o?(t=e,Wn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=it();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!s&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),s&&i.pageSearch!==s?t.map(e=>e===i?{...e,pageSearch:s}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]})},[u]),f=X(()=>{},[]),w=X(()=>{},[]),y=u,g=u;/* @__PURE__ */
|
|
40
|
+
return ne(Ye.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
|
|
41
|
+
/* @__PURE__ */re(ft,{openWindows:o,onRemove:u,onSplitView:Kr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&Bn(e)}})},onActivateById:rt}),
|
|
42
|
+
/* @__PURE__ */re(Or,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
43
|
+
/* @__PURE__ */
|
|
44
|
+
return re(ve.Provider,{value:c(e),children:/* @__PURE__ */re(Le,{fallback:(t,n)=>/* @__PURE__ */re($r,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */re(Se,{error:t,onReload:n})}),children:/* @__PURE__ */re(Bt,{spec:Je(e),children:/* @__PURE__ */re(Yr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */re(Ge,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */re(et,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var gt=null,bt=/* @__PURE__ */new Set;function vt(){return gt}function xt(e){if(gt!==e){gt=e;for(const e of bt)e()}}function kt(e){return bt.add(e),()=>{bt.delete(e)}}var Et=!1,Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Mt=()=>{};function Nt(e){Et=e,Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function St(e,t){Et&&("submenu"===e?Ct.submenus++:Ct.menus++,Ct.menuKey=t)}function Lt(e){if(!Et)return Mt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Et)return;const r=performance.now()-t;"move"===e?Ct.moveMs+=r:Ct.resizeMs+=r}}function Tt(){const e=Ct;return Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var zt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),At=/* @__PURE__ */new Set(["svg"]);function Dt(e){const t=[],n={text:"",accessories:[]};return It(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function It(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>It(e,t,n));if(!V(e))return;const r=e;if(r.type!==d)if(r.type!==_){if("string"==typeof r.type){if(At.has(r.type))return;if(!zt.has(r.type))return n.push(" "),J.toArray(r.props.children).forEach(e=>It(e,t,n)),void n.push(" ")}t.accessories.push(G(r,{key:`title-part-${t.accessories.length}`}))}else J.toArray(r.props.children).forEach(e=>It(e,t,n));else void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text)}var Pt=/* @__PURE__ */new Map,Wt=/* @__PURE__ */new Set,Kt=0;function Ot(){Kt++,Wt.forEach(e=>e())}function $t(e){return Pt.get(e)}function Rt(e){return Wt.add(e),()=>{Wt.delete(e)}}function Ft(){return Kt}var qt=R(""),jt=R(null);function Bt({spec:e,children:t}){/* @__PURE__ */
|
|
45
|
+
return re(jt.Provider,{value:e,children:t})}var Ht=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Yt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Ut='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Xt(e){return Vt(e).replace(/\s+/g," ").trim()}function Vt(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(Vt).join("");if(V(e)){const t=e,n="string"==typeof t.type?t.type:"";return Ht.has(n)?"":` ${Vt(t.props?.children)} `}return""}function _t(e){const t=F(qt);H(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var Jt={};function Gt(e,t,n){const r=F(qt);H(()=>{if(!r)return;Jt[r]||(Jt[r]=[]);const o={label:e,icon:n,onClick:t};return Jt[r].push(o),()=>{Jt[r]=(Jt[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function Qt({title:e}){const t=B(null);return H(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */re("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Zt(e){}var en=R(null);function tn(){return F(qt)}function nn(){const e=U(fr,pr),t=F(en);return t?.active??(kn.length<=1||null!=e)}function rn({children:e,position:t="right",quiet:n=!1}){const r=F(en),[o,i]=Y(null);return H(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),l=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(l)}},[r,t,n]),o?ie(e,o):null}function on({onClick:e,children:t,className:n}){const r=F(en);/* @__PURE__ */
|
|
46
|
+
return re("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-X2DPOYWO.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var an="erp_window_positions",ln={};try{const e=localStorage.getItem(an);e&&(ln=JSON.parse(e))}catch{}var sn=null;function cn(){sn&&clearTimeout(sn),sn=setTimeout(()=>{try{localStorage.setItem(an,JSON.stringify(ln))}catch{}},500)}var dn="erp_activation_order",un=[];try{const e=localStorage.getItem(dn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(un=t)}catch{}var hn=null;function mn(){hn&&clearTimeout(hn),hn=setTimeout(()=>{try{localStorage.setItem(dn,JSON.stringify(un))}catch{}},500)}function pn(e,t){ln[e]||(ln[e]=t,cn())}function fn(e){return ln[e]?{...ln[e]}:null}function wn(e,t){ln[e]=t,cn()}function yn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(ln))n(ln[e],r,o)&&(delete ln[e],i=!0);i&&cn()}var gn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},bn=4e3,vn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},xn={small:.8,medium:1,large:1.25,maximized:1.25},kn=[],En=/* @__PURE__ */new Set,Cn=/* @__PURE__ */new Set,Mn=0,Nn=/* @__PURE__ */new Map;var Sn=0;function Ln(){return Sn}function Tn(){Sn++,En.forEach(e=>e())}var zn=/* @__PURE__ */new Map,An=/* @__PURE__ */new Map,Dn=/* @__PURE__ */new Map;function In(){for(let e=kn.length-1;e>=0;e--){const t=Dn.get(kn[e]);if(t?.tab)return t.owner}return null}function Pn(){return U(fr,In,()=>null)}var Wn=/* @__PURE__ */new Set;var Kn=null;function On(e){Kn=null,Bn(e)}function $n(e){Kn=e;const t=zn.get(e);t&&On(t)}function Rn(e){Kn===e&&(Kn=null)}function Fn(e,t,n){if(n&&Dn.set(e,n),t)if(zn.set(t,e),An.set(e,t),Wn.delete(t)){kn.unshift(e);const n=un.indexOf(t);-1!==n&&un.splice(n,1),un.unshift(t),mn()}else!function(e,t){const n=un.indexOf(t);if(-1===n)return void kn.push(e);let r=kn.length;for(let e=0;e<kn.length;e++){const t=An.get(kn[e]);if(t&&un.indexOf(t)>n){r=e;break}}kn.splice(r,0,e)}(e,t),-1===un.indexOf(t)&&(un.push(t),mn());else kn.push(e);Tn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Kn===t&&On(e)}function qn(e){return e?Dn.get(e)?.owner??An.get(e)??null:null}var jn=/* @__PURE__ */new Set;function Bn(e){const t=qn(pr()),n=kn.indexOf(e);-1!==n&&kn.splice(n,1),kn.push(e);const o=Dn.get(e);if(o?.root&&o.tab&&r()){const e=kn.filter(e=>{const t=Dn.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)kn.splice(kn.indexOf(t),1),kn.push(t)}Cn.delete(e);const i=An.get(e);if(i){const e=un.indexOf(i);-1!==e&&un.splice(e,1),un.push(i),mn(),Kn&&Kn!==i&&(Kn=null)}Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=qn(pr());a&&a!==t&&jn.forEach(e=>e(a))}function Hn(e){const t=kn.indexOf(e);-1!==t&&kn.splice(t,1),Cn.add(e),Nn.set(e,++Mn);const n=An.get(e);if(n){const e=un.indexOf(n);-1!==e&&(un.splice(e,1),mn())}Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var Yn=/* @__PURE__ */new Set;var Un=8,Xn=32;function Vn(){return e()}var _n=40,Jn=80,Gn=384,Qn=400;function Zn(e,t=Vn()){const n=Math.min(Math.max(e.x,t.x+Jn-e.w),t.x+t.w-Jn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-_n);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function er(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Vn();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function tr(e){const t=Vn(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var nr=null;function rr(e){const t=(nr||((nr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none","z-index: 40","border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(nr)),nr);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function or(){nr&&(nr.style.opacity="0",nr.style.display="none")}var ir=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],ar=350,lr=200;function sr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=Y(!1),l=B(void 0),s=B(void 0);H(()=>()=>{clearTimeout(l.current),clearTimeout(s.current)},[]);const c=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!0),ar)},d=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!1),lr)};/* @__PURE__ */
|
|
47
|
+
return ne("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
48
|
+
/* @__PURE__ */re("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */re("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(s.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-1.5 shadow-lg",children:ir.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */re("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(s.current),onBlur:d,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */re("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var cr="rosh-gesture-style";var dr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},ur=4;function hr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(cr))return;const e=document.createElement("style");e.id=cr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=Lt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function mr(e){const t=kn.indexOf(e);if(-1===t)return-1;const n=C.window+t*C.windowStep,o=Dn.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of Dn){if(!t.root||t.owner!==o.owner)continue;const n=kn.indexOf(e);-1!==n&&(i=Math.max(i,C.window+n*C.windowStep))}return i>=n?i+2+Math.min(t,7):n}function pr(){return kn[kn.length-1]||null}function fr(e){return En.add(e),()=>{En.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=kn.length-1;e>=0;e--)Yn.has(kn[e])||kn.splice(e,1);un=un.filter(e=>{const t=zn.get(e);return null!=t&&Yn.has(t)}),mn(),Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var wr="modal-close-request";function yr(e){U(fr,Ln);const t=F(en);if(kn.length<=1)return!0;if(e){const t=zn.get(e);if(null!=t)return pr()===t}return t?.active??null!=pr()}var gr=!1,br=/* @__PURE__ */new Set;function vr(e){return br.add(e),()=>br.delete(e)}function xr(){return gr}function kr(e){gr!==e&&(gr=e,br.forEach(e=>e()))}function Er(){kr(!gr)}function Cr(){kr(!1)}var Mr=null,Nr=/* @__PURE__ */new Set;function Sr(e){return Nr.add(e),()=>Nr.delete(e)}function Lr(){return Mr}function Tr(e){Mr!==e&&(Mr=e,Nr.forEach(e=>e()))}var zr=null,Ar=/* @__PURE__ */new Set;function Dr(e){return Ar.add(e),()=>Ar.delete(e)}function Ir(){return zr}function Pr(e){zr!==e&&(zr=e,Ar.forEach(e=>e()))}function Wr(){if(!zr)return void kr(!1);Tr(zr),Pr(null),kr(!1)}function Kr(){kr(!gr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Or(){const e=U(vr,xr),[t,n]=Y(e),[r,o]=Y(e);return H(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?ie(
|
|
49
|
+
/* @__PURE__ */re("div",{onMouseDown:e=>{e.stopPropagation(),kr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:2e3,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function $r({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:g,bodyScroll:E,onMinimize:N,initialBox:P,actions:W,actionsLeft:K,editing:R=!1,allowPinOnTop:q,initialPosition:_,widget:J,compact:Z,appStyle:ee,flushBody:te,autoHeight:le,autoMinHeight:se,autoWidth:ce,widgetMenu:de,dimensions:ue,windowKey:he,openedFromKey:me,accentRgb:pe,children:fe}){const we=w(),[ye,ge]=Y(0),[be,xe]=Y(!1),ke=B(null),Ee=B(0);H(()=>{Ee.current=ye},[ye]);const Ce=X(e=>{we&&(ke.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),xt(me??null))},[we,me]),Me=U(kt,vt);H(()=>{if(!be)return;const e=e=>{if(!ke.current)return;const t=e.clientX-ke.current.startX;if(Math.abs(e.clientY-ke.current.startY)>Math.abs(t)+12)return ke.current=null,xe(!1),ge(0),void xt(null);ge(Math.max(0,t))},t=()=>{if(!ke.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ke.current=null,xe(!1),t?(ge(window.innerWidth),setTimeout(()=>{i(),ge(0),xt(null)},180)):(ge(0),xt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[be]);const[Ne,Se]=Y(c),ze=O(),De=ze.window;H(()=>{Se(c)},[c]);const Ie=Q(()=>Xt(Ne).trim()||void 0,[Ne]),[Pe,We]=Y(!1),Ke=B(!1),[Oe,$e]=Y(!1),[Re,Fe]=Y(null),qe=F(jt),je=F(ve),{prefs:Be,save:He}=y(),Ye=!!Be.window_accent_stripe,Ue=Be.favorite_documents||[],Ve=!!qe&&Ue.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),Je=X(()=>{if(!qe)return;const e=Ve?Ue.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Ue,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];He({favorite_documents:e})},[qe,Ve,Ue,He]),[Ge,Qe]=Y(null),[Ze,et]=Y("top-right"===_?"right":"left"),tt=B(!1),nt=B(null);j(()=>{const e=nt.current;e&&(pe?e.style.setProperty("--window-accent-rgb",pe):e.style.removeProperty("--window-accent-rgb"))},[pe]);const rt=B(!1),ot=B(null),it=B(null),at=B(null),[lt,st]=Y(!1),ct=B(null),dt=!!(g||W||K)||lt,ut=F(Te),ht=""!==F(qt),mt=B(null);mt.current=je?{owner:je.key,tab:je.tab,root:!ht}:null;const pt=he||(je&&!ht?je.key:null),ft=!!ut&&!ht&&ut.enabled&&ut.hasState&&(R||ut.declaredEditable)&&!ut.handMounted&&dt&&!J&&!Z&&!ee&&!we,wt=/* @__PURE__ */re($,{name:"window",fallback:I,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),yt=d&&V(d)?G(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??wt,gt=()=>/* @__PURE__ */re("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Fe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:yt}),bt=40,{minimize:Et,items:Ct,restoreIfMinimized:Mt,openWindows:Nt}=_e(),St=B(`modal-${Math.random().toString(36).slice(2,8)}`).current;H(()=>{if(J)return Yn.add(St),()=>{Yn.delete(St)}},[J,St]),H(()=>{const e=e=>{const t=e.detail;t?.id===St&&Se(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[St]);const[Lt,Tt]=Y(C.window),zt=function(e){const t=U(fr,pr);return kn.length<=1||t===e}(St),At=function(e){return U(fr,()=>Cn.has(e))}(St),It=U(vr,xr),Wt=U(Sr,Lr),Kt=U(Dr,Ir),$t=!q&&!J,Rt=It&&$t,[Ft,Bt]=Y(!1),Ht=Rt&&Kt===St,[Vt,_t]=Y(!1),Gt=Vt&&$t&&Wt===St?"picked":null,Qt=B(Rt);H(()=>{if(Qt.current&&!Rt){_t(!0);const e=setTimeout(()=>{_t(!1),Mr===St&&Tr(null)},700);return Qt.current=Rt,()=>clearTimeout(e)}Qt.current=Rt},[Rt,St]),H(()=>{Rt||Bt(!1)},[Rt]),H(()=>{const e=it.current,t=at.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),H(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&nt.current){const t=nt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=it.current,n=at.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const Zt=B(!1),tn=X(e,[]),nn=X(()=>{const t=e(),n=ue?ue[0]:gn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),l=xn[vn()],s=ue?Math.min(ue[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*l;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(kn.length-1),d=Math.max(bt,(i-s)/2),u=(o-a)/2,m=t.h-bt-s-d;return"top-right"===_?{x:t.x+t.w-a-bt,y:t.y+bt,w:a,h:s}:"top-left"===_?{x:t.x+bt,y:t.y+bt,w:a,h:s}:{x:t.x+Math.max(bt,(o-a)/2+bt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:s}},[h]),rn=B(!1);t||(rn.current=!1);const on=he||u||null;H(()=>{if(!t)return;Fn(St,on,mt.current??void 0),he||Bn(St),Zt.current=!1,Tt(mr(St));const e=()=>{Tt(mr(St))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===he;if(!e.label)return!1;const t=nt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Bn(St),Mn.current)return;const t=Vn(),n=Math.min(Kn.current.w,t.w-40),o=Math.min(Kn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;dn({x:i,y:a,w:n,h:o}),Wn(!1)},i=e=>{const t=e.detail;r(t)&&(Bn(St),Fe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==he)return;Bn(St);const t=Kn.current,n=function(e,t=Vn()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=nt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}dn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=kn.indexOf(e);-1!==t&&(kn.splice(t,1),Tn()),Cn.delete(e),Nn.delete(e),Dn.delete(e);const n=An.get(e);n&&(An.delete(e),zn.delete(n))}(St),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,St,on,tn]);const an=!J&&"maximized"===vn(),[sn,dn]=Y(()=>{if(on&&ln[on]){const e={...ln[on]};return ue&&(e.w=ue[0],le||(e.h=ue[1])),Zn(e)}return P?{x:P.x,y:P.y,w:P.w,h:P.h}:an?tn():nn()}),[un,hn]=Y(()=>!le),[mn,pn]=Y(()=>r()),fn=B(mn),wn=B(null);H(()=>{const e=()=>{const e=r();e!==fn.current&&wn.current?.(e),fn.current=e,pn(e),Tt(mr(St))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[St]);const yn=mn&&!!je?.tab&&!ht&&!J&&!we,En=yn,Mn=B(En);Mn.current=En;const Sn=Pn(),Ln=mn&&!!je?.tab&&!J&&!we&&!It&&Sn!==je.key,[In,Wn]=Y(()=>on&&ln[on]||P?En:En||an),Kn=B(sn);Kn.current=sn;const On=B(In);j(()=>{On.current=In},[In]),j(()=>{if(un||yn)return;const e=nt.current,t=ot.current;if(!e||!t)return;const n=se??(J?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const l=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&s.unobserve(a),s.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Kn.current.y)-24),g=w?Math.min(Kn.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,dn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),J||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;l(),o===e&&hn(!0)},160)))},s=new ResizeObserver(l);l(),ct.current&&s.observe(ct.current);const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[un,J,se,dt,yn]),j(()=>{if(!le||!un||J||!t)return;const e=ct.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||In)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=se??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,l=Math.max(i,window.innerHeight-a-Math.max(0,Kn.current.y)-24);dn(e=>({...e,h:Math.min(Math.max(i,e.h+r),l)}))});return r.observe(e),()=>r.disconnect()},[le,un,J,t,In,se]);const $n=!1!==ce&&!J&&!ee&&!we,[Rn,qn]=Y(()=>!$n);j(()=>{if(Rn||!t)return;if(!$n||In)return void qn(!0);const n=nt.current,r=ot.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Kn.current.w,c=0;const d=()=>qn(!0),u=()=>{c=0;const t=Kn.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),h=u.w-80;if(t.w>=h)return void d();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=l(t,s(t.w,w,g),u,bt);b!==t&&(i=b.w,dn(b))};u();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(u))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(d,bn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Rn,t,$n,In]);const jn=B(null),_n=!(!je?.tab||ht||J||we);wn.current=t=>{if(!_n)return;if(t)return jn.current||(jn.current={box:{...Kn.current},maximized:On.current}),void(On.current=!0);const r=jn.current;jn.current=null;const o=e();if(r?.maximized)return On.current=!0,Wn(!0),void dn(o);const i=r?.box??(on?ln[on]:void 0);if(On.current=!1,Wn(!1),i&&!n(i,o,!1)){const e={...i};ue&&(e.w=ue[0],le||(e.h=ue[1])),dn(Zn(e))}else dn(nn())},H(()=>{En&&(On.current=!0,Wn(!0),dn(tn()))},[En,tn]),H(()=>{if(J)return;const e=()=>{const e=on?ln[on]:void 0;if(On.current=!1,Wn(!1),e){const t={...e};ue&&(t.w=ue[0],le||(t.h=ue[1])),dn(Zn(t))}else dn(nn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[J,nn,on]),H(()=>{t&&on&&!yn&&(ln[on]=sn,cn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[sn,t,on,yn]),H(()=>{if(!t)return;const e=()=>{On.current?dn(tn()):document.body.classList.contains("rosh-gesturing")||dn(Zn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return In&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,In,tn]),H(()=>{if(t&&(We(!1),Ke.current=!1,tt.current=!1,qn(!$n),!Mn.current)){if(on&&ln[on]){const e=ln[on];return void dn(t=>Zn({...e,...le?{h:t.h}:{},...$n?{x:t.x,w:t.w}:{}}))}P&&(dn({x:P.x,y:P.y,w:P.w,h:P.h}),Wn(P.maximized))}},[t]),H(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{nt.current?.contains(t.target)&&!Ke.current&&(Ke.current=!0,e=setTimeout(()=>We(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const Jn="auto"===m?Pe:!0===m,er=je&&!ht?je.key:null,nr=Q(()=>Dt(Ne),[Ne]),ir=B({shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:Je,taskbarStrings:ze.taskbar});j(()=>{ir.current={shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:Je,taskbarStrings:ze.taskbar}});const ar=B(null);ar.current||(ar.current={open:(e,t)=>Fe({x:e,y:t}),items:()=>{const e=ir.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Jt[St]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),H(()=>{t&&er&&function(e,t){const n=Pt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(Pt.set(e,t),Ot())}(er,{title:nr.text||Ie,dirty:Jn,copy:nr.copy,menu:ar.current??void 0})},[t,er,Ie,Jn,nr.text,nr.copy]),H(()=>{if(t&&er)return()=>{return e=er,void(Pt.delete(e)&&Ot());var e}},[t,er]),Xe(!(he||!t)&&Jn);const lr=X(async()=>{if(!tt.current){if(Jn||"auto"===m&&Ke.current){tt.current=!0;const e=Ie,t=await b({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(tt.current=!1,!t)return}i()}},[Jn,m,i,Ie]);j(()=>{if(!t||!pt)return;const e=e=>{e.detail?.windowKey===pt&&lr()};return window.addEventListener(wr,e),()=>window.removeEventListener(wr,e)},[t,pt,lr]);const cr=B(null),yr=X(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Fe(null),Bn(St),Mn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=nt.current,l=a?.getBoundingClientRect();let s,c,d,u;if(cr.current){const t=cr.current;cr.current=null,u=t.w,d=t.h;const n=l?Math.min(Math.max(20,e.clientX-l.left),t.w-20):t.w/2;s=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${s}px`,a.style.top=`${c}px`)}else s=l?l.left:Kn.current.x,c=l?l.top:Kn.current.y,d=l?l.height:Kn.current.h,u=l?l.width:Kn.current.w;Wn(!1),dn(e=>({...e,x:s,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<ur&&Math.abs(e.clientY-i)<ur)return;r=hr(t,n,"move","move"),a&&(a.style.transition="none")}const l=s+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${l-s}px, ${d-c}px)`),Kn.current={...Kn.current,x:l,y:d},!J){const t=function(e,t){const n=Vn(),r=e<=n.x+Un,o=e>=n.x+n.w-Un,i=t<=n.y+Un,a=t>=n.y+n.h-Un,l=e<=n.x+Xn,s=e>=n.x+n.w-Xn,c=t<=n.y+Xn,d=t>=n.y+n.h-Xn;return i&&l?"tl":i&&s?"tr":a&&l?"bl":a&&s?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?rr(tr(t)):or())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),or();const e=Zn({...Kn.current});if(Kn.current=e,!J&&h){cr.current={x:s,y:c,w:u,h:d};const e=tr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void dn(e)}if(J){const t=e.x+e.w/2,n=window.innerWidth/2;et(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),dn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),gr=X((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,l=nt.current,s=l?.getBoundingClientRect(),c=s?s.left:Kn.current.x,d=s?s.top:Kn.current.y,u=s?s.width:Kn.current.w,h=s?s.height:Kn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Wn(!1),dn({x:c,y:d,w:u,h:h}),Kn.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Kn.current=e,l&&(l.style.left=`${e.x}px`,l.style.top=`${e.y}px`,l.style.width=`${e.w}px`,l.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<ur&&Math.abs(e.clientY-a)<ur)return;o=hr(n,r,dr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Gn,u+e)),w&&(i=Math.max(Qn,h+t)),m){const t=Math.max(Gn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(Qn,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),dn({...Kn.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),br=X(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Bn(St),"Enter"===e.key)return void(In?(Wn(!1),dn(nn())):(Wn(!0),dn(tn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{cr.current||(cr.current={...Kn.current})};if(r<0)return e(),Wn(!0),void dn(tn());if(r>0){if(In)return Wn(!1),void dn(nn());if(cr.current){const e=Zn(cr.current);return cr.current=null,Kn.current=e,void dn(e)}return void Hn(St)}e(),Wn(!1);const t=tr(n<0?"left":"right");return Kn.current=t,void dn(t)}if(In)return;const o=Kn.current,i=e.shiftKey?{...o,w:Math.max(Gn,o.w+24*n),h:Math.max(Qn,o.h+24*r)}:Zn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Kn.current=i,dn(i)},[St,In,nn,tn]),Er=X(e=>{cr.current||(cr.current={...Kn.current}),Wn(!1);const t=tr(e);Kn.current=t,dn(t),Bn(St)},[St]),Cr=En||Rt?{}:{tabIndex:0,role:"group","aria-label":Ie?`${Ie} — ${De.windowSuffix}`:De.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:br},Nr=()=>{Wn(!0),dn(tn())},zr=X(()=>{const e=nt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Yt);t&&!t.disabled&&t.click()}},[]);H(()=>{if(!t)return;if(J)return;const e=e=>{if(kn[kn.length-1]===St&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),zr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&nt.current?.contains(t)))return;if(t.closest(Ut))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,zr,St,J]),H(()=>{if(!t)return;const e=e=>{kn[kn.length-1]===St&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:St}})),Ke.current=!1,We(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:St}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),H(()=>{if(!t)return;if(J)return;const e=e=>{if("Escape"===e.key&&kn[kn.length-1]===St){if(M(e))return e.preventDefault(),void e.stopPropagation();if(yn&&!R)return;e.preventDefault(),e.stopPropagation(),lr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,lr,St,J,yn,R]);const Ar=t&&(void 0!==p||void 0!==f),Pr=X(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-[9999] bg-gray-900 text-white px-5 py-2.5 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(H(()=>{if(!t)return;const e=e=>{if(kn[kn.length-1]!==St)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Ar&&(e.preventDefault(),p?p():Pr("bottom")),"k"===e.key&&Ar&&(e.preventDefault(),f?f():Pr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Ar,Pr,St]),!t||rn.current)return null;const Wr=Rt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),l=n%o,s=r-o*(i-1),c=a===i-1&&s<o,d=Vn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-s)*(u+20)/2:0;return{x:d.x+20+l*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(St):null,Kr=Rt&&Wr?Math.min(Wr.w/sn.w,Wr.h/sn.h):1,Or=(()=>{if(Rt&&Wr){const e=Kr,t=sn.w*e,n=sn.h*e,r=Wr.x+(Wr.w-t)/2-sn.x,o=Wr.y+(Wr.h-n)/2-sn.y,i=Ft||Ht;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:i?2020:2010,boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Vt&&$t){const e="picked"===Gt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:2030}:{}}}return null})(),$r=/* @__PURE__ */ne("div",{children:[
|
|
50
|
+
/* @__PURE__ */ne("div",{ref:nt,"data-modal-panel":!0,"data-modal-id":St,"data-window-key":he||void 0,...q?{"data-utility":""}:{},...Oe?{"data-pinned-top":""}:{},...J?{"data-widget":""}:{},...je?{"data-window-owner":je.key}:{},...je&&!ht?{"data-window-root":""}:{},...yn?{"data-window-tab":""}:{},className:yn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(J?zt?"shadow-2xl":"shadow-lg":"border "+(zt?"shadow-2xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(rt.current=!1,Rt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Tr(St),kr(!1),void Bn(St)}if(!zt&&!J&&!Oe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===nt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),rt.current=!0,Fe(null),Bn(St),window.addEventListener("mouseup",()=>{setTimeout(()=>{rt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{rt.current&&(rt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Rt)return;Fe(null);e.target.closest("[data-modal-panel]")===nt.current&&(e.target.closest("button, input, a, select, textarea")||Bn(St))},style:we?{zIndex:Lt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ye}px)`,transition:be?"none":"transform 180ms ease-out",...J?{display:"none"}:{},...Lt<0?{display:"none"}:{},...zt||Oe||Me&&he===Me?{}:{display:"none"}}:{zIndex:Oe?C.pinnedWindow:Lt+1,width:sn.w,height:sn.h,top:sn.y,...J&&"right"===Ze?{right:window.innerWidth-sn.x-sn.w}:{left:sn.x},...Lt<0&&!Oe?{display:"none"}:{},...Ln?{visibility:"hidden",pointerEvents:"none"}:{},...Or??{}},children:[we&&!J&&/* @__PURE__ */re("div",{onPointerDown:Ce,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),J?null:yn?je?.home?null:/* @__PURE__ */ne(oe,{children:[
|
|
51
|
+
/* @__PURE__ */re("h2",{"data-window-title":!0,className:"sr-only",children:nr.text||Ie}),(nr.accessories.length>0||Ar)&&/* @__PURE__ */ne("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-3 border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:[
|
|
52
|
+
/* @__PURE__ */re("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:nr.accessories}),Ar&&/* @__PURE__ */ne("span",{className:"flex items-center gap-1 shrink-0 text-[10px] text-gray-400",children:[
|
|
53
|
+
/* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-1.5 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
54
|
+
/* @__PURE__ */re("span",{children:De.prev}),
|
|
55
|
+
/* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-1.5 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
56
|
+
/* @__PURE__ */re("span",{children:De.next})]})]})]}):we?null:
|
|
57
|
+
/* @__PURE__ */ne("div",Z?{onPointerDown:yr,"data-window-chrome":"",...Cr,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
58
|
+
/* @__PURE__ */ne("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Rt&>(),
|
|
59
|
+
/* @__PURE__ */re("span",{className:"truncate",children:Rt?Xt(Ne):Ne})]}),!Rt&&/* @__PURE__ */ne("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[q&&/* @__PURE__ */re("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
60
|
+
/* @__PURE__ */re("button",{type:"button",onClick:lr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-4 w-4"})})]})]}:ee?{onPointerDown:yr,"data-window-chrome":"",...Cr,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
61
|
+
/* @__PURE__ */ne("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Rt&>(),
|
|
62
|
+
/* @__PURE__ */re("span",{className:"truncate",children:Rt?Xt(Ne):Ne})]}),!Rt&&/* @__PURE__ */ne("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[q&&/* @__PURE__ */re("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
63
|
+
/* @__PURE__ */re("button",{onClick:()=>Hn(St),title:De.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!En&&/* @__PURE__ */re(sr,{maximized:In,onToggleMax:()=>{In?(Wn(!1),dn(nn())):Nr()},onSnap:Er,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:De}),
|
|
64
|
+
/* @__PURE__ */re("button",{type:"button",onClick:lr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-4 w-4"})})]})]}:{onPointerDown:yr,"data-window-chrome":"",...Cr,className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
65
|
+
/* @__PURE__ */ne("div",{"data-window-title":!0,title:Ie,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Rt&>(),
|
|
66
|
+
/* @__PURE__ */re("span",{className:"truncate",children:Rt?Xt(Ne):Ne})]}),!Rt&&/* @__PURE__ */ne("div",{className:"flex items-center gap-1.5 shrink-0 ml-4",children:[Ar&&/* @__PURE__ */ne("span",{className:"flex items-center gap-1 mr-1 text-[10px] text-gray-400",children:[
|
|
67
|
+
/* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
68
|
+
/* @__PURE__ */re("span",{children:De.prev}),
|
|
69
|
+
/* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
70
|
+
/* @__PURE__ */re("span",{children:De.next})]}),q&&/* @__PURE__ */re("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-3.5 w-3.5",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
71
|
+
/* @__PURE__ */re("button",{onClick:()=>Hn(St),title:De.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!En&&/* @__PURE__ */re(sr,{maximized:In,onToggleMax:()=>{In?(Wn(!1),dn(nn())):Nr()},onSnap:Er,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:De}),
|
|
72
|
+
/* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:"ESC"}),
|
|
73
|
+
/* @__PURE__ */re("button",{type:"button",onClick:lr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-5 w-5"})})]})]}),pe&&Ye&&!J&&!we&&/* @__PURE__ */re("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
|
|
74
|
+
/* @__PURE__ */re(qt.Provider,{value:St,children:/* @__PURE__ */re(en.Provider,{value:{rightRef:it,leftRef:at,notify:()=>st(!0),active:zt,isDirty:Jn,footerOpen:dt&&!J&&!Z&&!ee&&!we},children:/* @__PURE__ */re("div",{ref:ot,...J?{onPointerDown:yr,onContextMenu:e=>{e.preventDefault(),Qe({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${J?"p-0 cursor-move":ee||te?"p-0":Z?"p-2":"p-4"} ${J||yn?"":"backdrop-blur-sm"} ${!1===E||ee||te?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${J?"rounded-2xl select-none":""}`,style:{...J?{touchAction:"none"}:{},backgroundColor:J?"transparent":yn?"rgb(var(--window-content-rgb))":zt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */re(Le,{children:fe})})})}),J&&Ge&&/* @__PURE__ */ne(v,{minWidth:160,style:{left:Ge.x,top:Ge.y},onClose:()=>Qe(null),children:[
|
|
75
|
+
/* @__PURE__ */re(x,{onClick:()=>{Qe(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:St}))},children:"Settings"}),
|
|
76
|
+
/* @__PURE__ */re(k,{}),de&&/* @__PURE__ */ne(oe,{children:[de,
|
|
77
|
+
/* @__PURE__ */re(k,{})]}),
|
|
78
|
+
/* @__PURE__ */ne(x,{onClick:()=>{Qe(null),$e(e=>!e)},children:[
|
|
79
|
+
/* @__PURE__ */re("span",{className:"flex-1",children:"Always on Top"}),Oe&&/* @__PURE__ */re($,{name:"check",fallback:T,className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
|
|
80
|
+
/* @__PURE__ */re(k,{}),
|
|
81
|
+
/* @__PURE__ */re(x,{onClick:()=>{Qe(null),lr()},children:"Close"})]}),
|
|
82
|
+
/* @__PURE__ */ne("div",{onPointerDown:yr,ref:ct,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${yn?"":" cursor-move"}${zt&&!yn?" backdrop-blur-sm":""}${J||Z||ee||we||!dt?" hidden":""}`,style:{touchAction:"none",backgroundColor:yn?"rgb(var(--window-footer-rgb))":zt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
83
|
+
/* @__PURE__ */ne("div",{className:"flex items-center gap-2 min-w-0",children:[ft&&/* @__PURE__ */re(Ae,{auto:!0}),K,
|
|
84
|
+
/* @__PURE__ */re("div",{ref:at,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),g]}),
|
|
85
|
+
/* @__PURE__ */ne("div",{className:"flex items-center gap-2 ml-auto",children:[
|
|
86
|
+
/* @__PURE__ */re("div",{ref:it,"data-modal-actions":!0,className:"flex items-center gap-2"}),W]})]}),!J&&!we&&!Rt&&zt&&!En&&/* @__PURE__ */ne(oe,{children:[
|
|
87
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
88
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
89
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
90
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
91
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
92
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
93
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
94
|
+
/* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Rt&&/* @__PURE__ */re("div",{className:"absolute inset-0",style:{zIndex:9999,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Bt(!0),onMouseLeave:()=>Bt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Bn(St),kr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Ft&&/* @__PURE__ */re("button",{type:"button","data-expose-close":!0,"aria-label":ze.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Kr})`,transformOrigin:"top right",zIndex:1e4},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),lr()},children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-4 w-4",strokeWidth:2.2})})})]}),Rt&&Wr&&/* @__PURE__ */re("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Wr.x,top:Wr.y+Wr.h+4,width:Wr.w,zIndex:Ft?2021:2011,color:"white",fontSize:12,fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Xt(Ne)})]}),Rr=Re&&/* @__PURE__ */ne(v,{style:{left:Re.x,top:Re.y},onClose:()=>Fe(null),minWidth:160,children:[!J&&!Z&&!yn&&/* @__PURE__ */ne(oe,{children:[
|
|
95
|
+
/* @__PURE__ */ne(x,{onClick:()=>{Hn(St),Fe(null)},children:[
|
|
96
|
+
/* @__PURE__ */re($,{name:"remove",fallback:A,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),De.minimize]}),!En&&/* @__PURE__ */ne(x,In?{onClick:()=>{Wn(!1),dn(nn()),Fe(null)},children:[
|
|
97
|
+
/* @__PURE__ */re("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */re("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),De.windowed]}:{onClick:()=>{Nr(),Fe(null)},children:[
|
|
98
|
+
/* @__PURE__ */re($,{name:"expand",fallback:D,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),De.maximize]})]}),q&&!yn&&/* @__PURE__ */ne(x,{onClick:()=>{$e(e=>!e),Fe(null)},children:[
|
|
99
|
+
/* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-4 w-4 "+(Oe?"text-blue-600":"text-gray-400"),fill:Oe?"currentColor":"none",strokeWidth:1.5}),Oe?De.unpin:De.pinOnTop]}),qe&&/* @__PURE__ */ne(x,{onClick:()=>{Fe(null),Je()},children:[
|
|
100
|
+
/* @__PURE__ */re($,{name:"star",fallback:S,className:"h-4 w-4 "+(Ve?"text-yellow-500":"text-gray-400"),fill:Ve?"currentColor":"none",strokeWidth:1.5}),Ve?ze.taskbar.removeFromDesktop:ze.taskbar.addToDesktop]}),(Jt[St]||[]).length>0&&/* @__PURE__ */re(oe,{children:(Jt[St]||[]).map((e,t)=>/* @__PURE__ */ne(x,{onClick:()=>{Fe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(yn&&je?.home)&&/* @__PURE__ */ne(oe,{children:[
|
|
101
|
+
/* @__PURE__ */re(k,{}),
|
|
102
|
+
/* @__PURE__ */ne(x,{danger:!0,onClick:()=>{Fe(null),lr()},children:[
|
|
103
|
+
/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-4 w-4"}),De.close]})]})]}),Fr=!!he&&Nt.some(e=>e.id===he),qr=!At||Fr||J?null:/* @__PURE__ */ne("div",{"data-modal-restore-tab":!0,"data-modal-id":St,className:"fixed left-1/2 z-[1200] flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-1.5 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
104
|
+
/* @__PURE__ */re("button",{type:"button",onClick:()=>Bn(St),title:De.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Ie||De.windowSuffix}),
|
|
105
|
+
/* @__PURE__ */re("button",{type:"button",onClick:()=>Bn(St),title:De.restore,"aria-label":De.restore,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
106
|
+
/* @__PURE__ */re("button",{type:"button",onClick:()=>{lr()},title:De.close,"aria-label":De.close,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return ie(
|
|
107
|
+
/* @__PURE__ */ne(jt.Provider,{value:null,children:[$r,Rr,qr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{gr&&"Escape"===e.key&&(Pr(null),kr(!1))});var Rr=100,Fr={past:[],future:[]};function qr(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Rr?r.slice(r.length-Rr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Fr}}var jr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Br=500,Hr=250;function Yr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=Z(qr,Fr),l=B(/* @__PURE__ */new Map),[s,c]=Y(0),d=s>0,[u,h]=Y(0),[m,p]=Y(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===u&&(!(n&&n.length>0)||w(n)),g=B(null),b=B(!1),v=X(()=>{const e={};for(const[t,n]of l.current)e[t]=n.getLast();return e},[]),x=X((e,t)=>{l.current.has(e)||c(e=>e+1),l.current.set(e,t)},[]),k=X(e=>{l.current.delete(e)&&c(e=>e-1)},[]),E=X(e=>{h(t=>t+(e?1:-1))},[]),C=X(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=Y(0),S=M>0,L=X(e=>{N(t=>t+(e?1:-1))},[]),T=F(Te),z=T?.claimReadOnly;H(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;H(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=B({last:0,count:0,tripped:!1}),I=B(!1),P=X((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(I.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Hr&&(r.count=0),r.last=o,++r.count>Br)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Br} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,v]),W=X(e=>{for(const[t,n]of Object.entries(e)){const e=l.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),K=X(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"undo",redoStep:t})},[o.past,v,W]),O=X(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"redo",undoStep:t})},[o.future,v,W]),[$,R]=Y(0),q=B(0),j=B(0),U=B(!1),V=X(()=>{b.current=!0,I.current=!1,g.current=null,q.current+=1,j.current=q.current,R(q.current)},[]),_=B(void 0),J=X(e=>{void 0!==e&&(void 0!==_.current&&e!==_.current&&(U.current=!0),_.current=e),V()},[V]);H(()=>{b.current&&$===j.current&&(b.current=!1,g.current=null,(I.current||U.current)&&a({type:"clear"}),I.current=!1,U.current=!1)},[$]);const G=X(()=>{U.current=!0,a({type:"clear"}),V()},[V]),ee=y&&o.past.length>0,te=y&&o.future.length>0,oe=yr(r),ie=B({undo:K,redo:O,canUndo:ee,canRedo:te});ie.current={undo:K,redo:O,canUndo:ee,canRedo:te},H(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&jr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=Q(()=>({register:x,unregister:k,record:P,undo:K,redo:O,clear:G,baseline:J,canUndo:ee,canRedo:te,enabled:y,hasState:d,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ee?o.past[o.past.length-1].label:null,redoLabel:te?o.future[0].label:null}),[x,k,P,K,O,G,J,ee,te,y,d,S,L,E,f,C,o.past,o.future]),le=""!==tn(),se=F(en)?.footerOpen??!1,ce=le&&y&&d&&!S&&se;/* @__PURE__ */
|
|
108
|
+
return ne(Te.Provider,{value:ae,children:[ce&&/* @__PURE__ */re(rn,{position:"left",quiet:!0,children:/* @__PURE__ */re(Ae,{auto:!0})}),e]})}function Ur(){const e=F(Te),t=X(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function Xr(e){const t=F(Te),n=t?.claimReadOnly,r=t?.claimEditable;H(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Vr(e,t,n){const r=F(Te),o=ee(),i=B(e),a=B(t);a.current=t,H(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:l,coalesceKey:s=null}=n,c=B(r);c.current=r;const d=B({label:l,coalesceKey:s});d.current={label:l,coalesceKey:s},H(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function _r(e,t){const[n,r]=Y(e);return Vr(n,e=>r(()=>e),t),[n,r]}export{on as CancelButton,Qe as DocFavStar,Fe as EntityWindowFallback,$e as EntityWindowLoading,qe as EntityWindowState,Ut as KEY_ACTIVATED_SELECTOR,Ke as LoadingSpinner,Yt as MODAL_SUBMIT_SELECTOR,$r as Modal,rn as ModalActions,Ae as UndoControls,Yr as UndoProvider,pe as WINDOW_REGISTRY,Se as WindowCrashedFallback,Le as WindowErrorBoundary,yt as WindowManagerProvider,Qt as WindowTitle,rt as activateWindowById,Lt as beginWindowGesture,Rn as cancelWindowFront,be as client_default,Wr as commitExposeHighlight,Tt as drainPerfEvents,Cr as exitExposeMode,yn as forgetMaximizedWindowBoxes,pr as getActiveModalId,lt as getActiveWindowRoute,Ir as getExposeHighlight,Ft as getWindowChromeVersion,fn as getWindowPosition,Be as isDraftEntityId,He as isDraftEntityWindow,ue as isEntityEntry,de as isPageEntry,ye as isShellApiClientConfigured,ot as isTabWindow,St as markMenuOpen,$t as readWindowChrome,$n as requestWindowFront,Pr as setExposeHighlight,Nt as setPerfCollecting,we as setShellApiClient,Ce as setShellHomeRoute,me as setShellWindowRegistry,pn as setWindowDefaultPosition,wn as setWindowPosition,Dt as splitTitle,Dr as subscribeExposeHighlight,Rt as subscribeWindowChrome,Er as toggleExposeMode,Pn as useCurrentTabKey,tn as useEnclosingModalId,yr as useIsActiveWindow,nn as useModalActive,xe as usePageSearch,Ur as useUndo,Xr as useUndoCanEdit,Vr as useUndoable,_r as useUndoableState,_t as useWidgetSettings,Xe as useWindowDirty,_e as useWindowManager,Gt as useWindowMenuItem,Zt as useWindowTitle};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{useWindowMenuItem as e,Modal as t}from"./chunk-SBDIHKLU.js";import{navIcons as r}from"./chunk-DSSLOQDW.js";import{VERSION as s}from"./chunk-YKHMAGEM.js";import{InfoFallback as o,WindowFallback as n}from"./chunk-XUF7VW4U.js";import{DEFAULT_SHELL_STRINGS as i,useShellStrings as a,splitAround as m}from"./chunk-J3LIIIHJ.js";import{Icon as c}from"./chunk-YKZHOXI4.js";import{useState as l,useCallback as p,isValidElement as d,cloneElement as h}from"react";import{jsx as u,jsxs as f}from"react/jsx-runtime";var x=i.aboutApp,v={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:x.spreadsheet},notepad:{name:"Notepad",version:"1.0.1",route:"/notepad",description:x.notepad},documents:{name:"Documents",version:"1.1.0",route:"/documents",description:x.documents},preview:{name:"Preview",version:"1.4.2",route:"/preview",description:x.preview},files:{name:"Files",version:"1.1.1",route:"/files",description:x.files},browser:{name:"Browser",version:"1.0.1",route:"/browser",description:x.browser}},w=/* @__PURE__ */u(c,{name:"info",fallback:o,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),g=/* @__PURE__ */u(c,{name:"window",fallback:n,className:"h-9 w-9",strokeWidth:1.5});function b({app:o}){const n=v[o],[i,c]=l(!1),x=p(()=>c(!0),[]),b=a().aboutApp,N=b.title(n.name);if(e(N,x,w),!i)return null;const y=r[n.route],k=d(y)?h(y,{className:"h-9 w-9"}):g,[j,H]=m(b.partOf);/* @__PURE__ */
|
|
2
|
+
return u(t,{open:!0,onClose:()=>c(!1),title:N,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */f("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
|
|
3
|
+
/* @__PURE__ */u("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:k}),
|
|
4
|
+
/* @__PURE__ */u("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:n.name}),
|
|
5
|
+
/* @__PURE__ */u("p",{className:"text-[11px] font-mono text-gray-400",children:b.version(n.version)}),
|
|
6
|
+
/* @__PURE__ */u("p",{className:"mt-2 text-xs text-gray-500 leading-relaxed",children:b[o]}),
|
|
7
|
+
/* @__PURE__ */f("div",{className:"mt-4 pt-3 border-t border-gray-200 w-full",children:[
|
|
8
|
+
/* @__PURE__ */f("p",{className:"text-[11px] text-gray-500",children:[j,
|
|
9
|
+
/* @__PURE__ */u("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),H]}),s&&/* @__PURE__ */u("p",{className:"mt-0.5 text-[10px] font-mono text-gray-400",children:b.shellVersion(s)})]})]})})}export{b as AboutApp,v as BUILTIN_APP_INFO};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{ChevronRightFallbackC as e}from"./chunk-XUF7VW4U.js";import{useShellStrings as i}from"./chunk-J3LIIIHJ.js";import{Icon as t}from"./chunk-YKZHOXI4.js";import{Fragment as a}from"react";import{jsx as n,jsxs as s}from"react/jsx-runtime";var r=/* @__PURE__ */n(t,{name:"chevron-right",fallback:e,className:"h-3.5 w-3.5 shrink-0 text-gray-300","aria-hidden":!0}),l="inline-flex min-w-0 items-center gap-1 truncate rounded px-1 -mx-1 text-gray-500 transition-colors hover:text-gray-900 hover:underline rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]";function c({items:e,separator:t,maxItems:c=0,className:m}){const o=i().breadcrumbs;if(0===e.length)return null;const h=t??r,d=[],u=e.length-1;if(c>0&&e.length>c&&c>=2){const i=Math.max(1,c-1);d.push({kind:"item",item:e[0],isLast:!1}),d.push({kind:"ellipsis"});for(let t=e.length-i;t<=u;t++)d.push({kind:"item",item:e[t],isLast:t===u})}else e.forEach((e,i)=>d.push({kind:"item",item:e,isLast:i===u}));/* @__PURE__ */
|
|
2
|
+
return n("nav",{"aria-label":o.label,className:`min-w-0 ${m??""}`,children:/* @__PURE__ */n("ol",{className:"flex items-center gap-1.5 text-sm",children:d.map((e,i)=>/* @__PURE__ */s(a,{children:[i>0&&/* @__PURE__ */n("li",{"aria-hidden":!0,className:"flex items-center",children:h}),
|
|
3
|
+
/* @__PURE__ */n("li",{className:"flex min-w-0 items-center",children:"ellipsis"===e.kind?/* @__PURE__ */n("span",{className:"px-0.5 text-gray-400 select-none","aria-label":o.hidden,children:"…"}):e.isLast||!e.item.href&&!e.item.onClick?/* @__PURE__ */s("span",{"aria-current":e.isLast?"page":void 0,className:"inline-flex min-w-0 items-center gap-1 truncate "+(e.isLast?"font-medium text-gray-900":"text-gray-500"),children:[e.item.icon,
|
|
4
|
+
/* @__PURE__ */n("span",{className:"truncate",children:e.item.label})]}):e.item.href?/* @__PURE__ */s("a",{href:e.item.href,onClick:e.item.onClick,className:l,children:[e.item.icon,
|
|
5
|
+
/* @__PURE__ */n("span",{className:"truncate",children:e.item.label})]}):/* @__PURE__ */s("button",{type:"button",onClick:e.item.onClick,className:l,children:[e.item.icon,
|
|
6
|
+
/* @__PURE__ */n("span",{className:"truncate",children:e.item.label})]})})]},i))})})}export{c as Breadcrumbs};
|