efficient-shell 5.1.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +229 -31
  2. package/THIRD_PARTY_NOTICES.md +32 -0
  3. package/dist/{Browser-WUVL7ZSM.js → Browser-6QB2QTO7.js} +18 -18
  4. package/dist/Calculator-KOWRV2VK.js +29 -0
  5. package/dist/ConfirmDialog-32NLLK4K.js +1 -0
  6. package/dist/{CurrencyConverter-LF2WHJW4.js → CurrencyConverter-YJ47A3L5.js} +7 -7
  7. package/dist/{Documents-MB4TJGNY.js → Documents-TGGI2QBV.js} +26 -26
  8. package/dist/Files-KSDK3EO4.js +87 -0
  9. package/dist/{Notepad-UQSG5BE3.js → Notepad-EKB6FJPR.js} +11 -11
  10. package/dist/PdfViewer-KW5B44AX.js +1 -0
  11. package/dist/{PomodoroTimer-XARF7DO3.js → PomodoroTimer-RD5GRRA5.js} +20 -20
  12. package/dist/{Preview-LETK6AJS.js → Preview-AQVXKT2I.js} +32 -32
  13. package/dist/Sidebar-VYXN5YIJ.js +44 -0
  14. package/dist/{Spreadsheet-RCHOM2RE.js → Spreadsheet-INXG5UMI.js} +8 -8
  15. package/dist/{Stock-25FQMI2G.js → Stock-CBQN2IJF.js} +3 -3
  16. package/dist/{Weather-KLQ55R64.js → Weather-2EVUTIXX.js} +16 -16
  17. package/dist/{WorldClock-RMPU7D2M.js → WorldClock-TZUF7MOB.js} +6 -6
  18. package/dist/apps/index.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/brand.css +1 -1
  21. package/dist/{chunk-LTGIQ7HO.js → chunk-3GPU3JOW.js} +14 -14
  22. package/dist/{chunk-DBB4DB7J.js → chunk-3HJTOINK.js} +1 -1
  23. package/dist/{chunk-MDI265RK.js → chunk-4SWPNARR.js} +4 -4
  24. package/dist/{chunk-XUF7VW4U.js → chunk-6LTDJKIL.js} +72 -70
  25. package/dist/chunk-AP2QEJXQ.js +1 -0
  26. package/dist/{chunk-FA6E75W5.js → chunk-CLPJDJH4.js} +1 -1
  27. package/dist/{chunk-2TP4GK53.js → chunk-FROOMUJ7.js} +6 -6
  28. package/dist/{chunk-H5NEXQTX.js → chunk-GG7AE6OC.js} +1 -1
  29. package/dist/{chunk-6TCHOT4R.js → chunk-HRLPFUPB.js} +1 -1
  30. package/dist/{chunk-N3W6PH55.js → chunk-JEM73E4C.js} +11 -11
  31. package/dist/{chunk-P4SGJTK3.js → chunk-JXAAZGLJ.js} +1 -1
  32. package/dist/{chunk-4KLBITSY.js → chunk-KXAUDC3A.js} +28 -28
  33. package/dist/{chunk-TMZVVRTA.js → chunk-L5XA5MLK.js} +43 -43
  34. package/dist/{chunk-5LCZFVE4.js → chunk-MLYC5VQI.js} +2 -2
  35. package/dist/{chunk-HKLW5KTW.js → chunk-N3A3GWJI.js} +8 -8
  36. package/dist/{chunk-LY2G6LHW.js → chunk-PKEQ7XOH.js} +1 -1
  37. package/dist/{chunk-2KTBZE5F.js → chunk-R4XSSHDI.js} +1 -1
  38. package/dist/{chunk-XNHYCOPO.js → chunk-RCHCT7AO.js} +1 -1
  39. package/dist/chunk-RDQ7OXUA.js +1026 -0
  40. package/dist/{chunk-LMIQV3NB.js → chunk-RL626E7Q.js} +2 -2
  41. package/dist/{chunk-ZDF5AR5W.js → chunk-RMJZOKHY.js} +9 -9
  42. package/dist/{chunk-DXNCJBGY.js → chunk-SKB6L53D.js} +11 -11
  43. package/dist/{chunk-JK2KQ4PF.js → chunk-TFETN2GI.js} +1 -1
  44. package/dist/chunk-TNBCUZVE.js +1 -0
  45. package/dist/chunk-WOEFPBQF.js +1 -0
  46. package/dist/chunk-WRBXEZFN.js +1 -0
  47. package/dist/chunk-XWSWYMGM.js +2 -0
  48. package/dist/{chunk-GPNNQIRY.js → chunk-Z2353HNE.js} +5 -5
  49. package/dist/{chunk-VOY6TCS2.js → chunk-ZUCYJAQH.js} +18 -18
  50. package/dist/file-intake/index.js +1 -1
  51. package/dist/format/index.d.ts +1 -1
  52. package/dist/format/index.js +1 -1
  53. package/dist/i18n/index.d.ts +1 -1
  54. package/dist/icons/efficient-looks.d.ts +28 -0
  55. package/dist/icons/efficient-looks.js +920 -0
  56. package/dist/icons/efficient.d.ts +746 -298
  57. package/dist/icons/efficient.js +336 -470
  58. package/dist/icons/heroicons.d.ts +1 -1
  59. package/dist/icons/index.d.ts +10 -4
  60. package/dist/icons/index.js +1 -1
  61. package/dist/icons/lucide.d.ts +1 -1
  62. package/dist/{index-CzMz_Y9A.d.ts → index-BgM75MC6.d.ts} +617 -68
  63. package/dist/{index-DpUDK9zG.d.ts → index-CHufemKB.d.ts} +69 -1
  64. package/dist/index.d.ts +5 -5
  65. package/dist/index.js +504 -504
  66. package/dist/locales/zh-Hans.d.ts +1 -1
  67. package/dist/locales/zh-Hans.js +1 -1
  68. package/dist/map/index.js +5 -5
  69. package/dist/markdown/index.js +1 -1
  70. package/dist/page-tabs/index.js +5 -5
  71. package/dist/pdf/index.js +1 -1
  72. package/dist/{registry-FHdUeVww.d.ts → registry-J-TU7zKx.d.ts} +14 -4
  73. package/dist/{strings-BEuOOURI.d.ts → strings-BVB64Nck.d.ts} +61 -0
  74. package/dist/ui/index.d.ts +4 -4
  75. package/dist/ui/index.js +1 -1
  76. package/dist/ui.css +124 -1
  77. package/package.json +8 -2
  78. package/dist/Calculator-E2CBADVF.js +0 -29
  79. package/dist/ConfirmDialog-ZM364NPI.js +0 -1
  80. package/dist/Files-JQYIBZEP.js +0 -87
  81. package/dist/PdfViewer-4VGNBBED.js +0 -1
  82. package/dist/Sidebar-VR4QYFQU.js +0 -44
  83. package/dist/chunk-3JK2LSFU.js +0 -1
  84. package/dist/chunk-FWOPZB6I.js +0 -1
  85. package/dist/chunk-LOXV3J6X.js +0 -1005
  86. package/dist/chunk-OBMR6BEP.js +0 -1
  87. package/dist/chunk-YKZHOXI4.js +0 -2
@@ -1,34 +1,34 @@
1
- import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as l,widthToFit as s,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-6TCHOT4R.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,LoadingSpinner as p,Result as f,useIsMobile as w,useShellPrefs as y}from"./chunk-2TP4GK53.js";import{Button_default as g}from"./chunk-OGXU7QFW.js";import{confirm as b}from"./chunk-VOY6TCS2.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-ZDF5AR5W.js";import{Z_LAYERS as C,runEscapeInterceptors as M}from"./chunk-X4FJ54PP.js";import{WarningFallback as N,StarFallback as S,BookmarkSquareFallback as L,CheckFallbackB as T,CloseFallback as z,RemoveFallback as A,ExpandFallback as D,WindowFallback as P,ExpandFallbackB as I,GridFallbackC as W,ArrowRightFallbackB as K}from"./chunk-XUF7VW4U.js";import{useShellStrings as O}from"./chunk-3JK2LSFU.js";import{Icon as $}from"./chunk-YKZHOXI4.js";import{createContext as R,useContext as F,Component as q,useLayoutEffect as j,useRef as B,useEffect as H,useState as Y,useSyncExternalStore as U,useCallback as X,isValidElement as V,Fragment as _,Children as J,cloneElement as G,useMemo as Q,useReducer as Z,useId as ee,Suspense as te}from"react";import{jsxs as ne,jsx as re,Fragment as oe}from"react/jsx-runtime";import{createPortal as ie}from"react-dom";import{XMarkIcon as ae}from"@heroicons/react/24/outline";import{useLocation as le}from"react-router-dom";import{useQueryClient as se,useQuery as ce}from"@tanstack/react-query";function de(e){return"component"in e}function ue(e){return"endpoint"in e}var he={};function me(e){he=e}var pe=new Proxy({},{get:(e,t)=>he[t],has:(e,t)=>t in he,ownKeys:()=>Object.keys(he),getOwnPropertyDescriptor(e,t){if(t in he)return{configurable:!0,enumerable:!0,value:he[t]}}}),fe=null;function we(e){fe=e}function ye(){return null!==fe}var ge=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),be=new Proxy({},{get:(e,t)=>fe?fe[t]:"string"==typeof t&&ge.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),ve=R(null);function xe(){return F(ve)?.pageSearch??""}var ke=null,Ee=/* @__PURE__ */new Set;function Ce(e){ke!==e&&(ke=e,Ee.forEach(e=>e()))}function Me(){return ke}function Ne(e){return Ee.add(e),()=>{Ee.delete(e)}}function Se({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
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-FROOMUJ7.js";import{computeMaximizedBox as l,isSidebarStripReserved as s,boxFillsWorkArea as c,readAlwaysMaximizedFlag as d,WORK_AREA_CHANGED_EVENT as u,useShellAuth as h,scrollerIsFluid as m,growBoxToWidth as p,widthToFit as f,navIcons as w}from"./chunk-DSSLOQDW.js";import{Button_default as y}from"./chunk-OGXU7QFW.js";import{CopyButton as g}from"./chunk-HRLPFUPB.js";import{confirm as b}from"./chunk-ZUCYJAQH.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-RMJZOKHY.js";import{Z_LAYERS as C,runEscapeInterceptors as M}from"./chunk-X4FJ54PP.js";import{WarningFallback as N,StarFallback as S,BookmarkSquareFallback as L,CheckFallbackB as T,CloseFallback as z,RemoveFallback as A,ExpandFallback as D,WindowFallback as P,ExpandFallbackB as I,GridFallbackC as K,ArrowRightFallbackB as W}from"./chunk-6LTDJKIL.js";import{useShellStrings as O}from"./chunk-TNBCUZVE.js";import{Icon as $}from"./chunk-XWSWYMGM.js";import{createContext as R,useContext as F,Component as q,useLayoutEffect as j,useRef as B,useEffect as H,useState as Y,useSyncExternalStore as U,useCallback as X,isValidElement as J,Fragment as _,Children as V,cloneElement as G,useMemo as Q,useReducer as Z,useId as ee,Suspense as te}from"react";import{jsxs as ne,jsx as re,Fragment as oe}from"react/jsx-runtime";import{createPortal as ie}from"react-dom";import{XMarkIcon as ae}from"@heroicons/react/24/outline";import{useLocation as le}from"react-router-dom";import{useQueryClient as se,useQuery as ce}from"@tanstack/react-query";function de(e){return"component"in e}function ue(e){return"endpoint"in e}var he={};function me(e){he=e}var pe=new Proxy({},{get:(e,t)=>he[t],has:(e,t)=>t in he,ownKeys:()=>Object.keys(he),getOwnPropertyDescriptor(e,t){if(t in he)return{configurable:!0,enumerable:!0,value:he[t]}}}),fe=null;function we(e){fe=e}function ye(){return null!==fe}var ge=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),be=new Proxy({},{get:(e,t)=>fe?fe[t]:"string"==typeof t&&ge.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),ve=R(null);function xe(){return F(ve)?.pageSearch??""}var ke=null,Ee=/* @__PURE__ */new Set;function Ce(e){ke!==e&&(ke=e,Ee.forEach(e=>e()))}function Me(){return ke}function Ne(e){return Ee.add(e),()=>{Ee.delete(e)}}function Se({error:t,onReload:n}){const r=e(t);/* @__PURE__ */
2
2
  return ne("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
3
  /* @__PURE__ */re($,{name:"warning",fallback:N,className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
4
  /* @__PURE__ */ne("div",{className:"min-w-0",children:[
5
- /* @__PURE__ */re("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
- /* @__PURE__ */re("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
7
- /* @__PURE__ */re("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Le=class extends q{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */re(Se,{error:e,onReload:this.reset}):this.props.children}},Te=R(null),ze="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ae({className:e="",auto:t=!1}){const n=F(Te),r=O().undo,o=n?.claimOwnMount;if(j(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:l,canRedo:s,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
8
- return ne("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
- /* @__PURE__ */re("button",{type:"button",onClick:i,disabled:!l,title:l?r.undoStep(c??"",h):r.nothingToUndo,className:ze,children:r.undo}),
10
- /* @__PURE__ */re("button",{type:"button",onClick:a,disabled:!s,title:s?r.redoStep(d??"",m):r.nothingToRedo,className:ze,children:r.redo})]})}var De=/* @__PURE__ */new Set([408,429]);function Pe(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Ie(e){const t=Pe(e);return null!=t&&(t>=400&&t<500&&!De.has(t))}function We(e,t){return!Ie(t)&&e<3}function Ke(){const e=O().loading;/* @__PURE__ */
5
+ /* @__PURE__ */re("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__ */re("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__ */re("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 Le=class extends q{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */re(Se,{error:e,onReload:this.reset}):this.props.children}},Te=R(null),ze="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ae({className:e="",auto:r=!1}){const o=F(Te),i=O().undo,a=o?.claimOwnMount;if(j(()=>{if(!r&&a)return a(!0),()=>a(!1)},[r,a]),!o||!o.enabled)return null;const{undo:l,redo:s,canUndo:c,canRedo:d,undoLabel:u,redoLabel:h}=o;/* @__PURE__ */
8
+ return ne("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":r?"shell":"form",children:[
9
+ /* @__PURE__ */re("button",{type:"button",onClick:l,disabled:!c,title:c?i.undoStep(u??"",t):i.nothingToUndo,className:ze,children:i.undo}),
10
+ /* @__PURE__ */re("button",{type:"button",onClick:s,disabled:!d,title:d?i.redoStep(h??"",n):i.nothingToRedo,className:ze,children:i.redo})]})}var De=/* @__PURE__ */new Set([408,429]);function Pe(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Ie(e){const t=Pe(e);return null!=t&&(t>=400&&t<500&&!De.has(t))}function Ke(e,t){return!Ie(t)&&e<3}function We(){const e=O().loading;/* @__PURE__ */
11
11
  return re("div",{className:"flex items-center justify-center p-8 text-sm text-gray-400",children:e.label})}var Oe="flex-1 min-h-0";function $e(){const e=O().record;/* @__PURE__ */
12
- return re(p,{label:e.loading,padding:"",className:Oe})}function Re(e){return e??void 0}function Fe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=O().record;if(t||e&&n)/* @__PURE__ */return re($e,{});if(r){const e=Pe(r);if(401===e)/* @__PURE__ */
13
- return re(f,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Oe});if(403===e)/* @__PURE__ */
14
- return re(f,{status:"403",className:Oe});if(404===e||410===e)/* @__PURE__ */
15
- return re(f,{status:"404",title:i.notFound,className:Oe});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
- return re(f,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */re(g,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Oe})}/* @__PURE__ */
17
- return re(f,{status:"404",title:i.notFound,className:Oe})}function qe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */re(oe,{children:t(e)}):/* @__PURE__ */re(Fe,{...n})}var je=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Be(e){return"string"==typeof e&&(e.startsWith("new-")||je.test(e))}function He(e){if(Be(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Ye=R({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ue=R(null);function Xe(e){const t=F(Ue),n=B(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),j(()=>{if(t)return t(n.current,e)},[t,e]),H(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Ve(){const e=B(/* @__PURE__ */new Map),[t,n]=Y(!1);return{dirty:t,registerDirty:X((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function _e(){return F(Ye)}function Je(e){if("page"!==e.type&&He(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Ge({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Ve(),i=pe[e.route];if(!i||!de(i))return null;const a=i,l=a.component;/* @__PURE__ */
18
- return re($r,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */re(Ue.Provider,{value:o,children:/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */re(Ke,{})}),children:/* @__PURE__ */re(l,{})})})})}function Qe({entityType:e,entityId:t,label:n}){const r=O(),o=se(),{data:i}=ce({queryKey:["my-profile-sidebar"],enabled:ye(),queryFn:()=>be.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],l=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
- return re("button",{onClick:()=>{const r=l?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];be.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:l?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(l?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */re($,{name:"star",fallback:S,className:"h-4 w-4",fill:l?"currentColor":"none",strokeWidth:1.5})})}var Ze=/* @__PURE__ */new Set;function et({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=pe[e.entityType];if(!o||!ue(o))return null;const i=o,[a,l]=Y(!1),{dirty:s,registerDirty:d}=Ve(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Be(e.entityId),p=!i.selfFetching&&!h&&!m&&ye(),f=ce({queryKey:[u,e.entityId],queryFn:()=>{return be.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Re(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Ie(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:We}),w=f.data,y=f.refetch;H(()=>{var t;if(p)return t=t=>{t!==e.id||Ze.has(t)||y({cancelRefetch:!1})},jn.add(t),()=>{jn.delete(t)}},[y,e.id,p]);const g=X(()=>{a&&!s?l(!1):t()},[a,s,t]),b=i.selfFetching?e.label:w?i.title(w,a,l):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re(Ke,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,l)}):null!=w?/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re($r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */re($e,{})}),children:i.render(w,t,e.entityId,a,l)}):/* @__PURE__ */re($r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */re(Fe,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */re($r,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:s,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */re(Ue.Provider,{value:d,children:/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re($e,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,l):/* @__PURE__ */re(qe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,l)})})})})}function tt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function nt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function rt(e){const t=tt(e),n=t??nt(e);if(!n)return;if(t&&!er(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Bn(o)}function ot(e){if("page"!==e.type)return!0;const t=e.route?pe[e.route]:void 0;if(!t||!de(t))return!0;const n=t;return!n.widget&&!n.utility}function it(){const e=pr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var at=/* @__PURE__ */new Map;function lt(){const e=it();if(e)return at.get(e)}function st(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var ct="rosh-peek-style";function dt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(ct))return;const e=document.createElement("style");e.id=ct,e.textContent="body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:249!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}",document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function ut(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function ht({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const l=O(),s=B(null),[c,d]=Y({w:n,h:Math.round(.75*r)}),[u,h]=Y(!1);return j(()=>{const o=s.current;if(!o)return;const i=tt(e)??st(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const l=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*l)),u=Math.max(60,Math.round(a.height*l));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${l})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */ne("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-md cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
12
+ return re(r,{label:e.loading,padding:"",className:Oe})}function Re(e){return e??void 0}function Fe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:i}){const a=O().record;if(t||e&&n)/* @__PURE__ */return re($e,{});if(r){const e=Pe(r);if(401===e)/* @__PURE__ */
13
+ return re(o,{status:"warning",title:a.signInRequired,subTitle:a.signInBody,className:Oe});if(403===e)/* @__PURE__ */
14
+ return re(o,{status:"403",className:Oe});if(404===e||410===e)/* @__PURE__ */
15
+ return re(o,{status:"404",title:a.notFound,className:Oe});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
+ return re(o,{status:"500",title:a.loadFailed,subTitle:t?a.checkConnection:a.rejected,extra:t?/* @__PURE__ */re(y,{variant:"secondary",size:"sm",onClick:i,children:a.retry}):void 0,className:Oe})}/* @__PURE__ */
17
+ return re(o,{status:"404",title:a.notFound,className:Oe})}function qe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */re(oe,{children:t(e)}):/* @__PURE__ */re(Fe,{...n})}var je=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Be(e){return"string"==typeof e&&(e.startsWith("new-")||je.test(e))}function He(e){if(Be(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Ye=R({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ue=R(null);function Xe(e){const t=F(Ue),n=B(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),j(()=>{if(t)return t(n.current,e)},[t,e]),H(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Je(){const e=B(/* @__PURE__ */new Map),[t,n]=Y(!1);return{dirty:t,registerDirty:X((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function _e(){return F(Ye)}function Ve(e){if("page"!==e.type&&He(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Ge({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Je(),i=pe[e.route];if(!i||!de(i))return null;const a=i,l=a.component;/* @__PURE__ */
18
+ return re($r,{open:!0,onClose:t,icon:w[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */re(Ue.Provider,{value:o,children:/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */re(We,{})}),children:/* @__PURE__ */re(l,{})})})})}function Qe({entityType:e,entityId:t,label:n}){const r=O(),o=se(),{data:i}=ce({queryKey:["my-profile-sidebar"],enabled:ye(),queryFn:()=>be.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],l=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
+ return re("button",{onClick:()=>{const r=l?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];be.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:l?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(l?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */re($,{name:"star",fallback:S,className:"h-4 w-4",fill:l?"currentColor":"none",strokeWidth:1.5})})}var Ze=/* @__PURE__ */new Set;function et({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=pe[e.entityType];if(!o||!ue(o))return null;const i=o,[a,l]=Y(!1),{dirty:s,registerDirty:c}=Je(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,u=e.entitySnapshot?._duplicate,h=Be(e.entityId),m=!i.selfFetching&&!u&&!h&&ye(),p=ce({queryKey:[d,e.entityId],queryFn:()=>{return be.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Re(e.entitySnapshot),initialDataUpdatedAt:0,enabled:m,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Ie(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Ke}),f=p.data,y=p.refetch;H(()=>{var t;if(m)return t=t=>{t!==e.id||Ze.has(t)||y({cancelRefetch:!1})},jn.add(t),()=>{jn.delete(t)}},[y,e.id,m]);const g=X(()=>{a&&!s?l(!1):t()},[a,s,t]),b=i.selfFetching?e.label:f?i.title(f,a,l):e.label,v=i.icon,x=v?w[v]:null,k=b,E=!i.selfFetching&&f&&i.footer&&!u?i.footer(f):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re(We,{}),children:i.render(f??e.entitySnapshot,t,e.entityId,a,l)}):null!=f?/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re($r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */re($e,{})}),children:i.render(f,t,e.entityId,a,l)}):/* @__PURE__ */re($r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */re(Fe,{isPending:p.isPending,isFetching:p.isFetching,enabled:m,error:p.error,onRetry:y})}):/* @__PURE__ */re($r,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:s,editing:a||h||u,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */re(Ue.Provider,{value:c,children:/* @__PURE__ */re(te,{fallback:/* @__PURE__ */re($e,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,l):/* @__PURE__ */re(qe,{entity:f,isPending:p.isPending,isFetching:p.isFetching,enabled:m,error:p.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,l)})})})})}function tt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function nt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function rt(e){const t=tt(e),n=t??nt(e);if(!n)return;if(t&&!er(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Bn(o)}function ot(e){if("page"!==e.type)return!0;const t=e.route?pe[e.route]:void 0;if(!t||!de(t))return!0;const n=t;return!n.widget&&!n.utility}function it(){const e=pr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var at=/* @__PURE__ */new Map;function lt(){const e=it();if(e)return at.get(e)}function st(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var ct="rosh-peek-style";function dt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(ct))return;const e=document.createElement("style");e.id=ct,e.textContent="body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:249!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}",document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function ut(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function ht({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const l=O(),s=B(null),[c,d]=Y({w:n,h:Math.round(.75*r)}),[u,h]=Y(!1);return j(()=>{const o=s.current;if(!o)return;const i=tt(e)??st(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const l=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*l)),u=Math.max(60,Math.round(a.height*l));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${l})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */ne("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-md cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
20
20
  /* @__PURE__ */re("div",{ref:s,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */ne("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
21
21
  /* @__PURE__ */re($,{name:"window",fallback:P,className:"h-6 w-6",strokeWidth:1.5}),
22
22
  /* @__PURE__ */re("span",{className:"mt-1 text-[10px] uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */re("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-[10px] font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */re("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:l.taskbar.closeWindow,children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-3 w-3",strokeWidth:3})})]})}function mt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=O(),l=e.length>1,s=B(null),[c,d]=Y({left:-9999,top:-9999,ready:!1}),[u,h]=Y(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");j(()=>{const e=s.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),H(()=>ut,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-[11px] font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return ie(
23
- /* @__PURE__ */re("div",{ref:s,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:300,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:l?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ut(),i()},children:e.map(e=>{const t=tt(e.id)??st(e.label),o=t?function(e){if(er(e))return null;const t=e.getBoundingClientRect(),n=Vn(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
23
+ /* @__PURE__ */re("div",{ref:s,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:300,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:l?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ut(),i()},children:e.map(e=>{const t=tt(e.id)??st(e.label),o=t?function(e){if(er(e))return null;const t=e.getBoundingClientRect(),n=Jn(),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
24
  return ne("div",{className:"group flex flex-col items-center",onMouseEnter:()=>dt(t),children:[!m&&/* @__PURE__ */re("span",{className:p,children:e.label}),
25
25
  /* @__PURE__ */re(ht,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */re("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */ne("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-1.5 py-0.5 text-[10px] font-semibold text-white shadow-sm",children:[
26
- /* @__PURE__ */re($,{name:"arrow-right",fallback:K,className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function pt(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function ft({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=O(),[a,l]=Y(null);H(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return l(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const s=U(fr,pr),[,d]=Y(0);H(()=>{const e=()=>d(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=Y(0);H(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=st(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=Y(null),[f,w]=Y(null),[y,g]=Y(null),b=B(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!pe[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?pe[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return ie(
27
- /* @__PURE__ */ne(oe,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(s){const t=document.querySelector(`[data-modal-id="${s}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const l=e.items.length>1,d=e.items.some(e=>{const t=tt(e.id)??st(e.label);return!!t&&!er(t)});/* @__PURE__ */
28
- return ne("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),l?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-1.5 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&V(n)?G(n,{className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400")}):/* @__PURE__ */re($,{name:"expand",fallback:I,className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400"),strokeWidth:2}),
29
- /* @__PURE__ */re("span",{className:"truncate flex-1",children:l?e.label:h(r.label)}),d&&/* @__PURE__ */re("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),l&&/* @__PURE__ */re("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-blue-500/80 text-white text-[10px] font-bold leading-none",children:e.items.length}),!l&&/* @__PURE__ */re("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
26
+ /* @__PURE__ */re($,{name:"arrow-right",fallback:W,className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function pt(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function ft({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=O(),[a,l]=Y(null);H(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return l(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const s=U(fr,pr),[,c]=Y(0);H(()=>{const e=()=>c(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=Y(0);H(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const u=e=>{const t=st(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[h,m]=Y(null),[p,f]=Y(null),[y,g]=Y(null),b=B(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{m(null),f(null)},150)},M=e.filter(e=>!e.route||!pe[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?pe[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return ie(
27
+ /* @__PURE__ */ne(oe,{children:[N.map(e=>{const n=e.route?w[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(s){const t=document.querySelector(`[data-modal-id="${s}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const l=e.items.length>1,c=e.items.some(e=>{const t=tt(e.id)??st(e.label);return!!t&&!er(t)});/* @__PURE__ */
28
+ return ne("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{m(n),f(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),m(null),f(null),l?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-1.5 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&J(n)?G(n,{className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400")}):/* @__PURE__ */re($,{name:"expand",fallback:I,className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400"),strokeWidth:2}),
29
+ /* @__PURE__ */re("span",{className:"truncate flex-1",children:l?e.label:u(r.label)}),c&&/* @__PURE__ */re("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),l&&/* @__PURE__ */re("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-blue-500/80 text-white text-[10px] font-bold leading-none",children:e.items.length}),!l&&/* @__PURE__ */re("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
30
30
  /* @__PURE__ */re("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */ne("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
31
- /* @__PURE__ */re($,{name:"grid",fallback:W,className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */ne(v,{portal:!0,minWidth:200,style:pt(y.x,y.y),onClose:()=>g(null),children:[
31
+ /* @__PURE__ */re($,{name:"grid",fallback:K,className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */ne(v,{portal:!0,minWidth:200,style:pt(y.x,y.y),onClose:()=>g(null),children:[
32
32
  /* @__PURE__ */re(E,{children:y.label}),
33
33
  /* @__PURE__ */ne(x,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=zn.get(e);t&&Hn(t)}(e.id))},children:[
34
34
  /* @__PURE__ */re($,{name:"remove",fallback:A,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
@@ -36,18 +36,18 @@ return ne("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.cu
36
36
  /* @__PURE__ */re("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */re("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
37
37
  /* @__PURE__ */re(k,{}),
38
38
  /* @__PURE__ */ne(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
39
- /* @__PURE__ */re($,{name:"close",fallback:z,className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */re(mt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:C})]}),a)}var wt=["/login","/forgot-password","/reset-password","/force-change-password"];function yt({children:e,windowAccentForRoute:t}){const n=le(),r=wt.some(e=>n.pathname.startsWith(e)),[o,i]=Y([]),a=B(o);j(()=>{a.current=o},[o]);const l=U(Ne,Me,Me),s=B(/* @__PURE__ */new Map),c=e=>{const t=ot(e),n=!!l&&"page"===e.type&&e.route===l,r=e.pageSearch||void 0,o=s.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return s.current.set(e.id,i),i};H(()=>{at.clear();for(const e of o)e.route&&at.set(e.id,e.route)},[o]);const d=X(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=X(e=>{var t;tt(e)||nt(e)?(t=e,window.dispatchEvent(new CustomEvent(wr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=Mn;t&&Ze.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(Nn.get(i)??-1)>a)||Bn(o),t&&Ze.delete(e)},50)},m=X((e,t,n,r,o)=>{if(!pe[e]||!ue(pe[e]))return;const a=`${e}:${t}`,l=it();i(i=>{const s=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return s?(h(s.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Re(n),openedFrom:l}])})},[]),p=X((e,t={})=>{if(!pe[e]||!de(pe[e]))return;const n=pe[e],{reuse:r=!1,background:o=!1,shellOwned:l,search:s}=t,c=e=>{var t;o?(t=e,Wn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=it();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!s&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),s&&i.pageSearch!==s?t.map(e=>e===i?{...e,pageSearch:s}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]})},[u]),f=X(()=>{},[]),w=X(()=>{},[]),y=u,g=u;/* @__PURE__ */
39
+ /* @__PURE__ */re($,{name:"close",fallback:z,className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),h&&p&&/* @__PURE__ */re(mt,{items:h,anchorEl:p,onActivate:e=>{o(e),m(null),f(null)},onClose:e=>{t(e),m(null),f(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:C})]}),a)}var wt=["/login","/forgot-password","/reset-password","/force-change-password"];function yt({children:e,windowAccentForRoute:t}){const n=le(),r=wt.some(e=>n.pathname.startsWith(e)),[o,i]=Y([]),a=B(o);j(()=>{a.current=o},[o]);const l=U(Ne,Me,Me),s=B(/* @__PURE__ */new Map),c=e=>{const t=ot(e),n=!!l&&"page"===e.type&&e.route===l,r=e.pageSearch||void 0,o=s.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return s.current.set(e.id,i),i};H(()=>{at.clear();for(const e of o)e.route&&at.set(e.id,e.route)},[o]);const d=X(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=X(e=>{var t;tt(e)||nt(e)?(t=e,window.dispatchEvent(new CustomEvent(wr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=Mn;t&&Ze.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(Nn.get(i)??-1)>a)||Bn(o),t&&Ze.delete(e)},50)},m=X((e,t,n,r,o)=>{if(!pe[e]||!ue(pe[e]))return;const a=`${e}:${t}`,l=it();i(i=>{const s=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return s?(h(s.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Re(n),openedFrom:l}])})},[]),p=X((e,t={})=>{if(!pe[e]||!de(pe[e]))return;const n=pe[e],{reuse:r=!1,background:o=!1,shellOwned:l,search:s}=t,c=e=>{var t;o?(t=e,Kn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=it();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!s&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),s&&i.pageSearch!==s?t.map(e=>e===i?{...e,pageSearch:s}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]})},[u]),f=X(()=>{},[]),w=X(()=>{},[]),y=u,g=u;/* @__PURE__ */
40
40
  return ne(Ye.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
41
- /* @__PURE__ */re(ft,{openWindows:o,onRemove:u,onSplitView:Kr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&Bn(e)}})},onActivateById:rt}),
41
+ /* @__PURE__ */re(ft,{openWindows:o,onRemove:u,onSplitView:Wr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&Bn(e)}})},onActivateById:rt}),
42
42
  /* @__PURE__ */re(Or,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
43
43
  /* @__PURE__ */
44
- return re(ve.Provider,{value:c(e),children:/* @__PURE__ */re(Le,{fallback:(t,n)=>/* @__PURE__ */re($r,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */re(Se,{error:t,onReload:n})}),children:/* @__PURE__ */re(Bt,{spec:Je(e),children:/* @__PURE__ */re(Yr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */re(Ge,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */re(et,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var gt=null,bt=/* @__PURE__ */new Set;function vt(){return gt}function xt(e){if(gt!==e){gt=e;for(const e of bt)e()}}function kt(e){return bt.add(e),()=>{bt.delete(e)}}var Et=!1,Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Mt=()=>{};function Nt(e){Et=e,Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function St(e,t){Et&&("submenu"===e?Ct.submenus++:Ct.menus++,Ct.menuKey=t)}function Lt(e){if(!Et)return Mt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Et)return;const r=performance.now()-t;"move"===e?Ct.moveMs+=r:Ct.resizeMs+=r}}function Tt(){const e=Ct;return Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var zt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),At=/* @__PURE__ */new Set(["svg"]);function Dt(e){const t=[],n={text:"",accessories:[]};return Pt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Pt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Pt(e,t,n));if(!V(e))return;const r=e;if(r.type!==d)if(r.type!==_){if("string"==typeof r.type){if(At.has(r.type))return;if(!zt.has(r.type))return n.push(" "),J.toArray(r.props.children).forEach(e=>Pt(e,t,n)),void n.push(" ")}t.accessories.push(G(r,{key:`title-part-${t.accessories.length}`}))}else J.toArray(r.props.children).forEach(e=>Pt(e,t,n));else void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text)}var It=/* @__PURE__ */new Map,Wt=/* @__PURE__ */new Set,Kt=0;function Ot(){Kt++,Wt.forEach(e=>e())}function $t(e){return It.get(e)}function Rt(e){return Wt.add(e),()=>{Wt.delete(e)}}function Ft(){return Kt}var qt=R(""),jt=R(null);function Bt({spec:e,children:t}){/* @__PURE__ */
45
- return re(jt.Provider,{value:e,children:t})}var Ht=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Yt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Ut='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Xt(e){return Vt(e).replace(/\s+/g," ").trim()}function Vt(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(Vt).join("");if(V(e)){const t=e,n="string"==typeof t.type?t.type:"";return Ht.has(n)?"":` ${Vt(t.props?.children)} `}return""}function _t(e){const t=F(qt);H(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var Jt={};function Gt(e,t,n){const r=F(qt);H(()=>{if(!r)return;Jt[r]||(Jt[r]=[]);const o={label:e,icon:n,onClick:t};return Jt[r].push(o),()=>{Jt[r]=(Jt[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function Qt({title:e}){const t=B(null);return H(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */re("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Zt(e){}var en=R(null);function tn(){return F(qt)}function nn(){const e=U(fr,pr),t=F(en);return t?.active??(kn.length<=1||null!=e)}function rn({children:e,position:t="right",quiet:n=!1}){const r=F(en),[o,i]=Y(null);return H(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),l=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(l)}},[r,t,n]),o?ie(e,o):null}function on({onClick:e,children:t,className:n}){const r=F(en);/* @__PURE__ */
46
- return re("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-ZM364NPI.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var an="erp_window_positions",ln={};try{const e=localStorage.getItem(an);e&&(ln=JSON.parse(e))}catch{}var sn=null;function cn(){sn&&clearTimeout(sn),sn=setTimeout(()=>{try{localStorage.setItem(an,JSON.stringify(ln))}catch{}},500)}var dn="erp_activation_order",un=[];try{const e=localStorage.getItem(dn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(un=t)}catch{}var hn=null;function mn(){hn&&clearTimeout(hn),hn=setTimeout(()=>{try{localStorage.setItem(dn,JSON.stringify(un))}catch{}},500)}function pn(e,t){ln[e]||(ln[e]=t,cn())}function fn(e){return ln[e]?{...ln[e]}:null}function wn(e,t){ln[e]=t,cn()}function yn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(ln))n(ln[e],r,o)&&(delete ln[e],i=!0);i&&cn()}var gn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},bn=4e3,vn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},xn={small:.8,medium:1,large:1.25,maximized:1.25},kn=[],En=/* @__PURE__ */new Set,Cn=/* @__PURE__ */new Set,Mn=0,Nn=/* @__PURE__ */new Map;var Sn=0;function Ln(){return Sn}function Tn(){Sn++,En.forEach(e=>e())}var zn=/* @__PURE__ */new Map,An=/* @__PURE__ */new Map,Dn=/* @__PURE__ */new Map;function Pn(){for(let e=kn.length-1;e>=0;e--){const t=Dn.get(kn[e]);if(t?.tab)return t.owner}return null}function In(){return U(fr,Pn,()=>null)}var Wn=/* @__PURE__ */new Set;var Kn=null;function On(e){Kn=null,Bn(e)}function $n(e){Kn=e;const t=zn.get(e);t&&On(t)}function Rn(e){Kn===e&&(Kn=null)}function Fn(e,t,n){if(n&&Dn.set(e,n),t)if(zn.set(t,e),An.set(e,t),Wn.delete(t)){kn.unshift(e);const n=un.indexOf(t);-1!==n&&un.splice(n,1),un.unshift(t),mn()}else!function(e,t){const n=un.indexOf(t);if(-1===n)return void kn.push(e);let r=kn.length;for(let e=0;e<kn.length;e++){const t=An.get(kn[e]);if(t&&un.indexOf(t)>n){r=e;break}}kn.splice(r,0,e)}(e,t),-1===un.indexOf(t)&&(un.push(t),mn());else kn.push(e);Tn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Kn===t&&On(e)}function qn(e){return e?Dn.get(e)?.owner??An.get(e)??null:null}var jn=/* @__PURE__ */new Set;function Bn(e){const t=qn(pr()),n=kn.indexOf(e);-1!==n&&kn.splice(n,1),kn.push(e);const o=Dn.get(e);if(o?.root&&o.tab&&r()){const e=kn.filter(e=>{const t=Dn.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)kn.splice(kn.indexOf(t),1),kn.push(t)}Cn.delete(e);const i=An.get(e);if(i){const e=un.indexOf(i);-1!==e&&un.splice(e,1),un.push(i),mn(),Kn&&Kn!==i&&(Kn=null)}Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=qn(pr());a&&a!==t&&jn.forEach(e=>e(a))}function Hn(e){const t=kn.indexOf(e);-1!==t&&kn.splice(t,1),Cn.add(e),Nn.set(e,++Mn);const n=An.get(e);if(n){const e=un.indexOf(n);-1!==e&&(un.splice(e,1),mn())}Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var Yn=/* @__PURE__ */new Set;var Un=8,Xn=32;function Vn(){return e()}var _n=40,Jn=80,Gn=384,Qn=400;function Zn(e,t=Vn()){const n=Math.min(Math.max(e.x,t.x+Jn-e.w),t.x+t.w-Jn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-_n);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function er(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Vn();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function tr(e){const t=Vn(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var nr=null;function rr(e){const t=(nr||((nr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none","z-index: 40","border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(nr)),nr);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function or(){nr&&(nr.style.opacity="0",nr.style.display="none")}var ir=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],ar=350,lr=200;function sr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=Y(!1),l=B(void 0),s=B(void 0);H(()=>()=>{clearTimeout(l.current),clearTimeout(s.current)},[]);const c=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!0),ar)},d=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!1),lr)};/* @__PURE__ */
44
+ return re(ve.Provider,{value:c(e),children:/* @__PURE__ */re(Le,{fallback:(t,n)=>/* @__PURE__ */re($r,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */re(Se,{error:t,onReload:n})}),children:/* @__PURE__ */re(Bt,{spec:Ve(e),children:/* @__PURE__ */re(Yr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */re(Ge,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */re(et,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var gt=null,bt=/* @__PURE__ */new Set;function vt(){return gt}function xt(e){if(gt!==e){gt=e;for(const e of bt)e()}}function kt(e){return bt.add(e),()=>{bt.delete(e)}}var Et=!1,Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Mt=()=>{};function Nt(e){Et=e,Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function St(e,t){Et&&("submenu"===e?Ct.submenus++:Ct.menus++,Ct.menuKey=t)}function Lt(e){if(!Et)return Mt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Et)return;const r=performance.now()-t;"move"===e?Ct.moveMs+=r:Ct.resizeMs+=r}}function Tt(){const e=Ct;return Ct={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var zt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),At=/* @__PURE__ */new Set(["svg"]);function Dt(e){const t=[],n={text:"",accessories:[]};return Pt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Pt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Pt(e,t,n));if(!J(e))return;const r=e;if(r.type!==g)if(r.type!==_){if("string"==typeof r.type){if(At.has(r.type))return;if(!zt.has(r.type))return n.push(" "),V.toArray(r.props.children).forEach(e=>Pt(e,t,n)),void n.push(" ")}t.accessories.push(G(r,{key:`title-part-${t.accessories.length}`}))}else V.toArray(r.props.children).forEach(e=>Pt(e,t,n));else void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text)}var It=/* @__PURE__ */new Map,Kt=/* @__PURE__ */new Set,Wt=0;function Ot(){Wt++,Kt.forEach(e=>e())}function $t(e){return It.get(e)}function Rt(e){return Kt.add(e),()=>{Kt.delete(e)}}function Ft(){return Wt}var qt=R(""),jt=R(null);function Bt({spec:e,children:t}){/* @__PURE__ */
45
+ return re(jt.Provider,{value:e,children:t})}var Ht=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Yt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Ut='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Xt(e){return Jt(e).replace(/\s+/g," ").trim()}function Jt(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(Jt).join("");if(J(e)){const t=e,n="string"==typeof t.type?t.type:"";return Ht.has(n)?"":` ${Jt(t.props?.children)} `}return""}function _t(e){const t=F(qt);H(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var Vt={};function Gt(e,t,n){const r=F(qt);H(()=>{if(!r)return;Vt[r]||(Vt[r]=[]);const o={label:e,icon:n,onClick:t};return Vt[r].push(o),()=>{Vt[r]=(Vt[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function Qt({title:e}){const t=B(null);return H(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */re("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Zt(e){}var en=R(null);function tn(){return F(qt)}function nn(){const e=U(fr,pr),t=F(en);return t?.active??(kn.length<=1||null!=e)}function rn({children:e,position:t="right",quiet:n=!1}){const r=F(en),[o,i]=Y(null);return H(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),l=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(l)}},[r,t,n]),o?ie(e,o):null}function on({onClick:e,children:t,className:n}){const r=F(en);/* @__PURE__ */
46
+ return re("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-32NLLK4K.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var an="erp_window_positions",ln={};try{const e=localStorage.getItem(an);e&&(ln=JSON.parse(e))}catch{}var sn=null;function cn(){sn&&clearTimeout(sn),sn=setTimeout(()=>{try{localStorage.setItem(an,JSON.stringify(ln))}catch{}},500)}var dn="erp_activation_order",un=[];try{const e=localStorage.getItem(dn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(un=t)}catch{}var hn=null;function mn(){hn&&clearTimeout(hn),hn=setTimeout(()=>{try{localStorage.setItem(dn,JSON.stringify(un))}catch{}},500)}function pn(e,t){ln[e]||(ln[e]=t,cn())}function fn(e){return ln[e]?{...ln[e]}:null}function wn(e,t){ln[e]=t,cn()}function yn(){const e=l(),t=s();let n=!1;for(const r of Object.keys(ln))c(ln[r],e,t)&&(delete ln[r],n=!0);n&&cn()}var gn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},bn=4e3,vn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},xn={small:.8,medium:1,large:1.25,maximized:1.25},kn=[],En=/* @__PURE__ */new Set,Cn=/* @__PURE__ */new Set,Mn=0,Nn=/* @__PURE__ */new Map;var Sn=0;function Ln(){return Sn}function Tn(){Sn++,En.forEach(e=>e())}var zn=/* @__PURE__ */new Map,An=/* @__PURE__ */new Map,Dn=/* @__PURE__ */new Map;function Pn(){for(let e=kn.length-1;e>=0;e--){const t=Dn.get(kn[e]);if(t?.tab)return t.owner}return null}function In(){return U(fr,Pn,()=>null)}var Kn=/* @__PURE__ */new Set;var Wn=null;function On(e){Wn=null,Bn(e)}function $n(e){Wn=e;const t=zn.get(e);t&&On(t)}function Rn(e){Wn===e&&(Wn=null)}function Fn(e,t,n){if(n&&Dn.set(e,n),t)if(zn.set(t,e),An.set(e,t),Kn.delete(t)){kn.unshift(e);const n=un.indexOf(t);-1!==n&&un.splice(n,1),un.unshift(t),mn()}else!function(e,t){const n=un.indexOf(t);if(-1===n)return void kn.push(e);let r=kn.length;for(let e=0;e<kn.length;e++){const t=An.get(kn[e]);if(t&&un.indexOf(t)>n){r=e;break}}kn.splice(r,0,e)}(e,t),-1===un.indexOf(t)&&(un.push(t),mn());else kn.push(e);Tn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Wn===t&&On(e)}function qn(e){return e?Dn.get(e)?.owner??An.get(e)??null:null}var jn=/* @__PURE__ */new Set;function Bn(e){const t=qn(pr()),n=kn.indexOf(e);-1!==n&&kn.splice(n,1),kn.push(e);const r=Dn.get(e);if(r?.root&&r.tab&&d()){const e=kn.filter(e=>{const t=Dn.get(e);return!!t&&!t.root&&t.owner===r.owner});for(const t of e)kn.splice(kn.indexOf(t),1),kn.push(t)}Cn.delete(e);const o=An.get(e);if(o){const e=un.indexOf(o);-1!==e&&un.splice(e,1),un.push(o),mn(),Wn&&Wn!==o&&(Wn=null)}Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=qn(pr());i&&i!==t&&jn.forEach(e=>e(i))}function Hn(e){const t=kn.indexOf(e);-1!==t&&kn.splice(t,1),Cn.add(e),Nn.set(e,++Mn);const n=An.get(e);if(n){const e=un.indexOf(n);-1!==e&&(un.splice(e,1),mn())}Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var Yn=/* @__PURE__ */new Set;var Un=8,Xn=32;function Jn(){return l()}var _n=40,Vn=80,Gn=384,Qn=400;function Zn(e,t=Jn()){const n=Math.min(Math.max(e.x,t.x+Vn-e.w),t.x+t.w-Vn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-_n);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function er(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Jn();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function tr(e){const t=Jn(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var nr=null;function rr(e){const t=(nr||((nr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none","z-index: 40","border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(nr)),nr);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function or(){nr&&(nr.style.opacity="0",nr.style.display="none")}var ir=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],ar=350,lr=200;function sr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=Y(!1),l=B(void 0),s=B(void 0);H(()=>()=>{clearTimeout(l.current),clearTimeout(s.current)},[]);const c=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!0),ar)},d=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!1),lr)};/* @__PURE__ */
47
47
  return ne("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
48
- /* @__PURE__ */re("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */re("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(s.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-1.5 shadow-lg",children:ir.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */re("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(s.current),onBlur:d,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */re("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var cr="rosh-gesture-style";var dr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},ur=4;function hr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(cr))return;const e=document.createElement("style");e.id=cr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=Lt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function mr(e){const t=kn.indexOf(e);if(-1===t)return-1;const n=C.window+t*C.windowStep,o=Dn.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of Dn){if(!t.root||t.owner!==o.owner)continue;const n=kn.indexOf(e);-1!==n&&(i=Math.max(i,C.window+n*C.windowStep))}return i>=n?i+2+Math.min(t,7):n}function pr(){return kn[kn.length-1]||null}function fr(e){return En.add(e),()=>{En.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=kn.length-1;e>=0;e--)Yn.has(kn[e])||kn.splice(e,1);un=un.filter(e=>{const t=zn.get(e);return null!=t&&Yn.has(t)}),mn(),Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var wr="modal-close-request";function yr(e){U(fr,Ln);const t=F(en);if(kn.length<=1)return!0;if(e){const t=zn.get(e);if(null!=t)return pr()===t}return t?.active??null!=pr()}var gr=!1,br=/* @__PURE__ */new Set;function vr(e){return br.add(e),()=>br.delete(e)}function xr(){return gr}function kr(e){gr!==e&&(gr=e,br.forEach(e=>e()))}function Er(){kr(!gr)}function Cr(){kr(!1)}var Mr=null,Nr=/* @__PURE__ */new Set;function Sr(e){return Nr.add(e),()=>Nr.delete(e)}function Lr(){return Mr}function Tr(e){Mr!==e&&(Mr=e,Nr.forEach(e=>e()))}var zr=null,Ar=/* @__PURE__ */new Set;function Dr(e){return Ar.add(e),()=>Ar.delete(e)}function Pr(){return zr}function Ir(e){zr!==e&&(zr=e,Ar.forEach(e=>e()))}function Wr(){if(!zr)return void kr(!1);Tr(zr),Ir(null),kr(!1)}function Kr(){kr(!gr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Or(){const e=U(vr,xr),[t,n]=Y(e),[r,o]=Y(e);return H(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?ie(
49
- /* @__PURE__ */re("div",{onMouseDown:e=>{e.stopPropagation(),kr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:2e3,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function $r({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:g,bodyScroll:E,onMinimize:N,initialBox:I,actions:W,actionsLeft:K,editing:R=!1,allowPinOnTop:q,initialPosition:_,widget:J,compact:Z,appStyle:ee,flushBody:te,autoHeight:le,autoMinHeight:se,autoWidth:ce,widgetMenu:de,dimensions:ue,windowKey:he,openedFromKey:me,accentRgb:pe,children:fe}){const we=w(),[ye,ge]=Y(0),[be,xe]=Y(!1),ke=B(null),Ee=B(0);H(()=>{Ee.current=ye},[ye]);const Ce=X(e=>{we&&(ke.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),xt(me??null))},[we,me]),Me=U(kt,vt);H(()=>{if(!be)return;const e=e=>{if(!ke.current)return;const t=e.clientX-ke.current.startX;if(Math.abs(e.clientY-ke.current.startY)>Math.abs(t)+12)return ke.current=null,xe(!1),ge(0),void xt(null);ge(Math.max(0,t))},t=()=>{if(!ke.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ke.current=null,xe(!1),t?(ge(window.innerWidth),setTimeout(()=>{i(),ge(0),xt(null)},180)):(ge(0),xt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[be]);const[Ne,Se]=Y(c),ze=O(),De=ze.window;H(()=>{Se(c)},[c]);const Pe=Q(()=>Xt(Ne).trim()||void 0,[Ne]),[Ie,We]=Y(!1),Ke=B(!1),[Oe,$e]=Y(!1),[Re,Fe]=Y(null),qe=F(jt),je=F(ve),{prefs:Be,save:He}=y(),Ye=!!Be.window_accent_stripe,Ue=Be.favorite_documents||[],Ve=!!qe&&Ue.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),Je=X(()=>{if(!qe)return;const e=Ve?Ue.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Ue,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];He({favorite_documents:e})},[qe,Ve,Ue,He]),[Ge,Qe]=Y(null),[Ze,et]=Y("top-right"===_?"right":"left"),tt=B(!1),nt=B(null);j(()=>{const e=nt.current;e&&(pe?e.style.setProperty("--window-accent-rgb",pe):e.style.removeProperty("--window-accent-rgb"))},[pe]);const rt=B(!1),ot=B(null),it=B(null),at=B(null),[lt,st]=Y(!1),ct=B(null),dt=!!(g||W||K)||lt,ut=F(Te),ht=""!==F(qt),mt=B(null);mt.current=je?{owner:je.key,tab:je.tab,root:!ht}:null;const pt=he||(je&&!ht?je.key:null),ft=!!ut&&!ht&&ut.enabled&&ut.hasState&&(R||ut.declaredEditable)&&!ut.handMounted&&dt&&!J&&!Z&&!ee&&!we,wt=/* @__PURE__ */re($,{name:"window",fallback:P,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),yt=d&&V(d)?G(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??wt,gt=()=>/* @__PURE__ */re("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Fe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:yt}),bt=40,{minimize:Et,items:Ct,restoreIfMinimized:Mt,openWindows:Nt}=_e(),St=B(`modal-${Math.random().toString(36).slice(2,8)}`).current;H(()=>{if(J)return Yn.add(St),()=>{Yn.delete(St)}},[J,St]),H(()=>{const e=e=>{const t=e.detail;t?.id===St&&Se(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[St]);const[Lt,Tt]=Y(C.window),zt=function(e){const t=U(fr,pr);return kn.length<=1||t===e}(St),At=function(e){return U(fr,()=>Cn.has(e))}(St),Pt=U(vr,xr),Wt=U(Sr,Lr),Kt=U(Dr,Pr),$t=!q&&!J,Rt=Pt&&$t,[Ft,Bt]=Y(!1),Ht=Rt&&Kt===St,[Vt,_t]=Y(!1),Gt=Vt&&$t&&Wt===St?"picked":null,Qt=B(Rt);H(()=>{if(Qt.current&&!Rt){_t(!0);const e=setTimeout(()=>{_t(!1),Mr===St&&Tr(null)},700);return Qt.current=Rt,()=>clearTimeout(e)}Qt.current=Rt},[Rt,St]),H(()=>{Rt||Bt(!1)},[Rt]),H(()=>{const e=it.current,t=at.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),H(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&nt.current){const t=nt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=it.current,n=at.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const Zt=B(!1),tn=X(e,[]),nn=X(()=>{const t=e(),n=ue?ue[0]:gn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),l=xn[vn()],s=ue?Math.min(ue[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*l;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(kn.length-1),d=Math.max(bt,(i-s)/2),u=(o-a)/2,m=t.h-bt-s-d;return"top-right"===_?{x:t.x+t.w-a-bt,y:t.y+bt,w:a,h:s}:"top-left"===_?{x:t.x+bt,y:t.y+bt,w:a,h:s}:{x:t.x+Math.max(bt,(o-a)/2+bt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:s}},[h]),rn=B(!1);t||(rn.current=!1);const on=he||u||null;H(()=>{if(!t)return;Fn(St,on,mt.current??void 0),he||Bn(St),Zt.current=!1,Tt(mr(St));const e=()=>{Tt(mr(St))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===he;if(!e.label)return!1;const t=nt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Bn(St),Mn.current)return;const t=Vn(),n=Math.min(Kn.current.w,t.w-40),o=Math.min(Kn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;dn({x:i,y:a,w:n,h:o}),Wn(!1)},i=e=>{const t=e.detail;r(t)&&(Bn(St),Fe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==he)return;Bn(St);const t=Kn.current,n=function(e,t=Vn()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=nt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}dn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=kn.indexOf(e);-1!==t&&(kn.splice(t,1),Tn()),Cn.delete(e),Nn.delete(e),Dn.delete(e);const n=An.get(e);n&&(An.delete(e),zn.delete(n))}(St),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,St,on,tn]);const an=!J&&"maximized"===vn(),[sn,dn]=Y(()=>{if(on&&ln[on]){const e={...ln[on]};return ue&&(e.w=ue[0],le||(e.h=ue[1])),Zn(e)}return I?{x:I.x,y:I.y,w:I.w,h:I.h}:an?tn():nn()}),[un,hn]=Y(()=>!le),[mn,pn]=Y(()=>r()),fn=B(mn),wn=B(null);H(()=>{const e=()=>{const e=r();e!==fn.current&&wn.current?.(e),fn.current=e,pn(e),Tt(mr(St))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[St]);const yn=mn&&!!je?.tab&&!ht&&!J&&!we,En=yn,Mn=B(En);Mn.current=En;const Sn=In(),Ln=mn&&!!je?.tab&&!J&&!we&&!Pt&&Sn!==je.key,[Pn,Wn]=Y(()=>on&&ln[on]||I?En:En||an),Kn=B(sn);Kn.current=sn;const On=B(Pn);j(()=>{On.current=Pn},[Pn]),j(()=>{if(un||yn)return;const e=nt.current,t=ot.current;if(!e||!t)return;const n=se??(J?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const l=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&s.unobserve(a),s.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Kn.current.y)-24),g=w?Math.min(Kn.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,dn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),J||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;l(),o===e&&hn(!0)},160)))},s=new ResizeObserver(l);l(),ct.current&&s.observe(ct.current);const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[un,J,se,dt,yn]),j(()=>{if(!le||!un||J||!t)return;const e=ct.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||Pn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=se??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,l=Math.max(i,window.innerHeight-a-Math.max(0,Kn.current.y)-24);dn(e=>({...e,h:Math.min(Math.max(i,e.h+r),l)}))});return r.observe(e),()=>r.disconnect()},[le,un,J,t,Pn,se]);const $n=!1!==ce&&!J&&!ee&&!we,[Rn,qn]=Y(()=>!$n);j(()=>{if(Rn||!t)return;if(!$n||Pn)return void qn(!0);const n=nt.current,r=ot.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Kn.current.w,c=0;const d=()=>qn(!0),u=()=>{c=0;const t=Kn.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),h=u.w-80;if(t.w>=h)return void d();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=l(t,s(t.w,w,g),u,bt);b!==t&&(i=b.w,dn(b))};u();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(u))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(d,bn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Rn,t,$n,Pn]);const jn=B(null),_n=!(!je?.tab||ht||J||we);wn.current=t=>{if(!_n)return;if(t)return jn.current||(jn.current={box:{...Kn.current},maximized:On.current}),void(On.current=!0);const r=jn.current;jn.current=null;const o=e();if(r?.maximized)return On.current=!0,Wn(!0),void dn(o);const i=r?.box??(on?ln[on]:void 0);if(On.current=!1,Wn(!1),i&&!n(i,o,!1)){const e={...i};ue&&(e.w=ue[0],le||(e.h=ue[1])),dn(Zn(e))}else dn(nn())},H(()=>{En&&(On.current=!0,Wn(!0),dn(tn()))},[En,tn]),H(()=>{if(J)return;const e=()=>{const e=on?ln[on]:void 0;if(On.current=!1,Wn(!1),e){const t={...e};ue&&(t.w=ue[0],le||(t.h=ue[1])),dn(Zn(t))}else dn(nn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[J,nn,on]),H(()=>{t&&on&&!yn&&(ln[on]=sn,cn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[sn,t,on,yn]),H(()=>{if(!t)return;const e=()=>{On.current?dn(tn()):document.body.classList.contains("rosh-gesturing")||dn(Zn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Pn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,Pn,tn]),H(()=>{if(t&&(We(!1),Ke.current=!1,tt.current=!1,qn(!$n),!Mn.current)){if(on&&ln[on]){const e=ln[on];return void dn(t=>Zn({...e,...le?{h:t.h}:{},...$n?{x:t.x,w:t.w}:{}}))}I&&(dn({x:I.x,y:I.y,w:I.w,h:I.h}),Wn(I.maximized))}},[t]),H(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{nt.current?.contains(t.target)&&!Ke.current&&(Ke.current=!0,e=setTimeout(()=>We(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const Jn="auto"===m?Ie:!0===m,er=je&&!ht?je.key:null,nr=Q(()=>Dt(Ne),[Ne]),ir=B({shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:Je,taskbarStrings:ze.taskbar});j(()=>{ir.current={shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:Je,taskbarStrings:ze.taskbar}});const ar=B(null);ar.current||(ar.current={open:(e,t)=>Fe({x:e,y:t}),items:()=>{const e=ir.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Jt[St]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),H(()=>{t&&er&&function(e,t){const n=It.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(It.set(e,t),Ot())}(er,{title:nr.text||Pe,dirty:Jn,copy:nr.copy,menu:ar.current??void 0})},[t,er,Pe,Jn,nr.text,nr.copy]),H(()=>{if(t&&er)return()=>{return e=er,void(It.delete(e)&&Ot());var e}},[t,er]),Xe(!(he||!t)&&Jn);const lr=X(async()=>{if(!tt.current){if(Jn||"auto"===m&&Ke.current){tt.current=!0;const e=Pe,t=await b({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(tt.current=!1,!t)return}i()}},[Jn,m,i,Pe]);j(()=>{if(!t||!pt)return;const e=e=>{e.detail?.windowKey===pt&&lr()};return window.addEventListener(wr,e),()=>window.removeEventListener(wr,e)},[t,pt,lr]);const cr=B(null),yr=X(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Fe(null),Bn(St),Mn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=nt.current,l=a?.getBoundingClientRect();let s,c,d,u;if(cr.current){const t=cr.current;cr.current=null,u=t.w,d=t.h;const n=l?Math.min(Math.max(20,e.clientX-l.left),t.w-20):t.w/2;s=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${s}px`,a.style.top=`${c}px`)}else s=l?l.left:Kn.current.x,c=l?l.top:Kn.current.y,d=l?l.height:Kn.current.h,u=l?l.width:Kn.current.w;Wn(!1),dn(e=>({...e,x:s,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<ur&&Math.abs(e.clientY-i)<ur)return;r=hr(t,n,"move","move"),a&&(a.style.transition="none")}const l=s+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${l-s}px, ${d-c}px)`),Kn.current={...Kn.current,x:l,y:d},!J){const t=function(e,t){const n=Vn(),r=e<=n.x+Un,o=e>=n.x+n.w-Un,i=t<=n.y+Un,a=t>=n.y+n.h-Un,l=e<=n.x+Xn,s=e>=n.x+n.w-Xn,c=t<=n.y+Xn,d=t>=n.y+n.h-Xn;return i&&l?"tl":i&&s?"tr":a&&l?"bl":a&&s?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?rr(tr(t)):or())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),or();const e=Zn({...Kn.current});if(Kn.current=e,!J&&h){cr.current={x:s,y:c,w:u,h:d};const e=tr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void dn(e)}if(J){const t=e.x+e.w/2,n=window.innerWidth/2;et(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),dn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),gr=X((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,l=nt.current,s=l?.getBoundingClientRect(),c=s?s.left:Kn.current.x,d=s?s.top:Kn.current.y,u=s?s.width:Kn.current.w,h=s?s.height:Kn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Wn(!1),dn({x:c,y:d,w:u,h:h}),Kn.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Kn.current=e,l&&(l.style.left=`${e.x}px`,l.style.top=`${e.y}px`,l.style.width=`${e.w}px`,l.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<ur&&Math.abs(e.clientY-a)<ur)return;o=hr(n,r,dr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Gn,u+e)),w&&(i=Math.max(Qn,h+t)),m){const t=Math.max(Gn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(Qn,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),dn({...Kn.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),br=X(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Bn(St),"Enter"===e.key)return void(Pn?(Wn(!1),dn(nn())):(Wn(!0),dn(tn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{cr.current||(cr.current={...Kn.current})};if(r<0)return e(),Wn(!0),void dn(tn());if(r>0){if(Pn)return Wn(!1),void dn(nn());if(cr.current){const e=Zn(cr.current);return cr.current=null,Kn.current=e,void dn(e)}return void Hn(St)}e(),Wn(!1);const t=tr(n<0?"left":"right");return Kn.current=t,void dn(t)}if(Pn)return;const o=Kn.current,i=e.shiftKey?{...o,w:Math.max(Gn,o.w+24*n),h:Math.max(Qn,o.h+24*r)}:Zn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Kn.current=i,dn(i)},[St,Pn,nn,tn]),Er=X(e=>{cr.current||(cr.current={...Kn.current}),Wn(!1);const t=tr(e);Kn.current=t,dn(t),Bn(St)},[St]),Cr=En||Rt?{}:{tabIndex:0,role:"group","aria-label":Pe?`${Pe} — ${De.windowSuffix}`:De.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:br},Nr=()=>{Wn(!0),dn(tn())},zr=X(()=>{const e=nt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Yt);t&&!t.disabled&&t.click()}},[]);H(()=>{if(!t)return;if(J)return;const e=e=>{if(kn[kn.length-1]===St&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),zr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&nt.current?.contains(t)))return;if(t.closest(Ut))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,zr,St,J]),H(()=>{if(!t)return;const e=e=>{kn[kn.length-1]===St&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:St}})),Ke.current=!1,We(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:St}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),H(()=>{if(!t)return;if(J)return;const e=e=>{if("Escape"===e.key&&kn[kn.length-1]===St){if(M(e))return e.preventDefault(),void e.stopPropagation();if(yn&&!R)return;e.preventDefault(),e.stopPropagation(),lr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,lr,St,J,yn,R]);const Ar=t&&(void 0!==p||void 0!==f),Ir=X(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-[9999] bg-gray-900 text-white px-5 py-2.5 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(H(()=>{if(!t)return;const e=e=>{if(kn[kn.length-1]!==St)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Ar&&(e.preventDefault(),p?p():Ir("bottom")),"k"===e.key&&Ar&&(e.preventDefault(),f?f():Ir("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Ar,Ir,St]),!t||rn.current)return null;const Wr=Rt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),l=n%o,s=r-o*(i-1),c=a===i-1&&s<o,d=Vn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-s)*(u+20)/2:0;return{x:d.x+20+l*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(St):null,Kr=Rt&&Wr?Math.min(Wr.w/sn.w,Wr.h/sn.h):1,Or=(()=>{if(Rt&&Wr){const e=Kr,t=sn.w*e,n=sn.h*e,r=Wr.x+(Wr.w-t)/2-sn.x,o=Wr.y+(Wr.h-n)/2-sn.y,i=Ft||Ht;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:i?2020:2010,boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Vt&&$t){const e="picked"===Gt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:2030}:{}}}return null})(),$r=/* @__PURE__ */ne("div",{children:[
50
- /* @__PURE__ */ne("div",{ref:nt,"data-modal-panel":!0,"data-modal-id":St,"data-window-key":he||void 0,...q?{"data-utility":""}:{},...Oe?{"data-pinned-top":""}:{},...J?{"data-widget":""}:{},...je?{"data-window-owner":je.key}:{},...je&&!ht?{"data-window-root":""}:{},...yn?{"data-window-tab":""}:{},className:yn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(J?zt?"shadow-2xl":"shadow-lg":"border "+(zt?"shadow-2xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(rt.current=!1,Rt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Tr(St),kr(!1),void Bn(St)}if(!zt&&!J&&!Oe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===nt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),rt.current=!0,Fe(null),Bn(St),window.addEventListener("mouseup",()=>{setTimeout(()=>{rt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{rt.current&&(rt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Rt)return;Fe(null);e.target.closest("[data-modal-panel]")===nt.current&&(e.target.closest("button, input, a, select, textarea")||Bn(St))},style:we?{zIndex:Lt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ye}px)`,transition:be?"none":"transform 180ms ease-out",...J?{display:"none"}:{},...Lt<0?{display:"none"}:{},...zt||Oe||Me&&he===Me?{}:{display:"none"}}:{zIndex:Oe?C.pinnedWindow:Lt+1,width:sn.w,height:sn.h,top:sn.y,...J&&"right"===Ze?{right:window.innerWidth-sn.x-sn.w}:{left:sn.x},...Lt<0&&!Oe?{display:"none"}:{},...Ln?{visibility:"hidden",pointerEvents:"none"}:{},...Or??{}},children:[we&&!J&&/* @__PURE__ */re("div",{onPointerDown:Ce,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),J?null:yn?je?.home?null:/* @__PURE__ */ne(oe,{children:[
48
+ /* @__PURE__ */re("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */re("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(s.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-1.5 shadow-lg",children:ir.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */re("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(s.current),onBlur:d,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */re("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var cr="rosh-gesture-style";var dr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},ur=4;function hr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(cr))return;const e=document.createElement("style");e.id=cr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=Lt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function mr(e){const t=kn.indexOf(e);if(-1===t)return-1;const n=C.window+t*C.windowStep,r=Dn.get(e);if(!r||r.root||!r.tab||!d())return n;let o=-1;for(const[e,t]of Dn){if(!t.root||t.owner!==r.owner)continue;const n=kn.indexOf(e);-1!==n&&(o=Math.max(o,C.window+n*C.windowStep))}return o>=n?o+2+Math.min(t,7):n}function pr(){return kn[kn.length-1]||null}function fr(e){return En.add(e),()=>{En.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=kn.length-1;e>=0;e--)Yn.has(kn[e])||kn.splice(e,1);un=un.filter(e=>{const t=zn.get(e);return null!=t&&Yn.has(t)}),mn(),Tn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var wr="modal-close-request";function yr(e){U(fr,Ln);const t=F(en);if(kn.length<=1)return!0;if(e){const t=zn.get(e);if(null!=t)return pr()===t}return t?.active??null!=pr()}var gr=!1,br=/* @__PURE__ */new Set;function vr(e){return br.add(e),()=>br.delete(e)}function xr(){return gr}function kr(e){gr!==e&&(gr=e,br.forEach(e=>e()))}function Er(){kr(!gr)}function Cr(){kr(!1)}var Mr=null,Nr=/* @__PURE__ */new Set;function Sr(e){return Nr.add(e),()=>Nr.delete(e)}function Lr(){return Mr}function Tr(e){Mr!==e&&(Mr=e,Nr.forEach(e=>e()))}var zr=null,Ar=/* @__PURE__ */new Set;function Dr(e){return Ar.add(e),()=>Ar.delete(e)}function Pr(){return zr}function Ir(e){zr!==e&&(zr=e,Ar.forEach(e=>e()))}function Kr(){if(!zr)return void kr(!1);Tr(zr),Ir(null),kr(!1)}function Wr(){kr(!gr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Or(){const e=U(vr,xr),[t,n]=Y(e),[r,o]=Y(e);return H(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?ie(
49
+ /* @__PURE__ */re("div",{onMouseDown:e=>{e.stopPropagation(),kr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:2e3,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function $r({open:e,onClose:t,title:n,icon:r,copyText:o,size:s="lg",dirty:h=!1,onNext:w,onPrev:y,footer:g,bodyScroll:E,onMinimize:N,initialBox:I,actions:K,actionsLeft:W,editing:R=!1,allowPinOnTop:q,initialPosition:_,widget:V,compact:Z,appStyle:ee,flushBody:te,autoHeight:le,autoMinHeight:se,autoWidth:ce,widgetMenu:de,dimensions:ue,windowKey:he,openedFromKey:me,accentRgb:pe,children:fe}){const we=i(),[ye,ge]=Y(0),[be,xe]=Y(!1),ke=B(null),Ee=B(0);H(()=>{Ee.current=ye},[ye]);const Ce=X(e=>{we&&(ke.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),xt(me??null))},[we,me]),Me=U(kt,vt);H(()=>{if(!be)return;const e=e=>{if(!ke.current)return;const t=e.clientX-ke.current.startX;if(Math.abs(e.clientY-ke.current.startY)>Math.abs(t)+12)return ke.current=null,xe(!1),ge(0),void xt(null);ge(Math.max(0,t))},n=()=>{if(!ke.current)return;const e=.3*window.innerWidth,n=Ee.current>e;ke.current=null,xe(!1),n?(ge(window.innerWidth),setTimeout(()=>{t(),ge(0),xt(null)},180)):(ge(0),xt(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)}},[be]);const[Ne,Se]=Y(n),ze=O(),De=ze.window;H(()=>{Se(n)},[n]);const Pe=Q(()=>Xt(Ne).trim()||void 0,[Ne]),[Ie,Ke]=Y(!1),We=B(!1),[Oe,$e]=Y(!1),[Re,Fe]=Y(null),qe=F(jt),je=F(ve),{prefs:Be,save:He}=a(),Ye=!!Be.window_accent_stripe,Ue=Be.favorite_documents||[],Je=!!qe&&Ue.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),Ve=X(()=>{if(!qe)return;const e=Je?Ue.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Ue,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];He({favorite_documents:e})},[qe,Je,Ue,He]),[Ge,Qe]=Y(null),[Ze,et]=Y("top-right"===_?"right":"left"),tt=B(!1),nt=B(null);j(()=>{const e=nt.current;e&&(pe?e.style.setProperty("--window-accent-rgb",pe):e.style.removeProperty("--window-accent-rgb"))},[pe]);const rt=B(!1),ot=B(null),it=B(null),at=B(null),[lt,st]=Y(!1),ct=B(null),dt=!!(g||K||W)||lt,ut=F(Te),ht=""!==F(qt),mt=B(null);mt.current=je?{owner:je.key,tab:je.tab,root:!ht}:null;const pt=he||(je&&!ht?je.key:null),ft=!!ut&&!ht&&ut.enabled&&ut.hasState&&(R||ut.declaredEditable)&&!ut.handMounted&&dt&&!V&&!Z&&!ee&&!we,wt=/* @__PURE__ */re($,{name:"window",fallback:P,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),yt=r&&J(r)?G(r,{className:`h-4 w-4 ${r.props?.className??""}`.trim()}):r??wt,gt=()=>/* @__PURE__ */re("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Fe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:yt}),bt=40,{minimize:Et,items:Ct,restoreIfMinimized:Mt,openWindows:Nt}=_e(),St=B(`modal-${Math.random().toString(36).slice(2,8)}`).current;H(()=>{if(V)return Yn.add(St),()=>{Yn.delete(St)}},[V,St]),H(()=>{const e=e=>{const t=e.detail;t?.id===St&&Se(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[St]);const[Lt,Tt]=Y(C.window),zt=function(e){const t=U(fr,pr);return kn.length<=1||t===e}(St),At=function(e){return U(fr,()=>Cn.has(e))}(St),Pt=U(vr,xr),Kt=U(Sr,Lr),Wt=U(Dr,Pr),$t=!q&&!V,Rt=Pt&&$t,[Ft,Bt]=Y(!1),Ht=Rt&&Wt===St,[Jt,_t]=Y(!1),Gt=Jt&&$t&&Kt===St?"picked":null,Qt=B(Rt);H(()=>{if(Qt.current&&!Rt){_t(!0);const e=setTimeout(()=>{_t(!1),Mr===St&&Tr(null)},700);return Qt.current=Rt,()=>clearTimeout(e)}Qt.current=Rt},[Rt,St]),H(()=>{Rt||Bt(!1)},[Rt]),H(()=>{const e=it.current,t=at.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[e]),H(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&nt.current){const t=nt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=it.current,n=at.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[e]);const Zt=B(!1),tn=X(l,[]),nn=X(()=>{const e=l(),t=ue?ue[0]:gn[s]||672,n=e.w-80,r=e.h-80,o=Math.min(t,n),i=xn[vn()],a=ue?Math.min(ue[1],r):(()=>{const t=("sm"===s?500:"md"===s?600:"lg"===s?700:"xl"===s?800:920)*i;return Math.max(320,Math.min(t,e.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||d()?0:30*(kn.length-1),u=Math.max(bt,(r-a)/2),h=(n-o)/2,m=e.h-bt-a-u;return"top-right"===_?{x:e.x+e.w-o-bt,y:e.y+bt,w:o,h:a}:"top-left"===_?{x:e.x+bt,y:e.y+bt,w:o,h:a}:{x:e.x+Math.max(bt,(n-o)/2+bt)+Math.min(c,Math.max(0,h)),y:e.y+u+Math.min(c,Math.max(0,m)),w:o,h:a}},[s]),rn=B(!1);e||(rn.current=!1);const on=he||o||null;H(()=>{if(!e)return;Fn(St,on,mt.current??void 0),he||Bn(St),Zt.current=!1,Tt(mr(St));const t=()=>{Tt(mr(St))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===he;if(!e.label)return!1;const t=nt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Bn(St),Mn.current)return;const t=Jn(),n=Math.min(Wn.current.w,t.w-40),o=Math.min(Wn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;dn({x:i,y:a,w:n,h:o}),Kn(!1)},i=e=>{const t=e.detail;r(t)&&(Bn(St),Fe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==he)return;Bn(St);const t=Wn.current,n=function(e,t=Jn()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=nt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}dn(n)};return window.addEventListener("modal-reorder",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=kn.indexOf(e);-1!==t&&(kn.splice(t,1),Tn()),Cn.delete(e),Nn.delete(e),Dn.delete(e);const n=An.get(e);n&&(An.delete(e),zn.delete(n))}(St),window.removeEventListener("modal-reorder",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,St,on,tn]);const an=!V&&"maximized"===vn(),[sn,dn]=Y(()=>{if(on&&ln[on]){const e={...ln[on]};return ue&&(e.w=ue[0],le||(e.h=ue[1])),Zn(e)}return I?{x:I.x,y:I.y,w:I.w,h:I.h}:an?tn():nn()}),[un,hn]=Y(()=>!le),[mn,pn]=Y(()=>d()),fn=B(mn),wn=B(null);H(()=>{const e=()=>{const e=d();e!==fn.current&&wn.current?.(e),fn.current=e,pn(e),Tt(mr(St))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[St]);const yn=mn&&!!je?.tab&&!ht&&!V&&!we,En=yn,Mn=B(En);Mn.current=En;const Sn=In(),Ln=mn&&!!je?.tab&&!V&&!we&&!Pt&&Sn!==je.key,[Pn,Kn]=Y(()=>on&&ln[on]||I?En:En||an),Wn=B(sn);Wn.current=sn;const On=B(Pn);j(()=>{On.current=Pn},[Pn]),j(()=>{if(un||yn)return;const e=nt.current,t=ot.current;if(!e||!t)return;const n=se??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const l=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&s.unobserve(a),s.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Wn.current.y)-24),g=w?Math.min(Wn.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,dn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;l(),o===e&&hn(!0)},160)))},s=new ResizeObserver(l);l(),ct.current&&s.observe(ct.current);const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[un,V,se,dt,yn]),j(()=>{if(!le||!un||V||!e)return;const t=ct.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||Pn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=se??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,l=Math.max(i,window.innerHeight-a-Math.max(0,Wn.current.y)-24);dn(e=>({...e,h:Math.min(Math.max(i,e.h+r),l)}))});return r.observe(t),()=>r.disconnect()},[le,un,V,e,Pn,se]);const $n=!1!==ce&&!V&&!ee&&!we,[Rn,qn]=Y(()=>!$n);j(()=>{if(Rn||!e)return;if(!$n||Pn)return void qn(!0);const t=nt.current,n=ot.current;if(!t||!n)return;const r=/* @__PURE__ */new WeakSet;let o=Wn.current.w,i=0;const a=()=>qn(!0),s=()=>{i=0;const e=Wn.current;if(Math.abs(e.w-o)>1||document.body.classList.contains("rosh-gesturing"))return void a();const s=l(),c=s.w-80;if(e.w>=c)return void a();const d=[],u=[];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||(d.push(e),u.push(t))}if(!d.length)return;const h=Math.min(c,e.w+Math.max(...u)),w=h-e.w,y=t.style.width;t.style.width=`${h}px`;const g=d.map((e,t)=>({over:u[t],residual:e.scrollWidth-e.clientWidth}));t.style.width=y,g.forEach((e,t)=>{m(e,w)||r.add(d[t])});const b=p(e,f(e.w,w,g),s,bt);b!==e&&(o=b.w,dn(b))};s();const c=new MutationObserver(()=>{i||(i=requestAnimationFrame(s))});c.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const d=setTimeout(a,bn);return()=>{c.disconnect(),i&&cancelAnimationFrame(i),clearTimeout(d)}},[Rn,e,$n,Pn]);const jn=B(null),_n=!(!je?.tab||ht||V||we);wn.current=e=>{if(!_n)return;if(e)return jn.current||(jn.current={box:{...Wn.current},maximized:On.current}),void(On.current=!0);const t=jn.current;jn.current=null;const n=l();if(t?.maximized)return On.current=!0,Kn(!0),void dn(n);const r=t?.box??(on?ln[on]:void 0);if(On.current=!1,Kn(!1),r&&!c(r,n,!1)){const e={...r};ue&&(e.w=ue[0],le||(e.h=ue[1])),dn(Zn(e))}else dn(nn())},H(()=>{En&&(On.current=!0,Kn(!0),dn(tn()))},[En,tn]),H(()=>{if(V)return;const e=()=>{const e=on?ln[on]:void 0;if(On.current=!1,Kn(!1),e){const t={...e};ue&&(t.w=ue[0],le||(t.h=ue[1])),dn(Zn(t))}else dn(nn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,nn,on]),H(()=>{e&&on&&!yn&&(ln[on]=sn,cn()),e&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[sn,e,on,yn]),H(()=>{if(!e)return;const t=()=>{On.current?dn(tn()):document.body.classList.contains("rosh-gesturing")||dn(Zn)};window.addEventListener("resize",t),window.addEventListener(u,t);let n=null;return Pn&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),window.removeEventListener(u,t),n?.disconnect()}},[e,Pn,tn]),H(()=>{if(e&&(Ke(!1),We.current=!1,tt.current=!1,qn(!$n),!Mn.current)){if(on&&ln[on]){const e=ln[on];return void dn(t=>Zn({...e,...le?{h:t.h}:{},...$n?{x:t.x,w:t.w}:{}}))}I&&(dn({x:I.x,y:I.y,w:I.w,h:I.h}),Kn(I.maximized))}},[e]),H(()=>{if(!e||"auto"!==h)return;let t;const n=e=>{nt.current?.contains(e.target)&&!We.current&&(We.current=!0,t=setTimeout(()=>Ke(!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,h]);const Vn="auto"===h?Ie:!0===h,er=je&&!ht?je.key:null,nr=Q(()=>Dt(Ne),[Ne]),ir=B({shortcutSpec:qe,isOnDesktop:Je,toggleDesktopShortcut:Ve,taskbarStrings:ze.taskbar});j(()=>{ir.current={shortcutSpec:qe,isOnDesktop:Je,toggleDesktopShortcut:Ve,taskbarStrings:ze.taskbar}});const ar=B(null);ar.current||(ar.current={open:(e,t)=>Fe({x:e,y:t}),items:()=>{const e=ir.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Vt[St]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),H(()=>{e&&er&&function(e,t){const n=It.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(It.set(e,t),Ot())}(er,{title:nr.text||Pe,dirty:Vn,copy:nr.copy,menu:ar.current??void 0})},[e,er,Pe,Vn,nr.text,nr.copy]),H(()=>{if(e&&er)return()=>{return e=er,void(It.delete(e)&&Ot());var e}},[e,er]),Xe(!(he||!e)&&Vn);const lr=X(async()=>{if(!tt.current){if(Vn||"auto"===h&&We.current){tt.current=!0;const e=Pe,t=await b({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(tt.current=!1,!t)return}t()}},[Vn,h,t,Pe]);j(()=>{if(!e||!pt)return;const t=e=>{e.detail?.windowKey===pt&&lr()};return window.addEventListener(wr,t),()=>window.removeEventListener(wr,t)},[e,pt,lr]);const cr=B(null),yr=X(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Fe(null),Bn(St),Mn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=nt.current,l=a?.getBoundingClientRect();let s,c,d,u;if(cr.current){const t=cr.current;cr.current=null,u=t.w,d=t.h;const n=l?Math.min(Math.max(20,e.clientX-l.left),t.w-20):t.w/2;s=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${s}px`,a.style.top=`${c}px`)}else s=l?l.left:Wn.current.x,c=l?l.top:Wn.current.y,d=l?l.height:Wn.current.h,u=l?l.width:Wn.current.w;Kn(!1),dn(e=>({...e,x:s,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<ur&&Math.abs(e.clientY-i)<ur)return;r=hr(t,n,"move","move"),a&&(a.style.transition="none")}const l=s+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${l-s}px, ${d-c}px)`),Wn.current={...Wn.current,x:l,y:d},!V){const t=function(e,t){const n=Jn(),r=e<=n.x+Un,o=e>=n.x+n.w-Un,i=t<=n.y+Un,a=t>=n.y+n.h-Un,l=e<=n.x+Xn,s=e>=n.x+n.w-Xn,c=t<=n.y+Xn,d=t>=n.y+n.h-Xn;return i&&l?"tl":i&&s?"tr":a&&l?"bl":a&&s?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?rr(tr(t)):or())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),or();const e=Zn({...Wn.current});if(Wn.current=e,!V&&h){cr.current={x:s,y:c,w:u,h:d};const e=tr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void dn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;et(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),dn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),gr=X((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,l=nt.current,s=l?.getBoundingClientRect(),c=s?s.left: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,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Kn(!1),dn({x:c,y:d,w:u,h:h}),Wn.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,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`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<ur&&Math.abs(e.clientY-a)<ur)return;o=hr(n,r,dr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Gn,u+e)),w&&(i=Math.max(Qn,h+t)),m){const t=Math.max(Gn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(Qn,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),dn({...Wn.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),br=X(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Bn(St),"Enter"===e.key)return void(Pn?(Kn(!1),dn(nn())):(Kn(!0),dn(tn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{cr.current||(cr.current={...Wn.current})};if(r<0)return e(),Kn(!0),void dn(tn());if(r>0){if(Pn)return Kn(!1),void dn(nn());if(cr.current){const e=Zn(cr.current);return cr.current=null,Wn.current=e,void dn(e)}return void Hn(St)}e(),Kn(!1);const t=tr(n<0?"left":"right");return Wn.current=t,void dn(t)}if(Pn)return;const o=Wn.current,i=e.shiftKey?{...o,w:Math.max(Gn,o.w+24*n),h:Math.max(Qn,o.h+24*r)}:Zn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Wn.current=i,dn(i)},[St,Pn,nn,tn]),Er=X(e=>{cr.current||(cr.current={...Wn.current}),Kn(!1);const t=tr(e);Wn.current=t,dn(t),Bn(St)},[St]),Cr=En||Rt?{}:{tabIndex:0,role:"group","aria-label":Pe?`${Pe} — ${De.windowSuffix}`:De.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:br},Nr=()=>{Kn(!0),dn(tn())},zr=X(()=>{const e=nt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Yt);t&&!t.disabled&&t.click()}},[]);H(()=>{if(!e)return;if(V)return;const t=e=>{if(kn[kn.length-1]===St&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),zr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&nt.current?.contains(t)))return;if(t.closest(Ut))return;e.preventDefault()}}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,zr,St,V]),H(()=>{if(!e)return;const t=e=>{kn[kn.length-1]===St&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:St}})),We.current=!1,Ke(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:St}}))))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),H(()=>{if(!e)return;if(V)return;const t=e=>{if("Escape"===e.key&&kn[kn.length-1]===St){if(M(e))return e.preventDefault(),void e.stopPropagation();if(yn&&!R)return;e.preventDefault(),e.stopPropagation(),lr()}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,lr,St,V,yn,R]);const Ar=e&&(void 0!==w||void 0!==y),Ir=X(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-[9999] bg-gray-900 text-white px-5 py-2.5 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(H(()=>{if(!e)return;const t=e=>{if(kn[kn.length-1]!==St)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Ar&&(e.preventDefault(),w?w():Ir("bottom")),"k"===e.key&&Ar&&(e.preventDefault(),y?y():Ir("top"))))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,w,y,Ar,Ir,St]),!e||rn.current)return null;const Kr=Rt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),l=n%o,s=r-o*(i-1),c=a===i-1&&s<o,d=Jn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-s)*(u+20)/2:0;return{x:d.x+20+l*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(St):null,Wr=Rt&&Kr?Math.min(Kr.w/sn.w,Kr.h/sn.h):1,Or=(()=>{if(Rt&&Kr){const e=Wr,t=sn.w*e,n=sn.h*e,r=Kr.x+(Kr.w-t)/2-sn.x,o=Kr.y+(Kr.h-n)/2-sn.y,i=Ft||Ht;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:i?2020:2010,boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Jt&&$t){const e="picked"===Gt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:2030}:{}}}return null})(),$r=/* @__PURE__ */ne("div",{children:[
50
+ /* @__PURE__ */ne("div",{ref:nt,"data-modal-panel":!0,"data-modal-id":St,"data-window-key":he||void 0,...q?{"data-utility":""}:{},...Oe?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...je?{"data-window-owner":je.key}:{},...je&&!ht?{"data-window-root":""}:{},...yn?{"data-window-tab":""}:{},className:yn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(V?zt?"shadow-2xl":"shadow-lg":"border "+(zt?"shadow-2xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(rt.current=!1,Rt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Tr(St),kr(!1),void Bn(St)}if(!zt&&!V&&!Oe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===nt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),rt.current=!0,Fe(null),Bn(St),window.addEventListener("mouseup",()=>{setTimeout(()=>{rt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{rt.current&&(rt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Rt)return;Fe(null);e.target.closest("[data-modal-panel]")===nt.current&&(e.target.closest("button, input, a, select, textarea")||Bn(St))},style:we?{zIndex:Lt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ye}px)`,transition:be?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...Lt<0?{display:"none"}:{},...zt||Oe||Me&&he===Me?{}:{display:"none"}}:{zIndex:Oe?C.pinnedWindow:Lt+1,width:sn.w,height:sn.h,top:sn.y,...V&&"right"===Ze?{right:window.innerWidth-sn.x-sn.w}:{left:sn.x},...Lt<0&&!Oe?{display:"none"}:{},...Ln?{visibility:"hidden",pointerEvents:"none"}:{},...Or??{}},children:[we&&!V&&/* @__PURE__ */re("div",{onPointerDown:Ce,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),V?null:yn?je?.home?null:/* @__PURE__ */ne(oe,{children:[
51
51
  /* @__PURE__ */re("h2",{"data-window-title":!0,className:"sr-only",children:nr.text||Pe}),(nr.accessories.length>0||Ar)&&/* @__PURE__ */ne("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-3 border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:[
52
52
  /* @__PURE__ */re("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:nr.accessories}),Ar&&/* @__PURE__ */ne("span",{className:"flex items-center gap-1 shrink-0 text-[10px] text-gray-400",children:[
53
53
  /* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-1.5 py-0.5 font-medium text-gray-500",children:"K"}),
@@ -60,7 +60,7 @@ return ne("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d
60
60
  /* @__PURE__ */re("button",{type:"button",onClick:lr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-4 w-4"})})]})]}:ee?{onPointerDown:yr,"data-window-chrome":"",...Cr,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
61
61
  /* @__PURE__ */ne("div",{"data-window-title":!0,title:Pe,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Rt&&gt(),
62
62
  /* @__PURE__ */re("span",{className:"truncate",children:Rt?Xt(Ne):Ne})]}),!Rt&&/* @__PURE__ */ne("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[q&&/* @__PURE__ */re("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
63
- /* @__PURE__ */re("button",{onClick:()=>Hn(St),title:De.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!En&&/* @__PURE__ */re(sr,{maximized:Pn,onToggleMax:()=>{Pn?(Wn(!1),dn(nn())):Nr()},onSnap:Er,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:De}),
63
+ /* @__PURE__ */re("button",{onClick:()=>Hn(St),title:De.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!En&&/* @__PURE__ */re(sr,{maximized:Pn,onToggleMax:()=>{Pn?(Kn(!1),dn(nn())):Nr()},onSnap:Er,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:De}),
64
64
  /* @__PURE__ */re("button",{type:"button",onClick:lr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-4 w-4"})})]})]}:{onPointerDown:yr,"data-window-chrome":"",...Cr,className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
65
65
  /* @__PURE__ */ne("div",{"data-window-title":!0,title:Pe,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Rt&&gt(),
66
66
  /* @__PURE__ */re("span",{className:"truncate",children:Rt?Xt(Ne):Ne})]}),!Rt&&/* @__PURE__ */ne("div",{className:"flex items-center gap-1.5 shrink-0 ml-4",children:[Ar&&/* @__PURE__ */ne("span",{className:"flex items-center gap-1 mr-1 text-[10px] text-gray-400",children:[
@@ -68,10 +68,10 @@ return ne("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d
68
68
  /* @__PURE__ */re("span",{children:De.prev}),
69
69
  /* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
70
70
  /* @__PURE__ */re("span",{children:De.next})]}),q&&/* @__PURE__ */re("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-3.5 w-3.5",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
71
- /* @__PURE__ */re("button",{onClick:()=>Hn(St),title:De.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!En&&/* @__PURE__ */re(sr,{maximized:Pn,onToggleMax:()=>{Pn?(Wn(!1),dn(nn())):Nr()},onSnap:Er,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:De}),
71
+ /* @__PURE__ */re("button",{onClick:()=>Hn(St),title:De.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!En&&/* @__PURE__ */re(sr,{maximized:Pn,onToggleMax:()=>{Pn?(Kn(!1),dn(nn())):Nr()},onSnap:Er,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:De}),
72
72
  /* @__PURE__ */re("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:"ESC"}),
73
- /* @__PURE__ */re("button",{type:"button",onClick:lr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-5 w-5"})})]})]}),pe&&Ye&&!J&&!we&&/* @__PURE__ */re("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
74
- /* @__PURE__ */re(qt.Provider,{value:St,children:/* @__PURE__ */re(en.Provider,{value:{rightRef:it,leftRef:at,notify:()=>st(!0),active:zt,isDirty:Jn,footerOpen:dt&&!J&&!Z&&!ee&&!we},children:/* @__PURE__ */re("div",{ref:ot,...J?{onPointerDown:yr,onContextMenu:e=>{e.preventDefault(),Qe({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${J?"p-0 cursor-move":ee||te?"p-0":Z?"p-2":"p-4"} ${J||yn?"":"backdrop-blur-sm"} ${!1===E||ee||te?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${J?"rounded-2xl select-none":""}`,style:{...J?{touchAction:"none"}:{},backgroundColor:J?"transparent":yn?"rgb(var(--window-content-rgb))":zt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */re(Le,{children:fe})})})}),J&&Ge&&/* @__PURE__ */ne(v,{minWidth:160,style:{left:Ge.x,top:Ge.y},onClose:()=>Qe(null),children:[
73
+ /* @__PURE__ */re("button",{type:"button",onClick:lr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-5 w-5"})})]})]}),pe&&Ye&&!V&&!we&&/* @__PURE__ */re("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
74
+ /* @__PURE__ */re(qt.Provider,{value:St,children:/* @__PURE__ */re(en.Provider,{value:{rightRef:it,leftRef:at,notify:()=>st(!0),active:zt,isDirty:Vn,footerOpen:dt&&!V&&!Z&&!ee&&!we},children:/* @__PURE__ */re("div",{ref:ot,...V?{onPointerDown:yr,onContextMenu:e=>{e.preventDefault(),Qe({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":ee||te?"p-0":Z?"p-2":"p-4"} ${V||yn?"":"backdrop-blur-sm"} ${!1===E||ee||te?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${V?"rounded-2xl select-none":""}`,style:{...V?{touchAction:"none"}:{},backgroundColor:V?"transparent":yn?"rgb(var(--window-content-rgb))":zt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */re(Le,{children:fe})})})}),V&&Ge&&/* @__PURE__ */ne(v,{minWidth:160,style:{left:Ge.x,top:Ge.y},onClose:()=>Qe(null),children:[
75
75
  /* @__PURE__ */re(x,{onClick:()=>{Qe(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:St}))},children:"Settings"}),
76
76
  /* @__PURE__ */re(k,{}),de&&/* @__PURE__ */ne(oe,{children:[de,
77
77
  /* @__PURE__ */re(k,{})]}),
@@ -79,11 +79,11 @@ return ne("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d
79
79
  /* @__PURE__ */re("span",{className:"flex-1",children:"Always on Top"}),Oe&&/* @__PURE__ */re($,{name:"check",fallback:T,className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
80
80
  /* @__PURE__ */re(k,{}),
81
81
  /* @__PURE__ */re(x,{onClick:()=>{Qe(null),lr()},children:"Close"})]}),
82
- /* @__PURE__ */ne("div",{onPointerDown:yr,ref:ct,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${yn?"":" cursor-move"}${zt&&!yn?" backdrop-blur-sm":""}${J||Z||ee||we||!dt?" hidden":""}`,style:{touchAction:"none",backgroundColor:yn?"rgb(var(--window-footer-rgb))":zt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
83
- /* @__PURE__ */ne("div",{className:"flex items-center gap-2 min-w-0",children:[ft&&/* @__PURE__ */re(Ae,{auto:!0}),K,
82
+ /* @__PURE__ */ne("div",{onPointerDown:yr,ref:ct,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${yn?"":" cursor-move"}${zt&&!yn?" backdrop-blur-sm":""}${V||Z||ee||we||!dt?" hidden":""}`,style:{touchAction:"none",backgroundColor:yn?"rgb(var(--window-footer-rgb))":zt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
83
+ /* @__PURE__ */ne("div",{className:"flex items-center gap-2 min-w-0",children:[ft&&/* @__PURE__ */re(Ae,{auto:!0}),W,
84
84
  /* @__PURE__ */re("div",{ref:at,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),g]}),
85
85
  /* @__PURE__ */ne("div",{className:"flex items-center gap-2 ml-auto",children:[
86
- /* @__PURE__ */re("div",{ref:it,"data-modal-actions":!0,className:"flex items-center gap-2"}),W]})]}),!J&&!we&&!Rt&&zt&&!En&&/* @__PURE__ */ne(oe,{children:[
86
+ /* @__PURE__ */re("div",{ref:it,"data-modal-actions":!0,className:"flex items-center gap-2"}),K]})]}),!V&&!we&&!Rt&&zt&&!En&&/* @__PURE__ */ne(oe,{children:[
87
87
  /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
88
88
  /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
89
89
  /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
@@ -91,18 +91,18 @@ return ne("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d
91
91
  /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
92
92
  /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
93
93
  /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
94
- /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Rt&&/* @__PURE__ */re("div",{className:"absolute inset-0",style:{zIndex:9999,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Bt(!0),onMouseLeave:()=>Bt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Bn(St),kr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Ft&&/* @__PURE__ */re("button",{type:"button","data-expose-close":!0,"aria-label":ze.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Kr})`,transformOrigin:"top right",zIndex:1e4},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),lr()},children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-4 w-4",strokeWidth:2.2})})})]}),Rt&&Wr&&/* @__PURE__ */re("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Wr.x,top:Wr.y+Wr.h+4,width:Wr.w,zIndex:Ft?2021:2011,color:"white",fontSize:12,fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Xt(Ne)})]}),Rr=Re&&/* @__PURE__ */ne(v,{style:{left:Re.x,top:Re.y},onClose:()=>Fe(null),minWidth:160,children:[!J&&!Z&&!yn&&/* @__PURE__ */ne(oe,{children:[
94
+ /* @__PURE__ */re("div",{onPointerDown:e=>gr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Rt&&/* @__PURE__ */re("div",{className:"absolute inset-0",style:{zIndex:9999,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Bt(!0),onMouseLeave:()=>Bt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Bn(St),kr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Ft&&/* @__PURE__ */re("button",{type:"button","data-expose-close":!0,"aria-label":ze.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Wr})`,transformOrigin:"top right",zIndex:1e4},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),lr()},children:/* @__PURE__ */re($,{name:"close",fallback:z,className:"h-4 w-4",strokeWidth:2.2})})})]}),Rt&&Kr&&/* @__PURE__ */re("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Kr.x,top:Kr.y+Kr.h+4,width:Kr.w,zIndex:Ft?2021:2011,color:"white",fontSize:12,fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Xt(Ne)})]}),Rr=Re&&/* @__PURE__ */ne(v,{style:{left:Re.x,top:Re.y},onClose:()=>Fe(null),minWidth:160,children:[!V&&!Z&&!yn&&/* @__PURE__ */ne(oe,{children:[
95
95
  /* @__PURE__ */ne(x,{onClick:()=>{Hn(St),Fe(null)},children:[
96
- /* @__PURE__ */re($,{name:"remove",fallback:A,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),De.minimize]}),!En&&/* @__PURE__ */ne(x,Pn?{onClick:()=>{Wn(!1),dn(nn()),Fe(null)},children:[
96
+ /* @__PURE__ */re($,{name:"remove",fallback:A,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),De.minimize]}),!En&&/* @__PURE__ */ne(x,Pn?{onClick:()=>{Kn(!1),dn(nn()),Fe(null)},children:[
97
97
  /* @__PURE__ */re("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */re("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),De.windowed]}:{onClick:()=>{Nr(),Fe(null)},children:[
98
98
  /* @__PURE__ */re($,{name:"expand",fallback:D,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),De.maximize]})]}),q&&!yn&&/* @__PURE__ */ne(x,{onClick:()=>{$e(e=>!e),Fe(null)},children:[
99
- /* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-4 w-4 "+(Oe?"text-blue-600":"text-gray-400"),fill:Oe?"currentColor":"none",strokeWidth:1.5}),Oe?De.unpin:De.pinOnTop]}),qe&&/* @__PURE__ */ne(x,{onClick:()=>{Fe(null),Je()},children:[
100
- /* @__PURE__ */re($,{name:"star",fallback:S,className:"h-4 w-4 "+(Ve?"text-yellow-500":"text-gray-400"),fill:Ve?"currentColor":"none",strokeWidth:1.5}),Ve?ze.taskbar.removeFromDesktop:ze.taskbar.addToDesktop]}),(Jt[St]||[]).length>0&&/* @__PURE__ */re(oe,{children:(Jt[St]||[]).map((e,t)=>/* @__PURE__ */ne(x,{onClick:()=>{Fe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(yn&&je?.home)&&/* @__PURE__ */ne(oe,{children:[
99
+ /* @__PURE__ */re($,{name:"bookmark-square",fallback:L,className:"h-4 w-4 "+(Oe?"text-blue-600":"text-gray-400"),fill:Oe?"currentColor":"none",strokeWidth:1.5}),Oe?De.unpin:De.pinOnTop]}),qe&&/* @__PURE__ */ne(x,{onClick:()=>{Fe(null),Ve()},children:[
100
+ /* @__PURE__ */re($,{name:"star",fallback:S,className:"h-4 w-4 "+(Je?"text-yellow-500":"text-gray-400"),fill:Je?"currentColor":"none",strokeWidth:1.5}),Je?ze.taskbar.removeFromDesktop:ze.taskbar.addToDesktop]}),(Vt[St]||[]).length>0&&/* @__PURE__ */re(oe,{children:(Vt[St]||[]).map((e,t)=>/* @__PURE__ */ne(x,{onClick:()=>{Fe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(yn&&je?.home)&&/* @__PURE__ */ne(oe,{children:[
101
101
  /* @__PURE__ */re(k,{}),
102
102
  /* @__PURE__ */ne(x,{danger:!0,onClick:()=>{Fe(null),lr()},children:[
103
- /* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-4 w-4"}),De.close]})]})]}),Fr=!!he&&Nt.some(e=>e.id===he),qr=!At||Fr||J?null:/* @__PURE__ */ne("div",{"data-modal-restore-tab":!0,"data-modal-id":St,className:"fixed left-1/2 z-[1200] flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-1.5 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
103
+ /* @__PURE__ */re($,{name:"close",fallback:ae,className:"h-4 w-4"}),De.close]})]})]}),Fr=!!he&&Nt.some(e=>e.id===he),qr=!At||Fr||V?null:/* @__PURE__ */ne("div",{"data-modal-restore-tab":!0,"data-modal-id":St,className:"fixed left-1/2 z-[1200] flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-1.5 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
104
104
  /* @__PURE__ */re("button",{type:"button",onClick:()=>Bn(St),title:De.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Pe||De.windowSuffix}),
105
105
  /* @__PURE__ */re("button",{type:"button",onClick:()=>Bn(St),title:De.restore,"aria-label":De.restore,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
106
106
  /* @__PURE__ */re("button",{type:"button",onClick:()=>{lr()},title:De.close,"aria-label":De.close,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return ie(
107
- /* @__PURE__ */ne(jt.Provider,{value:null,children:[$r,Rr,qr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{gr&&"Escape"===e.key&&(Ir(null),kr(!1))});var Rr=100,Fr={past:[],future:[]};function qr(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Rr?r.slice(r.length-Rr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Fr}}var jr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Br=500,Hr=250;function Yr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=Z(qr,Fr),l=B(/* @__PURE__ */new Map),[s,c]=Y(0),d=s>0,[u,h]=Y(0),[m,p]=Y(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===u&&(!(n&&n.length>0)||w(n)),g=B(null),b=B(!1),v=X(()=>{const e={};for(const[t,n]of l.current)e[t]=n.getLast();return e},[]),x=X((e,t)=>{l.current.has(e)||c(e=>e+1),l.current.set(e,t)},[]),k=X(e=>{l.current.delete(e)&&c(e=>e-1)},[]),E=X(e=>{h(t=>t+(e?1:-1))},[]),C=X(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=Y(0),S=M>0,L=X(e=>{N(t=>t+(e?1:-1))},[]),T=F(Te),z=T?.claimReadOnly;H(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;H(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=B({last:0,count:0,tripped:!1}),P=B(!1),I=X((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(P.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Hr&&(r.count=0),r.last=o,++r.count>Br)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Br} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,v]),W=X(e=>{for(const[t,n]of Object.entries(e)){const e=l.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),K=X(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"undo",redoStep:t})},[o.past,v,W]),O=X(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"redo",undoStep:t})},[o.future,v,W]),[$,R]=Y(0),q=B(0),j=B(0),U=B(!1),V=X(()=>{b.current=!0,P.current=!1,g.current=null,q.current+=1,j.current=q.current,R(q.current)},[]),_=B(void 0),J=X(e=>{void 0!==e&&(void 0!==_.current&&e!==_.current&&(U.current=!0),_.current=e),V()},[V]);H(()=>{b.current&&$===j.current&&(b.current=!1,g.current=null,(P.current||U.current)&&a({type:"clear"}),P.current=!1,U.current=!1)},[$]);const G=X(()=>{U.current=!0,a({type:"clear"}),V()},[V]),ee=y&&o.past.length>0,te=y&&o.future.length>0,oe=yr(r),ie=B({undo:K,redo:O,canUndo:ee,canRedo:te});ie.current={undo:K,redo:O,canUndo:ee,canRedo:te},H(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&jr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=Q(()=>({register:x,unregister:k,record:I,undo:K,redo:O,clear:G,baseline:J,canUndo:ee,canRedo:te,enabled:y,hasState:d,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ee?o.past[o.past.length-1].label:null,redoLabel:te?o.future[0].label:null}),[x,k,I,K,O,G,J,ee,te,y,d,S,L,E,f,C,o.past,o.future]),le=""!==tn(),se=F(en)?.footerOpen??!1,ce=le&&y&&d&&!S&&se;/* @__PURE__ */
108
- return ne(Te.Provider,{value:ae,children:[ce&&/* @__PURE__ */re(rn,{position:"left",quiet:!0,children:/* @__PURE__ */re(Ae,{auto:!0})}),e]})}function Ur(){const e=F(Te),t=X(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function Xr(e){const t=F(Te),n=t?.claimReadOnly,r=t?.claimEditable;H(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Vr(e,t,n){const r=F(Te),o=ee(),i=B(e),a=B(t);a.current=t,H(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:l,coalesceKey:s=null}=n,c=B(r);c.current=r;const d=B({label:l,coalesceKey:s});d.current={label:l,coalesceKey:s},H(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function _r(e,t){const[n,r]=Y(e);return Vr(n,e=>r(()=>e),t),[n,r]}export{on as CancelButton,Qe as DocFavStar,Fe as EntityWindowFallback,$e as EntityWindowLoading,qe as EntityWindowState,Ut as KEY_ACTIVATED_SELECTOR,Ke as LoadingSpinner,Yt as MODAL_SUBMIT_SELECTOR,$r as Modal,rn as ModalActions,Ae as UndoControls,Yr as UndoProvider,pe as WINDOW_REGISTRY,Se as WindowCrashedFallback,Le as WindowErrorBoundary,yt as WindowManagerProvider,Qt as WindowTitle,rt as activateWindowById,Lt as beginWindowGesture,Rn as cancelWindowFront,be as client_default,Wr as commitExposeHighlight,Tt as drainPerfEvents,Cr as exitExposeMode,yn as forgetMaximizedWindowBoxes,pr as getActiveModalId,lt as getActiveWindowRoute,Pr as getExposeHighlight,Ft as getWindowChromeVersion,fn as getWindowPosition,Be as isDraftEntityId,He as isDraftEntityWindow,ue as isEntityEntry,de as isPageEntry,ye as isShellApiClientConfigured,ot as isTabWindow,St as markMenuOpen,$t as readWindowChrome,$n as requestWindowFront,Ir as setExposeHighlight,Nt as setPerfCollecting,we as setShellApiClient,Ce as setShellHomeRoute,me as setShellWindowRegistry,pn as setWindowDefaultPosition,wn as setWindowPosition,Dt as splitTitle,Dr as subscribeExposeHighlight,Rt as subscribeWindowChrome,Er as toggleExposeMode,In as useCurrentTabKey,tn as useEnclosingModalId,yr as useIsActiveWindow,nn as useModalActive,xe as usePageSearch,Ur as useUndo,Xr as useUndoCanEdit,Vr as useUndoable,_r as useUndoableState,_t as useWidgetSettings,Xe as useWindowDirty,_e as useWindowManager,Gt as useWindowMenuItem,Zt as useWindowTitle};
107
+ /* @__PURE__ */ne(jt.Provider,{value:null,children:[$r,Rr,qr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{gr&&"Escape"===e.key&&(Ir(null),kr(!1))});var Rr=100,Fr={past:[],future:[]};function qr(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Rr?r.slice(r.length-Rr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Fr}}var jr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Br=500,Hr=250;function Yr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=Z(qr,Fr),a=B(/* @__PURE__ */new Map),[l,s]=Y(0),c=l>0,[d,u]=Y(0),[m,p]=Y(0),f=m>0,{hasAnyPerm:w}=h(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=B(null),b=B(!1),v=X(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),x=X((e,t)=>{a.current.has(e)||s(e=>e+1),a.current.set(e,t)},[]),k=X(e=>{a.current.delete(e)&&s(e=>e-1)},[]),E=X(e=>{u(t=>t+(e?1:-1))},[]),C=X(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=Y(0),S=M>0,L=X(e=>{N(t=>t+(e?1:-1))},[]),T=F(Te),z=T?.claimReadOnly;H(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;H(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=B({last:0,count:0,tripped:!1}),P=B(!1),I=X((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(P.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Hr&&(r.count=0),r.last=o,++r.count>Br)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Br} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&i({type:"record",step:e})})},[y,v]),K=X(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),W=X(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};K(e.values),i({type:"undo",redoStep:t})},[o.past,v,K]),O=X(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};K(e.values),i({type:"redo",undoStep:t})},[o.future,v,K]),[$,R]=Y(0),q=B(0),j=B(0),U=B(!1),J=X(()=>{b.current=!0,P.current=!1,g.current=null,q.current+=1,j.current=q.current,R(q.current)},[]),_=B(void 0),V=X(e=>{void 0!==e&&(void 0!==_.current&&e!==_.current&&(U.current=!0),_.current=e),J()},[J]);H(()=>{b.current&&$===j.current&&(b.current=!1,g.current=null,(P.current||U.current)&&i({type:"clear"}),P.current=!1,U.current=!1)},[$]);const G=X(()=>{U.current=!0,i({type:"clear"}),J()},[J]),ee=y&&o.past.length>0,te=y&&o.future.length>0,oe=yr(r),ie=B({undo:W,redo:O,canUndo:ee,canRedo:te});ie.current={undo:W,redo:O,canUndo:ee,canRedo:te},H(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&jr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=Q(()=>({register:x,unregister:k,record:I,undo:W,redo:O,clear:G,baseline:V,canUndo:ee,canRedo:te,enabled:y,hasState:c,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ee?o.past[o.past.length-1].label:null,redoLabel:te?o.future[0].label:null}),[x,k,I,W,O,G,V,ee,te,y,c,S,L,E,f,C,o.past,o.future]),le=""!==tn(),se=F(en)?.footerOpen??!1,ce=le&&y&&c&&!S&&se;/* @__PURE__ */
108
+ return ne(Te.Provider,{value:ae,children:[ce&&/* @__PURE__ */re(rn,{position:"left",quiet:!0,children:/* @__PURE__ */re(Ae,{auto:!0})}),e]})}function Ur(){const e=F(Te),t=X(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function Xr(e){const t=F(Te),n=t?.claimReadOnly,r=t?.claimEditable;H(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Jr(e,t,n){const r=F(Te),o=ee(),i=B(e),a=B(t);a.current=t,H(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:l,coalesceKey:s=null}=n,c=B(r);c.current=r;const d=B({label:l,coalesceKey:s});d.current={label:l,coalesceKey:s},H(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function _r(e,t){const[n,r]=Y(e);return Jr(n,e=>r(()=>e),t),[n,r]}export{on as CancelButton,Qe as DocFavStar,Fe as EntityWindowFallback,$e as EntityWindowLoading,qe as EntityWindowState,Ut as KEY_ACTIVATED_SELECTOR,We as LoadingSpinner,Yt as MODAL_SUBMIT_SELECTOR,$r as Modal,rn as ModalActions,Ae as UndoControls,Yr as UndoProvider,pe as WINDOW_REGISTRY,Se as WindowCrashedFallback,Le as WindowErrorBoundary,yt as WindowManagerProvider,Qt as WindowTitle,rt as activateWindowById,Lt as beginWindowGesture,Rn as cancelWindowFront,be as client_default,Kr as commitExposeHighlight,Tt as drainPerfEvents,Cr as exitExposeMode,yn as forgetMaximizedWindowBoxes,pr as getActiveModalId,lt as getActiveWindowRoute,Pr as getExposeHighlight,Ft as getWindowChromeVersion,fn as getWindowPosition,Be as isDraftEntityId,He as isDraftEntityWindow,ue as isEntityEntry,de as isPageEntry,ye as isShellApiClientConfigured,ot as isTabWindow,St as markMenuOpen,$t as readWindowChrome,$n as requestWindowFront,Ir as setExposeHighlight,Nt as setPerfCollecting,we as setShellApiClient,Ce as setShellHomeRoute,me as setShellWindowRegistry,pn as setWindowDefaultPosition,wn as setWindowPosition,Dt as splitTitle,Dr as subscribeExposeHighlight,Rt as subscribeWindowChrome,Er as toggleExposeMode,In as useCurrentTabKey,tn as useEnclosingModalId,yr as useIsActiveWindow,nn as useModalActive,xe as usePageSearch,Ur as useUndo,Xr as useUndoCanEdit,Jr as useUndoable,_r as useUndoableState,_t as useWidgetSettings,Xe as useWindowDirty,_e as useWindowManager,Gt as useWindowMenuItem,Zt as useWindowTitle};