efficient-shell 7.56.0 → 7.56.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{Browser-6SOGC27E.js → Browser-HTH7GWNA.js} +14 -14
  2. package/dist/Calculator-WUFXRLVM.js +29 -0
  3. package/dist/{CurrencyConverter-XFICWUGP.js → CurrencyConverter-2A45OUOD.js} +5 -5
  4. package/dist/{Documents-C7DJOE4M.js → Documents-X33TJJFX.js} +16 -16
  5. package/dist/{Files-Q5HVPRVK.js → Files-KIJPNW23.js} +80 -80
  6. package/dist/{Notepad-3XPZIKLE.js → Notepad-O6GFW5XQ.js} +11 -11
  7. package/dist/PdfViewer-A4WWSSFU.js +1 -0
  8. package/dist/{PomodoroTimer-ZEPPQYCU.js → PomodoroTimer-LXUCEGO2.js} +6 -6
  9. package/dist/{Preview-HV2KJRRI.js → Preview-KKLHDTZC.js} +48 -48
  10. package/dist/{Sidebar-LKER76LS.js → Sidebar-5LMCOUCB.js} +28 -28
  11. package/dist/{Spreadsheet-URLX55NC.js → Spreadsheet-WOUU5DK7.js} +12 -12
  12. package/dist/{Stock-M6GGO7XF.js → Stock-L2W6WRVP.js} +1 -1
  13. package/dist/{Weather-VU7VGUDO.js → Weather-7GK4V2SQ.js} +17 -17
  14. package/dist/{WorldClock-QAMG23XA.js → WorldClock-2D2YSOTH.js} +6 -6
  15. package/dist/ai/index.js +13 -13
  16. package/dist/apps/index.js +1 -1
  17. package/dist/bin/ui-check.js +1 -1
  18. package/dist/{chunk-WFQIEKM3.js → chunk-4OKCSGQU.js} +31 -31
  19. package/dist/{chunk-HCC7EJUD.js → chunk-6ATKOYTG.js} +1 -1
  20. package/dist/chunk-7L7CUVCD.js +1 -0
  21. package/dist/{chunk-56DUNIS6.js → chunk-BVEUHQOE.js} +16 -16
  22. package/dist/{chunk-OWXCXFL6.js → chunk-EYOYUZFK.js} +2 -2
  23. package/dist/{chunk-DCMTTLLV.js → chunk-GXGRCLNE.js} +1 -1
  24. package/dist/{chunk-5H3MONF5.js → chunk-HKISG22R.js} +1 -1
  25. package/dist/{chunk-FP4N53XC.js → chunk-INXHIPJ5.js} +1 -1
  26. package/dist/{chunk-QGMHTEJ2.js → chunk-JIRDFTVN.js} +4 -4
  27. package/dist/{chunk-J4NEE4AO.js → chunk-MPAW7WHG.js} +26 -26
  28. package/dist/{chunk-YIIFH7CK.js → chunk-OGVC2IS3.js} +1 -1
  29. package/dist/{chunk-H4SBJXBL.js → chunk-ONEEJJK5.js} +1 -1
  30. package/dist/{chunk-L37CPWIB.js → chunk-RUJK3FOM.js} +13 -13
  31. package/dist/{chunk-7ZYZDQ5V.js → chunk-UHRGYZRP.js} +4 -4
  32. package/dist/{chunk-MRQLTNG6.js → chunk-VT6TBIVE.js} +321 -321
  33. package/dist/index.js +126 -126
  34. package/dist/map/index.js +7 -7
  35. package/dist/page-tabs/index.js +5 -5
  36. package/dist/pdf/index.js +1 -1
  37. package/dist/telemetry/index.js +1 -1
  38. package/dist/ui/index.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/Calculator-Z6JA6D6Q.js +0 -29
  41. package/dist/PdfViewer-NW6NQ6NP.js +0 -1
  42. package/dist/chunk-T6D5LTQR.js +0 -1
@@ -1,42 +1,42 @@
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 s,widthToFit as l,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-GEHGFIQ6.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,Result as p,useIsMobile as f,useIsPhone as w,useShellPrefs as y,StatusBadge as g,ColoredBadge as b}from"./chunk-2H3XIWVB.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-4AHFABYE.js";import{reportBoundaryError as C}from"./chunk-KNUR2UEG.js";import{confirm as M,dialogA11y as N}from"./chunk-J5USRYOM.js";import{Button_default as S}from"./chunk-DELNCIUK.js";import{Z_LAYERS as L,runEscapeInterceptors as T}from"./chunk-FIEA5CGB.js";import{LoadingSpinner as z}from"./chunk-2J6F4EE7.js";import{Icon as A}from"./chunk-TAUIAKU3.js";import{useShellStrings as D}from"./chunk-BLMDTJOK.js";import{createContext as I,useContext as P,Component as K,useLayoutEffect as $,useRef as W,useEffect as O,useState as R,useSyncExternalStore as F,useCallback as q,isValidElement as j,Fragment as B,Children as H,cloneElement as U,useMemo as Y,useId as X,useReducer as V,Suspense as _}from"react";import{jsxs as J,jsx as G,Fragment as Q}from"react/jsx-runtime";import{createPortal as Z}from"react-dom";import{useLocation as ee}from"react-router-dom";import{useQueryClient as te,useQuery as ne}from"@tanstack/react-query";function re(e){return"component"in e}function oe(e){return"endpoint"in e}var ie={};function ae(e){ie=e}var se=new Proxy({},{get:(e,t)=>ie[t],has:(e,t)=>t in ie,ownKeys:()=>Object.keys(ie),getOwnPropertyDescriptor(e,t){if(t in ie)return{configurable:!0,enumerable:!0,value:ie[t]}}}),le=null;function ce(e){le=e}function de(){return null!==le}var ue=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),he=new Proxy({},{get:(e,t)=>le?le[t]:"string"==typeof t&&ue.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),me=I(null);function pe(){return P(me)?.pageSearch??""}var fe=null,we=/* @__PURE__ */new Set;function ye(e){fe!==e&&(fe=e,we.forEach(e=>e()))}function ge(){return fe}function be(e){return we.add(e),()=>{we.delete(e)}}function ve({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
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 s,widthToFit as l,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-GEHGFIQ6.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,Result as p,useIsMobile as f,useIsPhone as w,useShellPrefs as y,StatusBadge as g,ColoredBadge as b}from"./chunk-2H3XIWVB.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-4AHFABYE.js";import{reportBoundaryError as C}from"./chunk-KNUR2UEG.js";import{confirm as M,dialogA11y as N}from"./chunk-J5USRYOM.js";import{Button_default as S}from"./chunk-DELNCIUK.js";import{Z_LAYERS as L,runEscapeInterceptors as T}from"./chunk-FIEA5CGB.js";import{Icon as z}from"./chunk-TAUIAKU3.js";import{useShellStrings as A}from"./chunk-BLMDTJOK.js";import{LoadingSpinner as D}from"./chunk-2J6F4EE7.js";import{createContext as I,useContext as P,Component as K,useLayoutEffect as $,useRef as W,useEffect as O,useState as R,useSyncExternalStore as F,useCallback as q,isValidElement as j,Fragment as B,Children as H,cloneElement as U,useMemo as Y,useId as X,useReducer as V,Suspense as _}from"react";import{jsxs as J,jsx as G,Fragment as Q}from"react/jsx-runtime";import{createPortal as Z}from"react-dom";import{useLocation as ee}from"react-router-dom";import{useQueryClient as te,useQuery as ne}from"@tanstack/react-query";function re(e){return"component"in e}function oe(e){return"endpoint"in e}var ie={};function ae(e){ie=e}var se=new Proxy({},{get:(e,t)=>ie[t],has:(e,t)=>t in ie,ownKeys:()=>Object.keys(ie),getOwnPropertyDescriptor(e,t){if(t in ie)return{configurable:!0,enumerable:!0,value:ie[t]}}}),le=null;function ce(e){le=e}function de(){return null!==le}var ue=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),he=new Proxy({},{get:(e,t)=>le?le[t]:"string"==typeof t&&ue.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),me=I(null);function pe(){return P(me)?.pageSearch??""}var fe=null,we=/* @__PURE__ */new Set;function ye(e){fe!==e&&(fe=e,we.forEach(e=>e()))}function ge(){return fe}function be(e){return we.add(e),()=>{we.delete(e)}}function ve({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
2
2
  return J("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
- /* @__PURE__ */G(A,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
3
+ /* @__PURE__ */G(z,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
4
  /* @__PURE__ */J("div",{className:"min-w-0",children:[
5
5
  /* @__PURE__ */G("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
6
  /* @__PURE__ */G("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__ */G("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 xe=class extends K{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),C(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */G(ve,{error:e,onReload:this.reset}):this.props.children}},ke=I(null),Ee="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ce({className:e="",auto:t=!1}){const n=P(ke),r=D().undo,o=n?.claimOwnMount;if($(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
7
+ /* @__PURE__ */G("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 xe=class extends K{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),C(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */G(ve,{error:e,onReload:this.reset}):this.props.children}},ke=I(null),Ee="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ce({className:e="",auto:t=!1}){const n=P(ke),r=A().undo,o=n?.claimOwnMount;if($(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
8
8
  return J("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
9
  /* @__PURE__ */G("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",h):r.nothingToUndo,className:Ee,children:r.undo}),
10
- /* @__PURE__ */G("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(d??"",m):r.nothingToRedo,className:Ee,children:r.redo})]})}var Me=/* @__PURE__ */new Set([408,429]);function Ne(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Se(e){const t=Ne(e);return null!=t&&(t>=400&&t<500&&!Me.has(t))}function Le(e,t){return!Se(t)&&e<3}function Te(){const e=D().loading;/* @__PURE__ */
11
- return G(z,{size:"sm",padding:"p-8",label:e.label})}var ze="flex-1 min-h-0";function Ae(){const e=D().record;/* @__PURE__ */
12
- return G(z,{label:e.loading,padding:"",className:ze})}function De(e){return e??void 0}function Ie({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=D().record;if(t||e&&n)/* @__PURE__ */return G(Ae,{});if(r){const e=Ne(r);if(401===e)/* @__PURE__ */
10
+ /* @__PURE__ */G("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(d??"",m):r.nothingToRedo,className:Ee,children:r.redo})]})}var Me=/* @__PURE__ */new Set([408,429]);function Ne(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Se(e){const t=Ne(e);return null!=t&&(t>=400&&t<500&&!Me.has(t))}function Le(e,t){return!Se(t)&&e<3}function Te(){const e=A().loading;/* @__PURE__ */
11
+ return G(D,{size:"sm",padding:"p-8",label:e.label})}var ze="flex-1 min-h-0";function Ae(){const e=A().record;/* @__PURE__ */
12
+ return G(D,{label:e.loading,padding:"",className:ze})}function De(e){return e??void 0}function Ie({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=A().record;if(t||e&&n)/* @__PURE__ */return G(Ae,{});if(r){const e=Ne(r);if(401===e)/* @__PURE__ */
13
13
  return G(p,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:ze});if(403===e)/* @__PURE__ */
14
14
  return G(p,{status:"403",className:ze});if(404===e||410===e)/* @__PURE__ */
15
15
  return G(p,{status:"404",title:i.notFound,className:ze});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
16
  return G(p,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */G(S,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:ze})}/* @__PURE__ */
17
17
  return G(p,{status:"404",title:i.notFound,className:ze})}function Pe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */G(Q,{children:t(e)}):/* @__PURE__ */G(Ie,{...n})}var Ke=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function $e(e){return"string"==typeof e&&(e.startsWith("new-")||Ke.test(e))}function We(e){if($e(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Oe=I({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Re=I(null);function Fe(e){const t=P(Re),n=W(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),$(()=>{if(t)return t(n.current,e)},[t,e]),O(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function qe(){const e=W(/* @__PURE__ */new Map),[t,n]=R(!1);return{dirty:t,registerDirty:q((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 je(){return P(Oe)}function Be(e){if("page"!==e.type&&We(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 He({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=qe(),i=se[e.route];if(!i||!re(i))return null;const a=i,s=a.component;/* @__PURE__ */
18
- return G(Kr,{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__ */G(Re.Provider,{value:o,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */G(Te,{})}),children:/* @__PURE__ */G(s,{})})})})}function Ue({entityType:e,entityId:t,label:n}){const r=D(),o=te(),{data:i}=ne({queryKey:["my-profile-sidebar"],enabled:de(),queryFn:()=>he.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
- return G("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];he.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */G(A,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Ye=/* @__PURE__ */new Set;function Xe({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=se[e.entityType];if(!o||!oe(o))return null;const i=o,[a,s]=R(!1),{dirty:l,registerDirty:d}=qe(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=$e(e.entityId),p=!i.selfFetching&&!h&&!m&&de(),f=ne({queryKey:[u,e.entityId],queryFn:()=>{return he.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:De(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Se(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Le}),w=f.data,y=f.refetch;O(()=>{var t;if(p)return t=t=>{t!==e.id||Ye.has(t)||y({cancelRefetch:!1})},Rn.add(t),()=>{Rn.delete(t)}},[y,e.id,p]);const g=q(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):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__ */G(_,{fallback:/* @__PURE__ */G(Te,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ae,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ie,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */G(Kr,{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:l,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__ */G(Re.Provider,{value:d,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Ae,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */G(Pe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function Ve(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function _e(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Je(e){const t=Ve(e),n=t??_e(e);if(!n)return;if(t&&!Gn(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Fn(o)}function Ge(e){if("page"!==e.type)return!0;const t=e.route?se[e.route]:void 0;if(!t||!re(t))return!0;const n=t;return!n.widget&&!n.utility}function Qe(){const e=ur();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Ze=/* @__PURE__ */new Map;function et(){const e=Qe();if(e)return Ze.get(e)}function tt(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 nt="rosh-peek-style",rt=L.peek,ot=L.taskbarPreview;function it(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(nt))return;const e=document.createElement("style");e.id=nt,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:${rt}!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 at(){"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 st({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=D(),l=W(null),[c,d]=R({w:n,h:Math.round(.75*r)}),[u,h]=R(!1);return $(()=>{const o=l.current;if(!o)return;const i=Ve(e)??tt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),u=Math.max(60,Math.round(a.height*s));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(${s})`,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__ */J("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
18
+ return G(Kr,{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__ */G(Re.Provider,{value:o,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */G(Te,{})}),children:/* @__PURE__ */G(s,{})})})})}function Ue({entityType:e,entityId:t,label:n}){const r=A(),o=te(),{data:i}=ne({queryKey:["my-profile-sidebar"],enabled:de(),queryFn:()=>he.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
+ return G("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];he.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */G(z,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Ye=/* @__PURE__ */new Set;function Xe({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=se[e.entityType];if(!o||!oe(o))return null;const i=o,[a,s]=R(!1),{dirty:l,registerDirty:d}=qe(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=$e(e.entityId),p=!i.selfFetching&&!h&&!m&&de(),f=ne({queryKey:[u,e.entityId],queryFn:()=>{return he.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:De(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Se(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Le}),w=f.data,y=f.refetch;O(()=>{var t;if(p)return t=t=>{t!==e.id||Ye.has(t)||y({cancelRefetch:!1})},Rn.add(t),()=>{Rn.delete(t)}},[y,e.id,p]);const g=q(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):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__ */G(_,{fallback:/* @__PURE__ */G(Te,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ae,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ie,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */G(Kr,{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:l,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__ */G(Re.Provider,{value:d,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Ae,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */G(Pe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function Ve(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function _e(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Je(e){const t=Ve(e),n=t??_e(e);if(!n)return;if(t&&!Gn(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Fn(o)}function Ge(e){if("page"!==e.type)return!0;const t=e.route?se[e.route]:void 0;if(!t||!re(t))return!0;const n=t;return!n.widget&&!n.utility}function Qe(){const e=ur();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Ze=/* @__PURE__ */new Map;function et(){const e=Qe();if(e)return Ze.get(e)}function tt(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 nt="rosh-peek-style",rt=L.peek,ot=L.taskbarPreview;function it(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(nt))return;const e=document.createElement("style");e.id=nt,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:${rt}!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 at(){"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 st({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=A(),l=W(null),[c,d]=R({w:n,h:Math.round(.75*r)}),[u,h]=R(!1);return $(()=>{const o=l.current;if(!o)return;const i=Ve(e)??tt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),u=Math.max(60,Math.round(a.height*s));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(${s})`,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__ */J("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
20
20
  /* @__PURE__ */G("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */J("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
21
- /* @__PURE__ */G(A,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
22
- /* @__PURE__ */G("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */G("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */G("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:s.taskbar.closeWindow,children:/* @__PURE__ */G(A,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function lt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=D(),s=e.length>1,l=W(null),[c,d]=R({left:-9999,top:-9999,ready:!1}),[u,h]=R(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");$(()=>{const e=l.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]),O(()=>at,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs 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 Z(
21
+ /* @__PURE__ */G(z,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
22
+ /* @__PURE__ */G("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */G("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */G("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:s.taskbar.closeWindow,children:/* @__PURE__ */G(z,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function lt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=A(),s=e.length>1,l=W(null),[c,d]=R({left:-9999,top:-9999,ready:!1}),[u,h]=R(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");$(()=>{const e=l.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]),O(()=>at,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs 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 Z(
23
23
  /* @__PURE__ */G("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:ot,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{at(),i()},children:e.map(e=>{const t=Ve(e.id)??tt(e.label),o=t?function(e){if(Gn(e))return null;const t=e.getBoundingClientRect(),n=Un(),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 J("div",{className:"group flex flex-col items-center",onMouseEnter:()=>it(t),children:[!m&&/* @__PURE__ */G("span",{className:p,children:e.label}),
25
25
  /* @__PURE__ */G(st,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */G("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */J("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-white shadow-sm",children:[
26
- /* @__PURE__ */G(A,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function ct(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 dt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=D(),[a,s]=R(null);O(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(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 l=F(hr,ur),[,d]=R(0);O(()=>{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]=R(0);O(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=tt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=R(null),[f,w]=R(null),[y,g]=R(null),b=W(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!se[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?se[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 Z(
26
+ /* @__PURE__ */G(z,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function ct(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 dt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=A(),[a,s]=R(null);O(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(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 l=F(hr,ur),[,d]=R(0);O(()=>{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]=R(0);O(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=tt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=R(null),[f,w]=R(null),[y,g]=R(null),b=W(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!se[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?se[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 Z(
27
27
  /* @__PURE__ */J(Q,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,d=e.items.some(e=>{const t=Ve(e.id)??tt(e.label);return!!t&&!Gn(t)});/* @__PURE__ */
28
- return J("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),s?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-2 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)?U(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */G(A,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
29
- /* @__PURE__ */G("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),d&&/* @__PURE__ */G("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */G("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */G("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__ */G(A,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
28
+ return J("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),s?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-2 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)?U(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */G(z,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
29
+ /* @__PURE__ */G("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),d&&/* @__PURE__ */G("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */G("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */G("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__ */G(z,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
30
30
  /* @__PURE__ */G("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */J("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
31
- /* @__PURE__ */G(A,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */J(v,{portal:!0,minWidth:200,style:ct(y.x,y.y),onClose:()=>g(null),children:[
31
+ /* @__PURE__ */G(z,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */J(v,{portal:!0,minWidth:200,style:ct(y.x,y.y),onClose:()=>g(null),children:[
32
32
  /* @__PURE__ */G(E,{children:y.label}),
33
33
  /* @__PURE__ */J(x,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=Sn.get(e);t&&qn(t)}(e.id))},children:[
34
- /* @__PURE__ */G(A,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
34
+ /* @__PURE__ */G(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
35
35
  /* @__PURE__ */J(x,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
36
36
  /* @__PURE__ */G("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */G("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__ */G(k,{}),
38
38
  /* @__PURE__ */J(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
39
- /* @__PURE__ */G(A,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */G(lt,{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 ut=["/login","/forgot-password","/reset-password","/force-change-password"];function ht({children:e,windowAccentForRoute:t}){const n=ee(),r=ut.some(e=>n.pathname.startsWith(e)),[o,i]=R([]),a=W(o);$(()=>{a.current=o},[o]);const s=F(be,ge,ge),l=W(/* @__PURE__ */new Map),c=e=>{const t=Ge(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.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 l.current.set(e.id,i),i};O(()=>{Ze.clear();for(const e of o)e.route&&Ze.set(e.id,e.route)},[o]);const d=q(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=q(e=>{var t;Ve(e)||_e(e)?(t=e,window.dispatchEvent(new CustomEvent(mr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=kn;t&&Ye.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,(En.get(i)??-1)>a)||Fn(o),t&&Ye.delete(e)},50)},m=q((e,t,n,r,o)=>{if(!se[e]||!oe(se[e]))return;const a=`${e}:${t}`,s=Qe();i(i=>{const l=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return l?(h(l.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:De(n),openedFrom:s}])})},[]),p=q((e,t={})=>{if(!se[e]||!re(se[e]))return;const n=se[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l}=t,c=e=>{var t;o?(t=e,Dn.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=Qe();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&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,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]})},[u]),f=q(()=>{},[]),w=q(()=>{},[]),y=u,g=u;/* @__PURE__ */
39
+ /* @__PURE__ */G(z,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */G(lt,{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 ut=["/login","/forgot-password","/reset-password","/force-change-password"];function ht({children:e,windowAccentForRoute:t}){const n=ee(),r=ut.some(e=>n.pathname.startsWith(e)),[o,i]=R([]),a=W(o);$(()=>{a.current=o},[o]);const s=F(be,ge,ge),l=W(/* @__PURE__ */new Map),c=e=>{const t=Ge(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.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 l.current.set(e.id,i),i};O(()=>{Ze.clear();for(const e of o)e.route&&Ze.set(e.id,e.route)},[o]);const d=q(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=q(e=>{var t;Ve(e)||_e(e)?(t=e,window.dispatchEvent(new CustomEvent(mr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=kn;t&&Ye.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,(En.get(i)??-1)>a)||Fn(o),t&&Ye.delete(e)},50)},m=q((e,t,n,r,o)=>{if(!se[e]||!oe(se[e]))return;const a=`${e}:${t}`,s=Qe();i(i=>{const l=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return l?(h(l.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:De(n),openedFrom:s}])})},[]),p=q((e,t={})=>{if(!se[e]||!re(se[e]))return;const n=se[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l}=t,c=e=>{var t;o?(t=e,Dn.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=Qe();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&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,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]})},[u]),f=q(()=>{},[]),w=q(()=>{},[]),y=u,g=u;/* @__PURE__ */
40
40
  return J(Oe.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
41
41
  /* @__PURE__ */G(dt,{openWindows:o,onRemove:u,onSplitView:Ir,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&&Fn(e)}})},onActivateById:Je}),
42
42
  /* @__PURE__ */G(Pr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
@@ -46,7 +46,7 @@ return G(Rt.Provider,{value:e,children:t})}var qt=/* @__PURE__ */new Set(["butto
46
46
  return G("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-ZWVAYCJQ.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 nn="erp_window_positions",rn={};try{const e=localStorage.getItem(nn);e&&(rn=JSON.parse(e))}catch{}var on=null;function an(){on&&clearTimeout(on),on=setTimeout(()=>{try{localStorage.setItem(nn,JSON.stringify(rn))}catch{}},500)}var sn="erp_activation_order",ln=[];try{const e=localStorage.getItem(sn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(ln=t)}catch{}var cn=null;function dn(){cn&&clearTimeout(cn),cn=setTimeout(()=>{try{localStorage.setItem(sn,JSON.stringify(ln))}catch{}},500)}function un(e,t){rn[e]||(rn[e]=t,an())}function hn(e){return rn[e]?{...rn[e]}:null}function mn(e,t){rn[e]=t,an()}function pn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(rn))n(rn[e],r,o)&&(delete rn[e],i=!0);i&&an()}var fn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},wn=4e3,yn=()=>{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"},gn={small:.8,medium:1,large:1.25,maximized:1.25},bn=[],vn=/* @__PURE__ */new Set,xn=/* @__PURE__ */new Set,kn=0,En=/* @__PURE__ */new Map;var Cn=0;function Mn(){return Cn}function Nn(){Cn++,vn.forEach(e=>e())}var Sn=/* @__PURE__ */new Map,Ln=/* @__PURE__ */new Map,Tn=/* @__PURE__ */new Map;function zn(){for(let e=bn.length-1;e>=0;e--){const t=Tn.get(bn[e]);if(t?.tab)return t.owner}return null}function An(){return F(hr,zn,()=>null)}var Dn=/* @__PURE__ */new Set;var In=null;function Pn(e){In=null,Fn(e)}function Kn(e){In=e;const t=Sn.get(e);t&&Pn(t)}function $n(e){In===e&&(In=null)}function Wn(e,t,n){if(n&&Tn.set(e,n),t)if(Sn.set(t,e),Ln.set(e,t),Dn.delete(t)){bn.unshift(e);const n=ln.indexOf(t);-1!==n&&ln.splice(n,1),ln.unshift(t),dn()}else!function(e,t){const n=ln.indexOf(t);if(-1===n)return void bn.push(e);let r=bn.length;for(let e=0;e<bn.length;e++){const t=Ln.get(bn[e]);if(t&&ln.indexOf(t)>n){r=e;break}}bn.splice(r,0,e)}(e,t),-1===ln.indexOf(t)&&(ln.push(t),dn());else bn.push(e);Nn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&In===t&&Pn(e)}function On(e){return e?Tn.get(e)?.owner??Ln.get(e)??null:null}var Rn=/* @__PURE__ */new Set;function Fn(e){const t=On(ur()),n=bn.indexOf(e);-1!==n&&bn.splice(n,1),bn.push(e);const o=Tn.get(e);if(o?.root&&o.tab&&r()){const e=bn.filter(e=>{const t=Tn.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)bn.splice(bn.indexOf(t),1),bn.push(t)}xn.delete(e);const i=Ln.get(e);if(i){const e=ln.indexOf(i);-1!==e&&ln.splice(e,1),ln.push(i),dn(),In&&In!==i&&(In=null)}Nn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=On(ur());a&&a!==t&&Rn.forEach(e=>e(a))}function qn(e){const t=bn.indexOf(e);-1!==t&&bn.splice(t,1),xn.add(e),En.set(e,++kn);const n=Ln.get(e);if(n){const e=ln.indexOf(n);-1!==e&&(ln.splice(e,1),dn())}Nn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var jn=/* @__PURE__ */new Set;var Bn=8,Hn=32;function Un(){return e()}var Yn=40,Xn=80,Vn=384,_n=400;function Jn(e,t=Un()){const n=Math.min(Math.max(e.x,t.x+Xn-e.w),t.x+t.w-Xn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Yn);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Gn(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Un();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 Qn(e){const t=Un(),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 Zn=null;function er(e){const t=(Zn||((Zn=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${L.snapPreview}`,"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(Zn)),Zn);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 tr(){Zn&&(Zn.style.opacity="0",Zn.style.display="none")}var nr=[{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"}],rr=350,or=200;function ir({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=R(!1),s=W(void 0),l=W(void 0);O(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),rr)},d=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),or)};/* @__PURE__ */
47
47
  return J("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
48
48
  /* @__PURE__ */G("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */G("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.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-2 shadow-lg",children:nr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */G("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.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__ */G("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var ar="rosh-gesture-style";var sr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},lr=4;function cr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(ar))return;const e=document.createElement("style");e.id=ar,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=Et(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function dr(e){const t=bn.indexOf(e);if(-1===t)return-1;const n=L.window+t*L.windowStep,o=Tn.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of Tn){if(!t.root||t.owner!==o.owner)continue;const n=bn.indexOf(e);-1!==n&&(i=Math.max(i,L.window+n*L.windowStep))}return i>=n?i+2+Math.min(t,7):n}function ur(){return bn[bn.length-1]||null}function hr(e){return vn.add(e),()=>{vn.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=bn.length-1;e>=0;e--)jn.has(bn[e])||bn.splice(e,1);ln=ln.filter(e=>{const t=Sn.get(e);return null!=t&&jn.has(t)}),dn(),Nn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var mr="modal-close-request";function pr(e){F(hr,Mn);const t=P(Gt);if(bn.length<=1)return!0;if(e){const t=Sn.get(e);if(null!=t)return ur()===t}return t?.active??null!=ur()}var fr=!1,wr=/* @__PURE__ */new Set;function yr(e){return wr.add(e),()=>wr.delete(e)}function gr(){return fr}function br(e){fr!==e&&(fr=e,wr.forEach(e=>e()))}function vr(){br(!fr)}function xr(){br(!1)}var kr=null,Er=/* @__PURE__ */new Set;function Cr(e){return Er.add(e),()=>Er.delete(e)}function Mr(){return kr}function Nr(e){kr!==e&&(kr=e,Er.forEach(e=>e()))}var Sr=null,Lr=/* @__PURE__ */new Set;function Tr(e){return Lr.add(e),()=>Lr.delete(e)}function zr(){return Sr}function Ar(e){Sr!==e&&(Sr=e,Lr.forEach(e=>e()))}function Dr(){if(!Sr)return void br(!1);Nr(Sr),Ar(null),br(!1)}function Ir(){br(!fr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Pr(){const e=F(yr,gr),[t,n]=R(e),[r,o]=R(e);return O(()=>{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?Z(
49
- /* @__PURE__ */G("div",{onMouseDown:e=>{e.stopPropagation(),br(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:L.expose,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 Kr({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:g,footer:b,bodyScroll:E,onMinimize:C,initialBox:S,actions:z,actionsLeft:I,editing:K=!1,allowPinOnTop:B,initialPosition:H,widget:V,compact:_,appStyle:ee,flushBody:te,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:de}){const[ue,he]=R(()=>r()),pe=f()&&!ue,fe=w()&&!!V,[we,ye]=R(0),[ge,be]=R(!1),ve=W(null),Ee=W(0);O(()=>{Ee.current=we},[we]);const Me=q(e=>{pe&&(ve.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},be(!0),wt(le??null))},[pe,le]),Ne=F(yt,ft);O(()=>{if(!ge)return;const e=e=>{if(!ve.current)return;const t=e.clientX-ve.current.startX;if(Math.abs(e.clientY-ve.current.startY)>Math.abs(t)+12)return ve.current=null,be(!1),ye(0),void wt(null);ye(Math.max(0,t))},t=()=>{if(!ve.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ve.current=null,be(!1),t?(ye(window.innerWidth),setTimeout(()=>{i(),ye(0),wt(null)},180)):(ye(0),wt(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)}},[ge]);const[Se,Le]=R(c),Te=D(),ze=Te.window;O(()=>{Le(c)},[c]);const Ae=Y(()=>Ht(Se).trim()||void 0,[Se]),De=X(),[Ie,Pe]=R(!1),Ke=W(!1),[$e,We]=R(!1),[Oe,Re]=R(null),qe=P(Rt),Be=P(me),{prefs:He,save:Ue}=y(),Ye=!!He.window_accent_stripe,Xe=He.favorite_documents||[],Ve=!!qe&&Xe.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),_e=q(()=>{if(!qe)return;const e=Ve?Xe.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Xe,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ue({favorite_documents:e})},[qe,Ve,Xe,Ue]),[Je,Ge]=R(null),[Qe,Ze]=R("top-right"===H?"right":"left"),et=W(!1),tt=W(null);$(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=W(!1),rt=W(null),ot=W(null),it=W(null),[at,st]=R(!1),lt=W(null),ct=!!(b||z||I)||at,dt=P(ke),ut=""!==P(Ot),ht=W(null);ht.current=Be?{owner:Be.key,tab:Be.tab,root:!ut}:null;const mt=se||(Be&&!ut?Be.key:null),pt=!!dt&&!ut&&dt.enabled&&dt.hasState&&(K||dt.declaredEditable)&&!dt.handMounted&&ct&&!V&&!_&&!ee&&!pe,gt=/* @__PURE__ */G(A,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),bt=d&&j(d)?U(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??gt,vt=()=>/* @__PURE__ */G("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Re(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:bt}),xt=40,{minimize:kt,items:Et,restoreIfMinimized:Ct,openWindows:Mt}=je(),Nt=W(`modal-${Math.random().toString(36).slice(2,8)}`).current;O(()=>{if(V)return jn.add(Nt),()=>{jn.delete(Nt)}},[V,Nt]),O(()=>{const e=e=>{const t=e.detail;t?.id===Nt&&Le(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Nt]);const[St,Lt]=R(L.window),zt=function(e){const t=F(hr,ur);return bn.length<=1||t===e}(Nt),Dt=function(e){return F(hr,()=>xn.has(e))}(Nt),It=F(yr,gr),Kt=F(Cr,Mr),$t=F(Tr,zr),Wt=!B&&!V,Ft=It&&Wt,[qt,Ut]=R(!1),Yt=Ft&&$t===Nt,[Vt,_t]=R(!1),Jt=Vt&&Wt&&Kt===Nt?"picked":null,Qt=W(Ft);O(()=>{if(Qt.current&&!Ft){_t(!0);const e=setTimeout(()=>{_t(!1),kr===Nt&&Nr(null)},700);return Qt.current=Ft,()=>clearTimeout(e)}Qt.current=Ft},[Ft,Nt]),O(()=>{Ft||Ut(!1)},[Ft]),O(()=>{const e=ot.current,t=it.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]),O(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.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=W(!1),en=q(e,[]),tn=q(()=>{const t=e(),n=ae?ae[0]:fn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=gn[yn()],l=ae?Math.min(ae[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(bn.length-1),d=Math.max(xt,(i-l)/2),u=(o-a)/2,m=t.h-xt-l-d;return"top-right"===H?{x:t.x+t.w-a-xt,y:t.y+xt,w:a,h:l}:"top-left"===H?{x:t.x+xt,y:t.y+xt,w:a,h:l}:{x:t.x+Math.max(xt,(o-a)/2+xt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),nn=W(!1);t||(nn.current=!1);const on=se||u||null;O(()=>{if(!t)return;Wn(Nt,on,ht.current??void 0),se||Fn(Nt),Zt.current=!1,Lt(dr(Nt));const e=()=>{Lt(dr(Nt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Fn(Nt),kn.current)return;const t=Un(),n=Math.min(In.current.w,t.w-40),o=Math.min(In.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;cn({x:i,y:a,w:n,h:o}),Dn(!1)},i=e=>{const t=e.detail;r(t)&&(Fn(Nt),Re({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Fn(Nt);const t=In.current,n=function(e,t=Un()){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=tt.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)}cn(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=bn.indexOf(e);-1!==t&&(bn.splice(t,1),Nn()),xn.delete(e),En.delete(e),Tn.delete(e);const n=Ln.get(e);n&&(Ln.delete(e),Sn.delete(n))}(Nt),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,Nt,on,en]);const sn=!V&&"maximized"===yn(),[ln,cn]=R(()=>{if(on&&rn[on]){const e={...rn[on]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),Jn(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:sn?en():tn()}),[dn,un]=R(()=>!ne),hn=W(ue),mn=W(null);O(()=>{const e=()=>{const e=r();e!==hn.current&&mn.current?.(e),hn.current=e,he(e),Lt(dr(Nt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Nt]);const pn=ue&&!!Be?.tab&&!ut&&!V&&!pe,vn=pn,kn=W(vn);kn.current=vn;const Cn=An(),Mn=ue&&!!Be?.tab&&!V&&!pe&&!It&&Cn!==Be.key,[zn,Dn]=R(()=>on&&rn[on]||S?vn:vn||sn),In=W(ln);In.current=ln;const Pn=W(zn);$(()=>{Pn.current=zn},[zn]),$(()=>{if(dn||pn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.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,In.current.y)-24),g=w?Math.min(In.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,cn(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;s(),o===e&&un(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[dn,V,re,ct,pn]),$(()=>{if(!ne||!dn||V||!t)return;const e=lt.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||zn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,In.current.y)-24);cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ne,dn,V,t,zn,re]);const Kn=!1!==oe&&!V&&!ee&&!pe,[$n,On]=R(()=>!Kn);$(()=>{if($n||!t)return;if(!Kn||zn)return void On(!0);const n=tt.current,r=rt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=In.current.w,c=0;const d=()=>On(!0),u=()=>{c=0;const t=In.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=s(t,l(t.w,w,g),u,xt);b!==t&&(i=b.w,cn(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,wn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[$n,t,Kn,zn]);const Rn=W(null),Yn=!(!Be?.tab||ut||V||pe);mn.current=t=>{if(!Yn)return;if(t)return Rn.current||(Rn.current={box:{...In.current},maximized:Pn.current}),void(Pn.current=!0);const r=Rn.current;Rn.current=null;const o=e();if(r?.maximized)return Pn.current=!0,Dn(!0),void cn(o);const i=r?.box??(on?rn[on]:void 0);if(Pn.current=!1,Dn(!1),i&&!n(i,o,!1)){const e={...i};ae&&(e.w=ae[0],ne||(e.h=ae[1])),cn(Jn(e))}else cn(tn())},O(()=>{vn&&(Pn.current=!0,Dn(!0),cn(en()))},[vn,en]),O(()=>{if(V)return;const e=()=>{const e=on?rn[on]:void 0;if(Pn.current=!1,Dn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),cn(Jn(t))}else cn(tn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,tn,on]),O(()=>{t&&on&&!pn&&(rn[on]=ln,an()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[ln,t,on,pn]),O(()=>{if(!t)return;const e=()=>{Pn.current?cn(en()):document.body.classList.contains("rosh-gesturing")||cn(Jn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return zn&&(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,zn,en]),O(()=>{if(t&&(Pe(!1),Ke.current=!1,et.current=!1,On(!Kn),!kn.current)){if(on&&rn[on]){const e=rn[on];return void cn(t=>Jn({...e,...ne?{h:t.h}:{},...Kn?{x:t.x,w:t.w}:{}}))}S&&(cn({x:S.x,y:S.y,w:S.w,h:S.h}),Dn(S.maximized))}},[t]),O(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{tt.current?.contains(t.target)&&!Ke.current&&(Ke.current=!0,e=setTimeout(()=>Pe(!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 Xn="auto"===m?Ie:!0===m,Gn=Be&&!ut?Be.key:null,Zn=Y(()=>Tt(Se),[Se]),nr=W({shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar});$(()=>{nr.current={shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar}});const rr=W(null);rr.current||(rr.current={open:(e,t)=>Re({x:e,y:t}),items:()=>{const e=nr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Xt[Nt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),O(()=>{if(t&&Gn)return()=>{return e=Gn,void(At.delete(e)&&Pt());var e}},[t,Gn]),Fe(!(se||!t)&&Xn);const or=q(async()=>{if(!et.current){if(Xn||"auto"===m&&Ke.current){et.current=!0;const e=Ae,t=await M({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(et.current=!1,!t)return}i()}},[Xn,m,i,Ae]);$(()=>{if(!t||!mt)return;const e=e=>{e.detail?.windowKey===mt&&or()};return window.addEventListener(mr,e),()=>window.removeEventListener(mr,e)},[t,mt,or]);const ar=W(null),pr=q(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Re(null),Fn(Nt),kn.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=tt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(ar.current){const t=ar.current;ar.current=null,u=t.w,d=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:In.current.x,c=s?s.top:In.current.y,d=s?s.height:In.current.h,u=s?s.width:In.current.w;Dn(!1),cn(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<lr&&Math.abs(e.clientY-i)<lr)return;r=cr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${d-c}px)`),In.current={...In.current,x:s,y:d},!V){const t=function(e,t){const n=Un(),r=e<=n.x+Bn,o=e>=n.x+n.w-Bn,i=t<=n.y+Bn,a=t>=n.y+n.h-Bn,s=e<=n.x+Hn,l=e>=n.x+n.w-Hn,c=t<=n.y+Hn,d=t>=n.y+n.h-Hn;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"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?er(Qn(t)):tr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),tr();const e=Jn({...In.current});if(In.current=e,!V&&h){ar.current={x:l,y:c,w:u,h:d};const e=Qn(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 cn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),cn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),fr=q((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,s=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:In.current.x,d=l?l.top:In.current.y,u=l?l.width:In.current.w,h=l?l.height:In.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;Dn(!1),cn({x:c,y:d,w:u,h:h}),In.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,In.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<lr&&Math.abs(e.clientY-a)<lr)return;o=cr(n,r,sr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Vn,u+e)),w&&(i=Math.max(_n,h+t)),m){const t=Math.max(Vn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(_n,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?.(),cn({...In.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),wr=q(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(),Fn(Nt),"Enter"===e.key)return void(zn?(Dn(!1),cn(tn())):(Dn(!0),cn(en())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ar.current||(ar.current={...In.current})};if(r<0)return e(),Dn(!0),void cn(en());if(r>0){if(zn)return Dn(!1),void cn(tn());if(ar.current){const e=Jn(ar.current);return ar.current=null,In.current=e,void cn(e)}return void qn(Nt)}e(),Dn(!1);const t=Qn(n<0?"left":"right");return In.current=t,void cn(t)}if(zn)return;const o=In.current,i=e.shiftKey?{...o,w:Math.max(Vn,o.w+24*n),h:Math.max(_n,o.h+24*r)}:Jn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});In.current=i,cn(i)},[Nt,zn,tn,en]),vr=q(e=>{ar.current||(ar.current={...In.current}),Dn(!1);const t=Qn(e);In.current=t,cn(t),Fn(Nt)},[Nt]),xr=vn||Ft?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.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:wr},Er=()=>{Dn(!0),cn(en())},Sr=q(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(jt);t&&!t.disabled&&t.click()}},[]);O(()=>{if(!t)return;if(V)return;const e=e=>{if(bn[bn.length-1]===Nt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Sr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Bt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,Nt,V]),O(()=>{if(!t)return;const e=e=>{bn[bn.length-1]===Nt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Nt}})),Ke.current=!1,Pe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Nt}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),O(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&bn[bn.length-1]===Nt){if(T(e))return e.preventDefault(),void e.stopPropagation();if(pn&&!K)return;e.preventDefault(),e.stopPropagation(),or()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,or,Nt,V,pn,K]);const Lr=t&&(void 0!==p||void 0!==g),[Ar]=R(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Dr=pn&&!Be?.home&&(Zn.actions.length>0||Lr);O(()=>{t&&Gn&&function(e,t){const n=At.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(At.set(e,t),Pt())}(Gn,{title:Zn.text||Ae,dirty:Xn,copy:Zn.copy,actions:Dr&&Ar?Ar:void 0,menu:rr.current??void 0})},[t,Gn,Ae,Xn,Zn.text,Zn.copy,Dr,Ar]);const Ir=q(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-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 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(O(()=>{if(!t)return;const e=e=>{if(bn[bn.length-1]!==Nt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Lr&&(e.preventDefault(),p?p():Ir("bottom")),"k"===e.key&&Lr&&(e.preventDefault(),g?g():Ir("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,g,Lr,Ir,Nt]),!t||nn.current)return null;const Pr=Ft?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),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,d=Un(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(Nt):null,Kr=Ft&&Pr?Math.min(Pr.w/ln.w,Pr.h/ln.h):1,$r=(()=>{if(Ft&&Pr){const e=Kr,t=ln.w*e,n=ln.h*e,r=Pr.x+(Pr.w-t)/2-ln.x,o=Pr.y+(Pr.h-n)/2-ln.y,i=qt||Yt;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:L.expose+(i?20:10),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&&Wt){const e="picked"===Jt;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:L.expose+30}:{}}}return null})(),Wr=N({modal:!1,titleId:!V&&(pn?!Be?.home:!pe)?De:void 0,label:Zn.text||Ae}),Or=/* @__PURE__ */J("div",{children:[
49
+ /* @__PURE__ */G("div",{onMouseDown:e=>{e.stopPropagation(),br(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:L.expose,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 Kr({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:g,footer:b,bodyScroll:E,onMinimize:C,initialBox:S,actions:D,actionsLeft:I,editing:K=!1,allowPinOnTop:B,initialPosition:H,widget:V,compact:_,appStyle:ee,flushBody:te,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:de}){const[ue,he]=R(()=>r()),pe=f()&&!ue,fe=w()&&!!V,[we,ye]=R(0),[ge,be]=R(!1),ve=W(null),Ee=W(0);O(()=>{Ee.current=we},[we]);const Me=q(e=>{pe&&(ve.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},be(!0),wt(le??null))},[pe,le]),Ne=F(yt,ft);O(()=>{if(!ge)return;const e=e=>{if(!ve.current)return;const t=e.clientX-ve.current.startX;if(Math.abs(e.clientY-ve.current.startY)>Math.abs(t)+12)return ve.current=null,be(!1),ye(0),void wt(null);ye(Math.max(0,t))},t=()=>{if(!ve.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ve.current=null,be(!1),t?(ye(window.innerWidth),setTimeout(()=>{i(),ye(0),wt(null)},180)):(ye(0),wt(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)}},[ge]);const[Se,Le]=R(c),Te=A(),ze=Te.window;O(()=>{Le(c)},[c]);const Ae=Y(()=>Ht(Se).trim()||void 0,[Se]),De=X(),[Ie,Pe]=R(!1),Ke=W(!1),[$e,We]=R(!1),[Oe,Re]=R(null),qe=P(Rt),Be=P(me),{prefs:He,save:Ue}=y(),Ye=!!He.window_accent_stripe,Xe=He.favorite_documents||[],Ve=!!qe&&Xe.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),_e=q(()=>{if(!qe)return;const e=Ve?Xe.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Xe,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ue({favorite_documents:e})},[qe,Ve,Xe,Ue]),[Je,Ge]=R(null),[Qe,Ze]=R("top-right"===H?"right":"left"),et=W(!1),tt=W(null);$(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=W(!1),rt=W(null),ot=W(null),it=W(null),[at,st]=R(!1),lt=W(null),ct=!!(b||D||I)||at,dt=P(ke),ut=""!==P(Ot),ht=W(null);ht.current=Be?{owner:Be.key,tab:Be.tab,root:!ut}:null;const mt=se||(Be&&!ut?Be.key:null),pt=!!dt&&!ut&&dt.enabled&&dt.hasState&&(K||dt.declaredEditable)&&!dt.handMounted&&ct&&!V&&!_&&!ee&&!pe,gt=/* @__PURE__ */G(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),bt=d&&j(d)?U(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??gt,vt=()=>/* @__PURE__ */G("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Re(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:bt}),xt=40,{minimize:kt,items:Et,restoreIfMinimized:Ct,openWindows:Mt}=je(),Nt=W(`modal-${Math.random().toString(36).slice(2,8)}`).current;O(()=>{if(V)return jn.add(Nt),()=>{jn.delete(Nt)}},[V,Nt]),O(()=>{const e=e=>{const t=e.detail;t?.id===Nt&&Le(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Nt]);const[St,Lt]=R(L.window),zt=function(e){const t=F(hr,ur);return bn.length<=1||t===e}(Nt),Dt=function(e){return F(hr,()=>xn.has(e))}(Nt),It=F(yr,gr),Kt=F(Cr,Mr),$t=F(Tr,zr),Wt=!B&&!V,Ft=It&&Wt,[qt,Ut]=R(!1),Yt=Ft&&$t===Nt,[Vt,_t]=R(!1),Jt=Vt&&Wt&&Kt===Nt?"picked":null,Qt=W(Ft);O(()=>{if(Qt.current&&!Ft){_t(!0);const e=setTimeout(()=>{_t(!1),kr===Nt&&Nr(null)},700);return Qt.current=Ft,()=>clearTimeout(e)}Qt.current=Ft},[Ft,Nt]),O(()=>{Ft||Ut(!1)},[Ft]),O(()=>{const e=ot.current,t=it.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]),O(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.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=W(!1),en=q(e,[]),tn=q(()=>{const t=e(),n=ae?ae[0]:fn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=gn[yn()],l=ae?Math.min(ae[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(bn.length-1),d=Math.max(xt,(i-l)/2),u=(o-a)/2,m=t.h-xt-l-d;return"top-right"===H?{x:t.x+t.w-a-xt,y:t.y+xt,w:a,h:l}:"top-left"===H?{x:t.x+xt,y:t.y+xt,w:a,h:l}:{x:t.x+Math.max(xt,(o-a)/2+xt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),nn=W(!1);t||(nn.current=!1);const on=se||u||null;O(()=>{if(!t)return;Wn(Nt,on,ht.current??void 0),se||Fn(Nt),Zt.current=!1,Lt(dr(Nt));const e=()=>{Lt(dr(Nt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Fn(Nt),kn.current)return;const t=Un(),n=Math.min(In.current.w,t.w-40),o=Math.min(In.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;cn({x:i,y:a,w:n,h:o}),Dn(!1)},i=e=>{const t=e.detail;r(t)&&(Fn(Nt),Re({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Fn(Nt);const t=In.current,n=function(e,t=Un()){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=tt.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)}cn(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=bn.indexOf(e);-1!==t&&(bn.splice(t,1),Nn()),xn.delete(e),En.delete(e),Tn.delete(e);const n=Ln.get(e);n&&(Ln.delete(e),Sn.delete(n))}(Nt),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,Nt,on,en]);const sn=!V&&"maximized"===yn(),[ln,cn]=R(()=>{if(on&&rn[on]){const e={...rn[on]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),Jn(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:sn?en():tn()}),[dn,un]=R(()=>!ne),hn=W(ue),mn=W(null);O(()=>{const e=()=>{const e=r();e!==hn.current&&mn.current?.(e),hn.current=e,he(e),Lt(dr(Nt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Nt]);const pn=ue&&!!Be?.tab&&!ut&&!V&&!pe,vn=pn,kn=W(vn);kn.current=vn;const Cn=An(),Mn=ue&&!!Be?.tab&&!V&&!pe&&!It&&Cn!==Be.key,[zn,Dn]=R(()=>on&&rn[on]||S?vn:vn||sn),In=W(ln);In.current=ln;const Pn=W(zn);$(()=>{Pn.current=zn},[zn]),$(()=>{if(dn||pn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.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,In.current.y)-24),g=w?Math.min(In.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,cn(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;s(),o===e&&un(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[dn,V,re,ct,pn]),$(()=>{if(!ne||!dn||V||!t)return;const e=lt.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||zn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,In.current.y)-24);cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ne,dn,V,t,zn,re]);const Kn=!1!==oe&&!V&&!ee&&!pe,[$n,On]=R(()=>!Kn);$(()=>{if($n||!t)return;if(!Kn||zn)return void On(!0);const n=tt.current,r=rt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=In.current.w,c=0;const d=()=>On(!0),u=()=>{c=0;const t=In.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=s(t,l(t.w,w,g),u,xt);b!==t&&(i=b.w,cn(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,wn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[$n,t,Kn,zn]);const Rn=W(null),Yn=!(!Be?.tab||ut||V||pe);mn.current=t=>{if(!Yn)return;if(t)return Rn.current||(Rn.current={box:{...In.current},maximized:Pn.current}),void(Pn.current=!0);const r=Rn.current;Rn.current=null;const o=e();if(r?.maximized)return Pn.current=!0,Dn(!0),void cn(o);const i=r?.box??(on?rn[on]:void 0);if(Pn.current=!1,Dn(!1),i&&!n(i,o,!1)){const e={...i};ae&&(e.w=ae[0],ne||(e.h=ae[1])),cn(Jn(e))}else cn(tn())},O(()=>{vn&&(Pn.current=!0,Dn(!0),cn(en()))},[vn,en]),O(()=>{if(V)return;const e=()=>{const e=on?rn[on]:void 0;if(Pn.current=!1,Dn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),cn(Jn(t))}else cn(tn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,tn,on]),O(()=>{t&&on&&!pn&&(rn[on]=ln,an()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[ln,t,on,pn]),O(()=>{if(!t)return;const e=()=>{Pn.current?cn(en()):document.body.classList.contains("rosh-gesturing")||cn(Jn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return zn&&(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,zn,en]),O(()=>{if(t&&(Pe(!1),Ke.current=!1,et.current=!1,On(!Kn),!kn.current)){if(on&&rn[on]){const e=rn[on];return void cn(t=>Jn({...e,...ne?{h:t.h}:{},...Kn?{x:t.x,w:t.w}:{}}))}S&&(cn({x:S.x,y:S.y,w:S.w,h:S.h}),Dn(S.maximized))}},[t]),O(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{tt.current?.contains(t.target)&&!Ke.current&&(Ke.current=!0,e=setTimeout(()=>Pe(!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 Xn="auto"===m?Ie:!0===m,Gn=Be&&!ut?Be.key:null,Zn=Y(()=>Tt(Se),[Se]),nr=W({shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar});$(()=>{nr.current={shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar}});const rr=W(null);rr.current||(rr.current={open:(e,t)=>Re({x:e,y:t}),items:()=>{const e=nr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Xt[Nt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),O(()=>{if(t&&Gn)return()=>{return e=Gn,void(At.delete(e)&&Pt());var e}},[t,Gn]),Fe(!(se||!t)&&Xn);const or=q(async()=>{if(!et.current){if(Xn||"auto"===m&&Ke.current){et.current=!0;const e=Ae,t=await M({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(et.current=!1,!t)return}i()}},[Xn,m,i,Ae]);$(()=>{if(!t||!mt)return;const e=e=>{e.detail?.windowKey===mt&&or()};return window.addEventListener(mr,e),()=>window.removeEventListener(mr,e)},[t,mt,or]);const ar=W(null),pr=q(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Re(null),Fn(Nt),kn.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=tt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(ar.current){const t=ar.current;ar.current=null,u=t.w,d=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:In.current.x,c=s?s.top:In.current.y,d=s?s.height:In.current.h,u=s?s.width:In.current.w;Dn(!1),cn(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<lr&&Math.abs(e.clientY-i)<lr)return;r=cr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${d-c}px)`),In.current={...In.current,x:s,y:d},!V){const t=function(e,t){const n=Un(),r=e<=n.x+Bn,o=e>=n.x+n.w-Bn,i=t<=n.y+Bn,a=t>=n.y+n.h-Bn,s=e<=n.x+Hn,l=e>=n.x+n.w-Hn,c=t<=n.y+Hn,d=t>=n.y+n.h-Hn;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"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?er(Qn(t)):tr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),tr();const e=Jn({...In.current});if(In.current=e,!V&&h){ar.current={x:l,y:c,w:u,h:d};const e=Qn(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 cn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),cn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),fr=q((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,s=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:In.current.x,d=l?l.top:In.current.y,u=l?l.width:In.current.w,h=l?l.height:In.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;Dn(!1),cn({x:c,y:d,w:u,h:h}),In.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,In.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<lr&&Math.abs(e.clientY-a)<lr)return;o=cr(n,r,sr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Vn,u+e)),w&&(i=Math.max(_n,h+t)),m){const t=Math.max(Vn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(_n,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?.(),cn({...In.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),wr=q(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(),Fn(Nt),"Enter"===e.key)return void(zn?(Dn(!1),cn(tn())):(Dn(!0),cn(en())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ar.current||(ar.current={...In.current})};if(r<0)return e(),Dn(!0),void cn(en());if(r>0){if(zn)return Dn(!1),void cn(tn());if(ar.current){const e=Jn(ar.current);return ar.current=null,In.current=e,void cn(e)}return void qn(Nt)}e(),Dn(!1);const t=Qn(n<0?"left":"right");return In.current=t,void cn(t)}if(zn)return;const o=In.current,i=e.shiftKey?{...o,w:Math.max(Vn,o.w+24*n),h:Math.max(_n,o.h+24*r)}:Jn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});In.current=i,cn(i)},[Nt,zn,tn,en]),vr=q(e=>{ar.current||(ar.current={...In.current}),Dn(!1);const t=Qn(e);In.current=t,cn(t),Fn(Nt)},[Nt]),xr=vn||Ft?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.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:wr},Er=()=>{Dn(!0),cn(en())},Sr=q(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(jt);t&&!t.disabled&&t.click()}},[]);O(()=>{if(!t)return;if(V)return;const e=e=>{if(bn[bn.length-1]===Nt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Sr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Bt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,Nt,V]),O(()=>{if(!t)return;const e=e=>{bn[bn.length-1]===Nt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Nt}})),Ke.current=!1,Pe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Nt}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),O(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&bn[bn.length-1]===Nt){if(T(e))return e.preventDefault(),void e.stopPropagation();if(pn&&!K)return;e.preventDefault(),e.stopPropagation(),or()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,or,Nt,V,pn,K]);const Lr=t&&(void 0!==p||void 0!==g),[Ar]=R(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Dr=pn&&!Be?.home&&(Zn.actions.length>0||Lr);O(()=>{t&&Gn&&function(e,t){const n=At.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(At.set(e,t),Pt())}(Gn,{title:Zn.text||Ae,dirty:Xn,copy:Zn.copy,actions:Dr&&Ar?Ar:void 0,menu:rr.current??void 0})},[t,Gn,Ae,Xn,Zn.text,Zn.copy,Dr,Ar]);const Ir=q(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-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 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(O(()=>{if(!t)return;const e=e=>{if(bn[bn.length-1]!==Nt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Lr&&(e.preventDefault(),p?p():Ir("bottom")),"k"===e.key&&Lr&&(e.preventDefault(),g?g():Ir("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,g,Lr,Ir,Nt]),!t||nn.current)return null;const Pr=Ft?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),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,d=Un(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(Nt):null,Kr=Ft&&Pr?Math.min(Pr.w/ln.w,Pr.h/ln.h):1,$r=(()=>{if(Ft&&Pr){const e=Kr,t=ln.w*e,n=ln.h*e,r=Pr.x+(Pr.w-t)/2-ln.x,o=Pr.y+(Pr.h-n)/2-ln.y,i=qt||Yt;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:L.expose+(i?20:10),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&&Wt){const e="picked"===Jt;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:L.expose+30}:{}}}return null})(),Wr=N({modal:!1,titleId:!V&&(pn?!Be?.home:!pe)?De:void 0,label:Zn.text||Ae}),Or=/* @__PURE__ */J("div",{children:[
50
50
  /* @__PURE__ */J("div",{ref:tt,"data-modal-panel":!0,"data-modal-id":Nt,"data-window-key":se||void 0,...B?{"data-utility":""}:{},...$e?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...Be?{"data-window-owner":Be.key}:{},...Be&&!ut?{"data-window-root":""}:{},...pn?{"data-window-tab":""}:{},...Wr,className:pn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(V?zt?"shadow-xl":"shadow-lg":"border "+(zt?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(nt.current=!1,Ft){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Nr(Nt),br(!1),void Fn(Nt)}if(!zt&&!V&&!$e&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===tt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),nt.current=!0,Re(null),Fn(Nt),window.addEventListener("mouseup",()=>{setTimeout(()=>{nt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{nt.current&&(nt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Ft)return;Re(null);e.target.closest("[data-modal-panel]")===tt.current&&(e.target.closest("button, input, a, select, textarea")||Fn(Nt))},style:pe?{zIndex:St+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${we}px)`,transition:ge?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...St<0?{display:"none"}:{},...zt||$e||Ne&&se===Ne?{}:{display:"none"}}:{zIndex:$e?L.pinnedWindow:St+1,width:ln.w,height:ln.h,top:ln.y,...V&&"right"===Qe?{right:window.innerWidth-ln.x-ln.w}:{left:ln.x},...St<0&&!$e?{display:"none"}:{},...fe?{display:"none"}:{},...Mn?{visibility:"hidden",pointerEvents:"none"}:{},...$r??{}},children:[pe&&!V&&/* @__PURE__ */G("div",{onPointerDown:Me,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),V?null:pn?Be?.home?null:/* @__PURE__ */J(Q,{children:[
51
51
  /* @__PURE__ */G("h2",{id:De,"data-window-title":!0,className:"sr-only",children:Zn.text||Ae}),Dr&&Ar&&Z(
52
52
  /* @__PURE__ */J(Q,{children:[Zn.actions,Lr&&/* @__PURE__ */J("span",{className:"flex items-center gap-1 shrink-0 text-2xs text-gray-400",children:[
@@ -54,34 +54,34 @@ return J("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,
54
54
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-2 py-0.5 font-medium text-gray-500",title:ze.next,children:"J"})]})]}),Ar),Zn.badges.length>0&&/* @__PURE__ */G("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:Zn.badges})]}):pe?null:
55
55
  /* @__PURE__ */J("div",_?{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 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:[
56
56
  /* @__PURE__ */J("div",{"data-window-title":!0,title:Ae,className:"text-sm 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:[!Ft&&vt(),
57
- /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(A,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
58
- /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(A,{name:"close",className:"h-4 w-4"})})]})]}:ee?{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 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:[
57
+ /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
58
+ /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(z,{name:"close",className:"h-4 w-4"})})]})]}:ee?{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 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:[
59
59
  /* @__PURE__ */J("div",{"data-window-title":!0,title:Ae,className:"text-sm 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:[!Ft&&vt(),
60
- /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(A,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
60
+ /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
61
61
  /* @__PURE__ */G("button",{onClick:()=>qn(Nt),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!vn&&/* @__PURE__ */G(ir,{maximized:zn,onToggleMax:()=>{zn?(Dn(!1),cn(tn())):Er()},onSnap:vr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:ze}),
62
- /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(A,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-window-bar) px-4 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:[
62
+ /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(z,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-window-bar) px-4 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:[
63
63
  /* @__PURE__ */J("div",{"data-window-title":!0,title:Ae,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:[!Ft&&vt(),
64
64
  /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[Lr&&/* @__PURE__ */J("span",{className:"flex items-center gap-1 mr-1 text-2xs text-gray-400",children:[
65
65
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium text-gray-500",children:"K"}),
66
66
  /* @__PURE__ */G("span",{children:ze.prev}),
67
67
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
68
- /* @__PURE__ */G("span",{children:ze.next})]}),B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(A,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
68
+ /* @__PURE__ */G("span",{children:ze.next})]}),B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
69
69
  /* @__PURE__ */G("button",{onClick:()=>qn(Nt),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!vn&&/* @__PURE__ */G(ir,{maximized:zn,onToggleMax:()=>{zn?(Dn(!1),cn(tn())):Er()},onSnap:vr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:ze}),
70
70
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 text-2xs font-medium text-gray-400",children:"ESC"}),
71
- /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */G(A,{name:"close",className:"h-5 w-5"})})]})]}),ce&&Ye&&!V&&!pe&&/* @__PURE__ */G("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
71
+ /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */G(z,{name:"close",className:"h-5 w-5"})})]})]}),ce&&Ye&&!V&&!pe&&/* @__PURE__ */G("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
72
72
  /* @__PURE__ */G(Ot.Provider,{value:Nt,children:/* @__PURE__ */G(Gt.Provider,{value:{rightRef:ot,leftRef:it,notify:()=>st(!0),active:zt,isDirty:Xn,footerOpen:ct&&!V&&!_&&!ee&&!pe},children:/* @__PURE__ */G("div",{ref:rt,...V?{onPointerDown:pr,onContextMenu:e=>{e.preventDefault(),Ge({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":ee||te?"p-0":_?"p-2":"p-4"} ${V||pn?"":"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":pn?"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__ */G(xe,{children:de})})})}),V&&Je&&/* @__PURE__ */J(v,{minWidth:160,style:{left:Je.x,top:Je.y},onClose:()=>Ge(null),children:[
73
73
  /* @__PURE__ */G(x,{onClick:()=>{Ge(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Nt}))},children:"Settings"}),
74
74
  /* @__PURE__ */G(k,{}),ie&&/* @__PURE__ */J(Q,{children:[ie,
75
75
  /* @__PURE__ */G(k,{})]}),
76
76
  /* @__PURE__ */J(x,{onClick:()=>{Ge(null),We(e=>!e)},children:[
77
- /* @__PURE__ */G("span",{className:"flex-1",children:"Always on Top"}),$e&&/* @__PURE__ */G(A,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
77
+ /* @__PURE__ */G("span",{className:"flex-1",children:"Always on Top"}),$e&&/* @__PURE__ */G(z,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
78
78
  /* @__PURE__ */G(k,{}),
79
79
  /* @__PURE__ */G(x,{onClick:()=>{Ge(null),or()},children:"Close"})]}),
80
80
  /* @__PURE__ */J("div",{onPointerDown:pr,ref:lt,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${pn?"":" cursor-move"}${zt&&!pn?" backdrop-blur-sm":""}${V||_||ee||pe||!ct?" hidden":""}`,style:{touchAction:"none",backgroundColor:pn?"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:[
81
81
  /* @__PURE__ */J("div",{className:"flex items-center gap-2 min-w-0",children:[pt&&/* @__PURE__ */G(Ce,{auto:!0}),I,
82
82
  /* @__PURE__ */G("div",{ref:it,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),b]}),
83
83
  /* @__PURE__ */J("div",{className:"flex items-center gap-2 ml-auto",children:[
84
- /* @__PURE__ */G("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),z]})]}),!V&&!pe&&!Ft&&zt&&!vn&&/* @__PURE__ */J(Q,{children:[
84
+ /* @__PURE__ */G("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),D]})]}),!V&&!pe&&!Ft&&zt&&!vn&&/* @__PURE__ */J(Q,{children:[
85
85
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
86
86
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
87
87
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
@@ -89,16 +89,16 @@ return J("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,
89
89
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
90
90
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
91
91
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
92
- /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Ft&&/* @__PURE__ */G("div",{className:"absolute inset-0",style:{zIndex:L.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Ut(!0),onMouseLeave:()=>Ut(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Fn(Nt),br(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:qt&&/* @__PURE__ */G("button",{type:"button","data-expose-close":!0,"aria-label":Te.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:L.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),or()},children:/* @__PURE__ */G(A,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Ft&&Pr&&/* @__PURE__ */G("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Pr.x,top:Pr.y+Pr.h+4,width:Pr.w,zIndex:L.expose+(qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Ht(Se)})]}),Rr=Oe&&/* @__PURE__ */J(v,{style:{left:Oe.x,top:Oe.y},onClose:()=>Re(null),minWidth:160,children:[!V&&!_&&!pn&&/* @__PURE__ */J(Q,{children:[
92
+ /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Ft&&/* @__PURE__ */G("div",{className:"absolute inset-0",style:{zIndex:L.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Ut(!0),onMouseLeave:()=>Ut(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Fn(Nt),br(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:qt&&/* @__PURE__ */G("button",{type:"button","data-expose-close":!0,"aria-label":Te.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:L.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),or()},children:/* @__PURE__ */G(z,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Ft&&Pr&&/* @__PURE__ */G("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Pr.x,top:Pr.y+Pr.h+4,width:Pr.w,zIndex:L.expose+(qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Ht(Se)})]}),Rr=Oe&&/* @__PURE__ */J(v,{style:{left:Oe.x,top:Oe.y},onClose:()=>Re(null),minWidth:160,children:[!V&&!_&&!pn&&/* @__PURE__ */J(Q,{children:[
93
93
  /* @__PURE__ */J(x,{onClick:()=>{qn(Nt),Re(null)},children:[
94
- /* @__PURE__ */G(A,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!vn&&/* @__PURE__ */J(x,zn?{onClick:()=>{Dn(!1),cn(tn()),Re(null)},children:[
94
+ /* @__PURE__ */G(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!vn&&/* @__PURE__ */J(x,zn?{onClick:()=>{Dn(!1),cn(tn()),Re(null)},children:[
95
95
  /* @__PURE__ */G("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */G("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),ze.windowed]}:{onClick:()=>{Er(),Re(null)},children:[
96
- /* @__PURE__ */G(A,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),B&&!pn&&/* @__PURE__ */J(x,{onClick:()=>{We(e=>!e),Re(null)},children:[
97
- /* @__PURE__ */G(A,{name:"bookmark-square",className:"h-4 w-4 "+($e?"text-blue-600":""),fill:$e?"currentColor":"none",strokeWidth:1.5}),$e?ze.unpin:ze.pinOnTop]}),qe&&/* @__PURE__ */J(x,{onClick:()=>{Re(null),_e()},children:[
98
- /* @__PURE__ */G(A,{name:"star",className:"h-4 w-4",fill:Ve?"currentColor":"none",strokeWidth:1.5}),Ve?Te.taskbar.removeFromDesktop:Te.taskbar.addToDesktop]}),(Xt[Nt]||[]).length>0&&/* @__PURE__ */G(Q,{children:(Xt[Nt]||[]).map((e,t)=>/* @__PURE__ */J(x,{onClick:()=>{Re(null),e.onClick()},children:[e.icon,e.label]},t))}),!(pn&&Be?.home)&&/* @__PURE__ */J(Q,{children:[
96
+ /* @__PURE__ */G(z,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),B&&!pn&&/* @__PURE__ */J(x,{onClick:()=>{We(e=>!e),Re(null)},children:[
97
+ /* @__PURE__ */G(z,{name:"bookmark-square",className:"h-4 w-4 "+($e?"text-blue-600":""),fill:$e?"currentColor":"none",strokeWidth:1.5}),$e?ze.unpin:ze.pinOnTop]}),qe&&/* @__PURE__ */J(x,{onClick:()=>{Re(null),_e()},children:[
98
+ /* @__PURE__ */G(z,{name:"star",className:"h-4 w-4",fill:Ve?"currentColor":"none",strokeWidth:1.5}),Ve?Te.taskbar.removeFromDesktop:Te.taskbar.addToDesktop]}),(Xt[Nt]||[]).length>0&&/* @__PURE__ */G(Q,{children:(Xt[Nt]||[]).map((e,t)=>/* @__PURE__ */J(x,{onClick:()=>{Re(null),e.onClick()},children:[e.icon,e.label]},t))}),!(pn&&Be?.home)&&/* @__PURE__ */J(Q,{children:[
99
99
  /* @__PURE__ */G(k,{}),
100
100
  /* @__PURE__ */J(x,{danger:!0,onClick:()=>{Re(null),or()},children:[
101
- /* @__PURE__ */G(A,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Fr=!!se&&Mt.some(e=>e.id===se),qr=!Dt||Fr||V?null:/* @__PURE__ */J("div",{"data-modal-restore-tab":!0,"data-modal-id":Nt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
101
+ /* @__PURE__ */G(z,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Fr=!!se&&Mt.some(e=>e.id===se),qr=!Dt||Fr||V?null:/* @__PURE__ */J("div",{"data-modal-restore-tab":!0,"data-modal-id":Nt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
102
102
  /* @__PURE__ */G("button",{type:"button",onClick:()=>Fn(Nt),title:ze.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:Ae||ze.windowSuffix}),
103
103
  /* @__PURE__ */G("button",{type:"button",onClick:()=>Fn(Nt),title:ze.restore,"aria-label":ze.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
104
104
  /* @__PURE__ */G("button",{type:"button",onClick:()=>{or()},title:ze.close,"aria-label":ze.close,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return Z(
@@ -1 +1 @@
1
- import{client_default as a}from"./chunk-WFQIEKM3.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
1
+ import{client_default as a}from"./chunk-4OKCSGQU.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
@@ -0,0 +1 @@
1
+ var r="7.56.1",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,24 +1,24 @@
1
- import{inputClasses as e}from"./chunk-HJQAE6SP.js";import{isSafeLinkHref as t}from"./chunk-PJPK2ADX.js";import{SpinnerRing as r}from"./chunk-2J6F4EE7.js";import{Icon as n}from"./chunk-TAUIAKU3.js";import{useShellStrings as a}from"./chunk-BLMDTJOK.js";import{forwardRef as s,useCallback as i,useState as l,useId as o}from"react";import{jsx as c,jsxs as d,Fragment as m}from"react/jsx-runtime";var u=s(function({invalid:t,autoGrow:r,className:n="",onInput:a,rows:s=3,size:l,readOnly:o,...d},m){const u=i(e=>{if(r){const t=e.currentTarget;t.style.height="auto",t.style.height=`${t.scrollHeight}px`}a?.(e)},[r,a]);/* @__PURE__ */
1
+ import{inputClasses as e}from"./chunk-HJQAE6SP.js";import{isSafeLinkHref as t}from"./chunk-PJPK2ADX.js";import{Icon as r}from"./chunk-TAUIAKU3.js";import{useShellStrings as n}from"./chunk-BLMDTJOK.js";import{SpinnerRing as a}from"./chunk-2J6F4EE7.js";import{forwardRef as s,useCallback as i,useState as l,useId as o}from"react";import{jsx as c,jsxs as d,Fragment as m}from"react/jsx-runtime";var u=s(function({invalid:t,autoGrow:r,className:n="",onInput:a,rows:s=3,size:l,readOnly:o,...d},m){const u=i(e=>{if(r){const t=e.currentTarget;t.style.height="auto",t.style.height=`${t.scrollHeight}px`}a?.(e)},[r,a]);/* @__PURE__ */
2
2
  return c("textarea",{ref:m,"aria-invalid":t||void 0,rows:s,onInput:u,readOnly:o,className:e({invalid:t,size:l,readOnly:o,multiline:!0,className:`${r?"resize-none overflow-hidden":""} ${n}`.trim()}),...d})}),h={info:{box:"bg-blue-50 border-blue-200",icon:"text-blue-600"},success:{box:"bg-green-50 border-green-200",icon:"text-green-600"},warning:{box:"bg-amber-50 border-amber-200",icon:"text-amber-600"},danger:{box:"bg-red-50 border-red-200",icon:"text-red-600"},neutral:{box:"bg-[var(--status-neutral-soft)] border-[color:var(--line)]",icon:"text-[color:var(--status-neutral-soft-ink)]"}},p={info:"bg-blue-700 border-blue-700 text-white",success:"bg-green-700 border-green-700 text-white",warning:"bg-amber-700 border-amber-700 text-white",danger:"bg-red-700 border-red-700 text-white",neutral:"bg-[var(--status-neutral-solid)] border-[color:var(--status-neutral-solid)] text-[color:var(--status-on-solid)]"};function g({tone:e}){const t={className:"h-5 w-5","aria-hidden":!0};switch(e){case"success":/* @__PURE__ */
3
- return c(n,{name:"check-circle",look:"mini",...t});case"warning":/* @__PURE__ */
4
- return c(n,{name:"warning",look:"mini",...t});case"danger":/* @__PURE__ */
5
- return c(n,{name:"close-circle",look:"mini",...t});default:/* @__PURE__ */
6
- return c(n,{name:"info",look:"mini",...t})}}function x({tone:e="info",emphasis:t="subtle",title:r,children:s,icon:i,action:l,onDismiss:o,sticky:u=!1,className:x=""}){const b=h[e],f="solid"===t,y=a().banner,v=f?p[e]:b.box,N=u?"sticky top-0 z-30":"",k=/* @__PURE__ */d(m,{children:[r&&/* @__PURE__ */c("div",{className:("font-semibold "+(f?"":"text-gray-900")).trim(),children:r}),s&&/* @__PURE__ */c("div",{className:`${f?"":"text-gray-700"} ${r?"mt-0.5":""}`.trim(),children:s})]});/* @__PURE__ */
3
+ return c(r,{name:"check-circle",look:"mini",...t});case"warning":/* @__PURE__ */
4
+ return c(r,{name:"warning",look:"mini",...t});case"danger":/* @__PURE__ */
5
+ return c(r,{name:"close-circle",look:"mini",...t});default:/* @__PURE__ */
6
+ return c(r,{name:"info",look:"mini",...t})}}function x({tone:e="info",emphasis:t="subtle",title:a,children:s,icon:i,action:l,onDismiss:o,sticky:u=!1,className:x=""}){const b=h[e],f="solid"===t,y=n().banner,v=f?p[e]:b.box,N=u?"sticky top-0 z-30":"",k=/* @__PURE__ */d(m,{children:[a&&/* @__PURE__ */c("div",{className:("font-semibold "+(f?"":"text-gray-900")).trim(),children:a}),s&&/* @__PURE__ */c("div",{className:`${f?"":"text-gray-700"} ${a?"mt-0.5":""}`.trim(),children:s})]});/* @__PURE__ */
7
7
  return d("div",{role:"danger"===e?"alert":"status",className:`${N} flex items-start gap-3 rounded-lg border px-4 py-3 ${v} ${x}`.trim(),children:[
8
8
  /* @__PURE__ */c("span",{className:`mt-0.5 shrink-0 ${f?"":b.icon}`.trim(),children:i??/* @__PURE__ */c(g,{tone:e})}),null==l?/* @__PURE__ */c("div",{className:"min-w-0 flex-1 text-sm",children:k}):
9
9
  /* @__PURE__ */d("div",{className:"flex min-w-0 flex-1 flex-wrap items-start gap-x-3 gap-y-2",children:[
10
10
  /* @__PURE__ */c("div",{className:"min-w-0 grow basis-48 text-sm",children:k}),
11
- /* @__PURE__ */c("div",{className:"shrink-0 self-center",children:l})]}),o&&/* @__PURE__ */c("button",{type:"button",onClick:o,"aria-label":y.dismiss,className:"shrink-0 "+(f?"opacity-80 hover:opacity-100":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */c(n,{name:"close",className:"h-4 w-4",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})}function b({summary:e,busy:t=!1,open:r,onOpenChange:a,label:s="Steps",className:i="",children:m}){const[u,h]=l(null),p=o(),g=r??u??t;/* @__PURE__ */
11
+ /* @__PURE__ */c("div",{className:"shrink-0 self-center",children:l})]}),o&&/* @__PURE__ */c("button",{type:"button",onClick:o,"aria-label":y.dismiss,className:"shrink-0 "+(f?"opacity-80 hover:opacity-100":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */c(r,{name:"close",className:"h-4 w-4",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})}function b({summary:e,busy:t=!1,open:n,onOpenChange:a,label:s="Steps",className:i="",children:m}){const[u,h]=l(null),p=o(),g=n??u??t;/* @__PURE__ */
12
12
  return d("div",{className:`text-xs text-gray-500 ${i}`.trim(),children:[
13
13
  /* @__PURE__ */d("button",{type:"button",onClick:()=>{h(!g),a?.(!g)},"aria-expanded":g,"aria-controls":g?p:void 0,className:"flex w-full items-center gap-2 rounded text-left hover:text-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-600",children:[
14
- /* @__PURE__ */c(n,{name:"chevron-right",size:12,className:"shrink-0 motion-safe:transition-transform "+(g?"rotate-90":"")}),
14
+ /* @__PURE__ */c(r,{name:"chevron-right",size:12,className:"shrink-0 motion-safe:transition-transform "+(g?"rotate-90":"")}),
15
15
  /* @__PURE__ */c("span",{"aria-live":"polite",className:"min-w-0 flex-1 truncate",children:e})]}),g&&/* @__PURE__ */c("ol",{id:p,"aria-label":s,className:"mt-2 ml-2 space-y-2 border-l border-gray-200 pl-3",children:m})]})}var f={pending:"text-gray-400",active:"text-gray-800",complete:"text-gray-600",failed:"text-red-600",stopped:"text-gray-500",waiting:"text-amber-700",skipped:"text-gray-400"},y={pending:"Pending",active:"In progress",complete:"Done",failed:"Failed",stopped:"Stopped",waiting:"Waiting for you",skipped:"Skipped"};function v({status:e}){switch(e){case"active":/* @__PURE__ */
16
- return c(r,{className:"size-3 motion-reduce:animate-none"});case"complete":/* @__PURE__ */
17
- return c(n,{name:"check-circle",size:14,tone:"success"});case"failed":/* @__PURE__ */
18
- return c(n,{name:"close-circle",size:14,tone:"danger"});case"stopped":/* @__PURE__ */
19
- return c(n,{name:"no-symbol",size:14,tone:"muted"});case"waiting":/* @__PURE__ */
20
- return c(n,{name:"pause",size:14,tone:"warning"});case"skipped":/* @__PURE__ */
21
- return c(n,{name:"remove",size:14,tone:"muted"});default:/* @__PURE__ */
16
+ return c(a,{className:"size-3 motion-reduce:animate-none"});case"complete":/* @__PURE__ */
17
+ return c(r,{name:"check-circle",size:14,tone:"success"});case"failed":/* @__PURE__ */
18
+ return c(r,{name:"close-circle",size:14,tone:"danger"});case"stopped":/* @__PURE__ */
19
+ return c(r,{name:"no-symbol",size:14,tone:"muted"});case"waiting":/* @__PURE__ */
20
+ return c(r,{name:"pause",size:14,tone:"warning"});case"skipped":/* @__PURE__ */
21
+ return c(r,{name:"remove",size:14,tone:"muted"});default:/* @__PURE__ */
22
22
  return c("span",{className:"block size-3 rounded-full border border-gray-300"})}}function N({label:e,description:t,status:r="complete",statusWord:n,icon:a,children:s}){/* @__PURE__ */
23
23
  return d("li",{className:`flex items-start gap-2 ${f[r]}`,"data-status":r,children:[
24
24
  /* @__PURE__ */c("span",{"aria-hidden":"true",className:"mt-1 flex size-3.5 shrink-0 items-center justify-center",children:a??/* @__PURE__ */c(v,{status:r})}),
@@ -28,11 +28,11 @@ return d("li",{className:`flex items-start gap-2 ${f[r]}`,"data-status":r,childr
28
28
  /* @__PURE__ */d("span",{className:"text-gray-400",children:["[",r[1],"]"]},a++)):void 0!==r[3]?t.push(
29
29
  /* @__PURE__ */c("a",{href:w(r[4])?r[4]:void 0,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:r[3]},a++)):void 0!==r[5]?t.push(
30
30
  /* @__PURE__ */c("strong",{className:"font-semibold text-gray-900",children:r[5]},a++)):void 0!==r[6]?t.push(
31
- /* @__PURE__ */c("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},a++)):void 0!==r[7]&&t.push(/* @__PURE__ */c("em",{children:r[7]},a++)),n=k.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function z({alt:e}){const t=e.replace(/^screenshot:\s*/i,""),r=a().markdown;/* @__PURE__ */
31
+ /* @__PURE__ */c("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},a++)):void 0!==r[7]&&t.push(/* @__PURE__ */c("em",{children:r[7]},a++)),n=k.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function z({alt:e}){const t=e.replace(/^screenshot:\s*/i,""),a=n().markdown;/* @__PURE__ */
32
32
  return d("div",{className:"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-3 text-gray-500",children:[
33
- /* @__PURE__ */c(n,{name:"camera",look:"mini",className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),
33
+ /* @__PURE__ */c(r,{name:"camera",look:"mini",className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),
34
34
  /* @__PURE__ */d("span",{className:"text-xs",children:[
35
- /* @__PURE__ */c("span",{className:"font-medium text-gray-600",children:`${r.screenshot} — `}),t]})]})}function j(e,t){const r=[];for(const n of e){const e=t.exec(n);e?r.push(e[1]):r.length&&(r[r.length-1]+=" "+n.trim())}return r}var I=e=>e.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(e=>e.trim());function O(e,t){const r=e.split("\n"),n=r[0],a=/^(#{2,4})\s+(.*)$/.exec(n);if(a&&1===r.length){const e=a[1].length;/* @__PURE__ */
35
+ /* @__PURE__ */c("span",{className:"font-medium text-gray-600",children:`${a.screenshot} — `}),t]})]})}function j(e,t){const r=[];for(const n of e){const e=t.exec(n);e?r.push(e[1]):r.length&&(r[r.length-1]+=" "+n.trim())}return r}var I=e=>e.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(e=>e.trim());function O(e,t){const r=e.split("\n"),n=r[0],a=/^(#{2,4})\s+(.*)$/.exec(n);if(a&&1===r.length){const e=a[1].length;/* @__PURE__ */
36
36
  return c(`h${e}`,{className:2===e?"mt-2 text-sm font-semibold uppercase tracking-wide text-gray-500":3===e?"mt-1 text-base font-semibold text-gray-900":"mt-1 text-sm font-semibold text-gray-900",children:$(a[2])},t)}if(1===r.length&&/^---+$/.test(n))/* @__PURE__ */
37
37
  return c("hr",{className:"border-gray-200"},t);if(function(e){return e.length>=2&&e[0].includes("|")&&/^\s*\|?[\s:|-]*-[\s:|-]*\|?\s*$/.test(e[1])&&e[1].includes("-")}(r))return function(e,t){const r=I(e[0]),n=e.slice(2).map(I);/* @__PURE__ */
38
38
  return c("div",{className:"my-1 overflow-x-auto rounded-lg border border-gray-200",children:/* @__PURE__ */d("table",{className:"w-full border-collapse text-sm",children:[