efficient-shell 14.2.0 → 14.4.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 +39 -1
- package/dist/{Browser-PL2P7EIZ.js → Browser-YFL2F4RL.js} +16 -16
- package/dist/{Calculator-WMYHPFPA.js → Calculator-VUM3R6HA.js} +22 -22
- package/dist/CodeEditor-D6V_rQOK.d.ts +55 -0
- package/dist/CodeEditor-ZTFRQLZM.js +1 -0
- package/dist/{CurrencyConverter-3B7YXRLL.js → CurrencyConverter-HEMRND5M.js} +5 -5
- package/dist/{Files-F3H7Z75F.js → Files-INFMXPDR.js} +76 -76
- package/dist/{Notepad-EEULMM65.js → Notepad-B6Z7RWAN.js} +9 -9
- package/dist/{PdfViewer-FWGHFO4N.js → PdfViewer-MSQ2RVGH.js} +1 -1
- package/dist/{PomodoroTimer-RZSYRTLV.js → PomodoroTimer-W6IPEIRY.js} +65 -65
- package/dist/{Preview-DUJIVUKT.js → Preview-WN6DQEL4.js} +46 -46
- package/dist/{Sidebar-2TYZENQL.js → Sidebar-6DMRN4XR.js} +1 -1
- package/dist/{Stock-FHC5TFGK.js → Stock-A6O3UHM4.js} +1 -1
- package/dist/{Weather-LYX5G6CZ.js → Weather-LUQQVJ2E.js} +20 -20
- package/dist/{WorldClock-MULNQEIS.js → WorldClock-ZO5EEEBS.js} +6 -6
- package/dist/ai/index.js +50 -50
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/FlowChart.js +1 -1
- package/dist/{chunk-BUUAALHH.js → chunk-26BUX7P6.js} +7 -7
- package/dist/chunk-366URRSE.js +4 -0
- package/dist/{chunk-UYZJT3AS.js → chunk-4MJNMXNJ.js} +3 -3
- package/dist/{chunk-NGFBYHDM.js → chunk-6GDVURG7.js} +1 -1
- package/dist/{chunk-PWERFHOU.js → chunk-6JPSVHUK.js} +9 -9
- package/dist/chunk-AFI3WCVM.js +1 -0
- package/dist/chunk-AKDPGEBE.js +1 -0
- package/dist/{chunk-3QRCPC7V.js → chunk-CG2GLJBL.js} +1 -1
- package/dist/{chunk-WNFZYTWW.js → chunk-D4Q33KXQ.js} +1 -1
- package/dist/{chunk-AZZ4NO2D.js → chunk-EEAOFYW5.js} +1 -1
- package/dist/{chunk-EHSK43WG.js → chunk-F7XL3XA2.js} +4 -4
- package/dist/{chunk-Y2M5PP2C.js → chunk-GNJXN5TU.js} +9 -9
- package/dist/{chunk-H56OE6Q5.js → chunk-J44PLTRE.js} +47 -47
- package/dist/chunk-JRRTJ3NV.js +1 -0
- package/dist/chunk-SKMXSDRJ.js +1 -0
- package/dist/{chunk-PEA5Y6DD.js → chunk-TFQC67XR.js} +12 -12
- package/dist/{chunk-6GRTHDQC.js → chunk-UB6DFJKA.js} +1 -1
- package/dist/{chunk-REFPTKRD.js → chunk-UYUNREAL.js} +2 -2
- package/dist/{chunk-Z2Z653OO.js → chunk-VR5MGNKG.js} +9 -9
- package/dist/{chunk-YTLUSBDY.js → chunk-W2HDWDS6.js} +10 -10
- package/dist/{chunk-Y7D2CZ4H.js → chunk-WTWAFKFN.js} +3 -3
- package/dist/{chunk-SFP5RZNY.js → chunk-XAPK3RVF.js} +1 -1
- package/dist/code/format.d.ts +16 -0
- package/dist/code/format.js +1 -0
- package/dist/code/index.d.ts +3 -15
- package/dist/code/index.js +1 -1
- package/dist/data/EntityList.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/icons/brands.node.js +1 -1
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/payment.js +3 -3
- package/dist/icons/sets.js +1 -1
- package/dist/index.js +144 -144
- package/dist/map/index.js +7 -7
- package/dist/pdf/index.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/StepChain.js +1 -1
- package/dist/shell/Text.d.ts +4 -2
- package/dist/shell/Text.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +6 -0
- package/dist/value-index.json +1 -1
- package/dist/version.js +1 -1
- package/package.json +11 -1
- package/dist/CodeEditor-VN76K3MD.js +0 -1
- package/dist/chunk-5KUE6IHF.js +0 -4
- package/dist/chunk-JBZ4WNI3.js +0 -1
- package/dist/chunk-QYRBRJDN.js +0 -1
- package/dist/chunk-RRVQT6RE.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,scrollerIsFluid as i,growBoxToWidth as a,widthToFit as s,navIcons as l}from"./chunk-4LXCCZDM.js";import{reportBoundaryError as c}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as u}from"./chunk-JDCM2VHG.js";import{WindowInsetContext as d,NO_WINDOW_DRAG as m}from"./chunk-YI4T5I5D.js";import{Result as h}from"./chunk-PSVGB7KT.js";import{CMD_Z as f,CMD_SHIFT_Z as p}from"./chunk-TTD2M6RF.js";import{CopyButton as w}from"./chunk-TJ5YMXVB.js";import{confirm as y}from"./chunk-2XDO7FZC.js";import{useModalDragAside as g}from"./chunk-EIFNESXS.js";import{ItemCount as v}from"./chunk-7WF6LFOJ.js";import{isInOverlayOver as b}from"./chunk-CJ4OEY3T.js";import{dialogA11y as x}from"./chunk-VWGWZY7A.js";import{ColoredBadge as k}from"./chunk-6X32SWQI.js";import{
|
|
1
|
+
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,scrollerIsFluid as i,growBoxToWidth as a,widthToFit as s,navIcons as l}from"./chunk-4LXCCZDM.js";import{reportBoundaryError as c}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as u}from"./chunk-JDCM2VHG.js";import{WindowInsetContext as d,NO_WINDOW_DRAG as m}from"./chunk-YI4T5I5D.js";import{Result as h}from"./chunk-PSVGB7KT.js";import{CMD_Z as f,CMD_SHIFT_Z as p}from"./chunk-TTD2M6RF.js";import{CopyButton as w}from"./chunk-TJ5YMXVB.js";import{confirm as y}from"./chunk-2XDO7FZC.js";import{useModalDragAside as g}from"./chunk-EIFNESXS.js";import{ItemCount as v}from"./chunk-7WF6LFOJ.js";import{isInOverlayOver as b}from"./chunk-CJ4OEY3T.js";import{dialogA11y as x}from"./chunk-VWGWZY7A.js";import{ColoredBadge as k}from"./chunk-6X32SWQI.js";import{ROW_HEIGHTS as E}from"./chunk-AW7TOB6N.js";import{parseOption as M}from"./chunk-YPXONNBV.js";import{LoadingSpinner as C}from"./chunk-4PJFL26P.js";import{activationOrder as S,activeListeners as N,ModalActionsContext as L,subscribeActive as T,getActiveModalId as z,KEY_ACTIVATED_SELECTOR as A}from"./chunk-F3ZOO23R.js";import{useShellAuth as D}from"./chunk-2QY5BJLA.js";import{useIsMobile as P,useIsPhone as I}from"./chunk-UGTRSRIW.js";import{useShellPrefs as R}from"./chunk-POBVGDZP.js";import{DropdownMenu as W}from"./chunk-M5IZ7QLQ.js";import{focusableIn as O}from"./chunk-DWGYC7OD.js";import{StatusBadge as $}from"./chunk-EDRELF6L.js";import{PopupMenu as K,PopupMenuItem as j,PopupMenuDivider as F,PopupMenuLabel as B}from"./chunk-RTK77DMP.js";import{Button_default as q}from"./chunk-MEP6CZJ3.js";import{LoadingSpinner as Y}from"./chunk-R2VKEMZH.js";import{Icon as H}from"./chunk-ISVODSRP.js";import{Z_LAYERS as U}from"./chunk-62LW225J.js";import{shellHttp as X,isShellHttpConfigured as V}from"./chunk-STKJA4PV.js";import{fitBoxScale as J,fitFrameStyle as G}from"./chunk-M6UKCZHT.js";import{buttonClasses as _}from"./chunk-UQYNPYF4.js";import{runEscapeInterceptors as Z}from"./chunk-TWVUQUUD.js";import{useShellStrings as Q}from"./chunk-NRHG4R2Q.js";import{createContext as ee,createElement as te,useContext as ne,Component as re,useLayoutEffect as oe,useRef as ie,useEffect as ae,useState as se,useSyncExternalStore as le,useCallback as ce,isValidElement as ue,Fragment as de,Children as me,cloneElement as he,useMemo as fe,useId as pe,useReducer as we,Suspense as ye}from"react";import{jsxs as ge,jsx as ve,Fragment as be}from"react/jsx-runtime";import{createPortal as xe}from"react-dom";import{useLocation as ke}from"react-router-dom";import{useQueryClient as Ee,useQuery as Me}from"@tanstack/react-query";function Ce(e){return"component"in e}function Se(e){return"endpoint"in e}var Ne={};function Le(e){Ne=e}var Te=new Proxy({},{get:(e,t)=>Ne[t],has:(e,t)=>t in Ne,ownKeys:()=>Object.keys(Ne),getOwnPropertyDescriptor(e,t){if(t in Ne)return{configurable:!0,enumerable:!0,value:Ne[t]}}});function ze(){return V()}var Ae=X,De=ee({});function Pe({value:e,children:t}){return te(De.Provider,{value:e},t)}function Ie(){return ne(De)}var Re=ee(null);function We(){return ne(Re)?.pageSearch??""}var Oe=null,$e=/* @__PURE__ */new Set;function Ke(e){Oe!==e&&(Oe=e,$e.forEach(e=>e()))}function je(){return Oe}function Fe(e){return $e.add(e),()=>{$e.delete(e)}}var Be=null;function qe(e){Be=e}function Ye({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
|
|
2
2
|
return ge("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
-
/* @__PURE__ */ve(
|
|
3
|
+
/* @__PURE__ */ve(H,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
4
|
/* @__PURE__ */ge("div",{className:"min-w-0",children:[
|
|
5
5
|
/* @__PURE__ */ve("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__ */ve("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)})]}),
|
|
@@ -8,66 +8,66 @@ return ge("div",{className:"flex-1 flex flex-col items-center justify-center gap
|
|
|
8
8
|
return ge("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
9
|
/* @__PURE__ */ve("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",f):r.nothingToUndo,className:Xe,children:r.undo}),
|
|
10
10
|
/* @__PURE__ */ve("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",p):r.nothingToRedo,className:Xe,children:r.redo})]})}var Je=/* @__PURE__ */new Set([408,429]);function Ge(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function _e(e){const t=Ge(e);return null!=t&&(t>=400&&t<500&&!Je.has(t))}function Ze(e,t){return!_e(t)&&e<3}function Qe(e){if("page"!==e.type)return!0;const t=e.route?Te[e.route]:void 0;if(!t||!Ce(t))return!0;const n=t;return!n.widget&&!n.utility}function et(e){const t=e.route?Te[e.route]:void 0;if(!t||!Ce(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var tt=(e,t)=>!!t&&"page"===e.type&&e.route===t;var nt="flex-1 min-h-0";function rt(){const e=Q().record;/* @__PURE__ */
|
|
11
|
-
return ve(
|
|
11
|
+
return ve(Y,{label:e.loading,padding:"",className:nt})}function ot(e){return e??void 0}function it({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=Q().record;if(t||e&&n)/* @__PURE__ */return ve(rt,{});if(r){const e=Ge(r);if(401===e)/* @__PURE__ */
|
|
12
12
|
return ve(h,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:nt});if(403===e)/* @__PURE__ */
|
|
13
13
|
return ve(h,{status:"403",className:nt});if(404===e||410===e)/* @__PURE__ */
|
|
14
14
|
return ve(h,{status:"404",title:i.notFound,className:nt});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
15
15
|
return ve(h,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */ve(q,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:nt})}/* @__PURE__ */
|
|
16
16
|
return ve(h,{status:"404",title:i.notFound,className:nt})}function at({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */ve(be,{children:t(e)}):/* @__PURE__ */ve(it,{...n})}var st=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function lt(e){return"string"==typeof e&&(e.startsWith("new-")||st.test(e))}function ct(e){if(lt(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var ut=ee({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),dt=ee(null);function mt(e){const t=ne(dt),n=ie(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),oe(()=>{if(t)return t(n.current,e)},[t,e]),ae(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function ht(){const e=ie(/* @__PURE__ */new Map),[t,n]=se(!1);return{dirty:t,registerDirty:ce((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 ft(){return ne(ut)}function pt(e){if("page"!==e.type&&ct(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 wt({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=ht(),i=Te[e.route];if(!i||!Ce(i))return null;const a=i,s=a.component;/* @__PURE__ */
|
|
17
|
-
return ve(mo,{open:!0,onClose:t,icon:l[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__ */ve(dt.Provider,{value:o,children:/* @__PURE__ */ve(ye,{fallback:/* @__PURE__ */ve("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */ve(
|
|
18
|
-
return ve("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];Ae.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__ */ve(
|
|
17
|
+
return ve(mo,{open:!0,onClose:t,icon:l[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__ */ve(dt.Provider,{value:o,children:/* @__PURE__ */ve(ye,{fallback:/* @__PURE__ */ve("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */ve(C,{})}),children:/* @__PURE__ */ve(s,{})})})})}function yt({entityType:e,entityId:t,label:n}){const r=Q(),o=Ee(),{data:i}=Me({queryKey:["my-profile-sidebar"],enabled:ze(),queryFn:()=>Ae.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
18
|
+
return ve("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];Ae.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__ */ve(H,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var gt=/* @__PURE__ */new Set,vt=()=>"hidden";function bt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=Te[e.entityType];if(!o||!Se(o))return null;const i=o,[a,s]=se(!1),{dirty:c,registerDirty:u}=ht(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,m=e.entitySnapshot?._duplicate,h=lt(e.entityId),f=Ie(),p=(w=e.id,le(T,()=>{const e=Qn.get(w);return null!=e&&Xn.has(e)}));var w;const y=!i.selfFetching&&!m&&!h&&ze(),g=Me({queryKey:[d,e.entityId],queryFn:()=>{return Ae.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:ot(e.entitySnapshot),initialDataUpdatedAt:0,enabled:y,staleTime:0,refetchOnWindowFocus:()=>{return void 0===(e=f.entityRefetchOnWindowFocus)||("function"==typeof e?e():e);var e},refetchOnMount:"always",refetchInterval:e=>function(e,t={}){if(_e(e))return!1;if(t.minimized)return!1;const n=t.hostInterval;if(void 0===n)return 6e4;const r="function"==typeof n?n():n;return"number"==typeof r&&r>0&&r}(e.state.error,{minimized:p,hostInterval:f.entityRefetchInterval}),refetchIntervalInBackground:!1,retry:Ze}),v=g.data,b=g.refetch;ae(()=>{var t;if(y)return t=t=>{t!==e.id||gt.has(t)||b({cancelRefetch:!1})},fr.add(t),()=>{fr.delete(t)}},[b,e.id,y]);const x=ce(()=>{a&&!c?s(!1):t()},[a,c,t]),k=(i.useEdit??vt)(v??null),E=!i.useEdit||h||m?void 0:{state:k,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},M=i.selfFetching?e.label:v?i.title(v,a,s):e.label,S=i.icon,N=S?l[S]:null,L=M,z=!i.selfFetching&&v&&i.footer&&!m?i.footer(v):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */ve(ye,{fallback:/* @__PURE__ */ve(C,{}),children:i.render(v??e.entitySnapshot,t,e.entityId,a,s)}):null!=v?/* @__PURE__ */ve(ye,{fallback:/* @__PURE__ */ve(mo,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */ve(rt,{})}),children:i.render(v,t,e.entityId,a,s)}):/* @__PURE__ */ve(mo,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */ve(it,{isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b})}):/* @__PURE__ */ve(mo,{open:!0,onClose:x,onMinimize:n,initialBox:e.savedBox,icon:N,title:L,footer:z,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||h||m,edit:E,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */ve(dt.Provider,{value:u,children:/* @__PURE__ */ve(ye,{fallback:/* @__PURE__ */ve(rt,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */ve(at,{entity:v,isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function xt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function kt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Et(e){const t=xt(e),n=t??kt(e);if(!n)return;if(t&&!Tr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&pr(o)}function Mt(){const e=z();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Ct=/* @__PURE__ */new Map;function St(){const e=Mt();if(e)return Ct.get(e)}function Nt(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 Lt="rosh-peek-style",Tt=U.peek,zt=U.taskbarPreview;function At(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Lt))return;const e=document.createElement("style");e.id=Lt,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:${Tt}!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 Dt(){"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 Pt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=Q(),l=ie(null),[c,u]=se({w:n,h:Math.round(.75*r)}),[d,m]=se(!1);return oe(()=>{const o=l.current;if(!o)return;const i=xt(e)??Nt(t);if(!i)return void m(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void m(!1);const s=J({width:n,height:r},a),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),m(!0);const h=i.cloneNode(!0);h.style.position="absolute",h.style.top="0",h.style.left="0",h.style.right="auto",h.style.bottom="auto",h.style.width=a.width+"px",h.style.height=a.height+"px";const f=G(a.width,s);return Object.assign(h.style,{transform:f.transform??"",transformOrigin:f.transformOrigin}),h.style.pointerEvents="none",h.style.animation="none",h.style.zIndex="auto",h.removeAttribute("data-modal-panel"),h.removeAttribute("data-modal-id"),h.removeAttribute("data-window-key"),h.removeAttribute("role"),h.removeAttribute("aria-labelledby"),h.removeAttribute("aria-label"),h.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(h),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */ge("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-line-strong shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
19
19
|
/* @__PURE__ */ve("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */ge("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
20
|
-
/* @__PURE__ */ve(
|
|
21
|
-
/* @__PURE__ */ve("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */ve("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-on-accent bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */ve("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-on-accent flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */ve(
|
|
20
|
+
/* @__PURE__ */ve(H,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
|
|
21
|
+
/* @__PURE__ */ve("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */ve("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-on-accent bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */ve("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-on-accent flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */ve(H,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function It({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=Q(),s=e.length>1,l=ie(null),[c,u]=se({left:-9999,top:-9999,ready:!1}),[d,m]=se(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");oe(()=>{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";m(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)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),ae(()=>Dt,[]);const h="top"===d,f=(h?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-ink-strongest bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return xe(
|
|
22
22
|
/* @__PURE__ */ve("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:zt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{Dt(),i()},children:e.map(e=>{const t=xt(e.id)??Nt(e.label),o=t?function(e){if(Tr(e))return null;const t=e.getBoundingClientRect(),n=br(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
|
|
23
23
|
return ge("div",{className:"group flex flex-col items-center",onMouseEnter:()=>At(t),children:[!h&&/* @__PURE__ */ve("span",{className:f,children:e.label}),
|
|
24
24
|
/* @__PURE__ */ve(Pt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),h&&/* @__PURE__ */ve("span",{className:f,children:e.label}),null!==o&&/* @__PURE__ */ge("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-on-accent shadow-sm",children:[
|
|
25
|
-
/* @__PURE__ */ve(
|
|
25
|
+
/* @__PURE__ */ve(H,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function Rt(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 Wt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=Q(),[a,s]=se(null);ae(()=>{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 c=le(T,z),[,u]=se(0);ae(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=se(0);ae(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const m=e=>{const t=Nt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[h,f]=se(null),[p,w]=se(null),[y,g]=se(null),b=ie(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{f(null),w(null)},150)},k=e.filter(e=>!e.route||!Te[e.route]?.utility);if(!a||!a.isConnected||0===k.length)return null;const E=[],M=/* @__PURE__ */new Map;for(const e of k){const t=e.route?Te[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=M.get(r);if(void 0!==o)E[o].items.push(e);else{M.set(r,E.length);const o=n?.label??t?.label??e.label;E.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return xe(
|
|
26
26
|
/* @__PURE__ */ge(be,{children:[E.map(e=>{const n=e.route?l[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(c){const t=document.querySelector(`[data-modal-id="${c}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,u=e.items.some(e=>{const t=xt(e.id)??Nt(e.label);return!!t&&!Tr(t)});/* @__PURE__ */
|
|
27
|
-
return ge("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(()=>{f(n),w(r)},350)));var n,r},onMouseLeave:x,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),f(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&&ue(n)?he(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */ve(
|
|
28
|
-
/* @__PURE__ */ve("span",{className:"truncate flex-1",children:s?e.label:m(r.label)}),u&&/* @__PURE__ */ve("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */ve(v,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */ve("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__ */ve(
|
|
27
|
+
return ge("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(()=>{f(n),w(r)},350)));var n,r},onMouseLeave:x,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),f(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&&ue(n)?he(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */ve(H,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
|
|
28
|
+
/* @__PURE__ */ve("span",{className:"truncate flex-1",children:s?e.label:m(r.label)}),u&&/* @__PURE__ */ve("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */ve(v,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */ve("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__ */ve(H,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
29
29
|
/* @__PURE__ */ve("div",{className:"flex-1"}),k.length>=2&&/* @__PURE__ */ge("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-accent-tint transition-colors shrink-0",children:[
|
|
30
|
-
/* @__PURE__ */ve(
|
|
31
|
-
/* @__PURE__ */ve(
|
|
32
|
-
/* @__PURE__ */ge(
|
|
33
|
-
/* @__PURE__ */ve(
|
|
34
|
-
/* @__PURE__ */ge(
|
|
30
|
+
/* @__PURE__ */ve(H,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */ge(K,{portal:!0,minWidth:200,style:Rt(y.x,y.y),onClose:()=>g(null),children:[
|
|
31
|
+
/* @__PURE__ */ve(B,{children:y.label}),
|
|
32
|
+
/* @__PURE__ */ge(j,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=Qn.get(e);t&&wr(t)}(e.id))},children:[
|
|
33
|
+
/* @__PURE__ */ve(H,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
34
|
+
/* @__PURE__ */ge(j,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
|
|
35
35
|
/* @__PURE__ */ve("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */ve("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
36
|
-
/* @__PURE__ */ve(
|
|
37
|
-
/* @__PURE__ */ge(
|
|
38
|
-
/* @__PURE__ */ve(
|
|
36
|
+
/* @__PURE__ */ve(F,{}),
|
|
37
|
+
/* @__PURE__ */ge(j,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
38
|
+
/* @__PURE__ */ve(H,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),h&&p&&/* @__PURE__ */ve(It,{items:h,anchorEl:p,onActivate:e=>{o(e),f(null),w(null)},onClose:e=>{t(e),f(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:x})]}),a)}var Ot=["/login","/forgot-password","/reset-password","/force-change-password"];function $t({children:e,windowAccentForRoute:t}){const n=ke(),r=Ot.some(e=>n.pathname.startsWith(e)),[o,i]=se([]),a=ie(o);oe(()=>{a.current=o},[o]);const s=le(Fe,je,je),l=ie(/* @__PURE__ */new Map),c=e=>{const t=Qe(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};ae(()=>{Ct.clear();for(const e of o)e.route&&Ct.set(e.id,e.route)},[o]);const u=ce(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=ce(e=>{var t;xt(e)||kt(e)?(t=e,window.dispatchEvent(new CustomEvent(qr,{detail:{windowKey:t}}))):u(e)},[u]),m=(e,t=!1)=>{const n=Vn;t&>.add(e),setTimeout(()=>{const r=xt(e)??kt(e),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(Jn.get(i)??-1)>a)||pr(o),t&>.delete(e)},50)},h=(e,t,n)=>{const r=Be;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Qe(t))return e.length;if(t.shellOwned&&tt(t,n.home))return 0;const r=tt(t,n.home)?void 0:et(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Qe(e)&&!tt(e,n.home)&&et(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!tt(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&tt(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Qe(e[t])&&!tt(e[t],n.home)?et(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:je(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},f=ce(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),p=ce((e,t,n,r,o,a={})=>{if(!Te[e]||!Se(Te[e]))return;const s=`${e}:${t}`,l=Mt();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(m(c.id),i):(m(s,!0),h(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:ot(n),openedFrom:l},!!a.append))})},[]),w=ce((e,t={})=>{if(!Te[e]||!Ce(Te[e]))return;const n=Te[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,or.add(t)):m(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const f=Mt();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(s&&i.length>0)return t;if(r&&!l&&i.length>0)return o||m(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),h(t,{id:a,type:"page",label:n.label,route:e,openedFrom:f,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||m(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),h(t,{id:a,type:"page",label:n.label,route:e,openedFrom:f,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=ce(()=>{},[]),g=ce(()=>{},[]),v=d,b=d;/* @__PURE__ */
|
|
39
39
|
return ge(ut.Provider,{value:{openWindows:o,openEntity:p,openPage:w,reorderWindows:f,closeEntity:v,minimize:y,items:[],openItems:o,restore:g,remove:b,restoreIfMinimized:()=>!1},children:[e,
|
|
40
40
|
/* @__PURE__ */ve(Wt,{openWindows:o,onRemove:d,onSplitView:co,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&&pr(e)}})},onActivateById:Et}),
|
|
41
41
|
/* @__PURE__ */ve(uo,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
42
42
|
/* @__PURE__ */
|
|
43
|
-
return ve(Re.Provider,{value:c(e),children:/* @__PURE__ */ve(He,{fallback:(t,n)=>/* @__PURE__ */ve(mo,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */ve(Ye,{error:t,onReload:n})}),children:/* @__PURE__ */ve(pn,{spec:pt(e),children:/* @__PURE__ */ve(vo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */ve(wt,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */ve(bt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var Kt=400;function jt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=ie(null),s=ie(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=ie(!1),c=ie(void 0),u=ie(i),d=u.current&&!i;u.current=i;const m=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},Kt)};ae(()=>{n&&!r&&m()},[n,r]),ae(()=>{d&&n&&!r&&m()},[d]),ae(()=>()=>clearTimeout(c.current),[]),ae(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?O(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),oe(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Ft=null,Bt=/* @__PURE__ */new Set;function qt(){return Ft}function Yt(e){if(Ft!==e){Ft=e;for(const e of Bt)e()}}function Ht(e){return Bt.add(e),()=>{Bt.delete(e)}}var Ut=!1,Xt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Vt=()=>{};function Jt(e){Ut=e,Xt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Gt(e,t){Ut&&("submenu"===e?Xt.submenus++:Xt.menus++,Xt.menuKey=t)}function _t(e){if(!Ut)return Vt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Ut)return;const r=performance.now()-t;"move"===e?Xt.moveMs+=r:Xt.resizeMs+=r}}function Zt(){const e=Xt;return Xt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Qt=/* @__PURE__ */new Set([
|
|
44
|
-
return ve(fn.Provider,{value:e,children:t})}var wn=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),yn='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function gn(e){return vn(e).replace(/\s+/g," ").trim()}function vn(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(vn).join("");if(ue(e)){const t=e,n="string"==typeof t.type?t.type:"";return wn.has(n)?"":` ${vn(t.props?.children)} `}return""}function bn(e){const t=ne(hn);ae(()=>{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 xn={};function kn(e,t,n){const r=ne(hn);ae(()=>{if(!r)return;xn[r]||(xn[r]=[]);const o={label:e,icon:n,onClick:t};return xn[r].push(o),()=>{xn[r]=(xn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function En({title:e}){const t=ie(null);return ae(()=>{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__ */ve("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Mn(e){}function Cn(){return ne(hn)}function Sn({className:e=""}){const t=ne(
|
|
45
|
-
/* @__PURE__ */ve(
|
|
46
|
-
return ve("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.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 zn="erp_window_positions",An={};try{const e=localStorage.getItem(zn);e&&(An=JSON.parse(e))}catch{}var Dn=null;function Pn(){Dn&&clearTimeout(Dn),Dn=setTimeout(()=>{try{localStorage.setItem(zn,JSON.stringify(An))}catch{}},500)}var In="erp_activation_order",Rn=[];try{const e=localStorage.getItem(In),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Rn=t)}catch{}var Wn=null;function On(){Wn&&clearTimeout(Wn),Wn=setTimeout(()=>{try{localStorage.setItem(In,JSON.stringify(Rn))}catch{}},500)}function $n(e,t){An[e]||(An[e]=t,Pn())}function Kn(e){return An[e]?{...An[e]}:null}function jn(e,t){An[e]=t,Pn()}function Fn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(An))n(An[e],r,o)&&(delete An[e],i=!0);i&&Pn()}var Bn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},qn=4e3,Yn=["small","medium","large","maximized"],Hn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return
|
|
43
|
+
return ve(Re.Provider,{value:c(e),children:/* @__PURE__ */ve(He,{fallback:(t,n)=>/* @__PURE__ */ve(mo,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */ve(Ye,{error:t,onReload:n})}),children:/* @__PURE__ */ve(pn,{spec:pt(e),children:/* @__PURE__ */ve(vo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */ve(wt,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */ve(bt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var Kt=400;function jt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=ie(null),s=ie(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=ie(!1),c=ie(void 0),u=ie(i),d=u.current&&!i;u.current=i;const m=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},Kt)};ae(()=>{n&&!r&&m()},[n,r]),ae(()=>{d&&n&&!r&&m()},[d]),ae(()=>()=>clearTimeout(c.current),[]),ae(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?O(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),oe(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Ft=null,Bt=/* @__PURE__ */new Set;function qt(){return Ft}function Yt(e){if(Ft!==e){Ft=e;for(const e of Bt)e()}}function Ht(e){return Bt.add(e),()=>{Bt.delete(e)}}var Ut=!1,Xt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Vt=()=>{};function Jt(e){Ut=e,Xt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Gt(e,t){Ut&&("submenu"===e?Xt.submenus++:Xt.menus++,Xt.menuKey=t)}function _t(e){if(!Ut)return Vt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Ut)return;const r=performance.now()-t;"move"===e?Xt.moveMs+=r:Xt.resizeMs+=r}}function Zt(){const e=Xt;return Xt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Qt=/* @__PURE__ */new Set([$,k]),en=e=>Qt.has(e)||"function"==typeof e&&"badge"===e.titleRole,tn=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),nn=/* @__PURE__ */new Set(["svg"]);function rn(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return on(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function on(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=>on(e,t,n));if(!ue(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===de)return void me.toArray(r.props.children).forEach(e=>on(e,t,n));if("string"==typeof r.type){if(nn.has(r.type))return;if(!tn.has(r.type))return n.push(" "),me.toArray(r.props.children).forEach(e=>on(e,t,n)),void n.push(" ")}const o=he(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(en(r.type)?t.badges:t.actions).push(o)}var an=/* @__PURE__ */new Map,sn=/* @__PURE__ */new Set,ln=0;function cn(){ln++,sn.forEach(e=>e())}function un(e){return an.get(e)}function dn(e){return sn.add(e),()=>{sn.delete(e)}}function mn(){return ln}var hn=ee(""),fn=ee(null);function pn({spec:e,children:t}){/* @__PURE__ */
|
|
44
|
+
return ve(fn.Provider,{value:e,children:t})}var wn=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),yn='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function gn(e){return vn(e).replace(/\s+/g," ").trim()}function vn(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(vn).join("");if(ue(e)){const t=e,n="string"==typeof t.type?t.type:"";return wn.has(n)?"":` ${vn(t.props?.children)} `}return""}function bn(e){const t=ne(hn);ae(()=>{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 xn={};function kn(e,t,n){const r=ne(hn);ae(()=>{if(!r)return;xn[r]||(xn[r]=[]);const o={label:e,icon:n,onClick:t};return xn[r].push(o),()=>{xn[r]=(xn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function En({title:e}){const t=ie(null);return ae(()=>{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__ */ve("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Mn(e){}function Cn(){return ne(hn)}function Sn({className:e=""}){const t=ne(L)?.setEditSlot,n=ce(e=>{t?.(e)},[t]);return t?/* @__PURE__ */ve("span",{ref:n,"data-window-edit-slot":"",className:`inline-flex items-center empty:hidden ${e}`.trim()}):null}function Nn({items:e,label:t}){const n=Q().window.more;return 0===e.length?null:/* @__PURE__ */ve(W,{side:"top",items:e,triggerClassName:_({variant:"secondary",size:"sm"}),trigger:/* @__PURE__ */ge(be,{children:[t??n,
|
|
45
|
+
/* @__PURE__ */ve(H,{name:"chevron-down",className:"size-3.5",strokeWidth:2,"aria-hidden":"true"})]})})}function Ln({children:e,position:t="right",quiet:n=!1}){const r=ne(L),[o,i]=se(null);return ae(()=>{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?xe(e,o):null}function Tn({onClick:e,children:t,className:n}){const r=ne(L);/* @__PURE__ */
|
|
46
|
+
return ve("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.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 zn="erp_window_positions",An={};try{const e=localStorage.getItem(zn);e&&(An=JSON.parse(e))}catch{}var Dn=null;function Pn(){Dn&&clearTimeout(Dn),Dn=setTimeout(()=>{try{localStorage.setItem(zn,JSON.stringify(An))}catch{}},500)}var In="erp_activation_order",Rn=[];try{const e=localStorage.getItem(In),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Rn=t)}catch{}var Wn=null;function On(){Wn&&clearTimeout(Wn),Wn=setTimeout(()=>{try{localStorage.setItem(In,JSON.stringify(Rn))}catch{}},500)}function $n(e,t){An[e]||(An[e]=t,Pn())}function Kn(e){return An[e]?{...An[e]}:null}function jn(e,t){An[e]=t,Pn()}function Fn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(An))n(An[e],r,o)&&(delete An[e],i=!0);i&&Pn()}var Bn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},qn=4e3,Yn=["small","medium","large","maximized"],Hn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return M(Yn,"large",e)},Un={small:.8,medium:1,large:1.25,maximized:1.25},Xn=/* @__PURE__ */new Set,Vn=0,Jn=/* @__PURE__ */new Map;var Gn=0;function _n(){return Gn}function Zn(){Gn++,N.forEach(e=>e())}var Qn=/* @__PURE__ */new Map,er=/* @__PURE__ */new Map,tr=/* @__PURE__ */new Map;function nr(){for(let e=S.length-1;e>=0;e--){const t=tr.get(S[e]);if(t?.tab)return t.owner}return null}function rr(){return le(T,nr,()=>null)}var or=/* @__PURE__ */new Set;var ir=null;function ar(e){ir=null,pr(e)}function sr(e){ir=e;const t=Qn.get(e);t&&ar(t)}var lr=/* @__PURE__ */new Map;function cr(e){return lr.get(e)?.holdsChanges()??!1}function ur(e){const t=lr.get(e);return t?t.ask():Promise.resolve(!0)}function dr(e){ir===e&&(ir=null)}function mr(e,t,n){if(n&&tr.set(e,n),t)if(Qn.set(t,e),er.set(e,t),or.delete(t)){S.unshift(e);const n=Rn.indexOf(t);-1!==n&&Rn.splice(n,1),Rn.unshift(t),On()}else!function(e,t){const n=Rn.indexOf(t);if(-1===n)return void S.push(e);let r=S.length;for(let e=0;e<S.length;e++){const t=er.get(S[e]);if(t&&Rn.indexOf(t)>n){r=e;break}}S.splice(r,0,e)}(e,t),-1===Rn.indexOf(t)&&(Rn.push(t),On());else S.push(e);Zn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&ir===t&&ar(e)}function hr(e){return e?tr.get(e)?.owner??er.get(e)??null:null}var fr=/* @__PURE__ */new Set;function pr(e){const t=hr(z()),n=S.indexOf(e);-1!==n&&S.splice(n,1),S.push(e);const r=tr.get(e);if(r?.root)for(const[e,t]of tr){if(t.root||t.owner!==r.owner||Xn.has(e))continue;const n=S.indexOf(e);-1!==n&&S.splice(n,1),S.push(e)}Xn.delete(e);const o=er.get(e);if(o){const e=Rn.indexOf(o);-1!==e&&Rn.splice(e,1),Rn.push(o),On(),ir&&ir!==o&&(ir=null)}Zn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=hr(z());i&&i!==t&&fr.forEach(e=>e(i))}function wr(e){const t=S.indexOf(e);-1!==t&&S.splice(t,1),Xn.add(e),Jn.set(e,++Vn);const n=er.get(e);if(n){const e=Rn.indexOf(n);-1!==e&&(Rn.splice(e,1),On())}Zn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var yr=/* @__PURE__ */new Set;var gr=8,vr=32;function br(){return e()}var xr="flex size-6 shrink-0 items-center justify-center rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",kr="flex size-3 items-center justify-center rounded-full text-gray-900/70",Er="size-2 opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100",Mr=E.windowBar,Cr=80,Sr=384,Nr=400;function Lr(e,t=br()){const n=Math.min(Math.max(e.x,t.x+Cr-e.w),t.x+t.w-Cr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Mr);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Tr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=br();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 zr(e){const t=br(),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 Ar=null;function Dr(e){const t=(Ar||((Ar=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${U.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(Ar)),Ar);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 Pr(){Ar&&(Ar.style.opacity="0",Ar.style.display="none")}var Ir=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],Rr=350,Wr=200;function Or({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o,children:i}){const[a,s]=se(!1),l=ie(void 0),c=ie(void 0);ae(()=>()=>{clearTimeout(l.current),clearTimeout(c.current)},[]);const u=()=>{clearTimeout(c.current),l.current=setTimeout(()=>s(!0),Rr)},d=()=>{clearTimeout(l.current),c.current=setTimeout(()=>s(!1),Wr)};/* @__PURE__ */
|
|
47
47
|
return ge("span",{className:"relative inline-flex",onMouseEnter:u,onMouseLeave:d,children:[
|
|
48
|
-
/* @__PURE__ */ve("button",{onClick:t,onFocus:u,onBlur:d,"aria-label":e?o.windowed:o.maximize,title:e?o.windowed:o.maximize,className:r,children:i}),a&&/* @__PURE__ */ve("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(c.current),onMouseLeave:d,className:"absolute left-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-line bg-surface p-2 shadow-lg",children:Ir.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */ve("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{s(!1),n(e)},onFocus:()=>clearTimeout(c.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__ */ve("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var $r="rosh-gesture-style";var Kr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},jr=4;function Fr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById($r))return;const e=document.createElement("style");e.id=$r,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=_t(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Br(e){const t=
|
|
49
|
-
/* @__PURE__ */ve("div",{onMouseDown:e=>{e.stopPropagation(),Jr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:U.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 mo({open:t,onClose:l,title:c,icon:u,copyText:h,size:f="lg",dirty:p=!1,onNext:w,onPrev:v,footer:k,bodyScroll:E,onMinimize:M,initialBox:S,actions:A,actionsLeft:W,editing:O=!1,edit:F,allowPinOnTop:B,initialPosition:H,widget:X,compact:V,appStyle:G,flushBody:_,autoHeight:ee,autoMinHeight:te,autoWidth:re,widgetMenu:ue,dimensions:de,windowKey:me,openedFromKey:he,accentRgb:we,children:ye}){const[ke,Ee]=se(()=>r()),Me=D()&&!ke,Ce=P()&&!!X,[Se,Ne]=se(0),[Le,Te]=se(!1),ze=ie(null),Ae=ie(0);ae(()=>{Ae.current=Se},[Se]);const De=ce(e=>{Me&&(ze.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Te(!0),Yt(he??null))},[Me,he]),Pe=le(Ht,qt);ae(()=>{if(!Le)return;const e=e=>{if(!ze.current)return;const t=e.clientX-ze.current.startX;if(Math.abs(e.clientY-ze.current.startY)>Math.abs(t)+12)return ze.current=null,Te(!1),Ne(0),void Yt(null);Ne(Math.max(0,t))},t=()=>{if(!ze.current)return;const e=.3*window.innerWidth,t=Ae.current>e;ze.current=null,Te(!1),t?(Ne(window.innerWidth),setTimeout(()=>{l(),Ne(0),Yt(null)},180)):(Ne(0),Yt(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)}},[Le]);const[Ie,We]=se(c),Oe=Q(),$e=Oe.window;ae(()=>{We(c)},[c]);const Ke=fe(()=>gn(Ie).trim()||void 0,[Ie]),je=pe(),[Fe,Be]=se(!1),qe=ie(!1),[Ye,Xe]=se(!1),[Je,Ge]=se(null),_e=ne(fn),Ze=ne(Re),{prefs:Qe,save:et}=I(),tt=!!Qe.window_accent_stripe,nt=Qe.favorite_documents||[],rt=!!_e&&nt.some(e=>e.entityType===_e.entityType&&e.entityId===_e.entityId),ot=ce(()=>{if(!_e)return;const e=rt?nt.filter(e=>!(e.entityType===_e.entityType&&e.entityId===_e.entityId)):[...nt,{entityType:_e.entityType,entityId:_e.entityId,label:_e.label}];et({favorite_documents:e})},[_e,rt,nt,et]),[it,at]=se(null),[st,lt]=se("top-right"===H?"right":"left"),ct=ie(!1),ut=ie(null);oe(()=>{const e=ut.current;e&&(we?e.style.setProperty("--window-accent-rgb",we):e.style.removeProperty("--window-accent-rgb"))},[we]);const dt=ie(!1),ht=ie(null),pt=ie(null),wt=ie(null),[yt,gt]=se(!1),vt=ie(null),bt=ie(null),xt=ie(null),[kt,Et]=se(!1);oe(()=>{const e=bt.current,t=xt.current;if(!e||!t)return;const n=()=>Et(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=k&&!1!==k]);const Mt=!!F&&!X&&!V&&!G&&(F.editing||"hidden"!==F.state),[Ct,St]=se(null),Nt=Mt&&(!!F?.editing||!Ct),Lt=!!(k||A||W)||yt||Nt,Tt=ne(Ue),zt=""!==ne(hn),At=ie(null);At.current=Ze?{owner:Ze.key,tab:Ze.tab,root:!zt}:null;const Dt=me||(Ze&&!zt?Ze.key:null),Pt=!!Tt&&!zt&&Tt.enabled&&Tt.hasState&&(O||Tt.declaredEditable)&&!Tt.handMounted&&Lt&&!X&&!V&&!G&&!Me,It=40,{minimize:Rt,items:Wt,restoreIfMinimized:Ot,openWindows:$t}=ft(),Kt=ie(`modal-${Math.random().toString(36).slice(2,8)}`).current,Ft=g(Kt);ae(()=>{if(X)return yr.add(Kt),()=>{yr.delete(Kt)}},[X,Kt]),ae(()=>{const e=e=>{const t=e.detail;t?.id===Kt&&We(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Kt]);const[Bt,Ut]=se(U.window),Xt=function(e){const t=le(L,T);return C.length<=1||t===e}(Kt),Vt=ie(F);Vt.current=F;const Jt=!!F&&!F.editing&&"enabled"===F.state;ae(()=>{if(!t||!Xt||!Jt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(b(e.target,ut.current)||(e.preventDefault(),e.stopPropagation(),Vt.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Xt,Jt]);const Gt=function(e){return le(L,()=>Xn.has(e))}(Kt);jt({panelRef:ut,bodyRef:ht,open:t,widget:!!X,active:Xt,minimized:Gt});const _t=le(Xr,Vr),Zt=le(eo,to),Qt=le(io,ao),en=!B&&!X,tn=_t&&en,[nn,on]=se(!1),sn=tn&&Qt===Kt,[ln,un]=se(!1),dn=ln&&en&&Zt===Kt?"picked":null,mn=ie(tn);ae(()=>{if(mn.current&&!tn){un(!0);const e=setTimeout(()=>{un(!1),Zr===Kt&&no(null)},700);return mn.current=tn,()=>clearTimeout(e)}mn.current=tn},[tn,Kt]),ae(()=>{tn||on(!1)},[tn]),ae(()=>{const e=pt.current,t=wt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>gt(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]),ae(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ut.current){const t=ut.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=pt.current,n=wt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const pn=ie(!1),wn=ce(e,[]),vn=ce(()=>{const t=e(),n=de?de[0]:Bn[f]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Un[Hn()],l=de?Math.min(de[1],i):(()=>{const e=("sm"===f?500:"md"===f?600:"lg"===f?700:"xl"===f?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*(C.length-1),u=Math.max(It,(i-l)/2),d=(o-a)/2,m=t.h-It-l-u;return"top-right"===H?{x:t.x+t.w-a-It,y:t.y+It,w:a,h:l}:"top-left"===H?{x:t.x+It,y:t.y+It,w:a,h:l}:{x:t.x+Math.max(It,(o-a)/2+It)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[f]),bn=ie(!1);t||(bn.current=!1);const kn=me||h||null;ae(()=>{if(!t)return;mr(Kt,kn,At.current??void 0),me||pr(Kt),pn.current=!1,Ut(Br(Kt));const e=()=>{Ut(Br(Kt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===me;if(!e.label)return!1;const t=ut.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(pr(Kt),In.current)return;const t=br(),n=Math.min(jn.current.w,t.w-40),o=Math.min(jn.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}),Kn(!1)},i=e=>{const t=e.detail;r(t)&&(pr(Kt),Ge({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==me)return;pr(Kt);const t=jn.current,n=function(e,t=br()){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=ut.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=C.indexOf(e);-1!==t&&(C.splice(t,1),Zn()),Xn.delete(e),Jn.delete(e),tr.delete(e);const n=er.get(e);n&&(er.delete(e),Qn.delete(n))}(Kt),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,Kt,kn,wn]);const En=!X&&"maximized"===Hn(),[Mn,Cn]=se(()=>{if(kn&&An[kn]){const e={...An[kn]};return de&&(e.w=de[0],ee||(e.h=de[1])),Lr(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:En?wn():vn()}),[Sn,Nn]=se(()=>!ee),Ln=ie(ke),Tn=ie(null);ae(()=>{const e=()=>{const e=r();e!==Ln.current&&Tn.current?.(e),Ln.current=e,Ee(e),Ut(Br(Kt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Kt]);const zn=ke&&!!Ze?.tab&&!zt&&!X&&!Me,Dn=zn,In=ie(Dn);In.current=Dn;const Rn=rr(),Wn=ke&&!!Ze?.tab&&!X&&!Me&&!_t&&Rn!==Ze.key,On=!!X&&ke&&!_t&&null!==Rn,[$n,Kn]=se(()=>kn&&An[kn]||S?Dn:Dn||En),jn=ie(Mn);jn.current=Mn;const Fn=ie($n);oe(()=>{Fn.current=$n},[$n]),oe(()=>{if(Sn||zn)return;const e=ut.current,t=ht.current;if(!e||!t)return;const n=te??(X?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 u=e.offsetHeight-t.offsetHeight,d=t.style.flex,m=t.style.overflowY,h=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const f=t.offsetHeight,p=c.offsetHeight;t.style.flex=d,t.style.height=h,t.style.overflowY=m;const w=c.offsetHeight>p+4,y=Math.max(n,window.innerHeight-r-Math.max(0,jn.current.y)-24),g=w?Math.min(jn.current.h,y):Math.min(Math.max(n,u+f),y),v=Math.abs(g-o)>1;v&&(o=g,Cn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),X||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Nn(!0)},160)))},l=new ResizeObserver(s);s(),vt.current&&l.observe(vt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[Sn,X,te,Lt,zn]),oe(()=>{if(!ee||!Sn||X||!t)return;const e=vt.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||$n)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=te??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,jn.current.y)-24);Cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ee,Sn,X,t,$n,te]);const Yn=!1!==re&&!X&&!G&&!Me,[Vn,Gn]=se(()=>!Yn);oe(()=>{if(Vn||!t)return;if(!Yn||$n)return void Gn(!0);const n=ut.current,r=ht.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=jn.current.w,c=0;const u=()=>Gn(!0),d=()=>{c=0;const t=jn.current;if(Math.abs(t.w-l)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),m=d.w-80;if(t.w>=m)return void u();const h=[],f=[];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||(h.push(e),f.push(t))}if(!h.length)return;const p=Math.min(m,t.w+Math.max(...f)),w=p-t.w,y=n.style.width;n.style.width=`${p}px`;const g=h.map((e,t)=>({over:f[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(h[t])});const v=a(t,s(t.w,w,g),d,It);v!==t&&(l=v.w,Cn(v))};d();const m=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});m.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const h=setTimeout(u,qn);return()=>{m.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(h)}},[Vn,t,Yn,$n]);const _n=ie(null),nr=!(!Ze?.tab||zt||X||Me);Tn.current=t=>{if(!nr)return;if(t)return _n.current||(_n.current={box:{...jn.current},maximized:Fn.current}),void(Fn.current=!0);const r=_n.current;_n.current=null;const o=e();if(r?.maximized)return Fn.current=!0,Kn(!0),void Cn(o);const i=r?.box??(kn?An[kn]:void 0);if(Fn.current=!1,Kn(!1),i&&!n(i,o,!1)){const e={...i};de&&(e.w=de[0],ee||(e.h=de[1])),Cn(Lr(e))}else Cn(vn())},ae(()=>{Dn&&(Fn.current=!0,Kn(!0),Cn(wn()))},[Dn,wn]),ae(()=>{if(X)return;const e=()=>{const e=kn?An[kn]:void 0;if(Fn.current=!1,Kn(!1),e){const t={...e};de&&(t.w=de[0],ee||(t.h=de[1])),Cn(Lr(t))}else Cn(vn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[X,vn,kn]),ae(()=>{t&&kn&&!zn&&(An[kn]=Mn,Pn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[Mn,t,kn,zn]),ae(()=>{if(!t)return;const e=()=>{Fn.current?Cn(wn()):document.body.classList.contains("rosh-gesturing")||Cn(Lr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return $n&&(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,$n,wn]),ae(()=>{if(t&&(Be(!1),qe.current=!1,ct.current=!1,Gn(!Yn),!In.current)){if(kn&&An[kn]){const e=An[kn];return void Cn(t=>Lr({...e,...ee?{h:t.h}:{},...Yn?{x:t.x,w:t.w}:{}}))}S&&(Cn({x:S.x,y:S.y,w:S.w,h:S.h}),Kn(S.maximized))}},[t]),ae(()=>{if(!t||"auto"!==p)return;let e;const n=t=>{ut.current?.contains(t.target)&&!qe.current&&(qe.current=!0,e=setTimeout(()=>Be(!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,p]);const or="auto"===p?Fe:!0===p,ir=Ze&&!zt?Ze.key:null,ar=fe(()=>rn(Ie),[Ie]),sr=ie({shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar});oe(()=>{sr.current={shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar}});const cr=ie(null);cr.current||(cr.current={open:(e,t)=>Ge({x:e,y:t}),items:()=>{const e=sr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of xn[Kt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),ae(()=>{if(t&&ir)return()=>{return e=ir,void(an.delete(e)&&cn());var e}},[t,ir]),mt(!(me||!t)&&or);const ur=ce(()=>or||"auto"===p&&qe.current,[or,p]),dr=ce(async e=>{if(ct.current)return!1;if(!ur())return!0;ct.current=!0;const t=Ke,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return ct.current=!1,r},[ur,Ke]),hr=ce(()=>ct.current?Promise.resolve():ur()?dr("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[ur,dr,l]),fr=ce(async()=>{await dr("discard")&&(qe.current=!1,Be(!1),Vt.current?.onDiscard())},[dr]),Mr=ce(async()=>{const e=await dr("switch");return e&&(qe.current=!1,Be(!1)),e},[dr]),Cr=ie(()=>!1);oe(()=>{Cr.current=ur}),oe(()=>{if(!t||!me)return;const e={holdsChanges:()=>Cr.current(),ask:Mr};return lr.set(me,e),()=>{lr.get(me)===e&&lr.delete(me)}},[t,me,Mr]),oe(()=>{if(!t||!Dt)return;const e=e=>{e.detail?.windowKey===Dt&&hr()};return window.addEventListener(qr,e),()=>window.removeEventListener(qr,e)},[t,Dt,hr]);const Tr=ie(null),Ar=ce(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Ge(null),pr(Kt),In.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=ut.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Tr.current){const t=Tr.current;Tr.current=null,d=t.w,u=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=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:jn.current.x,c=s?s.top:jn.current.y,u=s?s.height:jn.current.h,d=s?s.width:jn.current.w;Kn(!1),Cn(e=>({...e,x:l,y:c,w:d,h:u}));let m=null;const h=e=>{if(!r){if(Math.abs(e.clientX-o)<jr&&Math.abs(e.clientY-i)<jr)return;r=Fr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),jn.current={...jn.current,x:s,y:u},!X){const t=function(e,t){const n=br(),r=e<=n.x+gr,o=e>=n.x+n.w-gr,i=t<=n.y+gr,a=t>=n.y+n.h-gr,s=e<=n.x+vr,l=e>=n.x+n.w-vr,c=t<=n.y+vr,u=t>=n.y+n.h-vr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==m&&(m=t,t?Dr(zr(t)):Pr())}},f=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",f),r?.(),Pr();const e=Lr({...jn.current});if(jn.current=e,!X&&m){Tr.current={x:l,y:c,w:d,h:u};const e=zr(m);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(X){const t=e.x+e.w/2,n=window.innerWidth/2;lt(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",h),window.addEventListener("pointerup",f)},[]),Ir=ce((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=ut.current,l=s?.getBoundingClientRect(),c=l?l.left:jn.current.x,u=l?l.top:jn.current.y,d=l?l.width:jn.current.w,m=l?l.height:jn.current.h,h="sw"===t||"nw"===t||"w"===t,f="ne"===t||"nw"===t||"n"===t,p="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Kn(!1),Cn({x:c,y:u,w:d,h:m}),jn.current={x:c,y:u,w:d,h:m};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,jn.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`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<jr&&Math.abs(e.clientY-a)<jr)return;o=Fr(n,r,Kr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=m;if(p&&(o=Math.max(Sr,d+e)),w&&(i=Math.max(Nr,m+t)),h){const t=Math.max(Sr,d-e);n=c+d-t,o=t}if(f){const e=Math.max(Nr,m-t);r=u+m-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),Cn({...jn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Rr=ce(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(),pr(Kt),"Enter"===e.key)return void($n?(Kn(!1),Cn(vn())):(Kn(!0),Cn(wn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Tr.current||(Tr.current={...jn.current})};if(r<0)return e(),Kn(!0),void Cn(wn());if(r>0){if($n)return Kn(!1),void Cn(vn());if(Tr.current){const e=Lr(Tr.current);return Tr.current=null,jn.current=e,void Cn(e)}return void wr(Kt)}e(),Kn(!1);const t=zr(n<0?"left":"right");return jn.current=t,void Cn(t)}if($n)return;const o=jn.current,i=e.shiftKey?{...o,w:Math.max(Sr,o.w+24*n),h:Math.max(Nr,o.h+24*r)}:Lr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});jn.current=i,Cn(i)},[Kt,$n,vn,wn]),Wr=ce(e=>{Tr.current||(Tr.current={...jn.current}),Kn(!1);const t=zr(e);jn.current=t,Cn(t),pr(Kt)},[Kt]),$r=!X&&!zn&&!Me,[Yr,Hr]=se(0),Ur=$r&&!V&&!G&&(!!A||!!W||yt||Nt||Pt),Gr=$r&&Yr>0,_r=ie(Gr);_r.current=Gr;const Qr=!!V||!!G,ro=Qr?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)",oo=ce(e=>{const t=e.closest("[data-window-body]");if(!t)return null;const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return Math.abs(n.left-r.left)>2||Math.abs(n.top-r.top)>2?null:(Hr(e=>e+1),()=>Hr(e=>Math.max(0,e-1)))},[]),so=fe(()=>$r?{compact:Qr,over:Gr,claim:oo}:null,[$r,Qr,Gr,oo]),lo=ce(e=>{if(tn)return;e.preventDefault(),e.stopPropagation();const t=0===e.clientX&&0===e.clientY,n=e.currentTarget.getBoundingClientRect();Ge(t?{x:n.left,y:n.bottom+4}:{x:e.clientX,y:e.clientY})},[tn]),co=!!we&&tt&&!X&&!Me,uo=Dn||tn?{}:{tabIndex:0,role:"group","aria-label":Ke?`${Ke} — ${$e.windowSuffix}`:$e.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:Rr},mo=()=>{Kn(!0),Cn(wn())},ho=ce(()=>{const e=ut.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(yn);t&&!t.disabled&&t.click()}},[]);ae(()=>{if(!t)return;if(X)return;const e=e=>{if(C[C.length-1]===Kt&&!b(e.target,ut.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),ho();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ut.current?.contains(t)))return;if(t.closest(z))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,ho,Kt,X]),ae(()=>{if(!t)return;const e=e=>{C[C.length-1]===Kt&&(b(e.target,ut.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Kt}})),qe.current=!1,Be(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Kt}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),ae(()=>{if(!t)return;if(X)return;const e=e=>{if("Escape"===e.key&&C[C.length-1]===Kt){if(Z(e))return e.preventDefault(),void e.stopPropagation();if(zn&&!O)return;e.preventDefault(),e.stopPropagation(),hr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,hr,Kt,X,zn,O]);const fo=t&&(void 0!==w||void 0!==v),[po]=se(()=>{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}),wo=zn&&!Ze?.home&&ar.actions.length>0;ae(()=>{t&&ir&&function(e,t){const n=an.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(an.set(e,t),cn())}(ir,{title:ar.text||Ke,dirty:or,copy:ar.copy,actions:wo&&po?po:void 0,menu:cr.current??void 0})},[t,ir,Ke,or,ar.text,ar.copy,wo,po]);const yo=ce(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-on-accent 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(ae(()=>{if(!t)return;const e=e=>{if(C[C.length-1]!==Kt)return;if(b(e.target,ut.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&fo&&(e.preventDefault(),w?w():yo("bottom")),"k"===e.key&&fo&&(e.preventDefault(),v?v():yo("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,w,v,fo,yo,Kt]),!t||bn.current)return null;const go=tn?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,u=br(),d=(u.w-20*(o+1))/o,m=(u.h-14*(i+1)-22*i)/i,h=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+h,y:u.y+14+a*(m+14+22),w:d,h:m}}(Kt):null,vo=tn&&go?J({width:go.w,height:go.h},{width:Mn.w,height:Mn.h}):1,bo=(()=>{if(tn&&go){const e=vo,t=Mn.w*e,n=Mn.h*e,r=go.x+(go.w-t)/2-Mn.x,o=go.y+(go.h-n)/2-Mn.y,i=nn||sn;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:U.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(ln&&en){const e="picked"===dn;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:U.expose+30}:{}}}return null})(),xo=x({modal:!1,titleId:!X&&(zn?!Ze?.home:!Me)?je:void 0,label:ar.text||Ke}),ko=Mt&&F&&!F.editing?"object"==typeof F.state?/* @__PURE__ */ve(q,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:F.state.disabledReason,children:$e.edit}):/* @__PURE__ */ve(q,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>F.onEdit(),children:$e.edit}):null,Eo=/* @__PURE__ */ge("div",{children:[
|
|
50
|
-
/* @__PURE__ */ge("div",{ref:ut,"data-modal-panel":!0,"data-modal-id":Kt,"data-window-key":me||void 0,...B?{"data-utility":""}:{},...Ye?{"data-pinned-top":""}:{},...X?{"data-widget":""}:{},...Ze?{"data-window-owner":Ze.key}:{},...Ze&&!zt?{"data-window-root":""}:{},...zn?{"data-window-tab":""}:{},...xo,className:zn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(X?Xt?"shadow-xl":"shadow-lg":"border "+(Xt?"shadow-xl border-line":"shadow-lg border-line-strong")),onPointerDown:e=>{if(!_r.current||tn||0!==e.button)return;const t=e.target;if(t.closest("[data-modal-panel]")!==ut.current)return;if(t.closest("[data-window-chrome]"))return;const n=e.currentTarget.getBoundingClientRect(),r=n.height/(e.currentTarget.offsetHeight||n.height),o=(Qr?
|
|
48
|
+
/* @__PURE__ */ve("button",{onClick:t,onFocus:u,onBlur:d,"aria-label":e?o.windowed:o.maximize,title:e?o.windowed:o.maximize,className:r,children:i}),a&&/* @__PURE__ */ve("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(c.current),onMouseLeave:d,className:"absolute left-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-line bg-surface p-2 shadow-lg",children:Ir.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */ve("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{s(!1),n(e)},onFocus:()=>clearTimeout(c.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__ */ve("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var $r="rosh-gesture-style";var Kr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},jr=4;function Fr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById($r))return;const e=document.createElement("style");e.id=$r,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=_t(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Br(e){const t=S.indexOf(e);if(-1===t)return-1;const n=U.window+t*U.windowStep,r=tr.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of tr){if(!t.root||t.owner!==r.owner)continue;const n=S.indexOf(e);-1!==n&&(o=Math.max(o,U.window+n*U.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=S.length-1;e>=0;e--)yr.has(S[e])||S.splice(e,1);Rn=Rn.filter(e=>{const t=Qn.get(e);return null!=t&&yr.has(t)}),On(),Zn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var qr="modal-close-request";function Yr(e){le(T,_n);const t=ne(L);if(S.length<=1)return!0;if(e){const t=Qn.get(e);if(null!=t)return z()===t}return t?.active??null!=z()}var Hr=!1,Ur=/* @__PURE__ */new Set;function Xr(e){return Ur.add(e),()=>Ur.delete(e)}function Vr(){return Hr}function Jr(e){Hr!==e&&(Hr=e,Ur.forEach(e=>e()))}function Gr(){Jr(!Hr)}function _r(){Jr(!1)}var Zr=null,Qr=/* @__PURE__ */new Set;function eo(e){return Qr.add(e),()=>Qr.delete(e)}function to(){return Zr}function no(e){Zr!==e&&(Zr=e,Qr.forEach(e=>e()))}var ro=null,oo=/* @__PURE__ */new Set;function io(e){return oo.add(e),()=>oo.delete(e)}function ao(){return ro}function so(e){ro!==e&&(ro=e,oo.forEach(e=>e()))}function lo(){if(!ro)return void Jr(!1);no(ro),so(null),Jr(!1)}function co(){Jr(!Hr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function uo(){const e=le(Xr,Vr),[t,n]=se(e),[r,o]=se(e);return ae(()=>{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?xe(
|
|
49
|
+
/* @__PURE__ */ve("div",{onMouseDown:e=>{e.stopPropagation(),Jr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:U.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 mo({open:t,onClose:l,title:c,icon:u,copyText:h,size:f="lg",dirty:p=!1,onNext:w,onPrev:v,footer:k,bodyScroll:M,onMinimize:C,initialBox:N,actions:D,actionsLeft:W,editing:O=!1,edit:$,allowPinOnTop:B,initialPosition:Y,widget:X,compact:V,appStyle:G,flushBody:_,autoHeight:ee,autoMinHeight:te,autoWidth:re,widgetMenu:ue,dimensions:de,windowKey:me,openedFromKey:he,accentRgb:we,children:ye}){const[ke,Ee]=se(()=>r()),Me=P()&&!ke,Ce=I()&&!!X,[Se,Ne]=se(0),[Le,Te]=se(!1),ze=ie(null),Ae=ie(0);ae(()=>{Ae.current=Se},[Se]);const De=ce(e=>{Me&&(ze.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Te(!0),Yt(he??null))},[Me,he]),Pe=le(Ht,qt);ae(()=>{if(!Le)return;const e=e=>{if(!ze.current)return;const t=e.clientX-ze.current.startX;if(Math.abs(e.clientY-ze.current.startY)>Math.abs(t)+12)return ze.current=null,Te(!1),Ne(0),void Yt(null);Ne(Math.max(0,t))},t=()=>{if(!ze.current)return;const e=.3*window.innerWidth,t=Ae.current>e;ze.current=null,Te(!1),t?(Ne(window.innerWidth),setTimeout(()=>{l(),Ne(0),Yt(null)},180)):(Ne(0),Yt(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)}},[Le]);const[Ie,We]=se(c),Oe=Q(),$e=Oe.window;ae(()=>{We(c)},[c]);const Ke=fe(()=>gn(Ie).trim()||void 0,[Ie]),je=pe(),[Fe,Be]=se(!1),qe=ie(!1),[Ye,Xe]=se(!1),[Je,Ge]=se(null),_e=ne(fn),Ze=ne(Re),{prefs:Qe,save:et}=R(),tt=!!Qe.window_accent_stripe,nt=Qe.favorite_documents||[],rt=!!_e&&nt.some(e=>e.entityType===_e.entityType&&e.entityId===_e.entityId),ot=ce(()=>{if(!_e)return;const e=rt?nt.filter(e=>!(e.entityType===_e.entityType&&e.entityId===_e.entityId)):[...nt,{entityType:_e.entityType,entityId:_e.entityId,label:_e.label}];et({favorite_documents:e})},[_e,rt,nt,et]),[it,at]=se(null),[st,lt]=se("top-right"===Y?"right":"left"),ct=ie(!1),ut=ie(null);oe(()=>{const e=ut.current;e&&(we?e.style.setProperty("--window-accent-rgb",we):e.style.removeProperty("--window-accent-rgb"))},[we]);const dt=ie(!1),ht=ie(null),pt=ie(null),wt=ie(null),[yt,gt]=se(!1),vt=ie(null),bt=ie(null),xt=ie(null),[kt,Et]=se(!1);oe(()=>{const e=bt.current,t=xt.current;if(!e||!t)return;const n=()=>Et(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=k&&!1!==k]);const Mt=!!$&&!X&&!V&&!G&&($.editing||"hidden"!==$.state),[Ct,St]=se(null),Nt=Mt&&(!!$?.editing||!Ct),Lt=!!(k||D||W)||yt||Nt,Tt=ne(Ue),zt=""!==ne(hn),At=ie(null);At.current=Ze?{owner:Ze.key,tab:Ze.tab,root:!zt}:null;const Dt=me||(Ze&&!zt?Ze.key:null),Pt=!!Tt&&!zt&&Tt.enabled&&Tt.hasState&&(O||Tt.declaredEditable)&&!Tt.handMounted&&Lt&&!X&&!V&&!G&&!Me,It=40,{minimize:Rt,items:Wt,restoreIfMinimized:Ot,openWindows:$t}=ft(),Kt=ie(`modal-${Math.random().toString(36).slice(2,8)}`).current,Ft=g(Kt);ae(()=>{if(X)return yr.add(Kt),()=>{yr.delete(Kt)}},[X,Kt]),ae(()=>{const e=e=>{const t=e.detail;t?.id===Kt&&We(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Kt]);const[Bt,Ut]=se(U.window),Xt=function(e){const t=le(T,z);return S.length<=1||t===e}(Kt),Vt=ie($);Vt.current=$;const Jt=!!$&&!$.editing&&"enabled"===$.state;ae(()=>{if(!t||!Xt||!Jt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(b(e.target,ut.current)||(e.preventDefault(),e.stopPropagation(),Vt.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Xt,Jt]);const Gt=function(e){return le(T,()=>Xn.has(e))}(Kt);jt({panelRef:ut,bodyRef:ht,open:t,widget:!!X,active:Xt,minimized:Gt});const _t=le(Xr,Vr),Zt=le(eo,to),Qt=le(io,ao),en=!B&&!X,tn=_t&&en,[nn,on]=se(!1),sn=tn&&Qt===Kt,[ln,un]=se(!1),dn=ln&&en&&Zt===Kt?"picked":null,mn=ie(tn);ae(()=>{if(mn.current&&!tn){un(!0);const e=setTimeout(()=>{un(!1),Zr===Kt&&no(null)},700);return mn.current=tn,()=>clearTimeout(e)}mn.current=tn},[tn,Kt]),ae(()=>{tn||on(!1)},[tn]),ae(()=>{const e=pt.current,t=wt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>gt(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]),ae(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ut.current){const t=ut.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=pt.current,n=wt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const pn=ie(!1),wn=ce(e,[]),vn=ce(()=>{const t=e(),n=de?de[0]:Bn[f]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Un[Hn()],l=de?Math.min(de[1],i):(()=>{const e=("sm"===f?500:"md"===f?600:"lg"===f?700:"xl"===f?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*(S.length-1),u=Math.max(It,(i-l)/2),d=(o-a)/2,m=t.h-It-l-u;return"top-right"===Y?{x:t.x+t.w-a-It,y:t.y+It,w:a,h:l}:"top-left"===Y?{x:t.x+It,y:t.y+It,w:a,h:l}:{x:t.x+Math.max(It,(o-a)/2+It)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[f]),bn=ie(!1);t||(bn.current=!1);const kn=me||h||null;ae(()=>{if(!t)return;mr(Kt,kn,At.current??void 0),me||pr(Kt),pn.current=!1,Ut(Br(Kt));const e=()=>{Ut(Br(Kt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===me;if(!e.label)return!1;const t=ut.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(pr(Kt),In.current)return;const t=br(),n=Math.min(jn.current.w,t.w-40),o=Math.min(jn.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}),Kn(!1)},i=e=>{const t=e.detail;r(t)&&(pr(Kt),Ge({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==me)return;pr(Kt);const t=jn.current,n=function(e,t=br()){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=ut.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=S.indexOf(e);-1!==t&&(S.splice(t,1),Zn()),Xn.delete(e),Jn.delete(e),tr.delete(e);const n=er.get(e);n&&(er.delete(e),Qn.delete(n))}(Kt),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,Kt,kn,wn]);const En=!X&&"maximized"===Hn(),[Mn,Cn]=se(()=>{if(kn&&An[kn]){const e={...An[kn]};return de&&(e.w=de[0],ee||(e.h=de[1])),Lr(e)}return N?{x:N.x,y:N.y,w:N.w,h:N.h}:En?wn():vn()}),[Sn,Nn]=se(()=>!ee),Ln=ie(ke),Tn=ie(null);ae(()=>{const e=()=>{const e=r();e!==Ln.current&&Tn.current?.(e),Ln.current=e,Ee(e),Ut(Br(Kt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Kt]);const zn=ke&&!!Ze?.tab&&!zt&&!X&&!Me,Dn=zn,In=ie(Dn);In.current=Dn;const Rn=rr(),Wn=ke&&!!Ze?.tab&&!X&&!Me&&!_t&&Rn!==Ze.key,On=!!X&&ke&&!_t&&null!==Rn,[$n,Kn]=se(()=>kn&&An[kn]||N?Dn:Dn||En),jn=ie(Mn);jn.current=Mn;const Fn=ie($n);oe(()=>{Fn.current=$n},[$n]),oe(()=>{if(Sn||zn)return;const e=ut.current,t=ht.current;if(!e||!t)return;const n=te??(X?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 u=e.offsetHeight-t.offsetHeight,d=t.style.flex,m=t.style.overflowY,h=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const f=t.offsetHeight,p=c.offsetHeight;t.style.flex=d,t.style.height=h,t.style.overflowY=m;const w=c.offsetHeight>p+4,y=Math.max(n,window.innerHeight-r-Math.max(0,jn.current.y)-24),g=w?Math.min(jn.current.h,y):Math.min(Math.max(n,u+f),y),v=Math.abs(g-o)>1;v&&(o=g,Cn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),X||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Nn(!0)},160)))},l=new ResizeObserver(s);s(),vt.current&&l.observe(vt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[Sn,X,te,Lt,zn]),oe(()=>{if(!ee||!Sn||X||!t)return;const e=vt.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||$n)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=te??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,jn.current.y)-24);Cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ee,Sn,X,t,$n,te]);const Yn=!1!==re&&!X&&!G&&!Me,[Vn,Gn]=se(()=>!Yn);oe(()=>{if(Vn||!t)return;if(!Yn||$n)return void Gn(!0);const n=ut.current,r=ht.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=jn.current.w,c=0;const u=()=>Gn(!0),d=()=>{c=0;const t=jn.current;if(Math.abs(t.w-l)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),m=d.w-80;if(t.w>=m)return void u();const h=[],f=[];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||(h.push(e),f.push(t))}if(!h.length)return;const p=Math.min(m,t.w+Math.max(...f)),w=p-t.w,y=n.style.width;n.style.width=`${p}px`;const g=h.map((e,t)=>({over:f[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(h[t])});const v=a(t,s(t.w,w,g),d,It);v!==t&&(l=v.w,Cn(v))};d();const m=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});m.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const h=setTimeout(u,qn);return()=>{m.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(h)}},[Vn,t,Yn,$n]);const _n=ie(null),nr=!(!Ze?.tab||zt||X||Me);Tn.current=t=>{if(!nr)return;if(t)return _n.current||(_n.current={box:{...jn.current},maximized:Fn.current}),void(Fn.current=!0);const r=_n.current;_n.current=null;const o=e();if(r?.maximized)return Fn.current=!0,Kn(!0),void Cn(o);const i=r?.box??(kn?An[kn]:void 0);if(Fn.current=!1,Kn(!1),i&&!n(i,o,!1)){const e={...i};de&&(e.w=de[0],ee||(e.h=de[1])),Cn(Lr(e))}else Cn(vn())},ae(()=>{Dn&&(Fn.current=!0,Kn(!0),Cn(wn()))},[Dn,wn]),ae(()=>{if(X)return;const e=()=>{const e=kn?An[kn]:void 0;if(Fn.current=!1,Kn(!1),e){const t={...e};de&&(t.w=de[0],ee||(t.h=de[1])),Cn(Lr(t))}else Cn(vn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[X,vn,kn]),ae(()=>{t&&kn&&!zn&&(An[kn]=Mn,Pn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[Mn,t,kn,zn]),ae(()=>{if(!t)return;const e=()=>{Fn.current?Cn(wn()):document.body.classList.contains("rosh-gesturing")||Cn(Lr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return $n&&(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,$n,wn]),ae(()=>{if(t&&(Be(!1),qe.current=!1,ct.current=!1,Gn(!Yn),!In.current)){if(kn&&An[kn]){const e=An[kn];return void Cn(t=>Lr({...e,...ee?{h:t.h}:{},...Yn?{x:t.x,w:t.w}:{}}))}N&&(Cn({x:N.x,y:N.y,w:N.w,h:N.h}),Kn(N.maximized))}},[t]),ae(()=>{if(!t||"auto"!==p)return;let e;const n=t=>{ut.current?.contains(t.target)&&!qe.current&&(qe.current=!0,e=setTimeout(()=>Be(!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,p]);const or="auto"===p?Fe:!0===p,ir=Ze&&!zt?Ze.key:null,ar=fe(()=>rn(Ie),[Ie]),sr=ie({shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar});oe(()=>{sr.current={shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar}});const cr=ie(null);cr.current||(cr.current={open:(e,t)=>Ge({x:e,y:t}),items:()=>{const e=sr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of xn[Kt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),ae(()=>{if(t&&ir)return()=>{return e=ir,void(an.delete(e)&&cn());var e}},[t,ir]),mt(!(me||!t)&&or);const ur=ce(()=>or||"auto"===p&&qe.current,[or,p]),dr=ce(async e=>{if(ct.current)return!1;if(!ur())return!0;ct.current=!0;const t=Ke,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return ct.current=!1,r},[ur,Ke]),hr=ce(()=>ct.current?Promise.resolve():ur()?dr("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[ur,dr,l]),fr=ce(async()=>{await dr("discard")&&(qe.current=!1,Be(!1),Vt.current?.onDiscard())},[dr]),Mr=ce(async()=>{const e=await dr("switch");return e&&(qe.current=!1,Be(!1)),e},[dr]),Cr=ie(()=>!1);oe(()=>{Cr.current=ur}),oe(()=>{if(!t||!me)return;const e={holdsChanges:()=>Cr.current(),ask:Mr};return lr.set(me,e),()=>{lr.get(me)===e&&lr.delete(me)}},[t,me,Mr]),oe(()=>{if(!t||!Dt)return;const e=e=>{e.detail?.windowKey===Dt&&hr()};return window.addEventListener(qr,e),()=>window.removeEventListener(qr,e)},[t,Dt,hr]);const Tr=ie(null),Ar=ce(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Ge(null),pr(Kt),In.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=ut.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Tr.current){const t=Tr.current;Tr.current=null,d=t.w,u=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=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:jn.current.x,c=s?s.top:jn.current.y,u=s?s.height:jn.current.h,d=s?s.width:jn.current.w;Kn(!1),Cn(e=>({...e,x:l,y:c,w:d,h:u}));let m=null;const h=e=>{if(!r){if(Math.abs(e.clientX-o)<jr&&Math.abs(e.clientY-i)<jr)return;r=Fr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),jn.current={...jn.current,x:s,y:u},!X){const t=function(e,t){const n=br(),r=e<=n.x+gr,o=e>=n.x+n.w-gr,i=t<=n.y+gr,a=t>=n.y+n.h-gr,s=e<=n.x+vr,l=e>=n.x+n.w-vr,c=t<=n.y+vr,u=t>=n.y+n.h-vr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==m&&(m=t,t?Dr(zr(t)):Pr())}},f=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",f),r?.(),Pr();const e=Lr({...jn.current});if(jn.current=e,!X&&m){Tr.current={x:l,y:c,w:d,h:u};const e=zr(m);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(X){const t=e.x+e.w/2,n=window.innerWidth/2;lt(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",h),window.addEventListener("pointerup",f)},[]),Ir=ce((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=ut.current,l=s?.getBoundingClientRect(),c=l?l.left:jn.current.x,u=l?l.top:jn.current.y,d=l?l.width:jn.current.w,m=l?l.height:jn.current.h,h="sw"===t||"nw"===t||"w"===t,f="ne"===t||"nw"===t||"n"===t,p="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Kn(!1),Cn({x:c,y:u,w:d,h:m}),jn.current={x:c,y:u,w:d,h:m};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,jn.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`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<jr&&Math.abs(e.clientY-a)<jr)return;o=Fr(n,r,Kr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=m;if(p&&(o=Math.max(Sr,d+e)),w&&(i=Math.max(Nr,m+t)),h){const t=Math.max(Sr,d-e);n=c+d-t,o=t}if(f){const e=Math.max(Nr,m-t);r=u+m-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),Cn({...jn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Rr=ce(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(),pr(Kt),"Enter"===e.key)return void($n?(Kn(!1),Cn(vn())):(Kn(!0),Cn(wn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Tr.current||(Tr.current={...jn.current})};if(r<0)return e(),Kn(!0),void Cn(wn());if(r>0){if($n)return Kn(!1),void Cn(vn());if(Tr.current){const e=Lr(Tr.current);return Tr.current=null,jn.current=e,void Cn(e)}return void wr(Kt)}e(),Kn(!1);const t=zr(n<0?"left":"right");return jn.current=t,void Cn(t)}if($n)return;const o=jn.current,i=e.shiftKey?{...o,w:Math.max(Sr,o.w+24*n),h:Math.max(Nr,o.h+24*r)}:Lr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});jn.current=i,Cn(i)},[Kt,$n,vn,wn]),Wr=ce(e=>{Tr.current||(Tr.current={...jn.current}),Kn(!1);const t=zr(e);jn.current=t,Cn(t),pr(Kt)},[Kt]),$r=!X&&!zn&&!Me,[Yr,Hr]=se(0),Ur=$r&&!V&&!G&&(!!D||!!W||yt||Nt||Pt),Gr=$r&&Yr>0,_r=ie(Gr);_r.current=Gr;const Qr=!!V||!!G,ro=Qr?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)",oo=ce(e=>{const t=e.closest("[data-window-body]");if(!t)return null;const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return Math.abs(n.left-r.left)>2||Math.abs(n.top-r.top)>2?null:(Hr(e=>e+1),()=>Hr(e=>Math.max(0,e-1)))},[]),so=fe(()=>$r?{compact:Qr,over:Gr,claim:oo}:null,[$r,Qr,Gr,oo]),lo=ce(e=>{if(tn)return;e.preventDefault(),e.stopPropagation();const t=0===e.clientX&&0===e.clientY,n=e.currentTarget.getBoundingClientRect();Ge(t?{x:n.left,y:n.bottom+4}:{x:e.clientX,y:e.clientY})},[tn]),co=!!we&&tt&&!X&&!Me,uo=Dn||tn?{}:{tabIndex:0,role:"group","aria-label":Ke?`${Ke} — ${$e.windowSuffix}`:$e.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:Rr},mo=()=>{Kn(!0),Cn(wn())},ho=ce(()=>{const e=ut.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(yn);t&&!t.disabled&&t.click()}},[]);ae(()=>{if(!t)return;if(X)return;const e=e=>{if(S[S.length-1]===Kt&&!b(e.target,ut.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),ho();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ut.current?.contains(t)))return;if(t.closest(A))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,ho,Kt,X]),ae(()=>{if(!t)return;const e=e=>{S[S.length-1]===Kt&&(b(e.target,ut.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Kt}})),qe.current=!1,Be(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Kt}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),ae(()=>{if(!t)return;if(X)return;const e=e=>{if("Escape"===e.key&&S[S.length-1]===Kt){if(Z(e))return e.preventDefault(),void e.stopPropagation();if(zn&&!O)return;e.preventDefault(),e.stopPropagation(),hr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,hr,Kt,X,zn,O]);const fo=t&&(void 0!==w||void 0!==v),[po]=se(()=>{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}),wo=zn&&!Ze?.home&&ar.actions.length>0;ae(()=>{t&&ir&&function(e,t){const n=an.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(an.set(e,t),cn())}(ir,{title:ar.text||Ke,dirty:or,copy:ar.copy,actions:wo&&po?po:void 0,menu:cr.current??void 0})},[t,ir,Ke,or,ar.text,ar.copy,wo,po]);const yo=ce(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-on-accent 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(ae(()=>{if(!t)return;const e=e=>{if(S[S.length-1]!==Kt)return;if(b(e.target,ut.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&fo&&(e.preventDefault(),w?w():yo("bottom")),"k"===e.key&&fo&&(e.preventDefault(),v?v():yo("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,w,v,fo,yo,Kt]),!t||bn.current)return null;const go=tn?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,u=br(),d=(u.w-20*(o+1))/o,m=(u.h-14*(i+1)-22*i)/i,h=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+h,y:u.y+14+a*(m+14+22),w:d,h:m}}(Kt):null,vo=tn&&go?J({width:go.w,height:go.h},{width:Mn.w,height:Mn.h}):1,bo=(()=>{if(tn&&go){const e=vo,t=Mn.w*e,n=Mn.h*e,r=go.x+(go.w-t)/2-Mn.x,o=go.y+(go.h-n)/2-Mn.y,i=nn||sn;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:U.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(ln&&en){const e="picked"===dn;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:U.expose+30}:{}}}return null})(),xo=x({modal:!1,titleId:!X&&(zn?!Ze?.home:!Me)?je:void 0,label:ar.text||Ke}),ko=Mt&&$&&!$.editing?"object"==typeof $.state?/* @__PURE__ */ve(q,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:$.state.disabledReason,children:$e.edit}):/* @__PURE__ */ve(q,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>$.onEdit(),children:$e.edit}):null,Eo=/* @__PURE__ */ge("div",{children:[
|
|
50
|
+
/* @__PURE__ */ge("div",{ref:ut,"data-modal-panel":!0,"data-modal-id":Kt,"data-window-key":me||void 0,...B?{"data-utility":""}:{},...Ye?{"data-pinned-top":""}:{},...X?{"data-widget":""}:{},...Ze?{"data-window-owner":Ze.key}:{},...Ze&&!zt?{"data-window-root":""}:{},...zn?{"data-window-tab":""}:{},...xo,className:zn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(X?Xt?"shadow-xl":"shadow-lg":"border "+(Xt?"shadow-xl border-line":"shadow-lg border-line-strong")),onPointerDown:e=>{if(!_r.current||tn||0!==e.button)return;const t=e.target;if(t.closest("[data-modal-panel]")!==ut.current)return;if(t.closest("[data-window-chrome]"))return;const n=e.currentTarget.getBoundingClientRect(),r=n.height/(e.currentTarget.offsetHeight||n.height),o=(Qr?E.compactBar:E.windowBar)*r;e.clientY-n.top>o||t.closest(m)||Ar(e)},onContextMenu:e=>{const t=e.target;t.closest("[data-window-strip]")&&t.closest("[data-modal-panel]")===ut.current&&lo(e)},onMouseDownCapture:e=>{if(dt.current=!1,tn){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),no(Kt),Jr(!1),void pr(Kt)}if(!Xt&&!X&&!Ye&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ut.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),dt.current=!0,Ge(null),pr(Kt),window.addEventListener("mouseup",()=>{setTimeout(()=>{dt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{dt.current&&(dt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(tn)return;Ge(null);e.target.closest("[data-modal-panel]")===ut.current&&(e.target.closest("button, input, a, select, textarea")||pr(Kt))},style:Me?{zIndex:Bt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Se}px)`,transition:Le?"none":"transform 180ms ease-out",...X?{display:"none"}:{},...Bt<0?{display:"none"}:{},...Xt||Ye||Pe&&me===Pe?{}:{display:"none"},...Ft?{visibility:"hidden",pointerEvents:"none"}:{}}:{zIndex:Ye?U.pinnedWindow:Bt+1,width:Mn.w,height:Mn.h,top:Mn.y,...X&&"right"===st?{right:window.innerWidth-Mn.x-Mn.w}:{left:Mn.x},...Bt<0&&!Ye?{display:"none"}:{},...Ce?{display:"none"}:{},...Wn||On||Ft?{visibility:"hidden",pointerEvents:"none"}:{},...bo??{}},children:[Me&&!X&&/* @__PURE__ */ve("div",{onPointerDown:De,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),
|
|
51
51
|
/* @__PURE__ */ge("div",{"data-window-surface":"",className:"flex min-h-0 flex-1 flex-col "+($r?"backdrop-blur-sm":""),style:$r?{backgroundColor:Xt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"}:void 0,children:[X?null:zn?Ze?.home?null:/* @__PURE__ */ge(be,{children:[
|
|
52
52
|
/* @__PURE__ */ve("h2",{id:je,"data-window-title":!0,className:"sr-only",children:ar.text||Ke}),wo&&po&&xe(
|
|
53
53
|
/* @__PURE__ */ve(be,{children:ar.actions}),po),ar.badges.length>0&&/* @__PURE__ */ve("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:ar.badges})]}):Me?null:
|
|
54
54
|
/* @__PURE__ */ge("div",{onPointerDown:Ar,onContextMenu:lo,"data-window-chrome":"",...Gr?{"data-window-controls-over":""}:{},...uo,className:Gr?`absolute left-0 z-10 flex ${ro} items-center px-3 select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400`:`flex items-center gap-3 ${ro} px-3 shrink-0 cursor-move select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400`,style:{touchAction:"none",...Gr?{top:co?3:0}:{}},children:[!tn&&/* @__PURE__ */ge("div",{"data-window-controls":"",className:"group/controls flex shrink-0 items-center",children:[
|
|
55
|
-
/* @__PURE__ */ve("button",{type:"button",onClick:hr,"aria-label":$e.close,title:$e.close,className:xr,children:/* @__PURE__ */ve("span",{"aria-hidden":"true",className:`${kr} ${Xt?"bg-red-500":"bg-gray-300 group-hover/controls:bg-red-500"}`,children:/* @__PURE__ */ve(
|
|
55
|
+
/* @__PURE__ */ve("button",{type:"button",onClick:hr,"aria-label":$e.close,title:$e.close,className:xr,children:/* @__PURE__ */ve("span",{"aria-hidden":"true",className:`${kr} ${Xt?"bg-red-500":"bg-gray-300 group-hover/controls:bg-red-500"}`,children:/* @__PURE__ */ve(H,{name:"close",className:Er,strokeWidth:3})})}),!V&&/* @__PURE__ */ve("button",{type:"button",onClick:()=>wr(Kt),"aria-label":$e.minimize,title:$e.minimize,className:xr,children:/* @__PURE__ */ve("span",{"aria-hidden":"true",className:`${kr} ${Xt?"bg-amber-400":"bg-gray-300 group-hover/controls:bg-amber-400"}`,children:/* @__PURE__ */ve("span",{className:"h-0.5 w-2 rounded-full bg-current opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100"})})}),!V&&/* @__PURE__ */ve(Or,{maximized:$n,onToggleMax:()=>{$n?(Kn(!1),Cn(vn())):mo()},onSnap:Wr,buttonClassName:xr,strings:$e,children:/* @__PURE__ */ve("span",{"aria-hidden":"true",className:`${kr} ${Xt?"bg-green-500":"bg-gray-300 group-hover/controls:bg-green-500"}`,children:/* @__PURE__ */ve(H,{name:$n?"collapse":"expand",className:Er,strokeWidth:3})})}),B&&/* @__PURE__ */ve("button",{type:"button",onClick:()=>Xe(e=>!e),"aria-label":Ye?$e.unpin:$e.pinOnTop,title:Ye?$e.unpin:$e.pinOnTop,className:"ml-1 p-0.5 rounded hover:bg-gray-200 "+(Ye?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */ve(H,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Ye?"currentColor":"none",strokeWidth:1.5})})]}),Gr?
|
|
56
56
|
/* @__PURE__ */ve("h2",{id:je,"data-window-title":!0,className:"sr-only",children:ar.text||Ke}):/* @__PURE__ */ve("div",{"data-window-title":!0,title:Ke,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Xt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:/* @__PURE__ */ve("span",{id:je,className:"truncate",children:tn?gn(Ie):Ie})})]}),co&&/* @__PURE__ */ve("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Xt?.9:.55})`}}),
|
|
57
|
-
/* @__PURE__ */ve(hn.Provider,{value:Kt,children:/* @__PURE__ */ve(d.Provider,{value:so,children:/* @__PURE__ */ve(
|
|
58
|
-
/* @__PURE__ */ve(
|
|
59
|
-
/* @__PURE__ */ve(
|
|
60
|
-
/* @__PURE__ */ve(
|
|
61
|
-
/* @__PURE__ */ge(
|
|
62
|
-
/* @__PURE__ */ve("span",{className:"flex-1",children:"Always on Top"}),Ye&&/* @__PURE__ */ve(
|
|
63
|
-
/* @__PURE__ */ve(
|
|
64
|
-
/* @__PURE__ */ve(
|
|
57
|
+
/* @__PURE__ */ve(hn.Provider,{value:Kt,children:/* @__PURE__ */ve(d.Provider,{value:so,children:/* @__PURE__ */ve(L.Provider,{value:{rightRef:pt,leftRef:wt,notify:()=>gt(!0),setEditSlot:St,active:Xt,isDirty:or,footerOpen:Lt&&!X&&!V&&!G&&!Me},children:/* @__PURE__ */ve("div",{ref:ht,"data-window-body":"",...X?{onPointerDown:Ar,onContextMenu:e=>{e.preventDefault(),at({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${X?"p-0 cursor-move":G||_?"p-0":V?"p-2":"p-4"} ${X||zn||$r?"":"backdrop-blur-sm"} ${!1===M||G||_?"overflow-hidden":"overflow-y-auto overscroll-contain"+($r?Ur?" mr-1":" mb-2 mr-1":"")} ${X?"rounded-2xl select-none":""}`,style:{...X?{touchAction:"none"}:{},backgroundColor:X||$r?"transparent":zn?"rgb(var(--window-content-rgb))":Xt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */ve(He,{children:ye})})})})}),X&&it&&/* @__PURE__ */ge(K,{minWidth:160,style:{left:it.x,top:it.y},onClose:()=>at(null),children:[
|
|
58
|
+
/* @__PURE__ */ve(j,{onClick:()=>{at(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Kt}))},children:"Settings"}),
|
|
59
|
+
/* @__PURE__ */ve(F,{}),ue&&/* @__PURE__ */ge(be,{children:[ue,
|
|
60
|
+
/* @__PURE__ */ve(F,{})]}),
|
|
61
|
+
/* @__PURE__ */ge(j,{onClick:()=>{at(null),Xe(e=>!e)},children:[
|
|
62
|
+
/* @__PURE__ */ve("span",{className:"flex-1",children:"Always on Top"}),Ye&&/* @__PURE__ */ve(H,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
|
|
63
|
+
/* @__PURE__ */ve(F,{}),
|
|
64
|
+
/* @__PURE__ */ve(j,{onClick:()=>{at(null),hr()},children:"Close"})]}),
|
|
65
65
|
/* @__PURE__ */ge("div",{onPointerDown:Ar,ref:vt,"data-modal-footer":"",...$r?{"data-modal-footer-bare":""}:{},className:$r?"px-4 py-2 shrink-0 flex items-center justify-between text-xs select-none cursor-move"+(Ur?"":" hidden"):`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${zn?"":" cursor-move"}${Xt&&!zn?" backdrop-blur-sm":""}${X||V||G||Me||!Lt?" hidden":""}`,style:$r?{touchAction:"none"}:{touchAction:"none",backgroundColor:zn?"rgb(var(--window-footer-rgb))":Xt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
66
66
|
/* @__PURE__ */ge("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[Pt&&/* @__PURE__ */ve(Ve,{auto:!0}),W,
|
|
67
67
|
/* @__PURE__ */ve("div",{ref:wt,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=k&&!1!==k&&!$r&&
|
|
68
68
|
/* @__PURE__ */ve("div",{ref:bt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */ve("div",{ref:xt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(kt?" invisible":""),children:k})})]}),
|
|
69
|
-
/* @__PURE__ */ge("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[Mt
|
|
70
|
-
/* @__PURE__ */ve("div",{ref:pt,"data-modal-actions":!0,className:"flex items-center gap-2"}),
|
|
69
|
+
/* @__PURE__ */ge("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[Mt&&$&&($.editing?/* @__PURE__ */ve(q,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{fr()},children:$e.discard}):Ct?xe(ko,Ct):ko),
|
|
70
|
+
/* @__PURE__ */ve("div",{ref:pt,"data-modal-actions":!0,className:"flex items-center gap-2"}),D]})]})]}),!X&&!Me&&!tn&&Xt&&!Dn&&/* @__PURE__ */ge(be,{children:[
|
|
71
71
|
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
72
72
|
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
73
73
|
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
@@ -75,18 +75,18 @@ return ge("span",{className:"relative inline-flex",onMouseEnter:u,onMouseLeave:d
|
|
|
75
75
|
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
76
76
|
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
77
77
|
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
78
|
-
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),tn&&/* @__PURE__ */ve("div",{className:"absolute inset-0",style:{zIndex:U.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>on(!0),onMouseLeave:()=>on(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),pr(Kt),Jr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:nn&&/* @__PURE__ */ve("button",{type:"button","data-expose-close":!0,"aria-label":Oe.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-on-accent 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/vo})`,transformOrigin:"top right",zIndex:U.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),hr()},children:/* @__PURE__ */ve(
|
|
79
|
-
/* @__PURE__ */ge(
|
|
80
|
-
/* @__PURE__ */ve(
|
|
81
|
-
/* @__PURE__ */ve(
|
|
82
|
-
/* @__PURE__ */ve(
|
|
83
|
-
/* @__PURE__ */ve(
|
|
84
|
-
/* @__PURE__ */ve(
|
|
85
|
-
/* @__PURE__ */ve(
|
|
86
|
-
/* @__PURE__ */ge(
|
|
87
|
-
/* @__PURE__ */ve(
|
|
78
|
+
/* @__PURE__ */ve("div",{onPointerDown:e=>Ir(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),tn&&/* @__PURE__ */ve("div",{className:"absolute inset-0",style:{zIndex:U.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>on(!0),onMouseLeave:()=>on(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),pr(Kt),Jr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:nn&&/* @__PURE__ */ve("button",{type:"button","data-expose-close":!0,"aria-label":Oe.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-on-accent 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/vo})`,transformOrigin:"top right",zIndex:U.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),hr()},children:/* @__PURE__ */ve(H,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),tn&&go&&/* @__PURE__ */ve("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:go.x,top:go.y+go.h+4,width:go.w,zIndex:U.expose+(nn?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:gn(Ie)})]}),Mo=Je&&/* @__PURE__ */ge(K,{style:{left:Je.x,top:Je.y},onClose:()=>Ge(null),minWidth:160,children:[!X&&!V&&!zn&&/* @__PURE__ */ge(be,{children:[
|
|
79
|
+
/* @__PURE__ */ge(j,{onClick:()=>{wr(Kt),Ge(null)},children:[
|
|
80
|
+
/* @__PURE__ */ve(H,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),$e.minimize]}),!Dn&&/* @__PURE__ */ge(j,$n?{onClick:()=>{Kn(!1),Cn(vn()),Ge(null)},children:[
|
|
81
|
+
/* @__PURE__ */ve(H,{name:"collapse",className:"h-4 w-4",strokeWidth:1.5}),$e.windowed]}:{onClick:()=>{mo(),Ge(null)},children:[
|
|
82
|
+
/* @__PURE__ */ve(H,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),$e.maximize]})]}),B&&!zn&&/* @__PURE__ */ge(j,{onClick:()=>{Xe(e=>!e),Ge(null)},children:[
|
|
83
|
+
/* @__PURE__ */ve(H,{name:"bookmark-square",className:"h-4 w-4 "+(Ye?"text-blue-600":""),fill:Ye?"currentColor":"none",strokeWidth:1.5}),Ye?$e.unpin:$e.pinOnTop]}),_e&&/* @__PURE__ */ge(j,{onClick:()=>{Ge(null),ot()},children:[
|
|
84
|
+
/* @__PURE__ */ve(H,{name:"star",className:"h-4 w-4",fill:rt?"currentColor":"none",strokeWidth:1.5}),rt?Oe.taskbar.removeFromDesktop:Oe.taskbar.addToDesktop]}),(xn[Kt]||[]).length>0&&/* @__PURE__ */ve(be,{children:(xn[Kt]||[]).map((e,t)=>/* @__PURE__ */ge(j,{onClick:()=>{Ge(null),e.onClick()},children:[e.icon,e.label]},t))}),!(zn&&Ze?.home)&&/* @__PURE__ */ge(be,{children:[
|
|
85
|
+
/* @__PURE__ */ve(F,{}),
|
|
86
|
+
/* @__PURE__ */ge(j,{danger:!0,onClick:()=>{Ge(null),hr()},children:[
|
|
87
|
+
/* @__PURE__ */ve(H,{name:"close",className:"h-4 w-4"}),$e.close]})]})]}),Co=!!me&&$t.some(e=>e.id===me),So=!Gt||Co||X?null:/* @__PURE__ */ge("div",{"data-modal-restore-tab":!0,"data-modal-id":Kt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-line-strong bg-surface px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
88
88
|
/* @__PURE__ */ve("button",{type:"button",onClick:()=>pr(Kt),title:$e.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:Ke||$e.windowSuffix}),
|
|
89
89
|
/* @__PURE__ */ve("button",{type:"button",onClick:()=>pr(Kt),title:$e.restore,"aria-label":$e.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
90
90
|
/* @__PURE__ */ve("button",{type:"button",onClick:()=>{hr()},title:$e.close,"aria-label":$e.close,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return xe(
|
|
91
|
-
/* @__PURE__ */ge(fn.Provider,{value:null,children:[Eo,Mo,So]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Hr&&"Escape"===e.key&&(so(null),Jr(!1))});var ho=100,fo={past:[],future:[]};function po(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>ho?r.slice(r.length-ho):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:fo}}var wo=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var yo=500,go=250;function vo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=we(po,fo),a=ie(/* @__PURE__ */new Map),[s,l]=se(0),c=s>0,[u,d]=se(0),[m,h]=se(0),f=m>0,{hasAnyPerm:p}=
|
|
91
|
+
/* @__PURE__ */ge(fn.Provider,{value:null,children:[Eo,Mo,So]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Hr&&"Escape"===e.key&&(so(null),Jr(!1))});var ho=100,fo={past:[],future:[]};function po(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>ho?r.slice(r.length-ho):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:fo}}var wo=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var yo=500,go=250;function vo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=we(po,fo),a=ie(/* @__PURE__ */new Map),[s,l]=se(0),c=s>0,[u,d]=se(0),[m,h]=se(0),f=m>0,{hasAnyPerm:p}=D(),w=t&&0===u&&(!(n&&n.length>0)||p(n)),y=ie(null),g=ie(!1),v=ce(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),b=ce((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),x=ce(e=>{a.current.delete(e)&&l(e=>e-1)},[]),k=ce(e=>{d(t=>t+(e?1:-1))},[]),E=ce(e=>{h(t=>t+(e?1:-1))},[]),[M,C]=se(0),S=M>0,N=ce(e=>{C(t=>t+(e?1:-1))},[]),T=ne(Ue),z=T?.claimReadOnly;ae(()=>{if(z&&!w)return z(!0),()=>z(!1)},[z,w]);const A=T?.claimOwnMount;ae(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const P=ie({last:0,count:0,tripped:!1}),I=ie(!1),R=ce((e,t,n)=>{if(g.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(!w||y.current)return;const r=P.current;if(r.tripped)return;const o=Date.now();if(o-r.last>go&&(r.count=0),r.last=o,++r.count>yo)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${yo} 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.`);y.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=y.current;y.current=null,e&&i({type:"record",step:e})})},[w,v]),W=ce(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),O=ce(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),i({type:"undo",redoStep:t})},[o.past,v,W]),$=ce(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),i({type:"redo",undoStep:t})},[o.future,v,W]),[K,j]=se(0),F=ie(0),B=ie(0),q=ie(!1),Y=ce(()=>{g.current=!0,I.current=!1,y.current=null,F.current+=1,B.current=F.current,j(F.current)},[]),H=ie(void 0),U=ce(e=>{void 0!==e&&(void 0!==H.current&&e!==H.current&&(q.current=!0),H.current=e),Y()},[Y]);ae(()=>{g.current&&K===B.current&&(g.current=!1,y.current=null,(I.current||q.current)&&i({type:"clear"}),I.current=!1,q.current=!1)},[K]);const X=ce(()=>{q.current=!0,i({type:"clear"}),Y()},[Y]),V=w&&o.past.length>0,J=w&&o.future.length>0,G=Yr(r),_=ie({undo:O,redo:$,canUndo:V,canRedo:J});_.current={undo:O,redo:$,canUndo:V,canRedo:J},ae(()=>{if(!G||!w)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&&wo.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=_.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[G,w]);const Z=fe(()=>({register:b,unregister:x,record:R,undo:O,redo:$,clear:X,baseline:U,canUndo:V,canRedo:J,enabled:w,hasState:c,handMounted:S,claimOwnMount:N,claimReadOnly:k,declaredEditable:f,claimEditable:E,undoLabel:V?o.past[o.past.length-1].label:null,redoLabel:J?o.future[0].label:null}),[b,x,R,O,$,X,U,V,J,w,c,S,N,k,f,E,o.past,o.future]),Q=""!==Cn(),ee=ne(L)?.footerOpen??!1,te=Q&&w&&c&&!S&ⅇ/* @__PURE__ */
|
|
92
92
|
return ge(Ue.Provider,{value:Z,children:[te&&/* @__PURE__ */ve(Ln,{position:"left",quiet:!0,children:/* @__PURE__ */ve(Ve,{auto:!0})}),e]})}function bo(){const e=ne(Ue),t=ce(()=>{},[]);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 xo(e){const t=ne(Ue),n=t?.claimReadOnly,r=t?.claimEditable;ae(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function ko(e,t,n){const r=ne(Ue),o=pe(),i=ie(e),a=ie(t);a.current=t,ae(()=>{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=ie(r);c.current=r;const u=ie({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},ae(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function Eo(e,t){const[n,r]=se(e);return ko(n,e=>r(()=>e),t),[n,r]}export{Tn as CancelButton,Pe as DesktopHostProvider,yt as DocFavStar,it as EntityWindowFallback,rt as EntityWindowLoading,at as EntityWindowState,yn as MODAL_SUBMIT_SELECTOR,mo as Modal,Ln as ModalActions,Nn as ModalMoreActions,Ve as UndoControls,vo as UndoProvider,Te as WINDOW_REGISTRY,Ye as WindowCrashedFallback,Sn as WindowEditSlot,He as WindowErrorBoundary,$t as WindowManagerProvider,En as WindowTitle,Et as activateWindowById,_t as beginWindowGesture,dr as cancelWindowFront,Ae as client_default,lo as commitExposeHighlight,ur as confirmWindowDiscard,Zt as drainPerfEvents,_r as exitExposeMode,Fn as forgetMaximizedWindowBoxes,St as getActiveWindowRoute,ao as getExposeHighlight,mn as getWindowChromeVersion,Kn as getWindowPosition,lt as isDraftEntityId,ct as isDraftEntityWindow,Se as isEntityEntry,Ce as isPageEntry,ze as isShellApiClientConfigured,Qe as isTabWindow,Gt as markMenuOpen,un as readWindowChrome,sr as requestWindowFront,so as setExposeHighlight,Jt as setPerfCollecting,Ke as setShellHomeRoute,qe as setShellTabStrip,Le as setShellWindowRegistry,$n as setWindowDefaultPosition,jn as setWindowPosition,rn as splitTitle,io as subscribeExposeHighlight,dn as subscribeWindowChrome,et as tabGroupOf,Gr as toggleExposeMode,rr as useCurrentTabKey,Ie as useDesktopHost,Cn as useEnclosingModalId,Yr as useIsActiveWindow,We as usePageSearch,bo as useUndo,xo as useUndoCanEdit,ko as useUndoable,Eo as useUndoableState,bn as useWidgetSettings,mt as useWindowDirty,ft as useWindowManager,kn as useWindowMenuItem,Mn as useWindowTitle,cr as windowHoldsChanges};
|