efficient-shell 4.134.0 → 4.137.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -17
- package/README.md +84 -8
- package/dist/Browser-ZX5OTOKK.js +43 -0
- package/dist/Calculator-4SQGOQFQ.js +29 -0
- package/dist/ConfirmDialog-NPKW2XHM.js +1 -0
- package/dist/CurrencyConverter-2KOM7L6V.js +21 -0
- package/dist/Documents-IZTIQYPG.js +52 -0
- package/dist/Files-B63KKXGZ.js +89 -0
- package/dist/Notepad-WA77V45J.js +25 -0
- package/dist/PdfViewer-RBRGEKWF.js +1 -0
- package/dist/PomodoroTimer-SDUBKXUS.js +99 -0
- package/dist/Preview-D4KOA4OI.js +187 -0
- package/dist/Sidebar-Y57LYXXI.js +23 -0
- package/dist/Spreadsheet-JX5E6WH6.js +37 -0
- package/dist/Stock-XAQ5WMUZ.js +16 -0
- package/dist/Weather-HLAGJ5LV.js +60 -0
- package/dist/WorldClock-IRI4VCTA.js +32 -0
- package/dist/apps/index.js +1 -151
- package/dist/brand.css +1 -1
- package/dist/chunk-3A46NCXK.js +29 -0
- package/dist/chunk-44UO7FYU.js +11 -0
- package/dist/chunk-466CM2TJ.js +1 -0
- package/dist/chunk-57MIENLJ.js +1 -0
- package/dist/chunk-5CRAF2AD.js +2 -0
- package/dist/chunk-A2OQLLYK.js +6 -0
- package/dist/chunk-B43AGQET.js +4 -0
- package/dist/chunk-BR22X7E5.js +1 -0
- package/dist/chunk-BUTSU7FO.js +1 -0
- package/dist/chunk-D65T4H6J.js +1 -0
- package/dist/chunk-ESL5TDNA.js +1 -0
- package/dist/chunk-FBDZGO3V.js +1 -0
- package/dist/chunk-FHTLC7HH.js +1 -0
- package/dist/chunk-FQLMX3IE.js +948 -0
- package/dist/chunk-H562R4GX.js +34 -0
- package/dist/chunk-JN4WXTWJ.js +106 -0
- package/dist/chunk-LVDRBRYU.js +1 -0
- package/dist/chunk-LWLCNQY7.js +1 -0
- package/dist/chunk-MAIHBBWT.js +1 -0
- package/dist/chunk-NPJH5MD7.js +13 -0
- package/dist/chunk-OCSOMMY2.js +1 -0
- package/dist/chunk-OQDWLHZI.js +1 -0
- package/dist/chunk-OWSAMA3I.js +23 -0
- package/dist/chunk-PH3PRIFP.js +5 -0
- package/dist/chunk-TAWKWSPN.js +9 -0
- package/dist/chunk-U4GTZPXP.js +1 -0
- package/dist/chunk-UB4JIOLD.js +2 -0
- package/dist/chunk-UZAJ5BF6.js +9 -0
- package/dist/chunk-VEGMDXT4.js +1 -0
- package/dist/chunk-VTVSMRFX.js +1 -0
- package/dist/chunk-VVAGSKW7.js +1 -0
- package/dist/chunk-XO43FJRM.js +19 -0
- package/dist/chunk-Y7BOLDRM.js +69 -0
- package/dist/file-intake/index.js +1 -4
- package/dist/{index-DZ7E7bCl.d.ts → index-DVI9DMSu.d.ts} +189 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +639 -7473
- package/dist/map/index.js +20 -540
- package/dist/markdown/index.js +6 -184
- package/dist/markup/index.js +1 -135
- package/dist/page-tabs/index.js +21 -709
- package/dist/sounds-OMHXVVQ4.js +1 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -19
- package/dist/ui.css +78 -10
- package/package.json +4 -3
- package/dist/Browser-O3QZGUF2.js +0 -482
- package/dist/Browser-O3QZGUF2.js.map +0 -1
- package/dist/Calculator-L6N5X3KU.js +0 -192
- package/dist/Calculator-L6N5X3KU.js.map +0 -1
- package/dist/ConfirmDialog-LYSSZSUD.js +0 -4
- package/dist/ConfirmDialog-LYSSZSUD.js.map +0 -1
- package/dist/CurrencyConverter-64MKXB3D.js +0 -236
- package/dist/CurrencyConverter-64MKXB3D.js.map +0 -1
- package/dist/Documents-5WXXYCLI.js +0 -441
- package/dist/Documents-5WXXYCLI.js.map +0 -1
- package/dist/Files-AUURUUDN.js +0 -805
- package/dist/Files-AUURUUDN.js.map +0 -1
- package/dist/Notepad-GPXJVPB7.js +0 -410
- package/dist/Notepad-GPXJVPB7.js.map +0 -1
- package/dist/PdfViewer-HKO6P4SR.js +0 -5
- package/dist/PdfViewer-HKO6P4SR.js.map +0 -1
- package/dist/PomodoroTimer-4TQBWLP2.js +0 -633
- package/dist/PomodoroTimer-4TQBWLP2.js.map +0 -1
- package/dist/Preview-FOZYPKM2.js +0 -2959
- package/dist/Preview-FOZYPKM2.js.map +0 -1
- package/dist/Sidebar-BPU7RCZP.js +0 -291
- package/dist/Sidebar-BPU7RCZP.js.map +0 -1
- package/dist/Spreadsheet-3C66BBBF.js +0 -519
- package/dist/Spreadsheet-3C66BBBF.js.map +0 -1
- package/dist/Stock-IF4IHYLU.js +0 -158
- package/dist/Stock-IF4IHYLU.js.map +0 -1
- package/dist/Weather-725PFR7T.js +0 -431
- package/dist/Weather-725PFR7T.js.map +0 -1
- package/dist/WorldClock-UU4NZIQ7.js +0 -202
- package/dist/WorldClock-UU4NZIQ7.js.map +0 -1
- package/dist/apps/index.js.map +0 -1
- package/dist/chunk-2TPTHAKI.js +0 -316
- package/dist/chunk-2TPTHAKI.js.map +0 -1
- package/dist/chunk-4P44JXDS.js +0 -195
- package/dist/chunk-4P44JXDS.js.map +0 -1
- package/dist/chunk-5O42JXQE.js +0 -26
- package/dist/chunk-5O42JXQE.js.map +0 -1
- package/dist/chunk-72CQWN7O.js +0 -547
- package/dist/chunk-72CQWN7O.js.map +0 -1
- package/dist/chunk-7CCHEEYC.js +0 -94
- package/dist/chunk-7CCHEEYC.js.map +0 -1
- package/dist/chunk-BE7FZOFU.js +0 -17
- package/dist/chunk-BE7FZOFU.js.map +0 -1
- package/dist/chunk-D276EMXS.js +0 -57
- package/dist/chunk-D276EMXS.js.map +0 -1
- package/dist/chunk-D7PYW2QS.js +0 -265
- package/dist/chunk-D7PYW2QS.js.map +0 -1
- package/dist/chunk-DVZWYWSD.js +0 -26
- package/dist/chunk-DVZWYWSD.js.map +0 -1
- package/dist/chunk-ET6ID4LP.js +0 -102
- package/dist/chunk-ET6ID4LP.js.map +0 -1
- package/dist/chunk-GA35NEND.js +0 -56
- package/dist/chunk-GA35NEND.js.map +0 -1
- package/dist/chunk-GIGV2ZRW.js +0 -70
- package/dist/chunk-GIGV2ZRW.js.map +0 -1
- package/dist/chunk-IPXN646P.js +0 -14
- package/dist/chunk-IPXN646P.js.map +0 -1
- package/dist/chunk-IRWSRJ4K.js +0 -48
- package/dist/chunk-IRWSRJ4K.js.map +0 -1
- package/dist/chunk-IULP5BCD.js +0 -79
- package/dist/chunk-IULP5BCD.js.map +0 -1
- package/dist/chunk-MGGY74RY.js +0 -14
- package/dist/chunk-MGGY74RY.js.map +0 -1
- package/dist/chunk-OLJDJYSU.js +0 -13678
- package/dist/chunk-OLJDJYSU.js.map +0 -1
- package/dist/chunk-PIGDNN5F.js +0 -46
- package/dist/chunk-PIGDNN5F.js.map +0 -1
- package/dist/chunk-Q2MJVSJT.js +0 -7
- package/dist/chunk-Q2MJVSJT.js.map +0 -1
- package/dist/chunk-Q3LT745N.js +0 -3710
- package/dist/chunk-Q3LT745N.js.map +0 -1
- package/dist/chunk-QAGQRNKI.js +0 -145
- package/dist/chunk-QAGQRNKI.js.map +0 -1
- package/dist/chunk-QRL64J5F.js +0 -503
- package/dist/chunk-QRL64J5F.js.map +0 -1
- package/dist/chunk-QSKCQUZE.js +0 -1103
- package/dist/chunk-QSKCQUZE.js.map +0 -1
- package/dist/chunk-R4OQIQYX.js +0 -153
- package/dist/chunk-R4OQIQYX.js.map +0 -1
- package/dist/chunk-RT6DSB5Y.js +0 -143
- package/dist/chunk-RT6DSB5Y.js.map +0 -1
- package/dist/chunk-SHQM5CK3.js +0 -549
- package/dist/chunk-SHQM5CK3.js.map +0 -1
- package/dist/chunk-T4VQHMG4.js +0 -822
- package/dist/chunk-T4VQHMG4.js.map +0 -1
- package/dist/chunk-TRCWINHF.js +0 -105
- package/dist/chunk-TRCWINHF.js.map +0 -1
- package/dist/chunk-TW7LPMVR.js +0 -16
- package/dist/chunk-TW7LPMVR.js.map +0 -1
- package/dist/chunk-W622KQTD.js +0 -465
- package/dist/chunk-W622KQTD.js.map +0 -1
- package/dist/chunk-X4Q6G253.js +0 -416
- package/dist/chunk-X4Q6G253.js.map +0 -1
- package/dist/chunk-YNKK7NE3.js +0 -171
- package/dist/chunk-YNKK7NE3.js.map +0 -1
- package/dist/chunk-YPO6RDMX.js +0 -20
- package/dist/chunk-YPO6RDMX.js.map +0 -1
- package/dist/file-intake/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/map/index.js.map +0 -1
- package/dist/markdown/index.js.map +0 -1
- package/dist/markup/index.js.map +0 -1
- package/dist/page-tabs/index.js.map +0 -1
- package/dist/sounds-NT4DEZGD.js +0 -3
- package/dist/sounds-NT4DEZGD.js.map +0 -1
- package/dist/ui/index.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{Modal as e}from"./chunk-JN4WXTWJ.js";import{keepsNativeMenu as a}from"./chunk-UZAJ5BF6.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
|
+
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
|
+
/* @__PURE__ */n("div",{children:[
|
|
4
|
+
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
|
|
5
|
+
/* @__PURE__ */n("div",{className:"grid grid-cols-2 gap-4",children:[
|
|
6
|
+
/* @__PURE__ */n("div",{children:[
|
|
7
|
+
/* @__PURE__ */i("div",{className:"text-xs font-medium text-gray-600 mb-2",children:"Active"}),
|
|
8
|
+
/* @__PURE__ */n("div",{className:"space-y-2",children:[
|
|
9
|
+
/* @__PURE__ */n("div",{children:[
|
|
10
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
11
|
+
/* @__PURE__ */i("span",{children:"Opacity"}),
|
|
12
|
+
/* @__PURE__ */n("span",{children:[c.activeOpacity,"%"]})]}),
|
|
13
|
+
/* @__PURE__ */i("input",{type:"range",min:20,max:100,value:c.activeOpacity,onChange:e=>s({...c,activeOpacity:+e.target.value}),className:u})]}),
|
|
14
|
+
/* @__PURE__ */n("div",{children:[
|
|
15
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
16
|
+
/* @__PURE__ */i("span",{children:"Blur"}),
|
|
17
|
+
/* @__PURE__ */n("span",{children:[c.activeBlur,"px"]})]}),
|
|
18
|
+
/* @__PURE__ */i("input",{type:"range",min:0,max:20,value:c.activeBlur,onChange:e=>s({...c,activeBlur:+e.target.value}),className:u})]})]})]}),
|
|
19
|
+
/* @__PURE__ */n("div",{children:[
|
|
20
|
+
/* @__PURE__ */i("div",{className:"text-xs font-medium text-gray-600 mb-2",children:"Inactive"}),
|
|
21
|
+
/* @__PURE__ */n("div",{className:"space-y-2",children:[
|
|
22
|
+
/* @__PURE__ */n("div",{children:[
|
|
23
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
24
|
+
/* @__PURE__ */i("span",{children:"Opacity"}),
|
|
25
|
+
/* @__PURE__ */n("span",{children:[c.inactiveOpacity,"%"]})]}),
|
|
26
|
+
/* @__PURE__ */i("input",{type:"range",min:20,max:100,value:c.inactiveOpacity,onChange:e=>s({...c,inactiveOpacity:+e.target.value}),className:u})]}),
|
|
27
|
+
/* @__PURE__ */n("div",{children:[
|
|
28
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
29
|
+
/* @__PURE__ */i("span",{children:"Blur"}),
|
|
30
|
+
/* @__PURE__ */n("span",{children:[c.inactiveBlur,"px"]})]}),
|
|
31
|
+
/* @__PURE__ */i("input",{type:"range",min:0,max:20,value:c.inactiveBlur,onChange:e=>s({...c,inactiveBlur:+e.target.value}),className:u})]})]})]})]})]}),
|
|
32
|
+
/* @__PURE__ */n("div",{className:"flex gap-2 pt-2",children:[
|
|
33
|
+
/* @__PURE__ */i("button",{onClick:d,className:"flex-1 text-sm font-medium py-2 rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition",children:"Save"}),
|
|
34
|
+
/* @__PURE__ */i("button",{onClick:r,className:"flex-1 text-sm font-medium py-2 rounded-lg border border-gray-300 text-gray-600 hover:bg-gray-50 transition",children:"Cancel"})]})]})})})}export{l as WidgetSettingsModal,r as loadAppearance};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import{useShellAuth as e,navIcons as t}from"./chunk-UB4JIOLD.js";import{isStaleChunkError as n,CMD_Z as r,CMD_SHIFT_Z as o,LoadingSpinner as i,Result as a,useIsMobile as l,useShellPrefs as s}from"./chunk-44UO7FYU.js";import{Button_default as c}from"./chunk-PH3PRIFP.js";import{PopupMenu as d,PopupMenuItem as u,PopupMenuDivider as h,PopupMenuLabel as m}from"./chunk-UZAJ5BF6.js";import{Z_LAYERS as p,confirm as w,runEscapeInterceptors as f}from"./chunk-3A46NCXK.js";import{useShellStrings as y}from"./chunk-OQDWLHZI.js";import{createContext as g,Component as v,useContext as b,useLayoutEffect as x,useRef as k,useEffect as C,useState as E,useCallback as M,useSyncExternalStore as L,useMemo as N,isValidElement as S,cloneElement as A,useReducer as T,useId as z,Suspense as P}from"react";import{jsxs as I,jsx as D,Fragment as W}from"react/jsx-runtime";import{createPortal as $}from"react-dom";import{XMarkIcon as K}from"@heroicons/react/24/outline";import{useLocation as R}from"react-router-dom";import{useQueryClient as B,useQuery as j}from"@tanstack/react-query";function O(e){return"component"in e}function H(e){return"endpoint"in e}var V={};function F(e){V=e}var q=new Proxy({},{get:(e,t)=>V[t],has:(e,t)=>t in V,ownKeys:()=>Object.keys(V),getOwnPropertyDescriptor(e,t){if(t in V)return{configurable:!0,enumerable:!0,value:V[t]}}}),U=null;function Y(e){U=e}function X(){return null!==U}var _=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),J=new Proxy({},{get:(e,t)=>U?U[t]:"string"==typeof t&&_.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0});function G({error:e,onReload:t}){const r=n(e);/* @__PURE__ */
|
|
2
|
+
return I("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
+
/* @__PURE__ */D("svg",{className:"h-8 w-8 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),
|
|
4
|
+
/* @__PURE__ */I("div",{className:"min-w-0",children:[
|
|
5
|
+
/* @__PURE__ */D("p",{className:"text-sm font-medium text-gray-700",children:r?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */D("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:r?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
|
|
7
|
+
/* @__PURE__ */D("button",{type:"button",onClick:r?()=>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:r?"Reload page":"Reload window"})]})}var Q=class extends v{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__ */D(G,{error:e,onReload:this.reset}):this.props.children}},Z=g(null),ee="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function te({className:e="",auto:t=!1}){const n=b(Z),i=n?.claimOwnMount;if(x(()=>{if(!t&&i)return i(!0),()=>i(!1)},[t,i]),!n||!n.enabled)return null;const{undo:a,redo:l,canUndo:s,canRedo:c,undoLabel:d,redoLabel:u}=n;/* @__PURE__ */
|
|
8
|
+
return I("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */D("button",{type:"button",onClick:a,disabled:!s,title:s?`Undo ${d} (${r})`:"Nothing to undo",className:ee,children:"Undo"}),
|
|
10
|
+
/* @__PURE__ */D("button",{type:"button",onClick:l,disabled:!c,title:c?`Redo ${u} (${o})`:"Nothing to redo",className:ee,children:"Redo"})]})}var ne=/* @__PURE__ */new Set([408,429]);function re(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function oe(e){const t=re(e);return null!=t&&(t>=400&&t<500&&!ne.has(t))}function ie(e,t){return!oe(t)&&e<3}function ae(){/* @__PURE__ */
|
|
11
|
+
return D("div",{className:"flex items-center justify-center p-8 text-sm text-gray-400",children:"Loading..."})}var le="flex-1 min-h-0";function se(){/* @__PURE__ */
|
|
12
|
+
return D(i,{label:"Loading record…",padding:"",className:le})}function ce(e){return e??void 0}function de({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){if(t||e&&n)/* @__PURE__ */return D(se,{});if(r){const e=re(r);if(401===e)/* @__PURE__ */
|
|
13
|
+
return D(a,{status:"warning",title:"Sign in required",subTitle:"Your session may have expired. Sign in again to open this record.",className:le});if(403===e)/* @__PURE__ */
|
|
14
|
+
return D(a,{status:"403",className:le});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return D(a,{status:"404",title:"Record not found",className:le});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
|
+
return D(a,{status:"500",title:"Couldn't load record",subTitle:t?"Check your connection and try again.":"The server rejected this request.",extra:t?/* @__PURE__ */D(c,{variant:"secondary",size:"sm",onClick:o,children:"Try again"}):void 0,className:le})}/* @__PURE__ */
|
|
17
|
+
return D(a,{status:"404",title:"Record not found",className:le})}function ue({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */D(W,{children:t(e)}):/* @__PURE__ */D(de,{...n})}var he=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function me(e){return"string"==typeof e&&(e.startsWith("new-")||he.test(e))}function pe(e){if(me(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var we=g({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),fe=g(null);function ye(e){const t=b(fe),n=k(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),x(()=>{if(t)return t(n.current,e)},[t,e]),C(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function ge(){const e=k(/* @__PURE__ */new Map),[t,n]=E(!1);return{dirty:t,registerDirty:M((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 ve(){return b(we)}function be(e){if("page"!==e.type&&pe(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 xe({item:e,onClose:n,accentRgb:r}){const{dirty:o,registerDirty:i}=ge(),a=q[e.route];if(!a||!O(a))return null;const l=a,s=l.component;/* @__PURE__ */
|
|
18
|
+
return D(Vn,{open:!0,onClose:n,icon:t[e.route],title:l.label,size:l.size||"2xl",dirty:o,allowPinOnTop:l.allowPinOnTop,initialPosition:l.initialPosition,widget:l.widget,compact:l.compact,appStyle:l.appStyle,flushBody:l.flushBody,autoHeight:l.autoHeight,autoMinHeight:l.autoMinHeight,autoWidth:l.autoWidth,dimensions:l.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:r,children:/* @__PURE__ */D(fe.Provider,{value:i,children:/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */D(ae,{})}),children:/* @__PURE__ */D(s,{})})})})}function ke({entityType:e,entityId:t,label:n}){const r=y(),o=B(),{data:i}=j({queryKey:["my-profile-sidebar"],enabled:X(),queryFn:()=>J.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 D("button",{onClick:()=>{const r=l?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];J.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__ */D("svg",{className:"h-4 w-4",fill:l?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})})}function Ce({item:e,onClose:n,onMinimize:r,accentRgb:o}){const i=q[e.entityType];if(!i||!H(i))return null;const a=i,[l,s]=E(!1),{dirty:c,registerDirty:d}=ge(),u=a.queryKey||a.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=me(e.entityId),p=!a.selfFetching&&!h&&!m&&X(),w=j({queryKey:[u,e.entityId],queryFn:()=>{return J.get((t=a.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:ce(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!oe(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:ie}),f=w.data,y=w.refetch;C(()=>{if(a.selfFetching||h||m)return;const e=()=>{y()};return window.addEventListener("modal-reorder",e),()=>window.removeEventListener("modal-reorder",e)},[y,a.selfFetching,h,m]);const g=M(()=>{l&&!c?s(!1):n()},[l,c,n]),v=a.selfFetching?e.label:f?a.title(f,l,s):e.label,b=a.icon,x=b?t[b]:null,k=v,L=!a.selfFetching&&f&&a.footer&&!h?a.footer(f):void 0;return a.rendersOwnModal?a.selfFetching?/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(ae,{}),children:a.render(f??e.entitySnapshot,n,e.entityId,l,s)}):null!=f?/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(Vn,{open:!0,onClose:n,title:e.label,size:a.size||"2xl",children:/* @__PURE__ */D(se,{})}),children:a.render(f,n,e.entityId,l,s)}):/* @__PURE__ */D(Vn,{open:!0,onClose:n,title:e.label,size:a.size||"2xl",children:/* @__PURE__ */D(de,{isPending:w.isPending,isFetching:w.isFetching,enabled:p,error:w.error,onRetry:y})}):/* @__PURE__ */D(Vn,{open:!0,onClose:g,onMinimize:r,initialBox:e.savedBox,icon:x,title:k,footer:L,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:a.size||"2xl",dirty:c,editing:l||m||h,dimensions:a.dimensions,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,appStyle:a.appStyle,flushBody:a.flushBody,accentRgb:o,children:/* @__PURE__ */D(fe.Provider,{value:d,children:/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(se,{}),children:a.selfFetching?a.render(null,n,e.entityId,l,s):/* @__PURE__ */D(ue,{entity:f,isPending:w.isPending,isFetching:w.isFetching,enabled:p,error:w.error,onRetry:y,children:t=>a.render(t,n,e.entityId,l,s)})})})})}function Ee(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function Me(){const e=vn();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Le=/* @__PURE__ */new Map;function Ne(){const e=Me();if(e)return Le.get(e)}function Se(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 Ae="rosh-peek-style";function Te(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Ae))return;const e=document.createElement("style");e.id=Ae,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 ze(){"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 Pe({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const l=y(),s=k(null),[c,d]=E({w:n,h:Math.round(.75*r)}),[u,h]=E(!1);return x(()=>{const o=s.current;if(!o)return;const i=Ee(e)??Se(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__ */I("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__ */D("div",{ref:s,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */I("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
|
+
/* @__PURE__ */D("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})}),
|
|
22
|
+
/* @__PURE__ */D("span",{className:"mt-1 text-[10px] uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */D("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__ */D("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__ */D("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function Ie({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=y(),l=e.length>1,s=k(null),[c,d]=E({left:-9999,top:-9999,ready:!1}),[u,h]=E(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");x(()=>{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]),C(()=>ze,[]);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 $(
|
|
23
|
+
/* @__PURE__ */D("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:()=>{ze(),i()},children:e.map(e=>{const t=Ee(e.id)??Se(e.label),o=t?function(e){if(on(e))return null;const t=e.getBoundingClientRect(),n=Qt(),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 I("div",{className:"group flex flex-col items-center",onMouseEnter:()=>Te(t),children:[!m&&/* @__PURE__ */D("span",{className:p,children:e.label}),
|
|
25
|
+
/* @__PURE__ */D(Pe,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */D("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */I("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__ */D("svg",{className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14m0 0l-5-5m5 5l-5 5"})}),"Off screen"]})]},e.id)})}),document.body)}function De(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 We({openWindows:e,onRemove:n,onSplitView:r,onActivate:o,onActivateById:i}){const a=y(),[l,s]=E(null);C(()=>{const e=document.getElementById("taskbar-windows");if(!e){const e=setInterval(()=>{const t=document.getElementById("taskbar-windows");t&&(s(t),clearInterval(e))},100);return()=>clearInterval(e)}s(e)},[]);const c=L(bn,vn),[,p]=E(0);C(()=>{const e=()=>p(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,w]=E(0);C(()=>{const e=()=>w(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const f=e=>{const t=Se(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[g,v]=E(null),[b,x]=E(null),[M,N]=E(null),T=k(null),z=()=>{T.current&&(clearTimeout(T.current),T.current=null),T.current=setTimeout(()=>{v(null),x(null)},150)},P=e.filter(e=>!e.route||!q[e.route]?.utility);if(!l||0===P.length)return null;const K=[],R=/* @__PURE__ */new Map;for(const e of P){const t=e.route?q[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=R.get(r);if(void 0!==o)K[o].items.push(e);else{R.set(r,K.length);const o=n?.label??t?.label??e.label;K.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return $(
|
|
27
|
+
/* @__PURE__ */I(W,{children:[K.map(e=>{const r=e.route?t[e.route]:null,o=e.items[e.items.length-1];let l=!1;if(c){const t=document.querySelector(`[data-modal-id="${c}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";l=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,d=e.items.some(e=>{const t=Ee(e.id)??Se(e.label);return!!t&&!on(t)});/* @__PURE__ */
|
|
28
|
+
return I("button",{onClick:()=>i(o.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(M||(T.current&&(clearTimeout(T.current),T.current=null),T.current=setTimeout(()=>{v(n),x(r)},350)));var n,r},onMouseLeave:z,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:o.id,label:o.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),T.current&&(clearTimeout(T.current),T.current=null),v(null),x(null),s?N({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:o.id,label:o.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 "+(l?"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:[r&&S(r)?A(r,{className:"h-3.5 w-3.5 shrink-0 "+(l?"text-blue-600":"text-gray-400")}):/* @__PURE__ */D("svg",{className:"h-3.5 w-3.5 shrink-0 "+(l?"text-blue-600":"text-gray-400"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})}),
|
|
29
|
+
/* @__PURE__ */D("span",{className:"truncate flex-1",children:s?e.label:f(o.label)}),d&&/* @__PURE__ */D("span",{title:a.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */D("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}),!s&&/* @__PURE__ */D("span",{role:"button",onClick:e=>{e.stopPropagation(),n(o.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */D("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.key)}),
|
|
30
|
+
/* @__PURE__ */D("div",{className:"flex-1"}),P.length>=2&&/* @__PURE__ */I("button",{onClick:r,title:a.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__ */I("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[
|
|
32
|
+
/* @__PURE__ */D("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1"}),
|
|
33
|
+
/* @__PURE__ */D("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1"}),
|
|
34
|
+
/* @__PURE__ */D("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1"}),
|
|
35
|
+
/* @__PURE__ */D("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1"})]}),"Exposé"]}),M&&/* @__PURE__ */I(d,{portal:!0,minWidth:200,style:De(M.x,M.y),onClose:()=>N(null),children:[
|
|
36
|
+
/* @__PURE__ */D(m,{children:M.label}),
|
|
37
|
+
/* @__PURE__ */I(u,{onClick:()=>{N(null),M.items.forEach(e=>function(e){const t=jt.get(e);t&&Xt(t)}(e.id))},children:[
|
|
38
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 12h-15"})}),a.taskbar.minimizeAllWindows]}),
|
|
39
|
+
/* @__PURE__ */I(u,{onClick:()=>{N(null),M.items.forEach(e=>i(e.id))},children:[
|
|
40
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),a.taskbar.restoreAllWindows]}),
|
|
41
|
+
/* @__PURE__ */D(h,{}),
|
|
42
|
+
/* @__PURE__ */I(u,{danger:!0,onClick:()=>{N(null),M.items.forEach(e=>n(e.id))},children:[
|
|
43
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),`${a.taskbar.closeAllWindows} (${M.items.length})`]})]}),g&&b&&/* @__PURE__ */D(Ie,{items:g,anchorEl:b,onActivate:e=>{i(e),v(null),x(null)},onClose:e=>{n(e),v(null),x(null)},onMouseEnter:()=>{T.current&&(clearTimeout(T.current),T.current=null)},onMouseLeave:z})]}),l)}var $e=["/login","/forgot-password","/reset-password","/force-change-password"];function Ke({children:e,windowAccentForRoute:t}){const n=R(),r=$e.some(e=>n.pathname.startsWith(e)),[o,i]=E([]),a=k(o);x(()=>{a.current=o},[o]),C(()=>{Le.clear();for(const e of o)e.route&&Le.set(e.id,e.route)},[o]);const l=M(e=>{i(t=>t.filter(t=>t.id!==e))},[]),s=M(e=>{var t;Ee(e)?(t=e,window.dispatchEvent(new CustomEvent(xn,{detail:{windowKey:t}}))):l(e)},[l]),c=e=>{setTimeout(()=>{const t=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),n=t?.getAttribute("data-modal-id");n&&Yt(n)},50)},d=M((e,t,n,r,o)=>{if(!q[e]||!H(q[e]))return;const a=`${e}:${t}`,l=Me();i(i=>{const s=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return s?(c(s.id),i):(c(a),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:ce(n),openedFrom:l}])})},[]),u=M(e=>{if(!q[e]||!O(q[e]))return;const t=q[e];if(t.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void s(t.id)}const n=Me();i(r=>{if(t.multiInstance){const o=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(o),[...r,{id:o,type:"page",label:t.label,route:e,openedFrom:n}]}const o=r.find(t=>"page"===t.type&&t.route===e);if(o)return t.widget||c(o.id),r;const i=`page:${e}`;return c(i),[...r,{id:i,type:"page",label:t.label,route:e,openedFrom:n}]})},[s]),h=M(()=>{},[]),m=M(()=>{},[]),p=s,w=s;/* @__PURE__ */
|
|
44
|
+
return I(we.Provider,{value:{openWindows:o,openEntity:d,openPage:u,closeEntity:p,minimize:h,items:[],openItems:o,restore:m,remove:w,restoreIfMinimized:()=>!1},children:[e,
|
|
45
|
+
/* @__PURE__ */D(We,{openWindows:o,onRemove:s,onSplitView:On,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&&Yt(e)}})},onActivateById:e=>{const t=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`);if(!t)return;if(!on(t))return n=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:n}}));var n;const r=t.getAttribute("data-modal-id");r&&Yt(r)}}),
|
|
46
|
+
/* @__PURE__ */D(Hn,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;/* @__PURE__ */
|
|
47
|
+
return D(Q,{fallback:(t,n)=>/* @__PURE__ */D(Vn,{open:!0,onClose:()=>l(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */D(G,{error:t,onReload:n})}),children:/* @__PURE__ */D(rt,{spec:be(e),children:/* @__PURE__ */D(Jn,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */D(xe,{item:e,onClose:()=>l(e.id),accentRgb:n}):/* @__PURE__ */D(Ce,{item:e,onClose:()=>l(e.id),onMinimize:()=>{},accentRgb:n})})})},e.id)})]})}var Re=null,Be=/* @__PURE__ */new Set;function je(){return Re}function Oe(e){if(Re!==e){Re=e;for(const e of Be)e()}}function He(e){return Be.add(e),()=>{Be.delete(e)}}var Ve=!1,Fe={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},qe=()=>{};function Ue(e){Ve=e,Fe={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Ye(e,t){Ve&&("submenu"===e?Fe.submenus++:Fe.menus++,Fe.menuKey=t)}function Xe(e){if(!Ve)return qe;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Ve)return;const r=performance.now()-t;"move"===e?Fe.moveMs+=r:Fe.resizeMs+=r}}function _e(){const e=Fe;return Fe={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Je=280;function Ge(){const e=getComputedStyle(document.documentElement),t=parseInt(e.getPropertyValue("--taskbar-height"))||0,n=parseInt(e.getPropertyValue("--taskbar-width"))||0,r=e.getPropertyValue("--taskbar-position")?.trim()||"bottom",o=parseInt(e.getPropertyValue("--sidebar-width"))||0;return{x:("left"===r?n:0)+o,y:"top"===r?t:0,w:window.innerWidth-("left"===r||"right"===r?n:0)-o,h:window.innerHeight-("top"===r||"bottom"===r?t:0)}}function Qe(e,t,n){const r=n?t.w+280:t.w-280,o=Math.abs(e.w-t.w)<=4||Math.abs(e.w-r)<=4;return Math.abs(e.h-t.h)<=4&&o}function Ze({over:e,residual:t},n){return t<=1||e-t>=n-2}function et(){return"undefined"!=typeof document&&"sidebar"===getComputedStyle(document.documentElement).getPropertyValue("--layout-mode")?.trim()}var tt=g(""),nt=g(null);function rt({spec:e,children:t}){/* @__PURE__ */
|
|
48
|
+
return D(nt.Provider,{value:e,children:t})}var ot=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),it='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function at(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(at).join("");if(S(e)){const t=e,n="string"==typeof t.type?t.type:"";return ot.has(n)?"":at(t.props?.children)}return""}function lt(e){const t=b(tt);C(()=>{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 st={};function ct(e,t,n){const r=b(tt);C(()=>{if(!r)return;st[r]||(st[r]=[]);const o={label:e,icon:n,onClick:t};return st[r].push(o),()=>{st[r]=(st[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function dt({title:e}){const t=k(null);return C(()=>{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__ */D("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function ut(e){}function ht({text:e}){const[t,n]=E(!1);/* @__PURE__ */
|
|
49
|
+
return D("button",{onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},title:t?"Copied!":`Copy ${e}`,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:/* @__PURE__ */D("svg",t?{className:"w-4 h-4 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}:{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}var mt=g(null);function pt(){return b(tt)}function wt(){const e=L(bn,vn),t=b(mt);return t?.active??(Dt.length<=1||null!=e)}function ft({children:e,position:t="right",quiet:n=!1}){const r=b(mt),[o,i]=E(null);return C(()=>{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?$(e,o):null}function yt({onClick:e,children:t,className:n}){const r=b(mt);/* @__PURE__ */
|
|
50
|
+
return D("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-NPKW2XHM.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 gt="erp_window_positions",vt={};try{const e=localStorage.getItem(gt);e&&(vt=JSON.parse(e))}catch{}var bt=null;function xt(){bt&&clearTimeout(bt),bt=setTimeout(()=>{try{localStorage.setItem(gt,JSON.stringify(vt))}catch{}},500)}var kt="erp_activation_order",Ct=[];try{const e=localStorage.getItem(kt),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Ct=t)}catch{}var Et=null;function Mt(){Et&&clearTimeout(Et),Et=setTimeout(()=>{try{localStorage.setItem(kt,JSON.stringify(Ct))}catch{}},500)}function Lt(e,t){vt[e]||(vt[e]=t,xt())}function Nt(e){return vt[e]?{...vt[e]}:null}function St(e,t){vt[e]=t,xt()}function At(){const e=Ge(),t=(parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width"))||0)>0;let n=!1;for(const r of Object.keys(vt))Qe(vt[r],e,t)&&(delete vt[r],n=!0);n&&xt()}var Tt={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},zt=4e3,Pt=()=>{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"},It={small:.8,medium:1,large:1.25,maximized:1.25},Dt=[],Wt=/* @__PURE__ */new Set,$t=/* @__PURE__ */new Set,Kt=0;function Rt(){return Kt}function Bt(){Kt++,Wt.forEach(e=>e())}var jt=/* @__PURE__ */new Map,Ot=/* @__PURE__ */new Map;var Ht=null;function Vt(e){Ht=null,Yt(e)}function Ft(e){Ht=e;const t=jt.get(e);t&&Vt(t)}function qt(e){Ht===e&&(Ht=null)}function Ut(e,t){t?(jt.set(t,e),Ot.set(e,t),function(e,t){const n=Ct.indexOf(t);if(-1===n)return void Dt.push(e);let r=Dt.length;for(let e=0;e<Dt.length;e++){const t=Ot.get(Dt[e]);if(t&&Ct.indexOf(t)>n){r=e;break}}Dt.splice(r,0,e)}(e,t),-1===Ct.indexOf(t)&&(Ct.push(t),Mt())):Dt.push(e),Bt(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Ht===t&&Vt(e)}function Yt(e){const t=Dt.indexOf(e);-1!==t&&Dt.splice(t,1),Dt.push(e),$t.delete(e);const n=Ot.get(e);if(n){const e=Ct.indexOf(n);-1!==e&&Ct.splice(e,1),Ct.push(n),Mt(),Ht&&Ht!==n&&(Ht=null)}Bt(),window.dispatchEvent(new CustomEvent("modal-reorder"))}function Xt(e){const t=Dt.indexOf(e);-1!==t&&Dt.splice(t,1),$t.add(e);const n=Ot.get(e);if(n){const e=Ct.indexOf(n);-1!==e&&(Ct.splice(e,1),Mt())}Bt(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var _t=/* @__PURE__ */new Set;var Jt=8,Gt=32;function Qt(){const e=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,t=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return{x:"left"===n?t:0,y:"top"===n?e:0,w:window.innerWidth-("left"===n||"right"===n?t:0),h:window.innerHeight-("top"===n||"bottom"===n?e:0)}}var Zt=40,en=80,tn=384,nn=400;function rn(e,t=Qt()){const n=Math.min(Math.max(e.x,t.x+en-e.w),t.x+t.w-en),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Zt);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function on(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Qt();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 an(e){const t=Qt(),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 ln=null;function sn(e){const t=(ln||((ln=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(ln)),ln);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 cn(){ln&&(ln.style.opacity="0",ln.style.display="none")}var dn=[{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"}],un=350,hn=200;function mn({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=E(!1),l=k(void 0),s=k(void 0);C(()=>()=>{clearTimeout(l.current),clearTimeout(s.current)},[]);const c=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!0),un)},d=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!1),hn)};/* @__PURE__ */
|
|
51
|
+
return I("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
52
|
+
/* @__PURE__ */D("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */D("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:dn.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */D("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__ */D("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var pn="rosh-gesture-style";var wn={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},fn=4;function yn(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(pn))return;const e=document.createElement("style");e.id=pn,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=Xe(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function gn(e){const t=Dt.indexOf(e);return-1===t?-1:p.window+t*p.windowStep}function vn(){return Dt[Dt.length-1]||null}function bn(e){return Wt.add(e),()=>{Wt.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=Dt.length-1;e>=0;e--)_t.has(Dt[e])||Dt.splice(e,1);Ct=Ct.filter(e=>{const t=jt.get(e);return null!=t&&_t.has(t)}),Mt(),Bt(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var xn="modal-close-request";function kn(e){L(bn,Rt);const t=b(mt);if(Dt.length<=1)return!0;if(e){const t=jt.get(e);if(null!=t)return vn()===t}return t?.active??null!=vn()}var Cn=!1,En=/* @__PURE__ */new Set;function Mn(e){return En.add(e),()=>En.delete(e)}function Ln(){return Cn}function Nn(e){Cn!==e&&(Cn=e,En.forEach(e=>e()))}function Sn(){Nn(!Cn)}function An(){Nn(!1)}var Tn=null,zn=/* @__PURE__ */new Set;function Pn(e){return zn.add(e),()=>zn.delete(e)}function In(){return Tn}function Dn(e){Tn!==e&&(Tn=e,zn.forEach(e=>e()))}var Wn=null,$n=/* @__PURE__ */new Set;function Kn(e){return $n.add(e),()=>$n.delete(e)}function Rn(){return Wn}function Bn(e){Wn!==e&&(Wn=e,$n.forEach(e=>e()))}function jn(){if(!Wn)return void Nn(!1);Dn(Wn),Bn(null),Nn(!1)}function On(){Nn(!Cn),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Hn(){const e=L(Mn,Ln),[t,n]=E(e),[r,o]=E(e);return C(()=>{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?$(
|
|
53
|
+
/* @__PURE__ */D("div",{onMouseDown:e=>{e.stopPropagation(),Nn(!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 Vn({open:e,onClose:t,title:n,icon:r,copyText:o,size:i="lg",dirty:a=!1,onNext:c,onPrev:m,footer:g,bodyScroll:v,onMinimize:T,initialBox:z,actions:P,actionsLeft:R,editing:B=!1,allowPinOnTop:j,initialPosition:O,widget:H,compact:V,appStyle:F,flushBody:q,autoHeight:U,autoMinHeight:Y,autoWidth:X,widgetMenu:_,dimensions:J,windowKey:G,openedFromKey:ee,accentRgb:ne,children:re}){const oe=l(),[ie,ae]=E(0),[le,se]=E(!1),ce=k(null),de=k(0);C(()=>{de.current=ie},[ie]);const ue=M(e=>{oe&&(ce.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},se(!0),Oe(ee??null))},[oe,ee]),he=L(He,je);C(()=>{if(!le)return;const e=e=>{if(!ce.current)return;const t=e.clientX-ce.current.startX;if(Math.abs(e.clientY-ce.current.startY)>Math.abs(t)+12)return ce.current=null,se(!1),ae(0),void Oe(null);ae(Math.max(0,t))},n=()=>{if(!ce.current)return;const e=.3*window.innerWidth,n=de.current>e;ce.current=null,se(!1),n?(ae(window.innerWidth),setTimeout(()=>{t(),ae(0),Oe(null)},180)):(ae(0),Oe(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[le]);const[me,pe]=E(n),we=y(),fe=we.window;C(()=>{pe(n)},[n]);const ge=N(()=>at(me).trim()||void 0,[me]),[be,xe]=E(!1),ke=k(!1),[Ce,Ee]=E(!1),[Me,Le]=E(null),Ne=b(nt),{prefs:Se,save:Ae}=s(),Te=!!Se.window_accent_stripe,ze=Se.favorite_documents||[],Pe=!!Ne&&ze.some(e=>e.entityType===Ne.entityType&&e.entityId===Ne.entityId),Ie=M(()=>{if(!Ne)return;const e=Pe?ze.filter(e=>!(e.entityType===Ne.entityType&&e.entityId===Ne.entityId)):[...ze,{entityType:Ne.entityType,entityId:Ne.entityId,label:Ne.label}];Ae({favorite_documents:e})},[Ne,Pe,ze,Ae]),[De,We]=E(null),[$e,Ke]=E("top-right"===O?"right":"left"),Re=k(!1),Be=k(null);x(()=>{const e=Be.current;e&&(ne?e.style.setProperty("--window-accent-rgb",ne):e.style.removeProperty("--window-accent-rgb"))},[ne]);const Ve=k(!1),Fe=k(null),qe=k(null),Ue=k(null),[Ye,Xe]=E(!1),_e=k(null),Je=!!(g||P||R)||Ye,Qe=b(Z),rt=""!==b(tt),ot=!!Qe&&!rt&&Qe.enabled&&Qe.hasState&&(B||Qe.declaredEditable)&&!Qe.handMounted&&Je&&!H&&!V&&!F&&!oe,lt=/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})}),ct=r&&S(r)?A(r,{className:`h-4 w-4 ${r.props?.className??""}`.trim()}):r??lt,dt=()=>/* @__PURE__ */D("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Le(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:ct}),ut=40,{minimize:ht,items:pt,restoreIfMinimized:wt,openWindows:ft}=ve(),yt=k(`modal-${Math.random().toString(36).slice(2,8)}`).current;C(()=>{if(H)return _t.add(yt),()=>{_t.delete(yt)}},[H,yt]),C(()=>{const e=e=>{const t=e.detail;t?.id===yt&&pe(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[yt]);const[gt,bt]=E(p.window),kt=function(e){const t=L(bn,vn);return Dt.length<=1||t===e}(yt),Ct=function(e){return L(bn,()=>$t.has(e))}(yt),Et=L(Mn,Ln),Mt=L(Pn,In),Lt=L(Kn,Rn),Nt=!j&&!H,St=Et&&Nt,[At,Wt]=E(!1),Kt=St&&Lt===yt,[Rt,Ht]=E(!1),Vt=Rt&&Nt&&Mt===yt?"picked":null,Ft=k(St);C(()=>{if(Ft.current&&!St){Ht(!0);const e=setTimeout(()=>{Ht(!1),Tn===yt&&Dn(null)},700);return Ft.current=St,()=>clearTimeout(e)}Ft.current=St},[St,yt]),C(()=>{St||Wt(!1)},[St]),C(()=>{const e=qe.current,t=Ue.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>Xe(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()},[e]),C(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&Be.current){const t=Be.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=qe.current,n=Ue.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[e]);const qt=k(!1),Zt=M(Ge,[]),en=M(()=>{const e=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,t=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom",r="left"===n?t:0,o="right"===n?t:0,a=J?J[0]:Tt[i]||672,l=window.innerWidth-0-r-o-80,s=window.innerHeight-e-80,c=Math.min(a,l),d=It[Pt()],u=J?Math.min(J[1],s):(()=>{const t=("sm"===i?500:"md"===i?600:"lg"===i?700:"xl"===i?800:920)*d;return Math.max(320,Math.min(t,window.innerHeight-e-80))})(),h="cascade"===(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")?30*(Dt.length-1):0,m=l-c,p=s-u;return"top-right"===O?{x:window.innerWidth-c-ut,y:ut,w:c,h:u}:"top-left"===O?{x:40,y:ut,w:c,h:u}:{x:0+Math.max(ut,(l-c)/2+ut)+Math.min(h,Math.max(0,m)),y:Math.max(ut,(s-u)/2)+Math.min(h,Math.max(0,p)),w:c,h:u}},[i]),on=k(!1);e||(on.current=!1);const ln=G||o||null;C(()=>{if(!e)return;Ut(yt,ln),G||Yt(yt),qt.current=!1,bt(gn(yt));const t=()=>{bt(gn(yt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===G;if(!e.label)return!1;const t=Be.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;Yt(yt);const t=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,n=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom",i="left"===o?n:0,a="right"===o?n:0,l=window.innerWidth-i-a,s=window.innerHeight-t,c=Math.min(Wn.current.w,l-40),d=Math.min(Wn.current.h,s-40);hn({x:i+(l-c)/2,y:("top"===o?t:0)+(s-d)/2,w:c,h:d}),zn(!1)},i=e=>{const t=e.detail;r(t)&&(Yt(yt),Le({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==G)return;Yt(yt);const t=Wn.current,n=function(e,t=Qt()){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=Be.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)}hn(n)};return window.addEventListener("modal-reorder",t),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=Dt.indexOf(e);-1!==t&&(Dt.splice(t,1),Bt()),$t.delete(e);const n=Ot.get(e);n&&(Ot.delete(e),jt.delete(n))}(yt),window.removeEventListener("modal-reorder",t),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"))}},[e,yt,ln,Zt]);const dn=!H&&"maximized"===Pt(),[un,hn]=E(()=>{if(ln&&vt[ln]){const e={...vt[ln]};return J&&(e.w=J[0],U||(e.h=J[1])),rn(e)}return z?{x:z.x,y:z.y,w:z.w,h:z.h}:dn?Zt():en()}),[pn,kn]=E(()=>!U),[Cn,En]=E(()=>et());C(()=>{const e=()=>En(et());return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[]);const Sn=Cn&&!H,[An,zn]=E(()=>ln&&vt[ln]||z?Sn:Sn||dn),Wn=k(un);Wn.current=un,x(()=>{if(pn)return;const e=Be.current,t=Fe.current;if(!e||!t)return;const n=Y??(H?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,w=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const f=c.offsetHeight>w+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Wn.current.y)-24),g=f?Math.min(Wn.current.h,y):Math.min(Math.max(n,d+p),y),v=Math.abs(g-o)>1;v&&(o=g,hn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),H||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;l(),o===e&&kn(!0)},160)))},s=new ResizeObserver(l);l(),_e.current&&s.observe(_e.current);const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[pn,H,Y,Je]),x(()=>{if(!U||!pn||H||!e)return;const t=_e.current;if(!t)return;let n=t.offsetHeight;const r=new ResizeObserver(()=>{if(!t.isConnected)return;const e=t.offsetHeight,r=e-n,o=e>0!=n>0;if(n=e,!o||0===r||An)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=Y??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,l=Math.max(i,window.innerHeight-a-Math.max(0,Wn.current.y)-24);hn(e=>({...e,h:Math.min(Math.max(i,e.h+r),l)}))});return r.observe(t),()=>r.disconnect()},[U,pn,H,e,An,Y]);const $n=!1!==X&&!H&&!F&&!oe,[Bn,jn]=E(()=>!$n);x(()=>{if(Bn||!e)return;if(!$n||An)return void jn(!0);const t=Be.current,n=Fe.current;if(!t||!n)return;const r=/* @__PURE__ */new WeakSet;let o=Wn.current.w,i=0;const a=()=>jn(!0),l=()=>{i=0;const e=Wn.current;if(Math.abs(e.w-o)>1||document.body.classList.contains("rosh-gesturing"))return void a();const l=Ge(),s=l.w-80;if(e.w>=s)return void a();const c=[],d=[];for(const e of[n,...Array.from(n.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||r.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(c.push(e),d.push(t))}if(!c.length)return;const u=Math.min(s,e.w+Math.max(...d)),h=u-e.w,m=t.style.width;t.style.width=`${u}px`;const p=c.map((e,t)=>({over:d[t],residual:e.scrollWidth-e.clientWidth}));t.style.width=m,p.forEach((e,t)=>{Ze(e,h)||r.add(c[t])});const w=function(e,t,n,r){const o=Math.min(t,n.w-2*r);if(o<=e.w+1)return e;const i=n.x+r,a=n.x+n.w-r-o,l=Math.min(Math.max(e.x-(o-e.w)/2,i),a);return{...e,x:Math.round(l),w:Math.round(o)}}(e,function(e,t,n){let r=e;for(const o of n)Ze(o,t)&&(r=Math.max(r,e+o.over));return Math.ceil(r)}(e.w,h,p),l,ut);w!==e&&(o=w.w,hn(w))};l();const s=new MutationObserver(()=>{i||(i=requestAnimationFrame(l))});s.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const c=setTimeout(a,zt);return()=>{s.disconnect(),i&&cancelAnimationFrame(i),clearTimeout(c)}},[Bn,e,$n,An]),C(()=>{Sn&&(zn(!0),hn(Zt()))},[Sn,Zt]),C(()=>{if(H)return;const e=()=>{zn(!1),hn(en())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[H,en]),C(()=>{e&&ln&&(vt[ln]=un,xt()),e&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[un,e,ln]),C(()=>{if(!e)return;const t=()=>{An?hn(Zt()):document.body.classList.contains("rosh-gesturing")||hn(rn)};window.addEventListener("resize",t);let n=null;return An&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),n?.disconnect()}},[e,An,Zt]),C(()=>{if(e){if(xe(!1),ke.current=!1,Re.current=!1,jn(!$n),ln&&vt[ln]){const e=vt[ln];return void hn(t=>rn({...e,...U?{h:t.h}:{},...$n?{x:t.x,w:t.w}:{}}))}z&&(hn({x:z.x,y:z.y,w:z.w,h:z.h}),zn(z.maximized))}},[e]),C(()=>{if(!e||"auto"!==a)return;let t;const n=e=>{Be.current?.contains(e.target)&&!ke.current&&(ke.current=!0,t=setTimeout(()=>xe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(t),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[e,a]);const On="auto"===a?be:!0===a;ye(!(G||!e)&&On);const Hn=M(async()=>{if(!Re.current){if(On||"auto"===a&&ke.current){Re.current=!0;const e=ge,t=await w({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(Re.current=!1,!t)return}t()}},[On,a,t,ge]);x(()=>{if(!e||!G)return;const t=e=>{e.detail?.windowKey===G&&Hn()};return window.addEventListener(xn,t),()=>window.removeEventListener(xn,t)},[e,G,Hn]);const Vn=k(null),Fn=M(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Le(null),Yt(yt),Sn)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=Be.current,l=a?.getBoundingClientRect();let s,c,d,u;if(Vn.current){const t=Vn.current;Vn.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:Wn.current.x,c=l?l.top:Wn.current.y,d=l?l.height:Wn.current.h,u=l?l.width:Wn.current.w;zn(!1),hn(e=>({...e,x:s,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<fn&&Math.abs(e.clientY-i)<fn)return;r=yn(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)`),Wn.current={...Wn.current,x:l,y:d},!H){const t=function(e,t){const n=Qt(),r=e<=n.x+Jt,o=e>=n.x+n.w-Jt,i=t<=n.y+Jt,a=t>=n.y+n.h-Jt,l=e<=n.x+Gt,s=e>=n.x+n.w-Gt,c=t<=n.y+Gt,d=t>=n.y+n.h-Gt;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?sn(an(t)):cn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),cn();const e=rn({...Wn.current});if(Wn.current=e,!H&&h){Vn.current={x:s,y:c,w:u,h:d};const e=an(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 hn(e)}if(H){const t=e.x+e.w/2,n=window.innerWidth/2;Ke(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),hn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),qn=M((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=Be.current,s=l?.getBoundingClientRect(),c=s?s.left:Wn.current.x,d=s?s.top:Wn.current.y,u=s?s.width:Wn.current.w,h=s?s.height:Wn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,w="se"===t||"ne"===t||"e"===t,f="se"===t||"sw"===t||"s"===t;zn(!1),hn({x:c,y:d,w:u,h:h}),Wn.current={x:c,y:d,w:u,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Wn.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`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<fn&&Math.abs(e.clientY-a)<fn)return;o=yn(n,r,wn[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(w&&(o=Math.max(tn,u+e)),f&&(i=Math.max(nn,h+t)),m){const t=Math.max(tn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(nn,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(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),hn({...Wn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Un=M(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(),Yt(yt),"Enter"===e.key)return void(An?(zn(!1),hn(en())):(zn(!0),hn(Zt())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Vn.current||(Vn.current={...Wn.current})};if(r<0)return e(),zn(!0),void hn(Zt());if(r>0){if(An)return zn(!1),void hn(en());if(Vn.current){const e=rn(Vn.current);return Vn.current=null,Wn.current=e,void hn(e)}return void Xt(yt)}e(),zn(!1);const t=an(n<0?"left":"right");return Wn.current=t,void hn(t)}if(An)return;const o=Wn.current,i=e.shiftKey?{...o,w:Math.max(tn,o.w+24*n),h:Math.max(nn,o.h+24*r)}:rn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Wn.current=i,hn(i)},[yt,An,en,Zt]),Yn=M(e=>{Vn.current||(Vn.current={...Wn.current}),zn(!1);const t=an(e);Wn.current=t,hn(t),Yt(yt)},[yt]),Xn=Sn||St?{}:{tabIndex:0,role:"group","aria-label":ge?`${ge} — ${fe.windowSuffix}`:fe.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:Un},_n=()=>{zn(!0),hn(Zt())},Jn=M(()=>{const e=Be.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(it);t&&!t.disabled&&t.click()}},[]);C(()=>{if(!e)return;const t=e=>{if(Dt[Dt.length-1]===yt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Jn();else{if("INPUT"===t.tagName&&t.closest("form"))return;e.preventDefault()}}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Jn,yt]),C(()=>{if(!e)return;const t=e=>{Dt[Dt.length-1]===yt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:yt}})),ke.current=!1,xe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:yt}}))))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),C(()=>{if(!e)return;if(H)return;const t=e=>{if("Escape"===e.key&&Dt[Dt.length-1]===yt){if(f(e))return e.preventDefault(),void e.stopPropagation();e.preventDefault(),e.stopPropagation(),Hn()}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Hn,yt,H]);const Gn=e&&(void 0!==c||void 0!==m),Qn=M(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(C(()=>{if(!e)return;const t=e=>{if(Dt[Dt.length-1]!==yt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Gn&&(e.preventDefault(),c?c():Qn("bottom")),"k"===e.key&&Gn&&(e.preventDefault(),m?m():Qn("top"))))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,c,m,Gn,Qn,yt]),!e||on.current)return null;const Zn=St?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=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,u=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,h=(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")||"bottom").trim(),m="left"===h?u:0,p="right"===h?u:0,w="top"===h?d:0,f="top"===h||"left"===h||"right"===h?0:d,y=m,g=w,v=(window.innerWidth-m-p-20*(o+1))/o,b=(window.innerHeight-w-f-14*(i+1)-22*i)/i;return{x:y+20+l*(v+20)+(c?(o-s)*(v+20)/2:0),y:g+14+a*(b+14+22),w:v,h:b}}(yt):null,er=St&&Zn?Math.min(Zn.w/un.w,Zn.h/un.h):1,tr=(()=>{if(St&&Zn){const e=er,t=un.w*e,n=un.h*e,r=Zn.x+(Zn.w-t)/2-un.x,o=Zn.y+(Zn.h-n)/2-un.y,i=At||Kt;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(Rt&&Nt){const e="picked"===Vt;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})(),nr=/* @__PURE__ */I("div",{children:[
|
|
54
|
+
/* @__PURE__ */I("div",{ref:Be,"data-modal-panel":!0,"data-modal-id":yt,"data-window-key":G||void 0,...j?{"data-utility":""}:{},...Ce?{"data-pinned-top":""}:{},...H?{"data-widget":""}:{},className:"fixed rounded-2xl flex flex-col overflow-hidden "+(H?kt?"shadow-2xl":"shadow-lg":"border "+(kt?"shadow-2xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(Ve.current=!1,St){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Dn(yt),Nn(!1),void Yt(yt)}if(!kt&&!H&&!Ce&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===Be.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),Ve.current=!0,Le(null),Yt(yt),window.addEventListener("mouseup",()=>{setTimeout(()=>{Ve.current=!1},0)},{once:!0}))}},onClickCapture:e=>{Ve.current&&(Ve.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(St)return;Le(null);e.target.closest("[data-modal-panel]")===Be.current&&(e.target.closest("button, input, a, select, textarea")||Yt(yt))},style:oe?{zIndex:gt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ie}px)`,transition:le?"none":"transform 180ms ease-out",...H?{display:"none"}:{},...gt<0?{display:"none"}:{},...kt||Ce||he&&G===he?{}:{display:"none"}}:{zIndex:Ce?p.pinnedWindow:gt+1,width:un.w,height:un.h,top:un.y,...H&&"right"===$e?{right:window.innerWidth-un.x-un.w}:{left:un.x},...gt<0&&!Ce?{display:"none"}:{},...tr??{}},children:[oe&&!H&&/* @__PURE__ */D("div",{onPointerDown:ue,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),H||oe?null:
|
|
55
|
+
/* @__PURE__ */I("div",V?{onPointerDown:Fn,"data-window-chrome":"",...Xn,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
56
|
+
/* @__PURE__ */I("div",{"data-window-title":!0,title:ge,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!St&&dt(),
|
|
57
|
+
/* @__PURE__ */D("span",{className:"truncate",children:St?at(me):me})]}),!St&&/* @__PURE__ */I("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[j&&/* @__PURE__ */D("button",{onClick:()=>Ee(e=>!e),title:Ce?fe.unpin:fe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Ce?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */D("svg",{className:"h-3 w-3",fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})})}),
|
|
58
|
+
/* @__PURE__ */D("button",{type:"button",onClick:Hn,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */D(K,{className:"h-4 w-4"})})]})]}:F?{onPointerDown:Fn,"data-window-chrome":"",...Xn,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
59
|
+
/* @__PURE__ */I("div",{"data-window-title":!0,title:ge,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!St&&dt(),
|
|
60
|
+
/* @__PURE__ */D("span",{className:"truncate",children:St?at(me):me})]}),!St&&/* @__PURE__ */I("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[j&&/* @__PURE__ */D("button",{onClick:()=>Ee(e=>!e),title:Ce?fe.unpin:fe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Ce?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */D("svg",{className:"h-3 w-3",fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})})}),
|
|
61
|
+
/* @__PURE__ */D("button",{onClick:()=>Xt(yt),title:fe.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!Sn&&/* @__PURE__ */D(mn,{maximized:An,onToggleMax:()=>{An?(zn(!1),hn(en())):_n()},onSnap:Yn,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:fe}),
|
|
62
|
+
/* @__PURE__ */D("button",{type:"button",onClick:Hn,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */D(K,{className:"h-4 w-4"})})]})]}:{onPointerDown:Fn,"data-window-chrome":"",...Xn,className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
63
|
+
/* @__PURE__ */I("div",{"data-window-title":!0,title:ge,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!St&&dt(),
|
|
64
|
+
/* @__PURE__ */D("span",{className:"truncate",children:St?at(me):me})]}),!St&&/* @__PURE__ */I("div",{className:"flex items-center gap-1.5 shrink-0 ml-4",children:[Gn&&/* @__PURE__ */I("span",{className:"flex items-center gap-1 mr-1 text-[10px] text-gray-400",children:[
|
|
65
|
+
/* @__PURE__ */D("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
66
|
+
/* @__PURE__ */D("span",{children:fe.prev}),
|
|
67
|
+
/* @__PURE__ */D("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"}),
|
|
68
|
+
/* @__PURE__ */D("span",{children:fe.next})]}),j&&/* @__PURE__ */D("button",{onClick:()=>Ee(e=>!e),title:Ce?fe.unpin:fe.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Ce?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */D("svg",{className:"h-3.5 w-3.5",fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})})}),
|
|
69
|
+
/* @__PURE__ */D("button",{onClick:()=>Xt(yt),title:fe.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!Sn&&/* @__PURE__ */D(mn,{maximized:An,onToggleMax:()=>{An?(zn(!1),hn(en())):_n()},onSnap:Yn,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:fe}),
|
|
70
|
+
/* @__PURE__ */D("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"}),
|
|
71
|
+
/* @__PURE__ */D("button",{type:"button",onClick:Hn,className:"rounded-md text-gray-400 hover:text-gray-600",children:/* @__PURE__ */D(K,{className:"h-5 w-5"})})]})]}),ne&&Te&&!H&&!oe&&/* @__PURE__ */D("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${kt?.9:.55})`}}),
|
|
72
|
+
/* @__PURE__ */D(tt.Provider,{value:yt,children:/* @__PURE__ */D(mt.Provider,{value:{rightRef:qe,leftRef:Ue,notify:()=>Xe(!0),active:kt,isDirty:On,footerOpen:Je&&!H&&!V&&!F&&!oe},children:/* @__PURE__ */D("div",{ref:Fe,...H?{onPointerDown:Fn,onContextMenu:e=>{e.preventDefault(),We({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${H?"p-0 cursor-move":F||q?"p-0":V?"p-2":"p-4"} ${H?"":"backdrop-blur-sm"} ${!1===v||F||q?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${H?"rounded-2xl select-none":""}`,style:{...H?{touchAction:"none"}:{},backgroundColor:H?"transparent":kt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */D(Q,{children:re})})})}),H&&De&&/* @__PURE__ */I(d,{minWidth:160,style:{left:De.x,top:De.y},onClose:()=>We(null),children:[
|
|
73
|
+
/* @__PURE__ */D(u,{onClick:()=>{We(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:yt}))},children:"Settings"}),
|
|
74
|
+
/* @__PURE__ */D(h,{}),_&&/* @__PURE__ */I(W,{children:[_,
|
|
75
|
+
/* @__PURE__ */D(h,{})]}),
|
|
76
|
+
/* @__PURE__ */I(u,{onClick:()=>{We(null),Ee(e=>!e)},children:[
|
|
77
|
+
/* @__PURE__ */D("span",{className:"flex-1",children:"Always on Top"}),Ce&&/* @__PURE__ */D("svg",{className:"h-4 w-4 text-blue-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),
|
|
78
|
+
/* @__PURE__ */D(h,{}),
|
|
79
|
+
/* @__PURE__ */D(u,{onClick:()=>{We(null),Hn()},children:"Close"})]}),
|
|
80
|
+
/* @__PURE__ */I("div",{onPointerDown:Fn,ref:_e,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none cursor-move${kt?" backdrop-blur-sm":""}${H||V||F||oe||!Je?" hidden":""}`,style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
81
|
+
/* @__PURE__ */I("div",{className:"flex items-center gap-2 min-w-0",children:[ot&&/* @__PURE__ */D(te,{auto:!0}),R,
|
|
82
|
+
/* @__PURE__ */D("div",{ref:Ue,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),g]}),
|
|
83
|
+
/* @__PURE__ */I("div",{className:"flex items-center gap-2 ml-auto",children:[
|
|
84
|
+
/* @__PURE__ */D("div",{ref:qe,"data-modal-actions":!0,className:"flex items-center gap-2"}),P]})]}),!H&&!oe&&!St&&kt&&/* @__PURE__ */I(W,{children:[
|
|
85
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
86
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
87
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
88
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
89
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
90
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
91
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
92
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),St&&/* @__PURE__ */D("div",{className:"absolute inset-0",style:{zIndex:9999,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Wt(!0),onMouseLeave:()=>Wt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Yt(yt),Nn(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:At&&/* @__PURE__ */D("button",{type:"button","data-expose-close":!0,"aria-label":we.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/er})`,transformOrigin:"top right",zIndex:1e4},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),Hn()},children:/* @__PURE__ */D("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})})]}),St&&Zn&&/* @__PURE__ */D("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Zn.x,top:Zn.y+Zn.h+4,width:Zn.w,zIndex:At?2021:2011,color:"white",fontSize:12,fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:at(me)})]}),rr=Me&&/* @__PURE__ */I(d,{style:{left:Me.x,top:Me.y},onClose:()=>Le(null),minWidth:160,children:[!H&&!V&&/* @__PURE__ */I(W,{children:[
|
|
93
|
+
/* @__PURE__ */I(u,{onClick:()=>{Xt(yt),Le(null)},children:[
|
|
94
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 12h-15"})}),fe.minimize]}),!Sn&&/* @__PURE__ */I(u,An?{onClick:()=>{zn(!1),hn(en()),Le(null)},children:[
|
|
95
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),fe.windowed]}:{onClick:()=>{_n(),Le(null)},children:[
|
|
96
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})}),fe.maximize]})]}),j&&/* @__PURE__ */I(u,{onClick:()=>{Ee(e=>!e),Le(null)},children:[
|
|
97
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 "+(Ce?"text-blue-600":"text-gray-400"),fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})}),Ce?fe.unpin:fe.pinOnTop]}),Ne&&/* @__PURE__ */I(u,{onClick:()=>{Le(null),Ie()},children:[
|
|
98
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 "+(Pe?"text-yellow-500":"text-gray-400"),fill:Pe?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})}),Pe?we.taskbar.removeFromDesktop:we.taskbar.addToDesktop]}),(st[yt]||[]).length>0&&/* @__PURE__ */D(W,{children:(st[yt]||[]).map((e,t)=>/* @__PURE__ */I(u,{onClick:()=>{Le(null),e.onClick()},children:[e.icon,e.label]},t))}),
|
|
99
|
+
/* @__PURE__ */D(h,{}),
|
|
100
|
+
/* @__PURE__ */I(u,{danger:!0,onClick:()=>{Le(null),Hn()},children:[
|
|
101
|
+
/* @__PURE__ */D(K,{className:"h-4 w-4"}),fe.close]})]}),or=!!G&&ft.some(e=>e.id===G),ir=!Ct||or||H?null:/* @__PURE__ */I("div",{"data-modal-restore-tab":!0,"data-modal-id":yt,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:[
|
|
102
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>Yt(yt),title:fe.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:ge||fe.windowSuffix}),
|
|
103
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>Yt(yt),title:fe.restore,"aria-label":fe.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:"▴"}),
|
|
104
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>{Hn()},title:fe.close,"aria-label":fe.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 $(
|
|
105
|
+
/* @__PURE__ */I(nt.Provider,{value:null,children:[nr,rr,ir]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Cn&&"Escape"===e.key&&(Bn(null),Nn(!1))});var Fn=100,qn={past:[],future:[]};function Un(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>Fn?r.slice(r.length-Fn):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:qn}}var Yn=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Xn=500,_n=250;function Jn({children:t,canEdit:n=!0,perms:r,windowId:o}){const[i,a]=T(Un,qn),l=k(/* @__PURE__ */new Map),[s,c]=E(0),d=s>0,[u,h]=E(0),[m,p]=E(0),w=m>0,{hasAnyPerm:f}=e(),y=n&&0===u&&(!(r&&r.length>0)||f(r)),g=k(null),v=k(!1),x=M(()=>{const e={};for(const[t,n]of l.current)e[t]=n.getLast();return e},[]),L=M((e,t)=>{l.current.has(e)||c(e=>e+1),l.current.set(e,t)},[]),S=M(e=>{l.current.delete(e)&&c(e=>e-1)},[]),A=M(e=>{h(t=>t+(e?1:-1))},[]),z=M(e=>{p(t=>t+(e?1:-1))},[]),[P,W]=E(0),$=P>0,K=M(e=>{W(t=>t+(e?1:-1))},[]),R=b(Z),B=R?.claimReadOnly;C(()=>{if(B&&!y)return B(!0),()=>B(!1)},[B,y]);const j=R?.claimOwnMount;C(()=>{if(j&&$)return j(!0),()=>j(!1)},[j,$]);const O=k({last:0,count:0,tripped:!1}),H=k(!1),V=M((e,t,n)=>{if(v.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)||(H.current=!0));if(!y||g.current)return;const r=O.current;if(r.tripped)return;const o=Date.now();if(o-r.last>_n&&(r.count=0),r.last=o,++r.count>Xn)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Xn} 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:x(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,x]),F=M(e=>{for(const[t,n]of Object.entries(e)){const e=l.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),q=M(()=>{const e=i.past[i.past.length-1];if(!e)return;const t={values:x(),label:e.label,coalesceKey:null};F(e.values),a({type:"undo",redoStep:t})},[i.past,x,F]),U=M(()=>{const e=i.future[0];if(!e)return;const t={values:x(),label:e.label,coalesceKey:null};F(e.values),a({type:"redo",undoStep:t})},[i.future,x,F]),[Y,X]=E(0),_=k(0),J=k(0),G=k(!1),Q=M(()=>{v.current=!0,H.current=!1,g.current=null,_.current+=1,J.current=_.current,X(_.current)},[]),ee=k(void 0),ne=M(e=>{void 0!==e&&(void 0!==ee.current&&e!==ee.current&&(G.current=!0),ee.current=e),Q()},[Q]);C(()=>{v.current&&Y===J.current&&(v.current=!1,g.current=null,(H.current||G.current)&&a({type:"clear"}),H.current=!1,G.current=!1)},[Y]);const re=M(()=>{G.current=!0,a({type:"clear"}),Q()},[Q]),oe=y&&i.past.length>0,ie=y&&i.future.length>0,ae=kn(o),le=k({undo:q,redo:U,canUndo:oe,canRedo:ie});le.current={undo:q,redo:U,canUndo:oe,canRedo:ie},C(()=>{if(!ae||!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&&Yn.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=le.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ae,y]);const se=N(()=>({register:L,unregister:S,record:V,undo:q,redo:U,clear:re,baseline:ne,canUndo:oe,canRedo:ie,enabled:y,hasState:d,handMounted:$,claimOwnMount:K,claimReadOnly:A,declaredEditable:w,claimEditable:z,undoLabel:oe?i.past[i.past.length-1].label:null,redoLabel:ie?i.future[0].label:null}),[L,S,V,q,U,re,ne,oe,ie,y,d,$,K,A,w,z,i.past,i.future]),ce=""!==pt(),de=b(mt)?.footerOpen??!1,ue=ce&&y&&d&&!$&&de;/* @__PURE__ */
|
|
106
|
+
return I(Z.Provider,{value:se,children:[ue&&/* @__PURE__ */D(ft,{position:"left",quiet:!0,children:/* @__PURE__ */D(te,{auto:!0})}),t]})}function Gn(){const e=b(Z),t=M(()=>{},[]);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 Qn(e){const t=b(Z),n=t?.claimReadOnly,r=t?.claimEditable;C(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Zn(e,t,n){const r=b(Z),o=z(),i=k(e),a=k(t);a.current=t,C(()=>{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=k(r);c.current=r;const d=k({label:l,coalesceKey:s});d.current={label:l,coalesceKey:s},C(()=>{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 er(e,t){const[n,r]=E(e);return Zn(n,e=>r(()=>e),t),[n,r]}export{yt as CancelButton,ht as CopyButton,ke as DocFavStar,de as EntityWindowFallback,se as EntityWindowLoading,ue as EntityWindowState,ae as LoadingSpinner,it as MODAL_SUBMIT_SELECTOR,Vn as Modal,ft as ModalActions,Je as SIDEBAR_STRIP_W,te as UndoControls,Jn as UndoProvider,q as WINDOW_REGISTRY,G as WindowCrashedFallback,Q as WindowErrorBoundary,Ke as WindowManagerProvider,dt as WindowTitle,Xe as beginWindowGesture,qt as cancelWindowFront,J as client_default,jn as commitExposeHighlight,_e as drainPerfEvents,An as exitExposeMode,At as forgetMaximizedWindowBoxes,vn as getActiveModalId,Ne as getActiveWindowRoute,Rn as getExposeHighlight,Nt as getWindowPosition,me as isDraftEntityId,pe as isDraftEntityWindow,H as isEntityEntry,O as isPageEntry,X as isShellApiClientConfigured,Ye as markMenuOpen,Ft as requestWindowFront,Bn as setExposeHighlight,Ue as setPerfCollecting,Y as setShellApiClient,F as setShellWindowRegistry,Lt as setWindowDefaultPosition,St as setWindowPosition,Kn as subscribeExposeHighlight,Sn as toggleExposeMode,pt as useEnclosingModalId,kn as useIsActiveWindow,wt as useModalActive,Gn as useUndo,Qn as useUndoCanEdit,Zn as useUndoable,er as useUndoableState,lt as useWidgetSettings,ye as useWindowDirty,ve as useWindowManager,ct as useWindowMenuItem,ut as useWindowTitle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useShellAuth as o}from"./chunk-UB4JIOLD.js";var r={};function n(o){r=o}function t(){const{hasAnyPerm:n}=o();return{user:r.user,logout:r.logout??(()=>{}),hasAnyPerm:n}}export{n as setShellAuthBridge,t as useAuth};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=null,u=0;function t(t){n={token:++u,url:t}}function l(){return n}function o(u){n===u&&(n=null)}export{o as claimBrowserStartUrl,l as peekBrowserStartUrl,t as setBrowserStartUrl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(){try{const t=document.documentElement;return"dark"===t.getAttribute("data-theme")||t.classList.contains("dark")}catch{return!1}}var e=["data-theme","class"];export{e as ROOT_THEME_ATTRIBUTES,t as rootIsDark};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{navIcons as e}from"./chunk-UB4JIOLD.js";import{isValidElement as t,cloneElement as r}from"react";import{jsx as n,jsxs as o}from"react/jsx-runtime";var i=["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 l(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r);return i[Math.abs(t)%i.length]}var a={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"},d={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"},s={pdf:"PDF",dxf:"DXF","3d":"STP",image:"IMG",csv:"CSV"},c={pdf:"text-red-600",dxf:"text-blue-600","3d":"text-purple-600",image:"text-emerald-600",csv:"text-green-600"};function p({className:e}){/* @__PURE__ */
|
|
2
|
+
return n("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */n("path",{d:"M2.25 7.125A2.25 2.25 0 014.5 4.875h4.504c.61 0 1.193.243 1.624.673l1.494 1.494a.75.75 0 00.53.22h7.098A2.25 2.25 0 0122 9.51v8.366A2.25 2.25 0 0119.75 20.125H4.25A2.25 2.25 0 012 17.875V7.125z"})})}function f(t,r){return r&&e[r]||(t?e[t]:void 0)}var u=/* @__PURE__ */n("svg",{className:"h-7 w-7",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */n("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 h({entityType:e,isSelected:i,entityId:h,label:m,fileKind:w}){const g="preview-file"===e&&w,x=g?c[w]:null,y=g?s[w]:null;if("folder"===e)/* @__PURE__ */
|
|
3
|
+
return n("div",{className:"w-12 h-12 flex items-center justify-center "+(i?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */n(p,{className:"h-12 w-12 text-amber-500 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]"})});if("page"===e){const e=f(h,m),o=l(h||m||"page");/* @__PURE__ */
|
|
4
|
+
return n("div",{className:"w-12 h-12 flex items-center justify-center "+(i?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */n("span",{className:`h-11 w-11 rounded-xl bg-gradient-to-br ${o} flex items-center justify-center text-white border border-white/30 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]`,children:e&&t(e)?r(e,{className:"h-7 w-7 text-white"}):u})})}/* @__PURE__ */
|
|
5
|
+
return o("div",{className:"w-12 h-12 relative flex items-center justify-center "+(i?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:[
|
|
6
|
+
/* @__PURE__ */o("svg",{className:`w-10 h-12 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)] ${x??a[e]??"text-gray-500"}`,viewBox:"0 0 40 48",fill:"none",children:[
|
|
7
|
+
/* @__PURE__ */n("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__ */n("path",{d:"M26 0l10 10H30a4 4 0 01-4-4V0z",fill:"currentColor",fillOpacity:"0.2"}),
|
|
9
|
+
/* @__PURE__ */n("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__ */n("span",{className:`absolute inset-0 flex items-center justify-center text-[9px] font-bold pt-2 ${x??a[e]??"text-gray-600"}`,children:y??d[e]??e.slice(0,3).toUpperCase()})]})}function m({item:e}){if("folder"===e.entityType)/* @__PURE__ */
|
|
11
|
+
return n(p,{className:"h-4 w-4 shrink-0 text-amber-500"});if("page"===e.entityType){const o=f(e.entityId,e.label);/* @__PURE__ */
|
|
12
|
+
return n("span",{className:`h-4 w-4 rounded bg-gradient-to-br ${l(e.entityId||e.label||"page")} flex items-center justify-center text-white shrink-0`,children:o&&t(o)?r(o,{className:"h-3 w-3 text-white"}):/* @__PURE__ */n("span",{className:"h-1.5 w-1.5 rounded-[2px] border border-white/80"})})}const o=("preview-file"===e.entityType&&e.fileKind?c[e.fileKind]:a[e.entityType])??"text-gray-400";/* @__PURE__ */
|
|
13
|
+
return n("svg",{className:`h-4 w-4 shrink-0 ${o}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */n("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function w(e){return"preview-file"===e.entityType&&e.fileKind?s[e.fileKind]:"page"===e.entityType?"App":"folder"===e.entityType?"Folder":d[e.entityType]??e.entityType.slice(0,3).toUpperCase()}var g=null,x=/* @__PURE__ */new Set;function y(e){g=e,x.forEach(e=>e())}function v(e){return x.add(e),()=>{x.delete(e)}}function b(){return g}var _="__REACT_OS_SHELL_FILES_VIEW__",k="react-os-shell:files-show-trash",N="react-os-shell:files-open-desktop-folder";function C(){"undefined"!=typeof window&&(window[_]="trash",window.dispatchEvent(new CustomEvent(k)))}function j(e){"undefined"!=typeof window&&(window[_]={view:"desktop-folder",folderId:e},window.dispatchEvent(new CustomEvent(N,{detail:{folderId:e}})))}function I(){if("undefined"==typeof window)return null;const e=window[_];return"trash"===e?"trash":e&&"object"==typeof e&&"desktop-folder"===e.view&&"string"==typeof e.folderId?e:null}function L(){const e=I();return"undefined"!=typeof window&&(window[_]=null),e}export{m as DesktopItemMiniIcon,N as FILES_OPEN_DESKTOP_FOLDER_EVENT,k as FILES_SHOW_TRASH_EVENT,h as FileIconTile,p as FolderGlyph,L as consumeFilesViewRequest,w as desktopItemTypeLabel,b as getDesktopFoldersSnapshot,I as peekFilesViewRequest,y as publishDesktopFolders,j as requestFilesDesktopFolderView,C as requestFilesTrashView,v as subscribeDesktopFolders};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as a,useEffect as l}from"react";import{jsx as t}from"react/jsx-runtime";var r={favicon:"h-8 w-8",compact:"h-10 w-10",wordmark:"h-10 w-40"};function e(a){return a.trim().charAt(0).toLocaleUpperCase()||"·"}function n(a,l,t){return!1===a?"framed":null==a||null==l?"plate-light":l?"light"===t?"plate-dark":"bare":"dark"===t?"plate-light":"bare"}var o={"plate-light":"bg-white shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]","plate-dark":"bg-neutral-900 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow-strong)]",framed:"border border-black/10 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]",bare:""};function i(a,l,t){return"bare"===a?{}:"framed"===a?{borderRadius:l}:{borderRadius:l,padding:t}}function d({src:d,fallbackSrc:s,fallbackHasAlpha:h=null,fallbackIsLight:c=null,fallbackAdaptive:m,alt:u,slot:p="compact",surface:b="light",size:f,width:g,height:k,decorative:w=!1,fallbackMode:v="monogram",adaptive:x=!1,hasAlpha:_=null,isLight:y=null,treatmentPadding:j=4,treatmentRadius:A=8,className:N="",style:L}){const[R,B]=a(d||s||"");l(()=>{B(d||s||"")},[d,s]);const z=Boolean(s&&R===s&&R!==d),C=(z?m??x:x)?n(z?h:_,z?c:y,b):"bare",E=["inline-flex shrink-0 items-center justify-center overflow-hidden",null==f&&null==g&&null==k?r[p]:"","dark"===b?"text-white":"text-gray-700",o[C],N].filter(Boolean).join(" "),F={...i(C,A,j),...null==f?{width:g,height:k}:{width:f,height:f},...L};return R?/* @__PURE__ */t("span",{className:E,"data-brand-treatment":C,style:F,children:/* @__PURE__ */t("img",{src:R,alt:w?"":u,"data-brand-slot":p,className:"block max-h-full max-w-full",style:{objectFit:"contain"},onError:()=>B(a=>s&&a!==s?s:"")})}):"none"===v?null:/* @__PURE__ */t("span",{"data-brand-fallback":!0,"data-brand-slot":p,"aria-label":w?void 0:u,"aria-hidden":w||void 0,role:w?void 0:"img",className:`${E} rounded-md bg-gray-100 font-semibold`,style:F,children:w?null:e(u)})}export{d as BrandMark,n as resolveBrandMarkTreatment};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as e,useContext as o,useMemo as t,useEffect as a}from"react";import{jsx as n}from"react/jsx-runtime";var i=/* @__PURE__ */new Map;function r(e,o){const t=`${e}|${JSON.stringify(o)}`;let a=i.get(t);return a||(a=new Intl.NumberFormat(e,o),i.set(t,a)),a}function s(e,o){return o?r(o,{maximumFractionDigits:20}).format(e):String(e)}function l(e,o,t){return t?r(t,{minimumFractionDigits:o,maximumFractionDigits:o}).format(e):e.toFixed(o)}function d(e,o,t){return t?r(t,{style:"percent",minimumFractionDigits:o,maximumFractionDigits:o}).format(e/100):`${e.toFixed(o)}%`}function c(e){const o=o=>s(o,e),t=o=>function(e,o){return o?r(o,{}).format(e):e.toLocaleString()}(o,e),a=(o,t)=>l(o,t,e);return{window:{minimize:"Minimize",restore:"Restore",maximize:"Maximize",windowed:"Windowed",pinOnTop:"Pin on top",unpin:"Unpin from top",close:"Close",windowSuffix:"window",prev:"Prev",next:"Next",snapLayouts:"Snap layouts",snapLeft:"Snap left half",snapRight:"Snap right half",snapTopLeft:"Snap top-left quarter",snapTopRight:"Snap top-right quarter",snapBottomLeft:"Snap bottom-left quarter",snapBottomRight:"Snap bottom-right quarter"},taskbar:{closeWindow:"Close window",offscreenHint:"This window is off screen — click to bring it back",offscreenDot:"Off screen — click to bring this window back",expose:"Exposé — show all open windows as thumbnails",addToDesktop:"Add to desktop",removeFromDesktop:"Remove from desktop",minimizeAllWindows:"Minimize all",restoreAllWindows:"Restore all",closeAllWindows:"Close all"},logout:{goodbye:"Goodbye",seeYou:"See you next time"},about:{aboutPrefix:"About",thisApp:"this app",openSourceLicenses:"Open Source Licenses",whatsNew:"What's New",noChangelog:"No changelog available."},table:{empty:"Nothing to show",loading:"Loading",selectAll:"Select all rows",selectRow:"Select row"},select:{none:"— None —",noMatches:"No matches",allSelected:"All options selected",clear:"Clear selection",remove:"Remove"},notifications:{title:"Notifications",markAllRead:"Mark all read",dnd:"Do not disturb",dndOn:"Do not disturb is on",caughtUp:"All caught up",empty:"No notifications yet",viewAll:"View all notifications",cardLabel:"Notification",dismiss:"Dismiss notification"},form:{errorSummaryTitle:"There is a problem"},help:{title:"Help",searchPlaceholder:"Search help…",empty:"No help articles yet.",noResults:"No articles match your search.",loading:"Loading…",pickArticle:"Pick a help article from the left.",noBody:"This article has no body yet.",draft:"Draft",newArticle:"+ New",edit:"Edit"},update:{available:"A new version is available.",refreshNow:"Refresh now"},pageTabs:{label:"Open pages",close:"Close",closeOthers:"Close other tabs",closeRight:"Close tabs to the right",closeAll:"Close all tabs",unsaved:"Unsaved changes",discardTitle:"Discard unsaved changes?",discardOne:"This page has changes that have not been saved. Close it anyway?",discardMany:"pages have changes that have not been saved. Close them anyway?",discardConfirm:"Discard and close",keepEditing:"Keep editing"},dialog:{close:"Close",cancel:"Cancel",ok:"OK",confirmTitle:"Confirm",destructiveTitle:"Confirm Action",destructiveCancel:"Dismiss",destructiveConfirm:"Delete",typeToConfirm:e=>`Type ${e} to confirm:`,promptTitle:"Enter a value"},calendar:{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",monthPanel:"Choose a month",yearPanel:"Choose a year",chooseMonth:e=>`Choose a month, currently ${e}`,chooseYear:e=>`Choose a year, currently ${e}`},datePicker:{placeholder:"Select a date",dialog:"Choose a date",clear:"Clear",today:"Today"},dateRange:{placeholder:"Date Range",clearRange:"Clear date range",dialog:"Date range",from:"From",to:"To",start:"Start",end:"End",fromOnly:e=>`From ${e}`,toOnly:e=>`To ${e}`,range:(e,o)=>`${e} to ${o}`,last2Weeks:"Last 2 Weeks",lastMonth:"Last Month",last3Months:"Last 3 Months",last6Months:"Last 6 Months",last12Months:"Last 12 Months",custom:"Custom",clear:"Clear",cancel:"Cancel",apply:"Apply"},pagination:{label:"Pagination",first:"First page",previous:"Previous page",next:"Next page",last:"Last page"},list:{selected:e=>`${o(e)} selected`,allLoaded:(e,o)=>`All ${t(e)} ${o} loaded`,count:(e,o)=>`${t(e)} ${o}`,loadedOf:(e,o,a)=>`${t(e)} of ${t(o)} ${a}`,loadingMore:"Loading more...",loadError:"Couldn't load this list",loadErrorMessage:"Something went wrong fetching these records. Check your connection and try again.",retry:"Try again"},kanban:{loading:"Loading…",empty:"No items.",dropHere:"Drop here",addItem:"Add item"},files:{attach:"Attach files",drop:"Drop files to attach",remove:e=>`Remove ${e}`,chooseMany:"Choose files",chooseOne:"Choose a file",dragMany:"or drag them here",dragOne:"or drag it here",notAccepted:(e,o)=>`${e} is not an accepted file type${o?` (${o})`:""}`,tooLarge:(e,o,t)=>`${e} is ${o} — the limit is ${t}`,tooMany:(e,t)=>`${e} was not added — ${o(t)} ${1===t?"file":"files"} is the limit`,bytes:e=>`${o(e)} B`,kilobytes:e=>`${o(e)} KB`,megabytes:e=>`${a(e,1)} MB`},media:{uploadImage:"Upload an image",uploadVideo:"Upload a video",uploadFile:"Upload a file",upload:"Upload media",cta:"Choose from library or upload",replace:"Replace",remove:"Remove",uploading:"Uploading…",cover:"Cover",add:"Add",addMedia:"Add media",empty:"No media.",removeItem:e=>`Remove ${e}`,reorder:(e,t,a)=>`${e}, item ${o(t)} of ${o(a)}. Use arrow keys to reorder.`},brandAsset:{save:e=>`Save ${e}`,remove:e=>`Remove ${e}`,discard:"Discard change",saveFailed:e=>`Could not save ${e}.`,removeFailed:e=>`Could not remove ${e}.`,region:(e,o)=>`${e} for ${o}`,usedFor:e=>`Used for ${e}.`,previews:e=>`${e} previews`,preview:"Preview",alt:(e,o)=>`${e} ${o}`},copy:{copy:"Copy",copyLabel:e=>`Copy ${e}`,copied:"Copied",copiedLabel:e=>`${e} copied`,failed:"Could not copy to the clipboard"},keypad:{backspace:"Backspace",enter:"Enter"},banner:{dismiss:"Dismiss"},badge:{remove:"Remove",removeItem:e=>`Remove ${e}`},breadcrumbs:{label:"Breadcrumb",hidden:"Hidden crumbs"},emptyState:{message:"Nothing here yet."},errors:{notFound:"Page not found",notFoundBody:"The page you're looking for doesn't exist or was moved.",forbidden:"Access denied",forbiddenBody:"You don't have permission to view this page.",noAccess:"You don't have access to this",serverError:"Something went wrong",serverErrorBody:"An unexpected error occurred. Please try again.",retry:"Try again",details:"Error details"},search:{placeholder:"Search...",escBadge:"ESC",searching:"Searching...",noResults:"No results found.",minChars:e=>`Type at least ${o(e)} characters to search...`,navigate:"navigate",open:"open",close:"close",enterKey:"Enter",escKey:"Esc"},grid:{selectAll:"Select all",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:e=>`Delete row ${e}`,insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteColumn:e=>`Delete column ${e}`,resize:"Drag to resize · double-click to auto-fit",fill:"Drag to fill"},sidebar:{resize:"Drag to resize · double-click to reset"},markdown:{screenshot:"Screenshot"},severity:{success:"ok",warning:"warning",danger:"critical",unrecognised:e=>`unrecognised severity ${e}`},meter:{noData:"no data",warningAt:e=>`warning ≥ ${o(e)}`,criticalAt:e=>`critical ≥ ${o(e)}`,noReading:"no reading",noBudget:"no budget",ofBudget:e=>`${e} of budget`,budget:"budget",hoursMinutes:(e,t)=>`${o(e)}h ${o(t)}m`,minutesSeconds:(e,t)=>`${o(e)}m ${o(t)}s`,seconds:e=>`${o(e)}s`},charts:{showTable:"Show the data as a table",loading:"Loading chart data",noData:"No data in this window.",windowStart:"Window start",windowEnd:"Window end",window:(e,t,a)=>`Time window — showing ${e} to ${t} of ${o(a)} intervals`,overIntervals:(e,t)=>`${e.join(", ")} over ${o(t)} intervals`,acrossCategories:(e,t)=>`${e.join(", ")} across ${o(t)} categories`,acrossMeasures:(e,t)=>`${e.join(", ")} across ${o(t)} measures`,breakdown:(e,t)=>`Breakdown of ${e} across ${o(t)} segments`,funnel:(e,t,a)=>`Funnel of ${o(e)} stages, ${t} down to ${a}`,radialTrack:e=>`${o(e)} categories, as concentric proportions`,radialCycle:e=>`${o(e)} categories, around a cycle`,tableFrom:"From",tableTo:"To",tableItem:"Item",tableLevel:"Level",tableSeries:"Series",inBucket:e=>`${e} in this bucket`,inCategory:e=>`${e} in this category`,value:"Value",share:"Share",count:"Count",flow:"Flow",totalFlow:"Total flow",throughput:"Throughput",open:"Open",high:"High",low:"Low",close:"Close",maximum:"Maximum",q3:"Q3",median:"Median",q1:"Q1",minimum:"Minimum",distribution:"Distribution",fiveNumber:(e,t)=>`${e}: five-number summary for ${o(t)} categories`,outliers:e=>`${o(e)} outlier${e>1?"s":""} beyond the whiskers`,price:"Price",ohlc:(e,t)=>`${e}: open, high, low and close across ${o(t)} periods`,closedAbove:"Closed above its open",closedBelow:"Closed below its open",noFlows:"No flows to chart.",chord:e=>`Flows between ${o(e)} participants`,noStages:"No stages to chart.",ofFirstStage:"Of first stage",droppedHere:"Dropped here",intensity:"Intensity",noActivity:"No activity in this window.",heatmap:(e,t,a)=>`${e} across ${o(t)} rows and ${o(a)} columns`,countAxis:"count",histogram:(e,t,a)=>`${e}: ${o(t)} bins over ${o(a)} observations`,observations:"Observations",notEnough:"Not enough eligible requests to judge.",objectiveMet:e=>`objective ${e} met`,objectiveMissed:e=>`objective ${e} missed`,nothingToPlot:"Nothing to plot.",nothingToCompare:"Nothing to compare.",other:"Other",nothingToBreakDown:"Nothing to break down.",range:"Range",rangeLabel:(e,t)=>`${e}: low and high across ${o(t)} categories`,nothingToRank:"Nothing to rank in this window.",emphasised:"(emphasised)",sankey:(e,t)=>`Flow between ${o(e)} nodes over ${o(t)} links`,noObservations:"No observations in this window.",xAxis:"x",yAxis:"y",size:"Size",scatter:(e,o,t)=>`${e.join(", ")}: ${o} against ${t}`,outsideRange:e=>`${o(e)} ${1===e?"point":"points"} outside the shown range`,waterfall:(e,t,a)=>`Waterfall of ${o(e)} steps from ${t} to ${a}`,balance:"Balance",increase:"Increase",decrease:"Decrease",runningTotal:"Running total",sunburst:(e,t)=>`Hierarchy of ${e} across ${o(t)} levels`,treemap:e=>`Treemap of ${o(e)} items`,trendUp:"up",trendDown:"down",trendFlat:"flat"},timeline:{days:e=>`${t(e)} days`,daysToToday:e=>`${t(e)} days to today`,notReached:"Not yet reached",next:"Next",more:e=>`+${o(e)} more`,today:"Today",todayTitle:e=>`Today — ${e}`,open:e=>`Open ${e}`,openButton:"Open",scrub:"Scrub the timeline",alsoToCome:e=>`Also to come: ${e.join(", ")}`,start:e=>`Start · ${e}`,events:(e,t)=>`${o(e)} events · ${t.join(", ")}`,started:e=>`started ${e}`,duration:e=>`${t(e)} day${1===e?"":"s"}`,reached:(e,t)=>`${o(e)} of ${o(t)} milestones`,milestones:e=>`${e} milestones`},production:{heading:"Production progress",start:"Start",estimated:"Estimated",estimatedCompletion:"Estimated completion",estDone:"Est. done",play:"Play",pause:"Pause",playTitle:"Play the timeline, report by report",backTo:e=>`Back to ${e}`,showing:e=>`Showing ${e}`,overall:o=>`${((o,t)=>d(o,t,e))(o,0)} overall`,inStock:e=>`${t(e)} pc in stock`,noReport:"No production report filed yet",leadTime:e=>`${t(e)} day${1===e?"":"s"} lead time`,report:"Production report",shipment:"Shipment",inspection:"Inspection",invoice:"Invoice",scrub:"Scrub the production timeline",label:(e,o)=>`Production reports and events, ${e} to ${o}`},containers:{items:e=>`${o(e)} items`,pieces:e=>`${o(e)} pcs`,split:(e,t)=>`(${o(e)} instr / ${o(t)} loaded)`,added:(e,t)=>`${o(e)} new (${o(t)} pcs)`,fill:(e,t)=>`${a(e,1)} / ${o(t)} m³`,total:"Total:",instructed:e=>`${a(e,2)} m³ instruction`,loaded:e=>`${a(e,2)} m³ loaded`,volume:e=>`${a(e,2)} m³`,noVolume:"Volume: N/A (no volume data for these part numbers)"},toast:{notification:"Notification"}}}var m=c(),u=/* @__PURE__ */new Map;var h=e(m),p=e(null),g=/* @__PURE__ */new Set;var $=m,f={};function w(){return $}function v({value:e=f,locale:i,children:r}){const s=o(p),l=t(()=>function(e){if(e)try{return Intl.getCanonicalLocales(e)[0]}catch{return void(g.has(e)||(g.add(e),console.error(`[efficient-shell] ShellStringsProvider: locale="${e}" is not a BCP 47 language tag, so it is ignored and numbers and dates keep their default formatting. Pass a tag such as "de-DE" or "ja".`)))}}(i),[i]),d=void 0===i?s?.locale:l,w=t(()=>{const o=function(e){if(!e)return m;let o=u.get(e);return o||(o=c(e),u.set(e,o)),o}(d),t={};for(const a of Object.keys(o))t[a]={...o[a],...e[a]??{}};return t},[e,d]),v=t(()=>({locale:d}),[d]),y=null!==s;return a(()=>{if(!y)return $=w,()=>{$===w&&($=m)}},[w,y]),/* @__PURE__ */n(p.Provider,{value:v,children:/* @__PURE__ */n(h.Provider,{value:w,children:r})})}function y(){return o(h)}function b(){return o(p)?.locale}function C(e){const[o="",...t]=e("\0").split("\0");return[o,t.join("")]}export{m as DEFAULT_SHELL_STRINGS,v as ShellStringsProvider,w as currentShellStrings,l as formatFixed,d as formatPercent,s as formatPlain,C as splitAround,b as useShellLocale,y as useShellStrings};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{toast_default as e}from"./chunk-VEGMDXT4.js";import{createContext as t,useContext as n,useRef as r,useState as o,useEffect as a}from"react";import*as i from"pdfjs-dist";import{createPortal as s}from"react-dom";import{jsx as l,jsxs as c}from"react/jsx-runtime";function d(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 u=t(null);function h({children:e}){const t=n(u);return t?s(e,t):/* @__PURE__ */l("div",{className:"flex shrink-0 items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||i.GlobalWorkerOptions.workerSrc||(i.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${i.version}/build/pdf.worker.min.mjs`);var m={"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},p=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=m[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 o=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(o))throw d(n,t,o);return o}};function f(){const e="undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0;return"string"==typeof e&&e?{wasmUrl:e.endsWith("/")?e:`${e}/`}:{BinaryDataFactory:p}}var g=[50,75,100,125,150,200,300,400];function w(e,t,n){const r=(t.width-40)/n.width,o="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(o,.3),4)}function v({url:t,filename:n,fit:s="width",onDownload:d,onEmail:u}){const m=r(null),p=r(null),v=r(null),[y,x]=o(null),[b,k]=o(1),[C,L]=o(0),[N,M]=o(1),[j,E]=o(!0),[D,A]=o(!0);a(()=>{let n=!1;return A(!0),k(1),i.getDocument({url:t,...f()}).promise.then(e=>{n||(x(e),L(e.numPages),A(!1))}).catch(()=>{n||(e.error("Failed to load PDF"),A(!1))}),()=>{n=!0}},[t]),a(()=>{if(!y||!j||!v.current)return;const e=()=>{const e=v.current;e&&y.getPage(b).then(t=>{if(!v.current)return;const n=t.getViewport({scale:1}),r=w(s,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});M(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(v.current),()=>t.disconnect()},[y,b,j,s]),a(()=>{if(!y||!m.current)return;let e=!1,t=null,n=null;return y.getPage(b).then(r=>{if(e||!m.current)return;const o=r.getViewport({scale:N}),a=m.current;a.width=o.width,a.height=o.height,a.style.width=`${o.width}px`,a.style.height=`${o.height}px`;const s=a.getContext("2d");t=r.render({canvas:a,canvasContext:s,viewport:o}),t.promise.catch(()=>{});const l=p.current;l&&(l.replaceChildren(),l.style.setProperty("--total-scale-factor",String(o.scale)),n=new i.TextLayer({textContentSource:r.streamTextContent(),container:l,viewport:o}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",l.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[y,b,N]),a(()=>{const e=()=>p.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const _="page"===s?"Fit page":"Fit width",P="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
2
|
+
return c("div",{className:"flex flex-col h-full",children:[
|
|
3
|
+
/* @__PURE__ */c(h,{children:[
|
|
4
|
+
/* @__PURE__ */l("button",{"aria-label":"Previous page",onClick:()=>k(e=>Math.max(1,e-1)),disabled:b<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */l("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}),
|
|
5
|
+
/* @__PURE__ */c("span",{className:"text-gray-600 font-medium tabular-nums",children:[b," / ",C]}),
|
|
6
|
+
/* @__PURE__ */l("button",{"aria-label":"Next page",onClick:()=>k(e=>Math.min(C,e+1)),disabled:b>=C,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */l("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),
|
|
7
|
+
/* @__PURE__ */l("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
8
|
+
/* @__PURE__ */l("button",{onClick:()=>{E(!1),M(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:P,children:"−"}),
|
|
9
|
+
/* @__PURE__ */c("select",{value:j?"fit":g.includes(Math.round(100*N))?Math.round(100*N):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(E(!1),M(Number(t)/100)):E(!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",title:"Zoom",children:[
|
|
10
|
+
/* @__PURE__ */l("option",{value:"fit",children:_}),!j&&!g.includes(Math.round(100*N))&&/* @__PURE__ */c("option",{value:"custom",children:[Math.round(100*N),"%"]}),g.map(e=>/* @__PURE__ */c("option",{value:e,children:[e,"%"]},e))]}),
|
|
11
|
+
/* @__PURE__ */l("button",{onClick:()=>{E(!1),M(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:P,children:"+"}),
|
|
12
|
+
/* @__PURE__ */l("button",{onClick:()=>E(!0),className:P+(j?" bg-gray-200 text-gray-900":""),title:`${_} — auto-tracks the container size until you zoom manually`,children:"Fit"}),
|
|
13
|
+
/* @__PURE__ */l("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
14
|
+
/* @__PURE__ */c("button",{onClick:()=>{if(!y)return;const t=window.open("","_blank");if(!t)return void e.error("Allow popups to print");const r=[];for(let e=1;e<=C;e++)r.push(y.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(r).then(e=>{t.document.write(`<html><head><title>${n}</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:P,children:[
|
|
15
|
+
/* @__PURE__ */l("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z"})}),"Print"]}),
|
|
16
|
+
/* @__PURE__ */c("button",{onClick:d??(()=>{const e=document.createElement("a");e.href=t,e.download=n,e.click()}),className:P,children:[
|
|
17
|
+
/* @__PURE__ */l("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Download"]}),u&&/* @__PURE__ */c("button",{onClick:u,className:P,children:[
|
|
18
|
+
/* @__PURE__ */l("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})}),"Email"]})]}),
|
|
19
|
+
/* @__PURE__ */l("div",{ref:v,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!y)return;if(e.ctrlKey||e.metaKey)return;const t=v.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&b<C?(e.preventDefault(),k(e=>Math.min(C,e+1)),requestAnimationFrame(()=>{v.current&&(v.current.scrollTop=0)})):e.deltaY<0&&n&&b>1&&(e.preventDefault(),k(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{v.current&&(v.current.scrollTop=v.current.scrollHeight)}))},onKeyDown:e=>{if(!y)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?b<C&&(e.preventDefault(),k(e=>Math.min(C,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?b>1&&(e.preventDefault(),k(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),k(1)):"End"===e.key&&(e.preventDefault(),k(C)))},children:D?/* @__PURE__ */l("div",{className:"flex items-center justify-center h-full text-gray-400 text-sm",children:"Loading PDF..."}):/* @__PURE__ */c("div",{className:"min-h-full flex items-center justify-center p-4",children:[
|
|
20
|
+
/* @__PURE__ */l("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'}),
|
|
21
|
+
/* @__PURE__ */c("div",{className:"relative shadow-lg rounded",children:[
|
|
22
|
+
/* @__PURE__ */l("canvas",{ref:m,className:"block rounded"}),
|
|
23
|
+
/* @__PURE__ */l("div",{ref:p,className:"preview-pdf-textlayer",onPointerDown:e=>e.currentTarget.classList.add("selecting")})]})]})})]})}export{h as PanelActions,v as PdfViewer,u as ToolbarSlotContext,w as fitScale};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{forwardRef as e,useId as r}from"react";import{jsxs as t,jsx as o}from"react/jsx-runtime";var s="inline-flex items-center justify-center rounded-md font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60",i={primary:"bg-blue-600 text-white shadow-sm hover:bg-blue-700 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",secondary:"border border-gray-300 bg-white text-gray-700 shadow-sm hover:bg-gray-50 focus-visible:ring-[color:var(--rosh-focus-ring)]",ghost:"text-gray-700 hover:bg-gray-100 focus-visible:ring-[color:var(--rosh-focus-ring)]","ghost-danger":"text-red-600 hover:bg-red-50 focus-visible:ring-[color:var(--rosh-focus-ring-invalid)]",danger:"bg-red-600 text-white shadow-sm hover:bg-red-700 focus-visible:ring-[color:var(--rosh-focus-ring-invalid-strong)]",link:"text-blue-600 underline-offset-4 hover:underline focus-visible:ring-[color:var(--rosh-focus-ring)]"},a={sm:"gap-1 px-2.5 py-1 text-xs",md:"gap-1.5 px-3 py-1.5 text-sm",lg:"gap-2 px-4 py-2.5 text-sm","touch-sm":"gap-1.5 h-11 px-4 text-base",touch:"gap-2 h-14 px-5 text-base","touch-lg":"gap-2 h-16 px-6 text-lg","touch-xl":"gap-3 h-20 px-8 text-2xl"},l={sm:"gap-1 text-xs",md:"gap-1.5 text-sm",lg:"gap-2 text-sm","touch-sm":"gap-1.5 text-base",touch:"gap-2 text-base","touch-lg":"gap-2 text-lg","touch-xl":"gap-3 text-2xl"},n={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10","touch-sm":"h-11 w-11",touch:"h-14 w-14","touch-lg":"h-16 w-16","touch-xl":"h-20 w-20"};function c({variant:e="primary",size:r="md",block:t=!1,className:o=""}={}){const n="link"===e;return[n?"inline-flex items-center font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60":s,i[e],n?l[r]:a[r],t?"w-full":"",o].filter(Boolean).join(" ")}function g({variant:e="ghost",size:r="md",className:t=""}={}){return[s,i[e],n[r],"shrink-0 p-0",t].filter(Boolean).join(" ")}function d(){/* @__PURE__ */
|
|
2
|
+
return t("svg",{className:"h-3.5 w-3.5 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[
|
|
3
|
+
/* @__PURE__ */o("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),
|
|
4
|
+
/* @__PURE__ */o("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]})}var h=e(function({variant:e="primary",size:s="md",loading:i=!1,leftIcon:a,rightIcon:l,block:n=!1,disabled:g,type:h="button",children:u,className:x="",disabledReason:m,...p},f){const b=r(),v=g||i,y=v&&null!=m&&""!==m,w=y?b:void 0,N=/* @__PURE__ */t("button",{ref:f,type:h,disabled:v,"aria-busy":i||void 0,"aria-describedby":w,className:c({variant:e,size:s,block:n,className:x}),...p,children:[i?/* @__PURE__ */o(d,{}):a,u,!i&&l]});return y?/* @__PURE__ */t("span",{className:n?"flex w-full flex-col gap-1":"inline-flex flex-col items-start gap-1",children:[N,
|
|
5
|
+
/* @__PURE__ */o("span",{id:w,className:"text-xs text-red-600",children:m})]}):N});export{h as Button_default,c as buttonClasses,g as iconButtonClasses};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{useWindowMenuItem as e,Modal as t}from"./chunk-JN4WXTWJ.js";import{navIcons as r}from"./chunk-UB4JIOLD.js";import{VERSION as o}from"./chunk-U4GTZPXP.js";import{useState as n,useCallback as s,isValidElement as i,cloneElement as a}from"react";import{jsx as l,jsxs as d}from"react/jsx-runtime";var c={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:"Multi-sheet spreadsheet editor with CSV / TSV import and export."},notepad:{name:"Notepad",version:"1.0.0",route:"/notepad",description:"Color-coded notes with checklists, desktop stickies and entity autolinking."},documents:{name:"Documents",version:"1.1.0",route:"/documents",description:"Letter-page editor for Word documents and plain-text files — images, lists, alignment."},preview:{name:"Preview",version:"1.3.2",route:"/preview",description:"Viewer for PDF documents, images, DXF drawings and 3D models — CAD-style measuring with object snap and an AutoCAD-like command bar."},files:{name:"Files",version:"1.1.0",route:"/files",description:"Personal file manager with folders, uploads, quota, trash and desktop shortcut folders."},browser:{name:"Browser",version:"1.0.1",route:"/browser",description:"Minimal web browser with bookmarks, history and navigation bar."}},m=/* @__PURE__ */l("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})}),p=/* @__PURE__ */l("svg",{className:"h-9 w-9",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})});function h({app:h}){const u=c[h],[x,f]=n(!1),g=s(()=>f(!0),[]);if(e(`About ${u.name}`,g,m),!x)return null;const v=r[u.route],w=i(v)?a(v,{className:"h-9 w-9"}):p;/* @__PURE__ */
|
|
2
|
+
return l(t,{open:!0,onClose:()=>f(!1),title:`About ${u.name}`,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */d("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
|
|
3
|
+
/* @__PURE__ */l("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:w}),
|
|
4
|
+
/* @__PURE__ */l("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:u.name}),
|
|
5
|
+
/* @__PURE__ */d("p",{className:"text-[11px] font-mono text-gray-400",children:["Version ",u.version]}),
|
|
6
|
+
/* @__PURE__ */l("p",{className:"mt-2 text-xs text-gray-500 leading-relaxed",children:u.description}),
|
|
7
|
+
/* @__PURE__ */d("div",{className:"mt-4 pt-3 border-t border-gray-200 w-full",children:[
|
|
8
|
+
/* @__PURE__ */d("p",{className:"text-[11px] text-gray-500",children:["Part of the ",
|
|
9
|
+
/* @__PURE__ */l("span",{className:"font-medium text-gray-700",children:"efficient-shell"})," desktop environment"]}),o&&/* @__PURE__ */d("p",{className:"mt-0.5 text-[10px] font-mono text-gray-400",children:["shell v",o]})]})]})})}export{h as AboutApp,c as BUILTIN_APP_INFO};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="4.137.1",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as e,useContext as r}from"react";import{jsx as n}from"react/jsx-runtime";function t(e){return"items"in e}function i(e,r){return!(e.perms?.length&&!r(e.perms))&&!(e.allPerms?.length&&!e.allPerms.every(e=>r([e])))}function o(e,r){return(e.children??[]).filter(e=>i(e,r))}function u(e,r){return!e.children?.length||o(e,r).some(e=>u(e,r))}var c={},l=new Proxy(c,{get:(e,r)=>c[r],has:(e,r)=>r in c,ownKeys:()=>Object.keys(c),getOwnPropertyDescriptor(e,r){if(r in c)return{configurable:!0,enumerable:!0,value:c[r]}}});function s(e){for(const e of Object.keys(c))delete c[e];Object.assign(c,e)}var a={},f=[],m={erp:[],system:[],virtual:[],footer:[]},h=e({hasAnyPerm:()=>!0});function p({value:e,children:r}){/* @__PURE__ */
|
|
2
|
+
return n(h.Provider,{value:e,children:r})}function v(){return r(h)}export{p as ShellAuthProvider,u as isReachable,t as isSection,l as navIcons,f as navSections,i as navVisible,a as sectionIcons,s as setShellNavIcons,m as startMenuCategories,v as useShellAuth,o as visibleChildren};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{onOverlayOpen as e,Z_LAYERS as t,registerModalEscapeInterceptor as n}from"./chunk-3A46NCXK.js";import{glassStyle as r,GLASS_DIVIDER as o}from"./chunk-57MIENLJ.js";import{useHydrated as i,useBrowserLayoutEffect as l}from"./chunk-D65T4H6J.js";import{createContext as a,forwardRef as u,useContext as s,useRef as c,useId as d,useState as p,useEffect as m,useMemo as f,useCallback as h}from"react";import{createPortal as g}from"react-dom";import{jsx as y,jsxs as x,Fragment as w}from"react/jsx-runtime";var v=/* @__PURE__ */new Set(["text","search","url","tel","email","password","number","date","datetime-local","month","week","time"]),b="data-native-context-menu";function k(e,t){return e&&"function"==typeof e.closest?e.closest(t):null}function C(e){const t=e;if(!t||"function"!=typeof t.closest)return!1;if(k(t,`[${b}]`))return!0;if(k(t,"textarea"))return!0;if(k(t,"img, picture, canvas, video, audio"))return!0;const n=k(t,"input");if(n){const e=(n.type||"text").toLowerCase();if(v.has(e))return!0}const r=k(t,"[contenteditable]");if(r){const e=(r.getAttribute("contenteditable")||"").toLowerCase();if(""===e||"true"===e||"plaintext-only"===e)return!0}return!1}var N=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:","blob:"]);function L(e,t,n){const r=k(e,"a[href]"),o=(t||"").trim(),i=function(e,t){if(e&&"#"!==e)try{const n=new URL(e,t??("undefined"!=typeof document?document.baseURI:void 0));return N.has(n.protocol)?n.href:void 0}catch{return}}(r?.getAttribute("href"),n);return{kind:o?"selection":i?"link":"default",...o?{selectionText:o}:{},...i?{linkUrl:i}:{}}}function E(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function M(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function T(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function $(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),l=e-i/2;return l<n?n:l+i>r?Math.max(n,r-i):l}function A(e,t,n,r,o,i=!1,l=8){const a=t+o,u=e-o-n,s=u>=l;return i&&s?{left:u,flipped:!0}:a+n<=r-l?{left:a,flipped:!1}:s?{left:u,flipped:!0}:i?{left:l,flipped:!0}:{left:Math.max(l,r-l-n),flipped:!1}}function B(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var R=a(null);function W({children:n,style:o,className:l="",onClose:a,minWidth:u=180,portal:s=!1}){const h=c(null),x=d(),[w,v]=p([]),b=c();m(()=>()=>clearTimeout(b.current),[]);const k=i(),N=f(()=>{const e=()=>clearTimeout(b.current);return{id:x,depth:0,path:w,open:(t,n)=>{e(),v(e=>E(e,t,n))},scheduleClose:t=>{e(),b.current=setTimeout(()=>v(e=>M(e,t)),200)},closeBelow:t=>{e(),v(e=>M(e,t))},cancelClose:e,closeTree:()=>{e(),v([]),a?.()},root:h}},[x,w,a]);m(()=>{if(!a)return;const t=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${x}"]`)||h.current&&!h.current.contains(e.target)&&a()},n=e=>{"Escape"===e.key&&a()};window.addEventListener("pointerdown",t),window.addEventListener("keydown",n);const r=e(a);return()=>{window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",n),r()}},[a,x]),m(()=>{const e=h.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const L=B(),T=/(^|[\s:])!?z-/.test(l),$=/* @__PURE__ */y("div",{ref:h,"data-popup-menu-tree":x,className:`fixed rounded-2xl ${"tight"===L?"py-1":"large"===L?"py-2":"py-1.5"} ${l}`,onContextMenu:e=>{C(e.target)||e.preventDefault()},style:{...T?{}:{zIndex:t.menu},minWidth:u,animation:"popup-in 0.12s ease-out",...r(),...o},children:/* @__PURE__ */y(R.Provider,{value:N,children:n})});return s?k?g($,document.body):null:$}function D(e,t,n,r=!1){const o=B(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":"max(0.25rem, calc(var(--menu-padding-y, 0.5rem) - 0.1rem))";return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 hover:bg-red-50":r?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-blue-50 hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:i,paddingBottom:i}}}var H=u(function({onClick:e,children:t,className:n="",danger:r,disabled:o,role:i,tabIndex:l,id:a,onMouseEnter:u},c){const d=s(R),p=D(r,o,n);/* @__PURE__ */
|
|
2
|
+
return y("button",{ref:c,id:a,role:i,tabIndex:l,onClick:()=>{e?.(),d&&d.depth>0&&d.closeTree()},onMouseEnter:()=>{d?.scheduleClose(d.depth),u?.()},disabled:o,className:p.className,style:p.style,children:t})}),I=/* @__PURE__ */y("svg",{"aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})});function P(e){let n=t.menu;for(let t=e;t&&t!==document.body;t=t.parentElement){const e=parseInt(getComputedStyle(t).zIndex,10);Number.isNaN(e)||(n=e)}return n}function S(e){return e?[...e.querySelectorAll("button:not([disabled])")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function F({label:e,icon:t,children:o,disabled:i,className:a="",minWidth:u=180,maxHeight:p}){const v=s(R),b=d(),k=c(null),N=c(null),L=c(),E=c(!1),M=`${b}-menu`;m(()=>()=>clearTimeout(L.current),[]);const T=v?.depth??0,W=v?.path[T],H=!!W&&W.key===b&&!i,F=h(e=>{if(!v||i||!k.current)return;clearTimeout(L.current),E.current=e;const t=k.current.getBoundingClientRect(),n=k.current.closest("[data-popup-submenu-panel]")??k.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,o=T>0&&(v.path[T-1]?.flipped??!1),l=A(r.left,r.right,u,window.innerWidth,4,o);v.open(T,{key:b,y:t.top,...l})},[v,i,T,b,u]),j=e=>{v?.closeBelow(T),k.current?.focus()};m(()=>{if(H)return n(e=>"Escape"===e.key&&(!(v&&v.path.length>T+1)&&(j(),!0)))}),l(()=>{if(!H||!W)return;const e=()=>{const e=N.current;if(!e||!k.current)return;const t=k.current.closest("[data-popup-submenu-panel]")??k.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??k.current.getBoundingClientRect(),r=T>0&&(v?.path[T-1]?.flipped??!1),o=e.offsetWidth||u,i=A(n.left,n.right,o,window.innerWidth,4,r,8),l=e.offsetHeight,a=$(k.current.getBoundingClientRect().top+l/2,l,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${a}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),m(()=>{H&&E.current&&(E.current=!1,S(N.current)[0]?.focus())},[H]);const z=f(()=>v&&{...v,depth:T+1},[v,T]);if(!v)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const q=D(!1,i,a,H),U=B();/* @__PURE__ */
|
|
3
|
+
return x(w,{children:[
|
|
4
|
+
/* @__PURE__ */x("button",{ref:k,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":H,"aria-controls":H?M:void 0,disabled:i,"data-popup-submenu-row":!0,className:q.className,style:q.style,onClick:e=>{const t=0===e.detail;H?t&&S(N.current)[0]?.focus():F(t)},onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),F(!0))},onMouseEnter:()=>{i||(v.cancelClose(),H?v.closeBelow(T+1):(clearTimeout(L.current),L.current=setTimeout(()=>F(!1),120)))},onMouseLeave:()=>{clearTimeout(L.current),v.scheduleClose(T)},children:[t,
|
|
5
|
+
/* @__PURE__ */y("span",{className:"min-w-0 flex-1 truncate",children:e}),I]}),H&&g(
|
|
6
|
+
/* @__PURE__ */y("div",{ref:N,id:M,role:"menu","data-popup-menu-tree":v.id,"data-popup-submenu-panel":!0,className:"fixed rounded-2xl overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===U?"py-1":"large"===U?"py-2":"py-1.5"),style:{left:W.left,top:W.y,minWidth:u,maxHeight:void 0===p?"calc(100vh - 16px)":`min(${"number"==typeof p?`${p}px`:p}, calc(100vh - 16px))`,zIndex:P(v.root.current)+T+1,animation:(W.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...r()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=S(N.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),j())},onMouseEnter:()=>{v.cancelClose(),clearTimeout(L.current)},onMouseLeave:()=>v.scheduleClose(T+1),onContextMenu:e=>{C(e.target)||e.preventDefault()},children:/* @__PURE__ */y(R.Provider,{value:z,children:o})}),document.body)]})}function j(){const e=B();/* @__PURE__ */
|
|
7
|
+
return y("div",{className:`border-t ${o} ${"tight"===e?"my-0.5":"large"===e?"my-1.5":"my-1"} mx-3`})}function z({children:e}){const t=B(),n="tight"===t?"0.125rem":"large"===t?"0.375rem":"0.25rem";/* @__PURE__ */
|
|
8
|
+
return y("div",{className:"text-xs font-medium uppercase tracking-wide",style:{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:n,paddingBottom:n},children:e})}function q({d:e,className:t="h-4 w-4 text-gray-400"}){/* @__PURE__ */
|
|
9
|
+
return y("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{q as MenuIcon,b as NATIVE_MENU_ATTR,W as PopupMenu,j as PopupMenuDivider,H as PopupMenuItem,z as PopupMenuLabel,F as PopupSubmenu,$ as clampMenuTop,M as closeMenuBelow,L as describeContextTarget,D as itemLook,C as keepsNativeMenu,A as menuPanelLeft,E as openMenuLevel,T as resolveMenuLevels};
|