efficient-shell 4.150.0 → 4.155.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +95 -1
  2. package/dist/{Browser-6DPP4K2O.js → Browser-HNSQP7PK.js} +14 -14
  3. package/dist/Calculator-PWWTNCT7.js +29 -0
  4. package/dist/ConfirmDialog-UVIZK7EY.js +1 -0
  5. package/dist/{CurrencyConverter-KWNYRYOZ.js → CurrencyConverter-OH4WAA74.js} +6 -6
  6. package/dist/{Documents-LDCCZRKT.js → Documents-HG6NJCIB.js} +8 -8
  7. package/dist/{Files-QUAXBRVO.js → Files-22E36TVC.js} +22 -22
  8. package/dist/{Notepad-CYFDC4FM.js → Notepad-YHSWKS4C.js} +11 -11
  9. package/dist/PdfViewer-W65LHKXZ.js +1 -0
  10. package/dist/{PomodoroTimer-EOQDA5J7.js → PomodoroTimer-BXJZKA4W.js} +27 -27
  11. package/dist/{Preview-GZP7YTW3.js → Preview-6X5QAHHR.js} +14 -14
  12. package/dist/Sidebar-44I3DD2U.js +44 -0
  13. package/dist/{Spreadsheet-MXNEADWG.js → Spreadsheet-K6QSHFVS.js} +13 -13
  14. package/dist/{Stock-VVM7GK4C.js → Stock-HGSIZXAT.js} +3 -3
  15. package/dist/{Weather-4LJTQLDL.js → Weather-3VS65TQO.js} +17 -17
  16. package/dist/{WorldClock-AHTVTAI7.js → WorldClock-NI5OTEBV.js} +7 -7
  17. package/dist/apps/index.js +1 -1
  18. package/dist/brand.css +1 -1
  19. package/dist/{chunk-UB22J6EF.js → chunk-4DT7B7GZ.js} +1 -1
  20. package/dist/chunk-6UXY7MPY.js +2 -0
  21. package/dist/{chunk-L2ZO76TC.js → chunk-AC54EYVA.js} +1 -1
  22. package/dist/{chunk-IQVJ3C3D.js → chunk-C47EJ4MB.js} +1 -1
  23. package/dist/chunk-DRRIYS3R.js +113 -0
  24. package/dist/chunk-FEWQDVQJ.js +1 -0
  25. package/dist/chunk-J7LKJIZC.js +9 -0
  26. package/dist/{chunk-FHTLC7HH.js → chunk-JGHRZYNV.js} +1 -1
  27. package/dist/chunk-JHXGBYJO.js +18 -0
  28. package/dist/{chunk-4FS742BM.js → chunk-JLSOLX5J.js} +1 -1
  29. package/dist/{chunk-NPJH5MD7.js → chunk-KZPQW6UL.js} +2 -2
  30. package/dist/chunk-MVLIXV7C.js +2 -0
  31. package/dist/{chunk-SLCR26NK.js → chunk-MXLPLKRG.js} +4 -4
  32. package/dist/{chunk-I55UMU3R.js → chunk-NSXQF4YC.js} +1 -1
  33. package/dist/chunk-O35K6ZWH.js +22 -0
  34. package/dist/chunk-OSJ3ADF2.js +1 -0
  35. package/dist/{chunk-MU5H2CDL.js → chunk-RGFEKAPC.js} +2 -2
  36. package/dist/{chunk-L7TEFXIS.js → chunk-TULPGC2I.js} +15 -15
  37. package/dist/chunk-V73HRX73.js +937 -0
  38. package/dist/{chunk-KKOHUQPF.js → chunk-VGTI3BJ4.js} +1 -1
  39. package/dist/chunk-YIXQGB75.js +1 -0
  40. package/dist/{chunk-TFKB2WEB.js → chunk-ZP2V72LB.js} +7 -7
  41. package/dist/{chunk-V453E4KU.js → chunk-ZTXFXS6V.js} +6 -6
  42. package/dist/{chunk-CVTOZCM3.js → chunk-ZVAQKPRB.js} +11 -11
  43. package/dist/chunk-ZYUWLZUG.js +29 -0
  44. package/dist/file-intake/index.js +1 -1
  45. package/dist/{index-DQ52lM8L.d.ts → index-ak9Cps7c.d.ts} +86 -6
  46. package/dist/index.d.ts +75 -7
  47. package/dist/index.js +645 -638
  48. package/dist/map/index.js +1 -1
  49. package/dist/page-tabs/index.d.ts +2 -0
  50. package/dist/page-tabs/index.js +5 -21
  51. package/dist/pdf/index.js +1 -1
  52. package/dist/themes.css +35 -0
  53. package/dist/ui/index.d.ts +1 -1
  54. package/dist/ui/index.js +1 -1
  55. package/dist/ui.css +61 -0
  56. package/package.json +2 -2
  57. package/dist/Calculator-4CLXMBA4.js +0 -29
  58. package/dist/ConfirmDialog-DUYZA2FE.js +0 -1
  59. package/dist/PdfViewer-ZCT3PYXU.js +0 -1
  60. package/dist/Sidebar-CVF7C6BO.js +0 -23
  61. package/dist/chunk-57MIENLJ.js +0 -1
  62. package/dist/chunk-BJVY3LPW.js +0 -1
  63. package/dist/chunk-ET5HXDOR.js +0 -106
  64. package/dist/chunk-LVDRBRYU.js +0 -1
  65. package/dist/chunk-OCSOMMY2.js +0 -1
  66. package/dist/chunk-QOXIUJTN.js +0 -29
  67. package/dist/chunk-SWU7CXZB.js +0 -954
  68. package/dist/chunk-TR6PLN7W.js +0 -1
  69. package/dist/chunk-UB4JIOLD.js +0 -2
  70. package/dist/chunk-ZBIWNVJS.js +0 -9
@@ -1,106 +0,0 @@
1
- import{isStaleChunkError as e,CMD_Z as t,CMD_SHIFT_Z as n,LoadingSpinner as r,Result as o,useIsMobile as i,useShellPrefs as a}from"./chunk-V453E4KU.js";import{useShellAuth as l,navIcons as s}from"./chunk-UB4JIOLD.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-ZBIWNVJS.js";import{Z_LAYERS as p,confirm as w,runEscapeInterceptors as f}from"./chunk-QOXIUJTN.js";import{useShellStrings as y}from"./chunk-TR6PLN7W.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 T,useReducer as A,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:t,onReload:n}){const r=e(t);/* @__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.":t.message||String(t)})]}),
7
- /* @__PURE__ */D("button",{type:"button",onClick:r?()=>window.location.reload():n,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:r=!1}){const o=b(Z),i=o?.claimOwnMount;if(x(()=>{if(!r&&i)return i(!0),()=>i(!1)},[r,i]),!o||!o.enabled)return null;const{undo:a,redo:l,canUndo:s,canRedo:c,undoLabel:d,redoLabel:u}=o;/* @__PURE__ */
8
- return I("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":r?"shell":"form",children:[
9
- /* @__PURE__ */D("button",{type:"button",onClick:a,disabled:!s,title:s?`Undo ${d} (${t})`:"Nothing to undo",className:ee,children:"Undo"}),
10
- /* @__PURE__ */D("button",{type:"button",onClick:l,disabled:!c,title:c?`Redo ${u} (${n})`:"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(r,{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:i}){if(t||e&&n)/* @__PURE__ */return D(se,{});if(r){const e=re(r);if(401===e)/* @__PURE__ */
13
- return D(o,{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(o,{status:"403",className:le});if(404===e||410===e)/* @__PURE__ */
15
- return D(o,{status:"404",title:"Record not found",className:le});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
- return D(o,{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:i,children:"Try again"}):void 0,className:le})}/* @__PURE__ */
17
- return D(o,{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:t,accentRgb:n}){const{dirty:r,registerDirty:o}=ge(),i=q[e.route];if(!i||!O(i))return null;const a=i,l=a.component;/* @__PURE__ */
18
- return D(Vn,{open:!0,onClose:t,icon:s[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */D(fe.Provider,{value:o,children:/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */D(ae,{})}),children:/* @__PURE__ */D(l,{})})})})}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:t,onMinimize:n,accentRgb:r}){const o=q[e.entityType];if(!o||!H(o))return null;const i=o,[a,l]=E(!1),{dirty:c,registerDirty:d}=ge(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=me(e.entityId),p=!i.selfFetching&&!h&&!m&&X(),w=j({queryKey:[u,e.entityId],queryFn:()=>{return J.get((t=i.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(i.selfFetching||h||m)return;const e=()=>{y()};return window.addEventListener("modal-reorder",e),()=>window.removeEventListener("modal-reorder",e)},[y,i.selfFetching,h,m]);const g=M(()=>{a&&!c?l(!1):t()},[a,c,t]),v=i.selfFetching?e.label:f?i.title(f,a,l):e.label,b=i.icon,x=b?s[b]:null,k=v,L=!i.selfFetching&&f&&i.footer&&!h?i.footer(f):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(ae,{}),children:i.render(f??e.entitySnapshot,t,e.entityId,a,l)}):null!=f?/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(Vn,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */D(se,{})}),children:i.render(f,t,e.entityId,a,l)}):/* @__PURE__ */D(Vn,{open:!0,onClose:t,title:e.label,size:i.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:n,initialBox:e.savedBox,icon:x,title:k,footer:L,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */D(fe.Provider,{value:d,children:/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(se,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,l):/* @__PURE__ */D(ue,{entity:f,isPending:w.isPending,isFetching:w.isFetching,enabled:p,error:w.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,l)})})})})}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 Te="rosh-peek-style";function Ae(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Te))return;const e=document.createElement("style");e.id=Te,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:()=>Ae(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:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=y(),[a,l]=E(null);C(()=>{const e=document.getElementById("taskbar-windows");if(!e){const e=setInterval(()=>{const t=document.getElementById("taskbar-windows");t&&(l(t),clearInterval(e))},100);return()=>clearInterval(e)}l(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),A=k(null),z=()=>{A.current&&(clearTimeout(A.current),A.current=null),A.current=setTimeout(()=>{v(null),x(null)},150)},P=e.filter(e=>!e.route||!q[e.route]?.utility);if(!a||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 n=e.route?s[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(c){const t=document.querySelector(`[data-modal-id="${c}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const l=e.items.length>1,d=e.items.some(e=>{const t=Ee(e.id)??Se(e.label);return!!t&&!on(t)});/* @__PURE__ */
28
- return I("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(M||(A.current&&(clearTimeout(A.current),A.current=null),A.current=setTimeout(()=>{v(n),x(r)},350)));var n,r},onMouseLeave:z,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),A.current&&(clearTimeout(A.current),A.current=null),v(null),x(null),l?N({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-1.5 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&S(n)?T(n,{className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400")}):/* @__PURE__ */D("svg",{className:"h-3.5 w-3.5 shrink-0 "+(a?"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:l?e.label:f(r.label)}),d&&/* @__PURE__ */D("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),l&&/* @__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}),!l&&/* @__PURE__ */D("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */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:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
31
- /* @__PURE__ */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"})}),i.taskbar.minimizeAllWindows]}),
39
- /* @__PURE__ */I(u,{onClick:()=>{N(null),M.items.forEach(e=>o(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"})}),i.taskbar.restoreAllWindows]}),
41
- /* @__PURE__ */D(h,{}),
42
- /* @__PURE__ */I(u,{danger:!0,onClick:()=>{N(null),M.items.forEach(e=>t(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"})}),`${i.taskbar.closeAllWindows} (${M.items.length})`]})]}),g&&b&&/* @__PURE__ */D(Ie,{items:g,anchorEl:b,onActivate:e=>{o(e),v(null),x(null)},onClose:e=>{t(e),v(null),x(null)},onMouseEnter:()=>{A.current&&(clearTimeout(A.current),A.current=null)},onMouseLeave:z})]}),a)}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-DUYZA2FE.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 Tt(){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 At={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 Tn(){Nn(!1)}var An=null,zn=/* @__PURE__ */new Set;function Pn(e){return zn.add(e),()=>zn.delete(e)}function In(){return An}function Dn(e){An!==e&&(An=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:l="lg",dirty:s=!1,onNext:c,onPrev:m,footer:g,bodyScroll:v,onMinimize:A,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=i(),[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:Te}=a(),Ae=!!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}];Te({favorite_documents:e})},[Ne,Pe,ze,Te]),[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)?T(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,[Tt,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),An===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,i=J?J[0]:At[l]||672,a=window.innerWidth-0-r-o-80,s=window.innerHeight-e-80,c=Math.min(i,a),d=It[Pt()],u=J?Math.min(J[1],s):(()=>{const t=("sm"===l?500:"md"===l?600:"lg"===l?700:"xl"===l?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=a-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,(a-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}},[l]),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,[Tn,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||Tn)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,Tn,Y]);const $n=!1!==X&&!H&&!F&&!oe,[Bn,jn]=E(()=>!$n);x(()=>{if(Bn||!e)return;if(!$n||Tn)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,Tn]),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=()=>{Tn?hn(Zt()):document.body.classList.contains("rosh-gesturing")||hn(rn)};window.addEventListener("resize",t);let n=null;return Tn&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),n?.disconnect()}},[e,Tn,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"!==s)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,s]);const On="auto"===s?be:!0===s;ye(!(G||!e)&&On);const Hn=M(async()=>{if(!Re.current){if(On||"auto"===s&&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,s,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(Tn?(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(Tn)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(Tn)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,Tn,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=Tt||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:Tn,onToggleMax:()=>{Tn?(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:Tn,onToggleMax:()=>{Tn?(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&&Ae&&!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:Tt&&/* @__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:Tt?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,Tn?{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:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=A(Un,qn),a=k(/* @__PURE__ */new Map),[s,c]=E(0),d=s>0,[u,h]=E(0),[m,p]=E(0),w=m>0,{hasAnyPerm:f}=l(),y=t&&0===u&&(!(n&&n.length>0)||f(n)),g=k(null),v=k(!1),x=M(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),L=M((e,t)=>{a.current.has(e)||c(e=>e+1),a.current.set(e,t)},[]),S=M(e=>{a.current.delete(e)&&c(e=>e-1)},[]),T=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&&i({type:"record",step:e})})},[y,x]),F=M(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),q=M(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:x(),label:e.label,coalesceKey:null};F(e.values),i({type:"undo",redoStep:t})},[o.past,x,F]),U=M(()=>{const e=o.future[0];if(!e)return;const t={values:x(),label:e.label,coalesceKey:null};F(e.values),i({type:"redo",undoStep:t})},[o.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)&&i({type:"clear"}),H.current=!1,G.current=!1)},[Y]);const re=M(()=>{G.current=!0,i({type:"clear"}),Q()},[Q]),oe=y&&o.past.length>0,ie=y&&o.future.length>0,ae=kn(r),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:T,declaredEditable:w,claimEditable:z,undoLabel:oe?o.past[o.past.length-1].label:null,redoLabel:ie?o.future[0].label:null}),[L,S,V,q,U,re,ne,oe,ie,y,d,$,K,T,w,z,o.past,o.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})}),e]})}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,Tn as exitExposeMode,Tt 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};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1,29 +0,0 @@
1
- import{useShellStrings as e,splitAround as t}from"./chunk-TR6PLN7W.js";import{createContext as n,useEffect as r,useRef as o,useId as i,useContext as l,useState as a,useCallback as s,useLayoutEffect as d}from"react";import{jsxs as c,jsx as u,Fragment as m}from"react/jsx-runtime";var f=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function h(e){return Array.from(e.querySelectorAll(f)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var b=[];function g(e){const t=b.findIndex(t=>t!==e&&e.contains(t));-1===t?b.push(e):b.splice(t,0,e)}function p(e){const t=b.lastIndexOf(e);-1!==t&&b.splice(t,1)}var v=/* @__PURE__ */new WeakSet;function y(e){return h(e)}function x(e,t){r(()=>{if(!t)return;const n=e.current;return n?(v.add(n),g(n),()=>{p(n),v.delete(n)}):void 0},[e,t])}function w(e,t){const n=b.lastIndexOf(t),r=n>0?b[n-1]:-1===n?b[b.length-1]??null:null,o=h(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),i=o.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return i||(r&&!v.has(r)?o[0]??null:null)}function N(e,t,n){r(()=>{if(!t)return;const r=e.current;if(!r)return;const o=document.activeElement,i=n?.current??h(r)[0]??r;i!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),i.focus();const l=e=>{if("Tab"!==e.key)return;if(b[b.length-1]!==r)return;const t=h(r);if(0===t.length)return void e.preventDefault();const n=t[0],o=t[t.length-1],i=document.activeElement;!e.shiftKey||i!==n&&r.contains(i)?e.shiftKey||i!==o&&r.contains(i)||(e.preventDefault(),n.focus()):(e.preventDefault(),o.focus())};return g(r),document.addEventListener("keydown",l,!0),()=>{p(r),document.removeEventListener("keydown",l,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&o?.focus?.()}},[e,t,n])}var k=0,L=null;function C(e){r(()=>{if(!e)return;const t=document.body;if(0===k){L={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return k+=1,()=>{0===(k-=1)&&L&&(t.style.overflow=L.overflow,t.style.paddingRight=L.paddingRight,L=null)}},[e])}var E=/* @__PURE__ */new Set,P=null;function W(e){return E.add(e),function(){if(P||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&j(e)&&(e.preventDefault(),e.stopPropagation())};document.addEventListener("keydown",e,!0),P=()=>document.removeEventListener("keydown",e,!0)}(),()=>{E.delete(e),0===E.size&&P&&(P(),P=null)}}function j(e){const t=Array.from(E);for(let n=t.length-1;n>=0;n--)try{if(t[n](e))return!0}catch{}return!1}var D="react-os-shell:overlay-open";function T(){"undefined"!=typeof window&&window.dispatchEvent(new Event(D))}function F(e){return"undefined"==typeof window?()=>{}:(window.addEventListener(D,e),()=>window.removeEventListener(D,e))}var I="undefined"==typeof document?r:d;function M(e){I(()=>{e&&T()},[e])}var O={window:50,windowStep:10,menu:400,pinnedWindow:999,overlay:9999,popup:1e4},$={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function R({open:t,onClose:n,title:l,description:a,role:s="dialog",children:d,footer:m,blocking:f=!1,size:h="md",initialFocus:b,"aria-label":g,"aria-labelledby":p,"aria-describedby":v,className:y=""}){const x=o(null),w=i(),k=i(),L=!f&&!m,E=i(),P=e().dialog;return M(t),N(x,t,b),C(t),r(()=>{if(t)return W(()=>(f||n(),!0))},[t,f,n]),t?/* @__PURE__ */c("div",{className:"fixed inset-0",style:{zIndex:O.overlay},role:"presentation",children:[
2
- /* @__PURE__ */u("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
3
- /* @__PURE__ */u("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:f?void 0:e=>{e.target===e.currentTarget&&n()},children:/* @__PURE__ */c("div",{ref:x,role:s,"aria-modal":"true","aria-labelledby":l?E:p,"aria-label":l||p?void 0:g,"aria-describedby":v??(a?k:d?w:void 0),className:`relative max-h-full w-full ${$[h]} overflow-y-auto overscroll-contain rounded-lg bg-white p-6 shadow-xl ${y}`.trim(),children:[l&&/* @__PURE__ */u("h2",{id:E,className:(L?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:l}),a&&/* @__PURE__ */u("p",{id:k,className:((l?"mt-1":L?"pr-8":"")+" text-sm text-gray-500").trim(),children:a}),d&&/* @__PURE__ */u("div",{id:w,className:"mt-2 text-sm text-gray-600",children:d}),m&&/* @__PURE__ */u("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:m}),L&&/* @__PURE__ */u("button",{type:"button",onClick:n,"aria-label":P.close,className:"absolute right-3 top-3 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */u("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:/* @__PURE__ */u("path",{d:"M6 6l8 8M14 6l-8 8"})})})]})})]}):null}var z=n(()=>Promise.resolve(!1)),A=()=>l(z),S=()=>Promise.resolve(!1),K=e=>S(e),B=()=>Promise.resolve(!1),_=e=>B(e),q=()=>Promise.resolve(null),G=e=>q(e),H={danger:{icon:"text-red-600 bg-red-100",button:"bg-red-600 hover:bg-red-700 text-white"},warning:{icon:"text-yellow-600 bg-yellow-100",button:"bg-yellow-600 hover:bg-yellow-700 text-white"},info:{icon:"text-blue-600 bg-blue-100",button:"bg-blue-600 hover:bg-blue-700 text-white"}},U="bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50";function V(){/* @__PURE__ */
4
- return u("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */u("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"})})}function J(){/* @__PURE__ */
5
- return u("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function Q({children:n}){const[i,l]=a(!1),[d,f]=a({message:""}),[h,b]=a(0),g=o(),p=o(null),v=o(0),y=o([]),x=o(null),w=o(null),N=s(e=>{p.current=e.id,g.current=e.resolve,b(e.id),f(e.options),l(!0)},[]),k=s(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++v.current,options:t,resolve:e};null===p.current?N(n):y.current.push(n)})},[N]),[L,C]=a(!1),[E,P]=a({message:""}),[W,j]=a(""),D=o(),T=s(e=>(P(e),j(""),C(!0),new Promise(e=>{D.current=e})),[]),[F,I]=a(!1),[M,O]=a({}),[$,A]=a(""),K=o(),_=s(e=>{const t="string"==typeof e?{message:e}:e;return O(t),A(t.defaultValue??""),I(!0),new Promise(e=>{K.current=e})},[]);r(()=>{S=k,B=T,q=_},[k,T,_]);const G=(e,t)=>{if(p.current!==e)return;const n=g.current,r=y.current.shift();r?N(r):(p.current=null,g.current=void 0,l(!1)),n?.(t)},Q=e=>{C(!1),j(""),D.current?.(e)},X=e=>{if(e){const e=$.trim();if(!e&&!M.allowEmpty)return I(!1),void K.current?.(null);I(!1),K.current?.(e)}else I(!1),K.current?.(null)},Y=d.variant||(d.confirmLabel?.toLowerCase().includes("delete")||d.message.toLowerCase().includes("delete")?"danger":"info"),Z=H[Y],ee=H["warning"===E.variant?"warning":"danger"],te=E.confirmWord,ne=null==te||W===te,re=e().dialog,[oe,ie]=t(re.typeToConfirm);/* @__PURE__ */
6
- return c(z.Provider,{value:k,children:[n,
7
- /* @__PURE__ */u(R,{open:i,onClose:()=>G(h,!1),initialFocus:x,footer:/* @__PURE__ */c(m,{children:[
8
- /* @__PURE__ */u("button",{ref:x,type:"button",onClick:()=>G(h,!1),className:U,children:d.cancelLabel||re.cancel}),
9
- /* @__PURE__ */u("button",{type:"button",onClick:()=>G(h,!0),className:`px-4 py-2 text-sm font-medium rounded-lg ${Z.button}`,children:d.confirmLabel||re.ok})]}),children:/* @__PURE__ */c("div",{className:"flex gap-4",children:[
10
- /* @__PURE__ */u("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${Z.icon}`,children:/* @__PURE__ */u(V,{})}),
11
- /* @__PURE__ */c("div",{className:"flex-1",children:[
12
- /* @__PURE__ */u("h2",{className:"text-base font-semibold text-gray-900",children:d.title||re.confirmTitle}),
13
- /* @__PURE__ */u("p",{className:"mt-2 text-sm text-gray-600",children:d.message})]})]})}),
14
- /* @__PURE__ */c(R,{open:L,onClose:()=>Q(!1),initialFocus:null!=te?void 0:w,footer:/* @__PURE__ */c(m,{children:[
15
- /* @__PURE__ */u("button",{ref:w,type:"button",onClick:()=>Q(!1),className:U,children:E.cancelLabel||re.destructiveCancel}),
16
- /* @__PURE__ */u("button",{type:"button",onClick:()=>Q(!0),disabled:!ne,className:`px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40 ${ee.button}`,children:te??E.confirmLabel??re.destructiveConfirm})]}),children:[
17
- /* @__PURE__ */u("button",{type:"button",onClick:()=>Q(!1),"aria-label":re.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */u(J,{})}),
18
- /* @__PURE__ */c("div",{className:"flex gap-4",children:[
19
- /* @__PURE__ */u("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ee.icon}`,children:/* @__PURE__ */u(V,{})}),
20
- /* @__PURE__ */c("div",{className:"flex-1",children:[
21
- /* @__PURE__ */u("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:E.title||re.destructiveTitle}),
22
- /* @__PURE__ */u("p",{className:"mt-2 text-sm text-gray-600",children:E.message}),null!=te&&/* @__PURE__ */c(m,{children:[
23
- /* @__PURE__ */c("p",{className:"mt-3 text-sm text-gray-700",children:[oe,
24
- /* @__PURE__ */u("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-1.5 py-0.5 text-xs font-bold text-red-600 font-mono",children:te}),ie]}),
25
- /* @__PURE__ */u("input",{autoFocus:!0,type:"text",value:W,onChange:e=>j(e.target.value),onKeyDown:e=>{"Enter"===e.key&&W===te&&Q(!0)},placeholder:te,className:"mt-2 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-red-500"})]})]})]})]}),
26
- /* @__PURE__ */c(R,{open:F,onClose:()=>X(!1),title:M.title||re.promptTitle,footer:/* @__PURE__ */c(m,{children:[
27
- /* @__PURE__ */u("button",{type:"button",onClick:()=>X(!1),className:U,children:M.cancelLabel||re.cancel}),
28
- /* @__PURE__ */u("button",{type:"button",onClick:()=>X(!0),disabled:!M.allowEmpty&&!$.trim(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40",children:M.confirmLabel||re.ok})]}),children:[M.message&&/* @__PURE__ */u("p",{className:"text-sm text-gray-600",children:M.message}),
29
- /* @__PURE__ */u("input",{autoFocus:!0,type:"text",value:$,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key?X(!0):"Escape"===e.key&&X(!1)},onFocus:e=>e.target.select(),placeholder:M.placeholder,className:"mt-3 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})]})}export{Q as ConfirmProvider,R as Dialog,D as OVERLAY_OPEN_EVENT,O as Z_LAYERS,K as confirm,_ as confirmDestructive,T as dismissPopups,y as focusableIn,F as onOverlayOpen,G as prompt,W as registerModalEscapeInterceptor,j as runEscapeInterceptors,w as stopAfter,A as useConfirm,M as useDismissPopupsOnOpen,N as useFocusTrap,C as useScrollLock,x as useTabLayer};