efficient-shell 7.63.0 → 7.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{Browser-2EWFLK6R.js → Browser-LJYNAN55.js} +14 -14
- package/dist/Calculator-2F664I3G.js +29 -0
- package/dist/ConfirmDialog-EORVHGKM.js +1 -0
- package/dist/{CurrencyConverter-RT5WIUCM.js → CurrencyConverter-Z45C4SNW.js} +7 -7
- package/dist/{Documents-AEYU2PZT.js → Documents-H2L7GKM7.js} +25 -25
- package/dist/Files-VNNIH6KD.js +87 -0
- package/dist/Notepad-4YMVON4T.js +25 -0
- package/dist/PdfViewer-X4337266.js +1 -0
- package/dist/{PomodoroTimer-S5I57YDE.js → PomodoroTimer-SSNVNS25.js} +11 -11
- package/dist/{Preview-4HUSONTN.js → Preview-GO4GYEQI.js} +8 -8
- package/dist/Sidebar-GZ73VXN7.js +43 -0
- package/dist/{Spreadsheet-QBMJD2AP.js → Spreadsheet-KBN7SHI7.js} +14 -14
- package/dist/{Stock-APMSVB5J.js → Stock-A2ANAULX.js} +3 -3
- package/dist/{Weather-PHUSTWBQ.js → Weather-56JGRYFP.js} +17 -17
- package/dist/{WorldClock-WQY6DN7N.js → WorldClock-ZH5TZEMM.js} +6 -6
- package/dist/ai/index.js +13 -13
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-MHGVLZYL.js → chunk-5DTPO25W.js} +1 -1
- package/dist/{chunk-UCZFCKKS.js → chunk-5S6Y2M26.js} +12 -12
- package/dist/{chunk-LW5XF5JD.js → chunk-5SXGTGQE.js} +1 -1
- package/dist/chunk-6VMVPEYG.js +1 -0
- package/dist/{chunk-SYFDOMTA.js → chunk-AWT4Z7PI.js} +1 -1
- package/dist/{chunk-AAHMUDUP.js → chunk-BE6F2GAI.js} +2 -2
- package/dist/{chunk-BVETBHYF.js → chunk-BEBIR37J.js} +1 -1
- package/dist/{chunk-5THIN3JV.js → chunk-BF6PTZ6R.js} +17 -17
- package/dist/chunk-CSZF4UIL.js +14 -0
- package/dist/{chunk-3G5E2R7F.js → chunk-DI5PZENO.js} +63 -63
- package/dist/{chunk-BJ47M4AR.js → chunk-DXCKYXRV.js} +1 -1
- package/dist/chunk-ENVRURGD.js +2 -0
- package/dist/chunk-FZQ4UFRE.js +27 -0
- package/dist/{chunk-RWIFSTEK.js → chunk-GGDCR6GM.js} +1 -1
- package/dist/chunk-HWH4UHIU.js +2 -0
- package/dist/{chunk-3NRCLNCH.js → chunk-HWNAQ5MF.js} +7 -7
- package/dist/{chunk-JDS2IFBP.js → chunk-JNNGFK5N.js} +1 -1
- package/dist/{chunk-C6IR6W7P.js → chunk-KIOZ54V3.js} +5 -5
- package/dist/chunk-M4RQIHBG.js +2 -0
- package/dist/{chunk-KYBZBZEP.js → chunk-MSH7WWFL.js} +9 -9
- package/dist/{chunk-WPXX6GY2.js → chunk-OLTYKIFI.js} +1 -1
- package/dist/{chunk-UNBLH4EQ.js → chunk-Q4VC5ZVW.js} +16 -16
- package/dist/{chunk-SMFD6EID.js → chunk-RJKDF5LT.js} +2 -2
- package/dist/chunk-RQPZ4YYJ.js +1039 -0
- package/dist/{chunk-UYKGVCZO.js → chunk-S3IYYSTT.js} +1 -1
- package/dist/chunk-SB5KBKVJ.js +1 -0
- package/dist/{chunk-OKPYIQ2Q.js → chunk-UHTNN7UK.js} +8 -8
- package/dist/{chunk-2RPTKZSC.js → chunk-WA3MF5IV.js} +4 -4
- package/dist/{chunk-TJR6B3YD.js → chunk-XUOJSJR3.js} +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/{index-D16PP-U7.d.ts → index-Do4cL9nW.d.ts} +13 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +688 -688
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +5 -5
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{strings-mUwozHxH.d.ts → strings-BXfu1R53.d.ts} +10 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-XECRZGNK.js +0 -29
- package/dist/ConfirmDialog-IZ3NJINY.js +0 -1
- package/dist/Files-FHHYHLPN.js +0 -87
- package/dist/Notepad-OVG7P57T.js +0 -25
- package/dist/PdfViewer-EVJRMYTK.js +0 -1
- package/dist/Sidebar-7BYOIUQK.js +0 -44
- package/dist/chunk-I33KGECT.js +0 -5
- package/dist/chunk-K3WWKV3D.js +0 -1
- package/dist/chunk-LHHIRTEG.js +0 -2
- package/dist/chunk-MCHZT2FL.js +0 -1040
- package/dist/chunk-RUBR4GCW.js +0 -27
- package/dist/chunk-TT6QOFWA.js +0 -2
- package/dist/chunk-W7W4JMOT.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
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-
|
|
2
|
-
return
|
|
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-HWH4UHIU.js";import{CopyButton as d}from"./chunk-5DTPO25W.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-MSH7WWFL.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-YJIG2KT3.js";import{reportBoundaryError as C}from"./chunk-KNUR2UEG.js";import{confirm as M,dialogA11y as N}from"./chunk-Q4VC5ZVW.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-76DRQSJM.js";import{useShellStrings as A}from"./chunk-SB5KBKVJ.js";import{LoadingSpinner as D}from"./chunk-2J6F4EE7.js";import{createContext as I,useContext as P,Component as K,useLayoutEffect as W,useRef as $,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
|
+
return J("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
3
|
/* @__PURE__ */G(z,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
|
-
/* @__PURE__ */
|
|
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=A().undo,o=n?.claimOwnMount;if(
|
|
8
|
-
return
|
|
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(W(()=>{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
|
+
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
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
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__ */
|
|
@@ -14,74 +14,74 @@ return G(p,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,classN
|
|
|
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
|
-
return G(p,{status:"404",title:i.notFound,className:ze})}function Pe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */G(
|
|
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(
|
|
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
|
|
20
|
-
/* @__PURE__ */G("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */
|
|
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 We(e){return"string"==typeof e&&(e.startsWith("new-")||Ke.test(e))}function $e(e){if(We(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=$(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),W(()=>{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=$(/* @__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&&$e(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=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=We(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=$(null),[c,d]=R({w:n,h:Math.round(.75*r)}),[u,h]=R(!1);return W(()=>{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
|
+
/* @__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
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
|
|
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=
|
|
24
|
-
return
|
|
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__ */
|
|
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]=
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
return
|
|
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=$(null),[c,d]=R({left:-9999,top:-9999,ready:!1}),[u,h]=R(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");W(()=>{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
|
+
/* @__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
|
+
return J("div",{className:"group flex flex-col items-center",onMouseEnter:()=>it(t),children:[!m&&/* @__PURE__ */G("span",{className:p,children:e.label}),
|
|
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(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=$(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
|
+
/* @__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(z,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
|
|
29
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
|
-
/* @__PURE__ */G("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */G(z,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */
|
|
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(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
|
-
/* @__PURE__ */
|
|
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
34
|
/* @__PURE__ */G(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
35
|
-
/* @__PURE__ */
|
|
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
|
-
/* @__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]=
|
|
40
|
-
return
|
|
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:
|
|
38
|
+
/* @__PURE__ */J(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
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=$(o);W(()=>{a.current=o},[o]);const s=F(be,ge,ge),l=$(/* @__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
|
+
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
|
+
/* @__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;
|
|
43
43
|
/* @__PURE__ */
|
|
44
|
-
return G(me.Provider,{value:c(e),children:/* @__PURE__ */G(xe,{fallback:(t,n)=>/* @__PURE__ */G(Kr,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */G(ve,{error:t,onReload:n})}),children:/* @__PURE__ */G(Ft,{spec:Be(e),children:/* @__PURE__ */G(jr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */G(He,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */G(Xe,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var mt=null,pt=/* @__PURE__ */new Set;function ft(){return mt}function wt(e){if(mt!==e){mt=e;for(const e of pt)e()}}function yt(e){return pt.add(e),()=>{pt.delete(e)}}var gt=!1,bt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},vt=()=>{};function xt(e){gt=e,bt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function kt(e,t){gt&&("submenu"===e?bt.submenus++:bt.menus++,bt.menuKey=t)}function Et(e){if(!gt)return vt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!gt)return;const r=performance.now()-t;"move"===e?bt.moveMs+=r:bt.resizeMs+=r}}function Ct(){const e=bt;return bt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Mt=/* @__PURE__ */new Set([g,b]),Nt=e=>Mt.has(e)||"function"==typeof e&&"badge"===e.titleRole,St=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Lt=/* @__PURE__ */new Set(["svg"]);function Tt(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return zt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function zt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>zt(e,t,n));if(!j(e))return;const r=e;if(r.type===d)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===B)return void H.toArray(r.props.children).forEach(e=>zt(e,t,n));if("string"==typeof r.type){if(Lt.has(r.type))return;if(!St.has(r.type))return n.push(" "),H.toArray(r.props.children).forEach(e=>zt(e,t,n)),void n.push(" ")}const o=
|
|
45
|
-
return G(
|
|
46
|
-
return G("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-
|
|
47
|
-
return
|
|
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]=
|
|
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:J,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]=O(()=>r()),pe=f()&&!ue,fe=w()&&!!J,[we,ye]=O(0),[ge,be]=O(!1),ve=W(null),Ee=W(0);R(()=>{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);R(()=>{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]=O(c),Te=A(),ze=Te.window;R(()=>{Le(c)},[c]);const Ae=U(()=>Ht(Se).trim()||void 0,[Se]),De=X(),[Ie,Pe]=O(!1),Ke=W(!1),[$e,We]=O(!1),[Re,Oe]=O(null),qe=P(Ot),Be=P(me),{prefs:He,save:Ye}=y(),Ue=!!He.window_accent_stripe,Xe=He.favorite_documents||[],Je=!!qe&&Xe.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),_e=q(()=>{if(!qe)return;const e=Je?Xe.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Xe,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ye({favorite_documents:e})},[qe,Je,Xe,Ye]),[Ve,Ge]=O(null),[Ze,Qe]=O("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]=O(!1),lt=W(null),ct=!!(b||D||I)||at,dt=P(ke),ut=""!==P(Rt),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&&!J&&!_&&!ee&&!pe,gt=/* @__PURE__ */G(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),bt=d&&j(d)?Y(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();Oe(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;R(()=>{if(J)return jn.add(Nt),()=>{jn.delete(Nt)}},[J,Nt]),R(()=>{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]=O(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&&!J,Ft=It&&Wt,[qt,Yt]=O(!1),Ut=Ft&&$t===Nt,[Jt,_t]=O(!1),Vt=Jt&&Wt&&Kt===Nt?"picked":null,Zt=W(Ft);R(()=>{if(Zt.current&&!Ft){_t(!0);const e=setTimeout(()=>{_t(!1),kr===Nt&&Nr(null)},700);return Zt.current=Ft,()=>clearTimeout(e)}Zt.current=Ft},[Ft,Nt]),R(()=>{Ft||Yt(!1)},[Ft]),R(()=>{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]),R(()=>{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 Qt=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;R(()=>{if(!t)return;Wn(Nt,on,ht.current??void 0),se||Fn(Nt),Qt.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=Yn(),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),Oe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Fn(Nt);const t=In.current,n=function(e,t=Yn()){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=!J&&"maximized"===yn(),[ln,cn]=O(()=>{if(on&&rn[on]){const e={...rn[on]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),Vn(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:sn?en():tn()}),[dn,un]=O(()=>!ne),hn=W(ue),mn=W(null);R(()=>{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&&!J&&!pe,vn=pn,kn=W(vn);kn.current=vn;const Cn=An(),Mn=ue&&!!Be?.tab&&!J&&!pe&&!It&&Cn!==Be.key,[zn,Dn]=O(()=>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??(J?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)),J||(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,J,re,ct,pn]),$(()=>{if(!ne||!dn||J||!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,J,t,zn,re]);const Kn=!1!==oe&&!J&&!ee&&!pe,[$n,Rn]=O(()=>!Kn);$(()=>{if($n||!t)return;if(!Kn||zn)return void Rn(!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=()=>Rn(!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 On=W(null),Un=!(!Be?.tab||ut||J||pe);mn.current=t=>{if(!Un)return;if(t)return On.current||(On.current={box:{...In.current},maximized:Pn.current}),void(Pn.current=!0);const r=On.current;On.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(Vn(e))}else cn(tn())},R(()=>{vn&&(Pn.current=!0,Dn(!0),cn(en()))},[vn,en]),R(()=>{if(J)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(Vn(t))}else cn(tn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[J,tn,on]),R(()=>{t&&on&&!pn&&(rn[on]=ln,an()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[ln,t,on,pn]),R(()=>{if(!t)return;const e=()=>{Pn.current?cn(en()):document.body.classList.contains("rosh-gesturing")||cn(Vn)};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]),R(()=>{if(t&&(Pe(!1),Ke.current=!1,et.current=!1,Rn(!Kn),!kn.current)){if(on&&rn[on]){const e=rn[on];return void cn(t=>Vn({...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]),R(()=>{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,Qn=U(()=>Tt(Se),[Se]),nr=W({shortcutSpec:qe,isOnDesktop:Je,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar});$(()=>{nr.current={shortcutSpec:qe,isOnDesktop:Je,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar}});const rr=W(null);rr.current||(rr.current={open:(e,t)=>Oe({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}}),R(()=>{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(Oe(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},!J){const t=function(e,t){const n=Yn(),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(Zn(t)):tr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),tr();const e=Vn({...In.current});if(In.current=e,!J&&h){ar.current={x:l,y:c,w:u,h:d};const e=Zn(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(J){const t=e.x+e.w/2,n=window.innerWidth/2;Qe(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(Jn,u+e)),w&&(i=Math.max(_n,h+t)),m){const t=Math.max(Jn,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=Vn(ar.current);return ar.current=null,In.current=e,void cn(e)}return void qn(Nt)}e(),Dn(!1);const t=Zn(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(Jn,o.w+24*n),h:Math.max(_n,o.h+24*r)}:Vn({...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=Zn(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()}},[]);R(()=>{if(!t)return;if(J)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,J]),R(()=>{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]),R(()=>{if(!t)return;if(J)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,J,pn,K]);const Lr=t&&(void 0!==p||void 0!==g),[Ar]=O(()=>{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&&(Qn.actions.length>0||Lr);R(()=>{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:Qn.text||Ae,dirty:Xn,copy:Qn.copy,actions:Dr&&Ar?Ar:void 0,menu:rr.current??void 0})},[t,Gn,Ae,Xn,Qn.text,Qn.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(R(()=>{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=Yn(),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||Ut;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(Jt&&Wt){const e="picked"===Vt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:L.expose+30}:{}}}return null})(),Wr=N({modal:!1,titleId:!J&&(pn?!Be?.home:!pe)?De:void 0,label:Qn.text||Ae}),Rr=/* @__PURE__ */V("div",{children:[
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */G("h2",{id:De,"data-window-title":!0,className:"sr-only",children:
|
|
52
|
-
/* @__PURE__ */
|
|
44
|
+
return G(me.Provider,{value:c(e),children:/* @__PURE__ */G(xe,{fallback:(t,n)=>/* @__PURE__ */G(Kr,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */G(ve,{error:t,onReload:n})}),children:/* @__PURE__ */G(Ft,{spec:Be(e),children:/* @__PURE__ */G(jr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */G(He,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */G(Xe,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var mt=null,pt=/* @__PURE__ */new Set;function ft(){return mt}function wt(e){if(mt!==e){mt=e;for(const e of pt)e()}}function yt(e){return pt.add(e),()=>{pt.delete(e)}}var gt=!1,bt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},vt=()=>{};function xt(e){gt=e,bt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function kt(e,t){gt&&("submenu"===e?bt.submenus++:bt.menus++,bt.menuKey=t)}function Et(e){if(!gt)return vt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!gt)return;const r=performance.now()-t;"move"===e?bt.moveMs+=r:bt.resizeMs+=r}}function Ct(){const e=bt;return bt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Mt=/* @__PURE__ */new Set([g,b]),Nt=e=>Mt.has(e)||"function"==typeof e&&"badge"===e.titleRole,St=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Lt=/* @__PURE__ */new Set(["svg"]);function Tt(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return zt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function zt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>zt(e,t,n));if(!j(e))return;const r=e;if(r.type===d)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===B)return void H.toArray(r.props.children).forEach(e=>zt(e,t,n));if("string"==typeof r.type){if(Lt.has(r.type))return;if(!St.has(r.type))return n.push(" "),H.toArray(r.props.children).forEach(e=>zt(e,t,n)),void n.push(" ")}const o=U(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Nt(r.type)?t.badges:t.actions).push(o)}var At=/* @__PURE__ */new Map,Dt=/* @__PURE__ */new Set,It=0;function Pt(){It++,Dt.forEach(e=>e())}function Kt(e){return At.get(e)}function Wt(e){return Dt.add(e),()=>{Dt.delete(e)}}function $t(){return It}var Ot=I(""),Rt=I(null);function Ft({spec:e,children:t}){/* @__PURE__ */
|
|
45
|
+
return G(Rt.Provider,{value:e,children:t})}var qt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),jt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Bt='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Ht(e){return Ut(e).replace(/\s+/g," ").trim()}function Ut(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(Ut).join("");if(j(e)){const t=e,n="string"==typeof t.type?t.type:"";return qt.has(n)?"":` ${Ut(t.props?.children)} `}return""}function Yt(e){const t=P(Ot);O(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var Xt={};function Vt(e,t,n){const r=P(Ot);O(()=>{if(!r)return;Xt[r]||(Xt[r]=[]);const o={label:e,icon:n,onClick:t};return Xt[r].push(o),()=>{Xt[r]=(Xt[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function _t({title:e}){const t=$(null);return O(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */G("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Jt(e){}var Gt=I(null);function Qt(){return P(Ot)}function Zt(){const e=F(hr,ur),t=P(Gt);return t?.active??(bn.length<=1||null!=e)}function en({children:e,position:t="right",quiet:n=!1}){const r=P(Gt),[o,i]=R(null);return O(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?Z(e,o):null}function tn({onClick:e,children:t,className:n}){const r=P(Gt);/* @__PURE__ */
|
|
46
|
+
return G("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-EORVHGKM.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 Wn(e){In===e&&(In=null)}function $n(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=$(void 0),l=$(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
|
+
return J("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
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: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=$(null),Ee=$(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=$(!1),[We,$e]=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=$(!1),tt=$(null);W(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=$(!1),rt=$(null),ot=$(null),it=$(null),[at,st]=R(!1),lt=$(null),ct=!!(b||D||I)||at,dt=P(ke),ut=""!==P(Ot),ht=$(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=$(`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),Wt=F(Tr,zr),$t=!B&&!V,Ft=It&&$t,[qt,Ut]=R(!1),Yt=Ft&&Wt===Nt,[Vt,_t]=R(!1),Jt=Vt&&$t&&Kt===Nt?"picked":null,Qt=$(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=$(!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=$(!1);t||(nn.current=!1);const on=se||u||null;O(()=>{if(!t)return;$n(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=$(ue),mn=$(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=$(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=$(ln);In.current=ln;const Pn=$(zn);W(()=>{Pn.current=zn},[zn]),W(()=>{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]),W(()=>{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,[Wn,On]=R(()=>!Kn);W(()=>{if(Wn||!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)}},[Wn,t,Kn,zn]);const Rn=$(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=$({shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar});W(()=>{nr.current={shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar}});const rr=$(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]);W(()=>{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=$(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,Wr=(()=>{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&&$t){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})(),$r=N({modal:!1,titleId:!V&&(pn?!Be?.home:!pe)?De:void 0,label:Zn.text||Ae}),Or=/* @__PURE__ */J("div",{children:[
|
|
50
|
+
/* @__PURE__ */J("div",{ref:tt,"data-modal-panel":!0,"data-modal-id":Nt,"data-window-key":se||void 0,...B?{"data-utility":""}:{},...We?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...Be?{"data-window-owner":Be.key}:{},...Be&&!ut?{"data-window-root":""}:{},...pn?{"data-window-tab":""}:{},...$r,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&&!We&&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||We||Ne&&se===Ne?{}:{display:"none"}}:{zIndex:We?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&&!We?{display:"none"}:{},...fe?{display:"none"}:{},...Mn?{visibility:"hidden",pointerEvents:"none"}:{},...Wr??{}},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
|
+
/* @__PURE__ */G("h2",{id:De,"data-window-title":!0,className:"sr-only",children:Zn.text||Ae}),Dr&&Ar&&Z(
|
|
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:[
|
|
53
53
|
/* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-2 py-0.5 font-medium text-gray-500",title:ze.prev,children:"K"}),
|
|
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),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */
|
|
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
|
+
/* @__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
|
+
/* @__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-2 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>$e(e=>!e),title:We?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(We?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3 w-3",fill:We?"currentColor":"none",strokeWidth:1.5})}),
|
|
58
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
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */
|
|
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-2 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>$e(e=>!e),title:We?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(We?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3 w-3",fill:We?"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
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-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:[
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */
|
|
63
|
+
/* @__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(),
|
|
64
|
+
/* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-3 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:()
|
|
68
|
+
/* @__PURE__ */G("span",{children:ze.next})]}),B&&/* @__PURE__ */G("button",{onClick:()=>$e(e=>!e),title:We?ze.unpin:ze.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(We?"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:We?"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(z,{name:"close",className:"h-5 w-5"})})]})]}),ce&&
|
|
72
|
-
/* @__PURE__ */G(
|
|
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
|
+
/* @__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
|
-
/* @__PURE__ */G(k,{}),ie&&/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */G(k,{}),ie&&/* @__PURE__ */J(Q,{children:[ie,
|
|
75
75
|
/* @__PURE__ */G(k,{})]}),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */G("span",{className:"flex-1",children:"Always on Top"})
|
|
76
|
+
/* @__PURE__ */J(x,{onClick:()=>{Ge(null),$e(e=>!e)},children:[
|
|
77
|
+
/* @__PURE__ */G("span",{className:"flex-1",children:"Always on Top"}),We&&/* @__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
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
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
|
+
/* @__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
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */G("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),D]})]}),!
|
|
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"}),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,18 +89,18 @@ return V("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:()=>
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */G(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!vn&&/* @__PURE__ */
|
|
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(),
|
|
96
|
-
/* @__PURE__ */G(z,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),B&&!pn&&/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-4 w-4 "+(
|
|
98
|
-
/* @__PURE__ */G(z,{name:"star",className:"h-4 w-4",fill:
|
|
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
|
+
/* @__PURE__ */J(x,{onClick:()=>{qn(Nt),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
|
+
/* @__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(z,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),B&&!pn&&/* @__PURE__ */J(x,{onClick:()=>{$e(e=>!e),Re(null)},children:[
|
|
97
|
+
/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-4 w-4 "+(We?"text-blue-600":""),fill:We?"currentColor":"none",strokeWidth:1.5}),We?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
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */G(z,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Fr=!!se&&Mt.some(e=>e.id===se),qr=!Dt||Fr||
|
|
100
|
+
/* @__PURE__ */J(x,{danger:!0,onClick:()=>{Re(null),or()},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
|
-
/* @__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
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
return
|
|
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(
|
|
105
|
+
/* @__PURE__ */J(Rt.Provider,{value:null,children:[Or,Rr,qr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{fr&&"Escape"===e.key&&(Ar(null),br(!1))});var Wr=100,$r={past:[],future:[]};function Or(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Wr?r.slice(r.length-Wr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:$r}}var Rr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Fr=500,qr=250;function jr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=V(Or,$r),s=$(/* @__PURE__ */new Map),[l,c]=R(0),d=l>0,[u,h]=R(0),[m,p]=R(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===u&&(!(n&&n.length>0)||w(n)),g=$(null),b=$(!1),v=q(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=q((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=q(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=q(e=>{h(t=>t+(e?1:-1))},[]),C=q(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=R(0),S=M>0,L=q(e=>{N(t=>t+(e?1:-1))},[]),T=P(ke),z=T?.claimReadOnly;O(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;O(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=$({last:0,count:0,tripped:!1}),I=$(!1),K=q((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(I.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>qr&&(r.count=0),r.last=o,++r.count>Fr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Fr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,v]),W=q(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),F=q(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"undo",redoStep:t})},[o.past,v,W]),j=q(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"redo",undoStep:t})},[o.future,v,W]),[B,H]=R(0),U=$(0),X=$(0),_=$(!1),Q=q(()=>{b.current=!0,I.current=!1,g.current=null,U.current+=1,X.current=U.current,H(U.current)},[]),Z=$(void 0),ee=q(e=>{void 0!==e&&(void 0!==Z.current&&e!==Z.current&&(_.current=!0),Z.current=e),Q()},[Q]);O(()=>{b.current&&B===X.current&&(b.current=!1,g.current=null,(I.current||_.current)&&a({type:"clear"}),I.current=!1,_.current=!1)},[B]);const te=q(()=>{_.current=!0,a({type:"clear"}),Q()},[Q]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=pr(r),ie=$({undo:F,redo:j,canUndo:ne,canRedo:re});ie.current={undo:F,redo:j,canUndo:ne,canRedo:re},O(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&Rr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=Y(()=>({register:x,unregister:k,record:K,undo:F,redo:j,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:d,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,K,F,j,te,ee,ne,re,y,d,S,L,E,f,C,o.past,o.future]),se=""!==Qt(),le=P(Gt)?.footerOpen??!1,ce=se&&y&&d&&!S&≤/* @__PURE__ */
|
|
106
|
+
return J(ke.Provider,{value:ae,children:[ce&&/* @__PURE__ */G(en,{position:"left",quiet:!0,children:/* @__PURE__ */G(Ce,{auto:!0})}),e]})}function Br(){const e=P(ke),t=q(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function Hr(e){const t=P(ke),n=t?.claimReadOnly,r=t?.claimEditable;O(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Ur(e,t,n){const r=P(ke),o=X(),i=$(e),a=$(t);a.current=t,O(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=$(r);c.current=r;const d=$({label:s,coalesceKey:l});d.current={label:s,coalesceKey:l},O(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function Yr(e,t){const[n,r]=R(e);return Ur(n,e=>r(()=>e),t),[n,r]}export{tn as CancelButton,Ue as DocFavStar,Ie as EntityWindowFallback,Ae as EntityWindowLoading,Pe as EntityWindowState,Bt as KEY_ACTIVATED_SELECTOR,Te as LoadingSpinner,jt as MODAL_SUBMIT_SELECTOR,Kr as Modal,en as ModalActions,Ce as UndoControls,jr as UndoProvider,se as WINDOW_REGISTRY,ve as WindowCrashedFallback,xe as WindowErrorBoundary,ht as WindowManagerProvider,_t as WindowTitle,Je as activateWindowById,Et as beginWindowGesture,Wn as cancelWindowFront,he as client_default,Dr as commitExposeHighlight,Ct as drainPerfEvents,xr as exitExposeMode,pn as forgetMaximizedWindowBoxes,ur as getActiveModalId,et as getActiveWindowRoute,zr as getExposeHighlight,$t as getWindowChromeVersion,hn as getWindowPosition,We as isDraftEntityId,$e as isDraftEntityWindow,oe as isEntityEntry,re as isPageEntry,de as isShellApiClientConfigured,Ge as isTabWindow,kt as markMenuOpen,Kt as readWindowChrome,Kn as requestWindowFront,Ar as setExposeHighlight,xt as setPerfCollecting,ce as setShellApiClient,ye as setShellHomeRoute,ae as setShellWindowRegistry,un as setWindowDefaultPosition,mn as setWindowPosition,Tt as splitTitle,Tr as subscribeExposeHighlight,Wt as subscribeWindowChrome,vr as toggleExposeMode,An as useCurrentTabKey,Qt as useEnclosingModalId,pr as useIsActiveWindow,Zt as useModalActive,pe as usePageSearch,Br as useUndo,Hr as useUndoCanEdit,Ur as useUndoable,Yr as useUndoableState,Yt as useWidgetSettings,Fe as useWindowDirty,je as useWindowManager,Vt as useWindowMenuItem,Jt as useWindowTitle};
|