efficient-shell 8.38.0 → 8.40.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 (111) hide show
  1. package/README.md +2 -2
  2. package/dist/{Browser-5TOAZTHJ.js → Browser-SZB3KYL2.js} +14 -14
  3. package/dist/Calculator-MNTQSI6M.js +29 -0
  4. package/dist/{CurrencyConverter-K2IIOVHM.js → CurrencyConverter-5XTNXV6T.js} +8 -8
  5. package/dist/{Documents-IYGZXCU2.js → Documents-XL7MKKXZ.js} +22 -22
  6. package/dist/{Files-EMPEGBMQ.js → Files-CSIF475B.js} +22 -22
  7. package/dist/{Notepad-VYJZ2XA4.js → Notepad-G7UBNTKT.js} +11 -11
  8. package/dist/{PomodoroTimer-BEVXP5KG.js → PomodoroTimer-ZVD3D357.js} +12 -12
  9. package/dist/{Preview-AVQQI32Z.js → Preview-NJTBJCU2.js} +33 -33
  10. package/dist/Sidebar-LYTGLTQJ.js +43 -0
  11. package/dist/{Spreadsheet-EM6OOJ6I.js → Spreadsheet-NMXUMNKG.js} +13 -13
  12. package/dist/{Stock-YJNQMFSV.js → Stock-53UOMBQW.js} +7 -7
  13. package/dist/{Weather-XDT4ZEHN.js → Weather-S2ZIGNSU.js} +15 -15
  14. package/dist/{WorldClock-7PTVRQ2A.js → WorldClock-A62SDKTE.js} +6 -6
  15. package/dist/ai/index.js +32 -32
  16. package/dist/apps/index.js +1 -1
  17. package/dist/bin/media-host-check.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/{chunk-ZSFUNXRD.js → chunk-26AYPJSK.js} +4 -4
  20. package/dist/chunk-2CGZX62Z.js +29 -0
  21. package/dist/{chunk-G63BCOQ6.js → chunk-3AKIKASU.js} +1 -1
  22. package/dist/{chunk-Y6IQYQYN.js → chunk-3BSPSRK4.js} +3 -3
  23. package/dist/{chunk-MGXE75N5.js → chunk-3PAY7HSH.js} +1 -1
  24. package/dist/chunk-3ZHFKOFX.js +14 -0
  25. package/dist/{chunk-ZCHBOAPA.js → chunk-5E3WCKWB.js} +1 -1
  26. package/dist/{chunk-RJ4KZGAT.js → chunk-6NSCK3YX.js} +4 -4
  27. package/dist/{chunk-4OFD6ICH.js → chunk-C4YN2DNM.js} +10 -10
  28. package/dist/{chunk-WCKZHEFC.js → chunk-CWXKRYVY.js} +4 -4
  29. package/dist/{chunk-NGBT7AHL.js → chunk-DZ6B5XCG.js} +5 -5
  30. package/dist/{chunk-J7FZAOKT.js → chunk-EGDJEY4K.js} +18 -18
  31. package/dist/{chunk-ZWAVSUWT.js → chunk-FORJ75AU.js} +2 -2
  32. package/dist/chunk-FORUFXAN.js +7 -0
  33. package/dist/chunk-GNPTNAZH.js +4 -0
  34. package/dist/chunk-HTYRV4WU.js +3 -0
  35. package/dist/{chunk-L7FDYGGF.js → chunk-IUMFKZY7.js} +3 -3
  36. package/dist/{chunk-BUGAWNOC.js → chunk-JVIOAZHW.js} +4 -4
  37. package/dist/{chunk-DXTKNHWG.js → chunk-L5ND7FNA.js} +7 -7
  38. package/dist/{chunk-7MSFHQAY.js → chunk-L73LI7FG.js} +7 -7
  39. package/dist/{chunk-TZMJEOZA.js → chunk-LRTCIX3P.js} +1 -1
  40. package/dist/{chunk-ZEKM6HAA.js → chunk-M2AIC7IK.js} +2 -2
  41. package/dist/{chunk-K52WWA5G.js → chunk-MG7OPTLQ.js} +1 -1
  42. package/dist/{chunk-3CST4ZDP.js → chunk-N2SJNPFY.js} +3 -3
  43. package/dist/{chunk-CPK7JTN3.js → chunk-NL5G26Q7.js} +1 -1
  44. package/dist/chunk-OKA5H7UC.js +1 -0
  45. package/dist/{chunk-WIW2547G.js → chunk-QVR4LBBW.js} +1 -1
  46. package/dist/{chunk-LGAN7DNC.js → chunk-RGOUJFAO.js} +3 -3
  47. package/dist/{chunk-7C56GLLI.js → chunk-W6TS6WGA.js} +17 -17
  48. package/dist/{chunk-NESJOC3R.js → chunk-Z35NWGMT.js} +1 -1
  49. package/dist/{chunk-45S6M77O.js → chunk-ZVEOWBXE.js} +6 -6
  50. package/dist/data/ListLoadError.js +1 -1
  51. package/dist/format/index.js +1 -1
  52. package/dist/forms/BorderInput.js +1 -1
  53. package/dist/forms/BrandAssetEditor.js +1 -1
  54. package/dist/forms/ColorPicker.js +1 -1
  55. package/dist/forms/ComposerAttachments.js +1 -1
  56. package/dist/forms/CornersInput.js +1 -1
  57. package/dist/forms/DisplayChips.js +1 -1
  58. package/dist/forms/IconPicker.js +1 -1
  59. package/dist/forms/InputNumber.js +1 -1
  60. package/dist/forms/LinkPicker.js +1 -1
  61. package/dist/forms/MediaLibrary.d.ts +33 -1
  62. package/dist/forms/MediaLibrary.js +1 -1
  63. package/dist/forms/MediaUploadField.js +1 -1
  64. package/dist/forms/MediaUploadGrid.d.ts +10 -1
  65. package/dist/forms/MediaUploadGrid.js +1 -1
  66. package/dist/forms/MediaUsedInList.js +1 -1
  67. package/dist/forms/PositionInput.js +1 -1
  68. package/dist/forms/SidesInput.js +1 -1
  69. package/dist/forms/Slider.js +1 -1
  70. package/dist/forms/Snippet.js +1 -1
  71. package/dist/forms/SplitButton.js +1 -1
  72. package/dist/forms/TextToolbar.js +1 -1
  73. package/dist/forms/WidthsBar.js +1 -1
  74. package/dist/icons/index.js +1 -1
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +156 -156
  77. package/dist/map/index.js +1 -1
  78. package/dist/page-tabs/index.js +5 -5
  79. package/dist/shell/AppUpdateBanner.js +1 -1
  80. package/dist/shell/ConfirmDialog.js +1 -1
  81. package/dist/shell/ContextMenu.js +1 -1
  82. package/dist/shell/Dialog.d.ts +13 -3
  83. package/dist/shell/Dialog.js +1 -1
  84. package/dist/shell/DropdownMenu.js +1 -1
  85. package/dist/shell/HelpCenter.js +1 -1
  86. package/dist/shell/ImageLightbox.js +1 -1
  87. package/dist/shell/LanguageSelect.js +1 -1
  88. package/dist/shell/Markdown.js +1 -1
  89. package/dist/shell/PopupMenu.js +1 -1
  90. package/dist/shell/SearchableSelect.js +1 -1
  91. package/dist/shell/SettingReset.js +1 -1
  92. package/dist/shell/SettingRow.js +1 -1
  93. package/dist/shell/TopNav.js +1 -1
  94. package/dist/telemetry/index.js +1 -1
  95. package/dist/templates/ChatTemplate.js +1 -1
  96. package/dist/templates/CheckoutTemplate.js +1 -1
  97. package/dist/templates/DataTablePage.js +1 -1
  98. package/dist/templates/EmailTemplate.js +1 -1
  99. package/dist/templates/FormLayoutPage.js +1 -1
  100. package/dist/ui/index.d.ts +1 -1
  101. package/dist/ui/index.js +1 -1
  102. package/dist/version.js +1 -1
  103. package/package.json +1 -1
  104. package/dist/Calculator-I4P2BWR7.js +0 -29
  105. package/dist/Sidebar-6I4FC5AK.js +0 -43
  106. package/dist/chunk-AAW27HJY.js +0 -3
  107. package/dist/chunk-LSISFKKS.js +0 -14
  108. package/dist/chunk-NLWS7HMX.js +0 -29
  109. package/dist/chunk-O4Q475GF.js +0 -1
  110. package/dist/chunk-SG3ILR7W.js +0 -4
  111. package/dist/chunk-YALPQIBR.js +0 -7
@@ -1,4 +1,4 @@
1
- import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-CY5N5OA3.js";import{ROW_HEIGHTS as u}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as d}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as h}from"./chunk-JDCM2VHG.js";import{Result as m}from"./chunk-BMPBVI7P.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-Y53KNQKL.js";import{CopyButton as w}from"./chunk-6WWAQC5V.js";import{confirm as y}from"./chunk-J7FZAOKT.js";import{useShellPrefs as g}from"./chunk-KC3EX26K.js";import{dialogA11y as b}from"./chunk-VWGWZY7A.js";import{useIsMobile as v,useIsPhone as x}from"./chunk-UGTRSRIW.js";import{ColoredBadge as k}from"./chunk-ET2EF5CI.js";import{focusableIn as E}from"./chunk-CDAJKLGL.js";import{PopupMenu as C,PopupMenuItem as M,PopupMenuDivider as N,PopupMenuLabel as S}from"./chunk-DXTKNHWG.js";import{StatusBadge as L}from"./chunk-D323R2FT.js";import{Button_default as T}from"./chunk-4IU5BSVE.js";import{Icon as z}from"./chunk-FSPFV4MI.js";import{LoadingSpinner as A}from"./chunk-Q5MD3VY6.js";import{Z_LAYERS as D}from"./chunk-62LW225J.js";import{runEscapeInterceptors as P}from"./chunk-TWVUQUUD.js";import{useShellStrings as I}from"./chunk-E6UCGCOC.js";import{createContext as W,useContext as K,Component as R,useLayoutEffect as $,useRef as O,useEffect as F,useState as j,useSyncExternalStore as q,useCallback as B,isValidElement as H,Fragment as U,Children as Y,cloneElement as X,useMemo as V,useId as _,useReducer as G,Suspense as J}from"react";import{jsxs as Q,jsx as Z,Fragment as ee}from"react/jsx-runtime";import{createPortal as te}from"react-dom";import{useLocation as ne}from"react-router-dom";import{useQueryClient as re,useQuery as oe}from"@tanstack/react-query";function ie(e){return"component"in e}function ae(e){return"endpoint"in e}var se={};function le(e){se=e}var ce=new Proxy({},{get:(e,t)=>se[t],has:(e,t)=>t in se,ownKeys:()=>Object.keys(se),getOwnPropertyDescriptor(e,t){if(t in se)return{configurable:!0,enumerable:!0,value:se[t]}}}),ue=null;function de(e){ue=e}function he(){return null!==ue}var me=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),pe=new Proxy({},{get:(e,t)=>ue?ue[t]:"string"==typeof t&&me.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),fe=W(null);function we(){return K(fe)?.pageSearch??""}var ye=null,ge=/* @__PURE__ */new Set;function be(e){ye!==e&&(ye=e,ge.forEach(e=>e()))}function ve(){return ye}function xe(e){return ge.add(e),()=>{ge.delete(e)}}var ke=null;function Ee(e){ke=e}function Ce({error:e,onReload:t}){const n=h(e);/* @__PURE__ */
1
+ import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-CY5N5OA3.js";import{ROW_HEIGHTS as u}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as d}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as h}from"./chunk-JDCM2VHG.js";import{Result as m}from"./chunk-BMPBVI7P.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-Y53KNQKL.js";import{CopyButton as w}from"./chunk-6WWAQC5V.js";import{confirm as y}from"./chunk-EGDJEY4K.js";import{dialogA11y as g}from"./chunk-VWGWZY7A.js";import{ColoredBadge as b}from"./chunk-ET2EF5CI.js";import{useIsMobile as v,useIsPhone as x}from"./chunk-UGTRSRIW.js";import{focusableIn as k}from"./chunk-CDAJKLGL.js";import{useShellPrefs as E}from"./chunk-KC3EX26K.js";import{PopupMenu as C,PopupMenuItem as M,PopupMenuDivider as N,PopupMenuLabel as S}from"./chunk-L5ND7FNA.js";import{StatusBadge as L}from"./chunk-D323R2FT.js";import{Button_default as T}from"./chunk-4IU5BSVE.js";import{Icon as z}from"./chunk-FSPFV4MI.js";import{LoadingSpinner as A}from"./chunk-Q5MD3VY6.js";import{Z_LAYERS as D}from"./chunk-62LW225J.js";import{runEscapeInterceptors as P}from"./chunk-TWVUQUUD.js";import{useShellStrings as I}from"./chunk-E6UCGCOC.js";import{createContext as W,useContext as K,Component as R,useLayoutEffect as $,useRef as O,useEffect as F,useState as j,useSyncExternalStore as q,useCallback as B,isValidElement as H,Fragment as U,Children as Y,cloneElement as X,useMemo as V,useId as _,useReducer as G,Suspense as J}from"react";import{jsxs as Q,jsx as Z,Fragment as ee}from"react/jsx-runtime";import{createPortal as te}from"react-dom";import{useLocation as ne}from"react-router-dom";import{useQueryClient as re,useQuery as oe}from"@tanstack/react-query";function ie(e){return"component"in e}function ae(e){return"endpoint"in e}var se={};function le(e){se=e}var ce=new Proxy({},{get:(e,t)=>se[t],has:(e,t)=>t in se,ownKeys:()=>Object.keys(se),getOwnPropertyDescriptor(e,t){if(t in se)return{configurable:!0,enumerable:!0,value:se[t]}}}),ue=null;function de(e){ue=e}function he(){return null!==ue}var me=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),pe=new Proxy({},{get:(e,t)=>ue?ue[t]:"string"==typeof t&&me.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),fe=W(null);function we(){return K(fe)?.pageSearch??""}var ye=null,ge=/* @__PURE__ */new Set;function be(e){ye!==e&&(ye=e,ge.forEach(e=>e()))}function ve(){return ye}function xe(e){return ge.add(e),()=>{ge.delete(e)}}var ke=null;function Ee(e){ke=e}function Ce({error:e,onReload:t}){const n=h(e);/* @__PURE__ */
2
2
  return Q("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
3
  /* @__PURE__ */Z(z,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
4
  /* @__PURE__ */Q("div",{className:"min-w-0",children:[
@@ -41,12 +41,12 @@ return Q(Ue.Provider,{value:{openWindows:o,openEntity:f,openPage:w,reorderWindow
41
41
  /* @__PURE__ */Z(yt,{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&&Qn(e)}})},onActivateById:ot}),
42
42
  /* @__PURE__ */Z(Yr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
43
43
  /* @__PURE__ */
44
- return Z(fe.Provider,{value:c(e),children:/* @__PURE__ */Z(Me,{fallback:(t,n)=>/* @__PURE__ */Z(Xr,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */Z(Ce,{error:t,onReload:n})}),children:/* @__PURE__ */Z(_t,{spec:Ge(e),children:/* @__PURE__ */Z(eo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */Z(Je,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */Z(tt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var vt=400;function xt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=O(null),s=O(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=O(!1),c=O(void 0),u=O(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},vt)};F(()=>{n&&!r&&h()},[n,r]),F(()=>{d&&n&&!r&&h()},[d]),F(()=>()=>clearTimeout(c.current),[]),F(()=>{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?E(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),$(()=>{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 kt=null,Et=/* @__PURE__ */new Set;function Ct(){return kt}function Mt(e){if(kt!==e){kt=e;for(const e of Et)e()}}function Nt(e){return Et.add(e),()=>{Et.delete(e)}}var St=!1,Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Tt=()=>{};function zt(e){St=e,Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function At(e,t){St&&("submenu"===e?Lt.submenus++:Lt.menus++,Lt.menuKey=t)}function Dt(e){if(!St)return Tt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!St)return;const r=performance.now()-t;"move"===e?Lt.moveMs+=r:Lt.resizeMs+=r}}function Pt(){const e=Lt;return Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var It=/* @__PURE__ */new Set([L,k]),Wt=e=>It.has(e)||"function"==typeof e&&"badge"===e.titleRole,Kt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Rt=/* @__PURE__ */new Set(["svg"]);function $t(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Ot(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Ot(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=>Ot(e,t,n));if(!H(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===U)return void Y.toArray(r.props.children).forEach(e=>Ot(e,t,n));if("string"==typeof r.type){if(Rt.has(r.type))return;if(!Kt.has(r.type))return n.push(" "),Y.toArray(r.props.children).forEach(e=>Ot(e,t,n)),void n.push(" ")}const o=X(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Wt(r.type)?t.badges:t.actions).push(o)}var Ft=/* @__PURE__ */new Map,jt=/* @__PURE__ */new Set,qt=0;function Bt(){qt++,jt.forEach(e=>e())}function Ht(e){return Ft.get(e)}function Ut(e){return jt.add(e),()=>{jt.delete(e)}}function Yt(){return qt}var Xt=W(""),Vt=W(null);function _t({spec:e,children:t}){/* @__PURE__ */
44
+ return Z(fe.Provider,{value:c(e),children:/* @__PURE__ */Z(Me,{fallback:(t,n)=>/* @__PURE__ */Z(Xr,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */Z(Ce,{error:t,onReload:n})}),children:/* @__PURE__ */Z(_t,{spec:Ge(e),children:/* @__PURE__ */Z(eo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */Z(Je,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */Z(tt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var vt=400;function xt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=O(null),s=O(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=O(!1),c=O(void 0),u=O(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},vt)};F(()=>{n&&!r&&h()},[n,r]),F(()=>{d&&n&&!r&&h()},[d]),F(()=>()=>clearTimeout(c.current),[]),F(()=>{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?k(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),$(()=>{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 kt=null,Et=/* @__PURE__ */new Set;function Ct(){return kt}function Mt(e){if(kt!==e){kt=e;for(const e of Et)e()}}function Nt(e){return Et.add(e),()=>{Et.delete(e)}}var St=!1,Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Tt=()=>{};function zt(e){St=e,Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function At(e,t){St&&("submenu"===e?Lt.submenus++:Lt.menus++,Lt.menuKey=t)}function Dt(e){if(!St)return Tt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!St)return;const r=performance.now()-t;"move"===e?Lt.moveMs+=r:Lt.resizeMs+=r}}function Pt(){const e=Lt;return Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var It=/* @__PURE__ */new Set([L,b]),Wt=e=>It.has(e)||"function"==typeof e&&"badge"===e.titleRole,Kt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Rt=/* @__PURE__ */new Set(["svg"]);function $t(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Ot(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Ot(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=>Ot(e,t,n));if(!H(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===U)return void Y.toArray(r.props.children).forEach(e=>Ot(e,t,n));if("string"==typeof r.type){if(Rt.has(r.type))return;if(!Kt.has(r.type))return n.push(" "),Y.toArray(r.props.children).forEach(e=>Ot(e,t,n)),void n.push(" ")}const o=X(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Wt(r.type)?t.badges:t.actions).push(o)}var Ft=/* @__PURE__ */new Map,jt=/* @__PURE__ */new Set,qt=0;function Bt(){qt++,jt.forEach(e=>e())}function Ht(e){return Ft.get(e)}function Ut(e){return jt.add(e),()=>{jt.delete(e)}}function Yt(){return qt}var Xt=W(""),Vt=W(null);function _t({spec:e,children:t}){/* @__PURE__ */
45
45
  return Z(Vt.Provider,{value:e,children:t})}var Gt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Jt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Qt='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Zt(e){return en(e).replace(/\s+/g," ").trim()}function en(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(en).join("");if(H(e)){const t=e,n="string"==typeof t.type?t.type:"";return Gt.has(n)?"":` ${en(t.props?.children)} `}return""}function tn(e){const t=K(Xt);F(()=>{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 nn={};function rn(e,t,n){const r=K(Xt);F(()=>{if(!r)return;nn[r]||(nn[r]=[]);const o={label:e,icon:n,onClick:t};return nn[r].push(o),()=>{nn[r]=(nn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function on({title:e}){const t=O(null);return F(()=>{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__ */Z("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function an(e){}var sn=W(null);function ln(){return K(Xt)}function cn(){const e=q(Cr,Er),t=K(sn);return t?.active??(Ln.length<=1||null!=e)}function un({children:e,position:t="right",quiet:n=!1}){const r=K(sn),[o,i]=j(null);return F(()=>{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?te(e,o):null}function dn({onClick:e,children:t,className:n}){const r=K(sn);/* @__PURE__ */
46
46
  return Z("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 hn="erp_window_positions",mn={};try{const e=localStorage.getItem(hn);e&&(mn=JSON.parse(e))}catch{}var pn=null;function fn(){pn&&clearTimeout(pn),pn=setTimeout(()=>{try{localStorage.setItem(hn,JSON.stringify(mn))}catch{}},500)}var wn="erp_activation_order",yn=[];try{const e=localStorage.getItem(wn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(yn=t)}catch{}var gn=null;function bn(){gn&&clearTimeout(gn),gn=setTimeout(()=>{try{localStorage.setItem(wn,JSON.stringify(yn))}catch{}},500)}function vn(e,t){mn[e]||(mn[e]=t,fn())}function xn(e){return mn[e]?{...mn[e]}:null}function kn(e,t){mn[e]=t,fn()}function En(){const r=e(),o=t();let i=!1;for(const e of Object.keys(mn))n(mn[e],r,o)&&(delete mn[e],i=!0);i&&fn()}var Cn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Mn=4e3,Nn=()=>{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"},Sn={small:.8,medium:1,large:1.25,maximized:1.25},Ln=[],Tn=/* @__PURE__ */new Set,zn=/* @__PURE__ */new Set,An=0,Dn=/* @__PURE__ */new Map;var Pn=0;function In(){return Pn}function Wn(){Pn++,Tn.forEach(e=>e())}var Kn=/* @__PURE__ */new Map,Rn=/* @__PURE__ */new Map,$n=/* @__PURE__ */new Map;function On(){for(let e=Ln.length-1;e>=0;e--){const t=$n.get(Ln[e]);if(t?.tab)return t.owner}return null}function Fn(){return q(Cr,On,()=>null)}var jn=/* @__PURE__ */new Set;var qn=null;function Bn(e){qn=null,Qn(e)}function Hn(e){qn=e;const t=Kn.get(e);t&&Bn(t)}var Un=/* @__PURE__ */new Map;function Yn(e){return Un.get(e)?.holdsChanges()??!1}function Xn(e){const t=Un.get(e);return t?t.ask():Promise.resolve(!0)}function Vn(e){qn===e&&(qn=null)}function _n(e,t,n){if(n&&$n.set(e,n),t)if(Kn.set(t,e),Rn.set(e,t),jn.delete(t)){Ln.unshift(e);const n=yn.indexOf(t);-1!==n&&yn.splice(n,1),yn.unshift(t),bn()}else!function(e,t){const n=yn.indexOf(t);if(-1===n)return void Ln.push(e);let r=Ln.length;for(let e=0;e<Ln.length;e++){const t=Rn.get(Ln[e]);if(t&&yn.indexOf(t)>n){r=e;break}}Ln.splice(r,0,e)}(e,t),-1===yn.indexOf(t)&&(yn.push(t),bn());else Ln.push(e);Wn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&qn===t&&Bn(e)}function Gn(e){return e?$n.get(e)?.owner??Rn.get(e)??null:null}var Jn=/* @__PURE__ */new Set;function Qn(e){const t=Gn(Er()),n=Ln.indexOf(e);-1!==n&&Ln.splice(n,1),Ln.push(e);const o=$n.get(e);if(o?.root&&o.tab&&r()){const e=Ln.filter(e=>{const t=$n.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)Ln.splice(Ln.indexOf(t),1),Ln.push(t)}zn.delete(e);const i=Rn.get(e);if(i){const e=yn.indexOf(i);-1!==e&&yn.splice(e,1),yn.push(i),bn(),qn&&qn!==i&&(qn=null)}Wn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=Gn(Er());a&&a!==t&&Jn.forEach(e=>e(a))}function Zn(e){const t=Ln.indexOf(e);-1!==t&&Ln.splice(t,1),zn.add(e),Dn.set(e,++An);const n=Rn.get(e);if(n){const e=yn.indexOf(n);-1!==e&&(yn.splice(e,1),bn())}Wn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var er=/* @__PURE__ */new Set;var tr=8,nr=32;function rr(){return e()}var or=u.windowBar,ir=80,ar=384,sr=400;function lr(e,t=rr()){const n=Math.min(Math.max(e.x,t.x+ir-e.w),t.x+t.w-ir),r=Math.min(Math.max(e.y,t.y),t.y+t.h-or);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function cr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=rr();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 ur(e){const t=rr(),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 dr=null;function hr(e){const t=(dr||((dr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${D.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(dr)),dr);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 mr(){dr&&(dr.style.opacity="0",dr.style.display="none")}var pr=[{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"}],fr=350,wr=200;function yr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=j(!1),s=O(void 0),l=O(void 0);F(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),fr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),wr)};/* @__PURE__ */
47
47
  return Q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,children:[
48
48
  /* @__PURE__ */Z("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */Z("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-gray-200 bg-white p-2 shadow-lg",children:pr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */Z("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__ */Z("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var gr="rosh-gesture-style";var br={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},vr=4;function xr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(gr))return;const e=document.createElement("style");e.id=gr,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=Dt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function kr(e){const t=Ln.indexOf(e);if(-1===t)return-1;const n=D.window+t*D.windowStep,o=$n.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of $n){if(!t.root||t.owner!==o.owner)continue;const n=Ln.indexOf(e);-1!==n&&(i=Math.max(i,D.window+n*D.windowStep))}return i>=n?i+2+Math.min(t,7):n}function Er(){return Ln[Ln.length-1]||null}function Cr(e){return Tn.add(e),()=>{Tn.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=Ln.length-1;e>=0;e--)er.has(Ln[e])||Ln.splice(e,1);yn=yn.filter(e=>{const t=Kn.get(e);return null!=t&&er.has(t)}),bn(),Wn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Mr="modal-close-request";function Nr(e){q(Cr,In);const t=K(sn);if(Ln.length<=1)return!0;if(e){const t=Kn.get(e);if(null!=t)return Er()===t}return t?.active??null!=Er()}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,Wr=/* @__PURE__ */new Set;function Kr(e){return Wr.add(e),()=>Wr.delete(e)}function Rr(){return Ir}function $r(e){Ir!==e&&(Ir=e,Wr.forEach(e=>e()))}var Or=null,Fr=/* @__PURE__ */new Set;function jr(e){return Fr.add(e),()=>Fr.delete(e)}function qr(){return Or}function Br(e){Or!==e&&(Or=e,Fr.forEach(e=>e()))}function Hr(){if(!Or)return void Ar(!1);$r(Or),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 F(()=>{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?te(
49
- /* @__PURE__ */Z("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:D.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:i,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:w,bodyScroll:k,onMinimize:E,initialBox:S,actions:L,actionsLeft:A,editing:W=!1,edit:R,allowPinOnTop:U,initialPosition:Y,widget:G,compact:J,appStyle:ne,flushBody:re,autoHeight:oe,autoMinHeight:ie,autoWidth:ae,widgetMenu:se,dimensions:le,windowKey:ce,openedFromKey:ue,accentRgb:de,children:he}){const[me,pe]=j(()=>r()),we=v()&&!me,ye=x()&&!!G,[ge,be]=j(0),[ve,xe]=j(!1),ke=O(null),Ee=O(0);F(()=>{Ee.current=ge},[ge]);const Ce=B(e=>{we&&(ke.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),Mt(ue??null))},[we,ue]),Se=q(Nt,Ct);F(()=>{if(!ve)return;const e=e=>{if(!ke.current)return;const t=e.clientX-ke.current.startX;if(Math.abs(e.clientY-ke.current.startY)>Math.abs(t)+12)return ke.current=null,xe(!1),be(0),void Mt(null);be(Math.max(0,t))},t=()=>{if(!ke.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ke.current=null,xe(!1),t?(be(window.innerWidth),setTimeout(()=>{i(),be(0),Mt(null)},180)):(be(0),Mt(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)}},[ve]);const[Te,ze]=j(c),Ae=I(),De=Ae.window;F(()=>{ze(c)},[c]);const Pe=V(()=>Zt(Te).trim()||void 0,[Te]),Ie=_(),[We,Ke]=j(!1),Re=O(!1),[$e,Oe]=j(!1),[Fe,je]=j(null),qe=K(Vt),Be=K(fe),{prefs:He,save:Ue}=g(),Ye=!!He.window_accent_stripe,Ve=He.favorite_documents||[],Ge=!!qe&&Ve.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),Je=B(()=>{if(!qe)return;const e=Ge?Ve.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Ve,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ue({favorite_documents:e})},[qe,Ge,Ve,Ue]),[Qe,Ze]=j(null),[et,tt]=j("top-right"===Y?"right":"left"),nt=O(!1),rt=O(null);$(()=>{const e=rt.current;e&&(de?e.style.setProperty("--window-accent-rgb",de):e.style.removeProperty("--window-accent-rgb"))},[de]);const ot=O(!1),it=O(null),at=O(null),st=O(null),[lt,ct]=j(!1),ut=O(null),dt=O(null),ht=O(null),[mt,pt]=j(!1);$(()=>{const e=dt.current,t=ht.current;if(!e||!t)return;const n=()=>pt(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!=w&&!1!==w]);const ft=!!R&&!G&&!J&&!ne&&(R.editing||"hidden"!==R.state),wt=!!(w||L||A)||lt||ft,yt=K(Ne),gt=""!==K(Xt),bt=O(null);bt.current=Be?{owner:Be.key,tab:Be.tab,root:!gt}:null;const vt=ce||(Be&&!gt?Be.key:null),kt=!!yt&&!gt&&yt.enabled&&yt.hasState&&(W||yt.declaredEditable)&&!yt.handMounted&&wt&&!G&&!J&&!ne&&!we,Et=/* @__PURE__ */Z(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),St=u&&H(u)?X(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Et,Lt=()=>/* @__PURE__ */Z("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();je(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:St}),Tt=40,{minimize:zt,items:At,restoreIfMinimized:Dt,openWindows:Pt}=_e(),It=O(`modal-${Math.random().toString(36).slice(2,8)}`).current;F(()=>{if(G)return er.add(It),()=>{er.delete(It)}},[G,It]),F(()=>{const e=e=>{const t=e.detail;t?.id===It&&ze(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[It]);const[Wt,Kt]=j(D.window),Rt=function(e){const t=q(Cr,Er);return Ln.length<=1||t===e}(It),Ot=O(R);Ot.current=R;const jt=!!R&&!R.editing&&"enabled"===R.state;F(()=>{if(!t||!Rt||!jt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),Ot.current?.onEdit())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Rt,jt]);const qt=function(e){return q(Cr,()=>zn.has(e))}(It);xt({panelRef:rt,bodyRef:it,open:t,widget:!!G,active:Rt,minimized:qt});const Ht=q(Tr,zr),Ut=q(Kr,Rr),Yt=q(jr,qr),_t=!U&&!G,Gt=Ht&&_t,[en,tn]=j(!1),rn=Gt&&Yt===It,[on,an]=j(!1),ln=on&&_t&&Ut===It?"picked":null,cn=O(Gt);F(()=>{if(cn.current&&!Gt){an(!0);const e=setTimeout(()=>{an(!1),Ir===It&&$r(null)},700);return cn.current=Gt,()=>clearTimeout(e)}cn.current=Gt},[Gt,It]),F(()=>{Gt||tn(!1)},[Gt]),F(()=>{const e=at.current,t=st.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ct(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]),F(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&rt.current){const t=rt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=at.current,n=st.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const un=O(!1),dn=B(e,[]),hn=B(()=>{const t=e(),n=le?le[0]:Cn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Sn[Nn()],l=le?Math.min(le[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*(Ln.length-1),u=Math.max(Tt,(i-l)/2),d=(o-a)/2,m=t.h-Tt-l-u;return"top-right"===Y?{x:t.x+t.w-a-Tt,y:t.y+Tt,w:a,h:l}:"top-left"===Y?{x:t.x+Tt,y:t.y+Tt,w:a,h:l}:{x:t.x+Math.max(Tt,(o-a)/2+Tt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),pn=O(!1);t||(pn.current=!1);const wn=ce||d||null;F(()=>{if(!t)return;_n(It,wn,bt.current??void 0),ce||Qn(It),un.current=!1,Kt(kr(It));const e=()=>{Kt(kr(It))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===ce;if(!e.label)return!1;const t=rt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Qn(It),Pn.current)return;const t=rr(),n=Math.min(Hn.current.w,t.w-40),o=Math.min(Hn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;bn({x:i,y:a,w:n,h:o}),Bn(!1)},i=e=>{const t=e.detail;r(t)&&(Qn(It),je({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==ce)return;Qn(It);const t=Hn.current,n=function(e,t=rr()){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=rt.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)}bn(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=Ln.indexOf(e);-1!==t&&(Ln.splice(t,1),Wn()),zn.delete(e),Dn.delete(e),$n.delete(e);const n=Rn.get(e);n&&(Rn.delete(e),Kn.delete(n))}(It),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,It,wn,dn]);const yn=!G&&"maximized"===Nn(),[gn,bn]=j(()=>{if(wn&&mn[wn]){const e={...mn[wn]};return le&&(e.w=le[0],oe||(e.h=le[1])),lr(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:yn?dn():hn()}),[vn,xn]=j(()=>!oe),kn=O(me),En=O(null);F(()=>{const e=()=>{const e=r();e!==kn.current&&En.current?.(e),kn.current=e,pe(e),Kt(kr(It))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[It]);const Tn=me&&!!Be?.tab&&!gt&&!G&&!we,An=Tn,Pn=O(An);Pn.current=An;const In=Fn(),On=me&&!!Be?.tab&&!G&&!we&&!Ht&&In!==Be.key,jn=!!G&&me&&!Ht&&null!==In,[qn,Bn]=j(()=>wn&&mn[wn]||S?An:An||yn),Hn=O(gn);Hn.current=gn;const Yn=O(qn);$(()=>{Yn.current=qn},[qn]),$(()=>{if(vn||Tn)return;const e=rt.current,t=it.current;if(!e||!t)return;const n=ie??(G?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,Hn.current.y)-24),g=w?Math.min(Hn.current.h,y):Math.min(Math.max(n,u+p),y),b=Math.abs(g-o)>1;b&&(o=g,bn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),G||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&xn(!0)},160)))},l=new ResizeObserver(s);s(),ut.current&&l.observe(ut.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[vn,G,ie,wt,Tn]),$(()=>{if(!oe||!vn||G||!t)return;const e=ut.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||qn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ie??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Hn.current.y)-24);bn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[oe,vn,G,t,qn,ie]);const Xn=!1!==ae&&!G&&!ne&&!we,[Vn,Gn]=j(()=>!Xn);$(()=>{if(Vn||!t)return;if(!Xn||qn)return void Gn(!0);const n=rt.current,r=it.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Hn.current.w,c=0;const u=()=>Gn(!0),d=()=>{c=0;const t=Hn.current;if(Math.abs(t.w-i)>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)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),d,Tt);b!==t&&(i=b.w,bn(b))};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,Mn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Vn,t,Xn,qn]);const Jn=O(null),or=!(!Be?.tab||gt||G||we);En.current=t=>{if(!or)return;if(t)return Jn.current||(Jn.current={box:{...Hn.current},maximized:Yn.current}),void(Yn.current=!0);const r=Jn.current;Jn.current=null;const o=e();if(r?.maximized)return Yn.current=!0,Bn(!0),void bn(o);const i=r?.box??(wn?mn[wn]:void 0);if(Yn.current=!1,Bn(!1),i&&!n(i,o,!1)){const e={...i};le&&(e.w=le[0],oe||(e.h=le[1])),bn(lr(e))}else bn(hn())},F(()=>{An&&(Yn.current=!0,Bn(!0),bn(dn()))},[An,dn]),F(()=>{if(G)return;const e=()=>{const e=wn?mn[wn]:void 0;if(Yn.current=!1,Bn(!1),e){const t={...e};le&&(t.w=le[0],oe||(t.h=le[1])),bn(lr(t))}else bn(hn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[G,hn,wn]),F(()=>{t&&wn&&!Tn&&(mn[wn]=gn,fn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[gn,t,wn,Tn]),F(()=>{if(!t)return;const e=()=>{Yn.current?bn(dn()):document.body.classList.contains("rosh-gesturing")||bn(lr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return qn&&(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,qn,dn]),F(()=>{if(t&&(Ke(!1),Re.current=!1,nt.current=!1,Gn(!Xn),!Pn.current)){if(wn&&mn[wn]){const e=mn[wn];return void bn(t=>lr({...e,...oe?{h:t.h}:{},...Xn?{x:t.x,w:t.w}:{}}))}S&&(bn({x:S.x,y:S.y,w:S.w,h:S.h}),Bn(S.maximized))}},[t]),F(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{rt.current?.contains(t.target)&&!Re.current&&(Re.current=!0,e=setTimeout(()=>Ke(!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 ir="auto"===m?We:!0===m,cr=Be&&!gt?Be.key:null,dr=V(()=>$t(Te),[Te]),pr=O({shortcutSpec:qe,isOnDesktop:Ge,toggleDesktopShortcut:Je,taskbarStrings:Ae.taskbar});$(()=>{pr.current={shortcutSpec:qe,isOnDesktop:Ge,toggleDesktopShortcut:Je,taskbarStrings:Ae.taskbar}});const fr=O(null);fr.current||(fr.current={open:(e,t)=>je({x:e,y:t}),items:()=>{const e=pr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of nn[It]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),F(()=>{if(t&&cr)return()=>{return e=cr,void(Ft.delete(e)&&Bt());var e}},[t,cr]),Xe(!(ce||!t)&&ir);const wr=B(()=>ir||"auto"===m&&Re.current,[ir,m]),gr=B(async e=>{if(nt.current)return!1;if(!wr())return!0;nt.current=!0;const t=Pe,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return nt.current=!1,r},[wr,Pe]),Nr=B(()=>nt.current?Promise.resolve():wr()?gr("close").then(e=>{e&&i()}):(i(),Promise.resolve()),[wr,gr,i]),Sr=B(async()=>{await gr("discard")&&(Re.current=!1,Ke(!1),Ot.current?.onDiscard())},[gr]),Lr=B(async()=>{const e=await gr("switch");return e&&(Re.current=!1,Ke(!1)),e},[gr]),Dr=O(()=>!1);$(()=>{Dr.current=wr}),$(()=>{if(!t||!ce)return;const e={holdsChanges:()=>Dr.current(),ask:Lr};return Un.set(ce,e),()=>{Un.get(ce)===e&&Un.delete(ce)}},[t,ce,Lr]),$(()=>{if(!t||!vt)return;const e=e=>{e.detail?.windowKey===vt&&Nr()};return window.addEventListener(Mr,e),()=>window.removeEventListener(Mr,e)},[t,vt,Nr]);const Pr=O(null),Wr=B(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(je(null),Qn(It),Pn.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=rt.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Pr.current){const t=Pr.current;Pr.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:Hn.current.x,c=s?s.top:Hn.current.y,u=s?s.height:Hn.current.h,d=s?s.width:Hn.current.w;Bn(!1),bn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<vr&&Math.abs(e.clientY-i)<vr)return;r=xr(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)`),Hn.current={...Hn.current,x:s,y:u},!G){const t=function(e,t){const n=rr(),r=e<=n.x+tr,o=e>=n.x+n.w-tr,i=t<=n.y+tr,a=t>=n.y+n.h-tr,s=e<=n.x+nr,l=e>=n.x+n.w-nr,c=t<=n.y+nr,u=t>=n.y+n.h-nr;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?hr(ur(t)):mr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),mr();const e=lr({...Hn.current});if(Hn.current=e,!G&&h){Pr.current={x:l,y:c,w:d,h:u};const e=ur(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 bn(e)}if(G){const t=e.x+e.w/2,n=window.innerWidth/2;tt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),bn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),Or=B((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=rt.current,l=s?.getBoundingClientRect(),c=l?l.left:Hn.current.x,u=l?l.top:Hn.current.y,d=l?l.width:Hn.current.w,h=l?l.height:Hn.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;Bn(!1),bn({x:c,y:u,w:d,h:h}),Hn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Hn.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<vr&&Math.abs(e.clientY-a)<vr)return;o=xr(n,r,br[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(ar,d+e)),w&&(i=Math.max(sr,h+t)),m){const t=Math.max(ar,d-e);n=c+d-t,o=t}if(p){const e=Math.max(sr,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(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),bn({...Hn.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),Fr=B(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(),Qn(It),"Enter"===e.key)return void(qn?(Bn(!1),bn(hn())):(Bn(!0),bn(dn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Pr.current||(Pr.current={...Hn.current})};if(r<0)return e(),Bn(!0),void bn(dn());if(r>0){if(qn)return Bn(!1),void bn(hn());if(Pr.current){const e=lr(Pr.current);return Pr.current=null,Hn.current=e,void bn(e)}return void Zn(It)}e(),Bn(!1);const t=ur(n<0?"left":"right");return Hn.current=t,void bn(t)}if(qn)return;const o=Hn.current,i=e.shiftKey?{...o,w:Math.max(ar,o.w+24*n),h:Math.max(sr,o.h+24*r)}:lr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Hn.current=i,bn(i)},[It,qn,hn,dn]),Br=B(e=>{Pr.current||(Pr.current={...Hn.current}),Bn(!1);const t=ur(e);Hn.current=t,bn(t),Qn(It)},[It]),Hr=An||Gt?{}:{tabIndex:0,role:"group","aria-label":Pe?`${Pe} — ${De.windowSuffix}`:De.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:Fr},Ur=()=>{Bn(!0),bn(dn())},Yr=B(()=>{const e=rt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Jt);t&&!t.disabled&&t.click()}},[]);F(()=>{if(!t)return;if(G)return;const e=e=>{if(Ln[Ln.length-1]===It&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Yr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&rt.current?.contains(t)))return;if(t.closest(Qt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Yr,It,G]),F(()=>{if(!t)return;const e=e=>{Ln[Ln.length-1]===It&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:It}})),Re.current=!1,Ke(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:It}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),F(()=>{if(!t)return;if(G)return;const e=e=>{if("Escape"===e.key&&Ln[Ln.length-1]===It){if(P(e))return e.preventDefault(),void e.stopPropagation();if(Tn&&!W)return;e.preventDefault(),e.stopPropagation(),Nr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Nr,It,G,Tn,W]);const Xr=t&&(void 0!==p||void 0!==f),[Vr]=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=Tn&&!Be?.home&&dr.actions.length>0;F(()=>{t&&cr&&function(e,t){const n=Ft.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(Ft.set(e,t),Bt())}(cr,{title:dr.text||Pe,dirty:ir,copy:dr.copy,actions:_r&&Vr?Vr:void 0,menu:fr.current??void 0})},[t,cr,Pe,ir,dr.text,dr.copy,_r,Vr]);const Gr=B(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(F(()=>{if(!t)return;const e=e=>{if(Ln[Ln.length-1]!==It)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Xr&&(e.preventDefault(),p?p():Gr("bottom")),"k"===e.key&&Xr&&(e.preventDefault(),f?f():Gr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Xr,Gr,It]),!t||pn.current)return null;const Jr=Gt?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=rr(),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}}(It):null,Qr=Gt&&Jr?Math.min(Jr.w/gn.w,Jr.h/gn.h):1,Zr=(()=>{if(Gt&&Jr){const e=Qr,t=gn.w*e,n=gn.h*e,r=Jr.x+(Jr.w-t)/2-gn.x,o=Jr.y+(Jr.h-n)/2-gn.y,i=en||rn;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:D.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(on&&_t){const e="picked"===ln;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:D.expose+30}:{}}}return null})(),eo=b({modal:!1,titleId:!G&&(Tn?!Be?.home:!we)?Ie:void 0,label:dr.text||Pe}),to=/* @__PURE__ */Q("div",{children:[
49
+ /* @__PURE__ */Z("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:D.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:i,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:w,bodyScroll:b,onMinimize:k,initialBox:S,actions:L,actionsLeft:A,editing:W=!1,edit:R,allowPinOnTop:U,initialPosition:Y,widget:G,compact:J,appStyle:ne,flushBody:re,autoHeight:oe,autoMinHeight:ie,autoWidth:ae,widgetMenu:se,dimensions:le,windowKey:ce,openedFromKey:ue,accentRgb:de,children:he}){const[me,pe]=j(()=>r()),we=v()&&!me,ye=x()&&!!G,[ge,be]=j(0),[ve,xe]=j(!1),ke=O(null),Ee=O(0);F(()=>{Ee.current=ge},[ge]);const Ce=B(e=>{we&&(ke.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),Mt(ue??null))},[we,ue]),Se=q(Nt,Ct);F(()=>{if(!ve)return;const e=e=>{if(!ke.current)return;const t=e.clientX-ke.current.startX;if(Math.abs(e.clientY-ke.current.startY)>Math.abs(t)+12)return ke.current=null,xe(!1),be(0),void Mt(null);be(Math.max(0,t))},t=()=>{if(!ke.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ke.current=null,xe(!1),t?(be(window.innerWidth),setTimeout(()=>{i(),be(0),Mt(null)},180)):(be(0),Mt(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)}},[ve]);const[Te,ze]=j(c),Ae=I(),De=Ae.window;F(()=>{ze(c)},[c]);const Pe=V(()=>Zt(Te).trim()||void 0,[Te]),Ie=_(),[We,Ke]=j(!1),Re=O(!1),[$e,Oe]=j(!1),[Fe,je]=j(null),qe=K(Vt),Be=K(fe),{prefs:He,save:Ue}=E(),Ye=!!He.window_accent_stripe,Ve=He.favorite_documents||[],Ge=!!qe&&Ve.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),Je=B(()=>{if(!qe)return;const e=Ge?Ve.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Ve,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ue({favorite_documents:e})},[qe,Ge,Ve,Ue]),[Qe,Ze]=j(null),[et,tt]=j("top-right"===Y?"right":"left"),nt=O(!1),rt=O(null);$(()=>{const e=rt.current;e&&(de?e.style.setProperty("--window-accent-rgb",de):e.style.removeProperty("--window-accent-rgb"))},[de]);const ot=O(!1),it=O(null),at=O(null),st=O(null),[lt,ct]=j(!1),ut=O(null),dt=O(null),ht=O(null),[mt,pt]=j(!1);$(()=>{const e=dt.current,t=ht.current;if(!e||!t)return;const n=()=>pt(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!=w&&!1!==w]);const ft=!!R&&!G&&!J&&!ne&&(R.editing||"hidden"!==R.state),wt=!!(w||L||A)||lt||ft,yt=K(Ne),gt=""!==K(Xt),bt=O(null);bt.current=Be?{owner:Be.key,tab:Be.tab,root:!gt}:null;const vt=ce||(Be&&!gt?Be.key:null),kt=!!yt&&!gt&&yt.enabled&&yt.hasState&&(W||yt.declaredEditable)&&!yt.handMounted&&wt&&!G&&!J&&!ne&&!we,Et=/* @__PURE__ */Z(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),St=u&&H(u)?X(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Et,Lt=()=>/* @__PURE__ */Z("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();je(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:St}),Tt=40,{minimize:zt,items:At,restoreIfMinimized:Dt,openWindows:Pt}=_e(),It=O(`modal-${Math.random().toString(36).slice(2,8)}`).current;F(()=>{if(G)return er.add(It),()=>{er.delete(It)}},[G,It]),F(()=>{const e=e=>{const t=e.detail;t?.id===It&&ze(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[It]);const[Wt,Kt]=j(D.window),Rt=function(e){const t=q(Cr,Er);return Ln.length<=1||t===e}(It),Ot=O(R);Ot.current=R;const jt=!!R&&!R.editing&&"enabled"===R.state;F(()=>{if(!t||!Rt||!jt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),Ot.current?.onEdit())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Rt,jt]);const qt=function(e){return q(Cr,()=>zn.has(e))}(It);xt({panelRef:rt,bodyRef:it,open:t,widget:!!G,active:Rt,minimized:qt});const Ht=q(Tr,zr),Ut=q(Kr,Rr),Yt=q(jr,qr),_t=!U&&!G,Gt=Ht&&_t,[en,tn]=j(!1),rn=Gt&&Yt===It,[on,an]=j(!1),ln=on&&_t&&Ut===It?"picked":null,cn=O(Gt);F(()=>{if(cn.current&&!Gt){an(!0);const e=setTimeout(()=>{an(!1),Ir===It&&$r(null)},700);return cn.current=Gt,()=>clearTimeout(e)}cn.current=Gt},[Gt,It]),F(()=>{Gt||tn(!1)},[Gt]),F(()=>{const e=at.current,t=st.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ct(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]),F(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&rt.current){const t=rt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=at.current,n=st.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const un=O(!1),dn=B(e,[]),hn=B(()=>{const t=e(),n=le?le[0]:Cn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Sn[Nn()],l=le?Math.min(le[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*(Ln.length-1),u=Math.max(Tt,(i-l)/2),d=(o-a)/2,m=t.h-Tt-l-u;return"top-right"===Y?{x:t.x+t.w-a-Tt,y:t.y+Tt,w:a,h:l}:"top-left"===Y?{x:t.x+Tt,y:t.y+Tt,w:a,h:l}:{x:t.x+Math.max(Tt,(o-a)/2+Tt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),pn=O(!1);t||(pn.current=!1);const wn=ce||d||null;F(()=>{if(!t)return;_n(It,wn,bt.current??void 0),ce||Qn(It),un.current=!1,Kt(kr(It));const e=()=>{Kt(kr(It))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===ce;if(!e.label)return!1;const t=rt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Qn(It),Pn.current)return;const t=rr(),n=Math.min(Hn.current.w,t.w-40),o=Math.min(Hn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;bn({x:i,y:a,w:n,h:o}),Bn(!1)},i=e=>{const t=e.detail;r(t)&&(Qn(It),je({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==ce)return;Qn(It);const t=Hn.current,n=function(e,t=rr()){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=rt.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)}bn(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=Ln.indexOf(e);-1!==t&&(Ln.splice(t,1),Wn()),zn.delete(e),Dn.delete(e),$n.delete(e);const n=Rn.get(e);n&&(Rn.delete(e),Kn.delete(n))}(It),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,It,wn,dn]);const yn=!G&&"maximized"===Nn(),[gn,bn]=j(()=>{if(wn&&mn[wn]){const e={...mn[wn]};return le&&(e.w=le[0],oe||(e.h=le[1])),lr(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:yn?dn():hn()}),[vn,xn]=j(()=>!oe),kn=O(me),En=O(null);F(()=>{const e=()=>{const e=r();e!==kn.current&&En.current?.(e),kn.current=e,pe(e),Kt(kr(It))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[It]);const Tn=me&&!!Be?.tab&&!gt&&!G&&!we,An=Tn,Pn=O(An);Pn.current=An;const In=Fn(),On=me&&!!Be?.tab&&!G&&!we&&!Ht&&In!==Be.key,jn=!!G&&me&&!Ht&&null!==In,[qn,Bn]=j(()=>wn&&mn[wn]||S?An:An||yn),Hn=O(gn);Hn.current=gn;const Yn=O(qn);$(()=>{Yn.current=qn},[qn]),$(()=>{if(vn||Tn)return;const e=rt.current,t=it.current;if(!e||!t)return;const n=ie??(G?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,Hn.current.y)-24),g=w?Math.min(Hn.current.h,y):Math.min(Math.max(n,u+p),y),b=Math.abs(g-o)>1;b&&(o=g,bn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),G||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&xn(!0)},160)))},l=new ResizeObserver(s);s(),ut.current&&l.observe(ut.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[vn,G,ie,wt,Tn]),$(()=>{if(!oe||!vn||G||!t)return;const e=ut.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||qn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ie??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Hn.current.y)-24);bn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[oe,vn,G,t,qn,ie]);const Xn=!1!==ae&&!G&&!ne&&!we,[Vn,Gn]=j(()=>!Xn);$(()=>{if(Vn||!t)return;if(!Xn||qn)return void Gn(!0);const n=rt.current,r=it.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Hn.current.w,c=0;const u=()=>Gn(!0),d=()=>{c=0;const t=Hn.current;if(Math.abs(t.w-i)>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)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),d,Tt);b!==t&&(i=b.w,bn(b))};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,Mn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Vn,t,Xn,qn]);const Jn=O(null),or=!(!Be?.tab||gt||G||we);En.current=t=>{if(!or)return;if(t)return Jn.current||(Jn.current={box:{...Hn.current},maximized:Yn.current}),void(Yn.current=!0);const r=Jn.current;Jn.current=null;const o=e();if(r?.maximized)return Yn.current=!0,Bn(!0),void bn(o);const i=r?.box??(wn?mn[wn]:void 0);if(Yn.current=!1,Bn(!1),i&&!n(i,o,!1)){const e={...i};le&&(e.w=le[0],oe||(e.h=le[1])),bn(lr(e))}else bn(hn())},F(()=>{An&&(Yn.current=!0,Bn(!0),bn(dn()))},[An,dn]),F(()=>{if(G)return;const e=()=>{const e=wn?mn[wn]:void 0;if(Yn.current=!1,Bn(!1),e){const t={...e};le&&(t.w=le[0],oe||(t.h=le[1])),bn(lr(t))}else bn(hn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[G,hn,wn]),F(()=>{t&&wn&&!Tn&&(mn[wn]=gn,fn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[gn,t,wn,Tn]),F(()=>{if(!t)return;const e=()=>{Yn.current?bn(dn()):document.body.classList.contains("rosh-gesturing")||bn(lr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return qn&&(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,qn,dn]),F(()=>{if(t&&(Ke(!1),Re.current=!1,nt.current=!1,Gn(!Xn),!Pn.current)){if(wn&&mn[wn]){const e=mn[wn];return void bn(t=>lr({...e,...oe?{h:t.h}:{},...Xn?{x:t.x,w:t.w}:{}}))}S&&(bn({x:S.x,y:S.y,w:S.w,h:S.h}),Bn(S.maximized))}},[t]),F(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{rt.current?.contains(t.target)&&!Re.current&&(Re.current=!0,e=setTimeout(()=>Ke(!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 ir="auto"===m?We:!0===m,cr=Be&&!gt?Be.key:null,dr=V(()=>$t(Te),[Te]),pr=O({shortcutSpec:qe,isOnDesktop:Ge,toggleDesktopShortcut:Je,taskbarStrings:Ae.taskbar});$(()=>{pr.current={shortcutSpec:qe,isOnDesktop:Ge,toggleDesktopShortcut:Je,taskbarStrings:Ae.taskbar}});const fr=O(null);fr.current||(fr.current={open:(e,t)=>je({x:e,y:t}),items:()=>{const e=pr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of nn[It]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),F(()=>{if(t&&cr)return()=>{return e=cr,void(Ft.delete(e)&&Bt());var e}},[t,cr]),Xe(!(ce||!t)&&ir);const wr=B(()=>ir||"auto"===m&&Re.current,[ir,m]),gr=B(async e=>{if(nt.current)return!1;if(!wr())return!0;nt.current=!0;const t=Pe,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return nt.current=!1,r},[wr,Pe]),Nr=B(()=>nt.current?Promise.resolve():wr()?gr("close").then(e=>{e&&i()}):(i(),Promise.resolve()),[wr,gr,i]),Sr=B(async()=>{await gr("discard")&&(Re.current=!1,Ke(!1),Ot.current?.onDiscard())},[gr]),Lr=B(async()=>{const e=await gr("switch");return e&&(Re.current=!1,Ke(!1)),e},[gr]),Dr=O(()=>!1);$(()=>{Dr.current=wr}),$(()=>{if(!t||!ce)return;const e={holdsChanges:()=>Dr.current(),ask:Lr};return Un.set(ce,e),()=>{Un.get(ce)===e&&Un.delete(ce)}},[t,ce,Lr]),$(()=>{if(!t||!vt)return;const e=e=>{e.detail?.windowKey===vt&&Nr()};return window.addEventListener(Mr,e),()=>window.removeEventListener(Mr,e)},[t,vt,Nr]);const Pr=O(null),Wr=B(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(je(null),Qn(It),Pn.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=rt.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Pr.current){const t=Pr.current;Pr.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:Hn.current.x,c=s?s.top:Hn.current.y,u=s?s.height:Hn.current.h,d=s?s.width:Hn.current.w;Bn(!1),bn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<vr&&Math.abs(e.clientY-i)<vr)return;r=xr(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)`),Hn.current={...Hn.current,x:s,y:u},!G){const t=function(e,t){const n=rr(),r=e<=n.x+tr,o=e>=n.x+n.w-tr,i=t<=n.y+tr,a=t>=n.y+n.h-tr,s=e<=n.x+nr,l=e>=n.x+n.w-nr,c=t<=n.y+nr,u=t>=n.y+n.h-nr;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?hr(ur(t)):mr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),mr();const e=lr({...Hn.current});if(Hn.current=e,!G&&h){Pr.current={x:l,y:c,w:d,h:u};const e=ur(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 bn(e)}if(G){const t=e.x+e.w/2,n=window.innerWidth/2;tt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),bn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),Or=B((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=rt.current,l=s?.getBoundingClientRect(),c=l?l.left:Hn.current.x,u=l?l.top:Hn.current.y,d=l?l.width:Hn.current.w,h=l?l.height:Hn.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;Bn(!1),bn({x:c,y:u,w:d,h:h}),Hn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Hn.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<vr&&Math.abs(e.clientY-a)<vr)return;o=xr(n,r,br[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(ar,d+e)),w&&(i=Math.max(sr,h+t)),m){const t=Math.max(ar,d-e);n=c+d-t,o=t}if(p){const e=Math.max(sr,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(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),bn({...Hn.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),Fr=B(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(),Qn(It),"Enter"===e.key)return void(qn?(Bn(!1),bn(hn())):(Bn(!0),bn(dn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Pr.current||(Pr.current={...Hn.current})};if(r<0)return e(),Bn(!0),void bn(dn());if(r>0){if(qn)return Bn(!1),void bn(hn());if(Pr.current){const e=lr(Pr.current);return Pr.current=null,Hn.current=e,void bn(e)}return void Zn(It)}e(),Bn(!1);const t=ur(n<0?"left":"right");return Hn.current=t,void bn(t)}if(qn)return;const o=Hn.current,i=e.shiftKey?{...o,w:Math.max(ar,o.w+24*n),h:Math.max(sr,o.h+24*r)}:lr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Hn.current=i,bn(i)},[It,qn,hn,dn]),Br=B(e=>{Pr.current||(Pr.current={...Hn.current}),Bn(!1);const t=ur(e);Hn.current=t,bn(t),Qn(It)},[It]),Hr=An||Gt?{}:{tabIndex:0,role:"group","aria-label":Pe?`${Pe} — ${De.windowSuffix}`:De.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:Fr},Ur=()=>{Bn(!0),bn(dn())},Yr=B(()=>{const e=rt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Jt);t&&!t.disabled&&t.click()}},[]);F(()=>{if(!t)return;if(G)return;const e=e=>{if(Ln[Ln.length-1]===It&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Yr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&rt.current?.contains(t)))return;if(t.closest(Qt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Yr,It,G]),F(()=>{if(!t)return;const e=e=>{Ln[Ln.length-1]===It&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:It}})),Re.current=!1,Ke(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:It}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),F(()=>{if(!t)return;if(G)return;const e=e=>{if("Escape"===e.key&&Ln[Ln.length-1]===It){if(P(e))return e.preventDefault(),void e.stopPropagation();if(Tn&&!W)return;e.preventDefault(),e.stopPropagation(),Nr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Nr,It,G,Tn,W]);const Xr=t&&(void 0!==p||void 0!==f),[Vr]=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=Tn&&!Be?.home&&dr.actions.length>0;F(()=>{t&&cr&&function(e,t){const n=Ft.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(Ft.set(e,t),Bt())}(cr,{title:dr.text||Pe,dirty:ir,copy:dr.copy,actions:_r&&Vr?Vr:void 0,menu:fr.current??void 0})},[t,cr,Pe,ir,dr.text,dr.copy,_r,Vr]);const Gr=B(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(F(()=>{if(!t)return;const e=e=>{if(Ln[Ln.length-1]!==It)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Xr&&(e.preventDefault(),p?p():Gr("bottom")),"k"===e.key&&Xr&&(e.preventDefault(),f?f():Gr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Xr,Gr,It]),!t||pn.current)return null;const Jr=Gt?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=rr(),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}}(It):null,Qr=Gt&&Jr?Math.min(Jr.w/gn.w,Jr.h/gn.h):1,Zr=(()=>{if(Gt&&Jr){const e=Qr,t=gn.w*e,n=gn.h*e,r=Jr.x+(Jr.w-t)/2-gn.x,o=Jr.y+(Jr.h-n)/2-gn.y,i=en||rn;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:D.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(on&&_t){const e="picked"===ln;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:D.expose+30}:{}}}return null})(),eo=g({modal:!1,titleId:!G&&(Tn?!Be?.home:!we)?Ie:void 0,label:dr.text||Pe}),to=/* @__PURE__ */Q("div",{children:[
50
50
  /* @__PURE__ */Q("div",{ref:rt,"data-modal-panel":!0,"data-modal-id":It,"data-window-key":ce||void 0,...U?{"data-utility":""}:{},...$e?{"data-pinned-top":""}:{},...G?{"data-widget":""}:{},...Be?{"data-window-owner":Be.key}:{},...Be&&!gt?{"data-window-root":""}:{},...Tn?{"data-window-tab":""}:{},...eo,className:Tn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(G?Rt?"shadow-xl":"shadow-lg":"border "+(Rt?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(ot.current=!1,Gt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),$r(It),Ar(!1),void Qn(It)}if(!Rt&&!G&&!$e&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===rt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),ot.current=!0,je(null),Qn(It),window.addEventListener("mouseup",()=>{setTimeout(()=>{ot.current=!1},0)},{once:!0}))}},onClickCapture:e=>{ot.current&&(ot.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Gt)return;je(null);e.target.closest("[data-modal-panel]")===rt.current&&(e.target.closest("button, input, a, select, textarea")||Qn(It))},style:we?{zIndex:Wt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ge}px)`,transition:ve?"none":"transform 180ms ease-out",...G?{display:"none"}:{},...Wt<0?{display:"none"}:{},...Rt||$e||Se&&ce===Se?{}:{display:"none"}}:{zIndex:$e?D.pinnedWindow:Wt+1,width:gn.w,height:gn.h,top:gn.y,...G&&"right"===et?{right:window.innerWidth-gn.x-gn.w}:{left:gn.x},...Wt<0&&!$e?{display:"none"}:{},...ye?{display:"none"}:{},...On||jn?{visibility:"hidden",pointerEvents:"none"}:{},...Zr??{}},children:[we&&!G&&/* @__PURE__ */Z("div",{onPointerDown:Ce,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),G?null:Tn?Be?.home?null:/* @__PURE__ */Q(ee,{children:[
51
51
  /* @__PURE__ */Z("h2",{id:Ie,"data-window-title":!0,className:"sr-only",children:dr.text||Pe}),_r&&Vr&&te(
52
52
  /* @__PURE__ */Z(ee,{children:dr.actions}),Vr),dr.badges.length>0&&/* @__PURE__ */Z("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:dr.badges})]}):we?null:
@@ -62,7 +62,7 @@ return Q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,
62
62
  /* @__PURE__ */Z("span",{id:Ie,className:"truncate",children:Gt?Zt(Te):Te})]}),!Gt&&/* @__PURE__ */Q("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[U&&/* @__PURE__ */Z("button",{onClick:()=>Oe(e=>!e),title:$e?De.unpin:De.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
63
63
  /* @__PURE__ */Z("button",{onClick:()=>Zn(It),title:De.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!An&&/* @__PURE__ */Z(yr,{maximized:qn,onToggleMax:()=>{qn?(Bn(!1),bn(hn())):Ur()},onSnap:Br,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:De}),
64
64
  /* @__PURE__ */Z("button",{type:"button",onClick:Nr,"aria-label":De.close,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */Z(z,{name:"close",className:"h-5 w-5"})})]})]}),de&&Ye&&!G&&!we&&/* @__PURE__ */Z("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Rt?.9:.55})`}}),
65
- /* @__PURE__ */Z(Xt.Provider,{value:It,children:/* @__PURE__ */Z(sn.Provider,{value:{rightRef:at,leftRef:st,notify:()=>ct(!0),active:Rt,isDirty:ir,footerOpen:wt&&!G&&!J&&!ne&&!we},children:/* @__PURE__ */Z("div",{ref:it,...G?{onPointerDown:Wr,onContextMenu:e=>{e.preventDefault(),Ze({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${G?"p-0 cursor-move":ne||re?"p-0":J?"p-2":"p-4"} ${G||Tn?"":"backdrop-blur-sm"} ${!1===k||ne||re?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${G?"rounded-2xl select-none":""}`,style:{...G?{touchAction:"none"}:{},backgroundColor:G?"transparent":Tn?"rgb(var(--window-content-rgb))":Rt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */Z(Me,{children:he})})})}),G&&Qe&&/* @__PURE__ */Q(C,{minWidth:160,style:{left:Qe.x,top:Qe.y},onClose:()=>Ze(null),children:[
65
+ /* @__PURE__ */Z(Xt.Provider,{value:It,children:/* @__PURE__ */Z(sn.Provider,{value:{rightRef:at,leftRef:st,notify:()=>ct(!0),active:Rt,isDirty:ir,footerOpen:wt&&!G&&!J&&!ne&&!we},children:/* @__PURE__ */Z("div",{ref:it,...G?{onPointerDown:Wr,onContextMenu:e=>{e.preventDefault(),Ze({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${G?"p-0 cursor-move":ne||re?"p-0":J?"p-2":"p-4"} ${G||Tn?"":"backdrop-blur-sm"} ${!1===b||ne||re?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${G?"rounded-2xl select-none":""}`,style:{...G?{touchAction:"none"}:{},backgroundColor:G?"transparent":Tn?"rgb(var(--window-content-rgb))":Rt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */Z(Me,{children:he})})})}),G&&Qe&&/* @__PURE__ */Q(C,{minWidth:160,style:{left:Qe.x,top:Qe.y},onClose:()=>Ze(null),children:[
66
66
  /* @__PURE__ */Z(M,{onClick:()=>{Ze(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:It}))},children:"Settings"}),
67
67
  /* @__PURE__ */Z(N,{}),se&&/* @__PURE__ */Q(ee,{children:[se,
68
68
  /* @__PURE__ */Z(N,{})]}),
@@ -1,16 +1,16 @@
1
- import{Popover as e}from"./chunk-RNBM5JZI.js";import{InputNumber_default as r}from"./chunk-ZCHBOAPA.js";import{InSettingRowContext as a}from"./chunk-L65BESIE.js";import{parseHexColor as n,hexToHsv as o,hsvToHex as t,hexReadout as l,HUE_GRADIENT as i,HEX_MAX_LENGTH as s,svFromPoint as c,hueFromPoint as u}from"./chunk-S6OB6HJB.js";import{inputClasses as d}from"./chunk-PF3ANJFI.js";import{Tooltip as h}from"./chunk-22S6LG6D.js";import{useShellStrings as g}from"./chunk-E6UCGCOC.js";import{forwardRef as p,useState as b,useRef as m,useEffect as f,useId as v}from"react";import{jsx as w,jsxs as x}from"react/jsx-runtime";var y={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},k={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function C(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function N(e,r){if(!e)return k;const a=C(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`}}function $({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",y[e],a].filter(Boolean).join(" ")}var z=p(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
2
- return w("button",{ref:l,type:o,"aria-pressed":a,className:$({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),D=(e,r,a)=>Math.min(a,Math.max(r,e)),I=e=>"string"==typeof e?{value:e}:e;function A(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:D(e.s+o[0],0,1),v:D(e.v+o[1],0,1)}:null}function P(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,359);case"ArrowRight":case"ArrowUp":return D(e+n,0,359);case"PageDown":return D(e-10,0,359);case"PageUp":return D(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var M={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function j(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,100);case"ArrowRight":case"ArrowUp":return D(e+n,0,100);case"PageDown":return D(e-10,0,100);case"PageUp":return D(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function S({value:e,onChange:r,label:s,presets:d,clearable:p=!1,fallback:v,dragWrites:y="live",disabled:$=!1,opacity:D,onOpacityChange:S,onClose:B,id:K,className:O=""}){const L=g().color,R=C(D),U=e=>{const r=C(e);$||r===R||S?.(r)},H=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:R},q=n(v??""),[F,J]=b(()=>o(e||q||"")),W=m(e);f(()=>{e!==W.current&&(W.current=e,e?J(o(e)):q&&J(o(q)))},[e]);const X=a=>{$||a===e||(W.current=a,r(a))},G=e=>{const r=n(e);r&&(J(o(r)),X(r))},Z=e=>{J(e),X(t(e))},[V,Y]=b(!1),Q=m(F);Q.current=F;const _=e=>({onPointerDown:r=>{if($||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,Q.current);"end"===y?(Y(!0),J(a)):Z(a)},onPointerMove:r=>{if($||!(1&r.buttons))return;const a=e(r,Q.current);"end"===y?J(a):Z(a)},onPointerUp:r=>{"end"===y&&V&&(Y(!1),Z(e(r,Q.current)))}}),ee=_((e,r)=>({...r,...c(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),re=_((e,r)=>({...r,h:u(e.clientX,e.currentTarget.getBoundingClientRect())})),ae=V?t(F):e,ne=e=>`${Math.round(100*e)}%`,oe=(d??[]).map(I),te=n(e),le=ae||q||"";
1
+ import{Popover as e}from"./chunk-RNBM5JZI.js";import{InputNumber_default as r}from"./chunk-5E3WCKWB.js";import{InSettingRowContext as a}from"./chunk-L65BESIE.js";import{parseHexColor as n,hexToHsv as o,hsvToHex as t,hexReadout as l,HUE_GRADIENT as i,HEX_MAX_LENGTH as s,svFromPoint as c,hueFromPoint as u}from"./chunk-S6OB6HJB.js";import{inputClasses as d}from"./chunk-PF3ANJFI.js";import{Tooltip as h}from"./chunk-22S6LG6D.js";import{useShellStrings as g}from"./chunk-E6UCGCOC.js";import{forwardRef as p,useState as b,useRef as m,useEffect as f,useId as v}from"react";import{jsx as w,jsxs as x}from"react/jsx-runtime";var y={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},k={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function C(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function N(e,r){if(!e)return k;const a=C(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`}}function $({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",y[e],a].filter(Boolean).join(" ")}var z=p(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
2
+ return w("button",{ref:l,type:o,"aria-pressed":a,className:$({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),D=(e,r,a)=>Math.min(a,Math.max(r,e)),I=e=>"string"==typeof e?{value:e}:e;function P(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:D(e.s+o[0],0,1),v:D(e.v+o[1],0,1)}:null}function A(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,359);case"ArrowRight":case"ArrowUp":return D(e+n,0,359);case"PageDown":return D(e-10,0,359);case"PageUp":return D(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var M={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function j(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,100);case"ArrowRight":case"ArrowUp":return D(e+n,0,100);case"PageDown":return D(e-10,0,100);case"PageUp":return D(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function S({value:e,onChange:r,label:s,presets:d,clearable:p=!1,fallback:v,dragWrites:y="live",disabled:$=!1,opacity:D,onOpacityChange:S,onClose:B,id:K,className:E=""}){const O=g().color,R=C(D),U=e=>{const r=C(e);$||r===R||S?.(r)},W=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:R},H=n(v??""),[q,F]=b(()=>o(e||H||"")),J=m(e);f(()=>{e!==J.current&&(J.current=e,e?F(o(e)):H&&F(o(H)))},[e]);const X=a=>{$||a===e||(J.current=a,r(a))},G=e=>{const r=n(e);r&&(F(o(r)),X(r))},V=e=>{F(e),X(t(e))},[Y,Z]=b(!1),Q=m(q);Q.current=q;const _=e=>({onPointerDown:r=>{if($||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,Q.current);"end"===y?(Z(!0),F(a)):V(a)},onPointerMove:r=>{if($||!(1&r.buttons))return;const a=e(r,Q.current);"end"===y?F(a):V(a)},onPointerUp:r=>{"end"===y&&Y&&(Z(!1),V(e(r,Q.current)))}}),ee=_((e,r)=>({...r,...c(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),re=_((e,r)=>({...r,h:u(e.clientX,e.currentTarget.getBoundingClientRect())})),ae=Y?t(q):e,ne=e=>`${Math.round(100*e)}%`,oe=(d??[]).map(I),te=n(e),le=ae||H||"";
3
3
  /* @__PURE__ */
4
- return w(a.Provider,{value:!1,children:/* @__PURE__ */x("div",{id:K,className:`flex w-56 flex-col gap-3 ${$?"opacity-60":""} ${O}`.trim(),onKeyDown:e=>{"Escape"===e.key&&B&&(e.preventDefault(),e.stopPropagation(),B())},children:[(oe.length>0||p)&&/* @__PURE__ */x("div",{role:"group","aria-label":L.presets,className:"flex flex-wrap gap-2",children:[p&&/* @__PURE__ */w(h,{content:L.clear,children:/* @__PURE__ */w(z,{color:"",size:"sm","aria-label":L.clear,selected:""===e,disabled:$,onClick:()=>{$||""===e||(W.current="",r(""))}})}),oe.map(e=>{const r=n(e.value),a=e.label?`${e.label} · ${l(r??e.value)}`:l(r??e.value);/* @__PURE__ */
4
+ return w(a.Provider,{value:!1,children:/* @__PURE__ */x("div",{id:K,className:`flex w-56 flex-col gap-3 ${$?"opacity-60":""} ${E}`.trim(),onKeyDown:e=>{"Escape"===e.key&&B&&(e.preventDefault(),e.stopPropagation(),B())},children:[(oe.length>0||p)&&/* @__PURE__ */x("div",{role:"group","aria-label":O.presets,className:"flex flex-wrap gap-2",children:[p&&/* @__PURE__ */w(h,{content:O.clear,children:/* @__PURE__ */w(z,{color:"",size:"sm","aria-label":O.clear,selected:""===e,disabled:$,onClick:()=>{$||""===e||(J.current="",r(""))}})}),oe.map(e=>{const r=n(e.value),a=e.label?`${e.label} · ${l(r??e.value)}`:l(r??e.value);/* @__PURE__ */
5
5
  return w(h,{content:a,children:/* @__PURE__ */w(z,{color:r??e.value,size:"sm","aria-label":a,selected:null!==r&&r===te,disabled:$,onClick:()=>G(e.value)})},`${e.label??""}:${e.value}`)})]}),
6
- /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":L.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*F.v),"aria-valuetext":L.squareValue(Math.round(100*F.s),Math.round(100*F.v)),"aria-disabled":$||void 0,"data-color-square":"",onKeyDown:e=>{if($)return;const r=A(F,e.key,e.shiftKey);r&&(e.preventDefault(),Z(r))},...ee,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:t({h:F.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */w("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:ne(F.s),top:ne(1-F.v),...M}})}),
7
- /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":L.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(F.h),"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-hue":"",onKeyDown:e=>{if($)return;const r=P(F.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),Z({...F,h:r}))},...re,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:i},children:/* @__PURE__ */w("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:F.h/360*100+"%",background:t({h:F.h,s:1,v:1}),...M}})}),S&&/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":L.opacity(s),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":R,"aria-valuetext":`${R}%`,"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-opacity":"",onKeyDown:e=>{if($)return;const r=j(R,e.key,e.shiftKey);null!==r&&(e.preventDefault(),U(r))},onPointerDown:e=>{$||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),U(H(e)))},onPointerMove:e=>{!$&&1&e.buttons&&U(H(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, ${le||"black"}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`},children:/* @__PURE__ */w("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:`${R}%`,...N(le||"black",R),...M}})}),
6
+ /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":O.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*q.v),"aria-valuetext":O.squareValue(Math.round(100*q.s),Math.round(100*q.v)),"aria-disabled":$||void 0,"data-color-square":"",onKeyDown:e=>{if($)return;const r=P(q,e.key,e.shiftKey);r&&(e.preventDefault(),V(r))},...ee,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:t({h:q.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */w("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:ne(q.s),top:ne(1-q.v),...M}})}),
7
+ /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":O.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(q.h),"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-hue":"",onKeyDown:e=>{if($)return;const r=A(q.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),V({...q,h:r}))},...re,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:i},children:/* @__PURE__ */w("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:q.h/360*100+"%",background:t({h:q.h,s:1,v:1}),...M}})}),S&&/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":O.opacity(s),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":R,"aria-valuetext":`${R}%`,"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-opacity":"",onKeyDown:e=>{if($)return;const r=j(R,e.key,e.shiftKey);null!==r&&(e.preventDefault(),U(r))},onPointerDown:e=>{$||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),U(W(e)))},onPointerMove:e=>{!$&&1&e.buttons&&U(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, ${le||"black"}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`},children:/* @__PURE__ */w("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:`${R}%`,...N(le||"black",R),...M}})}),
8
8
  /* @__PURE__ */x("div",{className:"flex items-center gap-2",children:[
9
9
  /* @__PURE__ */w("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-gray-300",style:N(le,S?R:null)}),
10
- /* @__PURE__ */w(T,{value:ae,placeholder:!e&&q?l(q):void 0,onChange:G,label:L.hex(s),disabled:$}),S&&/* @__PURE__ */w(E,{value:R,onChange:U,label:L.opacity(s),disabled:$})]})]})})}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)]"},K={sm:"h-6",md:"h-8",lg:"h-10"},O=["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-gray-800 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:a,placeholder:o,disabled:t,id:i,size:c="md",look:u="box",className:h=""}){const[g,p]=b(null),m="text"===u?`${O} ${K[c]} ${h}`.trim():d({size:c,className:`${B[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
11
- return w("input",{id:i,type:"text",value:g??(e?l(e):""),"aria-label":a,placeholder:o,maxLength:s,spellCheck:!1,autoComplete:"off",disabled:t,onChange:a=>{p(a.target.value);const o=n(a.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(null),"data-hex-look":u,className:m})}function E({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
12
- return w("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */w(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function L({value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:h=!1,opacity:p,onOpacityChange:b,size:m="md",align:f="start",open:y,onOpenChange:k,className:z=""}){const D=g().color,I=C(p),A=v(),P=n(s??""),M=r||P||"",j=r?l(r):P?l(P):D.none;
10
+ /* @__PURE__ */w(T,{value:ae,placeholder:!e&&H?l(H):void 0,onChange:G,label:O.hex(s),disabled:$}),S&&/* @__PURE__ */w(L,{value:R,onChange:U,label:O.opacity(s),disabled:$})]})]})})}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)]"},K={sm:"h-6",md:"h-8",lg:"h-10"},E=["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-gray-800 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:a,placeholder:o,disabled:t,id:i,size:c="md",look:u="box",className:h=""}){const[g,p]=b(null),m="text"===u?`${E} ${K[c]} ${h}`.trim():d({size:c,className:`${B[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
11
+ return w("input",{id:i,type:"text",value:g??(e?l(e):""),"aria-label":a,placeholder:o,maxLength:s,spellCheck:!1,autoComplete:"off",disabled:t,onChange:a=>{p(a.target.value);const o=n(a.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(null),"data-hex-look":u,className:m})}function L({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
12
+ return w("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */w(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function O({value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:h=!1,opacity:p,onOpacityChange:b,size:m="md",align:f="start",open:y,onOpenChange:k,className:z=""}){const D=g().color,I=C(p),P=v(),A=n(s??""),M=r||A||"",j=r?l(r):A?l(A):D.none;
13
13
  /* @__PURE__ */
14
14
  return x("div",{className:`inline-flex items-center ${b?"flex-wrap justify-end gap-1":h?"gap-1":"gap-2"} ${z}`.trim(),children:[
15
- /* @__PURE__ */w(e,{id:d,trigger:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(M,b?I:null)}),triggerLabel:D.swatch(o,j),triggerClassName:$({size:m}),"aria-label":D.panel(o),align:f,open:y,onOpenChange:k,disabled:u,children:/* @__PURE__ */w(S,{id:A,value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),h&&
16
- /* @__PURE__ */w(T,{value:r,placeholder:!r&&P?l(P):void 0,onChange:e=>{u||e===r||a(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */w(E,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{L as ColorPicker,S as ColorPickerPanel,z as ColorSwatch,T as HexInput,k as NO_COLOR_FILL,C as clampOpacity,N as colorFill,$ as colorSwatchClasses,P as stepHue,j as stepOpacity,A as stepSquare};
15
+ /* @__PURE__ */w(e,{id:d,trigger:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(M,b?I:null)}),triggerLabel:D.swatch(o,j),triggerClassName:$({size:m}),"aria-label":D.panel(o),align:f,open:y,onOpenChange:k,disabled:u,children:/* @__PURE__ */w(S,{id:P,value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),h&&
16
+ /* @__PURE__ */w(T,{value:r,placeholder:!r&&A?l(A):void 0,onChange:e=>{u||e===r||a(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */w(L,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{O as ColorPicker,S as ColorPickerPanel,z as ColorSwatch,T as HexInput,k as NO_COLOR_FILL,C as clampOpacity,N as colorFill,$ as colorSwatchClasses,A as stepHue,j as stepOpacity,P as stepSquare};
@@ -1,5 +1,5 @@
1
- import{InputNumber_default as e}from"./chunk-ZCHBOAPA.js";import{useSettingAuto as t,useInSettingRow as i}from"./chunk-L65BESIE.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{createContext as r,useState as l,useMemo as a,useId as o,useRef as d,useContext as s,useEffect as u,useLayoutEffect as c}from"react";import{jsx as m,jsxs as f}from"react/jsx-runtime";var p=(e,t,i)=>Math.min(i,Math.max(t,e));function h(e){const t=String(e),i=/e-(\d+)$/.exec(t);return i?Number(i[1]):t.split(".")[1]?.length??0}var v=8,x=40;function b(e){return Math.max(1,...e.map(e=>(e??"").length))}var w="undefined"==typeof window?u:c;function y(e,t,i,n){return Number(p(e,t,i).toFixed(n))}var g=r(null);function S({children:e}){const[t,i]=l({}),n=a(()=>(e,t)=>i(i=>{if(null===t){if(!(e in i))return i;const t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}}),[]),r=a(()=>{const e=Object.values(t);return{set:n,width:e.length?`max(${e.join(", ")})`:null}},[t,n]);/* @__PURE__ */
2
- return m(g.Provider,{value:r,children:e})}function z({value:r,onChange:a,min:c,max:S,step:z=1,shiftStep:F,precision:$,inputMin:k,inputMax:C,suffix:L,showInput:N=!0,emptyLabel:j,placeholderValue:A,stepFrom:E,label:K,"aria-labelledby":M,valueText:B,id:D,disabled:O,size:R="md",className:I="",auto:P}){const U=n(),V=o(),W=t(),q=P??W,G=o(),H=D??V,T=$??h(z),Z=k??c,J=C??S,Q=void 0!==j||void 0!==A,X=E??A,Y=p(r??A??c,c,S),_=d(null),[ee,te]=l(null),ie=Boolean(L);w(()=>{const e=()=>{const e=_.current?.querySelector("input");if(!e)return;const t=getComputedStyle(e),i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,i)=>e+(parseFloat(t[i])||0),0);i<=0||te(e=>e&&e.frame===i&&e.fontSize===t.fontSize?e:{frame:i,fontSize:t.fontSize})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[ie,N]);const ne=e=>B?B(e):"string"==typeof L?`${e.toFixed(T)} ${L}`:void 0,re=null==r?j??(null!=A?ne(A)??String(A):void 0):ne(r),le=`calc(${b([c.toFixed(T),S.toFixed(T),r?.toFixed(T),j,A?.toFixed(T)])}ch + ${(ee?.frame??10+(ie?x:v))+2}px)`,ae=s(g),oe=o(),de=ae?.set;w(()=>{de&&de(oe,N?le:null)},[de,oe,le,N]),u(()=>()=>de?.(oe,null),[de,oe]);const se=i();/* @__PURE__ */
1
+ import{InputNumber_default as e}from"./chunk-5E3WCKWB.js";import{useSettingAuto as t,useInSettingRow as i}from"./chunk-L65BESIE.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{createContext as r,useState as l,useMemo as a,useId as o,useRef as d,useContext as s,useEffect as u,useLayoutEffect as c}from"react";import{jsx as m,jsxs as f}from"react/jsx-runtime";var p=(e,t,i)=>Math.min(i,Math.max(t,e));function h(e){const t=String(e),i=/e-(\d+)$/.exec(t);return i?Number(i[1]):t.split(".")[1]?.length??0}var v=8,x=40;function b(e){return Math.max(1,...e.map(e=>(e??"").length))}var w="undefined"==typeof window?u:c;function y(e,t,i,n){return Number(p(e,t,i).toFixed(n))}var g=r(null);function S({children:e}){const[t,i]=l({}),n=a(()=>(e,t)=>i(i=>{if(null===t){if(!(e in i))return i;const t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}}),[]),r=a(()=>{const e=Object.values(t);return{set:n,width:e.length?`max(${e.join(", ")})`:null}},[t,n]);/* @__PURE__ */
2
+ return m(g.Provider,{value:r,children:e})}function z({value:r,onChange:a,min:c,max:S,step:z=1,shiftStep:F,precision:$,inputMin:k,inputMax:C,suffix:E,showInput:L=!0,emptyLabel:N,placeholderValue:j,stepFrom:K,label:M,"aria-labelledby":A,valueText:W,id:B,disabled:D,size:R="md",className:I="",auto:O}){const U=n(),V=o(),q=t(),G=O??q,P=o(),T=B??V,H=$??h(z),J=k??c,Q=C??S,X=void 0!==N||void 0!==j,Y=K??j,Z=p(r??j??c,c,S),_=d(null),[ee,te]=l(null),ie=Boolean(E);w(()=>{const e=()=>{const e=_.current?.querySelector("input");if(!e)return;const t=getComputedStyle(e),i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,i)=>e+(parseFloat(t[i])||0),0);i<=0||te(e=>e&&e.frame===i&&e.fontSize===t.fontSize?e:{frame:i,fontSize:t.fontSize})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[ie,L]);const ne=e=>W?W(e):"string"==typeof E?`${e.toFixed(H)} ${E}`:void 0,re=null==r?N??(null!=j?ne(j)??String(j):void 0):ne(r),le=`calc(${b([c.toFixed(H),S.toFixed(H),r?.toFixed(H),N,j?.toFixed(H)])}ch + ${(ee?.frame??10+(ie?x:v))+2}px)`,ae=s(g),oe=o(),de=ae?.set;w(()=>{de&&de(oe,L?le:null)},[de,oe,le,L]),u(()=>()=>de?.(oe,null),[de,oe]);const se=i();/* @__PURE__ */
3
3
  return f("div",{"data-slider":"",className:`flex w-full min-w-0 items-center ${se?"flex-wrap gap-2":"gap-3"} ${I}`.trim(),children:[
4
- /* @__PURE__ */m("input",{id:H,type:"range",min:c,max:S,step:z,value:Y,disabled:O,"aria-label":M?void 0:K,"aria-labelledby":M,"aria-valuetext":re,"aria-describedby":q?G:void 0,onKeyDown:e=>{const t="ArrowUp"===e.key||"ArrowRight"===e.key?1:"ArrowDown"===e.key||"ArrowLeft"===e.key?-1:0;if(!t||e.altKey||e.ctrlKey||e.metaKey)return;const i=e.shiftKey&&null!=F;if(!i&&!(null==r&&null!=X))return;e.preventDefault();a(y((r??X??Y)+t*(i?F??z:z),c,S,T))},onChange:e=>a(y(Number(e.target.value),c,S,T)),className:`min-w-24 flex-1 ${se?"basis-24":""} cursor-pointer accent-blue-600 disabled:cursor-not-allowed disabled:opacity-60 ${"sm"===R?"h-1":"h-1.5"}`}),N&&
5
- /* @__PURE__ */m("div",{ref:_,"data-slider-box":"",className:se?"ml-auto shrink-0":"shrink-0 text-xs",style:se?void 0:{width:ae?.width??le,...ee?{fontSize:ee.fontSize}:{}},children:/* @__PURE__ */m(e,{value:r,onChange:e=>{null!=e?e<Z||e>J||a(e):Q&&a(null)},min:Z,max:J,step:z,shiftStep:F,stepFrom:X,precision:T,snap:!0,allowEmpty:Q,suffix:L,disabled:O,placeholder:j??(null!=A?A.toFixed(T):void 0),size:se?void 0:"sm",auto:q,"aria-label":K?U.slider.value(K):void 0,"aria-labelledby":K?void 0:M})}),q&&/* @__PURE__ */m("span",{id:G,hidden:!0,children:U.settingView.auto})]})}export{z as Slider,S as SliderGroup,y as settleSliderValue,b as sliderBoxChars,h as stepDecimals};
4
+ /* @__PURE__ */m("input",{id:T,type:"range",min:c,max:S,step:z,value:Z,disabled:D,"aria-label":A?void 0:M,"aria-labelledby":A,"aria-valuetext":re,"aria-describedby":G?P:void 0,onKeyDown:e=>{const t="ArrowUp"===e.key||"ArrowRight"===e.key?1:"ArrowDown"===e.key||"ArrowLeft"===e.key?-1:0;if(!t||e.altKey||e.ctrlKey||e.metaKey)return;const i=e.shiftKey&&null!=F;if(!i&&!(null==r&&null!=Y))return;e.preventDefault();a(y((r??Y??Z)+t*(i?F??z:z),c,S,H))},onChange:e=>a(y(Number(e.target.value),c,S,H)),className:`min-w-24 flex-1 ${se?"basis-24":""} cursor-pointer accent-blue-600 disabled:cursor-not-allowed disabled:opacity-60 ${"sm"===R?"h-1":"h-1.5"}`}),L&&
5
+ /* @__PURE__ */m("div",{ref:_,"data-slider-box":"",className:se?"ml-auto shrink-0":"shrink-0 text-xs",style:se?void 0:{width:ae?.width??le,...ee?{fontSize:ee.fontSize}:{}},children:/* @__PURE__ */m(e,{value:r,onChange:e=>{null!=e?e<J||e>Q||a(e):X&&a(null)},min:J,max:Q,step:z,shiftStep:F,stepFrom:Y,precision:H,snap:!0,allowEmpty:X,suffix:E,disabled:D,placeholder:N??(null!=j?j.toFixed(H):void 0),size:se?void 0:"sm",auto:G,"aria-label":M?U.slider.value(M):void 0,"aria-labelledby":M?void 0:A})}),G&&/* @__PURE__ */m("span",{id:P,hidden:!0,children:U.settingView.auto})]})}export{z as Slider,S as SliderGroup,y as settleSliderValue,b as sliderBoxChars,h as stepDecimals};
@@ -1,12 +1,12 @@
1
- import{IconButton_default as e}from"./chunk-4CANQ3B3.js";import{CloseGlyph as t}from"./chunk-4Y4PWKMM.js";import{humanSize as n,useFileIntake as r,FileIntakeAlert as a}from"./chunk-YDYDR72S.js";import{Button_default as s}from"./chunk-4IU5BSVE.js";import{Icon as i}from"./chunk-FSPFV4MI.js";import{useShellStrings as c}from"./chunk-E6UCGCOC.js";import{useRef as o,useEffect as l}from"react";import{jsx as d,jsxs as u}from"react/jsx-runtime";function m({className:e="h-4 w-4"}){/* @__PURE__ */
1
+ import{CloseGlyph as e}from"./chunk-4Y4PWKMM.js";import{IconButton_default as t}from"./chunk-4CANQ3B3.js";import{humanSize as n,useFileIntake as r,FileIntakeAlert as a}from"./chunk-YDYDR72S.js";import{Button_default as s}from"./chunk-4IU5BSVE.js";import{Icon as i}from"./chunk-FSPFV4MI.js";import{useShellStrings as c}from"./chunk-E6UCGCOC.js";import{useRef as o,useEffect as l}from"react";import{jsx as d,jsxs as u}from"react/jsx-runtime";function m({className:e="h-4 w-4"}){/* @__PURE__ */
2
2
  return d(i,{name:"attach",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function p({className:e="h-4 w-4"}){/* @__PURE__ */
3
3
  return d(i,{name:"page",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function h({intake:e,dropLabel:t,className:n="",children:r}){const a=c().files;/* @__PURE__ */
4
4
  return u("div",{...e.zoneProps,...e.pasteProps,className:`relative ${n}`,children:[r,
5
- /* @__PURE__ */d("input",{...e.inputProps}),e.dragOver&&/* @__PURE__ */d("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-lg border-2 border-dashed border-blue-500 bg-blue-50/80 text-sm font-medium text-blue-600",children:t??a.drop})]})}function b({files:e,onRemove:r,disabled:a=!1,className:s=""}){const i=c().files,m=o(/* @__PURE__ */new Map);l(()=>{const t=new Set(e);for(const[e,n]of m.current)t.has(e)||(URL.revokeObjectURL(n),m.current.delete(e))},[e]),l(()=>()=>{for(const e of m.current.values())URL.revokeObjectURL(e);m.current.clear()},[]);const h=e=>{if(!e.type.startsWith("image/")||"undefined"==typeof URL||"function"!=typeof URL.createObjectURL)return null;let t=m.current.get(e);return t||(t=URL.createObjectURL(e),m.current.set(e,t)),t};return 0===e.length?null:/* @__PURE__ */d("ul",{className:`flex flex-wrap gap-2 ${s}`,children:e.map((e,s)=>{const c=h(e);/* @__PURE__ */
5
+ /* @__PURE__ */d("input",{...e.inputProps}),e.dragOver&&/* @__PURE__ */d("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-lg border-2 border-dashed border-blue-500 bg-blue-50/80 text-sm font-medium text-blue-600",children:t??a.drop})]})}function b({files:t,onRemove:r,disabled:a=!1,className:s=""}){const i=c().files,m=o(/* @__PURE__ */new Map);l(()=>{const e=new Set(t);for(const[t,n]of m.current)e.has(t)||(URL.revokeObjectURL(n),m.current.delete(t))},[t]),l(()=>()=>{for(const e of m.current.values())URL.revokeObjectURL(e);m.current.clear()},[]);const h=e=>{if(!e.type.startsWith("image/")||"undefined"==typeof URL||"function"!=typeof URL.createObjectURL)return null;let t=m.current.get(e);return t||(t=URL.createObjectURL(e),m.current.set(e,t)),t};return 0===t.length?null:/* @__PURE__ */d("ul",{className:`flex flex-wrap gap-2 ${s}`,children:t.map((t,s)=>{const c=h(t);/* @__PURE__ */
6
6
  return u("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-gray-200 bg-gray-50 py-1 pl-2 pr-1 text-xs text-gray-700",children:[c?/* @__PURE__ */d("img",{src:c,alt:"",className:"h-6 w-6 shrink-0 rounded object-cover"}):/* @__PURE__ */d("span",{className:"text-gray-400",children:/* @__PURE__ */d(p,{})}),
7
- /* @__PURE__ */d("span",{className:"min-w-0 truncate",title:e.name,children:e.name}),
8
- /* @__PURE__ */d("span",{className:"shrink-0 tabular-nums text-gray-400",children:n(e.size,i)}),r&&/* @__PURE__ */d("button",{type:"button",disabled:a,onClick:()=>r(s),"aria-label":i.remove(e.name),className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-200 hover:text-gray-600 disabled:cursor-not-allowed",children:/* @__PURE__ */d(t,{className:"h-3.5 w-3.5"})})]},`${e.name}-${e.size}-${s}`)})})}function f({onClick:t,count:n=0,variant:r="button",label:a,disabled:i=!1}){const o=c().files,l=a??o.attach,p=n>0?`${l} (${n})`:l;return"icon"===r?/* @__PURE__ */u("span",{className:"relative inline-flex",children:[
9
- /* @__PURE__ */d(e,{"aria-label":p,onClick:t,disabled:i,size:"sm",children:/* @__PURE__ */d(m,{})}),n>0&&/* @__PURE__ */d("span",{"aria-hidden":"true",className:"pointer-events-none absolute -right-1 -top-1 min-w-[1rem] rounded-full bg-blue-600 px-1 text-center text-2xs font-semibold leading-4 text-white",children:n})]}):/* @__PURE__ */d(s,{type:"button",variant:"secondary",size:"sm",onClick:t,disabled:i,leftIcon:/* @__PURE__ */d(m,{}),children:p})}function g({files:e,onChange:t,accept:n,maxSizeBytes:s,maxFiles:i,acceptHint:c,disabled:m=!1,dropLabel:p,attachLabel:g,trigger:x="button",actions:j,onReject:k,className:N="",children:v}){const y=r({accept:n,maxSizeBytes:s,maxFiles:i,acceptHint:c,disabled:m,multiple:!0,currentCount:e.length,onAccept:n=>t([...e,...n])}),L=o([]);return l(()=>{k&&y.rejections.length>0&&y.rejections!==L.current&&(L.current=y.rejections,k(y.rejections))},[y.rejections,k]),/* @__PURE__ */u(h,{intake:y,dropLabel:p,className:N,children:[v,
7
+ /* @__PURE__ */d("span",{className:"min-w-0 truncate",title:t.name,children:t.name}),
8
+ /* @__PURE__ */d("span",{className:"shrink-0 tabular-nums text-gray-400",children:n(t.size,i)}),r&&/* @__PURE__ */d("button",{type:"button",disabled:a,onClick:()=>r(s),"aria-label":i.remove(t.name),className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-200 hover:text-gray-600 disabled:cursor-not-allowed",children:/* @__PURE__ */d(e,{className:"h-3.5 w-3.5"})})]},`${t.name}-${t.size}-${s}`)})})}function f({onClick:e,count:n=0,variant:r="button",label:a,disabled:i=!1}){const o=c().files,l=a??o.attach,p=n>0?`${l} (${n})`:l;return"icon"===r?/* @__PURE__ */u("span",{className:"relative inline-flex",children:[
9
+ /* @__PURE__ */d(t,{"aria-label":p,onClick:e,disabled:i,size:"sm",children:/* @__PURE__ */d(m,{})}),n>0&&/* @__PURE__ */d("span",{"aria-hidden":"true",className:"pointer-events-none absolute -right-1 -top-1 min-w-[1rem] rounded-full bg-blue-600 px-1 text-center text-2xs font-semibold leading-4 text-white",children:n})]}):/* @__PURE__ */d(s,{type:"button",variant:"secondary",size:"sm",onClick:e,disabled:i,leftIcon:/* @__PURE__ */d(m,{}),children:p})}function g({files:e,onChange:t,accept:n,maxSizeBytes:s,maxFiles:i,acceptHint:c,disabled:m=!1,dropLabel:p,attachLabel:g,trigger:x="button",actions:j,onReject:k,className:N="",children:v}){const y=r({accept:n,maxSizeBytes:s,maxFiles:i,acceptHint:c,disabled:m,multiple:!0,currentCount:e.length,onAccept:n=>t([...e,...n])}),L=o([]);return l(()=>{k&&y.rejections.length>0&&y.rejections!==L.current&&(L.current=y.rejections,k(y.rejections))},[y.rejections,k]),/* @__PURE__ */u(h,{intake:y,dropLabel:p,className:N,children:[v,
10
10
  /* @__PURE__ */d(b,{files:e,disabled:m,onRemove:n=>{y.clearRejections(),t(e.filter((e,t)=>t!==n))},className:"mt-2"}),
11
11
  /* @__PURE__ */u("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[
12
12
  /* @__PURE__ */d(f,{onClick:y.open,count:e.length,variant:x,label:g,disabled:m}),j]}),
@@ -1,27 +1,27 @@
1
- import{Dialog as e}from"./chunk-SG3ILR7W.js";import{buttonClasses as t}from"./chunk-K7U4RWXJ.js";import{Icon as r}from"./chunk-FSPFV4MI.js";import{useShellStrings as n,splitAround as o}from"./chunk-E6UCGCOC.js";import{createContext as l,useContext as a,useState as i,useRef as s,useCallback as c,useEffect as u}from"react";import{jsxs as d,jsx as m,Fragment as h}from"react/jsx-runtime";var b=l(()=>Promise.resolve(!1)),f=()=>a(b),g=()=>Promise.resolve(!1),p=e=>g(e),y=()=>Promise.resolve(!1),v=e=>y(e),x=()=>Promise.resolve(null),N=e=>x(e),k={danger:{icon:"text-red-600 bg-red-100",button:t({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:t({variant:"warning"})},info:{icon:"text-blue-600 bg-blue-100",button:t({variant:"primary"})}},w=t({variant:"secondary"}),C=t({variant:"primary"}),L="w-full rounded-md border border-gray-300 h-8 px-3 text-sm";function P(){/* @__PURE__ */
1
+ import{Dialog as e}from"./chunk-GNPTNAZH.js";import{buttonClasses as t}from"./chunk-K7U4RWXJ.js";import{Icon as r}from"./chunk-FSPFV4MI.js";import{useShellStrings as n,splitAround as o}from"./chunk-E6UCGCOC.js";import{createContext as l,useContext as a,useState as i,useRef as s,useCallback as c,useEffect as u}from"react";import{jsxs as d,jsx as m,Fragment as h}from"react/jsx-runtime";var b=l(()=>Promise.resolve(!1)),f=()=>a(b),g=()=>Promise.resolve(!1),p=e=>g(e),y=()=>Promise.resolve(!1),v=e=>y(e),x=()=>Promise.resolve(null),N=e=>x(e),k={danger:{icon:"text-red-600 bg-red-100",button:t({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:t({variant:"warning"})},info:{icon:"text-blue-600 bg-blue-100",button:t({variant:"primary"})}},w=t({variant:"secondary"}),C=t({variant:"primary"}),P="w-full rounded-md border border-gray-300 h-8 px-3 text-sm";function L(){/* @__PURE__ */
2
2
  return m(r,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function j(){/* @__PURE__ */
3
- return m(r,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function F({children:t}){const[r,l]=i(!1),[a,f]=i({message:""}),[p,v]=i(0),N=s(),F=s(null),E=s(0),W=s([]),T=s(null),$=s(null),K=c(e=>{F.current=e.id,N.current=e.resolve,v(e.id),f(e.options),l(!0)},[]),D=c(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const r={id:++E.current,options:t,resolve:e};null===F.current?K(r):W.current.push(r)})},[K]),[G,I]=i(!1),[R,S]=i({message:""}),[U,V]=i(""),J=s(),M=c(e=>(S(e),V(""),I(!0),new Promise(e=>{J.current=e})),[]),[O,X]=i(!1),[q,z]=i({}),[A,B]=i(""),H=s(),Q=c(e=>{const t="string"==typeof e?{message:e}:e;return z(t),B(t.defaultValue??""),X(!0),new Promise(e=>{H.current=e})},[]);u(()=>{g=D,y=M,x=Q},[D,M,Q]);const Y=(e,t)=>{if(F.current!==e)return;const r=N.current,n=W.current.shift();n?K(n):(F.current=null,N.current=void 0,l(!1)),r?.(t)},Z=e=>{I(!1),V(""),J.current?.(e)},_=e=>{if(e){const e=A.trim();if(!e&&!q.allowEmpty)return X(!1),void H.current?.(null);X(!1),H.current?.(e)}else X(!1),H.current?.(null)},ee=a.variant||(a.confirmLabel?.toLowerCase().includes("delete")||a.message.toLowerCase().includes("delete")?"danger":"info"),te=k[ee],re=k["warning"===R.variant?"warning":"danger"],ne=R.confirmWord,oe=null==ne||U===ne,le=n().dialog,[ae,ie]=o(le.typeToConfirm);/* @__PURE__ */
3
+ return m(r,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function F({children:t}){const[r,l]=i(!1),[a,f]=i({message:""}),[p,v]=i(0),N=s(),F=s(null),E=s(0),T=s([]),W=s(null),$=s(null),K=c(e=>{F.current=e.id,N.current=e.resolve,v(e.id),f(e.options),l(!0)},[]),D=c(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const r={id:++E.current,options:t,resolve:e};null===F.current?K(r):T.current.push(r)})},[K]),[G,U]=i(!1),[V,A]=i({message:""}),[H,I]=i(""),J=s(),M=c(e=>(A(e),I(""),U(!0),new Promise(e=>{J.current=e})),[]),[O,R]=i(!1),[S,X]=i({}),[Z,q]=i(""),z=s(),B=c(e=>{const t="string"==typeof e?{message:e}:e;return X(t),q(t.defaultValue??""),R(!0),new Promise(e=>{z.current=e})},[]);u(()=>{g=D,y=M,x=B},[D,M,B]);const Q=(e,t)=>{if(F.current!==e)return;const r=N.current,n=T.current.shift();n?K(n):(F.current=null,N.current=void 0,l(!1)),r?.(t)},Y=e=>{U(!1),I(""),J.current?.(e)},_=e=>{if(e){const e=Z.trim();if(!e&&!S.allowEmpty)return R(!1),void z.current?.(null);R(!1),z.current?.(e)}else R(!1),z.current?.(null)},ee=a.variant||(a.confirmLabel?.toLowerCase().includes("delete")||a.message.toLowerCase().includes("delete")?"danger":"info"),te=k[ee],re=k["warning"===V.variant?"warning":"danger"],ne=V.confirmWord,oe=null==ne||H===ne,le=n().dialog,[ae,ie]=o(le.typeToConfirm);/* @__PURE__ */
4
4
  return d(b.Provider,{value:D,children:[t,
5
- /* @__PURE__ */m(e,{open:r,onClose:()=>Y(p,!1),initialFocus:T,footer:/* @__PURE__ */d(h,{children:[
6
- /* @__PURE__ */m("button",{ref:T,type:"button",onClick:()=>Y(p,!1),className:w,children:a.cancelLabel||le.cancel}),
7
- /* @__PURE__ */m("button",{type:"button",onClick:()=>Y(p,!0),className:te.button,children:a.confirmLabel||le.ok})]}),children:/* @__PURE__ */d("div",{className:"flex gap-4",children:[
8
- /* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */m(P,{})}),
5
+ /* @__PURE__ */m(e,{open:r,onClose:()=>Q(p,!1),initialFocus:W,footer:/* @__PURE__ */d(h,{children:[
6
+ /* @__PURE__ */m("button",{ref:W,type:"button",onClick:()=>Q(p,!1),className:w,children:a.cancelLabel||le.cancel}),
7
+ /* @__PURE__ */m("button",{type:"button",onClick:()=>Q(p,!0),className:te.button,children:a.confirmLabel||le.ok})]}),children:/* @__PURE__ */d("div",{className:"flex gap-4",children:[
8
+ /* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */m(L,{})}),
9
9
  /* @__PURE__ */d("div",{className:"flex-1",children:[
10
10
  /* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900",children:a.title||le.confirmTitle}),
11
11
  /* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:a.message})]})]})}),
12
- /* @__PURE__ */d(e,{open:G,onClose:()=>Z(!1),initialFocus:null!=ne?void 0:$,footer:/* @__PURE__ */d(h,{children:[
13
- /* @__PURE__ */m("button",{ref:$,type:"button",onClick:()=>Z(!1),className:w,children:R.cancelLabel||le.destructiveCancel}),
14
- /* @__PURE__ */m("button",{type:"button",onClick:()=>Z(!0),disabled:!oe,className:re.button,children:ne??R.confirmLabel??le.destructiveConfirm})]}),children:[
15
- /* @__PURE__ */m("button",{type:"button",onClick:()=>Z(!1),"aria-label":le.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */m(j,{})}),
12
+ /* @__PURE__ */d(e,{open:G,onClose:()=>Y(!1),initialFocus:null!=ne?void 0:$,footer:/* @__PURE__ */d(h,{children:[
13
+ /* @__PURE__ */m("button",{ref:$,type:"button",onClick:()=>Y(!1),className:w,children:V.cancelLabel||le.destructiveCancel}),
14
+ /* @__PURE__ */m("button",{type:"button",onClick:()=>Y(!0),disabled:!oe,className:re.button,children:ne??V.confirmLabel??le.destructiveConfirm})]}),children:[
15
+ /* @__PURE__ */m("button",{type:"button",onClick:()=>Y(!1),"aria-label":le.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */m(j,{})}),
16
16
  /* @__PURE__ */d("div",{className:"flex gap-4",children:[
17
- /* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${re.icon}`,children:/* @__PURE__ */m(P,{})}),
17
+ /* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${re.icon}`,children:/* @__PURE__ */m(L,{})}),
18
18
  /* @__PURE__ */d("div",{className:"flex-1",children:[
19
- /* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:R.title||le.destructiveTitle}),
20
- /* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:R.message}),null!=ne&&/* @__PURE__ */d(h,{children:[
19
+ /* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:V.title||le.destructiveTitle}),
20
+ /* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:V.message}),null!=ne&&/* @__PURE__ */d(h,{children:[
21
21
  /* @__PURE__ */d("p",{className:"mt-3 text-sm text-gray-700",children:[ae,
22
22
  /* @__PURE__ */m("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:ne}),ie]}),
23
- /* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:U,onChange:e=>V(e.target.value),onKeyDown:e=>{"Enter"===e.key&&U===ne&&Z(!0)},placeholder:ne,className:`mt-2 ${L} focus:border-red-500`})]})]})]})]}),
24
- /* @__PURE__ */d(e,{open:O,onClose:()=>_(!1),title:q.title||le.promptTitle,footer:/* @__PURE__ */d(h,{children:[
25
- /* @__PURE__ */m("button",{type:"button",onClick:()=>_(!1),className:w,children:q.cancelLabel||le.cancel}),
26
- /* @__PURE__ */m("button",{type:"button",onClick:()=>_(!0),disabled:!q.allowEmpty&&!A.trim(),className:C,children:q.confirmLabel||le.ok})]}),children:[q.message&&/* @__PURE__ */m("p",{className:"text-sm text-gray-600",children:q.message}),
27
- /* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:A,onChange:e=>B(e.target.value),onKeyDown:e=>{"Enter"===e.key?_(!0):"Escape"===e.key&&_(!1)},onFocus:e=>e.target.select(),placeholder:q.placeholder,className:`mt-3 ${L} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{F as ConfirmProvider,p as confirm,v as confirmDestructive,N as prompt,f as useConfirm};
23
+ /* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:H,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&H===ne&&Y(!0)},placeholder:ne,className:`mt-2 ${P} focus:border-red-500`})]})]})]})]}),
24
+ /* @__PURE__ */d(e,{open:O,onClose:()=>_(!1),title:S.title||le.promptTitle,footer:/* @__PURE__ */d(h,{children:[
25
+ /* @__PURE__ */m("button",{type:"button",onClick:()=>_(!1),className:w,children:S.cancelLabel||le.cancel}),
26
+ /* @__PURE__ */m("button",{type:"button",onClick:()=>_(!0),disabled:!S.allowEmpty&&!Z.trim(),className:C,children:S.confirmLabel||le.ok})]}),children:[S.message&&/* @__PURE__ */m("p",{className:"text-sm text-gray-600",children:S.message}),
27
+ /* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:Z,onChange:e=>q(e.target.value),onKeyDown:e=>{"Enter"===e.key?_(!0):"Escape"===e.key&&_(!1)},onFocus:e=>e.target.select(),placeholder:S.placeholder,className:`mt-3 ${P} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{F as ConfirmProvider,p as confirm,v as confirmDestructive,N as prompt,f as useConfirm};
@@ -1,2 +1,2 @@
1
- import{renderMenuEntries as e,menuStatusIds as t}from"./chunk-Y6IQYQYN.js";import{PopupMenu as n,MenuSemanticsContext as r}from"./chunk-DXTKNHWG.js";import{leavesContextMenuAlone as o}from"./chunk-5QFPTDQF.js";import{placeAtPoint as i,popupBounds as l}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as c}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as u}from"./chunk-TWVUQUUD.js";import{useRef as s,useId as a,useState as d,useEffect as m,useCallback as f}from"react";import{jsx as p,jsxs as v}from"react/jsx-runtime";function h(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(e=>!e.closest("[data-popup-submenu-panel]")):[]}function w({at:o,onClose:w,items:y,linkAs:g,children:k,owner:E,"aria-label":b,minWidth:x=180,className:H="",autoFocus:D=!0}){const L=s(null),j=a(),[A,S]=d(null),U=s(w);U.current=w,c(()=>{const e=L.current?.closest("[data-popup-menu-tree]");if(!e)return;const t={width:e.offsetWidth,height:e.offsetHeight},n=i({point:o,menu:t,bounds:l(E??null)});S(e=>e&&e.left===n.left&&e.top===n.top&&e.maxHeight===n.maxHeight?e:{left:n.left,top:n.top,maxHeight:n.maxHeight,scroll:t.height>n.maxHeight})},[o.x,o.y,E]);const C=s(null),Q=s(!1);m(()=>(C.current=document.activeElement,()=>{const e=document.activeElement;e&&e!==document.body&&!L.current?.contains(e)||C.current?.focus?.({preventScroll:!0})}),[]),m(()=>{A&&!Q.current&&D&&(Q.current=!0,h(L.current)[0]?.focus({preventScroll:!0}))},[A,D]),m(()=>{if(D)return;const e=e=>{if(L.current?.contains(document.activeElement))return;const t=h(L.current),n="ArrowDown"===e.key||"Home"===e.key?t[0]:"ArrowUp"===e.key||"End"===e.key?t[t.length-1]:void 0;n&&(e.preventDefault(),n.focus({preventScroll:!0}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D]),m(()=>u(e=>"Escape"===e.key&&(U.current(),!0),()=>L.current),[]),m(()=>{const e=()=>U.current();return window.addEventListener("resize",e),window.addEventListener("blur",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("blur",e),window.removeEventListener("scroll",e,!0)}},[]);const T=f(e=>{if(e.target.closest("[data-popup-submenu-panel]"))return;if("Tab"===e.key)return e.preventDefault(),void U.current();const t=h(L.current);if(0===t.length)return;const n=t.indexOf(document.activeElement),r="ArrowDown"===e.key?(n+1)%t.length:"ArrowUp"===e.key?n<=0?t.length-1:n-1:"Home"===e.key?0:"End"===e.key?t.length-1:-1;r<0||(e.preventDefault(),t[r].focus())},[]),W=A?{left:A.left,top:A.top,maxHeight:A.maxHeight,...A.scroll?{overflowY:"auto"}:{}}:{left:o.x,top:o.y,visibility:"hidden"};/* @__PURE__ */
2
- return p(n,{portal:!0,minWidth:x,style:W,onClose:w,className:H,children:/* @__PURE__ */p(r.Provider,{value:!0,children:/* @__PURE__ */v("div",{ref:L,id:j,role:"menu","aria-label":b,"aria-describedby":y?t(y,j):void 0,"data-context-menu":"",onKeyDown:T,children:[y&&e(y,{menuId:j,choose:e=>{e.disabled||(U.current(),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>U.current(),linkAs:g}),k]})})})}function y(){const[e,t]=d(null),n=f(()=>t(null),[]),r=f((e,n)=>{const r="nativeEvent"in e?e.nativeEvent:e;if(o(r))return!1;e.preventDefault();const i=e.target instanceof Element?e.target:null;let{clientX:l,clientY:c}=e;if(0===l&&0===c&&i){const e=i.getBoundingClientRect();l=e.left,c=e.bottom}return t({x:l,y:c,data:n,owner:i}),!0},[]),i=f(e=>{r(e,void 0)},[r]);return{open:r,onContextMenu:i,close:n,state:e,props:{at:{x:e?.x??0,y:e?.y??0},owner:e?.owner??null,onClose:n}}}export{w as ContextMenu,y as useContextMenu};
1
+ import{renderMenuEntries as e,menuStatusIds as t}from"./chunk-3BSPSRK4.js";import{PopupMenu as n,MenuSemanticsContext as r}from"./chunk-L5ND7FNA.js";import{leavesContextMenuAlone as o}from"./chunk-5QFPTDQF.js";import{placeAtPoint as i,popupBounds as l}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as c}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as u}from"./chunk-TWVUQUUD.js";import{useRef as s,useId as a,useState as d,useEffect as m,useCallback as f}from"react";import{jsx as p,jsxs as v}from"react/jsx-runtime";function h(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(e=>!e.closest("[data-popup-submenu-panel]")):[]}function w({at:o,onClose:w,items:y,linkAs:g,children:k,owner:E,"aria-label":b,minWidth:x=180,className:D="",autoFocus:H=!0}){const L=s(null),S=a(),[A,j]=d(null),U=s(w);U.current=w,c(()=>{const e=L.current?.closest("[data-popup-menu-tree]");if(!e)return;const t={width:e.offsetWidth,height:e.offsetHeight},n=i({point:o,menu:t,bounds:l(E??null)});j(e=>e&&e.left===n.left&&e.top===n.top&&e.maxHeight===n.maxHeight?e:{left:n.left,top:n.top,maxHeight:n.maxHeight,scroll:t.height>n.maxHeight})},[o.x,o.y,E]);const C=s(null),F=s(!1);m(()=>(C.current=document.activeElement,()=>{const e=document.activeElement;e&&e!==document.body&&!L.current?.contains(e)||C.current?.focus?.({preventScroll:!0})}),[]),m(()=>{A&&!F.current&&H&&(F.current=!0,h(L.current)[0]?.focus({preventScroll:!0}))},[A,H]),m(()=>{if(H)return;const e=e=>{if(L.current?.contains(document.activeElement))return;const t=h(L.current),n="ArrowDown"===e.key||"Home"===e.key?t[0]:"ArrowUp"===e.key||"End"===e.key?t[t.length-1]:void 0;n&&(e.preventDefault(),n.focus({preventScroll:!0}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[H]),m(()=>u(e=>"Escape"===e.key&&(U.current(),!0),()=>L.current),[]),m(()=>{const e=()=>U.current();return window.addEventListener("resize",e),window.addEventListener("blur",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("blur",e),window.removeEventListener("scroll",e,!0)}},[]);const N=f(e=>{if(e.target.closest("[data-popup-submenu-panel]"))return;if("Tab"===e.key)return e.preventDefault(),void U.current();const t=h(L.current);if(0===t.length)return;const n=t.indexOf(document.activeElement),r="ArrowDown"===e.key?(n+1)%t.length:"ArrowUp"===e.key?n<=0?t.length-1:n-1:"Home"===e.key?0:"End"===e.key?t.length-1:-1;r<0||(e.preventDefault(),t[r].focus())},[]),T=A?{left:A.left,top:A.top,maxHeight:A.maxHeight,...A.scroll?{overflowY:"auto"}:{}}:{left:o.x,top:o.y,visibility:"hidden"};/* @__PURE__ */
2
+ return p(n,{portal:!0,minWidth:x,style:T,onClose:w,className:D,children:/* @__PURE__ */p(r.Provider,{value:!0,children:/* @__PURE__ */v("div",{ref:L,id:S,role:"menu","aria-label":b,"aria-describedby":y?t(y,S):void 0,"data-context-menu":"",onKeyDown:N,children:[y&&e(y,{menuId:S,choose:e=>{e.disabled||(U.current(),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>U.current(),linkAs:g}),k]})})})}function y(){const[e,t]=d(null),n=f(()=>t(null),[]),r=f((e,n)=>{const r="nativeEvent"in e?e.nativeEvent:e;if(o(r))return!1;e.preventDefault();const i=e.target instanceof Element?e.target:null;let{clientX:l,clientY:c}=e;if(0===l&&0===c&&i){const e=i.getBoundingClientRect();l=e.left,c=e.bottom}return t({x:l,y:c,data:n,owner:i}),!0},[]),i=f(e=>{r(e,void 0)},[r]);return{open:r,onContextMenu:i,close:n,state:e,props:{at:{x:e?.x??0,y:e?.y??0},owner:e?.owner??null,onClose:n}}}export{w as ContextMenu,y as useContextMenu};
@@ -0,0 +1,7 @@
1
+ import{isFocusableEntry as e,menuStatusIds as t,renderMenuEntries as r}from"./chunk-3BSPSRK4.js";import{useTabLayer as n,focusableIn as o}from"./chunk-CDAJKLGL.js";import{PopupMenu as i,PopupMenuDivider as a}from"./chunk-L5ND7FNA.js";import{onOverlayOpen as l}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as s}from"./chunk-62LW225J.js";import{placeMenu as d,popupBounds as c,followAnchor as u}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as p}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as f}from"./chunk-TWVUQUUD.js";import{useState as m,useRef as h,useId as g,useCallback as v,useEffect as b}from"react";import{jsxs as y,jsx as x}from"react/jsx-runtime";var k=/(^|[\s:])!?z-/,w={paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:"0.25rem",paddingBottom:"0.25rem"};function D({trigger:D,items:L,align:S="end",side:j="bottom","aria-label":A,className:K="",triggerClassName:C,menuClassName:E="",minWidth:N=180,linkAs:W,disabled:$,id:H,"aria-describedby":T,"aria-disabled":U=!1,onOpenChange:B,footer:I,footerLabel:J}){const[q,G]=m(!1),[M,P]=m(-1),R=h(null),z=h(null),F=h(null),O=h(null),Q=h(null),V=null!=I&&!1!==I,Y=h({text:"",at:0}),X=g(),Z=g(),_=H??Z,ee=h(B);ee.current=B;const te=h(q);te.current=q;const re=v(e=>{G(!1),te.current&&(te.current=!1,ee.current?.(!1)),e&&z.current?.focus()},[]),ne=(t,r)=>{const n=L.length;for(let o=0;o<n;o+=1){const i=((t+r*o)%n+n)%n;if(e(L[i]))return i}return-1},oe=()=>F.current?.closest("[data-popup-menu-tree]")??null;b(()=>{if(!q)return;const e=e=>{const t=e.target;if(R.current?.contains(t)||oe()?.contains(t))return;const r=oe()?.getAttribute("data-popup-menu-tree"),n=t.closest?.("[data-popup-menu-tree]");r&&n?.getAttribute("data-popup-menu-tree")===r||re(!1)};document.addEventListener("pointerdown",e,!0);const t=l(()=>re(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[q,re]);const ie=v(()=>{const e=oe(),t=z.current;if(!e||!t)return;const r=e.style;r.left="0px",r.top="0px",r.maxWidth="none",r.maxHeight="none";const n={width:e.offsetWidth,height:e.offsetHeight},o=d({trigger:t.getBoundingClientRect(),menu:n,bounds:c(t),align:S,side:j});r.left=`${o.left}px`,r.top=`${o.top}px`,r.maxWidth=`${o.maxWidth}px`,r.maxHeight=`${o.maxHeight}px`,r.overflowY=n.height>o.maxHeight?"auto":"",e.dataset.side=o.side,e.dataset.align=S},[S,j]);p(()=>{q&&ie()}),b(()=>{if(q)return u(()=>z.current,ie)},[q,ie]),b(()=>{if(!q)return;const t=F.current,r=e(L[M])?t?.querySelector(`[data-dropdown-index="${M}"]`):null;(r??t)?.focus({preventScroll:!0})},[q,M]),b(()=>{if(q)return f(e=>"Escape"===e.key&&(re(!0),!0),()=>O.current)},[q,re]),n(O,q&&V);const ae=h(null),le=e=>"first"===e?ne(0,1):ne(L.length-1,-1),se=e=>{P(le(e)),G(!0),te.current||(te.current=!0,ae.current=e,B?.(!0))};p(()=>{const e=ae.current;if(!q||!e)return;ae.current=null;const t=le(e);t!==M&&P(t)});const de=t(L,X),ce="function"==typeof I?I({close:()=>re(!0)}):I,ue={...k.test(E)?{}:{zIndex:s.popup},minWidth:N};/* @__PURE__ */
2
+ return y("div",{ref:R,className:`relative inline-flex ${K}`.trim(),children:[
3
+ /* @__PURE__ */x("button",{ref:z,id:_,type:"button","aria-haspopup":"menu","aria-expanded":q,"aria-controls":q?X:void 0,"aria-label":A,"aria-describedby":T,"aria-disabled":U||void 0,disabled:$,onClick:()=>{U||(q?re(!1):se("first"))},onKeyDown:e=>{U||("ArrowDown"===e.key||"Enter"===e.key||" "===e.key?(e.preventDefault(),se("first")):"ArrowUp"===e.key&&(e.preventDefault(),se("last")))},className:C??"inline-flex items-center justify-center rounded-(--radius-control) text-gray-600 transition-colors not-disabled:not-aria-disabled:hover:bg-gray-100 not-disabled:not-aria-disabled:hover:text-gray-900 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] disabled:cursor-not-allowed disabled:opacity-60 "+(A?"h-8 min-w-8 px-0":"h-8 min-w-8 gap-2 px-3"),children:D}),q&&
4
+ /* @__PURE__ */x(i,{portal:!0,className:E,style:ue,children:/* @__PURE__ */y("div",{ref:O,children:[
5
+ /* @__PURE__ */x("div",{ref:F,id:X,role:"menu","aria-orientation":"vertical","aria-label":A,"aria-labelledby":A?void 0:_,"aria-describedby":de,tabIndex:-1,onKeyDown:t=>{if(!t.target.closest?.("[data-popup-submenu-panel]")||"Tab"===t.key)if("ArrowDown"===t.key)t.preventDefault(),P(ne(M+1,1));else if("ArrowUp"===t.key)t.preventDefault(),P(ne(M-1,-1));else if("Home"===t.key)t.preventDefault(),P(ne(0,1));else if("End"===t.key)t.preventDefault(),P(ne(L.length-1,-1));else if("Tab"===t.key){t.preventDefault();const e=!t.shiftKey&&Q.current?o(Q.current)[0]:void 0;e?e.focus({preventScroll:!0}):re(!0)}else if(" "===t.key){const e=t.target;e.matches?.("a[href]")&&(t.preventDefault(),e.click())}else 1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey||(t=>{const r=Date.now(),n=t.key.toLowerCase(),o=r-Y.current.at<500?Y.current.text+n:n;Y.current={text:o,at:r};const i=[...o].every(e=>e===o[0]),a=i?o[0]:o,l=i?M+1:Math.max(M,0),s=F.current,d=L.length;for(let r=0;r<d;r+=1){const n=((l+r)%d+d)%d;if(e(L[n])&&(s?.querySelector(`[data-dropdown-index="${n}"]`)?.textContent?.trim().toLowerCase()??"").startsWith(a))return t.preventDefault(),void P(n)}})(t)},children:r(L,{menuId:X,choose:e=>{e.disabled||(re(!0),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>re(!0),rowProps:(e,t)=>({"data-dropdown-index":e,tabIndex:e===M?0:-1,onMouseEnter:()=>{t.disabled||Q.current?.contains(document.activeElement)||P(e)}}),linkAs:W})}),V&&/* @__PURE__ */y("div",{ref:Q,role:"group","aria-label":J,"data-dropdown-footer":"",onKeyDown:e=>{const t=Q.current;if("Tab"!==e.key||!t||!t.contains(e.target))return;const r=o(t),n=document.activeElement;if(e.shiftKey){if(r.length>0&&n!==r[0])return;e.preventDefault();const t=F.current?.querySelector(`[data-dropdown-index="${M}"]`);return void(t??F.current)?.focus({preventScroll:!0})}r.length>0&&n!==r[r.length-1]||(e.preventDefault(),re(!0))},children:[
6
+ /* @__PURE__ */x("div",{"aria-hidden":"true",children:/* @__PURE__ */x(a,{})}),
7
+ /* @__PURE__ */x("div",{style:w,children:ce})]})]})})]})}export{D as DropdownMenu};
@@ -0,0 +1,4 @@
1
+ import{useOverlayTarget as e,OverlayLayerProvider as r}from"./chunk-4AJRHTTB.js";import{dialogA11y as i}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as t}from"./chunk-PKXQDCNR.js";import{useFocusTrap as a,useScrollLock as o}from"./chunk-CDAJKLGL.js";import{Icon as l}from"./chunk-FSPFV4MI.js";import{Z_LAYERS as s}from"./chunk-62LW225J.js";import{useHydrated as n}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as d}from"./chunk-TWVUQUUD.js";import{useShellStrings as c}from"./chunk-E6UCGCOC.js";import{useRef as m,useId as u,useState as f,useEffect as h}from"react";import{createPortal as p}from"react-dom";import{jsx as x,jsxs as b}from"react/jsx-runtime";var g={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl","2xl":"max-w-6xl"};function v({open:v,onClose:y,title:k,description:j,role:N="dialog",children:w,footer:C,blocking:T=!1,size:W="md",aside:D=!1,initialFocus:J,"aria-label":L,"aria-labelledby":U,"aria-describedby":A,className:F=""}){const G=m(null),I=u(),V=u(),z=!T,B=u(),H=c().dialog,K=e(n()),[P,Q]=f(null);return t(v),a(G,v&&null!==K,J),o(v),h(()=>{if(v)return d(()=>(T||y(),!0),()=>G.current)},[v,T,y]),v&&K?p(
2
+ /* @__PURE__ */x(r,{value:P,children:/* @__PURE__ */b("div",{ref:Q,className:"fixed inset-0"+(D?" pointer-events-none opacity-0":""),style:{zIndex:s.overlay},role:"presentation","data-aside":D?"":void 0,children:[
3
+ /* @__PURE__ */x("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
4
+ /* @__PURE__ */x("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:T?void 0:e=>{e.target===e.currentTarget&&y()},children:/* @__PURE__ */b("div",{ref:G,...i({role:N,modal:!0,titleId:k?B:void 0,labelledBy:U,label:L}),"aria-describedby":A??(j?V:w?I:void 0),className:`relative max-h-full w-full ${g[W]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl ${F}`.trim(),children:[k&&/* @__PURE__ */x("h2",{id:B,className:(z?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:k}),j&&/* @__PURE__ */x("p",{id:V,className:((k?"mt-1":z?"pr-8":"")+" text-sm text-gray-500").trim(),children:j}),w&&/* @__PURE__ */x("div",{id:I,className:"mt-2 text-sm text-gray-600",children:w}),C&&/* @__PURE__ */x("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:C}),z&&/* @__PURE__ */x("button",{type:"button",onClick:y,"aria-label":H.close,className:"absolute right-3 top-3 rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */x(l,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]})}),K):null}export{v as Dialog};
@@ -0,0 +1,3 @@
1
+ import{DropdownMenu as e}from"./chunk-FORUFXAN.js";import{Button_default as i}from"./chunk-4IU5BSVE.js";import{iconButtonClasses as n}from"./chunk-K7U4RWXJ.js";import{Icon as r}from"./chunk-FSPFV4MI.js";import{Tooltip as a}from"./chunk-22S6LG6D.js";import{forwardRef as l,useId as o}from"react";import{jsxs as s,jsx as t}from"react/jsx-runtime";var d="relative focus-visible:z-10",m={secondary:"border-l-0",primary:"border-l border-white/30",warning:"border-l border-white/30"},c=l(function({children:l,onClick:c,type:b="button",items:h,menuLabel:u,variant:f="primary",size:p="md",loading:v=!1,leftIcon:k,disabled:g=!1,disabledReason:N,tooltip:w,menuDisabled:x=!1,menuDisabledReason:j,onMenuOpenChange:y,menuFooter:F,menuFooterLabel:C,align:R="end",side:W="bottom",menuMinWidth:z,linkAs:I,block:L=!1,className:A=""},D){const M=g&&(null!=N&&""!==N&&!1!==N)&&!v,O=x&&null!=j&&""!==j&&!1!==j,S=o(),U=/* @__PURE__ */t(i,{ref:D,type:b,variant:f,size:p,loading:v,leftIcon:k,block:L,disabled:g&&!M,"aria-disabled":!!M||void 0,disabledReason:M?N:void 0,onClick:c,className:`rounded-r-none ${d}`,children:l}),$=L?"relative flex min-w-0 flex-1":"relative inline-flex",B=p.startsWith("touch")?"h-5 w-5":"h-4 w-4";/* @__PURE__ */
2
+ return s("div",{className:[L?"flex w-full":"inline-flex","items-stretch",A].filter(Boolean).join(" "),children:[null==w||""===w||M?U:/* @__PURE__ */t(a,{content:w,className:$,children:U}),
3
+ /* @__PURE__ */t(a,{content:O?j:u,describe:!1,className:"relative inline-flex shrink-0",children:/* @__PURE__ */t(e,{"aria-label":u,"aria-describedby":O?S:void 0,items:h,align:R,side:W,minWidth:z,linkAs:I,disabled:x&&!O,"aria-disabled":O,onOpenChange:y,footer:F,footerLabel:C,triggerClassName:n({variant:f,size:p,className:`rounded-l-none ${m[f]} ${d}`}),trigger:/* @__PURE__ */t(r,{name:"chevron-down",className:B,strokeWidth:2,"aria-hidden":"true"})})}),O&&/* @__PURE__ */t("span",{id:S,className:"sr-only",children:j})]})});export{c as SplitButton_default};
@@ -1,4 +1,4 @@
1
- import{ColorPicker as e}from"./chunk-4OFD6ICH.js";import{InputNumber_default as t}from"./chunk-ZCHBOAPA.js";import{Segmented as l}from"./chunk-N6DTTOB6.js";import{Icon as r}from"./chunk-FSPFV4MI.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["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__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(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 j=e=>"number"==typeof d[e]?d[e]:null,k=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===j(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},C=(e,l,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(t,{value:a,onChange:i,min:g,max:v,step:N,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":l})}),O=n.map(j),S="number"==typeof d.width?d.width:O.every(e=>null!==e&&e===O[0])?O[0]:null,F=null===S&&O.some(e=>null!==e),H=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",I=e=>j(e)??("number"==typeof d.width?d.width:null),z=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:[C("left",b.sides.left,h.left,I("left"),String(u.sides.left),e=>k("left",e)),C("top",b.sides.top,h.top,I("top"),String(u.sides.top),e=>k("top",e)),C("right",b.sides.right,h.right,I("right"),String(u.sides.right),e=>k("right",e)),C("bottom",b.sides.bottom,h.bottom,I("bottom"),String(u.sides.bottom),e=>k("bottom",e))]}):C("all",b.width,h.all,S,F?"–":H,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(l,{block:!0,size:"sm",label:b.style,value:z,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
1
+ import{Segmented as e}from"./chunk-N6DTTOB6.js";import{ColorPicker as t}from"./chunk-C4YN2DNM.js";import{InputNumber_default as l}from"./chunk-5E3WCKWB.js";import{Icon as r}from"./chunk-FSPFV4MI.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["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__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(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:N=20,step:v=1,readOnly:x}){const j=e=>"number"==typeof d[e]?d[e]:null,k=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===j(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},C=(e,t,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(l,{value:a,onChange:i,min:g,max:N,step:v,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":t})}),S=n.map(j),O="number"==typeof d.width?d.width:S.every(e=>null!==e&&e===S[0])?S[0]:null,z=null===O&&S.some(e=>null!==e),B=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",D=e=>j(e)??("number"==typeof d.width?d.width:null),E=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:[C("left",b.sides.left,h.left,D("left"),String(u.sides.left),e=>k("left",e)),C("top",b.sides.top,h.top,D("top"),String(u.sides.top),e=>k("top",e)),C("right",b.sides.right,h.right,D("right"),String(u.sides.right),e=>k("right",e)),C("bottom",b.sides.bottom,h.bottom,D("bottom"),String(u.sides.bottom),e=>k("bottom",e))]}):C("all",b.width,h.all,O,z?"–":B,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(e,{block:!0,size:"sm",label:b.style,value:E,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
3
3
  /* @__PURE__ */s("span",{className:"sr-only",children:b.styles[e]})]}),title:b.styles[e]}))})}),
4
- /* @__PURE__ */s("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */s(e,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"sm",disabled:x})})]})}export{i as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};
4
+ /* @__PURE__ */s("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */s(t,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"sm",disabled:x})})]})}export{i as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};