efficient-shell 10.23.0 → 10.24.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 (101) hide show
  1. package/README.md +14 -3
  2. package/dist/{Browser-GTQKXJQ6.js → Browser-KUFFOGYK.js} +14 -14
  3. package/dist/Calculator-LENRW34X.js +29 -0
  4. package/dist/CurrencyConverter-7UMHQS2V.js +21 -0
  5. package/dist/{Documents-MTCJXTXY.js → Documents-ODZ4AAOY.js} +16 -16
  6. package/dist/{Files-XMZ3XBP4.js → Files-BRGTTI2J.js} +25 -25
  7. package/dist/Notepad-RMRDEGGU.js +24 -0
  8. package/dist/{PomodoroTimer-5ELVNJEU.js → PomodoroTimer-4566W4F7.js} +40 -40
  9. package/dist/{Preview-QCA6XUDU.js → Preview-7POJP7PB.js} +33 -33
  10. package/dist/Sidebar-TU4QCKYJ.js +44 -0
  11. package/dist/Spreadsheet-7T4VT5IO.js +37 -0
  12. package/dist/{Stock-TRG6CAZJ.js → Stock-H73C4R3N.js} +3 -3
  13. package/dist/{Weather-YGTT7UWR.js → Weather-WF56QCBI.js} +19 -19
  14. package/dist/{WorldClock-UCX5LCJB.js → WorldClock-5QJNZYYS.js} +6 -6
  15. package/dist/ai/index.js +1 -1
  16. package/dist/api/shellHttp.d.ts +52 -0
  17. package/dist/api/shellHttp.js +1 -0
  18. package/dist/apps/index.js +1 -1
  19. package/dist/bin/media-host-check.js +1 -1
  20. package/dist/bin/ui-check.js +1 -1
  21. package/dist/chunk-2QY5BJLA.js +2 -0
  22. package/dist/chunk-3C5NKOVF.js +1 -0
  23. package/dist/chunk-3FBDLIQW.js +99 -0
  24. package/dist/chunk-4LXCCZDM.js +1 -0
  25. package/dist/chunk-5DIGYJHD.js +1 -0
  26. package/dist/{chunk-U2RFKQVA.js → chunk-5H4SWQGM.js} +1 -1
  27. package/dist/{chunk-75UD5ZMP.js → chunk-6IOFNPR6.js} +3 -3
  28. package/dist/{chunk-YOZGW2RB.js → chunk-7FW2BQTV.js} +1 -1
  29. package/dist/{chunk-RV2FGSGH.js → chunk-ALTBTO3Z.js} +2 -2
  30. package/dist/chunk-ATMJ5ZPK.js +1 -0
  31. package/dist/{chunk-XJPKDTQN.js → chunk-BUO7XCYR.js} +12 -12
  32. package/dist/{chunk-JET2TKEQ.js → chunk-DOF56HTO.js} +5 -5
  33. package/dist/chunk-E6FDUFPH.js +1 -0
  34. package/dist/chunk-EH2BNSG3.js +13 -0
  35. package/dist/chunk-F3ZOO23R.js +1 -0
  36. package/dist/chunk-HNVSVTNC.js +16 -0
  37. package/dist/{chunk-E6LQY6TB.js → chunk-IHNOWRTP.js} +2 -2
  38. package/dist/{chunk-E5QPXEKN.js → chunk-JFBL4PR3.js} +1 -1
  39. package/dist/{chunk-O52BQ5DP.js → chunk-NZ7BFYCM.js} +1 -1
  40. package/dist/chunk-O3MBPAWZ.js +2 -0
  41. package/dist/{chunk-DBL7MFCB.js → chunk-PVDZG2U2.js} +4 -4
  42. package/dist/{chunk-G7BBSHDF.js → chunk-QRU55BUS.js} +1 -1
  43. package/dist/{chunk-5RQJRD2E.js → chunk-RSOBUPLK.js} +1 -1
  44. package/dist/{chunk-VCCGS6Q2.js → chunk-S5DYR75A.js} +8 -8
  45. package/dist/chunk-STKJA4PV.js +1 -0
  46. package/dist/{chunk-ZTV2BA3P.js → chunk-U6LKNGC6.js} +1 -1
  47. package/dist/chunk-UKBXQXDZ.js +1 -0
  48. package/dist/chunk-ULJQYXHB.js +1 -0
  49. package/dist/{chunk-I4DLYOPO.js → chunk-V2J2AHDW.js} +4 -4
  50. package/dist/{chunk-Z46MSUTP.js → chunk-WLYYC3AP.js} +1 -1
  51. package/dist/{chunk-OGU5JE52.js → chunk-WOAMPTZI.js} +6 -6
  52. package/dist/{chunk-GCZU4XFA.js → chunk-Z6GQFTLJ.js} +1 -1
  53. package/dist/data/DataTable.js +1 -1
  54. package/dist/data/EntityList.d.ts +125 -0
  55. package/dist/data/EntityList.js +2 -0
  56. package/dist/data/ResizableTable.d.ts +31 -0
  57. package/dist/data/ResizableTable.js +2 -0
  58. package/dist/data/useColumnConfig.d.ts +68 -0
  59. package/dist/data/useColumnConfig.js +2 -0
  60. package/dist/data/useSort.d.ts +55 -0
  61. package/dist/data/useSort.js +2 -0
  62. package/dist/data/useTableNav.d.ts +28 -0
  63. package/dist/data/useTableNav.js +2 -0
  64. package/dist/format/index.js +1 -1
  65. package/dist/forms/BorderInput.js +1 -1
  66. package/dist/forms/BrandAssetEditor.js +1 -1
  67. package/dist/forms/ColorPicker.js +1 -1
  68. package/dist/forms/CornersInput.js +1 -1
  69. package/dist/forms/InputNumber.js +1 -1
  70. package/dist/forms/LinkPicker.js +1 -1
  71. package/dist/forms/MediaLibrary.js +1 -1
  72. package/dist/forms/MediaUploadGrid.js +1 -1
  73. package/dist/forms/PositionInput.js +1 -1
  74. package/dist/forms/SidesInput.js +1 -1
  75. package/dist/forms/Slider.js +1 -1
  76. package/dist/forms/WidthsBar.js +1 -1
  77. package/dist/icons/efficient-glyphs.js +1 -1
  78. package/dist/icons/efficient-looks.js +1 -1
  79. package/dist/icons/efficient.js +1 -1
  80. package/dist/icons/looks/map.js +1 -1
  81. package/dist/icons/payment.js +1 -1
  82. package/dist/icons/sets.js +1 -1
  83. package/dist/index.d.ts +13 -317
  84. package/dist/index.js +667 -694
  85. package/dist/shell/LanguageSelect.js +1 -1
  86. package/dist/telemetry/index.js +1 -1
  87. package/dist/templates/DataTablePage.js +1 -1
  88. package/dist/ui/index.d.ts +6 -0
  89. package/dist/ui/index.js +1 -1
  90. package/dist/version.js +1 -1
  91. package/package.json +1 -1
  92. package/dist/Calculator-PM4TYWTE.js +0 -29
  93. package/dist/CurrencyConverter-4I2ENTSX.js +0 -21
  94. package/dist/Notepad-QIJN7VDZ.js +0 -24
  95. package/dist/Sidebar-7LN3ZEF4.js +0 -44
  96. package/dist/Spreadsheet-EKYP6XIX.js +0 -37
  97. package/dist/chunk-7IY47EKR.js +0 -1
  98. package/dist/chunk-CY5N5OA3.js +0 -2
  99. package/dist/chunk-I3XM2PSQ.js +0 -100
  100. package/dist/chunk-OFCHJWM2.js +0 -1
  101. /package/dist/{chunk-CSA6CGXS.js → chunk-RKLZDVAO.js} +0 -0
@@ -0,0 +1,99 @@
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{ROW_HEIGHTS as c}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as u}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as d}from"./chunk-JDCM2VHG.js";import{Result as h}from"./chunk-QYL26AB4.js";import{CMD_Z as m,CMD_SHIFT_Z as p}from"./chunk-ZDMZM7HD.js";import{CopyButton as f}from"./chunk-2E2SUEEE.js";import{confirm as w}from"./chunk-PLK2WHZG.js";import{ItemCount as y}from"./chunk-55AEZX6K.js";import{isInOverlayOver as g}from"./chunk-3DVNXNTF.js";import{dialogA11y as v}from"./chunk-VWGWZY7A.js";import{ColoredBadge as b}from"./chunk-OKHKY3ZZ.js";import{focusableIn as x}from"./chunk-CDAJKLGL.js";import{LoadingSpinner as k}from"./chunk-O3MBPAWZ.js";import{useShellAuth as E}from"./chunk-2QY5BJLA.js";import{useIsMobile as C,useIsPhone as M}from"./chunk-UGTRSRIW.js";import{useShellPrefs as N}from"./chunk-KC3EX26K.js";import{activationOrder as S,activeListeners as L,ModalActionsContext as T,subscribeActive as z,getActiveModalId as A,KEY_ACTIVATED_SELECTOR as D}from"./chunk-F3ZOO23R.js";import{StatusBadge as P}from"./chunk-FZM3ZPW3.js";import{PopupMenu as I,PopupMenuItem as K,PopupMenuDivider as W,PopupMenuLabel as R}from"./chunk-OTITQ3IH.js";import{Button_default as O}from"./chunk-EOVXFXVV.js";import{Icon as $}from"./chunk-2UO47XB4.js";import{LoadingSpinner as j}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as F}from"./chunk-62LW225J.js";import{shellHttp as q,isShellHttpConfigured as B}from"./chunk-STKJA4PV.js";import{runEscapeInterceptors as H}from"./chunk-TWVUQUUD.js";import{useShellStrings as U}from"./chunk-GDQJBQ5B.js";import{createContext as Y,useContext as X,Component as V,useLayoutEffect as Z,useRef as _,useEffect as G,useState as J,useSyncExternalStore as Q,useCallback as ee,isValidElement as te,Fragment as ne,Children as re,cloneElement as oe,useMemo as ie,useId as ae,useReducer as se,Suspense as le}from"react";import{jsxs as ce,jsx as ue,Fragment as de}from"react/jsx-runtime";import{createPortal as he}from"react-dom";import{useLocation as me}from"react-router-dom";import{useQueryClient as pe,useQuery as fe}from"@tanstack/react-query";function we(e){return"component"in e}function ye(e){return"endpoint"in e}var ge={};function ve(e){ge=e}var be=new Proxy({},{get:(e,t)=>ge[t],has:(e,t)=>t in ge,ownKeys:()=>Object.keys(ge),getOwnPropertyDescriptor(e,t){if(t in ge)return{configurable:!0,enumerable:!0,value:ge[t]}}});function xe(){return B()}var ke=q,Ee=Y(null);function Ce(){return X(Ee)?.pageSearch??""}var Me=null,Ne=/* @__PURE__ */new Set;function Se(e){Me!==e&&(Me=e,Ne.forEach(e=>e()))}function Le(){return Me}function Te(e){return Ne.add(e),()=>{Ne.delete(e)}}var ze=null;function Ae(e){ze=e}function De({error:e,onReload:t}){const n=d(e);/* @__PURE__ */
2
+ return ce("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
+ /* @__PURE__ */ue($,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
+ /* @__PURE__ */ce("div",{className:"min-w-0",children:[
5
+ /* @__PURE__ */ue("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
+ /* @__PURE__ */ue("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
7
+ /* @__PURE__ */ue("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Pe=class extends V{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),u(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */ue(De,{error:e,onReload:this.reset}):this.props.children}},Ie=Y(null),Ke="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function We({className:e="",auto:t=!1}){const n=X(Ie),r=U().undo,o=n?.claimOwnMount;if(Z(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
8
+ return ce("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
+ /* @__PURE__ */ue("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",m):r.nothingToUndo,className:Ke,children:r.undo}),
10
+ /* @__PURE__ */ue("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",p):r.nothingToRedo,className:Ke,children:r.redo})]})}var Re=/* @__PURE__ */new Set([408,429]);function Oe(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function $e(e){const t=Oe(e);return null!=t&&(t>=400&&t<500&&!Re.has(t))}function je(e,t){return!$e(t)&&e<3}function Fe(e){if("page"!==e.type)return!0;const t=e.route?be[e.route]:void 0;if(!t||!we(t))return!0;const n=t;return!n.widget&&!n.utility}function qe(e){const t=e.route?be[e.route]:void 0;if(!t||!we(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var Be=(e,t)=>!!t&&"page"===e.type&&e.route===t;var He="flex-1 min-h-0";function Ue(){const e=U().record;/* @__PURE__ */
11
+ return ue(j,{label:e.loading,padding:"",className:He})}function Ye(e){return e??void 0}function Xe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=U().record;if(t||e&&n)/* @__PURE__ */return ue(Ue,{});if(r){const e=Oe(r);if(401===e)/* @__PURE__ */
12
+ return ue(h,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:He});if(403===e)/* @__PURE__ */
13
+ return ue(h,{status:"403",className:He});if(404===e||410===e)/* @__PURE__ */
14
+ return ue(h,{status:"404",title:i.notFound,className:He});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
15
+ return ue(h,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */ue(O,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:He})}/* @__PURE__ */
16
+ return ue(h,{status:"404",title:i.notFound,className:He})}function Ve({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */ue(de,{children:t(e)}):/* @__PURE__ */ue(Xe,{...n})}var Ze=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function _e(e){return"string"==typeof e&&(e.startsWith("new-")||Ze.test(e))}function Ge(e){if(_e(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Je=Y({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Qe=Y(null);function et(e){const t=X(Qe),n=_(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),Z(()=>{if(t)return t(n.current,e)},[t,e]),G(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function tt(){const e=_(/* @__PURE__ */new Map),[t,n]=J(!1);return{dirty:t,registerDirty:ee((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 nt(){return X(Je)}function rt(e){if("page"!==e.type&&Ge(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 ot({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=tt(),i=be[e.route];if(!i||!we(i))return null;const a=i,s=a.component;/* @__PURE__ */
17
+ return ue(Xr,{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__ */ue(Qe.Provider,{value:o,children:/* @__PURE__ */ue(le,{fallback:/* @__PURE__ */ue("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */ue(k,{})}),children:/* @__PURE__ */ue(s,{})})})})}function it({entityType:e,entityId:t,label:n}){const r=U(),o=pe(),{data:i}=fe({queryKey:["my-profile-sidebar"],enabled:xe(),queryFn:()=>ke.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 ue("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];ke.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__ */ue($,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var at=/* @__PURE__ */new Set,st=()=>"hidden";function lt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=be[e.entityType];if(!o||!ye(o))return null;const i=o,[a,s]=J(!1),{dirty:c,registerDirty:u}=tt(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=_e(e.entityId),p=!i.selfFetching&&!h&&!m&&xe(),f=fe({queryKey:[d,e.entityId],queryFn:()=>{return ke.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Ye(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!$e(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:je}),w=f.data,y=f.refetch;G(()=>{var t;if(p)return t=t=>{t!==e.id||at.has(t)||y({cancelRefetch:!1})},Qn.add(t),()=>{Qn.delete(t)}},[y,e.id,p]);const g=ee(()=>{a&&!c?s(!1):t()},[a,c,t]),v=(i.useEdit??st)(w??null),b=!i.useEdit||m||h?void 0:{state:v,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},x=i.selfFetching?e.label:w?i.title(w,a,s):e.label,E=i.icon,C=E?l[E]:null,M=x,N=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */ue(le,{fallback:/* @__PURE__ */ue(k,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */ue(le,{fallback:/* @__PURE__ */ue(Xr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */ue(Ue,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */ue(Xr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */ue(Xe,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */ue(Xr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:C,title:M,footer:N,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,edit:b,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */ue(Qe.Provider,{value:u,children:/* @__PURE__ */ue(le,{fallback:/* @__PURE__ */ue(Ue,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */ue(Ve,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function ct(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function ut(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function dt(e){const t=ct(e),n=t??ut(e);if(!n)return;if(t&&!dr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&er(o)}function ht(){const e=A();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var mt=/* @__PURE__ */new Map;function pt(){const e=ht();if(e)return mt.get(e)}function ft(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 wt="rosh-peek-style",yt=F.peek,gt=F.taskbarPreview;function vt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(wt))return;const e=document.createElement("style");e.id=wt,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:${yt}!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 bt(){"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 xt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=U(),l=_(null),[c,u]=J({w:n,h:Math.round(.75*r)}),[d,h]=J(!1);return Z(()=>{const o=l.current;if(!o)return;const i=ct(e)??ft(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.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__ */ce("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
+ /* @__PURE__ */ue("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */ce("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
20
+ /* @__PURE__ */ue($,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
21
+ /* @__PURE__ */ue("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */ue("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__ */ue("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__ */ue($,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function kt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=U(),s=e.length>1,l=_(null),[c,u]=J({left:-9999,top:-9999,ready:!1}),[d,h]=J(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");Z(()=>{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]),G(()=>bt,[]);const m="top"===d,p=(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 he(
22
+ /* @__PURE__ */ue("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:gt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{bt(),i()},children:e.map(e=>{const t=ct(e.id)??ft(e.label),o=t?function(e){if(dr(e))return null;const t=e.getBoundingClientRect(),n=ir(),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
+ return ce("div",{className:"group flex flex-col items-center",onMouseEnter:()=>vt(t),children:[!m&&/* @__PURE__ */ue("span",{className:p,children:e.label}),
24
+ /* @__PURE__ */ue(xt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */ue("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */ce("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__ */ue($,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function Et(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 Ct({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=U(),[a,s]=J(null);G(()=>{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=Q(z,A),[,u]=J(0);G(()=>{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]=J(0);G(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=ft(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=J(null),[f,w]=J(null),[g,v]=J(null),b=_(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},k=e.filter(e=>!e.route||!be[e.route]?.utility);if(!a||!a.isConnected||0===k.length)return null;const E=[],C=/* @__PURE__ */new Map;for(const e of k){const t=e.route?be[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=C.get(r);if(void 0!==o)E[o].items.push(e);else{C.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 he(
26
+ /* @__PURE__ */ce(de,{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=ct(e.id)??ft(e.label);return!!t&&!dr(t)});/* @__PURE__ */
27
+ return ce("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(g||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(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),p(null),w(null),s?v({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&&te(n)?oe(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */ue($,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
28
+ /* @__PURE__ */ue("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */ue("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */ue(y,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */ue("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__ */ue($,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
29
+ /* @__PURE__ */ue("div",{className:"flex-1"}),k.length>=2&&/* @__PURE__ */ce("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-accent-tint transition-colors shrink-0",children:[
30
+ /* @__PURE__ */ue($,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),g&&/* @__PURE__ */ce(I,{portal:!0,minWidth:200,style:Et(g.x,g.y),onClose:()=>v(null),children:[
31
+ /* @__PURE__ */ue(R,{children:g.label}),
32
+ /* @__PURE__ */ce(K,{onClick:()=>{v(null),g.items.forEach(e=>function(e){const t=On.get(e);t&&tr(t)}(e.id))},children:[
33
+ /* @__PURE__ */ue($,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
34
+ /* @__PURE__ */ce(K,{onClick:()=>{v(null),g.items.forEach(e=>o(e.id))},children:[
35
+ /* @__PURE__ */ue("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */ue("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
36
+ /* @__PURE__ */ue(W,{}),
37
+ /* @__PURE__ */ce(K,{danger:!0,onClick:()=>{v(null),g.items.forEach(e=>t(e.id))},children:[
38
+ /* @__PURE__ */ue($,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${g.items.length})`]})]}),m&&f&&/* @__PURE__ */ue(kt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:x})]}),a)}var Mt=["/login","/forgot-password","/reset-password","/force-change-password"];function Nt({children:e,windowAccentForRoute:t}){const n=me(),r=Mt.some(e=>n.pathname.startsWith(e)),[o,i]=J([]),a=_(o);Z(()=>{a.current=o},[o]);const s=Q(Te,Le,Le),l=_(/* @__PURE__ */new Map),c=e=>{const t=Fe(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};G(()=>{mt.clear();for(const e of o)e.route&&mt.set(e.id,e.route)},[o]);const u=ee(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=ee(e=>{var t;ct(e)||ut(e)?(t=e,window.dispatchEvent(new CustomEvent(Mr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=Pn;t&&at.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(In.get(i)??-1)>a)||er(o),t&&at.delete(e)},50)},m=(e,t,n)=>{const r=ze;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Fe(t))return e.length;if(t.shellOwned&&Be(t,n.home))return 0;const r=Be(t,n.home)?void 0:qe(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Fe(e)&&!Be(e,n.home)&&qe(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!Be(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&Be(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Fe(e[t])&&!Be(e[t],n.home)?qe(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:Le(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=ee(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),f=ee((e,t,n,r,o,a={})=>{if(!be[e]||!ye(be[e]))return;const s=`${e}:${t}`,l=ht();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Ye(n),openedFrom:l},!!a.append))})},[]),w=ee((e,t={})=>{if(!be[e]||!we(be[e]))return;const n=be[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Bn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const p=ht();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=ee(()=>{},[]),g=ee(()=>{},[]),v=d,b=d;/* @__PURE__ */
39
+ return ce(Je.Provider,{value:{openWindows:o,openEntity:f,openPage:w,reorderWindows:p,closeEntity:v,minimize:y,items:[],openItems:o,restore:g,remove:b,restoreIfMinimized:()=>!1},children:[e,
40
+ /* @__PURE__ */ue(Ct,{openWindows:o,onRemove:d,onSplitView:Ur,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&er(e)}})},onActivateById:dt}),
41
+ /* @__PURE__ */ue(Yr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
42
+ /* @__PURE__ */
43
+ return ue(Ee.Provider,{value:c(e),children:/* @__PURE__ */ue(Pe,{fallback:(t,n)=>/* @__PURE__ */ue(Xr,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */ue(De,{error:t,onReload:n})}),children:/* @__PURE__ */ue(nn,{spec:rt(e),children:/* @__PURE__ */ue(eo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */ue(ot,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */ue(lt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var St=400;function Lt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=_(null),s=_(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=_(!1),c=_(void 0),u=_(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},St)};G(()=>{n&&!r&&h()},[n,r]),G(()=>{d&&n&&!r&&h()},[d]),G(()=>()=>clearTimeout(c.current),[]),G(()=>{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?x(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),Z(()=>{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 Tt=null,zt=/* @__PURE__ */new Set;function At(){return Tt}function Dt(e){if(Tt!==e){Tt=e;for(const e of zt)e()}}function Pt(e){return zt.add(e),()=>{zt.delete(e)}}var It=!1,Kt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Wt=()=>{};function Rt(e){It=e,Kt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Ot(e,t){It&&("submenu"===e?Kt.submenus++:Kt.menus++,Kt.menuKey=t)}function $t(e){if(!It)return Wt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!It)return;const r=performance.now()-t;"move"===e?Kt.moveMs+=r:Kt.resizeMs+=r}}function jt(){const e=Kt;return Kt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Ft=/* @__PURE__ */new Set([P,b]),qt=e=>Ft.has(e)||"function"==typeof e&&"badge"===e.titleRole,Bt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Ht=/* @__PURE__ */new Set(["svg"]);function Ut(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Yt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Yt(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=>Yt(e,t,n));if(!te(e))return;const r=e;if(r.type===f)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===ne)return void re.toArray(r.props.children).forEach(e=>Yt(e,t,n));if("string"==typeof r.type){if(Ht.has(r.type))return;if(!Bt.has(r.type))return n.push(" "),re.toArray(r.props.children).forEach(e=>Yt(e,t,n)),void n.push(" ")}const o=oe(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(qt(r.type)?t.badges:t.actions).push(o)}var Xt=/* @__PURE__ */new Map,Vt=/* @__PURE__ */new Set,Zt=0;function _t(){Zt++,Vt.forEach(e=>e())}function Gt(e){return Xt.get(e)}function Jt(e){return Vt.add(e),()=>{Vt.delete(e)}}function Qt(){return Zt}var en=Y(""),tn=Y(null);function nn({spec:e,children:t}){/* @__PURE__ */
44
+ return ue(tn.Provider,{value:e,children:t})}var rn=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),on='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function an(e){return sn(e).replace(/\s+/g," ").trim()}function sn(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(sn).join("");if(te(e)){const t=e,n="string"==typeof t.type?t.type:"";return rn.has(n)?"":` ${sn(t.props?.children)} `}return""}function ln(e){const t=X(en);G(()=>{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 cn={};function un(e,t,n){const r=X(en);G(()=>{if(!r)return;cn[r]||(cn[r]=[]);const o={label:e,icon:n,onClick:t};return cn[r].push(o),()=>{cn[r]=(cn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function dn({title:e}){const t=_(null);return G(()=>{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__ */ue("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function hn(e){}function mn(){return X(en)}function pn({children:e,position:t="right",quiet:n=!1}){const r=X(T),[o,i]=J(null);return G(()=>{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?he(e,o):null}function fn({onClick:e,children:t,className:n}){const r=X(T);/* @__PURE__ */
45
+ return ue("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 wn="erp_window_positions",yn={};try{const e=localStorage.getItem(wn);e&&(yn=JSON.parse(e))}catch{}var gn=null;function vn(){gn&&clearTimeout(gn),gn=setTimeout(()=>{try{localStorage.setItem(wn,JSON.stringify(yn))}catch{}},500)}var bn="erp_activation_order",xn=[];try{const e=localStorage.getItem(bn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(xn=t)}catch{}var kn=null;function En(){kn&&clearTimeout(kn),kn=setTimeout(()=>{try{localStorage.setItem(bn,JSON.stringify(xn))}catch{}},500)}function Cn(e,t){yn[e]||(yn[e]=t,vn())}function Mn(e){return yn[e]?{...yn[e]}:null}function Nn(e,t){yn[e]=t,vn()}function Sn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(yn))n(yn[e],r,o)&&(delete yn[e],i=!0);i&&vn()}var Ln={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Tn=4e3,zn=()=>{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"},An={small:.8,medium:1,large:1.25,maximized:1.25},Dn=/* @__PURE__ */new Set,Pn=0,In=/* @__PURE__ */new Map;var Kn=0;function Wn(){return Kn}function Rn(){Kn++,L.forEach(e=>e())}var On=/* @__PURE__ */new Map,$n=/* @__PURE__ */new Map,jn=/* @__PURE__ */new Map;function Fn(){for(let e=S.length-1;e>=0;e--){const t=jn.get(S[e]);if(t?.tab)return t.owner}return null}function qn(){return Q(z,Fn,()=>null)}var Bn=/* @__PURE__ */new Set;var Hn=null;function Un(e){Hn=null,er(e)}function Yn(e){Hn=e;const t=On.get(e);t&&Un(t)}var Xn=/* @__PURE__ */new Map;function Vn(e){return Xn.get(e)?.holdsChanges()??!1}function Zn(e){const t=Xn.get(e);return t?t.ask():Promise.resolve(!0)}function _n(e){Hn===e&&(Hn=null)}function Gn(e,t,n){if(n&&jn.set(e,n),t)if(On.set(t,e),$n.set(e,t),Bn.delete(t)){S.unshift(e);const n=xn.indexOf(t);-1!==n&&xn.splice(n,1),xn.unshift(t),En()}else!function(e,t){const n=xn.indexOf(t);if(-1===n)return void S.push(e);let r=S.length;for(let e=0;e<S.length;e++){const t=$n.get(S[e]);if(t&&xn.indexOf(t)>n){r=e;break}}S.splice(r,0,e)}(e,t),-1===xn.indexOf(t)&&(xn.push(t),En());else S.push(e);Rn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Hn===t&&Un(e)}function Jn(e){return e?jn.get(e)?.owner??$n.get(e)??null:null}var Qn=/* @__PURE__ */new Set;function er(e){const t=Jn(A()),n=S.indexOf(e);-1!==n&&S.splice(n,1),S.push(e);const r=jn.get(e);if(r?.root)for(const[e,t]of jn){if(t.root||t.owner!==r.owner||Dn.has(e))continue;const n=S.indexOf(e);-1!==n&&S.splice(n,1),S.push(e)}Dn.delete(e);const o=$n.get(e);if(o){const e=xn.indexOf(o);-1!==e&&xn.splice(e,1),xn.push(o),En(),Hn&&Hn!==o&&(Hn=null)}Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=Jn(A());i&&i!==t&&Qn.forEach(e=>e(i))}function tr(e){const t=S.indexOf(e);-1!==t&&S.splice(t,1),Dn.add(e),In.set(e,++Pn);const n=$n.get(e);if(n){const e=xn.indexOf(n);-1!==e&&(xn.splice(e,1),En())}Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var nr=/* @__PURE__ */new Set;var rr=8,or=32;function ir(){return e()}var ar=c.windowBar,sr=80,lr=384,cr=400;function ur(e,t=ir()){const n=Math.min(Math.max(e.x,t.x+sr-e.w),t.x+t.w-sr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-ar);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function dr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=ir();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 hr(e){const t=ir(),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 mr=null;function pr(e){const t=(mr||((mr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${F.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(mr)),mr);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 fr(){mr&&(mr.style.opacity="0",mr.style.display="none")}var wr=[{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"}],yr=350,gr=200;function vr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=J(!1),s=_(void 0),l=_(void 0);G(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),yr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),gr)};/* @__PURE__ */
46
+ return ce("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,children:[
47
+ /* @__PURE__ */ue("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */ue("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:u,className:"absolute right-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:wr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */ue("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:u,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__ */ue("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var br="rosh-gesture-style";var xr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},kr=4;function Er(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(br))return;const e=document.createElement("style");e.id=br,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=$t(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Cr(e){const t=S.indexOf(e);if(-1===t)return-1;const n=F.window+t*F.windowStep,r=jn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of jn){if(!t.root||t.owner!==r.owner)continue;const n=S.indexOf(e);-1!==n&&(o=Math.max(o,F.window+n*F.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=S.length-1;e>=0;e--)nr.has(S[e])||S.splice(e,1);xn=xn.filter(e=>{const t=On.get(e);return null!=t&&nr.has(t)}),En(),Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Mr="modal-close-request";function Nr(e){Q(z,Wn);const t=X(T);if(S.length<=1)return!0;if(e){const t=On.get(e);if(null!=t)return A()===t}return t?.active??null!=A()}var Sr=!1,Lr=/* @__PURE__ */new Set;function Tr(e){return Lr.add(e),()=>Lr.delete(e)}function zr(){return Sr}function Ar(e){Sr!==e&&(Sr=e,Lr.forEach(e=>e()))}function Dr(){Ar(!Sr)}function Pr(){Ar(!1)}var Ir=null,Kr=/* @__PURE__ */new Set;function Wr(e){return Kr.add(e),()=>Kr.delete(e)}function Rr(){return Ir}function Or(e){Ir!==e&&(Ir=e,Kr.forEach(e=>e()))}var $r=null,jr=/* @__PURE__ */new Set;function Fr(e){return jr.add(e),()=>jr.delete(e)}function qr(){return $r}function Br(e){$r!==e&&($r=e,jr.forEach(e=>e()))}function Hr(){if(!$r)return void Ar(!1);Or($r),Br(null),Ar(!1)}function Ur(){Ar(!Sr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Yr(){const e=Q(Tr,zr),[t,n]=J(e),[r,o]=J(e);return G(()=>{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?he(
48
+ /* @__PURE__ */ue("div",{onMouseDown:e=>{e.stopPropagation(),Ar(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:F.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 Xr({open:t,onClose:l,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:y,bodyScroll:b,onMinimize:x,initialBox:k,actions:E,actionsLeft:L,editing:P=!1,edit:R,allowPinOnTop:j,initialPosition:q,widget:B,compact:Y,appStyle:V,flushBody:ne,autoHeight:re,autoMinHeight:se,autoWidth:le,widgetMenu:me,dimensions:pe,windowKey:fe,openedFromKey:we,accentRgb:ye,children:ge}){const[ve,be]=J(()=>r()),xe=C()&&!ve,ke=M()&&!!B,[Ce,Me]=J(0),[Ne,Se]=J(!1),Le=_(null),Te=_(0);G(()=>{Te.current=Ce},[Ce]);const ze=ee(e=>{xe&&(Le.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Se(!0),Dt(we??null))},[xe,we]),Ae=Q(Pt,At);G(()=>{if(!Ne)return;const e=e=>{if(!Le.current)return;const t=e.clientX-Le.current.startX;if(Math.abs(e.clientY-Le.current.startY)>Math.abs(t)+12)return Le.current=null,Se(!1),Me(0),void Dt(null);Me(Math.max(0,t))},t=()=>{if(!Le.current)return;const e=.3*window.innerWidth,t=Te.current>e;Le.current=null,Se(!1),t?(Me(window.innerWidth),setTimeout(()=>{l(),Me(0),Dt(null)},180)):(Me(0),Dt(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[De,Ke]=J(c),Re=U(),Oe=Re.window;G(()=>{Ke(c)},[c]);const $e=ie(()=>an(De).trim()||void 0,[De]),je=ae(),[Fe,qe]=J(!1),Be=_(!1),[He,Ue]=J(!1),[Ye,Xe]=J(null),Ve=X(tn),Ze=X(Ee),{prefs:_e,save:Ge}=N(),Je=!!_e.window_accent_stripe,Qe=_e.favorite_documents||[],tt=!!Ve&&Qe.some(e=>e.entityType===Ve.entityType&&e.entityId===Ve.entityId),rt=ee(()=>{if(!Ve)return;const e=tt?Qe.filter(e=>!(e.entityType===Ve.entityType&&e.entityId===Ve.entityId)):[...Qe,{entityType:Ve.entityType,entityId:Ve.entityId,label:Ve.label}];Ge({favorite_documents:e})},[Ve,tt,Qe,Ge]),[ot,it]=J(null),[at,st]=J("top-right"===q?"right":"left"),lt=_(!1),ct=_(null);Z(()=>{const e=ct.current;e&&(ye?e.style.setProperty("--window-accent-rgb",ye):e.style.removeProperty("--window-accent-rgb"))},[ye]);const ut=_(!1),dt=_(null),ht=_(null),mt=_(null),[pt,ft]=J(!1),wt=_(null),yt=_(null),gt=_(null),[vt,bt]=J(!1);Z(()=>{const e=yt.current,t=gt.current;if(!e||!t)return;const n=()=>bt(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!=y&&!1!==y]);const xt=!!R&&!B&&!Y&&!V&&(R.editing||"hidden"!==R.state),kt=!!(y||E||L)||pt||xt,Et=X(Ie),Ct=""!==X(en),Mt=_(null);Mt.current=Ze?{owner:Ze.key,tab:Ze.tab,root:!Ct}:null;const Nt=fe||(Ze&&!Ct?Ze.key:null),St=!!Et&&!Ct&&Et.enabled&&Et.hasState&&(P||Et.declaredEditable)&&!Et.handMounted&&kt&&!B&&!Y&&!V&&!xe,Tt=/* @__PURE__ */ue($,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),zt=u&&te(u)?oe(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Tt,It=()=>/* @__PURE__ */ue("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Xe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:zt}),Kt=40,{minimize:Wt,items:Rt,restoreIfMinimized:Ot,openWindows:$t}=nt(),jt=_(`modal-${Math.random().toString(36).slice(2,8)}`).current;G(()=>{if(B)return nr.add(jt),()=>{nr.delete(jt)}},[B,jt]),G(()=>{const e=e=>{const t=e.detail;t?.id===jt&&Ke(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[jt]);const[Ft,qt]=J(F.window),Bt=function(e){const t=Q(z,A);return S.length<=1||t===e}(jt),Ht=_(R);Ht.current=R;const Yt=!!R&&!R.editing&&"enabled"===R.state;G(()=>{if(!t||!Bt||!Yt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(g(e.target,ct.current)||(e.preventDefault(),e.stopPropagation(),Ht.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Bt,Yt]);const Vt=function(e){return Q(z,()=>Dn.has(e))}(jt);Lt({panelRef:ct,bodyRef:dt,open:t,widget:!!B,active:Bt,minimized:Vt});const Zt=Q(Tr,zr),Gt=Q(Wr,Rr),Jt=Q(Fr,qr),Qt=!j&&!B,nn=Zt&&Qt,[rn,sn]=J(!1),ln=nn&&Jt===jt,[un,dn]=J(!1),hn=un&&Qt&&Gt===jt?"picked":null,mn=_(nn);G(()=>{if(mn.current&&!nn){dn(!0);const e=setTimeout(()=>{dn(!1),Ir===jt&&Or(null)},700);return mn.current=nn,()=>clearTimeout(e)}mn.current=nn},[nn,jt]),G(()=>{nn||sn(!1)},[nn]),G(()=>{const e=ht.current,t=mt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ft(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]),G(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ct.current){const t=ct.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ht.current,n=mt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const pn=_(!1),fn=ee(e,[]),wn=ee(()=>{const t=e(),n=pe?pe[0]:Ln[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=An[zn()],l=pe?Math.min(pe[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(S.length-1),u=Math.max(Kt,(i-l)/2),d=(o-a)/2,m=t.h-Kt-l-u;return"top-right"===q?{x:t.x+t.w-a-Kt,y:t.y+Kt,w:a,h:l}:"top-left"===q?{x:t.x+Kt,y:t.y+Kt,w:a,h:l}:{x:t.x+Math.max(Kt,(o-a)/2+Kt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),gn=_(!1);t||(gn.current=!1);const bn=fe||d||null;G(()=>{if(!t)return;Gn(jt,bn,Mt.current??void 0),fe||er(jt),pn.current=!1,qt(Cr(jt));const e=()=>{qt(Cr(jt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===fe;if(!e.label)return!1;const t=ct.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(er(jt),Wn.current)return;const t=ir(),n=Math.min(Vn.current.w,t.w-40),o=Math.min(Vn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;En({x:i,y:a,w:n,h:o}),Yn(!1)},i=e=>{const t=e.detail;r(t)&&(er(jt),Xe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==fe)return;er(jt);const t=Vn.current,n=function(e,t=ir()){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=ct.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)}En(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=S.indexOf(e);-1!==t&&(S.splice(t,1),Rn()),Dn.delete(e),In.delete(e),jn.delete(e);const n=$n.get(e);n&&($n.delete(e),On.delete(n))}(jt),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,jt,bn,fn]);const xn=!B&&"maximized"===zn(),[kn,En]=J(()=>{if(bn&&yn[bn]){const e={...yn[bn]};return pe&&(e.w=pe[0],re||(e.h=pe[1])),ur(e)}return k?{x:k.x,y:k.y,w:k.w,h:k.h}:xn?fn():wn()}),[Cn,Mn]=J(()=>!re),Nn=_(ve),Sn=_(null);G(()=>{const e=()=>{const e=r();e!==Nn.current&&Sn.current?.(e),Nn.current=e,be(e),qt(Cr(jt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[jt]);const Pn=ve&&!!Ze?.tab&&!Ct&&!B&&!xe,Kn=Pn,Wn=_(Kn);Wn.current=Kn;const Fn=qn(),Bn=ve&&!!Ze?.tab&&!B&&!xe&&!Zt&&Fn!==Ze.key,Hn=!!B&&ve&&!Zt&&null!==Fn,[Un,Yn]=J(()=>bn&&yn[bn]||k?Kn:Kn||xn),Vn=_(kn);Vn.current=kn;const Zn=_(Un);Z(()=>{Zn.current=Un},[Un]),Z(()=>{if(Cn||Pn)return;const e=ct.current,t=dt.current;if(!e||!t)return;const n=se??(B?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 p=t.offsetHeight,f=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Vn.current.y)-24),g=w?Math.min(Vn.current.h,y):Math.min(Math.max(n,u+p),y),v=Math.abs(g-o)>1;v&&(o=g,En(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),B||(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(),wt.current&&l.observe(wt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[Cn,B,se,kt,Pn]),Z(()=>{if(!re||!Cn||B||!t)return;const e=wt.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||Un)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=se??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Vn.current.y)-24);En(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[re,Cn,B,t,Un,se]);const _n=!1!==le&&!B&&!V&&!xe,[Jn,Qn]=J(()=>!_n);Z(()=>{if(Jn||!t)return;if(!_n||Un)return void Qn(!0);const n=ct.current,r=dt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=Vn.current.w,c=0;const u=()=>Qn(!0),d=()=>{c=0;const t=Vn.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=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(m[t])});const v=a(t,s(t.w,w,g),d,Kt);v!==t&&(l=v.w,En(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,Tn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Jn,t,_n,Un]);const ar=_(null),sr=!(!Ze?.tab||Ct||B||xe);Sn.current=t=>{if(!sr)return;if(t)return ar.current||(ar.current={box:{...Vn.current},maximized:Zn.current}),void(Zn.current=!0);const r=ar.current;ar.current=null;const o=e();if(r?.maximized)return Zn.current=!0,Yn(!0),void En(o);const i=r?.box??(bn?yn[bn]:void 0);if(Zn.current=!1,Yn(!1),i&&!n(i,o,!1)){const e={...i};pe&&(e.w=pe[0],re||(e.h=pe[1])),En(ur(e))}else En(wn())},G(()=>{Kn&&(Zn.current=!0,Yn(!0),En(fn()))},[Kn,fn]),G(()=>{if(B)return;const e=()=>{const e=bn?yn[bn]:void 0;if(Zn.current=!1,Yn(!1),e){const t={...e};pe&&(t.w=pe[0],re||(t.h=pe[1])),En(ur(t))}else En(wn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[B,wn,bn]),G(()=>{t&&bn&&!Pn&&(yn[bn]=kn,vn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[kn,t,bn,Pn]),G(()=>{if(!t)return;const e=()=>{Zn.current?En(fn()):document.body.classList.contains("rosh-gesturing")||En(ur)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Un&&(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,Un,fn]),G(()=>{if(t&&(qe(!1),Be.current=!1,lt.current=!1,Qn(!_n),!Wn.current)){if(bn&&yn[bn]){const e=yn[bn];return void En(t=>ur({...e,...re?{h:t.h}:{},..._n?{x:t.x,w:t.w}:{}}))}k&&(En({x:k.x,y:k.y,w:k.w,h:k.h}),Yn(k.maximized))}},[t]),G(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{ct.current?.contains(t.target)&&!Be.current&&(Be.current=!0,e=setTimeout(()=>qe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const dr="auto"===m?Fe:!0===m,mr=Ze&&!Ct?Ze.key:null,wr=ie(()=>Ut(De),[De]),yr=_({shortcutSpec:Ve,isOnDesktop:tt,toggleDesktopShortcut:rt,taskbarStrings:Re.taskbar});Z(()=>{yr.current={shortcutSpec:Ve,isOnDesktop:tt,toggleDesktopShortcut:rt,taskbarStrings:Re.taskbar}});const gr=_(null);gr.current||(gr.current={open:(e,t)=>Xe({x:e,y:t}),items:()=>{const e=yr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of cn[jt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),G(()=>{if(t&&mr)return()=>{return e=mr,void(Xt.delete(e)&&_t());var e}},[t,mr]),et(!(fe||!t)&&dr);const br=ee(()=>dr||"auto"===m&&Be.current,[dr,m]),Nr=ee(async e=>{if(lt.current)return!1;if(!br())return!0;lt.current=!0;const t=$e,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 w({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 lt.current=!1,r},[br,$e]),Sr=ee(()=>lt.current?Promise.resolve():br()?Nr("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[br,Nr,l]),Lr=ee(async()=>{await Nr("discard")&&(Be.current=!1,qe(!1),Ht.current?.onDiscard())},[Nr]),Dr=ee(async()=>{const e=await Nr("switch");return e&&(Be.current=!1,qe(!1)),e},[Nr]),Pr=_(()=>!1);Z(()=>{Pr.current=br}),Z(()=>{if(!t||!fe)return;const e={holdsChanges:()=>Pr.current(),ask:Dr};return Xn.set(fe,e),()=>{Xn.get(fe)===e&&Xn.delete(fe)}},[t,fe,Dr]),Z(()=>{if(!t||!Nt)return;const e=e=>{e.detail?.windowKey===Nt&&Sr()};return window.addEventListener(Mr,e),()=>window.removeEventListener(Mr,e)},[t,Nt,Sr]);const Kr=_(null),$r=ee(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Xe(null),er(jt),Wn.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=ct.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Kr.current){const t=Kr.current;Kr.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:Vn.current.x,c=s?s.top:Vn.current.y,u=s?s.height:Vn.current.h,d=s?s.width:Vn.current.w;Yn(!1),En(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<kr&&Math.abs(e.clientY-i)<kr)return;r=Er(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)`),Vn.current={...Vn.current,x:s,y:u},!B){const t=function(e,t){const n=ir(),r=e<=n.x+rr,o=e>=n.x+n.w-rr,i=t<=n.y+rr,a=t>=n.y+n.h-rr,s=e<=n.x+or,l=e>=n.x+n.w-or,c=t<=n.y+or,u=t>=n.y+n.h-or;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?pr(hr(t)):fr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),fr();const e=ur({...Vn.current});if(Vn.current=e,!B&&h){Kr.current={x:l,y:c,w:d,h:u};const e=hr(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 En(e)}if(B){const t=e.x+e.w/2,n=window.innerWidth/2;st(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),En(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),jr=ee((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=ct.current,l=s?.getBoundingClientRect(),c=l?l.left:Vn.current.x,u=l?l.top:Vn.current.y,d=l?l.width:Vn.current.w,h=l?l.height:Vn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Yn(!1),En({x:c,y:u,w:d,h:h}),Vn.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,Vn.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)<kr&&Math.abs(e.clientY-a)<kr)return;o=Er(n,r,xr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(lr,d+e)),w&&(i=Math.max(cr,h+t)),m){const t=Math.max(lr,d-e);n=c+d-t,o=t}if(p){const e=Math.max(cr,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?.(),En({...Vn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Br=ee(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(),er(jt),"Enter"===e.key)return void(Un?(Yn(!1),En(wn())):(Yn(!0),En(fn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Kr.current||(Kr.current={...Vn.current})};if(r<0)return e(),Yn(!0),void En(fn());if(r>0){if(Un)return Yn(!1),void En(wn());if(Kr.current){const e=ur(Kr.current);return Kr.current=null,Vn.current=e,void En(e)}return void tr(jt)}e(),Yn(!1);const t=hr(n<0?"left":"right");return Vn.current=t,void En(t)}if(Un)return;const o=Vn.current,i=e.shiftKey?{...o,w:Math.max(lr,o.w+24*n),h:Math.max(cr,o.h+24*r)}:ur({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Vn.current=i,En(i)},[jt,Un,wn,fn]),Hr=ee(e=>{Kr.current||(Kr.current={...Vn.current}),Yn(!1);const t=hr(e);Vn.current=t,En(t),er(jt)},[jt]),Ur=Kn||nn?{}:{tabIndex:0,role:"group","aria-label":$e?`${$e} — ${Oe.windowSuffix}`:Oe.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:Br},Yr=()=>{Yn(!0),En(fn())},Xr=ee(()=>{const e=ct.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(on);t&&!t.disabled&&t.click()}},[]);G(()=>{if(!t)return;if(B)return;const e=e=>{if(S[S.length-1]===jt&&!g(e.target,ct.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Xr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ct.current?.contains(t)))return;if(t.closest(D))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Xr,jt,B]),G(()=>{if(!t)return;const e=e=>{S[S.length-1]===jt&&(g(e.target,ct.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:jt}})),Be.current=!1,qe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:jt}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),G(()=>{if(!t)return;if(B)return;const e=e=>{if("Escape"===e.key&&S[S.length-1]===jt){if(H(e))return e.preventDefault(),void e.stopPropagation();if(Pn&&!P)return;e.preventDefault(),e.stopPropagation(),Sr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,jt,B,Pn,P]);const Vr=t&&(void 0!==p||void 0!==f),[Zr]=J(()=>{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}),_r=Pn&&!Ze?.home&&wr.actions.length>0;G(()=>{t&&mr&&function(e,t){const n=Xt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(Xt.set(e,t),_t())}(mr,{title:wr.text||$e,dirty:dr,copy:wr.copy,actions:_r&&Zr?Zr:void 0,menu:gr.current??void 0})},[t,mr,$e,dr,wr.text,wr.copy,_r,Zr]);const Gr=ee(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(G(()=>{if(!t)return;const e=e=>{if(S[S.length-1]!==jt)return;if(g(e.target,ct.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Vr&&(e.preventDefault(),p?p():Gr("bottom")),"k"===e.key&&Vr&&(e.preventDefault(),f?f():Gr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Vr,Gr,jt]),!t||gn.current)return null;const Jr=nn?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=ir(),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}}(jt):null,Qr=nn&&Jr?Math.min(Jr.w/kn.w,Jr.h/kn.h):1,eo=(()=>{if(nn&&Jr){const e=Qr,t=kn.w*e,n=kn.h*e,r=Jr.x+(Jr.w-t)/2-kn.x,o=Jr.y+(Jr.h-n)/2-kn.y,i=rn||ln;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:F.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(un&&Qt){const e="picked"===hn;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:F.expose+30}:{}}}return null})(),to=v({modal:!1,titleId:!B&&(Pn?!Ze?.home:!xe)?je:void 0,label:wr.text||$e}),no=/* @__PURE__ */ce("div",{children:[
49
+ /* @__PURE__ */ce("div",{ref:ct,"data-modal-panel":!0,"data-modal-id":jt,"data-window-key":fe||void 0,...j?{"data-utility":""}:{},...He?{"data-pinned-top":""}:{},...B?{"data-widget":""}:{},...Ze?{"data-window-owner":Ze.key}:{},...Ze&&!Ct?{"data-window-root":""}:{},...Pn?{"data-window-tab":""}:{},...to,className:Pn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(B?Bt?"shadow-xl":"shadow-lg":"border "+(Bt?"shadow-xl border-line":"shadow-lg border-line-strong")),onMouseDownCapture:e=>{if(ut.current=!1,nn){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Or(jt),Ar(!1),void er(jt)}if(!Bt&&!B&&!He&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ct.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),ut.current=!0,Xe(null),er(jt),window.addEventListener("mouseup",()=>{setTimeout(()=>{ut.current=!1},0)},{once:!0}))}},onClickCapture:e=>{ut.current&&(ut.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(nn)return;Xe(null);e.target.closest("[data-modal-panel]")===ct.current&&(e.target.closest("button, input, a, select, textarea")||er(jt))},style:xe?{zIndex:Ft+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Ce}px)`,transition:Ne?"none":"transform 180ms ease-out",...B?{display:"none"}:{},...Ft<0?{display:"none"}:{},...Bt||He||Ae&&fe===Ae?{}:{display:"none"}}:{zIndex:He?F.pinnedWindow:Ft+1,width:kn.w,height:kn.h,top:kn.y,...B&&"right"===at?{right:window.innerWidth-kn.x-kn.w}:{left:kn.x},...Ft<0&&!He?{display:"none"}:{},...ke?{display:"none"}:{},...Bn||Hn?{visibility:"hidden",pointerEvents:"none"}:{},...eo??{}},children:[xe&&!B&&/* @__PURE__ */ue("div",{onPointerDown:ze,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),B?null:Pn?Ze?.home?null:/* @__PURE__ */ce(de,{children:[
50
+ /* @__PURE__ */ue("h2",{id:je,"data-window-title":!0,className:"sr-only",children:wr.text||$e}),_r&&Zr&&he(
51
+ /* @__PURE__ */ue(de,{children:wr.actions}),Zr),wr.badges.length>0&&/* @__PURE__ */ue("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:wr.badges})]}):xe?null:
52
+ /* @__PURE__ */ce("div",Y?{onPointerDown:$r,"data-window-chrome":"",...Ur,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-line shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
53
+ /* @__PURE__ */ce("div",{"data-window-title":!0,title:$e,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!nn&&It(),
54
+ /* @__PURE__ */ue("span",{id:je,className:"truncate",children:nn?an(De):De})]}),!nn&&/* @__PURE__ */ce("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[j&&/* @__PURE__ */ue("button",{onClick:()=>Ue(e=>!e),title:He?Oe.unpin:Oe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */ue($,{name:"bookmark-square",className:"h-3 w-3",fill:He?"currentColor":"none",strokeWidth:1.5})}),
55
+ /* @__PURE__ */ue("button",{type:"button",onClick:Sr,"aria-label":Oe.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */ue($,{name:"close",className:"h-4 w-4"})})]})]}:V?{onPointerDown:$r,"data-window-chrome":"",...Ur,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-line shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
56
+ /* @__PURE__ */ce("div",{"data-window-title":!0,title:$e,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!nn&&It(),
57
+ /* @__PURE__ */ue("span",{id:je,className:"truncate",children:nn?an(De):De})]}),!nn&&/* @__PURE__ */ce("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[j&&/* @__PURE__ */ue("button",{onClick:()=>Ue(e=>!e),title:He?Oe.unpin:Oe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */ue($,{name:"bookmark-square",className:"h-3 w-3",fill:He?"currentColor":"none",strokeWidth:1.5})}),
58
+ /* @__PURE__ */ue("button",{onClick:()=>tr(jt),title:Oe.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!Kn&&/* @__PURE__ */ue(vr,{maximized:Un,onToggleMax:()=>{Un?(Yn(!1),En(wn())):Yr()},onSnap:Hr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:Oe}),
59
+ /* @__PURE__ */ue("button",{type:"button",onClick:Sr,"aria-label":Oe.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */ue($,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:$r,"data-window-chrome":"",...Ur,className:"flex items-center justify-between h-(--row-height-window-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Bt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Bt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
60
+ /* @__PURE__ */ce("div",{"data-window-title":!0,title:$e,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Bt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!nn&&It(),
61
+ /* @__PURE__ */ue("span",{id:je,className:"truncate",children:nn?an(De):De})]}),!nn&&/* @__PURE__ */ce("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[j&&/* @__PURE__ */ue("button",{onClick:()=>Ue(e=>!e),title:He?Oe.unpin:Oe.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(He?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */ue($,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:He?"currentColor":"none",strokeWidth:1.5})}),
62
+ /* @__PURE__ */ue("button",{onClick:()=>tr(jt),title:Oe.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!Kn&&/* @__PURE__ */ue(vr,{maximized:Un,onToggleMax:()=>{Un?(Yn(!1),En(wn())):Yr()},onSnap:Hr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:Oe}),
63
+ /* @__PURE__ */ue("button",{type:"button",onClick:Sr,"aria-label":Oe.close,className:"rounded-(--radius-control) text-ink-faintest hover:text-gray-600",children:/* @__PURE__ */ue($,{name:"close",className:"h-5 w-5"})})]})]}),ye&&Je&&!B&&!xe&&/* @__PURE__ */ue("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Bt?.9:.55})`}}),
64
+ /* @__PURE__ */ue(en.Provider,{value:jt,children:/* @__PURE__ */ue(T.Provider,{value:{rightRef:ht,leftRef:mt,notify:()=>ft(!0),active:Bt,isDirty:dr,footerOpen:kt&&!B&&!Y&&!V&&!xe},children:/* @__PURE__ */ue("div",{ref:dt,...B?{onPointerDown:$r,onContextMenu:e=>{e.preventDefault(),it({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${B?"p-0 cursor-move":V||ne?"p-0":Y?"p-2":"p-4"} ${B||Pn?"":"backdrop-blur-sm"} ${!1===b||V||ne?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${B?"rounded-2xl select-none":""}`,style:{...B?{touchAction:"none"}:{},backgroundColor:B?"transparent":Pn?"rgb(var(--window-content-rgb))":Bt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */ue(Pe,{children:ge})})})}),B&&ot&&/* @__PURE__ */ce(I,{minWidth:160,style:{left:ot.x,top:ot.y},onClose:()=>it(null),children:[
65
+ /* @__PURE__ */ue(K,{onClick:()=>{it(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:jt}))},children:"Settings"}),
66
+ /* @__PURE__ */ue(W,{}),me&&/* @__PURE__ */ce(de,{children:[me,
67
+ /* @__PURE__ */ue(W,{})]}),
68
+ /* @__PURE__ */ce(K,{onClick:()=>{it(null),Ue(e=>!e)},children:[
69
+ /* @__PURE__ */ue("span",{className:"flex-1",children:"Always on Top"}),He&&/* @__PURE__ */ue($,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
70
+ /* @__PURE__ */ue(W,{}),
71
+ /* @__PURE__ */ue(K,{onClick:()=>{it(null),Sr()},children:"Close"})]}),
72
+ /* @__PURE__ */ce("div",{onPointerDown:$r,ref:wt,"data-modal-footer":"",className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${Pn?"":" cursor-move"}${Bt&&!Pn?" backdrop-blur-sm":""}${B||Y||V||xe||!kt?" hidden":""}`,style:{touchAction:"none",backgroundColor:Pn?"rgb(var(--window-footer-rgb))":Bt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
73
+ /* @__PURE__ */ce("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[St&&/* @__PURE__ */ue(We,{auto:!0}),L,
74
+ /* @__PURE__ */ue("div",{ref:mt,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=y&&!1!==y&&
75
+ /* @__PURE__ */ue("div",{ref:yt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */ue("div",{ref:gt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(vt?" invisible":""),children:y})})]}),
76
+ /* @__PURE__ */ce("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[xt&&R&&(R.editing?/* @__PURE__ */ue(O,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Lr()},children:Oe.discard}):"object"==typeof R.state?/* @__PURE__ */ue(O,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:R.state.disabledReason,children:Oe.edit}):/* @__PURE__ */ue(O,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>R.onEdit(),children:Oe.edit})),
77
+ /* @__PURE__ */ue("div",{ref:ht,"data-modal-actions":!0,className:"flex items-center gap-2"}),E]})]}),!B&&!xe&&!nn&&Bt&&!Kn&&/* @__PURE__ */ce(de,{children:[
78
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
79
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
80
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
81
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
82
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
83
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
84
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
85
+ /* @__PURE__ */ue("div",{onPointerDown:e=>jr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),nn&&/* @__PURE__ */ue("div",{className:"absolute inset-0",style:{zIndex:F.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>sn(!0),onMouseLeave:()=>sn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),er(jt),Ar(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:rn&&/* @__PURE__ */ue("button",{type:"button","data-expose-close":!0,"aria-label":Re.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/Qr})`,transformOrigin:"top right",zIndex:F.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),Sr()},children:/* @__PURE__ */ue($,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),nn&&Jr&&/* @__PURE__ */ue("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Jr.x,top:Jr.y+Jr.h+4,width:Jr.w,zIndex:F.expose+(rn?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:an(De)})]}),ro=Ye&&/* @__PURE__ */ce(I,{style:{left:Ye.x,top:Ye.y},onClose:()=>Xe(null),minWidth:160,children:[!B&&!Y&&!Pn&&/* @__PURE__ */ce(de,{children:[
86
+ /* @__PURE__ */ce(K,{onClick:()=>{tr(jt),Xe(null)},children:[
87
+ /* @__PURE__ */ue($,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),Oe.minimize]}),!Kn&&/* @__PURE__ */ce(K,Un?{onClick:()=>{Yn(!1),En(wn()),Xe(null)},children:[
88
+ /* @__PURE__ */ue("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */ue("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),Oe.windowed]}:{onClick:()=>{Yr(),Xe(null)},children:[
89
+ /* @__PURE__ */ue($,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),Oe.maximize]})]}),j&&!Pn&&/* @__PURE__ */ce(K,{onClick:()=>{Ue(e=>!e),Xe(null)},children:[
90
+ /* @__PURE__ */ue($,{name:"bookmark-square",className:"h-4 w-4 "+(He?"text-blue-600":""),fill:He?"currentColor":"none",strokeWidth:1.5}),He?Oe.unpin:Oe.pinOnTop]}),Ve&&/* @__PURE__ */ce(K,{onClick:()=>{Xe(null),rt()},children:[
91
+ /* @__PURE__ */ue($,{name:"star",className:"h-4 w-4",fill:tt?"currentColor":"none",strokeWidth:1.5}),tt?Re.taskbar.removeFromDesktop:Re.taskbar.addToDesktop]}),(cn[jt]||[]).length>0&&/* @__PURE__ */ue(de,{children:(cn[jt]||[]).map((e,t)=>/* @__PURE__ */ce(K,{onClick:()=>{Xe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Pn&&Ze?.home)&&/* @__PURE__ */ce(de,{children:[
92
+ /* @__PURE__ */ue(W,{}),
93
+ /* @__PURE__ */ce(K,{danger:!0,onClick:()=>{Xe(null),Sr()},children:[
94
+ /* @__PURE__ */ue($,{name:"close",className:"h-4 w-4"}),Oe.close]})]})]}),oo=!!fe&&$t.some(e=>e.id===fe),io=!Vt||oo||B?null:/* @__PURE__ */ce("div",{"data-modal-restore-tab":!0,"data-modal-id":jt,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:[
95
+ /* @__PURE__ */ue("button",{type:"button",onClick:()=>er(jt),title:Oe.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:$e||Oe.windowSuffix}),
96
+ /* @__PURE__ */ue("button",{type:"button",onClick:()=>er(jt),title:Oe.restore,"aria-label":Oe.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
97
+ /* @__PURE__ */ue("button",{type:"button",onClick:()=>{Sr()},title:Oe.close,"aria-label":Oe.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 he(
98
+ /* @__PURE__ */ce(tn.Provider,{value:null,children:[no,ro,io]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Sr&&"Escape"===e.key&&(Br(null),Ar(!1))});var Vr=100,Zr={past:[],future:[]};function _r(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>Vr?r.slice(r.length-Vr):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:Zr}}var Gr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Jr=500,Qr=250;function eo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=se(_r,Zr),a=_(/* @__PURE__ */new Map),[s,l]=J(0),c=s>0,[u,d]=J(0),[h,m]=J(0),p=h>0,{hasAnyPerm:f}=E(),w=t&&0===u&&(!(n&&n.length>0)||f(n)),y=_(null),g=_(!1),v=ee(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),b=ee((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),x=ee(e=>{a.current.delete(e)&&l(e=>e-1)},[]),k=ee(e=>{d(t=>t+(e?1:-1))},[]),C=ee(e=>{m(t=>t+(e?1:-1))},[]),[M,N]=J(0),S=M>0,L=ee(e=>{N(t=>t+(e?1:-1))},[]),z=X(Ie),A=z?.claimReadOnly;G(()=>{if(A&&!w)return A(!0),()=>A(!1)},[A,w]);const D=z?.claimOwnMount;G(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const P=_({last:0,count:0,tripped:!1}),I=_(!1),K=ee((e,t,n)=>{if(g.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(I.current=!0));if(!w||y.current)return;const r=P.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Qr&&(r.count=0),r.last=o,++r.count>Jr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Jr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);y.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=y.current;y.current=null,e&&i({type:"record",step:e})})},[w,v]),W=ee(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),R=ee(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),i({type:"undo",redoStep:t})},[o.past,v,W]),O=ee(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),i({type:"redo",undoStep:t})},[o.future,v,W]),[$,j]=J(0),F=_(0),q=_(0),B=_(!1),H=ee(()=>{g.current=!0,I.current=!1,y.current=null,F.current+=1,q.current=F.current,j(F.current)},[]),U=_(void 0),Y=ee(e=>{void 0!==e&&(void 0!==U.current&&e!==U.current&&(B.current=!0),U.current=e),H()},[H]);G(()=>{g.current&&$===q.current&&(g.current=!1,y.current=null,(I.current||B.current)&&i({type:"clear"}),I.current=!1,B.current=!1)},[$]);const V=ee(()=>{B.current=!0,i({type:"clear"}),H()},[H]),Z=w&&o.past.length>0,Q=w&&o.future.length>0,te=Nr(r),ne=_({undo:R,redo:O,canUndo:Z,canRedo:Q});ne.current={undo:R,redo:O,canUndo:Z,canRedo:Q},G(()=>{if(!te||!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&&Gr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ne.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[te,w]);const re=ie(()=>({register:b,unregister:x,record:K,undo:R,redo:O,clear:V,baseline:Y,canUndo:Z,canRedo:Q,enabled:w,hasState:c,handMounted:S,claimOwnMount:L,claimReadOnly:k,declaredEditable:p,claimEditable:C,undoLabel:Z?o.past[o.past.length-1].label:null,redoLabel:Q?o.future[0].label:null}),[b,x,K,R,O,V,Y,Z,Q,w,c,S,L,k,p,C,o.past,o.future]),oe=""!==mn(),ae=X(T)?.footerOpen??!1,le=oe&&w&&c&&!S&&ae;/* @__PURE__ */
99
+ return ce(Ie.Provider,{value:re,children:[le&&/* @__PURE__ */ue(pn,{position:"left",quiet:!0,children:/* @__PURE__ */ue(We,{auto:!0})}),e]})}function to(){const e=X(Ie),t=ee(()=>{},[]);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 no(e){const t=X(Ie),n=t?.claimReadOnly,r=t?.claimEditable;G(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function ro(e,t,n){const r=X(Ie),o=ae(),i=_(e),a=_(t);a.current=t,G(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=_(r);c.current=r;const u=_({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},G(()=>{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 oo(e,t){const[n,r]=J(e);return ro(n,e=>r(()=>e),t),[n,r]}export{fn as CancelButton,it as DocFavStar,Xe as EntityWindowFallback,Ue as EntityWindowLoading,Ve as EntityWindowState,on as MODAL_SUBMIT_SELECTOR,Xr as Modal,pn as ModalActions,We as UndoControls,eo as UndoProvider,be as WINDOW_REGISTRY,De as WindowCrashedFallback,Pe as WindowErrorBoundary,Nt as WindowManagerProvider,dn as WindowTitle,dt as activateWindowById,$t as beginWindowGesture,_n as cancelWindowFront,ke as client_default,Hr as commitExposeHighlight,Zn as confirmWindowDiscard,jt as drainPerfEvents,Pr as exitExposeMode,Sn as forgetMaximizedWindowBoxes,pt as getActiveWindowRoute,qr as getExposeHighlight,Qt as getWindowChromeVersion,Mn as getWindowPosition,_e as isDraftEntityId,Ge as isDraftEntityWindow,ye as isEntityEntry,we as isPageEntry,xe as isShellApiClientConfigured,Fe as isTabWindow,Ot as markMenuOpen,Gt as readWindowChrome,Yn as requestWindowFront,Br as setExposeHighlight,Rt as setPerfCollecting,Se as setShellHomeRoute,Ae as setShellTabStrip,ve as setShellWindowRegistry,Cn as setWindowDefaultPosition,Nn as setWindowPosition,Ut as splitTitle,Fr as subscribeExposeHighlight,Jt as subscribeWindowChrome,qe as tabGroupOf,Dr as toggleExposeMode,qn as useCurrentTabKey,mn as useEnclosingModalId,Nr as useIsActiveWindow,Ce as usePageSearch,to as useUndo,no as useUndoCanEdit,ro as useUndoable,oo as useUndoableState,ln as useWidgetSettings,et as useWindowDirty,nt as useWindowManager,un as useWindowMenuItem,hn as useWindowTitle,Vn as windowHoldsChanges};
@@ -0,0 +1 @@
1
+ var t={},e=new Proxy(t,{get:(e,r)=>t[r],has:(e,r)=>r in t,ownKeys:()=>Object.keys(t),getOwnPropertyDescriptor(e,r){if(r in t)return{configurable:!0,enumerable:!0,value:t[r]}}});function r(e){for(const e of Object.keys(t))delete t[e];Object.assign(t,e)}var n={},o=[],a={erp:[],system:[],virtual:[],footer:[]},u=42,i=240,s=6,c=49,d=6,l=200,h=420,m="react-os-shell:work-area-changed";function w(){const t=getComputedStyle(document.documentElement),e=parseInt(t.getPropertyValue("--taskbar-height"))||0,r=parseInt(t.getPropertyValue("--taskbar-width"))||0,n=t.getPropertyValue("--taskbar-position")?.trim()||"bottom",o=parseInt(t.getPropertyValue("--sidebar-width"))||0;return{x:("left"===n?r:0)+o,y:"top"===n?e:0,w:window.innerWidth-("left"===n||"right"===n?r:0)-o,h:window.innerHeight-("top"===n||"bottom"===n?e:0)}}function p(t,e,r){const n=r?e.w+280:e.w-280,o=Math.abs(t.w-e.w)<=4||Math.abs(t.w-n)<=4;return Math.abs(t.h-e.h)<=4&&o}function f({over:t,residual:e},r){return e<=1||t-e>=r-2}function y(t,e,r){let n=t;for(const o of r)f(o,e)&&(n=Math.max(n,t+o.over));return Math.ceil(n)}function g(t,e,r,n){const o=Math.min(e,r.w-2*n);if(o<=t.w+1)return t;const a=r.x+n,u=r.x+r.w-n-o,i=Math.min(Math.max(t.x-(o-t.w)/2,a),u);return{...t,x:Math.round(i),w:Math.round(o)}}function b(){return(parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width"))||0)>0}function M(){return"undefined"!=typeof document&&"sidebar"===getComputedStyle(document.documentElement).getPropertyValue("--layout-mode")?.trim()}export{s as RAIL_COLLAPSED_INSET,c as RAIL_COLLAPSED_W,h as RAIL_MAX_W,d as RAIL_MENU_GAP,l as RAIL_MIN_W,i as RAIL_W,u as TAB_STRIP_H,m as WORK_AREA_CHANGED_EVENT,p as boxFillsWorkArea,w as computeMaximizedBox,g as growBoxToWidth,b as isSidebarStripReserved,e as navIcons,o as navSections,M as readAlwaysMaximizedFlag,f as scrollerIsFluid,n as sectionIcons,r as setShellNavIcons,a as startMenuCategories,y as widthToFit};
@@ -0,0 +1 @@
1
+ var r="10.24.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1 +1 @@
1
- import{requestFilesTrashView as n}from"./chunk-E5QPXEKN.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
1
+ import{requestFilesTrashView as n}from"./chunk-JFBL4PR3.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
@@ -1,4 +1,4 @@
1
- import{InputNumber_default as e}from"./chunk-G7BBSHDF.js";import{IconButton_default as r}from"./chunk-LE5LWALR.js";import{Icon as a}from"./chunk-2UO47XB4.js";import{Tooltip as i}from"./chunk-NJN5IKWO.js";import{useShellStrings as n}from"./chunk-GDQJBQ5B.js";import{useState as l,useRef as o}from"react";import{jsxs as t,jsx as s}from"react/jsx-runtime";var d={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function u({label:u,value:m,corners:f,onChange:p,radius:h=null,onRadiusChange:v,radiusLabel:b,radiusMin:k=0,radiusMax:g,radiusStep:x=1,radiusPlaceholder:w,disabled:y=!1,disabledReason:j,id:A,className:N=""}){const B=n(),D=function(e){const r=c.map(r=>e.find(e=>e.value===r));for(const a of e){if(c.includes(a.value))continue;const e=r.findIndex(e=>void 0===e);-1===e?r.push(a):r[e]=a}return r.filter(e=>void 0!==e)}(f),[K,L]=l(0),R=o(null);/* @__PURE__ */
1
+ import{InputNumber_default as e}from"./chunk-QRU55BUS.js";import{IconButton_default as r}from"./chunk-LE5LWALR.js";import{Icon as a}from"./chunk-2UO47XB4.js";import{Tooltip as i}from"./chunk-NJN5IKWO.js";import{useShellStrings as n}from"./chunk-GDQJBQ5B.js";import{useState as l,useRef as o}from"react";import{jsxs as t,jsx as s}from"react/jsx-runtime";var d={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function u({label:u,value:m,corners:f,onChange:p,radius:h=null,onRadiusChange:v,radiusLabel:b,radiusMin:k=0,radiusMax:g,radiusStep:x=1,radiusPlaceholder:w,disabled:y=!1,disabledReason:j,id:A,className:N=""}){const R=n(),B=function(e){const r=c.map(r=>e.find(e=>e.value===r));for(const a of e){if(c.includes(a.value))continue;const e=r.findIndex(e=>void 0===e);-1===e?r.push(a):r[e]=a}return r.filter(e=>void 0!==e)}(f),[K,L]=l(0),C=o(null);/* @__PURE__ */
2
2
  return t("div",{id:A,role:"group","aria-label":u,className:`flex min-w-0 flex-wrap items-center gap-2 ${N}`.trim(),children:[v&&
3
- /* @__PURE__ */s("div",{className:"w-30 shrink-0",children:/* @__PURE__ */s(e,{value:h,onChange:v,min:k,max:g,step:x,precision:0,placeholder:w,prefix:/* @__PURE__ */s("span",{"data-radius-mark":"","aria-hidden":"true",children:B.corners.radiusMark}),suffix:B.corners.unit,steppers:"compact",disabled:y,"aria-label":b??B.corners.radius})}),
4
- /* @__PURE__ */s("div",{ref:R,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const r=Array.from(R.current?.querySelectorAll("button[data-corner]")??[]),a=r.indexOf(document.activeElement);if(-1===a)return;const i=a%2,n=Math.floor(a/2),l="ArrowRight"===e.key?2*n+1:"ArrowLeft"===e.key?2*n:"ArrowDown"===e.key?2+i:"ArrowUp"===e.key?i:null;null!==l&&(e.preventDefault(),l<r.length&&r[l].focus())},children:D.map((e,n)=>{const l=m.includes(e.value),o=y||!0===e.disabled,t=o&&(!0===e.disabled&&e.title||(y?j:void 0))||void 0,c=/* @__PURE__ */s(r,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":o||void 0,disabledReason:t,"data-corner":e.value,size:"sm",tabIndex:n===K?0:-1,onFocus:()=>L(n),onClick:()=>{o||p(l?m.filter(r=>r!==e.value):[...m,e.value])},children:/* @__PURE__ */s(a,{name:"corner",strokeWidth:2,className:["h-4 w-4",d[e.value]??""].filter(Boolean).join(" ")})},e.value);return t?c:/* @__PURE__ */s(i,{content:e.title??e.label,children:c},e.value)})})]})}export{u as CornersInput};
3
+ /* @__PURE__ */s("div",{className:"w-30 shrink-0",children:/* @__PURE__ */s(e,{value:h,onChange:v,min:k,max:g,step:x,precision:0,placeholder:w,prefix:/* @__PURE__ */s("span",{"data-radius-mark":"","aria-hidden":"true",children:R.corners.radiusMark}),suffix:R.corners.unit,steppers:"compact",disabled:y,"aria-label":b??R.corners.radius})}),
4
+ /* @__PURE__ */s("div",{ref:C,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const r=Array.from(C.current?.querySelectorAll("button[data-corner]")??[]),a=r.indexOf(document.activeElement);if(-1===a)return;const i=a%2,n=Math.floor(a/2),l="ArrowRight"===e.key?2*n+1:"ArrowLeft"===e.key?2*n:"ArrowDown"===e.key?2+i:"ArrowUp"===e.key?i:null;null!==l&&(e.preventDefault(),l<r.length&&r[l].focus())},children:B.map((e,n)=>{const l=m.includes(e.value),o=y||!0===e.disabled,t=o&&(!0===e.disabled&&e.title||(y?j:void 0))||void 0,c=/* @__PURE__ */s(r,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":o||void 0,disabledReason:t,"data-corner":e.value,size:"sm",tabIndex:n===K?0:-1,onFocus:()=>L(n),onClick:()=>{o||p(l?m.filter(r=>r!==e.value):[...m,e.value])},children:/* @__PURE__ */s(a,{name:"corner",strokeWidth:2,className:["h-4 w-4",d[e.value]??""].filter(Boolean).join(" ")})},e.value);return t?c:/* @__PURE__ */s(i,{content:e.title??e.label,children:c},e.value)})})]})}export{u as CornersInput};
@@ -1,4 +1,4 @@
1
- import{InputNumber_default as e}from"./chunk-G7BBSHDF.js";import{IconButton_default as a}from"./chunk-LE5LWALR.js";import{Icon as r}from"./chunk-2UO47XB4.js";import{Tooltip as i}from"./chunk-NJN5IKWO.js";import{jsx as t,jsxs as n,Fragment as o}from"react/jsx-runtime";var d="h-3.5 w-3.5",s={padding:{top:/* @__PURE__ */t(r,{name:"padding-top","aria-hidden":"true",className:d}),right:/* @__PURE__ */t(r,{name:"padding-right","aria-hidden":"true",className:d}),bottom:/* @__PURE__ */t(r,{name:"padding-bottom","aria-hidden":"true",className:d}),left:/* @__PURE__ */t(r,{name:"padding-left","aria-hidden":"true",className:d}),vertical:/* @__PURE__ */t(r,{name:"padding-y","aria-hidden":"true",className:d}),horizontal:/* @__PURE__ */t(r,{name:"padding-left-right","aria-hidden":"true",className:d})},crop:{top:/* @__PURE__ */t(r,{name:"crop-top","aria-hidden":"true",className:d}),right:/* @__PURE__ */t(r,{name:"crop-right","aria-hidden":"true",className:d}),bottom:/* @__PURE__ */t(r,{name:"crop-bottom","aria-hidden":"true",className:d}),left:/* @__PURE__ */t(r,{name:"crop-left","aria-hidden":"true",className:d}),vertical:/* @__PURE__ */t(r,{name:"crop-y","aria-hidden":"true",className:d}),horizontal:/* @__PURE__ */t(r,{name:"crop-left-right","aria-hidden":"true",className:d})}},l=/* @__PURE__ */t(r,{name:"sides-each","aria-hidden":"true",className:"h-4 w-4"});var m=(e,a,r)=>null===e[r]?a[r]:String(e[r]);function c(e,a){const r=r=>m(e,a,r);return r("left")!==r("right")||r("top")!==r("bottom")}function h({label:a,value:r,onChange:i,each:d,placeholder:l,words:c,min:h=0,max:p=200,step:u=4,readOnly:g,glyphs:f="padding"}){const N=s[f],b=(a,n,o)=>{const d=function(e,a){const r=a.map(a=>e[a]);return r.every(e=>e===r[0])?r[0]:"mixed"}(r,a),s=a.map(e=>m(r,l,e)),f="mixed"!==d&&s.every(e=>e===s[0])?s[0]:"–";/* @__PURE__ */
1
+ import{InputNumber_default as e}from"./chunk-QRU55BUS.js";import{IconButton_default as a}from"./chunk-LE5LWALR.js";import{Icon as r}from"./chunk-2UO47XB4.js";import{Tooltip as i}from"./chunk-NJN5IKWO.js";import{jsx as t,jsxs as n,Fragment as o}from"react/jsx-runtime";var d="h-3.5 w-3.5",s={padding:{top:/* @__PURE__ */t(r,{name:"padding-top","aria-hidden":"true",className:d}),right:/* @__PURE__ */t(r,{name:"padding-right","aria-hidden":"true",className:d}),bottom:/* @__PURE__ */t(r,{name:"padding-bottom","aria-hidden":"true",className:d}),left:/* @__PURE__ */t(r,{name:"padding-left","aria-hidden":"true",className:d}),vertical:/* @__PURE__ */t(r,{name:"padding-y","aria-hidden":"true",className:d}),horizontal:/* @__PURE__ */t(r,{name:"padding-left-right","aria-hidden":"true",className:d})},crop:{top:/* @__PURE__ */t(r,{name:"crop-top","aria-hidden":"true",className:d}),right:/* @__PURE__ */t(r,{name:"crop-right","aria-hidden":"true",className:d}),bottom:/* @__PURE__ */t(r,{name:"crop-bottom","aria-hidden":"true",className:d}),left:/* @__PURE__ */t(r,{name:"crop-left","aria-hidden":"true",className:d}),vertical:/* @__PURE__ */t(r,{name:"crop-y","aria-hidden":"true",className:d}),horizontal:/* @__PURE__ */t(r,{name:"crop-left-right","aria-hidden":"true",className:d})}},l=/* @__PURE__ */t(r,{name:"sides-each","aria-hidden":"true",className:"h-4 w-4"});var m=(e,a,r)=>null===e[r]?a[r]:String(e[r]);function c(e,a){const r=r=>m(e,a,r);return r("left")!==r("right")||r("top")!==r("bottom")}function h({label:a,value:r,onChange:i,each:d,placeholder:l,words:c,min:h=0,max:p=200,step:u=4,readOnly:g,glyphs:f="padding"}){const N=s[f],b=(a,n,o)=>{const d=function(e,a){const r=a.map(a=>e[a]);return r.every(e=>e===r[0])?r[0]:"mixed"}(r,a),s=a.map(e=>m(r,l,e)),f="mixed"!==d&&s.every(e=>e===s[0])?s[0]:"–";/* @__PURE__ */
2
2
  return t("div",{"data-side":a.join("-"),className:"min-w-0",children:/* @__PURE__ */t(e,{value:"mixed"===d?null:d,onChange:e=>((e,a)=>{const t={...r};for(const r of e)t[r]=a;i(t)})(a,e),min:h,max:p,step:u,snap:!0,precision:0,steppers:"compact",readOnly:g,placeholder:f,prefix:o,suffix:c.unit,"aria-label":n})})};/* @__PURE__ */
3
3
  return t("div",{role:"group","aria-label":a,"data-sides":d?"each":"pairs",className:"grid min-w-0 grid-cols-2 gap-2",children:/* @__PURE__ */n(o,d?{children:[b(["left"],c.sides.left,N.left),b(["top"],c.sides.top,N.top),b(["right"],c.sides.right,N.right),b(["bottom"],c.sides.bottom,N.bottom)]}:{children:[b(["left","right"],c.horizontal,N.horizontal),b(["top","bottom"],c.vertical,N.vertical)]})})}function p({each:e,onChange:r,label:n,disabled:o}){/* @__PURE__ */
4
4
  return t(i,{content:n,children:/* @__PURE__ */t(a,{size:"md","aria-label":n,"aria-pressed":e,disabled:o,onClick:()=>r(!e),children:l})})}export{p as SidesEachToggle,h as SidesInput,c as sidesStartEach};
@@ -1,4 +1,4 @@
1
- import{Segmented as e}from"./chunk-S4FPYCUU.js";import{ColorPicker as t}from"./chunk-XJPKDTQN.js";import{InputNumber_default as l}from"./chunk-G7BBSHDF.js";import{Icon as r}from"./chunk-2UO47XB4.js";import{jsxs as a,Fragment as o,jsx as i}from"react/jsx-runtime";var s=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */i(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */i(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */i(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */i(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */i(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */i(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */i(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */i(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:v=20,step:N=1,readOnly:x}){const S=e=>"number"==typeof d[e]?d[e]:null,j=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===S(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},k=(e,t,r,a,o,s)=>/* @__PURE__ */i("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */i(l,{value:a,onChange:s,min:g,max:v,step:N,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":t})}),C=n.map(S),O="number"==typeof d.width?d.width:C.every(e=>null!==e&&e===C[0])?C[0]:null,B=null===O&&C.some(e=>null!==e),U=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",z=e=>S(e)??("number"==typeof d.width?d.width:null),D=d.style??u.style;/* @__PURE__ */
2
- return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[k("left",b.sides.left,h.left,z("left"),String(u.sides.left),e=>j("left",e)),k("top",b.sides.top,h.top,z("top"),String(u.sides.top),e=>j("top",e)),k("right",b.sides.right,h.right,z("right"),String(u.sides.right),e=>j("right",e)),k("bottom",b.sides.bottom,h.bottom,z("bottom"),String(u.sides.bottom),e=>j("bottom",e))]}):k("all",b.width,h.all,O,B?"–":U,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */i("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */i(e,{block:!0,size:"sm",label:b.style,value:D,onChange:e=>{x||m({...d,style:e})},options:s.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
1
+ import{Segmented as e}from"./chunk-S4FPYCUU.js";import{ColorPicker as t}from"./chunk-BUO7XCYR.js";import{InputNumber_default as l}from"./chunk-QRU55BUS.js";import{Icon as r}from"./chunk-2UO47XB4.js";import{jsxs as a,Fragment as o,jsx as i}from"react/jsx-runtime";var s=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */i(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */i(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */i(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */i(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */i(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */i(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */i(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */i(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:v=20,step:N=1,readOnly:x}){const S=e=>"number"==typeof d[e]?d[e]:null,j=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===S(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},k=(e,t,r,a,o,s)=>/* @__PURE__ */i("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */i(l,{value:a,onChange:s,min:g,max:v,step:N,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":t})}),C=n.map(S),U="number"==typeof d.width?d.width:C.every(e=>null!==e&&e===C[0])?C[0]:null,O=null===U&&C.some(e=>null!==e),B=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",z=e=>S(e)??("number"==typeof d.width?d.width:null),R=d.style??u.style;/* @__PURE__ */
2
+ return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[k("left",b.sides.left,h.left,z("left"),String(u.sides.left),e=>j("left",e)),k("top",b.sides.top,h.top,z("top"),String(u.sides.top),e=>j("top",e)),k("right",b.sides.right,h.right,z("right"),String(u.sides.right),e=>j("right",e)),k("bottom",b.sides.bottom,h.bottom,z("bottom"),String(u.sides.bottom),e=>j("bottom",e))]}):k("all",b.width,h.all,U,O?"–":B,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */i("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */i(e,{block:!0,size:"sm",label:b.style,value:R,onChange:e=>{x||m({...d,style:e})},options:s.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
3
3
  /* @__PURE__ */i("span",{className:"sr-only",children:b.styles[e]})]}),title:b.styles[e]}))})}),
4
4
  /* @__PURE__ */i("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */i(t,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"md",disabled:x})})]})}export{s as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};
@@ -0,0 +1 @@
1
+ import{useModalActive as e,KEY_ACTIVATED_SELECTOR as r}from"./chunk-F3ZOO23R.js";import{useState as t,useRef as n,useEffect as c}from"react";function u(u,o,i,a,s,l){const[d,m]=t(-1),f=n(u),v=n(o),y=n(i),k=n(a),w=n(s),h=n(d),E=n(-1),g=e(),p=n(g),K=n(l),L=n(null);f.current=u,v.current=o,y.current=i,k.current=a,w.current=s,h.current=d,p.current=g,K.current=l;const x=n(void 0),N=e=>{clearTimeout(x.current),x.current=setTimeout(()=>m(e),0)};c(()=>()=>clearTimeout(x.current),[]);const T=n(u.length);return c(()=>{u.length!==T.current&&(clearTimeout(x.current),m(-1),E.current=-1,T.current=u.length)},[u.length]),c(()=>{let e=!1;const r=()=>{e=document.activeElement===L.current},t=r=>{const t=e&&r.target===L.current;e=!1,t||(L.current=null)},n=e=>{L.current?.contains(e.target)&&(L.current=null)};return window.addEventListener("blur",r),document.addEventListener("focusin",t,!0),document.addEventListener("mousedown",n,!0),()=>{window.removeEventListener("blur",r),document.removeEventListener("focusin",t,!0),document.removeEventListener("mousedown",n,!0)}},[]),c(()=>{const e=e=>{if(!p.current)return;if(e.shiftKey)return;const r=e.target,t=r?.closest?.("[data-row-idx]");if(!t)return;if("INPUT"!==r.tagName||"checkbox"!==r.type)return;const n=parseInt(t.getAttribute("data-row-idx"),10);isNaN(n)||(E.current=n,N(n))};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[]),c(()=>{const e=e=>{if(!p.current)return;const t=e.target?.tagName;if("INPUT"===t||"TEXTAREA"===t||"SELECT"===t)return;if(e.target?.isContentEditable)return;if((e.metaKey||e.ctrlKey)&&"a"===e.key)return e.preventDefault(),void k.current?.();if(e.metaKey||e.ctrlKey||e.altKey)return;const n=f.current.length;if(0===n)return;const c="KeyJ"===e.code||"j"===e.key||"J"===e.key||"ArrowDown"===e.key,u="KeyK"===e.code||"k"===e.key||"K"===e.key||"ArrowUp"===e.key,o=e.target?.closest?.(r)??null;if("Enter"!==e.key&&" "!==e.key||!o||o===L.current)if(c||u){L.current=o?.closest('[aria-modal="true"], [role="menu"]')||e.defaultPrevented&&e.key.startsWith("Arrow")?null:o,e.preventDefault();const r=h.current,t=c?Math.min(r+1,n-1):Math.max(r-1,0);t!==r&&(m(t),function(e,r){requestAnimationFrame(()=>{const t=r?r.current:document,n=t?.querySelector(`[data-row-idx="${e}"]`);n?.scrollIntoView({block:"nearest"})})}(t,K.current),e.shiftKey&&y.current&&(y.current(f.current[t]),E.current=t))}else if("Enter"===e.key&&h.current>=0&&h.current<n)e.preventDefault(),v.current(f.current[h.current]);else if(" "===e.key&&h.current>=0&&h.current<n){if(e.preventDefault(),e.shiftKey&&E.current>=0&&w.current){const e=Math.min(E.current,h.current),r=Math.max(E.current,h.current);w.current(e,r)}else y.current?.(f.current[h.current]);E.current=h.current}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),c(()=>{const e=e=>{if(!p.current)return;if(!e.shiftKey)return;const r=e.target,t=r?.closest?.("[data-row-idx]");if(!t)return;const n=parseInt(t.getAttribute("data-row-idx"),10);if(isNaN(n))return;const c="INPUT"===r.tagName&&"checkbox"===r.type?r:null,u=E.current;if(u<0){if(c)return E.current=n,void N(n);y.current?.(f.current[n])}else{const e=Math.min(u,n),r=Math.max(u,n);if(w.current)w.current(e,r),c&&(c.checked=!0);else if(y.current)for(let t=e;t<=r;t++)y.current(f.current[t])}c||e.preventDefault(),e.stopPropagation(),E.current=n,m(n)};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[]),d}export{u as useTableNav};
@@ -1,15 +1,15 @@
1
- import{Popover as e}from"./chunk-7JGR7WPD.js";import{InputNumber_default as r}from"./chunk-G7BBSHDF.js";import{parseHexColor as a,hexToHsv as n,hsvToHex as o,hexReadout as t,HUE_GRADIENT as l,HEX_MAX_LENGTH as i,svFromPoint as s,hueFromPoint as c}from"./chunk-S6OB6HJB.js";import{inputClasses as u}from"./chunk-AYZY3YNC.js";import{Tooltip as d}from"./chunk-NJN5IKWO.js";import{useShellStrings as h}from"./chunk-GDQJBQ5B.js";import{forwardRef as g,useState as p,useRef as b,useEffect as m,useId as f}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var x={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},y={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function k(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function N(e,r){if(!e)return y;const a=k(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`}}function C({size:e="md",selected:r=!1,className:a=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",r?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",x[e],a].filter(Boolean).join(" ")}var $=g(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
2
- return v("button",{ref:l,type:o,"aria-pressed":a,className:C({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),z=(e,r,a)=>Math.min(a,Math.max(r,e)),D=e=>"string"==typeof e?{value:e}:e;function I(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:z(e.s+o[0],0,1),v:z(e.v+o[1],0,1)}:null}function A(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,359);case"ArrowRight":case"ArrowUp":return z(e+n,0,359);case"PageDown":return z(e-10,0,359);case"PageUp":return z(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var P={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function M(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,100);case"ArrowRight":case"ArrowUp":return z(e+n,0,100);case"PageDown":return z(e-10,0,100);case"PageUp":return z(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function B({value:e,onChange:r,label:i,presets:u,clearable:g=!1,fallback:f,dragWrites:x="live",disabled:C=!1,opacity:z,onOpacityChange:B,onClose:j,id:S,className:K=""}){const R=h().color,U=k(z),H=e=>{const r=k(e);C||r===U||B?.(r)},L=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:U},W=a(f??""),[E,J]=p(()=>n(e||W||"")),Y=b(e);m(()=>{e!==Y.current&&(Y.current=e,e?J(n(e)):W&&J(n(W)))},[e]);const q=a=>{C||a===e||(Y.current=a,r(a))},G=e=>{const r=a(e);r&&(J(n(r)),q(r))},X=e=>{J(e),q(o(e))},[F,Q]=p(!1),V=b(E);V.current=E;const Z=e=>({onPointerDown:r=>{if(C||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,V.current);"end"===x?(Q(!0),J(a)):X(a)},onPointerMove:r=>{if(C||!(1&r.buttons))return;const a=e(r,V.current);"end"===x?J(a):X(a)},onPointerUp:r=>{"end"===x&&F&&(Q(!1),X(e(r,V.current)))}}),_=Z((e,r)=>({...r,...s(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),ee=Z((e,r)=>({...r,h:c(e.clientX,e.currentTarget.getBoundingClientRect())})),re=F?o(E):e,ae=e=>`${Math.round(100*e)}%`,ne=(u??[]).map(D),oe=a(e),te=re||W||"";/* @__PURE__ */
3
- return w("div",{id:S,className:`flex w-56 flex-col gap-3 ${C?"opacity-60":""} ${K}`.trim(),onKeyDown:e=>{"Escape"===e.key&&j&&(e.preventDefault(),e.stopPropagation(),j())},children:[(ne.length>0||g)&&/* @__PURE__ */w("div",{role:"group","aria-label":R.presets,className:"flex flex-wrap gap-2",children:[g&&/* @__PURE__ */v(d,{content:R.clear,children:/* @__PURE__ */v($,{color:"",size:"sm","aria-label":R.clear,selected:""===e,disabled:C,onClick:()=>{C||""===e||(Y.current="",r(""))}})}),ne.map(e=>{const r=a(e.value),n=e.label?`${e.label} · ${t(r??e.value)}`:t(r??e.value);/* @__PURE__ */
4
- return v(d,{content:n,children:/* @__PURE__ */v($,{color:r??e.value,size:"sm","aria-label":n,selected:null!==r&&r===oe,disabled:C,onClick:()=>G(e.value)})},`${e.label??""}:${e.value}`)})]}),
5
- /* @__PURE__ */v("div",{role:"slider",tabIndex:C?-1:0,"aria-label":R.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*E.v),"aria-valuetext":R.squareValue(Math.round(100*E.s),Math.round(100*E.v)),"aria-disabled":C||void 0,"data-color-square":"",onKeyDown:e=>{if(C)return;const r=I(E,e.key,e.shiftKey);r&&(e.preventDefault(),X(r))},..._,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:o({h:E.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:ae(E.s),top:ae(1-E.v),...P}})}),
6
- /* @__PURE__ */v("div",{role:"slider",tabIndex:C?-1:0,"aria-label":R.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(E.h),"aria-orientation":"horizontal","aria-disabled":C||void 0,"data-color-hue":"",onKeyDown:e=>{if(C)return;const r=A(E.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),X({...E,h:r}))},...ee,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:l},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:E.h/360*100+"%",background:o({h:E.h,s:1,v:1}),...P}})}),B&&/* @__PURE__ */v("div",{role:"slider",tabIndex:C?-1:0,"aria-label":R.opacity(i),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":U,"aria-valuetext":`${U}%`,"aria-orientation":"horizontal","aria-disabled":C||void 0,"data-color-opacity":"",onKeyDown:e=>{if(C)return;const r=M(U,e.key,e.shiftKey);null!==r&&(e.preventDefault(),H(r))},onPointerDown:e=>{C||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),H(L(e)))},onPointerMove:e=>{!C&&1&e.buttons&&H(L(e))},className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:`linear-gradient(to right, transparent, ${te||"black"}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:`${U}%`,...N(te||"black",U),...P}})}),
1
+ import{Popover as e}from"./chunk-7JGR7WPD.js";import{InputNumber_default as r}from"./chunk-QRU55BUS.js";import{parseHexColor as a,hexToHsv as n,hsvToHex as o,hexReadout as t,HUE_GRADIENT as l,HEX_MAX_LENGTH as i,svFromPoint as s,hueFromPoint as c}from"./chunk-S6OB6HJB.js";import{inputClasses as u}from"./chunk-AYZY3YNC.js";import{Tooltip as d}from"./chunk-NJN5IKWO.js";import{useShellStrings as h}from"./chunk-GDQJBQ5B.js";import{forwardRef as g,useState as p,useRef as b,useEffect as m,useId as f}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var x={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},y={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function k(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function N(e,r){if(!e)return y;const a=k(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`}}function C({size:e="md",selected:r=!1,className:a=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",r?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",x[e],a].filter(Boolean).join(" ")}var $=g(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
2
+ return v("button",{ref:l,type:o,"aria-pressed":a,className:C({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),z=(e,r,a)=>Math.min(a,Math.max(r,e)),D=e=>"string"==typeof e?{value:e}:e;function I(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:z(e.s+o[0],0,1),v:z(e.v+o[1],0,1)}:null}function A(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,359);case"ArrowRight":case"ArrowUp":return z(e+n,0,359);case"PageDown":return z(e-10,0,359);case"PageUp":return z(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var P={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function M(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,100);case"ArrowRight":case"ArrowUp":return z(e+n,0,100);case"PageDown":return z(e-10,0,100);case"PageUp":return z(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function j({value:e,onChange:r,label:i,presets:u,clearable:g=!1,fallback:f,dragWrites:x="live",disabled:C=!1,opacity:z,onOpacityChange:j,onClose:B,id:S,className:K=""}){const U=h().color,O=k(z),L=e=>{const r=k(e);C||r===O||j?.(r)},W=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:O},E=a(f??""),[H,J]=p(()=>n(e||E||"")),Y=b(e);m(()=>{e!==Y.current&&(Y.current=e,e?J(n(e)):E&&J(n(E)))},[e]);const q=a=>{C||a===e||(Y.current=a,r(a))},Q=e=>{const r=a(e);r&&(J(n(r)),q(r))},X=e=>{J(e),q(o(e))},[G,F]=p(!1),V=b(H);V.current=H;const Z=e=>({onPointerDown:r=>{if(C||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,V.current);"end"===x?(F(!0),J(a)):X(a)},onPointerMove:r=>{if(C||!(1&r.buttons))return;const a=e(r,V.current);"end"===x?J(a):X(a)},onPointerUp:r=>{"end"===x&&G&&(F(!1),X(e(r,V.current)))}}),_=Z((e,r)=>({...r,...s(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),ee=Z((e,r)=>({...r,h:c(e.clientX,e.currentTarget.getBoundingClientRect())})),re=G?o(H):e,ae=e=>`${Math.round(100*e)}%`,ne=(u??[]).map(D),oe=a(e),te=re||E||"";/* @__PURE__ */
3
+ return w("div",{id:S,className:`flex w-56 flex-col gap-3 ${C?"opacity-60":""} ${K}`.trim(),onKeyDown:e=>{"Escape"===e.key&&B&&(e.preventDefault(),e.stopPropagation(),B())},children:[(ne.length>0||g)&&/* @__PURE__ */w("div",{role:"group","aria-label":U.presets,className:"flex flex-wrap gap-2",children:[g&&/* @__PURE__ */v(d,{content:U.clear,children:/* @__PURE__ */v($,{color:"",size:"sm","aria-label":U.clear,selected:""===e,disabled:C,onClick:()=>{C||""===e||(Y.current="",r(""))}})}),ne.map(e=>{const r=a(e.value),n=e.label?`${e.label} · ${t(r??e.value)}`:t(r??e.value);/* @__PURE__ */
4
+ return v(d,{content:n,children:/* @__PURE__ */v($,{color:r??e.value,size:"sm","aria-label":n,selected:null!==r&&r===oe,disabled:C,onClick:()=>Q(e.value)})},`${e.label??""}:${e.value}`)})]}),
5
+ /* @__PURE__ */v("div",{role:"slider",tabIndex:C?-1:0,"aria-label":U.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*H.v),"aria-valuetext":U.squareValue(Math.round(100*H.s),Math.round(100*H.v)),"aria-disabled":C||void 0,"data-color-square":"",onKeyDown:e=>{if(C)return;const r=I(H,e.key,e.shiftKey);r&&(e.preventDefault(),X(r))},..._,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:o({h:H.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:ae(H.s),top:ae(1-H.v),...P}})}),
6
+ /* @__PURE__ */v("div",{role:"slider",tabIndex:C?-1:0,"aria-label":U.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(H.h),"aria-orientation":"horizontal","aria-disabled":C||void 0,"data-color-hue":"",onKeyDown:e=>{if(C)return;const r=A(H.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),X({...H,h:r}))},...ee,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:l},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:H.h/360*100+"%",background:o({h:H.h,s:1,v:1}),...P}})}),j&&/* @__PURE__ */v("div",{role:"slider",tabIndex:C?-1:0,"aria-label":U.opacity(i),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":O,"aria-valuetext":`${O}%`,"aria-orientation":"horizontal","aria-disabled":C||void 0,"data-color-opacity":"",onKeyDown:e=>{if(C)return;const r=M(O,e.key,e.shiftKey);null!==r&&(e.preventDefault(),L(r))},onPointerDown:e=>{C||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),L(W(e)))},onPointerMove:e=>{!C&&1&e.buttons&&L(W(e))},className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:`linear-gradient(to right, transparent, ${te||"black"}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:`${O}%`,...N(te||"black",O),...P}})}),
7
7
  /* @__PURE__ */w("div",{className:"flex items-center gap-2",children:[
8
- /* @__PURE__ */v("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-line-strong",style:N(te,B?U:null)}),
9
- /* @__PURE__ */v(T,{value:re,placeholder:!e&&W?t(W):void 0,onChange:G,label:R.hex(i),disabled:C}),B&&/* @__PURE__ */v(O,{value:U,onChange:H,label:R.opacity(i),disabled:C})]})]})}var j={sm:"w-[calc(7ch+1rem+4px)] min-w-[calc(7ch+1rem+4px)]",md:"w-[calc(7ch+1.5rem+4px)] min-w-[calc(7ch+1.5rem+4px)]",lg:"w-[calc(7ch+2rem+4px)] min-w-[calc(7ch+2rem+4px)]"},S={sm:"h-6",md:"h-8",lg:"h-10"},K=["block w-[calc(7ch+0.5rem+4px)] min-w-[calc(7ch+0.5rem+4px)] flex-none rounded-(--radius-control)","border border-transparent bg-transparent px-1 text-2xs font-mono uppercase","text-ink-strong placeholder:text-[color:var(--ink-placeholder)] hover:border-gray-300","focus:border-blue-400 focus:bg-(--surface) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)]","disabled:cursor-not-allowed disabled:opacity-60"].join(" ");function T({value:e,onChange:r,label:n,placeholder:o,disabled:l,id:s,size:c="md",look:d="box",className:h=""}){const[g,b]=p(null),m="text"===d?`${K} ${S[c]} ${h}`.trim():u({size:c,className:`${j[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
10
- return v("input",{id:s,type:"text",value:g??(e?t(e):""),"aria-label":n,placeholder:o,maxLength:i,spellCheck:!1,autoComplete:"off",disabled:l,onChange:n=>{b(n.target.value);const o=a(n.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),b(null))},onBlur:()=>b(null),"data-hex-look":d,className:m})}function O({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
11
- return v("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */v(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function R({value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:g=!1,opacity:p,onOpacityChange:b,size:m="md",align:x="start",open:y,onOpenChange:$,className:z=""}){const D=h().color,I=k(p),A=f(),P=a(s??""),M=r||P||"",j=r?t(r):P?t(P):D.none;
8
+ /* @__PURE__ */v("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-line-strong",style:N(te,j?O:null)}),
9
+ /* @__PURE__ */v(R,{value:re,placeholder:!e&&E?t(E):void 0,onChange:Q,label:U.hex(i),disabled:C}),j&&/* @__PURE__ */v(T,{value:O,onChange:L,label:U.opacity(i),disabled:C})]})]})}var B={sm:"w-[calc(7ch+1rem+4px)] min-w-[calc(7ch+1rem+4px)]",md:"w-[calc(7ch+1.5rem+4px)] min-w-[calc(7ch+1.5rem+4px)]",lg:"w-[calc(7ch+2rem+4px)] min-w-[calc(7ch+2rem+4px)]"},S={sm:"h-6",md:"h-8",lg:"h-10"},K=["block w-[calc(7ch+0.5rem+4px)] min-w-[calc(7ch+0.5rem+4px)] flex-none rounded-(--radius-control)","border border-transparent bg-transparent px-1 text-2xs font-mono uppercase","text-ink-strong placeholder:text-[color:var(--ink-placeholder)] hover:border-gray-300","focus:border-blue-400 focus:bg-(--surface) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)]","disabled:cursor-not-allowed disabled:opacity-60"].join(" ");function R({value:e,onChange:r,label:n,placeholder:o,disabled:l,id:s,size:c="md",look:d="box",className:h=""}){const[g,b]=p(null),m="text"===d?`${K} ${S[c]} ${h}`.trim():u({size:c,className:`${B[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
10
+ return v("input",{id:s,type:"text",value:g??(e?t(e):""),"aria-label":n,placeholder:o,maxLength:i,spellCheck:!1,autoComplete:"off",disabled:l,onChange:n=>{b(n.target.value);const o=a(n.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),b(null))},onBlur:()=>b(null),"data-hex-look":d,className:m})}function T({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
11
+ return v("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */v(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function U({value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:g=!1,opacity:p,onOpacityChange:b,size:m="md",align:x="start",open:y,onOpenChange:$,className:z=""}){const D=h().color,I=k(p),A=f(),P=a(s??""),M=r||P||"",B=r?t(r):P?t(P):D.none;
12
12
  /* @__PURE__ */
13
13
  return w("div",{className:`inline-flex items-center ${b?"flex-wrap justify-end gap-1":g?"gap-1":"gap-2"} ${z}`.trim(),children:[
14
- /* @__PURE__ */v(e,{id:d,trigger:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(M,b?I:null)}),triggerLabel:D.swatch(o,j),triggerClassName:C({size:m}),"aria-label":D.panel(o),align:x,open:y,onOpenChange:$,disabled:u,children:/* @__PURE__ */v(B,{id:A,value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),g&&
15
- /* @__PURE__ */v(T,{value:r,placeholder:!r&&P?t(P):void 0,onChange:e=>{u||e===r||n(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */v(O,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{R as ColorPicker,B as ColorPickerPanel,$ as ColorSwatch,T as HexInput,y as NO_COLOR_FILL,k as clampOpacity,N as colorFill,C as colorSwatchClasses,A as stepHue,M as stepOpacity,I as stepSquare};
14
+ /* @__PURE__ */v(e,{id:d,trigger:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(M,b?I:null)}),triggerLabel:D.swatch(o,B),triggerClassName:C({size:m}),"aria-label":D.panel(o),align:x,open:y,onOpenChange:$,disabled:u,children:/* @__PURE__ */v(j,{id:A,value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),g&&
15
+ /* @__PURE__ */v(R,{value:r,placeholder:!r&&P?t(P):void 0,onChange:e=>{u||e===r||n(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */v(T,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{U as ColorPicker,j as ColorPickerPanel,$ as ColorSwatch,R as HexInput,y as NO_COLOR_FILL,k as clampOpacity,N as colorFill,C as colorSwatchClasses,A as stepHue,M as stepOpacity,I as stepSquare};
@@ -1,6 +1,6 @@
1
- import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-G7BBSHDF.js";import{Tooltip as i}from"./chunk-NJN5IKWO.js";import{useShellStrings as l}from"./chunk-GDQJBQ5B.js";import{useId as a,useRef as s,useState as c,useEffect as u,Fragment as d}from"react";import{jsxs as h,jsx as f}from"react/jsx-runtime";var m=(e,t,r)=>Math.min(r,Math.max(t,e)),p=e=>e.reduce((e,t)=>e+t,0),v=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var g,b="w-0.5",y=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var w=["text-blue-700","text-gray-600"];function x({count:x,value:$,onChange:k,label:C,"aria-labelledby":N,readOnly:P=!1,disabled:B=!1,className:M=""}){const j=l().widths,R=a(),z=m(Math.round(x)||1,1,n),D=e($,z),S=D??[...t[z]??[]],A=[...S,100-p(S)],K=P||B,O=s(null),T=s({onChange:k,shown:S,locked:K,n:z,stored:D});T.current={onChange:k,shown:S,locked:K,n:z,stored:D};const E=t=>{const{onChange:r,shown:n,locked:o,n:i}=T.current;if(o)return!1;const l=e(t,i);return!(!l||v(l,n))&&(r(l),!0)},G=(e,t,n)=>{const o=e[t]+e[t+1],i=[...e];i[t]=m(Math.round(n),r,o-r),i[t+1]=o-i[t],E(i.slice(0,-1))&&(ne.current=null)},H=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const n=t.shiftKey?10:1,o=A[e]+A[e+1],i="ArrowRight"===t.key?A[e]+n:"ArrowLeft"===t.key?A[e]-n:"PageUp"===t.key?A[e]+10:"PageDown"===t.key?A[e]-10:"Home"===t.key?r:"End"===t.key?o-r:null;null!==i&&(t.preventDefault(),G(A,e,i))},I=s(null),[F,J]=c(null),L=()=>{I.current=null,J(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};u(()=>L,[]);const W=e=>t=>{if(0!==t.button||K)return;t.preventDefault();const r=O.current?.getBoundingClientRect().width??0;r<=0||(I.current={i:e,x:t.clientX,width:r,from:A,moved:!1,pointer:t.pointerId},J(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},Q=e=>{const t=I.current;if(!t)return;if(0===e.buttons)return void L();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}G(t.from,t.i,t.from[t.i]+r/t.width*100)},U=e=>{const t=I.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),L())},X=(e,t)=>{const{shown:n}=T.current,o=function(e,t,n){const o=e.length,i=[...e];if(o<2)return i;const l=m(Math.round(n),r,100-(o-1)*r);let a=l-i[t];i[t]=l;const s=[...Array.from({length:o-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(a<0)return i[s[0]]-=a,i;for(const e of s){if(a<=0)break;const t=Math.min(a,i[e]-r);i[e]-=t,a-=t}return i}([...n,100-p(n)],e,t);return E(o.slice(0,-1))?o:null},[q,V]=c(0);u(()=>{const e=O.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>V(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const Y=s(null),[Z,_]=c(null),[ee,te]=c([]),re=(e,t)=>_(r=>t?e:r===e?null:r),ne=s(null),oe=(e,t)=>{const r=ne.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:o,stored:i}=T.current;var l,a;return o||(l=i,a=r.stored,void 0===l||void 0===a?l===a:v(l,a))||n(r.stored),!0},ie=A.join(",");u(()=>{const e=null===Z?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===g&&(g=document.createElement("canvas").getContext("2d")),!g)return[];const o=g;return r.flatMap((e,r)=>{if(r===t)return[];const i=e.getBoundingClientRect(),l=getComputedStyle(e);o.font=`${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;const a=o.measureText(e.value).width/2,s=(i.left+i.right)/2;return s+a>n.left&&s-a<n.right?[r]:[]})}(Y.current,Z);te(t=>v(t,e)?t:e)},[Z,ie,q]);const le=j.hint(z,r),ae=A.slice(0,-1).map((e,t)=>p(A.slice(0,t+1)));/* @__PURE__ */
2
- return h("div",{role:"group","aria-label":N?void 0:C,"aria-labelledby":N,"aria-describedby":z>1?R:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${B?"opacity-60":""} ${M}`.trim(),children:[
1
+ import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-QRU55BUS.js";import{Tooltip as i}from"./chunk-NJN5IKWO.js";import{useShellStrings as l}from"./chunk-GDQJBQ5B.js";import{useId as a,useRef as s,useState as c,useEffect as u,Fragment as d}from"react";import{jsxs as h,jsx as f}from"react/jsx-runtime";var m=(e,t,r)=>Math.min(r,Math.max(t,e)),p=e=>e.reduce((e,t)=>e+t,0),v=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var g,b="w-0.5",y=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var w=["text-blue-700","text-gray-600"];function x({count:x,value:$,onChange:k,label:C,"aria-labelledby":N,readOnly:P=!1,disabled:B=!1,className:M=""}){const R=l().widths,j=a(),z=m(Math.round(x)||1,1,n),S=e($,z),A=S??[...t[z]??[]],D=[...A,100-p(A)],K=P||B,O=s(null),T=s({onChange:k,shown:A,locked:K,n:z,stored:S});T.current={onChange:k,shown:A,locked:K,n:z,stored:S};const E=t=>{const{onChange:r,shown:n,locked:o,n:i}=T.current;if(o)return!1;const l=e(t,i);return!(!l||v(l,n))&&(r(l),!0)},I=(e,t,n)=>{const o=e[t]+e[t+1],i=[...e];i[t]=m(Math.round(n),r,o-r),i[t+1]=o-i[t],E(i.slice(0,-1))&&(ne.current=null)},U=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const n=t.shiftKey?10:1,o=D[e]+D[e+1],i="ArrowRight"===t.key?D[e]+n:"ArrowLeft"===t.key?D[e]-n:"PageUp"===t.key?D[e]+10:"PageDown"===t.key?D[e]-10:"Home"===t.key?r:"End"===t.key?o-r:null;null!==i&&(t.preventDefault(),I(D,e,i))},G=s(null),[H,J]=c(null),L=()=>{G.current=null,J(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};u(()=>L,[]);const Q=e=>t=>{if(0!==t.button||K)return;t.preventDefault();const r=O.current?.getBoundingClientRect().width??0;r<=0||(G.current={i:e,x:t.clientX,width:r,from:D,moved:!1,pointer:t.pointerId},J(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},W=e=>{const t=G.current;if(!t)return;if(0===e.buttons)return void L();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}I(t.from,t.i,t.from[t.i]+r/t.width*100)},F=e=>{const t=G.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),L())},X=(e,t)=>{const{shown:n}=T.current,o=function(e,t,n){const o=e.length,i=[...e];if(o<2)return i;const l=m(Math.round(n),r,100-(o-1)*r);let a=l-i[t];i[t]=l;const s=[...Array.from({length:o-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(a<0)return i[s[0]]-=a,i;for(const e of s){if(a<=0)break;const t=Math.min(a,i[e]-r);i[e]-=t,a-=t}return i}([...n,100-p(n)],e,t);return E(o.slice(0,-1))?o:null},[q,V]=c(0);u(()=>{const e=O.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>V(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const Y=s(null),[Z,_]=c(null),[ee,te]=c([]),re=(e,t)=>_(r=>t?e:r===e?null:r),ne=s(null),oe=(e,t)=>{const r=ne.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:o,stored:i}=T.current;var l,a;return o||(l=i,a=r.stored,void 0===l||void 0===a?l===a:v(l,a))||n(r.stored),!0},ie=D.join(",");u(()=>{const e=null===Z?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===g&&(g=document.createElement("canvas").getContext("2d")),!g)return[];const o=g;return r.flatMap((e,r)=>{if(r===t)return[];const i=e.getBoundingClientRect(),l=getComputedStyle(e);o.font=`${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;const a=o.measureText(e.value).width/2,s=(i.left+i.right)/2;return s+a>n.left&&s-a<n.right?[r]:[]})}(Y.current,Z);te(t=>v(t,e)?t:e)},[Z,ie,q]);const le=R.hint(z,r),ae=D.slice(0,-1).map((e,t)=>p(D.slice(0,t+1)));/* @__PURE__ */
2
+ return h("div",{role:"group","aria-label":N?void 0:C,"aria-labelledby":N,"aria-describedby":z>1?j:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${B?"opacity-60":""} ${M}`.trim(),children:[
3
3
  /* @__PURE__ */h("div",{ref:Y,"data-widths-bar":"",className:"relative h-8",children:[
4
- /* @__PURE__ */f("div",{ref:O,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-surface",children:A.map((e,t)=>/* @__PURE__ */f("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${w[t%2]} ${t%2==0?"bg-accent-tint":""}`,children:1===z&&/* @__PURE__ */f("span",{"data-widths-label":"",children:`${e}%`})},t))}),
5
- /* @__PURE__ */f("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-line-strong"}),z>1&&A.map((e,t)=>/* @__PURE__ */h(d,{children:[(()=>{const n=Z===t,l=p(A.slice(0,t)),a=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
6
- return f("div",{"data-widths-tip":"",className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${l+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */f(i,{content:le,delay:600,describe:!1,className:"absolute inset-0",children:/* @__PURE__ */f(o,{appearance:"bare",value:e,display:()=>(e=>q>0&&q*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(z-1)*r,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:P,disabled:B,"aria-label":j.column(t+1),"aria-describedby":R,"data-widths-label":"",onChange:e=>{null===e||oe(t,e)||X(t,e)},onRevert:e=>((e,t)=>{T.current.locked||null===t||oe(e,t)||X(e,t)})(t,e),onFocus:()=>{ne.current={column:t,share:e,stored:T.current.stored},re(t,!0)},onBlur:()=>re(t,!1),className:`absolute inset-0 text-xs font-medium ${w[t%2]} ${ee.includes(t)&&!n?"opacity-0":""}`})})})})(),t<z-1&&/* @__PURE__ */f("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${ae[t]}%`},children:/* @__PURE__ */f(i,{content:j.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */f("div",{role:"separator",tabIndex:B?-1:0,"aria-orientation":"vertical","aria-label":j.divider(t+1,t+2),"aria-valuenow":A[t],"aria-valuemin":r,"aria-valuemax":A[t]+A[t+1]-r,"aria-valuetext":j.dividerValue(t+1,A[t],t+2,A[t+1]),"aria-disabled":K||void 0,onKeyDown:K?void 0:H(t),onPointerDown:W(t),onPointerMove:Q,onPointerUp:U,onPointerCancel:U,onLostPointerCapture:()=>{I.current&&L()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(K?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */f("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(K?`${b} bg-gray-300`:`bg-accent-fill transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${F===t?"w-1":y}`)})})})})]},t))]}),z>1&&/* @__PURE__ */f("span",{id:R,className:"sr-only",children:le})]})}export{x as WidthsBar};
4
+ /* @__PURE__ */f("div",{ref:O,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-surface",children:D.map((e,t)=>/* @__PURE__ */f("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${w[t%2]} ${t%2==0?"bg-accent-tint":""}`,children:1===z&&/* @__PURE__ */f("span",{"data-widths-label":"",children:`${e}%`})},t))}),
5
+ /* @__PURE__ */f("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-line-strong"}),z>1&&D.map((e,t)=>/* @__PURE__ */h(d,{children:[(()=>{const n=Z===t,l=p(D.slice(0,t)),a=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
6
+ return f("div",{"data-widths-tip":"",className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${l+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */f(i,{content:le,delay:600,describe:!1,className:"absolute inset-0",children:/* @__PURE__ */f(o,{appearance:"bare",value:e,display:()=>(e=>q>0&&q*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(z-1)*r,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:P,disabled:B,"aria-label":R.column(t+1),"aria-describedby":j,"data-widths-label":"",onChange:e=>{null===e||oe(t,e)||X(t,e)},onRevert:e=>((e,t)=>{T.current.locked||null===t||oe(e,t)||X(e,t)})(t,e),onFocus:()=>{ne.current={column:t,share:e,stored:T.current.stored},re(t,!0)},onBlur:()=>re(t,!1),className:`absolute inset-0 text-xs font-medium ${w[t%2]} ${ee.includes(t)&&!n?"opacity-0":""}`})})})})(),t<z-1&&/* @__PURE__ */f("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${ae[t]}%`},children:/* @__PURE__ */f(i,{content:R.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */f("div",{role:"separator",tabIndex:B?-1:0,"aria-orientation":"vertical","aria-label":R.divider(t+1,t+2),"aria-valuenow":D[t],"aria-valuemin":r,"aria-valuemax":D[t]+D[t+1]-r,"aria-valuetext":R.dividerValue(t+1,D[t],t+2,D[t+1]),"aria-disabled":K||void 0,onKeyDown:K?void 0:U(t),onPointerDown:Q(t),onPointerMove:W,onPointerUp:F,onPointerCancel:F,onLostPointerCapture:()=>{G.current&&L()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(K?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */f("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(K?`${b} bg-gray-300`:`bg-accent-fill transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${H===t?"w-1":y}`)})})})})]},t))]}),z>1&&/* @__PURE__ */f("span",{id:j,className:"sr-only",children:le})]})}export{x as WidthsBar};
@@ -0,0 +1 @@
1
+ import{useDefaultColumnConfig as t}from"./chunk-ULJQYXHB.js";import{useShellPrefs as e}from"./chunk-KC3EX26K.js";import{useState as i,useRef as r,useEffect as o}from"react";function c(t){const e=t;return!!e&&"string"==typeof e.field&&e.field.length>0&&("asc"===e.direction||"desc"===e.direction)}function n(n,s="asc",f,d){const{prefs:l,save:a}=e(),u=f?`sort_${f}`:null,[g,m]=i(()=>{if(u){if(c(l[u]))return l[u];try{const t=JSON.parse(localStorage.getItem(`sort-config-${f}`)||"null");if(c(t))return t}catch{}}return{field:n,direction:s}}),y=r(!1),S=u?l[u]:void 0,h=r(S);h.current=S,o(()=>{if(!y.current&&c(S)){m(t=>t.field===S.field&&t.direction===S.direction?t:S);try{localStorage.setItem(`sort-config-${f}`,JSON.stringify(S))}catch{}}},[f,S?.field,S?.direction]);const{defaultConfig:p}=t(f);o(()=>{const t=p?.sort;if(!y.current&&!c(h.current)&&c(t)){m(e=>e.field===t.field&&e.direction===t.direction?e:t);try{localStorage.setItem(`sort-config-${f}`,JSON.stringify(t))}catch{}}},[f,p]);const $=d?.columns?.length?d.columns:void 0,J=!$||function(t,e){return t.some(t=>(t.sortField??("_select"!==t.key?t.key:""))===e&&""!==e)}($,g.field)?g:{field:n,direction:s},k="desc"===J.direction?`-${J.field}`:J.field;return{sort:J,onSort:t=>{y.current=!0;const e=J.field===t?{field:t,direction:"asc"===J.direction?"desc":"asc"}:{field:t,direction:"asc"};if(m(e),u){try{localStorage.setItem(`sort-config-${f}`,JSON.stringify(e))}catch{}a({[u]:e})}},ordering:k}}export{n as useSort};