efficient-shell 13.20.0 → 13.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +10 -10
  2. package/dist/{Browser-XFEOOL5J.js → Browser-AE7OYSTS.js} +12 -12
  3. package/dist/{Calculator-V5SACDGQ.js → Calculator-QEQU3W2L.js} +11 -11
  4. package/dist/{CurrencyConverter-B3NWE6LM.js → CurrencyConverter-L22FF4ST.js} +7 -7
  5. package/dist/{Files-LRSNSZ5Y.js → Files-Y5UGT3RX.js} +77 -77
  6. package/dist/{Notepad-GGBFJNRE.js → Notepad-YZOEXYE3.js} +9 -9
  7. package/dist/{PomodoroTimer-XLPBKMWS.js → PomodoroTimer-6XHLOAJD.js} +64 -64
  8. package/dist/{Preview-CWGCGKR5.js → Preview-XQXSRAGY.js} +19 -19
  9. package/dist/{Stock-PRUMXULJ.js → Stock-36O4LW46.js} +3 -3
  10. package/dist/{Weather-FO5DVYQ4.js → Weather-BN6AJJ4S.js} +18 -18
  11. package/dist/{WorldClock-BYZ5BNLZ.js → WorldClock-TUVIRPTM.js} +6 -6
  12. package/dist/apps/index.js +1 -1
  13. package/dist/bin/browser-check.js +1 -1
  14. package/dist/bin/media-host-check.js +1 -1
  15. package/dist/bin/ui-check.js +1 -1
  16. package/dist/{chunk-XOCRRCCP.js → chunk-ABTVRB23.js} +1 -1
  17. package/dist/{chunk-IXJIHTUI.js → chunk-D4WO73XD.js} +29 -29
  18. package/dist/{chunk-JGKUENPD.js → chunk-H75CQD46.js} +1 -1
  19. package/dist/chunk-LZOKBMAF.js +1 -0
  20. package/dist/{chunk-YE2YU526.js → chunk-MUNP5Z24.js} +1 -1
  21. package/dist/{chunk-5EC62E65.js → chunk-SOXZRLSD.js} +2 -2
  22. package/dist/hooks/index.d.ts +2 -2
  23. package/dist/hooks/useTheme.d.ts +1 -1
  24. package/dist/index.js +58 -58
  25. package/dist/telemetry/index.js +1 -1
  26. package/dist/tokens/colour.d.ts +2 -2
  27. package/dist/ui/index.js +1 -1
  28. package/dist/version.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunk-VGUYAVDG.js +0 -1
@@ -1,4 +1,4 @@
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 h}from"./chunk-YI4T5I5D.js";import{Result as m}from"./chunk-M2TQOJ3G.js";import{CMD_Z as f,CMD_SHIFT_Z as p}from"./chunk-FBZUEZK7.js";import{CopyButton as w}from"./chunk-BG3C4ALM.js";import{confirm as y}from"./chunk-GMLOMLCS.js";import{useModalDragAside as g}from"./chunk-EIFNESXS.js";import{ItemCount as v}from"./chunk-SXHV5OLA.js";import{isInOverlayOver as b}from"./chunk-SF4IIV5Z.js";import{dialogA11y as x}from"./chunk-VWGWZY7A.js";import{ColoredBadge as k}from"./chunk-WRV6QKJN.js";import{ROW_HEIGHTS as E}from"./chunk-AW7TOB6N.js";import{LoadingSpinner as M}from"./chunk-4U5M37SF.js";import{activationOrder as C,activeListeners as S,ModalActionsContext as L,subscribeActive as N,getActiveModalId as z,KEY_ACTIVATED_SELECTOR as T}from"./chunk-F3ZOO23R.js";import{useShellAuth as A}from"./chunk-2QY5BJLA.js";import{useIsMobile as D,useIsPhone as I}from"./chunk-UGTRSRIW.js";import{useShellPrefs as P}from"./chunk-DPFEQQQU.js";import{focusableIn as R}from"./chunk-DWGYC7OD.js";import{StatusBadge as O}from"./chunk-YDJ5IZOU.js";import{PopupMenu as $,PopupMenuItem as W,PopupMenuDivider as K,PopupMenuLabel as j}from"./chunk-THAPVKEJ.js";import{Button_default as F}from"./chunk-UTISUEO4.js";import{Icon as B}from"./chunk-ISVODSRP.js";import{LoadingSpinner as q}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as H}from"./chunk-62LW225J.js";import{shellHttp as U,isShellHttpConfigured as Y}from"./chunk-STKJA4PV.js";import{fitBoxScale as X,fitFrameStyle as V}from"./chunk-M6UKCZHT.js";import{runEscapeInterceptors as G}from"./chunk-TWVUQUUD.js";import{useShellStrings as J}from"./chunk-IUVGHHR3.js";import{createContext as _,createElement as Z,useContext as Q,Component as ee,useLayoutEffect as te,useRef as ne,useEffect as re,useState as oe,useSyncExternalStore as ie,useCallback as ae,isValidElement as se,Fragment as le,Children as ce,cloneElement as ue,useMemo as de,useId as he,useReducer as me,Suspense as fe}from"react";import{jsxs as pe,jsx as we,Fragment as ye}from"react/jsx-runtime";import{createPortal as ge}from"react-dom";import{useLocation as ve}from"react-router-dom";import{useQueryClient as be,useQuery as xe}from"@tanstack/react-query";function ke(e){return"component"in e}function Ee(e){return"endpoint"in e}var Me={};function Ce(e){Me=e}var Se=new Proxy({},{get:(e,t)=>Me[t],has:(e,t)=>t in Me,ownKeys:()=>Object.keys(Me),getOwnPropertyDescriptor(e,t){if(t in Me)return{configurable:!0,enumerable:!0,value:Me[t]}}});function Le(){return Y()}var Ne=U,ze=_({});function Te({value:e,children:t}){return Z(ze.Provider,{value:e},t)}function Ae(){return Q(ze)}var De=_(null);function Ie(){return Q(De)?.pageSearch??""}var Pe=null,Re=/* @__PURE__ */new Set;function Oe(e){Pe!==e&&(Pe=e,Re.forEach(e=>e()))}function $e(){return Pe}function We(e){return Re.add(e),()=>{Re.delete(e)}}var Ke=null;function je(e){Ke=e}function Fe({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
1
+ import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,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 h}from"./chunk-YI4T5I5D.js";import{Result as m}from"./chunk-M2TQOJ3G.js";import{CMD_Z as f,CMD_SHIFT_Z as p}from"./chunk-FBZUEZK7.js";import{CopyButton as w}from"./chunk-BG3C4ALM.js";import{confirm as y}from"./chunk-GMLOMLCS.js";import{useModalDragAside as g}from"./chunk-EIFNESXS.js";import{ItemCount as v}from"./chunk-SXHV5OLA.js";import{isInOverlayOver as b}from"./chunk-SF4IIV5Z.js";import{dialogA11y as x}from"./chunk-VWGWZY7A.js";import{ColoredBadge as k}from"./chunk-WRV6QKJN.js";import{ROW_HEIGHTS as E}from"./chunk-AW7TOB6N.js";import{LoadingSpinner as M}from"./chunk-4U5M37SF.js";import{activationOrder as C,activeListeners as S,ModalActionsContext as L,subscribeActive as N,getActiveModalId as T,KEY_ACTIVATED_SELECTOR as z}from"./chunk-F3ZOO23R.js";import{useShellAuth as A}from"./chunk-2QY5BJLA.js";import{useIsMobile as D,useIsPhone as I}from"./chunk-UGTRSRIW.js";import{useShellPrefs as P}from"./chunk-DPFEQQQU.js";import{focusableIn as R}from"./chunk-DWGYC7OD.js";import{StatusBadge as O}from"./chunk-YDJ5IZOU.js";import{PopupMenu as $,PopupMenuItem as W,PopupMenuDivider as K,PopupMenuLabel as j}from"./chunk-THAPVKEJ.js";import{Button_default as F}from"./chunk-UTISUEO4.js";import{Icon as B}from"./chunk-ISVODSRP.js";import{LoadingSpinner as q}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as H}from"./chunk-62LW225J.js";import{shellHttp as U,isShellHttpConfigured as Y}from"./chunk-STKJA4PV.js";import{fitBoxScale as X,fitFrameStyle as V}from"./chunk-M6UKCZHT.js";import{runEscapeInterceptors as G}from"./chunk-TWVUQUUD.js";import{useShellStrings as J}from"./chunk-IUVGHHR3.js";import{createContext as _,createElement as Z,useContext as Q,Component as ee,useLayoutEffect as te,useRef as ne,useEffect as re,useState as oe,useSyncExternalStore as ie,useCallback as ae,isValidElement as se,Fragment as le,Children as ce,cloneElement as ue,useMemo as de,useId as he,useReducer as me,Suspense as fe}from"react";import{jsxs as pe,jsx as we,Fragment as ye}from"react/jsx-runtime";import{createPortal as ge}from"react-dom";import{useLocation as ve}from"react-router-dom";import{useQueryClient as be,useQuery as xe}from"@tanstack/react-query";function ke(e){return"component"in e}function Ee(e){return"endpoint"in e}var Me={};function Ce(e){Me=e}var Se=new Proxy({},{get:(e,t)=>Me[t],has:(e,t)=>t in Me,ownKeys:()=>Object.keys(Me),getOwnPropertyDescriptor(e,t){if(t in Me)return{configurable:!0,enumerable:!0,value:Me[t]}}});function Le(){return Y()}var Ne=U,Te=_({});function ze({value:e,children:t}){return Z(Te.Provider,{value:e},t)}function Ae(){return Q(Te)}var De=_(null);function Ie(){return Q(De)?.pageSearch??""}var Pe=null,Re=/* @__PURE__ */new Set;function Oe(e){Pe!==e&&(Pe=e,Re.forEach(e=>e()))}function $e(){return Pe}function We(e){return Re.add(e),()=>{Re.delete(e)}}var Ke=null;function je(e){Ke=e}function Fe({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
2
2
  return pe("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
3
  /* @__PURE__ */we(B,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
4
  /* @__PURE__ */pe("div",{className:"min-w-0",children:[
@@ -15,14 +15,14 @@ return we(m,{status:"404",title:i.notFound,className:Qe});const t=null==e||408==
15
15
  return we(m,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */we(F,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Qe})}/* @__PURE__ */
16
16
  return we(m,{status:"404",title:i.notFound,className:Qe})}function rt({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */we(ye,{children:t(e)}):/* @__PURE__ */we(nt,{...n})}var ot=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function it(e){return"string"==typeof e&&(e.startsWith("new-")||ot.test(e))}function at(e){if(it(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var st=_({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),lt=_(null);function ct(e){const t=Q(lt),n=ne(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),te(()=>{if(t)return t(n.current,e)},[t,e]),re(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function ut(){const e=ne(/* @__PURE__ */new Map),[t,n]=oe(!1);return{dirty:t,registerDirty:ae((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 dt(){return Q(st)}function ht(e){if("page"!==e.type&&at(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 mt({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=ut(),i=Se[e.route];if(!i||!ke(i))return null;const a=i,s=a.component;/* @__PURE__ */
17
17
  return we(io,{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__ */we(lt.Provider,{value:o,children:/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */we(M,{})}),children:/* @__PURE__ */we(s,{})})})})}function ft({entityType:e,entityId:t,label:n}){const r=J(),o=be(),{data:i}=xe({queryKey:["my-profile-sidebar"],enabled:Le(),queryFn:()=>Ne.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 we("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];Ne.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__ */we(B,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var pt=/* @__PURE__ */new Set,wt=()=>"hidden";function yt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=Se[e.entityType];if(!o||!Ee(o))return null;const i=o,[a,s]=oe(!1),{dirty:c,registerDirty:u}=ut(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=it(e.entityId),f=Ae(),p=(w=e.id,ie(N,()=>{const e=Xn.get(w);return null!=e&&Fn.has(e)}));var w;const y=!i.selfFetching&&!h&&!m&&Le(),g=xe({queryKey:[d,e.entityId],queryFn:()=>{return Ne.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:tt(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(Ve(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:Ge}),v=g.data,b=g.refetch;re(()=>{var t;if(y)return t=t=>{t!==e.id||pt.has(t)||b({cancelRefetch:!1})},lr.add(t),()=>{lr.delete(t)}},[b,e.id,y]);const x=ae(()=>{a&&!c?s(!1):t()},[a,c,t]),k=(i.useEdit??wt)(v??null),E=!i.useEdit||m||h?void 0:{state:k,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},C=i.selfFetching?e.label:v?i.title(v,a,s):e.label,S=i.icon,L=S?l[S]:null,z=C,T=!i.selfFetching&&v&&i.footer&&!h?i.footer(v):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(M,{}),children:i.render(v??e.entitySnapshot,t,e.entityId,a,s)}):null!=v?/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(io,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */we(et,{})}),children:i.render(v,t,e.entityId,a,s)}):/* @__PURE__ */we(io,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */we(nt,{isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b})}):/* @__PURE__ */we(io,{open:!0,onClose:x,onMinimize:n,initialBox:e.savedBox,icon:L,title:z,footer:T,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,edit:E,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */we(lt.Provider,{value:u,children:/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(et,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */we(rt,{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 gt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function vt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function bt(e){const t=gt(e),n=t??vt(e);if(!n)return;if(t&&!Er(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&cr(o)}function xt(){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 kt=/* @__PURE__ */new Map;function Et(){const e=xt();if(e)return kt.get(e)}function Mt(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var Ct="rosh-peek-style",St=H.peek,Lt=H.taskbarPreview;function Nt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Ct))return;const e=document.createElement("style");e.id=Ct,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${St}!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 zt(){"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 Tt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=J(),l=ne(null),[c,u]=oe({w:n,h:Math.round(.75*r)}),[d,h]=oe(!1);return te(()=>{const o=l.current;if(!o)return;const i=gt(e)??Mt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=X({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}),h(!0);const m=i.cloneNode(!0);m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px";const f=V(a.width,s);return Object.assign(m.style,{transform:f.transform??"",transformOrigin:f.transformOrigin}),m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */pe("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:[
18
+ return we("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];Ne.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__ */we(B,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var pt=/* @__PURE__ */new Set,wt=()=>"hidden";function yt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=Se[e.entityType];if(!o||!Ee(o))return null;const i=o,[a,s]=oe(!1),{dirty:c,registerDirty:u}=ut(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=it(e.entityId),f=Ae(),p=(w=e.id,ie(N,()=>{const e=Xn.get(w);return null!=e&&Fn.has(e)}));var w;const y=!i.selfFetching&&!h&&!m&&Le(),g=xe({queryKey:[d,e.entityId],queryFn:()=>{return Ne.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:tt(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(Ve(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:Ge}),v=g.data,b=g.refetch;re(()=>{var t;if(y)return t=t=>{t!==e.id||pt.has(t)||b({cancelRefetch:!1})},lr.add(t),()=>{lr.delete(t)}},[b,e.id,y]);const x=ae(()=>{a&&!c?s(!1):t()},[a,c,t]),k=(i.useEdit??wt)(v??null),E=!i.useEdit||m||h?void 0:{state:k,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},C=i.selfFetching?e.label:v?i.title(v,a,s):e.label,S=i.icon,L=S?l[S]:null,T=C,z=!i.selfFetching&&v&&i.footer&&!h?i.footer(v):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(M,{}),children:i.render(v??e.entitySnapshot,t,e.entityId,a,s)}):null!=v?/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(io,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */we(et,{})}),children:i.render(v,t,e.entityId,a,s)}):/* @__PURE__ */we(io,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */we(nt,{isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b})}):/* @__PURE__ */we(io,{open:!0,onClose:x,onMinimize:n,initialBox:e.savedBox,icon:L,title:T,footer:z,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,edit:E,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */we(lt.Provider,{value:u,children:/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(et,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */we(rt,{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 gt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function vt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function bt(e){const t=gt(e),n=t??vt(e);if(!n)return;if(t&&!Er(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&cr(o)}function xt(){const e=T();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var kt=/* @__PURE__ */new Map;function Et(){const e=xt();if(e)return kt.get(e)}function Mt(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var Ct="rosh-peek-style",St=H.peek,Lt=H.taskbarPreview;function Nt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Ct))return;const e=document.createElement("style");e.id=Ct,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${St}!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 Tt(){"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 zt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=J(),l=ne(null),[c,u]=oe({w:n,h:Math.round(.75*r)}),[d,h]=oe(!1);return te(()=>{const o=l.current;if(!o)return;const i=gt(e)??Mt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=X({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}),h(!0);const m=i.cloneNode(!0);m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px";const f=V(a.width,s);return Object.assign(m.style,{transform:f.transform??"",transformOrigin:f.transformOrigin}),m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */pe("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__ */we("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */pe("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
20
20
  /* @__PURE__ */we(B,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
21
- /* @__PURE__ */we("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */we("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__ */we("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__ */we(B,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function At({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=J(),s=e.length>1,l=ne(null),[c,u]=oe({left:-9999,top:-9999,ready:!1}),[d,h]=oe(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");te(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),re(()=>zt,[]);const m="top"===d,f=(m?"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 ge(
22
- /* @__PURE__ */we("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:Lt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{zt(),i()},children:e.map(e=>{const t=gt(e.id)??Mt(e.label),o=t?function(e){if(Er(e))return null;const t=e.getBoundingClientRect(),n=fr(),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__ */
21
+ /* @__PURE__ */we("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */we("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__ */we("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__ */we(B,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function At({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=J(),s=e.length>1,l=ne(null),[c,u]=oe({left:-9999,top:-9999,ready:!1}),[d,h]=oe(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");te(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),re(()=>Tt,[]);const m="top"===d,f=(m?"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 ge(
22
+ /* @__PURE__ */we("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:Lt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{Tt(),i()},children:e.map(e=>{const t=gt(e.id)??Mt(e.label),o=t?function(e){if(Er(e))return null;const t=e.getBoundingClientRect(),n=fr(),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 pe("div",{className:"group flex flex-col items-center",onMouseEnter:()=>Nt(t),children:[!m&&/* @__PURE__ */we("span",{className:f,children:e.label}),
24
- /* @__PURE__ */we(Tt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */we("span",{className:f,children:e.label}),null!==o&&/* @__PURE__ */pe("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__ */we(B,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function Dt(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 It({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=J(),[a,s]=oe(null);re(()=>{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=ie(N,z),[,u]=oe(0);re(()=>{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]=oe(0);re(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=Mt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,f]=oe(null),[p,w]=oe(null),[y,g]=oe(null),b=ne(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{f(null),w(null)},150)},k=e.filter(e=>!e.route||!Se[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?Se[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 ge(
24
+ /* @__PURE__ */we(zt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */we("span",{className:f,children:e.label}),null!==o&&/* @__PURE__ */pe("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__ */we(B,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function Dt(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 It({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=J(),[a,s]=oe(null);re(()=>{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=ie(N,T),[,u]=oe(0);re(()=>{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]=oe(0);re(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=Mt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,f]=oe(null),[p,w]=oe(null),[y,g]=oe(null),b=ne(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{f(null),w(null)},150)},k=e.filter(e=>!e.route||!Se[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?Se[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 ge(
26
26
  /* @__PURE__ */pe(ye,{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=gt(e.id)??Mt(e.label);return!!t&&!Er(t)});/* @__PURE__ */
27
27
  return pe("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&&se(n)?ue(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */we(B,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
28
28
  /* @__PURE__ */we("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */we("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */we(v,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */we("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__ */we(B,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
@@ -42,18 +42,18 @@ return pe(st.Provider,{value:{openWindows:o,openEntity:p,openPage:w,reorderWindo
42
42
  /* @__PURE__ */
43
43
  return we(De.Provider,{value:c(e),children:/* @__PURE__ */we(Be,{fallback:(t,n)=>/* @__PURE__ */we(io,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */we(Fe,{error:t,onReload:n})}),children:/* @__PURE__ */we(hn,{spec:ht(e),children:/* @__PURE__ */we(mo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */we(mt,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */we(yt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var Ot=400;function $t({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=ne(null),s=ne(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=ne(!1),c=ne(void 0),u=ne(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},Ot)};re(()=>{n&&!r&&h()},[n,r]),re(()=>{d&&n&&!r&&h()},[d]),re(()=>()=>clearTimeout(c.current),[]),re(()=>{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?R(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),te(()=>{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 Wt=null,Kt=/* @__PURE__ */new Set;function jt(){return Wt}function Ft(e){if(Wt!==e){Wt=e;for(const e of Kt)e()}}function Bt(e){return Kt.add(e),()=>{Kt.delete(e)}}var qt=!1,Ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Ut=()=>{};function Yt(e){qt=e,Ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Xt(e,t){qt&&("submenu"===e?Ht.submenus++:Ht.menus++,Ht.menuKey=t)}function Vt(e){if(!qt)return Ut;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!qt)return;const r=performance.now()-t;"move"===e?Ht.moveMs+=r:Ht.resizeMs+=r}}function Gt(){const e=Ht;return Ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Jt=/* @__PURE__ */new Set([O,k]),_t=e=>Jt.has(e)||"function"==typeof e&&"badge"===e.titleRole,Zt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Qt=/* @__PURE__ */new Set(["svg"]);function en(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return tn(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function tn(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=>tn(e,t,n));if(!se(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===le)return void ce.toArray(r.props.children).forEach(e=>tn(e,t,n));if("string"==typeof r.type){if(Qt.has(r.type))return;if(!Zt.has(r.type))return n.push(" "),ce.toArray(r.props.children).forEach(e=>tn(e,t,n)),void n.push(" ")}const o=ue(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(_t(r.type)?t.badges:t.actions).push(o)}var nn=/* @__PURE__ */new Map,rn=/* @__PURE__ */new Set,on=0;function an(){on++,rn.forEach(e=>e())}function sn(e){return nn.get(e)}function ln(e){return rn.add(e),()=>{rn.delete(e)}}function cn(){return on}var un=_(""),dn=_(null);function hn({spec:e,children:t}){/* @__PURE__ */
44
44
  return we(dn.Provider,{value:e,children:t})}var mn=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),fn='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function pn(e){return wn(e).replace(/\s+/g," ").trim()}function wn(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(wn).join("");if(se(e)){const t=e,n="string"==typeof t.type?t.type:"";return mn.has(n)?"":` ${wn(t.props?.children)} `}return""}function yn(e){const t=Q(un);re(()=>{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 gn={};function vn(e,t,n){const r=Q(un);re(()=>{if(!r)return;gn[r]||(gn[r]=[]);const o={label:e,icon:n,onClick:t};return gn[r].push(o),()=>{gn[r]=(gn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function bn({title:e}){const t=ne(null);return re(()=>{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__ */we("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function xn(e){}function kn(){return Q(un)}function En({children:e,position:t="right",quiet:n=!1}){const r=Q(L),[o,i]=oe(null);return re(()=>{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?ge(e,o):null}function Mn({onClick:e,children:t,className:n}){const r=Q(L);/* @__PURE__ */
45
- return we("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 Cn="erp_window_positions",Sn={};try{const e=localStorage.getItem(Cn);e&&(Sn=JSON.parse(e))}catch{}var Ln=null;function Nn(){Ln&&clearTimeout(Ln),Ln=setTimeout(()=>{try{localStorage.setItem(Cn,JSON.stringify(Sn))}catch{}},500)}var zn="erp_activation_order",Tn=[];try{const e=localStorage.getItem(zn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Tn=t)}catch{}var An=null;function Dn(){An&&clearTimeout(An),An=setTimeout(()=>{try{localStorage.setItem(zn,JSON.stringify(Tn))}catch{}},500)}function In(e,t){Sn[e]||(Sn[e]=t,Nn())}function Pn(e){return Sn[e]?{...Sn[e]}:null}function Rn(e,t){Sn[e]=t,Nn()}function On(){const r=e(),o=t();let i=!1;for(const e of Object.keys(Sn))n(Sn[e],r,o)&&(delete Sn[e],i=!0);i&&Nn()}var $n={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Wn=4e3,Kn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},jn={small:.8,medium:1,large:1.25,maximized:1.25},Fn=/* @__PURE__ */new Set,Bn=0,qn=/* @__PURE__ */new Map;var Hn=0;function Un(){return Hn}function Yn(){Hn++,S.forEach(e=>e())}var Xn=/* @__PURE__ */new Map,Vn=/* @__PURE__ */new Map,Gn=/* @__PURE__ */new Map;function Jn(){for(let e=C.length-1;e>=0;e--){const t=Gn.get(C[e]);if(t?.tab)return t.owner}return null}function _n(){return ie(N,Jn,()=>null)}var Zn=/* @__PURE__ */new Set;var Qn=null;function er(e){Qn=null,cr(e)}function tr(e){Qn=e;const t=Xn.get(e);t&&er(t)}var nr=/* @__PURE__ */new Map;function rr(e){return nr.get(e)?.holdsChanges()??!1}function or(e){const t=nr.get(e);return t?t.ask():Promise.resolve(!0)}function ir(e){Qn===e&&(Qn=null)}function ar(e,t,n){if(n&&Gn.set(e,n),t)if(Xn.set(t,e),Vn.set(e,t),Zn.delete(t)){C.unshift(e);const n=Tn.indexOf(t);-1!==n&&Tn.splice(n,1),Tn.unshift(t),Dn()}else!function(e,t){const n=Tn.indexOf(t);if(-1===n)return void C.push(e);let r=C.length;for(let e=0;e<C.length;e++){const t=Vn.get(C[e]);if(t&&Tn.indexOf(t)>n){r=e;break}}C.splice(r,0,e)}(e,t),-1===Tn.indexOf(t)&&(Tn.push(t),Dn());else C.push(e);Yn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Qn===t&&er(e)}function sr(e){return e?Gn.get(e)?.owner??Vn.get(e)??null:null}var lr=/* @__PURE__ */new Set;function cr(e){const t=sr(z()),n=C.indexOf(e);-1!==n&&C.splice(n,1),C.push(e);const r=Gn.get(e);if(r?.root)for(const[e,t]of Gn){if(t.root||t.owner!==r.owner||Fn.has(e))continue;const n=C.indexOf(e);-1!==n&&C.splice(n,1),C.push(e)}Fn.delete(e);const o=Vn.get(e);if(o){const e=Tn.indexOf(o);-1!==e&&Tn.splice(e,1),Tn.push(o),Dn(),Qn&&Qn!==o&&(Qn=null)}Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=sr(z());i&&i!==t&&lr.forEach(e=>e(i))}function ur(e){const t=C.indexOf(e);-1!==t&&C.splice(t,1),Fn.add(e),qn.set(e,++Bn);const n=Vn.get(e);if(n){const e=Tn.indexOf(n);-1!==e&&(Tn.splice(e,1),Dn())}Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var dr=/* @__PURE__ */new Set;var hr=8,mr=32;function fr(){return e()}var pr="flex size-6 shrink-0 items-center justify-center rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",wr="flex size-3 items-center justify-center rounded-full text-gray-900/70",yr="size-2 opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100",gr=E.windowBar,vr=80,br=384,xr=400;function kr(e,t=fr()){const n=Math.min(Math.max(e.x,t.x+vr-e.w),t.x+t.w-vr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-gr);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Er(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=fr();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 Mr(e){const t=fr(),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 Cr=null;function Sr(e){const t=(Cr||((Cr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${H.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(Cr)),Cr);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 Lr(){Cr&&(Cr.style.opacity="0",Cr.style.display="none")}var Nr=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],zr=350,Tr=200;function Ar({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o,children:i}){const[a,s]=oe(!1),l=ne(void 0),c=ne(void 0);re(()=>()=>{clearTimeout(l.current),clearTimeout(c.current)},[]);const u=()=>{clearTimeout(c.current),l.current=setTimeout(()=>s(!0),zr)},d=()=>{clearTimeout(l.current),c.current=setTimeout(()=>s(!1),Tr)};/* @__PURE__ */
45
+ return we("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 Cn="erp_window_positions",Sn={};try{const e=localStorage.getItem(Cn);e&&(Sn=JSON.parse(e))}catch{}var Ln=null;function Nn(){Ln&&clearTimeout(Ln),Ln=setTimeout(()=>{try{localStorage.setItem(Cn,JSON.stringify(Sn))}catch{}},500)}var Tn="erp_activation_order",zn=[];try{const e=localStorage.getItem(Tn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(zn=t)}catch{}var An=null;function Dn(){An&&clearTimeout(An),An=setTimeout(()=>{try{localStorage.setItem(Tn,JSON.stringify(zn))}catch{}},500)}function In(e,t){Sn[e]||(Sn[e]=t,Nn())}function Pn(e){return Sn[e]?{...Sn[e]}:null}function Rn(e,t){Sn[e]=t,Nn()}function On(){const r=e(),o=t();let i=!1;for(const e of Object.keys(Sn))n(Sn[e],r,o)&&(delete Sn[e],i=!0);i&&Nn()}var $n={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Wn=4e3,Kn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},jn={small:.8,medium:1,large:1.25,maximized:1.25},Fn=/* @__PURE__ */new Set,Bn=0,qn=/* @__PURE__ */new Map;var Hn=0;function Un(){return Hn}function Yn(){Hn++,S.forEach(e=>e())}var Xn=/* @__PURE__ */new Map,Vn=/* @__PURE__ */new Map,Gn=/* @__PURE__ */new Map;function Jn(){for(let e=C.length-1;e>=0;e--){const t=Gn.get(C[e]);if(t?.tab)return t.owner}return null}function _n(){return ie(N,Jn,()=>null)}var Zn=/* @__PURE__ */new Set;var Qn=null;function er(e){Qn=null,cr(e)}function tr(e){Qn=e;const t=Xn.get(e);t&&er(t)}var nr=/* @__PURE__ */new Map;function rr(e){return nr.get(e)?.holdsChanges()??!1}function or(e){const t=nr.get(e);return t?t.ask():Promise.resolve(!0)}function ir(e){Qn===e&&(Qn=null)}function ar(e,t,n){if(n&&Gn.set(e,n),t)if(Xn.set(t,e),Vn.set(e,t),Zn.delete(t)){C.unshift(e);const n=zn.indexOf(t);-1!==n&&zn.splice(n,1),zn.unshift(t),Dn()}else!function(e,t){const n=zn.indexOf(t);if(-1===n)return void C.push(e);let r=C.length;for(let e=0;e<C.length;e++){const t=Vn.get(C[e]);if(t&&zn.indexOf(t)>n){r=e;break}}C.splice(r,0,e)}(e,t),-1===zn.indexOf(t)&&(zn.push(t),Dn());else C.push(e);Yn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Qn===t&&er(e)}function sr(e){return e?Gn.get(e)?.owner??Vn.get(e)??null:null}var lr=/* @__PURE__ */new Set;function cr(e){const t=sr(T()),n=C.indexOf(e);-1!==n&&C.splice(n,1),C.push(e);const r=Gn.get(e);if(r?.root)for(const[e,t]of Gn){if(t.root||t.owner!==r.owner||Fn.has(e))continue;const n=C.indexOf(e);-1!==n&&C.splice(n,1),C.push(e)}Fn.delete(e);const o=Vn.get(e);if(o){const e=zn.indexOf(o);-1!==e&&zn.splice(e,1),zn.push(o),Dn(),Qn&&Qn!==o&&(Qn=null)}Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=sr(T());i&&i!==t&&lr.forEach(e=>e(i))}function ur(e){const t=C.indexOf(e);-1!==t&&C.splice(t,1),Fn.add(e),qn.set(e,++Bn);const n=Vn.get(e);if(n){const e=zn.indexOf(n);-1!==e&&(zn.splice(e,1),Dn())}Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var dr=/* @__PURE__ */new Set;var hr=8,mr=32;function fr(){return e()}var pr="flex size-6 shrink-0 items-center justify-center rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",wr="flex size-3 items-center justify-center rounded-full text-gray-900/70",yr="size-2 opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100",gr=E.windowBar,vr=80,br=384,xr=400;function kr(e,t=fr()){const n=Math.min(Math.max(e.x,t.x+vr-e.w),t.x+t.w-vr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-gr);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Er(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=fr();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 Mr(e){const t=fr(),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 Cr=null;function Sr(e){const t=(Cr||((Cr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${H.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(Cr)),Cr);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 Lr(){Cr&&(Cr.style.opacity="0",Cr.style.display="none")}var Nr=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],Tr=350,zr=200;function Ar({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o,children:i}){const[a,s]=oe(!1),l=ne(void 0),c=ne(void 0);re(()=>()=>{clearTimeout(l.current),clearTimeout(c.current)},[]);const u=()=>{clearTimeout(c.current),l.current=setTimeout(()=>s(!0),Tr)},d=()=>{clearTimeout(l.current),c.current=setTimeout(()=>s(!1),zr)};/* @__PURE__ */
46
46
  return pe("span",{className:"relative inline-flex",onMouseEnter:u,onMouseLeave:d,children:[
47
- /* @__PURE__ */we("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__ */we("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:Nr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */we("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__ */we("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Dr="rosh-gesture-style";var Ir={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},Pr=4;function Rr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(Dr))return;const e=document.createElement("style");e.id=Dr,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=Vt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Or(e){const t=C.indexOf(e);if(-1===t)return-1;const n=H.window+t*H.windowStep,r=Gn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of Gn){if(!t.root||t.owner!==r.owner)continue;const n=C.indexOf(e);-1!==n&&(o=Math.max(o,H.window+n*H.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=C.length-1;e>=0;e--)dr.has(C[e])||C.splice(e,1);Tn=Tn.filter(e=>{const t=Xn.get(e);return null!=t&&dr.has(t)}),Dn(),Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var $r="modal-close-request";function Wr(e){ie(N,Un);const t=Q(L);if(C.length<=1)return!0;if(e){const t=Xn.get(e);if(null!=t)return z()===t}return t?.active??null!=z()}var Kr=!1,jr=/* @__PURE__ */new Set;function Fr(e){return jr.add(e),()=>jr.delete(e)}function Br(){return Kr}function qr(e){Kr!==e&&(Kr=e,jr.forEach(e=>e()))}function Hr(){qr(!Kr)}function Ur(){qr(!1)}var Yr=null,Xr=/* @__PURE__ */new Set;function Vr(e){return Xr.add(e),()=>Xr.delete(e)}function Gr(){return Yr}function Jr(e){Yr!==e&&(Yr=e,Xr.forEach(e=>e()))}var _r=null,Zr=/* @__PURE__ */new Set;function Qr(e){return Zr.add(e),()=>Zr.delete(e)}function eo(){return _r}function to(e){_r!==e&&(_r=e,Zr.forEach(e=>e()))}function no(){if(!_r)return void qr(!1);Jr(_r),to(null),qr(!1)}function ro(){qr(!Kr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function oo(){const e=ie(Fr,Br),[t,n]=oe(e),[r,o]=oe(e);return re(()=>{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?ge(
48
- /* @__PURE__ */we("div",{onMouseDown:e=>{e.stopPropagation(),qr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:H.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 io({open:t,onClose:l,title:c,icon:u,copyText:m,size:f="lg",dirty:p=!1,onNext:w,onPrev:v,footer:k,bodyScroll:M,onMinimize:S,initialBox:A,actions:R,actionsLeft:O,editing:j=!1,edit:q,allowPinOnTop:U,initialPosition:Y,widget:V,compact:_,appStyle:Z,flushBody:ee,autoHeight:se,autoMinHeight:le,autoWidth:ce,widgetMenu:ue,dimensions:me,windowKey:fe,openedFromKey:ve,accentRgb:be,children:xe}){const[ke,Ee]=oe(()=>r()),Me=D()&&!ke,Ce=I()&&!!V,[Se,Le]=oe(0),[Ne,ze]=oe(!1),Te=ne(null),Ae=ne(0);re(()=>{Ae.current=Se},[Se]);const Ie=ae(e=>{Me&&(Te.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},ze(!0),Ft(ve??null))},[Me,ve]),Pe=ie(Bt,jt);re(()=>{if(!Ne)return;const e=e=>{if(!Te.current)return;const t=e.clientX-Te.current.startX;if(Math.abs(e.clientY-Te.current.startY)>Math.abs(t)+12)return Te.current=null,ze(!1),Le(0),void Ft(null);Le(Math.max(0,t))},t=()=>{if(!Te.current)return;const e=.3*window.innerWidth,t=Ae.current>e;Te.current=null,ze(!1),t?(Le(window.innerWidth),setTimeout(()=>{l(),Le(0),Ft(null)},180)):(Le(0),Ft(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)}},[Ne]);const[Re,Oe]=oe(c),$e=J(),We=$e.window;re(()=>{Oe(c)},[c]);const Ke=de(()=>pn(Re).trim()||void 0,[Re]),je=he(),[Fe,He]=oe(!1),Ye=ne(!1),[Xe,Ve]=oe(!1),[Ge,Je]=oe(null),_e=Q(dn),Ze=Q(De),{prefs:Qe,save:et}=P(),tt=!!Qe.window_accent_stripe,nt=Qe.favorite_documents||[],rt=!!_e&&nt.some(e=>e.entityType===_e.entityType&&e.entityId===_e.entityId),ot=ae(()=>{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]=oe(null),[st,lt]=oe("top-right"===Y?"right":"left"),ut=ne(!1),ht=ne(null);te(()=>{const e=ht.current;e&&(be?e.style.setProperty("--window-accent-rgb",be):e.style.removeProperty("--window-accent-rgb"))},[be]);const mt=ne(!1),ft=ne(null),pt=ne(null),wt=ne(null),[yt,gt]=oe(!1),vt=ne(null),bt=ne(null),xt=ne(null),[kt,Et]=oe(!1);te(()=>{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=!!q&&!V&&!_&&!Z&&(q.editing||"hidden"!==q.state),Ct=!!(k||R||O)||yt||Mt,St=Q(qe),Lt=""!==Q(un),Nt=ne(null);Nt.current=Ze?{owner:Ze.key,tab:Ze.tab,root:!Lt}:null;const zt=fe||(Ze&&!Lt?Ze.key:null),Tt=!!St&&!Lt&&St.enabled&&St.hasState&&(j||St.declaredEditable)&&!St.handMounted&&Ct&&!V&&!_&&!Z&&!Me,At=40,{minimize:Dt,items:It,restoreIfMinimized:Pt,openWindows:Rt}=dt(),Ot=ne(`modal-${Math.random().toString(36).slice(2,8)}`).current,Wt=g(Ot);re(()=>{if(V)return dr.add(Ot),()=>{dr.delete(Ot)}},[V,Ot]),re(()=>{const e=e=>{const t=e.detail;t?.id===Ot&&Oe(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Ot]);const[Kt,qt]=oe(H.window),Ht=function(e){const t=ie(N,z);return C.length<=1||t===e}(Ot),Ut=ne(q);Ut.current=q;const Yt=!!q&&!q.editing&&"enabled"===q.state;re(()=>{if(!t||!Ht||!Yt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(b(e.target,ht.current)||(e.preventDefault(),e.stopPropagation(),Ut.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Ht,Yt]);const Xt=function(e){return ie(N,()=>Fn.has(e))}(Ot);$t({panelRef:ht,bodyRef:ft,open:t,widget:!!V,active:Ht,minimized:Xt});const Vt=ie(Fr,Br),Gt=ie(Vr,Gr),Jt=ie(Qr,eo),_t=!U&&!V,Zt=Vt&&_t,[Qt,tn]=oe(!1),rn=Zt&&Jt===Ot,[on,sn]=oe(!1),ln=on&&_t&&Gt===Ot?"picked":null,cn=ne(Zt);re(()=>{if(cn.current&&!Zt){sn(!0);const e=setTimeout(()=>{sn(!1),Yr===Ot&&Jr(null)},700);return cn.current=Zt,()=>clearTimeout(e)}cn.current=Zt},[Zt,Ot]),re(()=>{Zt||tn(!1)},[Zt]),re(()=>{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]),re(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ht.current){const t=ht.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 hn=ne(!1),mn=ae(e,[]),wn=ae(()=>{const t=e(),n=me?me[0]:$n[f]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=jn[Kn()],l=me?Math.min(me[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(At,(i-l)/2),d=(o-a)/2,h=t.h-At-l-u;return"top-right"===Y?{x:t.x+t.w-a-At,y:t.y+At,w:a,h:l}:"top-left"===Y?{x:t.x+At,y:t.y+At,w:a,h:l}:{x:t.x+Math.max(At,(o-a)/2+At)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,h)),w:a,h:l}},[f]),yn=ne(!1);t||(yn.current=!1);const vn=fe||m||null;re(()=>{if(!t)return;ar(Ot,vn,Nt.current??void 0),fe||cr(Ot),hn.current=!1,qt(Or(Ot));const e=()=>{qt(Or(Ot))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===fe;if(!e.label)return!1;const t=ht.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(cr(Ot),An.current)return;const t=fr(),n=Math.min(Bn.current.w,t.w-40),o=Math.min(Bn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;kn({x:i,y:a,w:n,h:o}),On(!1)},i=e=>{const t=e.detail;r(t)&&(cr(Ot),Je({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==fe)return;cr(Ot);const t=Bn.current,n=function(e,t=fr()){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=ht.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)}kn(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),Yn()),Fn.delete(e),qn.delete(e),Gn.delete(e);const n=Vn.get(e);n&&(Vn.delete(e),Xn.delete(n))}(Ot),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,Ot,vn,mn]);const bn=!V&&"maximized"===Kn(),[xn,kn]=oe(()=>{if(vn&&Sn[vn]){const e={...Sn[vn]};return me&&(e.w=me[0],se||(e.h=me[1])),kr(e)}return A?{x:A.x,y:A.y,w:A.w,h:A.h}:bn?mn():wn()}),[En,Mn]=oe(()=>!se),Cn=ne(ke),Ln=ne(null);re(()=>{const e=()=>{const e=r();e!==Cn.current&&Ln.current?.(e),Cn.current=e,Ee(e),qt(Or(Ot))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Ot]);const zn=ke&&!!Ze?.tab&&!Lt&&!V&&!Me,Tn=zn,An=ne(Tn);An.current=Tn;const Dn=_n(),In=ke&&!!Ze?.tab&&!V&&!Me&&!Vt&&Dn!==Ze.key,Pn=!!V&&ke&&!Vt&&null!==Dn,[Rn,On]=oe(()=>vn&&Sn[vn]||A?Tn:Tn||bn),Bn=ne(xn);Bn.current=xn;const Hn=ne(Rn);te(()=>{Hn.current=Rn},[Rn]),te(()=>{if(En||zn)return;const e=ht.current,t=ft.current;if(!e||!t)return;const n=le??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const f=t.offsetHeight,p=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>p+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Bn.current.y)-24),g=w?Math.min(Bn.current.h,y):Math.min(Math.max(n,u+f),y),v=Math.abs(g-o)>1;v&&(o=g,kn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Mn(!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)}},[En,V,le,Ct,zn]),te(()=>{if(!se||!En||V||!t)return;const e=vt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=so.current?0:e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||Rn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=le??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Bn.current.y)-24);kn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[se,En,V,t,Rn,le]);const Un=!1!==ce&&!V&&!Z&&!Me,[Jn,Zn]=oe(()=>!Un);te(()=>{if(Jn||!t)return;if(!Un||Rn)return void Zn(!0);const n=ht.current,r=ft.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=Bn.current.w,c=0;const u=()=>Zn(!0),d=()=>{c=0;const t=Bn.current;if(Math.abs(t.w-l)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],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||(m.push(e),f.push(t))}if(!m.length)return;const p=Math.min(h,t.w+Math.max(...f)),w=p-t.w,y=n.style.width;n.style.width=`${p}px`;const g=m.map((e,t)=>({over:f[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(m[t])});const v=a(t,s(t.w,w,g),d,At);v!==t&&(l=v.w,kn(v))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Wn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Jn,t,Un,Rn]);const Qn=ne(null),er=!(!Ze?.tab||Lt||V||Me);Ln.current=t=>{if(!er)return;if(t)return Qn.current||(Qn.current={box:{...Bn.current},maximized:Hn.current}),void(Hn.current=!0);const r=Qn.current;Qn.current=null;const o=e();if(r?.maximized)return Hn.current=!0,On(!0),void kn(o);const i=r?.box??(vn?Sn[vn]:void 0);if(Hn.current=!1,On(!1),i&&!n(i,o,!1)){const e={...i};me&&(e.w=me[0],se||(e.h=me[1])),kn(kr(e))}else kn(wn())},re(()=>{Tn&&(Hn.current=!0,On(!0),kn(mn()))},[Tn,mn]),re(()=>{if(V)return;const e=()=>{const e=vn?Sn[vn]:void 0;if(Hn.current=!1,On(!1),e){const t={...e};me&&(t.w=me[0],se||(t.h=me[1])),kn(kr(t))}else kn(wn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,wn,vn]),re(()=>{t&&vn&&!zn&&(Sn[vn]=xn,Nn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[xn,t,vn,zn]),re(()=>{if(!t)return;const e=()=>{Hn.current?kn(mn()):document.body.classList.contains("rosh-gesturing")||kn(kr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Rn&&(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,Rn,mn]),re(()=>{if(t&&(He(!1),Ye.current=!1,ut.current=!1,Zn(!Un),!An.current)){if(vn&&Sn[vn]){const e=Sn[vn];return void kn(t=>kr({...e,...se?{h:t.h}:{},...Un?{x:t.x,w:t.w}:{}}))}A&&(kn({x:A.x,y:A.y,w:A.w,h:A.h}),On(A.maximized))}},[t]),re(()=>{if(!t||"auto"!==p)return;let e;const n=t=>{ht.current?.contains(t.target)&&!Ye.current&&(Ye.current=!0,e=setTimeout(()=>He(!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 tr="auto"===p?Fe:!0===p,rr=Ze&&!Lt?Ze.key:null,or=de(()=>en(Re),[Re]),ir=ne({shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:$e.taskbar});te(()=>{ir.current={shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:$e.taskbar}});const sr=ne(null);sr.current||(sr.current={open:(e,t)=>Je({x:e,y:t}),items:()=>{const e=ir.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of gn[Ot]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),re(()=>{if(t&&rr)return()=>{return e=rr,void(nn.delete(e)&&an());var e}},[t,rr]),ct(!(fe||!t)&&tr);const lr=ae(()=>tr||"auto"===p&&Ye.current,[tr,p]),gr=ae(async e=>{if(ut.current)return!1;if(!lr())return!0;ut.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 ut.current=!1,r},[lr,Ke]),vr=ae(()=>ut.current?Promise.resolve():lr()?gr("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[lr,gr,l]),Er=ae(async()=>{await gr("discard")&&(Ye.current=!1,He(!1),Ut.current?.onDiscard())},[gr]),Cr=ae(async()=>{const e=await gr("switch");return e&&(Ye.current=!1,He(!1)),e},[gr]),Nr=ne(()=>!1);te(()=>{Nr.current=lr}),te(()=>{if(!t||!fe)return;const e={holdsChanges:()=>Nr.current(),ask:Cr};return nr.set(fe,e),()=>{nr.get(fe)===e&&nr.delete(fe)}},[t,fe,Cr]),te(()=>{if(!t||!zt)return;const e=e=>{e.detail?.windowKey===zt&&vr()};return window.addEventListener($r,e),()=>window.removeEventListener($r,e)},[t,zt,vr]);const zr=ne(null),Tr=ae(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Je(null),cr(Ot),An.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=ht.current,s=a?.getBoundingClientRect();let l,c,u,d;if(zr.current){const t=zr.current;zr.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:Bn.current.x,c=s?s.top:Bn.current.y,u=s?s.height:Bn.current.h,d=s?s.width:Bn.current.w;On(!1),kn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<Pr&&Math.abs(e.clientY-i)<Pr)return;r=Rr(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)`),Bn.current={...Bn.current,x:s,y:u},!V){const t=function(e,t){const n=fr(),r=e<=n.x+hr,o=e>=n.x+n.w-hr,i=t<=n.y+hr,a=t>=n.y+n.h-hr,s=e<=n.x+mr,l=e>=n.x+n.w-mr,c=t<=n.y+mr,u=t>=n.y+n.h-mr;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!==h&&(h=t,t?Sr(Mr(t)):Lr())}},f=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",f),r?.(),Lr();const e=kr({...Bn.current});if(Bn.current=e,!V&&h){zr.current={x:l,y:c,w:d,h:u};const e=Mr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void kn(e)}if(V){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=""),kn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",f)},[]),Dr=ae((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=ht.current,l=s?.getBoundingClientRect(),c=l?l.left:Bn.current.x,u=l?l.top:Bn.current.y,d=l?l.width:Bn.current.w,h=l?l.height:Bn.current.h,m="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;On(!1),kn({x:c,y:u,w:d,h:h}),Bn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Bn.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)<Pr&&Math.abs(e.clientY-a)<Pr)return;o=Rr(n,r,Ir[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(p&&(o=Math.max(br,d+e)),w&&(i=Math.max(xr,h+t)),m){const t=Math.max(br,d-e);n=c+d-t,o=t}if(f){const e=Math.max(xr,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),kn({...Bn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Wr=ae(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(),cr(Ot),"Enter"===e.key)return void(Rn?(On(!1),kn(wn())):(On(!0),kn(mn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{zr.current||(zr.current={...Bn.current})};if(r<0)return e(),On(!0),void kn(mn());if(r>0){if(Rn)return On(!1),void kn(wn());if(zr.current){const e=kr(zr.current);return zr.current=null,Bn.current=e,void kn(e)}return void ur(Ot)}e(),On(!1);const t=Mr(n<0?"left":"right");return Bn.current=t,void kn(t)}if(Rn)return;const o=Bn.current,i=e.shiftKey?{...o,w:Math.max(br,o.w+24*n),h:Math.max(xr,o.h+24*r)}:kr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Bn.current=i,kn(i)},[Ot,Rn,wn,mn]),Kr=ae(e=>{zr.current||(zr.current={...Bn.current}),On(!1);const t=Mr(e);Bn.current=t,kn(t),cr(Ot)},[Ot]),jr=!V&&!zn&&!Me,[Hr,Ur]=oe(0),Xr=jr&&!_&&!Z&&(!!R||!!O||yt||Mt||Tt),_r=jr&&Hr>0&&!Xr,Zr=ne(_r);Zr.current=_r;const to=!!_||!!Z,no=to?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)",ro=ae(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:(Ur(e=>e+1),()=>Ur(e=>Math.max(0,e-1)))},[]),oo=de(()=>jr?{compact:to,over:_r,claim:ro}:null,[jr,to,_r,ro]),[io,ao]=oe(0),so=ne(jr);so.current=jr,te(()=>{const e=vt.current;if(!e||!Xr)return void ao(0);const t=()=>ao(Math.ceil(e.offsetWidth));if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Xr]);const lo=ae(e=>{if(Zt)return;e.preventDefault(),e.stopPropagation();const t=0===e.clientX&&0===e.clientY,n=e.currentTarget.getBoundingClientRect();Je(t?{x:n.left,y:n.bottom+4}:{x:e.clientX,y:e.clientY})},[Zt]),co=!!be&&tt&&!V&&!Me,uo=Tn||Zt?{}:{tabIndex:0,role:"group","aria-label":Ke?`${Ke} — ${We.windowSuffix}`:We.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:Wr},ho=()=>{On(!0),kn(mn())},mo=ae(()=>{const e=ht.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(fn);t&&!t.disabled&&t.click()}},[]);re(()=>{if(!t)return;if(V)return;const e=e=>{if(C[C.length-1]===Ot&&!b(e.target,ht.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),mo();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ht.current?.contains(t)))return;if(t.closest(T))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,mo,Ot,V]),re(()=>{if(!t)return;const e=e=>{C[C.length-1]===Ot&&(b(e.target,ht.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Ot}})),Ye.current=!1,He(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Ot}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),re(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&C[C.length-1]===Ot){if(G(e))return e.preventDefault(),void e.stopPropagation();if(zn&&!j)return;e.preventDefault(),e.stopPropagation(),vr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,vr,Ot,V,zn,j]);const fo=t&&(void 0!==w||void 0!==v),[po]=oe(()=>{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&&or.actions.length>0;re(()=>{t&&rr&&function(e,t){const n=nn.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(nn.set(e,t),an())}(rr,{title:or.text||Ke,dirty:tr,copy:or.copy,actions:wo&&po?po:void 0,menu:sr.current??void 0})},[t,rr,Ke,tr,or.text,or.copy,wo,po]);const yo=ae(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(re(()=>{if(!t)return;const e=e=>{if(C[C.length-1]!==Ot)return;if(b(e.target,ht.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,Ot]),!t||yn.current)return null;const go=Zt?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=fr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(Ot):null,vo=Zt&&go?X({width:go.w,height:go.h},{width:xn.w,height:xn.h}):1,bo=(()=>{if(Zt&&go){const e=vo,t=xn.w*e,n=xn.h*e,r=go.x+(go.w-t)/2-xn.x,o=go.y+(go.h-n)/2-xn.y,i=Qt||rn;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:H.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(on&&_t){const e="picked"===ln;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:H.expose+30}:{}}}return null})(),xo=x({modal:!1,titleId:!V&&(zn?!Ze?.home:!Me)?je:void 0,label:or.text||Ke}),ko=/* @__PURE__ */pe("div",{children:[
49
- /* @__PURE__ */pe("div",{ref:ht,"data-modal-panel":!0,"data-modal-id":Ot,"data-window-key":fe||void 0,...U?{"data-utility":""}:{},...Xe?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...Ze?{"data-window-owner":Ze.key}:{},...Ze&&!Lt?{"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 "+(V?Ht?"shadow-xl":"shadow-lg":"border "+(Ht?"shadow-xl border-line":"shadow-lg border-line-strong")),onPointerDown:e=>{if(!Zr.current||Zt||0!==e.button)return;const t=e.target;if(t.closest("[data-modal-panel]")!==ht.current)return;if(t.closest("[data-window-chrome]"))return;const n=e.currentTarget.getBoundingClientRect(),r=n.height/(e.currentTarget.offsetHeight||n.height),o=(to?E.compactBar:E.windowBar)*r;e.clientY-n.top>o||t.closest(h)||Tr(e)},onContextMenu:e=>{const t=e.target;t.closest("[data-window-strip]")&&t.closest("[data-modal-panel]")===ht.current&&lo(e)},onMouseDownCapture:e=>{if(mt.current=!1,Zt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Jr(Ot),qr(!1),void cr(Ot)}if(!Ht&&!V&&!Xe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ht.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),mt.current=!0,Je(null),cr(Ot),window.addEventListener("mouseup",()=>{setTimeout(()=>{mt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{mt.current&&(mt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Zt)return;Je(null);e.target.closest("[data-modal-panel]")===ht.current&&(e.target.closest("button, input, a, select, textarea")||cr(Ot))},style:Me?{zIndex:Kt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Se}px)`,transition:Ne?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...Kt<0?{display:"none"}:{},...Ht||Xe||Pe&&fe===Pe?{}:{display:"none"},...Wt?{visibility:"hidden",pointerEvents:"none"}:{}}:{zIndex:Xe?H.pinnedWindow:Kt+1,width:xn.w,height:xn.h,top:xn.y,...V&&"right"===st?{right:window.innerWidth-xn.x-xn.w}:{left:xn.x},...Kt<0&&!Xe?{display:"none"}:{},...Ce?{display:"none"}:{},...In||Pn||Wt?{visibility:"hidden",pointerEvents:"none"}:{},...bo??{}},children:[Me&&!V&&/* @__PURE__ */we("div",{onPointerDown:Ie,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),
50
- /* @__PURE__ */pe("div",{"data-window-surface":"",className:"flex min-h-0 flex-1 flex-col "+(jr?"backdrop-blur-sm":""),style:jr?{backgroundColor:Ht?"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:[V?null:zn?Ze?.home?null:/* @__PURE__ */pe(ye,{children:[
51
- /* @__PURE__ */we("h2",{id:je,"data-window-title":!0,className:"sr-only",children:or.text||Ke}),wo&&po&&ge(
52
- /* @__PURE__ */we(ye,{children:or.actions}),po),or.badges.length>0&&/* @__PURE__ */we("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:or.badges})]}):Me?null:
53
- /* @__PURE__ */pe("div",{onPointerDown:Tr,onContextMenu:lo,"data-window-chrome":"",..._r?{"data-window-controls-over":""}:{},...uo,className:_r?`absolute left-0 z-10 flex ${no} 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 ${no} 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",..._r?{top:co?3:0}:{paddingRight:Xr?io:void 0}},children:[!Zt&&/* @__PURE__ */pe("div",{"data-window-controls":"",className:"group/controls flex shrink-0 items-center",children:[
54
- /* @__PURE__ */we("button",{type:"button",onClick:vr,"aria-label":We.close,title:We.close,className:pr,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-red-500":"bg-gray-300 group-hover/controls:bg-red-500"}`,children:/* @__PURE__ */we(B,{name:"close",className:yr,strokeWidth:3})})}),!_&&/* @__PURE__ */we("button",{type:"button",onClick:()=>ur(Ot),"aria-label":We.minimize,title:We.minimize,className:pr,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-amber-400":"bg-gray-300 group-hover/controls:bg-amber-400"}`,children:/* @__PURE__ */we("span",{className:"h-0.5 w-2 rounded-full bg-current opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100"})})}),!_&&/* @__PURE__ */we(Ar,{maximized:Rn,onToggleMax:()=>{Rn?(On(!1),kn(wn())):ho()},onSnap:Kr,buttonClassName:pr,strings:We,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-green-500":"bg-gray-300 group-hover/controls:bg-green-500"}`,children:/* @__PURE__ */we(B,{name:Rn?"collapse":"expand",className:yr,strokeWidth:3})})}),U&&/* @__PURE__ */we("button",{type:"button",onClick:()=>Ve(e=>!e),"aria-label":Xe?We.unpin:We.pinOnTop,title:Xe?We.unpin:We.pinOnTop,className:"ml-1 p-0.5 rounded hover:bg-gray-200 "+(Xe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */we(B,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Xe?"currentColor":"none",strokeWidth:1.5})})]}),_r?
55
- /* @__PURE__ */we("h2",{id:je,"data-window-title":!0,className:"sr-only",children:or.text||Ke}):/* @__PURE__ */we("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:Ht?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:/* @__PURE__ */we("span",{id:je,className:"truncate",children:Zt?pn(Re):Re})})]}),co&&/* @__PURE__ */we("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Ht?.9:.55})`}}),
56
- /* @__PURE__ */we(un.Provider,{value:Ot,children:/* @__PURE__ */we(d.Provider,{value:oo,children:/* @__PURE__ */we(L.Provider,{value:{rightRef:pt,leftRef:wt,notify:()=>gt(!0),active:Ht,isDirty:tr,footerOpen:Ct&&!V&&!_&&!Z&&!Me},children:/* @__PURE__ */we("div",{ref:ft,"data-window-body":"",...V?{onPointerDown:Tr,onContextMenu:e=>{e.preventDefault(),at({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":Z||ee?"p-0":_?"p-2":"p-4"} ${V||zn||jr?"":"backdrop-blur-sm"} ${!1===M||Z||ee?"overflow-hidden":"overflow-y-auto overscroll-contain"+(jr?" mb-2 mr-1":"")} ${V?"rounded-2xl select-none":""}`,style:{...V?{touchAction:"none"}:{},backgroundColor:V||jr?"transparent":zn?"rgb(var(--window-content-rgb))":Ht?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */we(Be,{children:xe})})})})})]}),V&&it&&/* @__PURE__ */pe($,{minWidth:160,style:{left:it.x,top:it.y},onClose:()=>at(null),children:[
47
+ /* @__PURE__ */we("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__ */we("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:Nr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */we("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__ */we("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Dr="rosh-gesture-style";var Ir={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},Pr=4;function Rr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(Dr))return;const e=document.createElement("style");e.id=Dr,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=Vt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Or(e){const t=C.indexOf(e);if(-1===t)return-1;const n=H.window+t*H.windowStep,r=Gn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of Gn){if(!t.root||t.owner!==r.owner)continue;const n=C.indexOf(e);-1!==n&&(o=Math.max(o,H.window+n*H.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=C.length-1;e>=0;e--)dr.has(C[e])||C.splice(e,1);zn=zn.filter(e=>{const t=Xn.get(e);return null!=t&&dr.has(t)}),Dn(),Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var $r="modal-close-request";function Wr(e){ie(N,Un);const t=Q(L);if(C.length<=1)return!0;if(e){const t=Xn.get(e);if(null!=t)return T()===t}return t?.active??null!=T()}var Kr=!1,jr=/* @__PURE__ */new Set;function Fr(e){return jr.add(e),()=>jr.delete(e)}function Br(){return Kr}function qr(e){Kr!==e&&(Kr=e,jr.forEach(e=>e()))}function Hr(){qr(!Kr)}function Ur(){qr(!1)}var Yr=null,Xr=/* @__PURE__ */new Set;function Vr(e){return Xr.add(e),()=>Xr.delete(e)}function Gr(){return Yr}function Jr(e){Yr!==e&&(Yr=e,Xr.forEach(e=>e()))}var _r=null,Zr=/* @__PURE__ */new Set;function Qr(e){return Zr.add(e),()=>Zr.delete(e)}function eo(){return _r}function to(e){_r!==e&&(_r=e,Zr.forEach(e=>e()))}function no(){if(!_r)return void qr(!1);Jr(_r),to(null),qr(!1)}function ro(){qr(!Kr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function oo(){const e=ie(Fr,Br),[t,n]=oe(e),[r,o]=oe(e);return re(()=>{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?ge(
48
+ /* @__PURE__ */we("div",{onMouseDown:e=>{e.stopPropagation(),qr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:H.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 io({open:t,onClose:l,title:c,icon:u,copyText:m,size:f="lg",dirty:p=!1,onNext:w,onPrev:v,footer:k,bodyScroll:M,onMinimize:S,initialBox:A,actions:R,actionsLeft:O,editing:j=!1,edit:q,allowPinOnTop:U,initialPosition:Y,widget:V,compact:_,appStyle:Z,flushBody:ee,autoHeight:se,autoMinHeight:le,autoWidth:ce,widgetMenu:ue,dimensions:me,windowKey:fe,openedFromKey:ve,accentRgb:be,children:xe}){const[ke,Ee]=oe(()=>r()),Me=D()&&!ke,Ce=I()&&!!V,[Se,Le]=oe(0),[Ne,Te]=oe(!1),ze=ne(null),Ae=ne(0);re(()=>{Ae.current=Se},[Se]);const Ie=ae(e=>{Me&&(ze.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Te(!0),Ft(ve??null))},[Me,ve]),Pe=ie(Bt,jt);re(()=>{if(!Ne)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),Le(0),void Ft(null);Le(Math.max(0,t))},t=()=>{if(!ze.current)return;const e=.3*window.innerWidth,t=Ae.current>e;ze.current=null,Te(!1),t?(Le(window.innerWidth),setTimeout(()=>{l(),Le(0),Ft(null)},180)):(Le(0),Ft(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)}},[Ne]);const[Re,Oe]=oe(c),$e=J(),We=$e.window;re(()=>{Oe(c)},[c]);const Ke=de(()=>pn(Re).trim()||void 0,[Re]),je=he(),[Fe,He]=oe(!1),Ye=ne(!1),[Xe,Ve]=oe(!1),[Ge,Je]=oe(null),_e=Q(dn),Ze=Q(De),{prefs:Qe,save:et}=P(),tt=!!Qe.window_accent_stripe,nt=Qe.favorite_documents||[],rt=!!_e&&nt.some(e=>e.entityType===_e.entityType&&e.entityId===_e.entityId),ot=ae(()=>{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]=oe(null),[st,lt]=oe("top-right"===Y?"right":"left"),ut=ne(!1),ht=ne(null);te(()=>{const e=ht.current;e&&(be?e.style.setProperty("--window-accent-rgb",be):e.style.removeProperty("--window-accent-rgb"))},[be]);const mt=ne(!1),ft=ne(null),pt=ne(null),wt=ne(null),[yt,gt]=oe(!1),vt=ne(null),bt=ne(null),xt=ne(null),[kt,Et]=oe(!1);te(()=>{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=!!q&&!V&&!_&&!Z&&(q.editing||"hidden"!==q.state),Ct=!!(k||R||O)||yt||Mt,St=Q(qe),Lt=""!==Q(un),Nt=ne(null);Nt.current=Ze?{owner:Ze.key,tab:Ze.tab,root:!Lt}:null;const Tt=fe||(Ze&&!Lt?Ze.key:null),zt=!!St&&!Lt&&St.enabled&&St.hasState&&(j||St.declaredEditable)&&!St.handMounted&&Ct&&!V&&!_&&!Z&&!Me,At=40,{minimize:Dt,items:It,restoreIfMinimized:Pt,openWindows:Rt}=dt(),Ot=ne(`modal-${Math.random().toString(36).slice(2,8)}`).current,Wt=g(Ot);re(()=>{if(V)return dr.add(Ot),()=>{dr.delete(Ot)}},[V,Ot]),re(()=>{const e=e=>{const t=e.detail;t?.id===Ot&&Oe(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Ot]);const[Kt,qt]=oe(H.window),Ht=function(e){const t=ie(N,T);return C.length<=1||t===e}(Ot),Ut=ne(q);Ut.current=q;const Yt=!!q&&!q.editing&&"enabled"===q.state;re(()=>{if(!t||!Ht||!Yt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(b(e.target,ht.current)||(e.preventDefault(),e.stopPropagation(),Ut.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Ht,Yt]);const Xt=function(e){return ie(N,()=>Fn.has(e))}(Ot);$t({panelRef:ht,bodyRef:ft,open:t,widget:!!V,active:Ht,minimized:Xt});const Vt=ie(Fr,Br),Gt=ie(Vr,Gr),Jt=ie(Qr,eo),_t=!U&&!V,Zt=Vt&&_t,[Qt,tn]=oe(!1),rn=Zt&&Jt===Ot,[on,sn]=oe(!1),ln=on&&_t&&Gt===Ot?"picked":null,cn=ne(Zt);re(()=>{if(cn.current&&!Zt){sn(!0);const e=setTimeout(()=>{sn(!1),Yr===Ot&&Jr(null)},700);return cn.current=Zt,()=>clearTimeout(e)}cn.current=Zt},[Zt,Ot]),re(()=>{Zt||tn(!1)},[Zt]),re(()=>{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]),re(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ht.current){const t=ht.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 hn=ne(!1),mn=ae(e,[]),wn=ae(()=>{const t=e(),n=me?me[0]:$n[f]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=jn[Kn()],l=me?Math.min(me[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(At,(i-l)/2),d=(o-a)/2,h=t.h-At-l-u;return"top-right"===Y?{x:t.x+t.w-a-At,y:t.y+At,w:a,h:l}:"top-left"===Y?{x:t.x+At,y:t.y+At,w:a,h:l}:{x:t.x+Math.max(At,(o-a)/2+At)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,h)),w:a,h:l}},[f]),yn=ne(!1);t||(yn.current=!1);const vn=fe||m||null;re(()=>{if(!t)return;ar(Ot,vn,Nt.current??void 0),fe||cr(Ot),hn.current=!1,qt(Or(Ot));const e=()=>{qt(Or(Ot))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===fe;if(!e.label)return!1;const t=ht.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(cr(Ot),An.current)return;const t=fr(),n=Math.min(Bn.current.w,t.w-40),o=Math.min(Bn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;kn({x:i,y:a,w:n,h:o}),On(!1)},i=e=>{const t=e.detail;r(t)&&(cr(Ot),Je({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==fe)return;cr(Ot);const t=Bn.current,n=function(e,t=fr()){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=ht.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)}kn(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),Yn()),Fn.delete(e),qn.delete(e),Gn.delete(e);const n=Vn.get(e);n&&(Vn.delete(e),Xn.delete(n))}(Ot),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,Ot,vn,mn]);const bn=!V&&"maximized"===Kn(),[xn,kn]=oe(()=>{if(vn&&Sn[vn]){const e={...Sn[vn]};return me&&(e.w=me[0],se||(e.h=me[1])),kr(e)}return A?{x:A.x,y:A.y,w:A.w,h:A.h}:bn?mn():wn()}),[En,Mn]=oe(()=>!se),Cn=ne(ke),Ln=ne(null);re(()=>{const e=()=>{const e=r();e!==Cn.current&&Ln.current?.(e),Cn.current=e,Ee(e),qt(Or(Ot))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Ot]);const Tn=ke&&!!Ze?.tab&&!Lt&&!V&&!Me,zn=Tn,An=ne(zn);An.current=zn;const Dn=_n(),In=ke&&!!Ze?.tab&&!V&&!Me&&!Vt&&Dn!==Ze.key,Pn=!!V&&ke&&!Vt&&null!==Dn,[Rn,On]=oe(()=>vn&&Sn[vn]||A?zn:zn||bn),Bn=ne(xn);Bn.current=xn;const Hn=ne(Rn);te(()=>{Hn.current=Rn},[Rn]),te(()=>{if(En||Tn)return;const e=ht.current,t=ft.current;if(!e||!t)return;const n=le??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const f=t.offsetHeight,p=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>p+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Bn.current.y)-24),g=w?Math.min(Bn.current.h,y):Math.min(Math.max(n,u+f),y),v=Math.abs(g-o)>1;v&&(o=g,kn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Mn(!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)}},[En,V,le,Ct,Tn]),te(()=>{if(!se||!En||V||!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||Rn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=le??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Bn.current.y)-24);kn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[se,En,V,t,Rn,le]);const Un=!1!==ce&&!V&&!Z&&!Me,[Jn,Zn]=oe(()=>!Un);te(()=>{if(Jn||!t)return;if(!Un||Rn)return void Zn(!0);const n=ht.current,r=ft.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=Bn.current.w,c=0;const u=()=>Zn(!0),d=()=>{c=0;const t=Bn.current;if(Math.abs(t.w-l)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],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||(m.push(e),f.push(t))}if(!m.length)return;const p=Math.min(h,t.w+Math.max(...f)),w=p-t.w,y=n.style.width;n.style.width=`${p}px`;const g=m.map((e,t)=>({over:f[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(m[t])});const v=a(t,s(t.w,w,g),d,At);v!==t&&(l=v.w,kn(v))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Wn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Jn,t,Un,Rn]);const Qn=ne(null),er=!(!Ze?.tab||Lt||V||Me);Ln.current=t=>{if(!er)return;if(t)return Qn.current||(Qn.current={box:{...Bn.current},maximized:Hn.current}),void(Hn.current=!0);const r=Qn.current;Qn.current=null;const o=e();if(r?.maximized)return Hn.current=!0,On(!0),void kn(o);const i=r?.box??(vn?Sn[vn]:void 0);if(Hn.current=!1,On(!1),i&&!n(i,o,!1)){const e={...i};me&&(e.w=me[0],se||(e.h=me[1])),kn(kr(e))}else kn(wn())},re(()=>{zn&&(Hn.current=!0,On(!0),kn(mn()))},[zn,mn]),re(()=>{if(V)return;const e=()=>{const e=vn?Sn[vn]:void 0;if(Hn.current=!1,On(!1),e){const t={...e};me&&(t.w=me[0],se||(t.h=me[1])),kn(kr(t))}else kn(wn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,wn,vn]),re(()=>{t&&vn&&!Tn&&(Sn[vn]=xn,Nn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[xn,t,vn,Tn]),re(()=>{if(!t)return;const e=()=>{Hn.current?kn(mn()):document.body.classList.contains("rosh-gesturing")||kn(kr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Rn&&(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,Rn,mn]),re(()=>{if(t&&(He(!1),Ye.current=!1,ut.current=!1,Zn(!Un),!An.current)){if(vn&&Sn[vn]){const e=Sn[vn];return void kn(t=>kr({...e,...se?{h:t.h}:{},...Un?{x:t.x,w:t.w}:{}}))}A&&(kn({x:A.x,y:A.y,w:A.w,h:A.h}),On(A.maximized))}},[t]),re(()=>{if(!t||"auto"!==p)return;let e;const n=t=>{ht.current?.contains(t.target)&&!Ye.current&&(Ye.current=!0,e=setTimeout(()=>He(!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 tr="auto"===p?Fe:!0===p,rr=Ze&&!Lt?Ze.key:null,or=de(()=>en(Re),[Re]),ir=ne({shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:$e.taskbar});te(()=>{ir.current={shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:$e.taskbar}});const sr=ne(null);sr.current||(sr.current={open:(e,t)=>Je({x:e,y:t}),items:()=>{const e=ir.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of gn[Ot]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),re(()=>{if(t&&rr)return()=>{return e=rr,void(nn.delete(e)&&an());var e}},[t,rr]),ct(!(fe||!t)&&tr);const lr=ae(()=>tr||"auto"===p&&Ye.current,[tr,p]),gr=ae(async e=>{if(ut.current)return!1;if(!lr())return!0;ut.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 ut.current=!1,r},[lr,Ke]),vr=ae(()=>ut.current?Promise.resolve():lr()?gr("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[lr,gr,l]),Er=ae(async()=>{await gr("discard")&&(Ye.current=!1,He(!1),Ut.current?.onDiscard())},[gr]),Cr=ae(async()=>{const e=await gr("switch");return e&&(Ye.current=!1,He(!1)),e},[gr]),Nr=ne(()=>!1);te(()=>{Nr.current=lr}),te(()=>{if(!t||!fe)return;const e={holdsChanges:()=>Nr.current(),ask:Cr};return nr.set(fe,e),()=>{nr.get(fe)===e&&nr.delete(fe)}},[t,fe,Cr]),te(()=>{if(!t||!Tt)return;const e=e=>{e.detail?.windowKey===Tt&&vr()};return window.addEventListener($r,e),()=>window.removeEventListener($r,e)},[t,Tt,vr]);const Tr=ne(null),zr=ae(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Je(null),cr(Ot),An.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=ht.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:Bn.current.x,c=s?s.top:Bn.current.y,u=s?s.height:Bn.current.h,d=s?s.width:Bn.current.w;On(!1),kn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<Pr&&Math.abs(e.clientY-i)<Pr)return;r=Rr(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)`),Bn.current={...Bn.current,x:s,y:u},!V){const t=function(e,t){const n=fr(),r=e<=n.x+hr,o=e>=n.x+n.w-hr,i=t<=n.y+hr,a=t>=n.y+n.h-hr,s=e<=n.x+mr,l=e>=n.x+n.w-mr,c=t<=n.y+mr,u=t>=n.y+n.h-mr;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!==h&&(h=t,t?Sr(Mr(t)):Lr())}},f=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",f),r?.(),Lr();const e=kr({...Bn.current});if(Bn.current=e,!V&&h){Tr.current={x:l,y:c,w:d,h:u};const e=Mr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void kn(e)}if(V){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=""),kn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",f)},[]),Dr=ae((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=ht.current,l=s?.getBoundingClientRect(),c=l?l.left:Bn.current.x,u=l?l.top:Bn.current.y,d=l?l.width:Bn.current.w,h=l?l.height:Bn.current.h,m="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;On(!1),kn({x:c,y:u,w:d,h:h}),Bn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Bn.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)<Pr&&Math.abs(e.clientY-a)<Pr)return;o=Rr(n,r,Ir[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(p&&(o=Math.max(br,d+e)),w&&(i=Math.max(xr,h+t)),m){const t=Math.max(br,d-e);n=c+d-t,o=t}if(f){const e=Math.max(xr,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),kn({...Bn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Wr=ae(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(),cr(Ot),"Enter"===e.key)return void(Rn?(On(!1),kn(wn())):(On(!0),kn(mn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Tr.current||(Tr.current={...Bn.current})};if(r<0)return e(),On(!0),void kn(mn());if(r>0){if(Rn)return On(!1),void kn(wn());if(Tr.current){const e=kr(Tr.current);return Tr.current=null,Bn.current=e,void kn(e)}return void ur(Ot)}e(),On(!1);const t=Mr(n<0?"left":"right");return Bn.current=t,void kn(t)}if(Rn)return;const o=Bn.current,i=e.shiftKey?{...o,w:Math.max(br,o.w+24*n),h:Math.max(xr,o.h+24*r)}:kr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Bn.current=i,kn(i)},[Ot,Rn,wn,mn]),Kr=ae(e=>{Tr.current||(Tr.current={...Bn.current}),On(!1);const t=Mr(e);Bn.current=t,kn(t),cr(Ot)},[Ot]),jr=!V&&!Tn&&!Me,[Hr,Ur]=oe(0),Xr=jr&&!_&&!Z&&(!!R||!!O||yt||Mt||zt),_r=jr&&Hr>0,Zr=ne(_r);Zr.current=_r;const to=!!_||!!Z,no=to?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)",ro=ae(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:(Ur(e=>e+1),()=>Ur(e=>Math.max(0,e-1)))},[]),oo=de(()=>jr?{compact:to,over:_r,claim:ro}:null,[jr,to,_r,ro]),io=ae(e=>{if(Zt)return;e.preventDefault(),e.stopPropagation();const t=0===e.clientX&&0===e.clientY,n=e.currentTarget.getBoundingClientRect();Je(t?{x:n.left,y:n.bottom+4}:{x:e.clientX,y:e.clientY})},[Zt]),ao=!!be&&tt&&!V&&!Me,so=zn||Zt?{}:{tabIndex:0,role:"group","aria-label":Ke?`${Ke} — ${We.windowSuffix}`:We.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:Wr},lo=()=>{On(!0),kn(mn())},co=ae(()=>{const e=ht.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(fn);t&&!t.disabled&&t.click()}},[]);re(()=>{if(!t)return;if(V)return;const e=e=>{if(C[C.length-1]===Ot&&!b(e.target,ht.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),co();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ht.current?.contains(t)))return;if(t.closest(z))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,co,Ot,V]),re(()=>{if(!t)return;const e=e=>{C[C.length-1]===Ot&&(b(e.target,ht.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Ot}})),Ye.current=!1,He(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Ot}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),re(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&C[C.length-1]===Ot){if(G(e))return e.preventDefault(),void e.stopPropagation();if(Tn&&!j)return;e.preventDefault(),e.stopPropagation(),vr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,vr,Ot,V,Tn,j]);const uo=t&&(void 0!==w||void 0!==v),[ho]=oe(()=>{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}),mo=Tn&&!Ze?.home&&or.actions.length>0;re(()=>{t&&rr&&function(e,t){const n=nn.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(nn.set(e,t),an())}(rr,{title:or.text||Ke,dirty:tr,copy:or.copy,actions:mo&&ho?ho:void 0,menu:sr.current??void 0})},[t,rr,Ke,tr,or.text,or.copy,mo,ho]);const fo=ae(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(re(()=>{if(!t)return;const e=e=>{if(C[C.length-1]!==Ot)return;if(b(e.target,ht.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&uo&&(e.preventDefault(),w?w():fo("bottom")),"k"===e.key&&uo&&(e.preventDefault(),v?v():fo("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,w,v,uo,fo,Ot]),!t||yn.current)return null;const po=Zt?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=fr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(Ot):null,wo=Zt&&po?X({width:po.w,height:po.h},{width:xn.w,height:xn.h}):1,yo=(()=>{if(Zt&&po){const e=wo,t=xn.w*e,n=xn.h*e,r=po.x+(po.w-t)/2-xn.x,o=po.y+(po.h-n)/2-xn.y,i=Qt||rn;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:H.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(on&&_t){const e="picked"===ln;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:H.expose+30}:{}}}return null})(),go=x({modal:!1,titleId:!V&&(Tn?!Ze?.home:!Me)?je:void 0,label:or.text||Ke}),vo=/* @__PURE__ */pe("div",{children:[
49
+ /* @__PURE__ */pe("div",{ref:ht,"data-modal-panel":!0,"data-modal-id":Ot,"data-window-key":fe||void 0,...U?{"data-utility":""}:{},...Xe?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...Ze?{"data-window-owner":Ze.key}:{},...Ze&&!Lt?{"data-window-root":""}:{},...Tn?{"data-window-tab":""}:{},...go,className:Tn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(V?Ht?"shadow-xl":"shadow-lg":"border "+(Ht?"shadow-xl border-line":"shadow-lg border-line-strong")),onPointerDown:e=>{if(!Zr.current||Zt||0!==e.button)return;const t=e.target;if(t.closest("[data-modal-panel]")!==ht.current)return;if(t.closest("[data-window-chrome]"))return;const n=e.currentTarget.getBoundingClientRect(),r=n.height/(e.currentTarget.offsetHeight||n.height),o=(to?E.compactBar:E.windowBar)*r;e.clientY-n.top>o||t.closest(h)||zr(e)},onContextMenu:e=>{const t=e.target;t.closest("[data-window-strip]")&&t.closest("[data-modal-panel]")===ht.current&&io(e)},onMouseDownCapture:e=>{if(mt.current=!1,Zt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Jr(Ot),qr(!1),void cr(Ot)}if(!Ht&&!V&&!Xe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ht.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),mt.current=!0,Je(null),cr(Ot),window.addEventListener("mouseup",()=>{setTimeout(()=>{mt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{mt.current&&(mt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Zt)return;Je(null);e.target.closest("[data-modal-panel]")===ht.current&&(e.target.closest("button, input, a, select, textarea")||cr(Ot))},style:Me?{zIndex:Kt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Se}px)`,transition:Ne?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...Kt<0?{display:"none"}:{},...Ht||Xe||Pe&&fe===Pe?{}:{display:"none"},...Wt?{visibility:"hidden",pointerEvents:"none"}:{}}:{zIndex:Xe?H.pinnedWindow:Kt+1,width:xn.w,height:xn.h,top:xn.y,...V&&"right"===st?{right:window.innerWidth-xn.x-xn.w}:{left:xn.x},...Kt<0&&!Xe?{display:"none"}:{},...Ce?{display:"none"}:{},...In||Pn||Wt?{visibility:"hidden",pointerEvents:"none"}:{},...yo??{}},children:[Me&&!V&&/* @__PURE__ */we("div",{onPointerDown:Ie,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),
50
+ /* @__PURE__ */pe("div",{"data-window-surface":"",className:"flex min-h-0 flex-1 flex-col "+(jr?"backdrop-blur-sm":""),style:jr?{backgroundColor:Ht?"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:[V?null:Tn?Ze?.home?null:/* @__PURE__ */pe(ye,{children:[
51
+ /* @__PURE__ */we("h2",{id:je,"data-window-title":!0,className:"sr-only",children:or.text||Ke}),mo&&ho&&ge(
52
+ /* @__PURE__ */we(ye,{children:or.actions}),ho),or.badges.length>0&&/* @__PURE__ */we("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:or.badges})]}):Me?null:
53
+ /* @__PURE__ */pe("div",{onPointerDown:zr,onContextMenu:io,"data-window-chrome":"",..._r?{"data-window-controls-over":""}:{},...so,className:_r?`absolute left-0 z-10 flex ${no} 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 ${no} 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",..._r?{top:ao?3:0}:{}},children:[!Zt&&/* @__PURE__ */pe("div",{"data-window-controls":"",className:"group/controls flex shrink-0 items-center",children:[
54
+ /* @__PURE__ */we("button",{type:"button",onClick:vr,"aria-label":We.close,title:We.close,className:pr,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-red-500":"bg-gray-300 group-hover/controls:bg-red-500"}`,children:/* @__PURE__ */we(B,{name:"close",className:yr,strokeWidth:3})})}),!_&&/* @__PURE__ */we("button",{type:"button",onClick:()=>ur(Ot),"aria-label":We.minimize,title:We.minimize,className:pr,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-amber-400":"bg-gray-300 group-hover/controls:bg-amber-400"}`,children:/* @__PURE__ */we("span",{className:"h-0.5 w-2 rounded-full bg-current opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100"})})}),!_&&/* @__PURE__ */we(Ar,{maximized:Rn,onToggleMax:()=>{Rn?(On(!1),kn(wn())):lo()},onSnap:Kr,buttonClassName:pr,strings:We,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-green-500":"bg-gray-300 group-hover/controls:bg-green-500"}`,children:/* @__PURE__ */we(B,{name:Rn?"collapse":"expand",className:yr,strokeWidth:3})})}),U&&/* @__PURE__ */we("button",{type:"button",onClick:()=>Ve(e=>!e),"aria-label":Xe?We.unpin:We.pinOnTop,title:Xe?We.unpin:We.pinOnTop,className:"ml-1 p-0.5 rounded hover:bg-gray-200 "+(Xe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */we(B,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Xe?"currentColor":"none",strokeWidth:1.5})})]}),_r?
55
+ /* @__PURE__ */we("h2",{id:je,"data-window-title":!0,className:"sr-only",children:or.text||Ke}):/* @__PURE__ */we("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:Ht?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:/* @__PURE__ */we("span",{id:je,className:"truncate",children:Zt?pn(Re):Re})})]}),ao&&/* @__PURE__ */we("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Ht?.9:.55})`}}),
56
+ /* @__PURE__ */we(un.Provider,{value:Ot,children:/* @__PURE__ */we(d.Provider,{value:oo,children:/* @__PURE__ */we(L.Provider,{value:{rightRef:pt,leftRef:wt,notify:()=>gt(!0),active:Ht,isDirty:tr,footerOpen:Ct&&!V&&!_&&!Z&&!Me},children:/* @__PURE__ */we("div",{ref:ft,"data-window-body":"",...V?{onPointerDown:zr,onContextMenu:e=>{e.preventDefault(),at({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":Z||ee?"p-0":_?"p-2":"p-4"} ${V||Tn||jr?"":"backdrop-blur-sm"} ${!1===M||Z||ee?"overflow-hidden":"overflow-y-auto overscroll-contain"+(jr?Xr?" mr-1":" mb-2 mr-1":"")} ${V?"rounded-2xl select-none":""}`,style:{...V?{touchAction:"none"}:{},backgroundColor:V||jr?"transparent":Tn?"rgb(var(--window-content-rgb))":Ht?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */we(Be,{children:xe})})})})}),V&&it&&/* @__PURE__ */pe($,{minWidth:160,style:{left:it.x,top:it.y},onClose:()=>at(null),children:[
57
57
  /* @__PURE__ */we(W,{onClick:()=>{at(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Ot}))},children:"Settings"}),
58
58
  /* @__PURE__ */we(K,{}),ue&&/* @__PURE__ */pe(ye,{children:[ue,
59
59
  /* @__PURE__ */we(K,{})]}),
@@ -61,12 +61,12 @@ return pe("span",{className:"relative inline-flex",onMouseEnter:u,onMouseLeave:d
61
61
  /* @__PURE__ */we("span",{className:"flex-1",children:"Always on Top"}),Xe&&/* @__PURE__ */we(B,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
62
62
  /* @__PURE__ */we(K,{}),
63
63
  /* @__PURE__ */we(W,{onClick:()=>{at(null),vr()},children:"Close"})]}),
64
- /* @__PURE__ */pe("div",{onPointerDown:Tr,ref:vt,"data-modal-footer":"",...jr?{"data-modal-footer-top":""}:{},className:jr?`absolute right-0 z-10 flex ${no} items-center gap-2 px-3 text-xs select-none cursor-move${Xr?"":" hidden"}`:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${zn?"":" cursor-move"}${Ht&&!zn?" backdrop-blur-sm":""}${V||_||Z||Me||!Ct?" hidden":""}`,style:jr?{touchAction:"none",top:co?3:0}:{touchAction:"none",backgroundColor:zn?"rgb(var(--window-footer-rgb))":Ht?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
65
- /* @__PURE__ */pe("div",{className:jr?"flex shrink-0 items-center gap-2":"flex items-center gap-2 min-w-0 flex-1",children:[Tt&&/* @__PURE__ */we(Ue,{auto:!0}),O,
64
+ /* @__PURE__ */pe("div",{onPointerDown:zr,ref:vt,"data-modal-footer":"",...jr?{"data-modal-footer-bare":""}:{},className:jr?"px-4 py-2 shrink-0 flex items-center justify-between text-xs select-none cursor-move"+(Xr?"":" hidden"):`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${Tn?"":" cursor-move"}${Ht&&!Tn?" backdrop-blur-sm":""}${V||_||Z||Me||!Ct?" hidden":""}`,style:jr?{touchAction:"none"}:{touchAction:"none",backgroundColor:Tn?"rgb(var(--window-footer-rgb))":Ht?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
65
+ /* @__PURE__ */pe("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[zt&&/* @__PURE__ */we(Ue,{auto:!0}),O,
66
66
  /* @__PURE__ */we("div",{ref:wt,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=k&&!1!==k&&!jr&&
67
67
  /* @__PURE__ */we("div",{ref:bt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */we("div",{ref:xt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(kt?" invisible":""),children:k})})]}),
68
- /* @__PURE__ */pe("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 shrink-0"+(jr?"":" ml-auto"),children:[Mt&&q&&(q.editing?/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Er()},children:We.discard}):"object"==typeof q.state?/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:q.state.disabledReason,children:We.edit}):/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>q.onEdit(),children:We.edit})),
69
- /* @__PURE__ */we("div",{ref:pt,"data-modal-actions":!0,className:"flex items-center gap-2"}),R]})]}),!V&&!Me&&!Zt&&Ht&&!Tn&&/* @__PURE__ */pe(ye,{children:[
68
+ /* @__PURE__ */pe("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[Mt&&q&&(q.editing?/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Er()},children:We.discard}):"object"==typeof q.state?/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:q.state.disabledReason,children:We.edit}):/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>q.onEdit(),children:We.edit})),
69
+ /* @__PURE__ */we("div",{ref:pt,"data-modal-actions":!0,className:"flex items-center gap-2"}),R]})]})]}),!V&&!Me&&!Zt&&Ht&&!zn&&/* @__PURE__ */pe(ye,{children:[
70
70
  /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
71
71
  /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
72
72
  /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
@@ -74,18 +74,18 @@ return pe("span",{className:"relative inline-flex",onMouseEnter:u,onMouseLeave:d
74
74
  /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
75
75
  /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
76
76
  /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
77
- /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Zt&&/* @__PURE__ */we("div",{className:"absolute inset-0",style:{zIndex:H.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>tn(!0),onMouseLeave:()=>tn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),cr(Ot),qr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Qt&&/* @__PURE__ */we("button",{type:"button","data-expose-close":!0,"aria-label":$e.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:H.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),vr()},children:/* @__PURE__ */we(B,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Zt&&go&&/* @__PURE__ */we("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:H.expose+(Qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:pn(Re)})]}),Eo=Ge&&/* @__PURE__ */pe($,{style:{left:Ge.x,top:Ge.y},onClose:()=>Je(null),minWidth:160,children:[!V&&!_&&!zn&&/* @__PURE__ */pe(ye,{children:[
77
+ /* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Zt&&/* @__PURE__ */we("div",{className:"absolute inset-0",style:{zIndex:H.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>tn(!0),onMouseLeave:()=>tn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),cr(Ot),qr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Qt&&/* @__PURE__ */we("button",{type:"button","data-expose-close":!0,"aria-label":$e.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/wo})`,transformOrigin:"top right",zIndex:H.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),vr()},children:/* @__PURE__ */we(B,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Zt&&po&&/* @__PURE__ */we("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:po.x,top:po.y+po.h+4,width:po.w,zIndex:H.expose+(Qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:pn(Re)})]}),bo=Ge&&/* @__PURE__ */pe($,{style:{left:Ge.x,top:Ge.y},onClose:()=>Je(null),minWidth:160,children:[!V&&!_&&!Tn&&/* @__PURE__ */pe(ye,{children:[
78
78
  /* @__PURE__ */pe(W,{onClick:()=>{ur(Ot),Je(null)},children:[
79
- /* @__PURE__ */we(B,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),We.minimize]}),!Tn&&/* @__PURE__ */pe(W,Rn?{onClick:()=>{On(!1),kn(wn()),Je(null)},children:[
80
- /* @__PURE__ */we(B,{name:"collapse",className:"h-4 w-4",strokeWidth:1.5}),We.windowed]}:{onClick:()=>{ho(),Je(null)},children:[
81
- /* @__PURE__ */we(B,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),We.maximize]})]}),U&&!zn&&/* @__PURE__ */pe(W,{onClick:()=>{Ve(e=>!e),Je(null)},children:[
79
+ /* @__PURE__ */we(B,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),We.minimize]}),!zn&&/* @__PURE__ */pe(W,Rn?{onClick:()=>{On(!1),kn(wn()),Je(null)},children:[
80
+ /* @__PURE__ */we(B,{name:"collapse",className:"h-4 w-4",strokeWidth:1.5}),We.windowed]}:{onClick:()=>{lo(),Je(null)},children:[
81
+ /* @__PURE__ */we(B,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),We.maximize]})]}),U&&!Tn&&/* @__PURE__ */pe(W,{onClick:()=>{Ve(e=>!e),Je(null)},children:[
82
82
  /* @__PURE__ */we(B,{name:"bookmark-square",className:"h-4 w-4 "+(Xe?"text-blue-600":""),fill:Xe?"currentColor":"none",strokeWidth:1.5}),Xe?We.unpin:We.pinOnTop]}),_e&&/* @__PURE__ */pe(W,{onClick:()=>{Je(null),ot()},children:[
83
- /* @__PURE__ */we(B,{name:"star",className:"h-4 w-4",fill:rt?"currentColor":"none",strokeWidth:1.5}),rt?$e.taskbar.removeFromDesktop:$e.taskbar.addToDesktop]}),(gn[Ot]||[]).length>0&&/* @__PURE__ */we(ye,{children:(gn[Ot]||[]).map((e,t)=>/* @__PURE__ */pe(W,{onClick:()=>{Je(null),e.onClick()},children:[e.icon,e.label]},t))}),!(zn&&Ze?.home)&&/* @__PURE__ */pe(ye,{children:[
83
+ /* @__PURE__ */we(B,{name:"star",className:"h-4 w-4",fill:rt?"currentColor":"none",strokeWidth:1.5}),rt?$e.taskbar.removeFromDesktop:$e.taskbar.addToDesktop]}),(gn[Ot]||[]).length>0&&/* @__PURE__ */we(ye,{children:(gn[Ot]||[]).map((e,t)=>/* @__PURE__ */pe(W,{onClick:()=>{Je(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Tn&&Ze?.home)&&/* @__PURE__ */pe(ye,{children:[
84
84
  /* @__PURE__ */we(K,{}),
85
85
  /* @__PURE__ */pe(W,{danger:!0,onClick:()=>{Je(null),vr()},children:[
86
- /* @__PURE__ */we(B,{name:"close",className:"h-4 w-4"}),We.close]})]})]}),Mo=!!fe&&Rt.some(e=>e.id===fe),Co=!Xt||Mo||V?null:/* @__PURE__ */pe("div",{"data-modal-restore-tab":!0,"data-modal-id":Ot,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:[
86
+ /* @__PURE__ */we(B,{name:"close",className:"h-4 w-4"}),We.close]})]})]}),xo=!!fe&&Rt.some(e=>e.id===fe),ko=!Xt||xo||V?null:/* @__PURE__ */pe("div",{"data-modal-restore-tab":!0,"data-modal-id":Ot,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:[
87
87
  /* @__PURE__ */we("button",{type:"button",onClick:()=>cr(Ot),title:We.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||We.windowSuffix}),
88
88
  /* @__PURE__ */we("button",{type:"button",onClick:()=>cr(Ot),title:We.restore,"aria-label":We.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
89
89
  /* @__PURE__ */we("button",{type:"button",onClick:()=>{vr()},title:We.close,"aria-label":We.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 ge(
90
- /* @__PURE__ */pe(dn.Provider,{value:null,children:[ko,Eo,Co]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Kr&&"Escape"===e.key&&(to(null),qr(!1))});var ao=100,so={past:[],future:[]};function lo(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>ao?r.slice(r.length-ao):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:so}}var co=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var uo=500,ho=250;function mo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=me(lo,so),a=ne(/* @__PURE__ */new Map),[s,l]=oe(0),c=s>0,[u,d]=oe(0),[h,m]=oe(0),f=h>0,{hasAnyPerm:p}=A(),w=t&&0===u&&(!(n&&n.length>0)||p(n)),y=ne(null),g=ne(!1),v=ae(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),b=ae((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),x=ae(e=>{a.current.delete(e)&&l(e=>e-1)},[]),k=ae(e=>{d(t=>t+(e?1:-1))},[]),E=ae(e=>{m(t=>t+(e?1:-1))},[]),[M,C]=oe(0),S=M>0,N=ae(e=>{C(t=>t+(e?1:-1))},[]),z=Q(qe),T=z?.claimReadOnly;re(()=>{if(T&&!w)return T(!0),()=>T(!1)},[T,w]);const D=z?.claimOwnMount;re(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const I=ne({last:0,count:0,tripped:!1}),P=ne(!1),R=ae((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)||(P.current=!0));if(!w||y.current)return;const r=I.current;if(r.tripped)return;const o=Date.now();if(o-r.last>ho&&(r.count=0),r.last=o,++r.count>uo)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${uo} 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]),O=ae(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),$=ae(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};O(e.values),i({type:"undo",redoStep:t})},[o.past,v,O]),W=ae(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};O(e.values),i({type:"redo",undoStep:t})},[o.future,v,O]),[K,j]=oe(0),F=ne(0),B=ne(0),q=ne(!1),H=ae(()=>{g.current=!0,P.current=!1,y.current=null,F.current+=1,B.current=F.current,j(F.current)},[]),U=ne(void 0),Y=ae(e=>{void 0!==e&&(void 0!==U.current&&e!==U.current&&(q.current=!0),U.current=e),H()},[H]);re(()=>{g.current&&K===B.current&&(g.current=!1,y.current=null,(P.current||q.current)&&i({type:"clear"}),P.current=!1,q.current=!1)},[K]);const X=ae(()=>{q.current=!0,i({type:"clear"}),H()},[H]),V=w&&o.past.length>0,G=w&&o.future.length>0,J=Wr(r),_=ne({undo:$,redo:W,canUndo:V,canRedo:G});_.current={undo:$,redo:W,canUndo:V,canRedo:G},re(()=>{if(!J||!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&&co.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)},[J,w]);const Z=de(()=>({register:b,unregister:x,record:R,undo:$,redo:W,clear:X,baseline:Y,canUndo:V,canRedo:G,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:G?o.future[0].label:null}),[b,x,R,$,W,X,Y,V,G,w,c,S,N,k,f,E,o.past,o.future]),ee=""!==kn(),te=Q(L)?.footerOpen??!1,ie=ee&&w&&c&&!S&&te;/* @__PURE__ */
91
- return pe(qe.Provider,{value:Z,children:[ie&&/* @__PURE__ */we(En,{position:"left",quiet:!0,children:/* @__PURE__ */we(Ue,{auto:!0})}),e]})}function fo(){const e=Q(qe),t=ae(()=>{},[]);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 po(e){const t=Q(qe),n=t?.claimReadOnly,r=t?.claimEditable;re(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function wo(e,t,n){const r=Q(qe),o=he(),i=ne(e),a=ne(t);a.current=t,re(()=>{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=ne(r);c.current=r;const u=ne({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},re(()=>{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 yo(e,t){const[n,r]=oe(e);return wo(n,e=>r(()=>e),t),[n,r]}export{Mn as CancelButton,Te as DesktopHostProvider,ft as DocFavStar,nt as EntityWindowFallback,et as EntityWindowLoading,rt as EntityWindowState,fn as MODAL_SUBMIT_SELECTOR,io as Modal,En as ModalActions,Ue as UndoControls,mo as UndoProvider,Se as WINDOW_REGISTRY,Fe as WindowCrashedFallback,Be as WindowErrorBoundary,Rt as WindowManagerProvider,bn as WindowTitle,bt as activateWindowById,Vt as beginWindowGesture,ir as cancelWindowFront,Ne as client_default,no as commitExposeHighlight,or as confirmWindowDiscard,Gt as drainPerfEvents,Ur as exitExposeMode,On as forgetMaximizedWindowBoxes,Et as getActiveWindowRoute,eo as getExposeHighlight,cn as getWindowChromeVersion,Pn as getWindowPosition,it as isDraftEntityId,at as isDraftEntityWindow,Ee as isEntityEntry,ke as isPageEntry,Le as isShellApiClientConfigured,Je as isTabWindow,Xt as markMenuOpen,sn as readWindowChrome,tr as requestWindowFront,to as setExposeHighlight,Yt as setPerfCollecting,Oe as setShellHomeRoute,je as setShellTabStrip,Ce as setShellWindowRegistry,In as setWindowDefaultPosition,Rn as setWindowPosition,en as splitTitle,Qr as subscribeExposeHighlight,ln as subscribeWindowChrome,_e as tabGroupOf,Hr as toggleExposeMode,_n as useCurrentTabKey,Ae as useDesktopHost,kn as useEnclosingModalId,Wr as useIsActiveWindow,Ie as usePageSearch,fo as useUndo,po as useUndoCanEdit,wo as useUndoable,yo as useUndoableState,yn as useWidgetSettings,ct as useWindowDirty,dt as useWindowManager,vn as useWindowMenuItem,xn as useWindowTitle,rr as windowHoldsChanges};
90
+ /* @__PURE__ */pe(dn.Provider,{value:null,children:[vo,bo,ko]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Kr&&"Escape"===e.key&&(to(null),qr(!1))});var ao=100,so={past:[],future:[]};function lo(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>ao?r.slice(r.length-ao):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:so}}var co=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var uo=500,ho=250;function mo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=me(lo,so),a=ne(/* @__PURE__ */new Map),[s,l]=oe(0),c=s>0,[u,d]=oe(0),[h,m]=oe(0),f=h>0,{hasAnyPerm:p}=A(),w=t&&0===u&&(!(n&&n.length>0)||p(n)),y=ne(null),g=ne(!1),v=ae(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),b=ae((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),x=ae(e=>{a.current.delete(e)&&l(e=>e-1)},[]),k=ae(e=>{d(t=>t+(e?1:-1))},[]),E=ae(e=>{m(t=>t+(e?1:-1))},[]),[M,C]=oe(0),S=M>0,N=ae(e=>{C(t=>t+(e?1:-1))},[]),T=Q(qe),z=T?.claimReadOnly;re(()=>{if(z&&!w)return z(!0),()=>z(!1)},[z,w]);const D=T?.claimOwnMount;re(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const I=ne({last:0,count:0,tripped:!1}),P=ne(!1),R=ae((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)||(P.current=!0));if(!w||y.current)return;const r=I.current;if(r.tripped)return;const o=Date.now();if(o-r.last>ho&&(r.count=0),r.last=o,++r.count>uo)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${uo} 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]),O=ae(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),$=ae(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};O(e.values),i({type:"undo",redoStep:t})},[o.past,v,O]),W=ae(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};O(e.values),i({type:"redo",undoStep:t})},[o.future,v,O]),[K,j]=oe(0),F=ne(0),B=ne(0),q=ne(!1),H=ae(()=>{g.current=!0,P.current=!1,y.current=null,F.current+=1,B.current=F.current,j(F.current)},[]),U=ne(void 0),Y=ae(e=>{void 0!==e&&(void 0!==U.current&&e!==U.current&&(q.current=!0),U.current=e),H()},[H]);re(()=>{g.current&&K===B.current&&(g.current=!1,y.current=null,(P.current||q.current)&&i({type:"clear"}),P.current=!1,q.current=!1)},[K]);const X=ae(()=>{q.current=!0,i({type:"clear"}),H()},[H]),V=w&&o.past.length>0,G=w&&o.future.length>0,J=Wr(r),_=ne({undo:$,redo:W,canUndo:V,canRedo:G});_.current={undo:$,redo:W,canUndo:V,canRedo:G},re(()=>{if(!J||!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&&co.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)},[J,w]);const Z=de(()=>({register:b,unregister:x,record:R,undo:$,redo:W,clear:X,baseline:Y,canUndo:V,canRedo:G,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:G?o.future[0].label:null}),[b,x,R,$,W,X,Y,V,G,w,c,S,N,k,f,E,o.past,o.future]),ee=""!==kn(),te=Q(L)?.footerOpen??!1,ie=ee&&w&&c&&!S&&te;/* @__PURE__ */
91
+ return pe(qe.Provider,{value:Z,children:[ie&&/* @__PURE__ */we(En,{position:"left",quiet:!0,children:/* @__PURE__ */we(Ue,{auto:!0})}),e]})}function fo(){const e=Q(qe),t=ae(()=>{},[]);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 po(e){const t=Q(qe),n=t?.claimReadOnly,r=t?.claimEditable;re(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function wo(e,t,n){const r=Q(qe),o=he(),i=ne(e),a=ne(t);a.current=t,re(()=>{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=ne(r);c.current=r;const u=ne({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},re(()=>{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 yo(e,t){const[n,r]=oe(e);return wo(n,e=>r(()=>e),t),[n,r]}export{Mn as CancelButton,ze as DesktopHostProvider,ft as DocFavStar,nt as EntityWindowFallback,et as EntityWindowLoading,rt as EntityWindowState,fn as MODAL_SUBMIT_SELECTOR,io as Modal,En as ModalActions,Ue as UndoControls,mo as UndoProvider,Se as WINDOW_REGISTRY,Fe as WindowCrashedFallback,Be as WindowErrorBoundary,Rt as WindowManagerProvider,bn as WindowTitle,bt as activateWindowById,Vt as beginWindowGesture,ir as cancelWindowFront,Ne as client_default,no as commitExposeHighlight,or as confirmWindowDiscard,Gt as drainPerfEvents,Ur as exitExposeMode,On as forgetMaximizedWindowBoxes,Et as getActiveWindowRoute,eo as getExposeHighlight,cn as getWindowChromeVersion,Pn as getWindowPosition,it as isDraftEntityId,at as isDraftEntityWindow,Ee as isEntityEntry,ke as isPageEntry,Le as isShellApiClientConfigured,Je as isTabWindow,Xt as markMenuOpen,sn as readWindowChrome,tr as requestWindowFront,to as setExposeHighlight,Yt as setPerfCollecting,Oe as setShellHomeRoute,je as setShellTabStrip,Ce as setShellWindowRegistry,In as setWindowDefaultPosition,Rn as setWindowPosition,en as splitTitle,Qr as subscribeExposeHighlight,ln as subscribeWindowChrome,_e as tabGroupOf,Hr as toggleExposeMode,_n as useCurrentTabKey,Ae as useDesktopHost,kn as useEnclosingModalId,Wr as useIsActiveWindow,Ie as usePageSearch,fo as useUndo,po as useUndoCanEdit,wo as useUndoable,yo as useUndoableState,yn as useWidgetSettings,ct as useWindowDirty,dt as useWindowManager,vn as useWindowMenuItem,xn as useWindowTitle,rr as windowHoldsChanges};
@@ -1 +1 @@
1
- import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-VGUYAVDG.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],U=[800,1800],B=e=>{document.prerendering?E(()=>B(e)):"complete"!==document.readyState?addEventListener("load",()=>B(e),!0):setTimeout(e)};var N=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},V=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,K=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,D=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,G=/\d{4,}/g,W=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Y=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,Q=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function X(e,t,n){const i=e.replace(Y,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=Q.exec(n.trim()),i=e&&X(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Y,"").split(/[?#]/,1)[0].replace(W,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&N.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,U,t.reportAllChanges);B(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,U,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,U,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(V,"[redacted]").replace(J,"[redacted]").replace(K,"[url]").replace(D,"[id]").replace(G,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
1
+ import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-LZOKBMAF.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,Z=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},_=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,Z),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{_(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var O=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},K=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&U.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&O.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;_(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(K,"[redacted]").replace(J,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
@@ -0,0 +1 @@
1
+ var r="13.21.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,4 +1,4 @@
1
- import{Modal as e}from"./chunk-IXJIHTUI.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
1
+ import{Modal as e}from"./chunk-D4WO73XD.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
2
2
  return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
3
3
  /* @__PURE__ */n("div",{children:[
4
4
  /* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),