@sheetxl/studio-mui 0.7.5 → 0.7.7

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 (51) hide show
  1. package/LICENSE.md +1 -1
  2. package/browser/cjs/BCf8BQb2c8ANexW4.cjs +7 -0
  3. package/browser/cjs/BJ4pZo7s81ynDlzw.cjs +6 -0
  4. package/browser/cjs/{CuHwOikK2J1MLsHN.cjs → Bf70UQlMT3b0NoOZ.cjs} +1 -1
  5. package/browser/cjs/Bpq9GrV7al7xxJ_d.cjs +6 -0
  6. package/browser/cjs/BxlQ6aLh5_jUvk9w.cjs +20 -0
  7. package/browser/cjs/{B4uj1Smd-98Hab_l.cjs → CJSNNa8ySxzuEmoy.cjs} +2 -2
  8. package/browser/cjs/{D4c72fkCJiL-S_-a.cjs → CUND2W1xMwqPOHwD.cjs} +7 -7
  9. package/browser/cjs/{CJQkIVFa7S1AZcBP.cjs → Cg95aBJ4kuUq7jrz.cjs} +1 -1
  10. package/browser/cjs/Dcoq8P2O8-40waHl.cjs +6 -0
  11. package/browser/cjs/{JURSrTjvLJ8bc4Yl.cjs → DeoOsY5TkIAydt9W.cjs} +2 -2
  12. package/browser/cjs/index.cjs +3 -3
  13. package/browser/cjs/{D6pUyWwmIliDWT8B.cjs → j0lD5RrJ86CRlUNT.cjs} +2 -2
  14. package/browser/esm/{B7CJX7fKvv1vBk8-.mjs → 7tCRjNmDM5kf3BFa.mjs} +2 -2
  15. package/browser/esm/{hWToTYtpa0PFzhRm.mjs → BWxmPJd4f8qZMxaa.mjs} +17 -18
  16. package/browser/esm/{COI8Eg7HQcdPFGcZ.mjs → BbHGWXif6ytyfyHI.mjs} +1 -1
  17. package/browser/esm/{CajWEWsYWzynjFKw.mjs → BkhHyCmy1MwVFS1b.mjs} +2 -2
  18. package/browser/esm/{BbfPde9B9b4p64_L.mjs → Bo3cXzeDcP_Q9YvX.mjs} +2 -2
  19. package/browser/esm/CRDu7VFAa8NGcoHj.mjs +49 -0
  20. package/browser/esm/{C48fXszXYqcJMQni.mjs → Cd02kMBZDsozIA98.mjs} +12 -12
  21. package/browser/esm/CzdBzjYgP1i3pkPL.mjs +4455 -0
  22. package/browser/esm/DFppS_p4spncePDm.mjs +156 -0
  23. package/browser/esm/{KULqIIHcvNriSu7F.mjs → db-2uDA7mYS4QpHj.mjs} +1 -1
  24. package/browser/esm/index.mjs +70 -72
  25. package/browser/esm/{gpytxNaiTkBoZ6aj.mjs → nzc1811Pk5-sKDu5.mjs} +7 -7
  26. package/licenses/dependencies.txt +189 -222
  27. package/node/assets/style.css +1 -1
  28. package/node/esm/BVKo3uc0IreLNkkN.mjs +157 -0
  29. package/node/esm/{CuIak_iZn0ApypmT.mjs → BfnEq4EhLf8jJ0Gp.mjs} +1 -1
  30. package/node/esm/{BHFc6-pxJ_X3esj1.mjs → BgR1PWucIb0Zucr4.mjs} +1 -1
  31. package/node/esm/{DEnAvzkXoQEvscd-.mjs → BimlBylqyslj9fNg.mjs} +1 -1
  32. package/node/esm/{DExsoaMD7hWNhceb.mjs → BnGsbrQwjcaUFAdt.mjs} +13 -13
  33. package/node/esm/{DKhoTrOwIfMtft9r.mjs → CQhaL28vV1X6Xt2N.mjs} +43 -44
  34. package/node/esm/{NYFZEGBg9dFXwfFf.mjs → DB2ryaj4_Y8Lgyy_.mjs} +1 -1
  35. package/node/esm/{DQIYBoarjlonhEEn.mjs → X3qO0PKREgY9FMZU.mjs} +8 -8
  36. package/node/esm/index.mjs +1575 -1576
  37. package/node/esm/{DH3yxwtQR5c61iv3.mjs → rOozeXREjiU8jjPd.mjs} +14 -14
  38. package/package.json +15 -17
  39. package/types/index.d.ts +25 -93
  40. package/browser/cjs/BnpPHKTC6_96pDcW.cjs +0 -6
  41. package/browser/cjs/CHyGxDKCce-XV53l.cjs +0 -7
  42. package/browser/cjs/F4v-BOmzUXzCO3uz.cjs +0 -6
  43. package/browser/cjs/QQ4l7f6lYZb7S6td.cjs +0 -20
  44. package/browser/cjs/Td2md8ruASYOp_Rr.cjs +0 -6
  45. package/browser/cjs/jHU6TwhWd2lZX-VA.cjs +0 -6
  46. package/browser/esm/BhP57_jo4NnvHBgF.mjs +0 -64
  47. package/browser/esm/CGVa4zFRRZyFzDvh.mjs +0 -4489
  48. package/browser/esm/CkXFR3hHwNp6jfJV.mjs +0 -49
  49. package/browser/esm/CwAqw5gJ2yzuXbLx.mjs +0 -155
  50. package/node/esm/8qD_FXFKXbOqF2_X.mjs +0 -156
  51. package/node/esm/DQKU8gdXpx4S0S0D.mjs +0 -65
@@ -1,20 +0,0 @@
1
- "use strict";var Ml=Object.create;var Dn=Object.defineProperty;var Pl=Object.getOwnPropertyDescriptor;var Dl=Object.getOwnPropertyNames;var Fl=Object.getPrototypeOf,Nl=Object.prototype.hasOwnProperty;var Al=(l,s,n,t)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of Dl(s))!Nl.call(l,a)&&a!==n&&Dn(l,a,{get:()=>s[a],enumerable:!(t=Pl(s,a))||t.enumerable});return l};var Fn=(l,s,n)=>(n=l!=null?Ml(Fl(l)):{},Al(s||!l||!l.__esModule?Dn(n,"default",{value:l,enumerable:!0}):n,l));/**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.5
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */const L=require("@sheetxl/sdk"),ie=require("@sheetxl/react"),e=require("react/jsx-runtime"),r=require("react"),E=require("@mui/material"),o=require("@sheetxl/utils-mui"),me=require("@mui/icons-material"),k=require("@sheetxl/utils-react"),G=require("@mui/material/styles"),Re=require("@mui/system"),Je=require("react-dom"),Fe=require("@sheetxl/utils"),it=require("@sheetxl/io");function Tr(l){var s,n,t="";if(typeof l=="string"||typeof l=="number")t+=l;else if(typeof l=="object")if(Array.isArray(l)){var a=l.length;for(s=0;s<a;s++)l[s]&&(n=Tr(l[s]))&&(t&&(t+=" "),t+=n)}else for(n in l)l[n]&&(t&&(t+=" "),t+=n);return t}function ge(){for(var l,s,n=0,t="",a=arguments.length;n<a;n++)(l=arguments[n])&&(s=Tr(l))&&(t&&(t+=" "),t+=s);return t}const Er=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,parentFloat:m,...h}=l,i=k.useCommands(n,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),d=r.useMemo(()=>{for(let u=0;u<i.length;u++)if(i[u]?.state())return i[u].key();return i[0]?.key()},[i]),f=r.useMemo(()=>{const u=new Map;return u.set("formatAlignLeftToggle",o.themeIcon(e.jsx(me.FormatAlignLeft,{}))),u.set("formatAlignCenterToggle",o.themeIcon(e.jsx(me.FormatAlignCenter,{}))),u.set("formatAlignRightToggle",o.themeIcon(e.jsx(me.FormatAlignRight,{}))),u.set("formatAlignJustifyToggle",o.themeIcon(e.jsx(me.FormatAlignJustify,{}))),u.set("formatAlignCenterContinuousToggle",o.themeIcon(e.jsx(me.FormatAlignCenter,{}))),u.set("formatAlignFillToggle",o.themeIcon(e.jsx(me.FormatAlignJustify,{}))),u.set("formatAlignDistributedHorizontalToggle",o.themeIcon(e.jsx(me.FormatAlignJustify,{}))),u},[]),p=r.useMemo(()=>{if(!t)return null;const u={...t};return delete u.beforeExecute,u},[t]),x=r.useCallback((u,g)=>{const S={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:a,disabled:c},y=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...S,command:g.getCommand("formatAlignLeftToggle"),icon:f.get("formatAlignLeftToggle")}),e.jsx(o.CommandButton,{...S,command:g.getCommand("formatAlignCenterToggle"),icon:f.get("formatAlignCenterToggle")}),e.jsx(o.CommandButton,{...S,command:g.getCommand("formatAlignRightToggle"),icon:f.get("formatAlignRightToggle")}),e.jsx(o.CommandButton,{...S,command:g.getCommand("formatAlignJustifyToggle"),icon:f.get("formatAlignJustifyToggle")}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...S,command:g.getCommand("formatAlignCenterContinuousToggle"),icon:f.get("formatAlignCenterContinuousToggle")}),e.jsx(o.CommandButton,{...S,command:g.getCommand("formatAlignFillToggle"),icon:f.get("formatAlignFillToggle")}),e.jsx(o.CommandButton,{...S,command:g.getCommand("formatAlignDistributedHorizontalToggle"),icon:f.get("formatAlignDistributedHorizontalToggle")})]}),C=e.jsxs(E.Box,{sx:{className:ge("quick-buttons"),display:"flex",alignItems:"center",justifyContent:"center"},onClick:w=>w.stopPropagation(),children:[e.jsx(o.CommandButton,{command:g.getCommand("formatIndentDecrease"),commandHook:p,scope:a,disabled:c,icon:o.themeIcon(e.jsx(o.FormatIndentDecreaseIcon,{}))}),e.jsx(o.CommandButton,{command:g.getCommand("formatIndentIncrease"),commandHook:p,scope:a,disabled:c,icon:o.themeIcon(e.jsx(o.FormatIndentIncreaseIcon,{}))})]}),b=e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...h,children:[C,e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:y})]});return o.defaultCreatePopupPanel({...u,children:b})},[c,t]);return e.jsx(o.CommandPopupButton,{ref:s,parentFloat:m,commands:n,commandHook:t,scope:a,createPopupPanel:x,label:"Horizontal Alignment",tooltip:"Configure how text is placed in the horizontal direction of the cell.",quickCommand:d,icon:f.get(d)??e.jsx(me.FormatAlignLeft,{}),...h})})),Br=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=k.useCommands(n,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),i=r.useMemo(()=>{for(let p=0;p<h.length;p++)if(h[p]?.state())return h[p].key();return h[0]?.key()},[h]),d=r.useMemo(()=>{const p=new Map;return p.set("formatAlignTopToggle",o.themeIcon(e.jsx(o.TextVerticalTopIcon,{}))),p.set("formatAlignMiddleToggle",o.themeIcon(e.jsx(o.TextVerticalCenterIcon,{}))),p.set("formatAlignBottomToggle",o.themeIcon(e.jsx(o.TextVerticalBottomIcon,{}))),p.set("formatAlignJustifyVerticalToggle",o.themeIcon(e.jsx(me.FormatAlignJustify,{}))),p.set("formatAlignDistributedVerticalToggle",o.themeIcon(e.jsx(me.FormatAlignJustify,{}))),p},[]),f=r.useCallback((p,x)=>{const u={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:a,disabled:c},g=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...u,command:x.getCommand("formatAlignTopToggle"),icon:d.get("formatAlignTopToggle")}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatAlignMiddleToggle"),icon:d.get("formatAlignMiddleToggle")}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatAlignBottomToggle"),icon:d.get("formatAlignBottomToggle")}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatAlignJustifyVerticalToggle"),icon:d.get("formatAlignJustifyVerticalToggle")}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatAlignDistributedVerticalToggle"),icon:d.get("formatAlignDistributedVerticalToggle")})]});return o.defaultCreatePopupPanel({...p,children:g})},[c,t,d]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,createPopupPanel:f,label:"Vertical Alignment",tooltip:"Configure how text is placed in the vertical direction of the cell.",icon:d.get(i)??o.themeIcon(e.jsx(o.TextVerticalBottomIcon,{})),...m})})),Ir=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=k.useCommands(n,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),i=r.useMemo(()=>{for(let p=0;p<h.length;p++)if(h[p]?.state())return h[p].key();return h[0]?.key()},[h]),d=r.useMemo(()=>{const p=new Map;return p.set("formatTextOverflowVisibleToggle",o.themeIcon(e.jsx(o.TextHorizontalOverflowIcon,{}))),p.set("formatTextOverflowWrapToggle",o.themeIcon(e.jsx(o.TextHorizontalWrapIcon,{}))),p.set("formatTextOverflowClipToggle",o.themeIcon(e.jsx(o.TextHorizontalClipIcon,{}))),p.set("formatTextOverflowShrinkToggle",o.themeIcon(e.jsx(o.TextHorizontalShrinkIcon,{}))),p},[]),f=k.useCallbackRef((p,x)=>{const u={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:a,disabled:c},g=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...u,command:x.getCommand("formatTextOverflowVisibleToggle"),icon:d.get("formatTextOverflowVisibleToggle")}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatTextOverflowWrapToggle"),icon:d.get("formatTextOverflowWrapToggle")}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatTextOverflowClipToggle"),icon:d.get("formatTextOverflowClipToggle")}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatTextOverflowShrinkToggle"),icon:d.get("formatTextOverflowShrinkToggle")})]});return o.defaultCreatePopupPanel({...p,children:g})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,scope:a,label:"Text Overflow",tooltip:"Configure how text behaves when it doesn't fit within a cell.",createPopupPanel:f,icon:d.get(i)??o.themeIcon(e.jsx(o.TextHorizontalOverflowIcon,{})),...m})})),Rr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=k.useCommands(n,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),i=r.useMemo(()=>{const x=h.length;for(let u=0;u<x;u++){const g=h[u];if(g?.state())return g.key()}return h[1]?.key()},[h]),d=r.useMemo(()=>{const x=new Map;return x.set("formatTextRotate0",o.themeIcon(e.jsx(o.TextRotation315Icon,{}))),x.set("formatTextRotate315",o.themeIcon(e.jsx(o.TextRotation315Icon,{}))),x.set("formatTextRotate45",o.themeIcon(e.jsx(o.TextRotation45Icon,{}))),x.set("formatTextRotate90",o.themeIcon(e.jsx(o.TextRotation90Icon,{}))),x.set("formatTextRotate270",o.themeIcon(e.jsx(o.TextRotation2702Icon,{}))),x.set("formatTextRotateCustom",o.themeIcon(e.jsx(o.TextRotationCustomIcon,{}))),x},[]),f=r.useCallback((x,u)=>{const g={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:a,disabled:c},S=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...g,command:u.getCommand("formatTextRotate0"),icon:o.themeIcon(e.jsx(o.TextRotation0Icon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...g,command:u.getCommand("formatTextRotate315"),icon:o.themeIcon(e.jsx(o.TextRotation315Icon,{}))}),e.jsx(o.CommandButton,{...g,command:u.getCommand("formatTextRotate45"),icon:o.themeIcon(e.jsx(o.TextRotation45Icon,{}))}),e.jsx(o.CommandButton,{...g,command:u.getCommand("formatTextRotate90"),icon:o.themeIcon(e.jsx(o.TextRotation90Icon,{}))}),e.jsx(o.CommandButton,{...g,command:u.getCommand("formatTextRotate270"),icon:o.themeIcon(e.jsx(o.TextRotation2702Icon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.InputCommandButton,{...g,command:u.getCommand("formatTextRotateCustom"),icon:o.themeIcon(e.jsx(o.TextRotationCustomIcon,{})),label:"Custom"})]});return o.defaultCreatePopupPanel({...x,children:S})},[c,t,a,n]),p=r.useMemo(()=>(n.getCommand("formatTextRotateCustom")?.state()??0)!==0,[h]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,scope:a,selected:p,label:"Text Orientation",tooltip:"Rotate your text diagonally or vertically. This is a great way to label narrow columns.",createPopupPanel:f,quickCommand:p?"formatTextRotate0":"formatTextRotate315",icon:o.themeIcon(d.get(i)??e.jsx(o.TextRotation315Icon,{})),...m})})),Mr={Preset:"preset",Custom:"custom"},dt={Start:"start",End:"end"},yo={},Ol=(l,s,n,t)=>{const a=l+"-"+s+"-"+n+(t?"-server":"");if(yo[a])return yo[a];const c=((m,h,i,d)=>{if(typeof document>"u"&&!d)return null;const f=d?new d:document.createElement("canvas");f.width=2*i,f.height=2*i;const p=f.getContext("2d");return p?(p.fillStyle=m,p.fillRect(0,0,f.width,f.height),p.fillStyle=h,p.fillRect(0,0,i,i),p.translate(i,i),p.fillRect(0,0,i,i),f.toDataURL()):null})(l,s,n,t);return yo[a]=c,c},Ll={},Pr=r.memo(l=>{const{className:s,style:n=k.ReactUtils.EmptyCssProperties,white:t="transparent",grey:a="grey",size:c=8,borderRadius:m,boxShadow:h,renderers:i=Ll,children:d,...f}=l,p=d,x=r.useMemo(()=>Object.assign({borderRadius:m,boxShadow:h,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Ol(t,a,c,i?.canvas)}) center left`},n),[t,a,c,i]);return r.isValidElement(d)?r.cloneElement(d,{...p.props}):e.jsx("div",{style:x,...f})}),Hl=r.memo(l=>{const{selectedColor:s,onSelectColor:n,onPreviewColor:t,onClick:a,onKeyDown:c,onMouseOver:m,onMouseLeave:h,onFocus:i,style:d=k.ReactUtils.EmptyCssProperties,children:f,alphaWhite:p,alphaGrey:x,darkMode:u,alphaCheckSize:g=7,...S}=l;if(!s)throw new Error("a selectedColor is required");const y=r.useCallback(B=>{a?.(B),B.isDefaultPrevented()||(B.ctrlKey?t?.(s.toRGBA()):n?.(s.toRGBA()))},[n,t,a,s]),C=r.useCallback(B=>{m?.(B),B.isDefaultPrevented()||t?.(s.toRGBA())},[t,m,s]),b=r.useCallback(B=>{h?.(B),B.isDefaultPrevented()},[t,h]),w=r.useCallback(B=>{i?.(B),B.isDefaultPrevented()||t?.(s.toRGBA())},[t,i,s]),j=r.useCallback(B=>{c?.(B),B.isDefaultPrevented()||B.keyCode===k.KeyCodes.Enter&&n?.(s.toRGBA())},[n,c,s]),T=r.useMemo(()=>s.toRGBA().alpha===1?null:e.jsx(Pr,{size:g,white:p,grey:x,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[p,x,s]);return e.jsxs("div",{style:{position:"absolute",height:"100%",width:"100%",top:"0px",left:"0px",cursor:"pointer",outline:"none",...d},tabIndex:0,...S,onClick:y,onKeyDown:j,onMouseOver:C,onMouseLeave:b,onFocus:w,children:[T,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:s.toCSS(u)},children:f})]})}),lo=r.memo(l=>{const{schemeColorLookup:s,selectedColor:n,previewColor:t,colorDef:a,onSelectColorDef:c,onPreviewColorDef:m,swatchProps:h,defaultButtonSize:i=24,isLarge:d=!1,compareRGB:f=!1,darkMode:p=!1,...x}=l,u=new L.Color({val:a.definition.val,adjs:a.definition.adjs},T=>s(T)),g=f?u.toRGBA().toString():u.toString(),S=n&&(f?n.toRGBA().toString():n.toString())===g,y=t&&(f?t.toRGBA().toString():t.toString())===g,C=[];C.push({[L.IColor.AdjustmentType.Inv]:!0}),C.push({[L.IColor.AdjustmentType.Alpha]:100});const b=u.adjust(C),w=r.useCallback(()=>{c?.(a)},[c,a]),j=r.useCallback(T=>{m?.(T?a:null)},[m,a]);return e.jsx(o.SimpleTooltip,{disableInteractive:!0,PopperProps:{style:{pointerEvents:"none"},disablePortal:!0,popperOptions:{strategy:"fixed",modifiers:[{name:"preventOverflow",enabled:!0,options:{boundariesElement:"viewport"}}]}},title:a.description,placement:"bottom-start",children:e.jsx("div",{style:{width:i*(d?1.2:1)+"px",height:i*(d?1.2:1)+"px",position:"relative",boxSizing:"border-box",cursor:"pointer",outline:"none"},...x,children:e.jsxs(Hl,{selectedColor:u,title:null,onSelectColor:w,onPreviewColor:j,alphaCheckSize:d?9:void 0,darkMode:p,...h,children:[e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",top:"0px",left:"0px",pointerEvents:"none",borderColor:b.toRGBA(p).toString(),borderWidth:"2px",borderStyle:"solid",boxSizing:"border-box",opacity:S?"1":"0"}}),e.jsx("div",{style:{position:"absolute",width:.33*i*(d?1.2:1)+"px",height:.33*i*(d?1.2:1)+"px",left:"calc(50% - 0.5px)",top:"calc(50% - 0.5px)",transform:"translate(-50%,-50%)",pointerEvents:"none",background:b.toRGBA(p).toString(),borderRadius:"50%",opacity:y?"1":"0"}})]})})})}),zt=r.memo(l=>{const{title:s,schemeColorLookup:n,colorDefs:t,selectedColor:a,previewColor:c,onSelectColorDef:m,onPreviewColorDef:h,style:i=k.ReactUtils.EmptyCssProperties,compareRGB:d=!1,darkMode:f,swatchProps:p,...x}=l;let u;if(Array.isArray(t[0]))u=t;else{u=[];for(let b=0;b<t.length;b++)u.push([t[b]])}const g=r.useCallback(b=>{m?.(b)},[m]),S=r.useCallback(b=>{h?.(b)},[h]),y=r.useMemo(()=>{let b=[];for(let w=0;w<u.length;w++){let j=[],T=u[w];for(let I=0;I<T.length;I++){let D=T[I];j.push(e.jsx(lo,{schemeColorLookup:n,colorDef:D,selectedColor:a,previewColor:c,onSelectColorDef:g,onPreviewColorDef:S,swatchProps:p,compareRGB:d,darkMode:f},w+" "+I))}let B=e.jsx(E.Box,{className:"button-col",sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",boxShadow:I=>I.shadows[2],borderRadius:"2px",overflow:"hidden"},children:j},""+w);b.push(B)}return b},[u,a,c,g,S]),C=r.useMemo(()=>s?e.jsx(E.Typography,{noWrap:!0,component:"div",sx:{display:"flex",flexShrink:"0",paddingLeft:"6px",paddingBottom:"4px",paddingTop:"0px",userSelect:"none",color:b=>b.palette.text.secondary},children:s}):null,[s]);return e.jsxs(E.Box,{style:{...i},children:[C,e.jsx(E.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...x,children:y})]})}),De=(l,s)=>({description:l,definition:{val:s,adjs:[]}}),Ce=(l,s,n,t,a,c)=>{const m=De(l,s);t?.push(m);const h=new L.Color({val:m.definition.val,adjs:m.definition.adjs},n),i=h.toString();a?.set(i,h);const d=h.toRGBA().toString();c?.set(d,h)},zl=r.lazy(()=>Promise.resolve().then(()=>require("./B4uj1Smd-98Hab_l.cjs"))),Dr=r.memo(r.forwardRef((l,s)=>{const{selectedColor:n=null,previewColor:t=l.selectedColor??null,recentColors:a,schemeLookup:c,disableAlpha:m=!1,previewDebounceTime:h=100,initialPanelType:i,defaultButtonSize:d=24,width:f,onElementLoad:p,onDone:x,onEyeDropStart:u,onEyeDropStop:g,onPreviewColor:S,onPreviewColorImmediate:y,onSelectColor:C,autoColor:b,autoColorLabel:w="Automatic",autoColorPosition:j=dt.Start,compareRGB:T=!1,darkMode:B=!1,...I}=l,D=t||n,F=k.useCallbackRef(S,[S]),O=k.useCallbackRef(y,[y]),P=k.useCallbackRef(C,[C]),v=k.useCallbackRef(u,[u]),M=k.useCallbackRef(g,[g]),[H,A]=r.useState(!1),V=G.useTheme(),N=r.useMemo(()=>c||L.Color.getDefaultSchemeLookup(),[c]),R=r.useMemo(()=>{const $=new Map,te=new Map,ue=[];Ce("Primary Background","bg1",N,ue,$,te),Ce("Primary Text","tx1",N,ue,$,te),Ce("Secondary Background","bg2",N,ue,$,te),Ce("Secondary Text","tx2",N,ue,$,te),Ce("Accent 1","accent1",N,ue,$,te),Ce("Accent 2","accent2",N,ue,$,te),Ce("Accent 3","accent3",N,ue,$,te),Ce("Accent 4","accent4",N,ue,$,te),Ce("Accent 5","accent5",N,ue,$,te),Ce("Accent 6","accent6",N,ue,$,te);const le=L.ITheme.buildPalette(ue,N,$,te),ae=[];if(Ce("Dark Red","C00000",N,ae,$,te),Ce("Red","FF0000",N,ae,$,te),Ce("Orange","FFC000",N,ae,$,te),Ce("Yellow","FFFF00",N,ae,$,te),Ce("Light Green","92D050",N,ae,$,te),Ce("Green","00B050",N,ae,$,te),Ce("Light Blue","00B0F0",N,ae,$,te),Ce("Blue","0070C0",N,ae,$,te),Ce("Dark Blue","002060",N,ae,$,te),m?Ce("Purple Is A Fruit","7030A0",N,ae,$,te):Ce("Transparent","00000000",N,ae,$,te),b){const se=b.toString();$.set(se,b)}const Y=new Map,oe=typeof a=="function"?a():a,pe=[];for(let se=0;oe&&se<oe.length;se++){const je=oe[se].toString();Y.set(je,oe[se]),pe.push({description:"Recent "+(se+1),definition:{val:oe[se].toString()}})}return{primaryColors:ue,modifiedPresets:le,standardColors:ae,recentColorsLimited:pe,mapAllPresets:$,mapAllPresetsRGB:te,mapRecent:Y}},[N,a,m,b]);r.useEffect(()=>{p?.()},[]);const[_,X]=r.useState(!1),q=r.useCallback(()=>{X($=>!$)},[]);r.useEffect(()=>{if(i)X(i===Mr.Custom);else if(n){let $=n.toString(),te=R.mapAllPresets.get($);te||($=n.toRGBA().toString(),te=R.mapAllPresetsRGB.get($));const ue=R.mapRecent.get($);X(!te&&!ue)}},[n,i]);const U=r.useCallback(L.CommonUtils.debounce($=>{F?.($)},h),[F,h]),[Z,ee]=r.useState();r.useEffect(()=>{ee(t||n)},[t,n]);const K=k.useCallbackRef($=>{O&&(O($),U($))},[O]),z=k.useCallbackRef($=>{K($?new L.Color({val:$.definition.val,adjs:$.definition.adjs},N):null)},[N]),J=r.useCallback($=>{$.ctrlKey&&X(!0)},[]),re=k.useCallbackRef($=>{let te=!1;if($){const ue=$.toString();te=!R.mapAllPresets.has(ue)}P?.($,te)},[P,R]),xe=k.useCallbackRef($=>{const te=$?new L.Color({val:$.definition.val,adjs:$.definition.adjs},N):null;Promise.resolve(x?.()).then(()=>{re(te)})},[N,x]),be=k.useCallbackRef($=>{K($?new L.Color($,N):null)},[N]),ye=r.useMemo(()=>window.EyeDropper===void 0?e.jsx(e.Fragment,{}):e.jsx(E.IconButton,{"aria-label":"eye dropper",size:"small",sx:{color:$=>$.palette.text.icon??$.palette.action.active},onClick:async()=>{A(!0),v?.(),await new EyeDropper().open().then($=>{A(!1),M?.();let te=new L.Color($.sRGBHex),ue=te.toString(),le=R.mapAllPresets.get(ue);if(le||(ue=te.toRGBA().toString(),le=R.mapAllPresetsRGB.get(ue)),!le){const ae=te.toRGBA(),Y=3;let oe=255;R.mapAllPresetsRGB.forEach((pe,se)=>{const je=pe.toRGBA(),Me=Math.abs(je.red-ae.red)+Math.abs(je.blue-ae.blue)+Math.abs(je.green-ae.green);Me<Y&&Me<oe&&(le=pe)})}X(!le),K(le||te)}).catch($=>{A(!1),$?.name!=="AbortError"&&console.error($)})},children:e.jsx(me.Colorize,{})}),[R,B]),Be=r.useMemo(()=>{if(!_)return;const $={opacity:_?1:"0",position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box"};return e.jsx(r.Suspense,{fallback:e.jsx("div",{style:$,children:e.jsx(o.LoadingPanel,{})}),children:e.jsx(zl,{style:$,selectedColor:D?D.toRGBA().toString():"transparent",onColorChange:be,disableAlpha:m})})},[_,D]),ce=r.useMemo(()=>({onClick:J,alphaGrey:V.palette.text.icon??V.palette.action.active}),[J,V]),Q=r.useMemo(()=>{if(!b)return null;const $={description:w,definition:{val:b.getVal(),adjs:b.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(E.MenuItem,{sx:{display:"flex",color:te=>te.palette.text.secondary},onMouseOver:()=>{z(null)},onClick:()=>{xe(null)},children:[e.jsx(E.Box,{sx:{flex:"none",boxShadow:te=>te.shadows[2],borderRadius:te=>te.spacing(.5),overflow:"hidden"},children:e.jsx(lo,{schemeColorLookup:N,colorDef:$,selectedColor:n===null?b:n,previewColor:t===null?b:t,defaultButtonSize:d,isLarge:!0,darkMode:B,compareRGB:T,swatchProps:ce})}),e.jsx(E.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:w})]})})},[b,w,N,n,t]);return e.jsxs(E.Box,{ref:s,sx:{width:f,outline:"none",padding:"10px 10px",overflow:"hidden",boxSizing:"content-box"},...I,children:[e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("div",{style:{opacity:_?"0":1},children:[Q&&j===dt.Start?e.jsxs(e.Fragment,{children:[Q,e.jsx(E.Divider,{light:!0,style:{marginTop:"2px",marginBottom:"10px"}})]}):null,e.jsx(zt,{title:"Theme Colors",schemeColorLookup:N,colorDefs:R.primaryColors,selectedColor:n,previewColor:t===void 0?n:t,swatchProps:ce,onPreviewColorDef:z,onSelectColorDef:xe,compareRGB:T,darkMode:B}),e.jsx(zt,{schemeColorLookup:N,colorDefs:R.modifiedPresets,selectedColor:n,previewColor:t===void 0?n:t,swatchProps:ce,onPreviewColorDef:z,onSelectColorDef:xe,compareRGB:T,darkMode:B}),e.jsx(E.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(zt,{title:"Standard Colors",schemeColorLookup:N,colorDefs:R.standardColors,selectedColor:n,previewColor:t===void 0?n:t,swatchProps:ce,onPreviewColorDef:z,onSelectColorDef:xe,compareRGB:T,darkMode:B}),e.jsxs("div",{style:{opacity:R.recentColorsLimited.length===0?"0":void 0,display:R.recentColorsLimited.length===0?"none":void 0},children:[e.jsx(E.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(zt,{title:"Recent Colors",schemeColorLookup:N,colorDefs:R.recentColorsLimited,selectedColor:n,previewColor:t===void 0?n:t,swatchProps:ce,onPreviewColorDef:z,onSelectColorDef:xe,compareRGB:T,darkMode:B})]}),Q&&j===dt.End?e.jsxs(e.Fragment,{children:[e.jsx(E.Divider,{light:!0,sx:{marginTop:"2px",marginBottom:"2px"}}),Q,e.jsx("div",{style:{marginBottom:"2px"}})]}):null]}),Be]}),e.jsx(E.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-around",gap:"8px",paddingLeft:"2px",paddingRight:"2px"},children:[ye,e.jsx("div",{style:{flex:"1 1 100%",background:"pink"}}),e.jsx(E.Button,{style:{minWidth:"75px",maxWidth:"75px"},value:"check",variant:"outlined",size:"small",onClick:()=>{q()},children:_?e.jsx("div",{children:"Preset"}):e.jsx("div",{children:"Custom"})}),e.jsx(E.Button,{variant:"contained",size:"small",style:{minWidth:"75px"},onClick:()=>{Promise.resolve(x?.()).then(()=>{re(Z)})},children:"Done"})]})]})})),Wl=e.jsx(o.ColorizedCircleIcon,{}),Wo=r.memo(r.forwardRef((l,s)=>{const{selectedColor:n,quickColor:t,icon:a=Wl,tooltip:c,label:m,onPreviewColor:h,onPreviewColorImmediate:i,onSelectColor:d,variant:f=o.PopupButtonType.Toolbar,panelProps:p,shouldCloseFloatAll:x=!0,compareRGB:u=!1,darkMode:g=!1,...S}=l,y=k.useCallbackRef(h,[h]),C=k.useCallbackRef(i,[i]),b=k.useCallbackRef(d,[d]),[w,j]=r.useState(()=>{}),T=t||w||n||p?.autoColor,B=r.useRef(!1),I=r.useCallback(()=>{},[]),D=k.useCallbackRef(()=>{j(n)},[n]),F=k.useCallbackRef(R=>{B.current||(j(R),y?.(R))},[y]),O=k.useCallbackRef(R=>{B.current||(j(R),C?.(R))},[C]),P=k.useCallbackRef((R,_)=>{B.current||(j(void 0),b?.(R,_))},[b]),v=r.useMemo(()=>e.jsx(E.Box,{sx:{width:"24px",height:"24px",color:"inherit","--sxl-color-active":`${T?.toCSS(g)??"transparent"}`,"& .activeColor":{fill:`${T?.toCSS(g)??"transparent"}`},"& .style_grey":{fill:R=>R.palette.text.icon??R.palette.action.active}},children:typeof a=="function"?a():a}),[T,a,g]),M=k.useCallbackRef(R=>{b?.(t,!1)},[b,t]),[H,A]=r.useState(!1),V=r.useCallback(R=>{const{closeFloat:_,closeFloatAll:X}=R;return e.jsx(Dr,{...p,selectedColor:n,previewColor:w,onDone:x?X:_,onKeyDown:q=>{q.which===k.KeyCodes.Enter&&(x?X():_())},onPreviewColorImmediate:O,onPreviewColor:F,onSelectColor:P,onEyeDropStart:()=>A(!0),onEyeDropStop:()=>A(!1),compareRGB:u,darkMode:g})},[n,w,x,T,p?.autoColor,g]),N={onQuickClick:t?M:void 0,createPopupPanel:V,popupProps:{popperProps:{resizeOnOverflow:!1}},onPopupOpen:D,onPopupClose:I,tooltip:c||m||"Color",label:m,icon:v,...S};return f===o.PopupButtonType.Toolbar?e.jsx(o.ExhibitPopupIconButton,{ref:s,...N}):e.jsx(o.ExhibitPopupMenuItem,{ref:s,...N})})),eo=82,No=l=>{const{styleColor:s,length:n=eo,width:t=1,dashArray:a=null,sx:c,isDouble:m=!1,isAngled:h=!1,darkMode:i=!1,...d}=l;return e.jsx(E.SvgIcon,{sx:{width:`${n}px`,height:`${t}px`,color:"inherit",overflow:"visible","& .activeColor":{stroke:f=>`${s?s.toRGBA(i).toString():f.palette.text.icon??f.palette.action.active}`},"& .style_grey":{stroke:f=>f.palette.text.icon??f.palette.action.active},...c},height:t,width:n,viewBox:`0 0 ${n} ${t}`,...d,children:e.jsx(ie.StyledStrokePath,{length:n,width:t,dashArray:a,isDouble:m,isAngled:h,className:"activeColor"})})},Fr=r.memo(r.forwardRef((l,s)=>{const{variant:n,showLabels:t=!1,disabled:a=!1,createPopupPanel:c,styleColor:m,selectedStyle:h,onSelectStyle:i,showNone:d=!0,darkMode:f,sx:p,...x}=l,u=k.useCallbackRef(i,[]),g=r.useCallback(b=>{const{popupContainer:w,floatReference:j,closeFloat:T,...B}=b,I=[],D=L.IBorder.BuiltInDefinitionsArray;for(let F=0;F<D.length;F++){const O=D[F];if(O.description==="None"&&!d)continue;const P=e.jsx(No,{styleColor:m,length:eo,width:O.width,darkMode:f,dashArray:O.pattern,isDouble:O.description.toLowerCase().includes("double"),isAngled:O.description.toLowerCase().includes("slant")});let v=null;v=t?e.jsxs(e.Fragment,{children:[e.jsx(E.Box,{sx:{marginRight:"6px"},children:O.description}),e.jsxs(E.Box,{sx:{marginLeft:"6px",marginRight:"6px",display:"flex",alignItems:"center",flex:"1 1 100%"},children:[e.jsx("div",{style:{flex:"1 1 100%"}}),P]})]}):O.description==="None"?"None":P,I.push(e.jsx(o.ExhibitMenuItem,{className:"border-stroke",tabIndex:0,sx:{height:"28px","& svg path.activeColor":{filter:o.createStrokeShadowFilter(4)},paddingLeft:"16px",background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},tooltipProps:{description:t?"":O.description},icon:null,disabled:a,onMouseDown:M=>M.preventDefault(),onMouseUp:()=>{T(),u(O.style)},onKeyDown:M=>{M.which===k.KeyCodes.Enter&&T()},selected:O.style===h,parentFloat:j,children:v},F))}return e.jsx(E.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:I})},[a,d,m,h,f]),S=r.useMemo(()=>{const b=L.IBorder.BuiltInDefinitions.get(h);let w;return w=b.description==="None"?e.jsx(E.Box,{sx:{minWidth:`${eo}px`},children:"None"}):e.jsx(No,{styleColor:m,length:eo,width:b.width,dashArray:b.pattern,darkMode:f,isDouble:b.description.toLowerCase().includes("double"),isAngled:b.description.toLowerCase().includes("slant")}),e.jsx(E.Box,{className:"border-stroke",sx:{paddingLeft:"12px",marginLeft:"4px",marginRight:"4px",height:"24px",display:"flex",alignItems:"center","& svg path.activeColor":{filter:o.createStrokeShadowFilter()}},children:w})},[h,m]),y=r.useMemo(()=>L.IBorder.BuiltInDefinitions.get(h),[h]),C={disabled:a,icon:S,tooltip:"Border Style: "+y.description,sx:{background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,...p},createPopupPanel:g,...x};return n===o.PopupButtonType.Toolbar?e.jsx(o.ExhibitPopupIconButton,{...C}):e.jsx(o.ExhibitPopupMenuItem,{...C})})),Nr=r.memo(r.forwardRef((l,s)=>{const{autoColor:n=null,schemeLookup:t,autoStrokeStyle:a=L.IBorder.StrokeStyle.Thin,disabled:c=!1,darkMode:m=!1,showStylingBefore:h=!0,onSelectBorder:i,onPreviewBorder:d,selectedBorder:f,createTemporaryBorder:p,...x}=l,u=k.useCallbackRef(i,[i]),g=k.useCallbackRef(d,[d]),[S,y]=r.useState(),[C,b]=r.useState(),w=S??a,j=C??n,T=f||{bottom:{style:a,color:n?.toString()}},B=k.useCallbackRef(v=>{const M={},H=v?Object.keys(v):[];let A=!1;for(let Z=0;Z<H.length;Z++)v[H[Z]]?.style&&(M[H[Z]]={style:v[H[Z]].style,color:v[H[Z]].color},A||M[H[Z]].style===L.IBorder.StrokeStyle.None||(A=!0));H.length<6&&(A=!0);const V=A?M.left:null,N=A?M.top:null,R=A?M.right:null,_=A?M.bottom:null,X=A?M.vertical:null,q=A?M.horizontal:null;let U="";return N||V||(U+="M 3,5 H 5 V 3 H 3 "),N||(U+="M 7,5 H 9 V 3 H 7 "),N||X||(U+="M 11,5 h 2 V 3 h -2 "),N||(U+="M 15,5 h 2 V 3 h -2 "),N||R||(U+="M 19,5 h 2 V 3 h -2 "),V||(U+="M 3,9 H 5 V 7 H 3 "),X||(U+="M 11,9 h 2 V 7 h -2 "),R||(U+="M 19,9 h 2 V 7 h -2 "),q||V||(U+="M 3,13 H 5 V 11 H 3 "),q||(U+="M 7,13 H 9 V 11 H 7 "),q||X||(U+="M 11,13 h 2 v -2 h -2 "),q||R||(U+="M 19,13 h 2 v -2 h -2 "),q||(U+="M 15,13 h 2 v -2 h -2 "),V||(U+="M 3,17 H 5 V 15 H 3 "),X||(U+="M 11,17 h 2 v -2 h -2 "),R||(U+="M 19,17 h 2 v -2 h -2 "),_||V||(U+="M 3,21 H 5 V 19 H 3 "),_||(U+="M 7,21 H 9 V 19 H 7 "),_||X||(U+="M 11,21 h 2 v -2 h -2 "),_||(U+="M 15,21 h 2 v -2 h -2 "),_||R||(U+="M 19,21 h 2 v -2 h -2 "),e.jsxs("div",{style:{width:"24px",height:"24px",position:"relative"},children:[e.jsx(E.SvgIcon,{sx:{position:"absolute",top:"0px",left:"0px","& path":{opacity:"0.8",transform:"translate(-0.5px, -0.5px)"}},children:e.jsx("path",{d:U})}),e.jsx(E.Box,{sx:{width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"-1px",left:"-1px","& svg path":{filter:o.strokeShadowFilter}},children:e.jsx(ie.StaticBorderRenderer,{getBorderAt:(Z,ee)=>{if(!p||H.length===0)return null;const K=Z.rowIndex,z=Z.colIndex,J={};return K===0?(J.top=M.top,J.bottom=M.horizontal):(J.top=M.horizontal,J.bottom=M.bottom),z===0?(J.left=M.left,J.right=M.vertical):(J.left=M.vertical,J.right=M.right),p?.(J)},width:18,height:18,darkMode:m,style:{top:"0px",left:"0px",width:"18px",height:"18px",minWidth:"18px",minHeight:"18px",position:"relative"}})})]})},[j,w,m]),I=r.useCallback((v,M,H)=>{let A=null;if(v&&v.length>0){let V=null;(M||H)&&(V={style:H,color:M?.toString()??null}),A={};for(let N=0;N<v.length;N++)A[v[N]]=V}return A},[]),D=r.useCallback(v=>{u?.(v)},[]),F=r.useCallback(v=>{g?.(v)},[]),O=r.useCallback(v=>{const{closeFloatAll:M,floatReference:H}=v,A=(R,_,X="bottom",q=!1)=>{const U=I(R,j??null,q?L.IBorder.StrokeStyle.None:w??null),Z=q?I([],j??null,w??null):U;return e.jsx(o.ExhibitIconButton,{icon:B(Z),sx:{background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},tooltipProps:{label:_,simple:!0,placement:X},onClick:()=>{M(),F(U),D(U)}})},V=e.jsxs(e.Fragment,{children:[e.jsxs(E.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[A([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom,L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical],"All Borders","top"),A([L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical],"Inner Borders","top"),A([L.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),A([L.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),A([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom],"Outside Borders","top")]}),e.jsxs(E.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[A([L.IBorder.Edge.Left],"Left Borders"),A([L.IBorder.Edge.Top],"Top Borders"),A([L.IBorder.Edge.Right],"Right Borders"),A([L.IBorder.Edge.Bottom],"Bottom Borders"),A([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom,L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical,L.IBorder.Edge.DiagonalUp,L.IBorder.Edge.DiagonalDown],"No Borders","bottom",!0)]})]}),N=e.jsx(e.Fragment,{children:e.jsxs(E.Box,{sx:{display:"flex",padding:"6px 16px",flexDirection:"row",gap:"6px"},children:[e.jsx(Wo,{variant:o.PopupButtonType.Toolbar,icon:e.jsx(o.ColorizedStrokeIcon,{}),selectedColor:w===L.IBorder.StrokeStyle.None?new L.Color("transparent"):j,onPreviewColor:R=>{b(R)},onSelectColor:(R,_)=>{b(R)},darkMode:m,tooltip:"Border Color",panelProps:{disableAlpha:!0,autoColor:n,schemeLookup:t},disabled:c||w===L.IBorder.StrokeStyle.None,parentFloat:H,shouldCloseFloatAll:!1}),e.jsx(Fr,{selectedStyle:w,onSelectStyle:y,styleColor:j,darkMode:m,variant:o.PopupButtonType.Toolbar,parentFloat:H})]})});return e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},onClick:R=>R.stopPropagation(),children:[h?N:V,e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),h?V:N]})},[w,j,n,t,m]),P=r.useMemo(()=>B(T),[T,m]);return e.jsx(o.ExhibitPopupIconButton,{ref:s,createPopupPanel:O,popupProps:{popperProps:{resizeOnOverflow:!1}},createTooltip:({children:v},M)=>e.jsx(o.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:M,children:v}),onQuickClick:()=>{u?.(T)},quickButtonProps:{sx:{}},disabled:c,icon:P,...x})})),Ar=r.memo(r.forwardRef((l,s)=>{const{commands:n,command:t,commandHook:a,variant:c=k.CommandButtonType.Toolbar,disabled:m=!1,autoColor:h,autoStrokeStyle:i,schemeLookup:d,createTemporaryBorder:f,selectedBorder:p,onSelectBorder:x,darkMode:u,icon:g,label:S,...y}=l,C=k.useCommands(n,["formatBorder"]),b=t??C[0],w=b?.context()??null,j=w?.autoColor??h,T=w?.autoStyle??i,B=p??w?.quickBorder,I=u??w?.darkMode,D=f??w?.createTemporaryBorder,F=d??w?.schemeLookup,O=k.useCallbackRef(v=>{w?.onBorderSelect&&w.onBorderSelect(v),x?.(v),b?.execute(v,a)},[b,x,a]),P=r.useCallback((v,M)=>{const{children:H,title:A,...V}=v;let N=v.children;return(b?.disabled()||m)&&(N=e.jsx("div",{children:N})),e.jsx(o.CommandTooltip,{command:b,placement:c===k.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:M,...V,children:N})},[b,m]);return e.jsx(Nr,{ref:s,autoColor:j,darkMode:I,autoStrokeStyle:T,createTemporaryBorder:D,schemeLookup:F,selectedBorder:B,onSelectBorder:O,createTooltip:P,disabled:m||!b||b.disabled(),...y})})),Or=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=r.useCallback((i,d)=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:a,disabled:c},p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:d.getCommand("mergeToggle"),icon:o.themeIcon(e.jsx(o.MergeAllIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("mergeHorizontal"),icon:o.themeIcon(e.jsx(o.MergeHorizontalIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("mergeVertical"),icon:o.themeIcon(e.jsx(o.MergeVerticalIcon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...f,command:d.getCommand("unmerge"),icon:o.themeIcon(e.jsx(o.MergeUnMergeIcon,{}))})]});return o.defaultCreatePopupPanel({...i,children:p})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,quickCommand:"mergeToggle",commandHook:t,scope:a,tooltip:"Combine or split cells.",createPopupPanel:h,icon:o.themeIcon(e.jsx(o.MergeAllIcon,{})),...m})})),Lr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=r.useCallback((i,d)=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:a,disabled:c},p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:d.getCommand("freezeToggle"),icon:o.themeIcon(e.jsx(o.FreezeBothIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("freezeToggleHorizontal"),icon:o.themeIcon(e.jsx(o.FreezeRowsIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("freezeToggleVertical"),icon:o.themeIcon(e.jsx(o.FreezeColumnsIcon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...f,command:d.getCommand("unfreeze"),icon:e.jsx(o.MergeUnMergeIcon,{})})]});return o.defaultCreatePopupPanel({...i,children:p})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,createPopupPanel:h,quickCommand:"freezeToggle",label:"Freeze Panes",tooltip:"Freeze a portion of the sheet to keep it visible while you scroll through the rest of the sheet.\\n\\nUseful for viewing data in other parts of your worksheet without losing your headers or labels.",icon:e.jsx(o.FreezeIcon,{}),...m})})),Hr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=r.useCallback((i,d)=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:a,disabled:c},p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:d.getCommand("find"),icon:o.themeIcon(e.jsx(o.FindIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("findReplace"),icon:o.themeIcon(e.jsx(o.FindReplaceIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("goto"),icon:o.themeIcon(e.jsx(o.GotoIcon,{}))})]});return o.defaultCreatePopupPanel({...i,children:p})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,createPopupPanel:h,label:"Find & Select",tooltip:"Find and replace cells or go to a specific location.",quickCommand:"find",icon:o.themeIcon(e.jsx(o.FindIcon,{})),...m})})),zr=r.memo(r.forwardRef((l,s)=>{const{command:n,commandHook:t,showQuickButtons:a=!!l.commands,commands:c,fontSizes:m=ie.FontUtils.DefaultFontSizes,disabled:h=!1,parentFloat:i,icon:d,label:f,sx:p,...x}=l;k.useCommand(n);const u=()=>n?.state()?.toString()||"11",[g,S]=r.useState(u),y=k.useCallbackRef(()=>{const D=parseFloat(g);isNaN(D)?S(u()):parseFloat(u())!==D&&n.execute(D,t)},[u,n,g,t]);r.useEffect(()=>{S(u())},[n?.state()]);const C=r.useMemo(()=>{if(!t)return null;const D={...t};return delete D.beforeExecute,D},[t]),b=k.useCommands(c,["formatFontSizeIncrease","formatFontSizeDecrease"]),w=r.useMemo(()=>b?e.jsxs(E.Box,{className:ge("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:D=>D.stopPropagation(),children:[e.jsx(o.CommandButton,{command:b[0],commandHook:C,icon:o.themeIcon(e.jsx(o.TextSizeIncreaseIcon,{}))}),e.jsx(o.CommandButton,{command:b[1],icon:o.themeIcon(e.jsx(o.TextSizeDecreaseIcon,{}))})]}):null,[b]),j=G.useTheme(),T=r.useMemo(()=>`${L.IFont.getSharedMeasurer()("12.3",Math.round(j.typography.fontSize),j.typography.fontFamily).width}px`,[j]),B=r.useCallback(D=>{const{onMouseDown:F,onMouseUp:O,...P}=D;return e.jsx(E.IconButton,{component:"div",...P,disableRipple:!0,children:e.jsx(E.Input,{inputMode:"numeric",disabled:h||!n||n.disabled(),inputProps:{name:"font-input",autoComplete:"off",tabIndex:0,type:"number",maxLength:4,max:409,min:2},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:v=>`1px solid ${v.palette.text.icon??v.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:v=>`1px solid ${v.palette.error.main}`},"::after":{borderBottom:v=>`1px solid ${v.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:v=>`${Math.round(v.typography.fontSize)}px`,width:T,color:v=>v.palette.text.secondary,input:{padding:"0 0",textAlign:"center",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:v=>v.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:v=>v.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"},minHeight:"24px"},value:g,onFocus:v=>{v.target?.select()},onKeyDown:v=>{if(v.which===k.KeyCodes.Enter)u()!==g&&(v.stopPropagation(),v.preventDefault(),y());else if(v.which===k.KeyCodes.Escape)u()!==g&&(S(u()),setTimeout(()=>{v.target?.select()},0),v.stopPropagation(),v.preventDefault());else{if(v.key.match("[-]")||v.key.match("[0-9.]")&&(g+v.key).length>4)return v.stopPropagation(),void v.preventDefault();if(v.which===k.KeyCodes.Space)return void v.preventDefault()}},onBlur:()=>{y()},onChange:v=>{if(v.target.value.length>4)return v.stopPropagation(),void v.preventDefault();S(v.target.value)}})})},[g,h,n]),I=r.useCallback(D=>{const F=M=>{n?.execute(M,t)},O=n?.state(),P=[];for(let M=0;M<m.length;M++){const H=m[M]===O;P.push(e.jsx(o.ExhibitMenuItem,{selected:H,icon:H?e.jsx(o.SelectedIcon,{}):void 0,disabled:h||!n||n.disabled(),onMouseDown:A=>{A.button===0&&A.preventDefault()},onMouseUp:A=>{A.button===0&&F(m[M])},onKeyDown:A=>{A.keyCode!==k.KeyCodes.Enter&&A.keyCode!==k.KeyCodes.Space||F(m[M])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(E.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:m[M]})},"fontSize-"+M))}const v=e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...x,children:[w,e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:P})]});return o.defaultCreatePopupPanel({...D,children:v})},[h,n?.state(),t]);return e.jsx(o.ExhibitPopupIconButton,{ref:s,sx:{...p},tabIndex:-1,outlined:!0,disabled:h,parentFloat:i,createPopupPanel:I,createTooltip:({children:D},F)=>e.jsx(o.ExhibitTooltip,{label:n?.label(),description:n?.description(),disabled:F||n?.disabled(),children:D}),createQuickButton:B,...x})})),Nn=r.memo(l=>{const{selected:s,disabled:n,formattedValue:t,handleSetFormat:a,format:c,sx:m,...h}=l;return e.jsx(o.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...m},disabled:n,selected:s,icon:s?e.jsx(o.SelectedIcon,{}):void 0,onMouseDown:i=>{i.button===0&&i.preventDefault()},onMouseUp:i=>{i.button===0&&a(c.numberFormat)},onKeyDown:i=>{i.keyCode!==k.KeyCodes.Enter&&i.keyCode!==k.KeyCodes.Space||a(c.numberFormat)},...h,children:e.jsxs(E.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(E.Typography,{component:"div",children:[c.formatType,c.formatType===L.NumberFormat.Type.Custom?"…":""]}),e.jsx(E.Typography,{variant:"caption",component:"div",sx:{color:i=>Re.alpha(i.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),Wr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,sx:c,disabled:m=!1,parentFloat:h,...i}=l,d=k.useCommands(n,["formatNumberFormat"])[0],f=d?.state()?L.NumberFormat.Styles.lookupStyle(d?.state()).formatType:L.NumberFormat.Type.General,p=r.useMemo(()=>{if(!t)return null;const S={...t};return delete S.beforeExecute,S},[t]),x=r.useCallback((S,y)=>{const C=O=>{t?.beforeExecute?.(d,d?.state()),d.execute(O,t),t?.onExecute?.(d,d?.state())},b=d?.context()(),w=L.NumberFormat.Styles.lookupPrimary(),j=[];for(let O=0;O<w.length;O++){let P="";if(b&&!b.isEmpty())try{P=b.getNumberFormat(w[O].numberFormat).displayText}catch(M){console.warn(M)}P===""&&w[O].formatType===L.NumberFormat.Type.General&&(P="No specific format");const v=w[O].formatType===f;j.push(e.jsx(Nn,{selected:v,disabled:m||!d||d.disabled(),formattedValue:P,handleSetFormat:C,format:w[O]},w[O].formatType))}const T={numberFormat:"",formatType:L.NumberFormat.Type.Custom},B=f===L.NumberFormat.Type.Custom,I=e.jsx(Nn,{selected:B,disabled:m||!d||d.disabled(),formattedValue:B?b.getNumberFormat().displayText:"",handleSetFormat:()=>{t?.beforeExecute?.(d,d?.state()),y.getCommand("formatNumberDialog")?.execute(d?.state()),t?.onExecute?.(d,d?.state())},format:T,sx:{flex:"0",width:"100%"}},L.NumberFormat.Type.Custom),D=e.jsxs(E.Box,{className:"quick-buttons",sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:O=>O.stopPropagation(),children:[e.jsx(o.CommandButton,{command:y.getCommand("formatNumberFormatAccountingStyle"),commandHook:p,scope:a,icon:e.jsx(o.CurrencyDollarIcon,{})}),e.jsx(o.CommandButton,{command:y.getCommand("formatNumberFormatPercentStyle"),commandHook:p,scope:a,icon:e.jsx(o.PercentIcon,{})}),e.jsx(o.CommandButton,{command:y.getCommand("formatNumberFormatCommaStyle"),commandHook:p,scope:a,icon:e.jsx(o.CommaIcon,{})}),e.jsx(o.CommandButton,{command:y.getCommand("formatNumberFormatIncreaseDecimal"),commandHook:p,scope:a,icon:o.themeIcon(e.jsx(o.IncreaseDecimalIcon2,{}))}),e.jsx(o.CommandButton,{command:y.getCommand("formatNumberFormatDecreaseDecimal"),commandHook:p,scope:a,icon:o.themeIcon(e.jsx(o.DecreaseDecimalIcon2,{}))})]}),F=e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...i,children:[D,e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:j}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),I]});return o.defaultCreatePopupPanel({...S,children:F})},[d?.context(),d?.state(),t,a]),u=G.useTheme(),g=r.useMemo(()=>{const S=L.NumberFormat.Type.MediumTime;return`${L.IFont.getSharedMeasurer()(S,Math.round(u.typography.fontSize),u.typography.fontFamily).width}px`},[u]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,sx:c,outlined:!0,disabled:m,parentFloat:h,createPopupPanel:x,createTooltip:({children:S},y)=>e.jsx(o.ExhibitTooltip,{label:d?.label(),description:d?.description(),disabled:y,children:S}),icon:e.jsx(E.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:S=>`${Math.round(S.typography.fontSize)}px`,color:S=>S.palette.text.secondary,fontFamily:S=>S.typography.fontFamily,width:g},children:e.jsx(E.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:f})}),...i})})),Vo=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=r.useCallback((i,d)=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"clear",disabled:c},p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:d.getCommand("clearAll"),icon:e.jsx(o.ClearAllIcon,{})}),e.jsx(o.CommandButton,{...f,command:d.getCommand("clearFormats"),icon:o.themeIcon(e.jsx(o.ClearFormatsIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("clearContents"),icon:o.themeIcon(e.jsx(o.ClearContentsIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("clearComments")}),e.jsx(o.CommandButton,{...f,command:d.getCommand("clearHyperlinks")})]});return o.defaultCreatePopupPanel({...i,children:p})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,disabled:c,commandHook:t,scope:a,label:"Clear",tooltip:"Clear everything in the cell, or remove just the formatting or contents.",createPopupPanel:h,icon:e.jsx(o.ClearAllIcon,{}),...m})})),Vr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=r.useCallback((i,d)=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"fill",disabled:c},p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:d.getCommand("fillDown"),icon:o.themeIcon(e.jsx(o.FillDownIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("fillRight"),icon:o.themeIcon(e.jsx(o.FillDownIcon,{sx:{transform:"rotate(270deg)"}}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("fillUp"),icon:o.themeIcon(e.jsx(o.FillDownIcon,{sx:{transform:"rotate(180deg)"}}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("fillLeft"),icon:o.themeIcon(e.jsx(o.FillDownIcon,{sx:{transform:"rotate(90deg)"}}))})]});return o.defaultCreatePopupPanel({...i,children:p})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,disabled:c,commandHook:t,label:"Fill",tooltip:"Fill the selected cells with the value from one of the corners.",createPopupPanel:h,icon:o.themeIcon(e.jsx(o.FillDownIcon,{})),...m})})),$o=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,disableSheet:m=!1,preferSingleMenu:h=!0,showQuickButton:i=!0,variant:d=k.CommandButtonType.Toolbar,...f}=l,p=["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns"],x=k.useCommands(n,p),{singleCommand:u,allDisabled:g}=r.useMemo(()=>{let C=null,b=0;for(let w=0;w<x.length;w++)x[w]&&!x[w]?.disabled()&&(h&&d===k.CommandButtonType.Menuitem&&(C=b===0?x[w]:null),b++);return{singleCommand:C,allDisabled:b===0}},[x]),S=r.useMemo(()=>{const C=new Map;return C.set("insertCellsShiftDown",o.themeIcon(e.jsx(o.InsertCells,{}))),C.set("insertCellsShiftRight",o.themeIcon(e.jsx(o.InsertCells,{sx:{transform:"rotate(270deg)"}}))),C.set("insertRows",o.themeIcon(e.jsx(o.InsertRowIcon,{}))),C.set("insertColumns",o.themeIcon(e.jsx(o.InsertColumn2Icon,{}))),C},[]),y=r.useCallback((C,b)=>{let w=null;const j={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"insertCells",disabled:c};m||(w=e.jsxs(e.Fragment,{children:[e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...j,command:b.getCommand("addSheet"),icon:o.themeIcon(e.jsx(o.BlankIcon,{}))})]}));const T=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...j,command:x[0],icon:S.get(p[0])}),e.jsx(o.CommandButton,{...j,command:x[1],icon:S.get(p[1])}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...j,command:x[2],icon:S.get(p[2])}),e.jsx(o.CommandButton,{...j,command:x[3],icon:S.get(p[3])}),w]});return o.defaultCreatePopupPanel({...C,children:T})},[c,x,t,a,S]);return u?e.jsx(o.CommandButton,{ref:s,variant:d,commandHook:t,disabled:c,command:u,icon:S.get(u.key()),...f}):e.jsx(o.CommandPopupButton,{ref:s,variant:d,quickCommand:"insertCells",commands:n,commandHook:t,scope:a,disabled:c||g,tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Insert new cells, rows or columns to your workbook."}),e.jsx("br",{}),e.jsx("span",{children:"To insert multiple rows or columns at a time, select multiple rows or columns in the sheet and click Insert."})]}),createPopupPanel:y,icon:o.themeIcon(e.jsx(o.InsertColumn2Icon,{})),...f})})),Uo=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,disableSheet:m=!1,preferSingleMenu:h=!0,showQuickButton:i=!0,variant:d=k.CommandButtonType.Toolbar,...f}=l,p=k.useCommands(n,["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"]),{singleCommand:x,allDisabled:u}=r.useMemo(()=>{let y=null,C=0;for(let b=0;b<p.length;b++)p[b]&&!p[b]?.disabled()&&(h&&d===k.CommandButtonType.Menuitem&&(y=C===0?p[b]:null),C++);return{singleCommand:y,allDisabled:C===0}},[p]),g=r.useMemo(()=>{const y=new Map;return y.set("deleteCellsShiftUp",o.themeIcon(e.jsx(o.RemoveCellsIcon,{sx:{transform:"rotate(0deg)"}}))),y.set("deleteCellsShiftLeft",o.themeIcon(e.jsx(o.RemoveCellsIcon,{sx:{transform:"rotate(270deg)"}}))),y.set("deleteRows",o.themeIcon(e.jsx(o.RemoveRowIcon,{}))),y.set("deleteColumns",o.themeIcon(e.jsx(o.RemoveColumn2Icon,{}))),y},[]),S=r.useCallback((y,C)=>{const b={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:c};let w=null;m||(w=e.jsxs(e.Fragment,{children:[e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...b,command:C.getCommand("deleteSheet"),icon:o.themeIcon(e.jsx(o.BlankIcon,{}))})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...b,command:C.getCommand("deleteCellsShiftUp"),icon:g.get("deleteCellsShiftUp")}),e.jsx(o.CommandButton,{...b,command:C.getCommand("deleteCellsShiftLeft"),icon:g.get("deleteCellsShiftLeft")}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...b,command:C.getCommand("deleteRows"),icon:g.get("deleteRows")}),e.jsx(o.CommandButton,{...b,command:C.getCommand("deleteColumns"),icon:g.get("deleteColumns")}),w]});return o.defaultCreatePopupPanel({...y,children:j})},[c,t,a,g]);return x?e.jsx(o.CommandButton,{ref:s,variant:d,commandHook:t,disabled:c,command:x,icon:g.get(x.key()),...f}):e.jsx(o.CommandPopupButton,{ref:s,variant:d,quickCommand:"deleteCells",commands:n,commandHook:t,scope:a,disabled:c||u,tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Delete cells, rows, columns or sheets from your workbook."}),e.jsx("br",{}),e.jsx("span",{children:"To delete multiple rows or columns at a time, select multiple rows or columns in the sheet and click Delete."})]}),createPopupPanel:S,icon:o.themeIcon(e.jsx(o.RemoveColumn2Icon,{})),...f})})),ut=r.memo(r.forwardRef((l,s)=>{const{command:n,commandHook:t,onSelectColor:a,disabled:c=!1,variant:m=k.CommandButtonType.Toolbar,quickColor:h,panelProps:i,isSplit:d=!1,darkMode:f,icon:p,...x}=l,{autoColor:u,schemeLookup:g,recentColors:S,...y}=i;if(x.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");k.useCommand(n);const C=n?.context();let b=h??C?.quickColor;d&&!b&&(b=new L.Color("transparent"));const w=u??C?.autoColor,j=g??C?.schemeLookup,T=S??C?.recentColors,B=f??C?.darkMode,I=r.useMemo(()=>({autoColor:w,schemeLookup:j,recentColors:T,darkMode:B,...y}),[w,j,T,B]),D=k.useCallbackRef((O,P)=>{O&&P&&C?.addRecentColor&&C.addRecentColor(O),C?.onColorSelect&&C.onColorSelect(O),a?.(O,P),n?.execute(O,t)},[n,a,t,C]),F=r.useCallback((O,P)=>{const{children:v,title:M,...H}=O;let A=O.children;return(n?.disabled()||c)&&(A=e.jsx("div",{children:A})),e.jsx(o.CommandTooltip,{command:n,placement:m===k.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:P,...H,children:A})},[n,c]);return e.jsx(Wo,{ref:s,panelProps:I,icon:p,quickColor:b,selectedColor:n?.state(),onSelectColor:D,variant:m===k.CommandButtonType.Menuitem?o.PopupButtonType.Menuitem:o.PopupButtonType.Toolbar,createTooltip:F,label:n?.label(),disabled:c||!n||n.disabled(),compareRGB:!0,darkMode:B,...x})}));ut.displayName="ColorCommandButton";const $r=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,parentFloat:m,...h}=l,i=k.useCommands(n,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),d=r.useCallback((f,p)=>{const x={variant:k.CommandButtonType.Menuitem,parentFloat:f.floatReference,commandHook:t,scope:a,disabled:c},u=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...x,command:p.getCommand("gridlinesToggle")}),e.jsx(ut,{...x,command:p.getCommand("sheetViewFormatGridlinesColor"),icon:e.jsx(o.ColorizedStrokeIcon,{}),panelProps:{disableAlpha:!0}}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...x,command:p.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(o.CommandButton,{...x,command:p.getCommand("sheetViewToggleGridlinesRows")})]});return o.defaultCreatePopupPanel({...f,children:u})},[c,t]);return e.jsx(o.CommandPopupButton,{ref:s,parentFloat:m,quickCommand:i[0]?.key(),commands:n,commandHook:t,createPopupPanel:d,label:"Gridlines",tooltip:"Configure how the lines between rows and columns in the sheet are displayed.",icon:e.jsx(o.LabelIcon,{command:i[0],scope:"view"}),...h})})),_o=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=r.useCallback((i,d)=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:c},p=d.getCommand("sortCustom"),x=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:d.getCommand("sortAscending"),icon:o.themeIcon(e.jsx(o.SortIncreaseIcon,{}))}),e.jsx(o.CommandButton,{...f,command:d.getCommand("sortDescending"),icon:o.themeIcon(e.jsx(o.SortDecreaseIcon,{}))}),p?e.jsx(o.CommandButton,{...f,command:p,icon:o.themeIcon(e.jsx(o.SortCustomIcon,{}))}):null,e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...f,scope:"filter",command:d.getCommand("autoFilterToggle"),icon:o.themeIcon(e.jsx(o.FilterToggleIcon,{}))}),e.jsx(o.CommandButton,{...f,scope:"filter",command:d.getCommand("autoFilterClear"),icon:o.themeIcon(e.jsx(o.FilterClearIcon,{}))}),e.jsx(o.CommandButton,{...f,scope:"filter",command:d.getCommand("autoFilterReapply"),icon:o.themeIcon(e.jsx(o.FilterReapplyIcon,{}))})]});return o.defaultCreatePopupPanel({...i,children:x})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,scope:a,disabled:c,label:"Sort",tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Organize your data so it's easier to analyze."}),e.jsx("br",{}),e.jsx("span",{children:"You can sort the selected data from smallest to largest or largest to smallest."})]}),createPopupPanel:h,icon:o.themeIcon(e.jsx(o.SortIncreaseIcon,{})),...m})})),Vl=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=r.useCallback((i,d)=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:c},p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,scope:"filter",command:d.getCommand("autoFilterToggle"),icon:o.themeIcon(e.jsx(o.FilterToggleIcon,{}))}),e.jsx(o.CommandButton,{...f,scope:"filter",command:d.getCommand("autoFilterClear"),icon:o.themeIcon(e.jsx(o.FilterClearIcon,{}))}),e.jsx(o.CommandButton,{...f,scope:"filter",command:d.getCommand("autoFilterReapply"),icon:o.themeIcon(e.jsx(o.FilterReapplyIcon,{}))})]});return o.defaultCreatePopupPanel({...i,children:p})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,scope:a,disabled:c,label:"Filter",tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Organize your data so it's easier to analyze."}),e.jsx("br",{}),e.jsx("span",{children:"You can sort the selected data from smallest to largest or largest to smallest."})]}),createPopupPanel:h,icon:o.themeIcon(e.jsx(o.FilterToggleIcon,{})),...m})})),Ko=r.memo(r.forwardRef((l,s)=>{const{quickCommand:n,icon:t,isRedo:a=!1,nestRedo:c=!0,undoManager:m,scope:h,sx:i,disabled:d,commands:f,...p}=l,x=[n];!a&&c&&x.push("redo");const u=k.useCommands(f,x),g=u[0],S=u[1],y=m??g?.context?.()?.undoManager;let C=d;d||(C=!g||g.disabled(),S&&!S.disabled()&&(C=!1));const[b,w]=r.useState(0),j=r.useCallback((T,B)=>{let I=b===0?"Cancel":`${g.label()} ${b} Action${b===1?"":"s"}`,D=!1;y||(D=!0),D||(D=c?!y.hasRedo()&&!y.hasUndo():!y.hasRedo());const F=A=>{g.execute(A)},O=e.jsx(o.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:D?void 0:"0 0",minWidth:"180px"},icon:null,onMouseEnter:()=>{w(0)},onMouseDown:A=>{A.button===0&&A.preventDefault()},onMouseUp:A=>{A.button===0&&F(b)},onKeyDown:A=>{A.isDefaultPrevented()||A.keyCode!==k.KeyCodes.Enter&&A.keyCode!==k.KeyCodes.Space||F(b)},children:e.jsx(E.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:I})});if(D)return O;const P=a?y?.getRedoDescriptions():y?.getUndoDescriptions(),v=[];for(let A=0;A<P.length;A++){const V=P[A];v.push(e.jsx(o.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},icon:e.jsx(o.BlankIcon,{}),disabled:C,selected:A<b,onMouseEnter:()=>{w(A+1)},onMouseDown:N=>{N.button===0&&N.preventDefault()},onMouseUp:N=>{N.button===0&&F(A+1)},onKeyDown:N=>{N.isDefaultPrevented()||N.keyCode!==k.KeyCodes.Enter&&N.keyCode!==k.KeyCodes.Space||F(A+1)},children:e.jsxs(E.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",alignItems:"center",overflow:"hidden"},children:[e.jsx(E.Typography,{component:"div",children:V}),e.jsx(o.BlankIcon,{})]})},`action:${A}`))}let M=null;if(!a&&c){const A={scope:"undo",commands:B,variant:k.CommandButtonType.Menuitem,parentFloat:T.floatReference};M=[],M.push(e.jsx(Ko,{...A,quickCommand:"redo",isRedo:!0},"nested:redo")),y.hasRedo()&&y.hasUndo()&&M.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal"},"action:redo-div"))}const H=e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},onClick:()=>{T.closeFloatAll()},onMouseLeave:()=>{w(0)},children:[M,e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:v}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),O]});return o.defaultCreatePopupPanel({...T,children:H})},[g?.context(),g?.state(),h,y,b,C]);return e.jsx(o.CommandPopupButton,{ref:s,commands:f,quickCommand:n,scope:h,disabled:C,label:g?.label()??(a?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${g?.label()??"No"} last actions.`})}),createPopupPanel:j,icon:t??o.themeIcon(a?e.jsx(o.RedoIcon,{}):e.jsx(o.UndoIcon,{})),selected:!1,...p})})),mt=L.IFontCollection.getFontList(),Ur=new Map;for(let l=0;l<mt.length;l++)Ur.set(mt[l].fontRef.getFamily(),mt[l]);const _r=r.memo(r.forwardRef((l,s)=>{const{command:n,commandHook:t,sx:a,disabled:c=!1,parentFloat:m,icon:h,label:i,...d}=l;k.useCommand(n);const f=n?.state(),p=G.useTheme(),x=r.useMemo(()=>`${L.IFont.getSharedMeasurer()("Times New Roman",Math.round(p.typography.fontSize),p.typography.fontFamily).width}px`,[p]),u=r.useCallback(g=>{const S=w=>{n?.execute(w,t)},y=[];for(let w=0;w<mt.length;w++)y.push({key:mt[w].fontRef.getFamily(),description:mt[w].fontRef.getFamily()});Ur.get(f)||y.unshift({key:f,description:f});const C=[];for(let w=0;w<y.length;w++){const j=y[w].key===f;C.push(e.jsx(o.ExhibitMenuItem,{sx:{display:"flex",paddingTop:"4px",paddingBottom:"4px"},selected:j,disabled:c||!n||n.disabled(),icon:j?e.jsx(o.SelectedIcon,{}):void 0,onMouseUp:T=>{T.button===0&&S(y[w].key)},onMouseDown:T=>{T.button===0&&T.preventDefault()},onKeyDown:T=>{T.keyCode!==k.KeyCodes.Enter&&T.keyCode!==k.KeyCodes.Space||S(y[w].key)},children:e.jsx(E.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(E.Typography,{component:"div",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:()=>y[w]?.key},children:y[w].description})})},w+""+y[w].key))}const b=e.jsx(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},...d,children:e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:C})});return o.defaultCreatePopupPanel({...g,children:b})},[c,n?.state()]);return e.jsx(o.ExhibitPopupIconButton,{ref:s,sx:{...a},outlined:!0,disabled:c,parentFloat:m,createPopupPanel:u,createTooltip:({children:g},S)=>e.jsx(o.ExhibitTooltip,{label:n?.label(),description:n?.description(),disabled:S,children:g}),icon:e.jsx(E.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:g=>`${Math.round(g.typography.fontSize)}px`,fontFamily:g=>g.typography.fontFamily,color:g=>g.palette.text.secondary,width:x},children:e.jsx(E.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:f})}),...d})})),Kr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=k.useCommands(n,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),i=r.useMemo(()=>{for(let p=0;p<h.length;p++)if(h[p]?.state())return h[p].key();return h[0]?.key()},[h]),d=r.useMemo(()=>{const p=new Map;return p.set("formatStrikeThroughToggle",o.themeIcon(e.jsx(o.TextStrikeIcon,{}))),p.set("formatSuperscriptToggle",o.themeIcon(e.jsx(o.TextSuperscriptIcon,{}))),p.set("formatSubscriptToggle",o.themeIcon(e.jsx(o.TextSubscriptIcon,{}))),p},[]),f=r.useCallback((p,x)=>{const u={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:c},g=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...u,command:x.getCommand("formatStrikeThroughToggle"),icon:d.get("formatStrikeThroughToggle")}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatSuperscriptToggle"),icon:d.get("formatSuperscriptToggle")}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatSubscriptToggle"),icon:d.get("formatSubscriptToggle")})]});return o.defaultCreatePopupPanel({...p,children:g})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,quickCommand:i,commands:n,commandHook:t,createPopupPanel:f,label:"Text Effects",tooltip:"Style your text to differentiate it.",icon:d.get(i)??o.themeIcon(e.jsx(o.TextStrikeIcon,{})),...m})})),qr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=k.useCommands(n,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),i=r.useMemo(()=>{for(let p=0;p<h.length;p++)if(h[p]?.state())return h[p].key();return h[0]?.key()},[h]),d=r.useMemo(()=>{const p=new Map;return p.set("formatUnderlinedToggle",o.themeIcon(e.jsx(o.TextUnderlineIcon,{}))),p.set("formatUnderlinedDoubleToggle",o.themeIcon(e.jsx(o.TextUnderlineDoubleIcon,{}))),p.set("formatUnderlinedAccountingToggle",o.themeIcon(e.jsx(o.TextUnderlineAccountingIcon,{}))),p.set("formatUnderlinedAccountingDoubleToggle",o.themeIcon(e.jsx(o.TextUnderlineAccountingDoubleIcon,{}))),p},[]),f=r.useCallback((p,x)=>{const u={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:c},g=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...u,command:x.getCommand("formatUnderlinedToggle"),icon:o.themeIcon(e.jsx(o.TextUnderlineIcon,{}))}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatUnderlinedDoubleToggle"),icon:o.themeIcon(e.jsx(o.TextUnderlineDoubleIcon,{}))}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatUnderlinedAccountingToggle"),commandHook:t,icon:o.themeIcon(e.jsx(o.TextUnderlineAccountingIcon,{}))}),e.jsx(o.CommandButton,{...u,command:x.getCommand("formatUnderlinedAccountingDoubleToggle"),icon:o.themeIcon(e.jsx(o.TextUnderlineAccountingDoubleIcon,{}))})]});return o.defaultCreatePopupPanel({...p,children:g})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,quickCommand:i,commands:n,commandHook:t,label:"Underline",tooltip:"All underline stylings.",createPopupPanel:f,icon:d.get(i)??o.themeIcon(e.jsx(o.TextUnderlineIcon,{})),...m})})),qo=r.memo(r.forwardRef((l,s)=>{const{command:n,commands:t,commandHook:a,scope:c,includePasteAllInPopup:m=!0,disabled:h=!1,...i}=l,d=k.useCallbackRef((f,p)=>{const x={variant:k.CommandButtonType.Menuitem,commandHook:a,scope:"paste",disabled:h},u=[];return m&&(u.push(r.createElement(o.CommandButton,{...x,command:p.getCommand("paste"),key:"paste",icon:e.jsx(o.PasteIcon,{})})),u.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),u.push(r.createElement(o.CommandButton,{...x,command:p.getCommand("pasteValues"),key:"pasteValues",icon:o.themeIcon(e.jsx(o.PasteValuesIcon,{}))})),u.push(r.createElement(o.CommandButton,{...x,command:p.getCommand("pasteFormats"),key:"pasteFormats",icon:o.themeIcon(e.jsx(o.PasteFormatsIcon,{}))})),u.push(r.createElement(o.CommandButton,{...x,command:p.getCommand("pasteFormulas"),key:"pasteFormulas",icon:o.themeIcon(e.jsx(o.PasteFormulasIcon,{}))})),u.push(r.createElement(o.CommandButton,{...x,command:p.getCommand("pasteTranspose"),key:"pasteTranspose",icon:o.themeIcon(e.jsx(o.PasteTransposeIcon,{}))})),u.push(r.createElement(o.CommandButton,{...x,command:p.getCommand("pasteLinks"),key:"pasteLinks",icon:o.themeIcon(e.jsx(o.PasteLinksIcon,{}))})),o.defaultCreatePopupPanel({...f,children:u})},[h,a,c,m]);return e.jsx(o.CommandPopupButton,{ref:s,commands:t,commandHook:a,scope:c,createPopupPanel:d,label:"Paste",tooltip:"Add content to the clipboard to your document.",quickCommand:"paste",icon:e.jsx(o.PasteIcon,{}),...i})})),Gr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,parentFloat:m,...h}=l,i=k.useCommands(n,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),d=r.useCallback((f,p)=>{const x={variant:k.CommandButtonType.Menuitem,parentFloat:f.floatReference,commandHook:t,scope:a,disabled:c},u=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...x,command:p.getCommand("sheetViewToggleShowHeadings")}),e.jsx(o.CommandButton,{...x,command:p.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...x,command:p.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(o.CommandButton,{...x,command:p.getCommand("sheetViewToggleShowHeadingRows")})]});return o.defaultCreatePopupPanel({...f,children:u})},[c,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,parentFloat:m,quickCommand:i[0]?.key(),commands:n,commandHook:t,createPopupPanel:d,label:"Headings",tooltip:"Configure how the column and rows headings in the sheet are displayed.",icon:e.jsx(o.LabelIcon,{command:i[0],scope:"view"}),...h})})),Xr=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a="view",disabled:c=!1,...m}=l,h=r.useCallback(i=>{const d={variant:k.CommandButtonType.Menuitem,parentFloat:i.floatReference,commandHook:t,scope:a,disabled:c},f=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...d,command:n.getCommand("workbookViewToggleShowFormulaBar")}),e.jsx(o.CommandButton,{...d,command:n.getCommand("workbookViewToggleShowTabs")}),e.jsx(o.CommandButton,{...d,command:n.getCommand("workbookViewToggleShowStatusBar")}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...d,command:n.getCommand("workbookViewToggleShowHorizontalScrollBar")}),e.jsx(o.CommandButton,{...d,command:n.getCommand("workbookViewToggleShowVerticalScrollBar")})]});return o.defaultCreatePopupPanel({...i,children:f})},[c,n,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,disabled:c,commandHook:t,scope:a,label:"Workbook View",tooltip:"Options to configure how the workbook is displayed.",createPopupPanel:h,icon:e.jsx(o.LabelIcon,{icon:null,label:"Workbook View"}),...m})})),Yr=r.memo(r.forwardRef((l,s)=>{const{value:n,cellStyle:t,styles:a,createTemporaryCell:c,bodyStyle:m,sx:h,borderProps:i,disabled:d,...f}=l,p=r.useMemo(()=>c({value:n,style:t}),[n,t,c]),x=r.useMemo(()=>p.getStyle(),[p,m]),u=r.useMemo(()=>x.getFill().toCSS(m?.darkMode??!1),[x]),g=x.getInsets(),S=x.getFont(),y=r.useCallback(()=>x.getBorder(),[x]);return e.jsx(E.Box,{ref:s,sx:{width:"100px",textOverflow:"ellipsis",display:"flex",alignItems:"stretch",background:m?.fill,filter:d?"grayscale(0.4) opacity(0.8);":"none","& .fill":{flex:"1 1 100%",overflow:"hidden",...u},"& .text":{flex:"1 1 100%",...S.toCSS(m?.darkMode??!1,1),boxSizing:"border-box",padding:`${g.top}px ${g.right}px ${g.bottom}px ${g.left}px`,margin:"0px",outline:"none",resize:"none",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"baseline",textDecoration:S.toCSS().textDecoration,textAlign:L.ITextFrame.toCSSHorizontalTextAlign(p.getRenderHorizontalAlignment()),background:"transparent",maxHeight:"100%",whiteSpace:"pre",wordWrap:"break-word"},...h},...f,children:e.jsx(ie.StaticBorderRenderer,{getBorderAt:y,darkMode:m?.darkMode??!1,rowCount:1,columnCount:1,style:{display:"flex",flex:"1 1 100%",width:"100%",maxWidth:"100%",justifyContent:"start",alignItems:"stretch",...i?.style},...i,children:e.jsx(E.Box,{className:"fill",sx:{paddingLeft:"4px",paddingRight:"4px",marginLeft:"-1px",marginTop:"-1px",marginRight:"-1px",marginBottom:"-1px",overflow:"hidden",display:"flex",alignItems:"center"},children:e.jsx(E.Box,{className:"text",children:n})})})})})),$l=r.memo(l=>{const{styles:s,namedStyle:n,selectedNamed:t,hasContextMenu:a=!0,bodyStyle:c,onSelectNamed:m,createTemporaryCell:h,parentFloat:i,commands:d,disabled:f,commandHook:p,...x}=l,u=r.useCallback(y=>{const C={variant:k.CommandButtonType.Menuitem,commandHook:p,context:"cellStyle"},b=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...C,sx:{fontWeight:550},command:d.getCommand("formatCellStyle"),commandState:n,disabled:f,icon:o.themeIcon(e.jsx(o.PresetStylesIcon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...C,command:d.getCommand("modifyCellStyle"),commandState:{named:n}}),e.jsx(o.CommandButton,{...C,command:d.getCommand("deleteCellStyle"),commandState:n,disabled:f||n?.getName()===L.IStyle.BuiltInName.Normal})]}),w=e.jsx(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:b})});return o.defaultCreatePopupPanel({...y,children:w})},[]),g=n?.getName()===t?.getName();let S=e.jsx(o.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:y=>`solid ${g?y.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:n.getName(),placement:"bottom-start"},disabled:f,icon:null,onClick:()=>{m?.(n)},...x,children:e.jsx(Yr,{value:n.getName(),cellStyle:{named:n.getName()},styles:s,createTemporaryCell:h,bodyStyle:c})},n.getName());return a&&(S=e.jsx(o.ContextMenu,{label:n.getName(),parentFloat:i,createPopupPanel:u,children:S})),S}),Zr=r.memo(r.forwardRef((l,s)=>{const{commands:n,command:t,commandHook:a,selectedNamed:c,onSelectNamed:m,disabled:h=!1,bodyStyle:i,usePreviewIcon:d=!0,...f}=l;k.useCommand(t);const p=t?.context(),x=p?.styles,u=c??p?.named(),g=i??p?.bodyStyle(),S=k.useCallbackRef(j=>{m?.(j),t?.execute(j,a)},[t,m,a]),y=r.useCallback((j,T)=>{const B={onSelectNamed:S,styles:x(),parentFloat:j.floatReference},I=x().getCustomNamed(),D=new Map,F=[];for(let N=0;N<I.length;N++)D.set(I[N].getName(),I[N]),x().getNamed(I[N].getName()).getBuiltInID()===null&&F.push(I[N].getName());const O=N=>{let R=D.get(N);return R||(R=x().getNamed(N)),!R||R.isHidden()?null:e.jsx($l,{namedStyle:R,selectedNamed:u,bodyStyle:p.bodyStyle(),createTemporaryCell:p.createTemporaryCell,commands:n,commandHook:a,...B},N)},P=(N,R,_=!0)=>{const X=[];for(let q=0;q<R.length;q++){const U=O(R[q]);U&&X.push(U)}return X.length===0?null:e.jsxs(E.Box,{children:[_?e.jsx(o.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(o.ExhibitMenuHeader,{children:N},N+"-header"),e.jsx(E.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:X},N+"-presets")]},N)},v=(N,R)=>{const _=[];for(let X=0;X<R.length;X++){const q=O(R[X]);q&&_.push(q)}return _.length===0?null:e.jsx(E.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",flexDirection:"column",flex:"0 0 0%"},children:_},N+"-presets")},M=[];M.push(P("Custom",F,!1)),M.push(P("Good, Bad and Neutral",[L.IStyle.BuiltInName.Normal,L.IStyle.BuiltInName.Bad,L.IStyle.BuiltInName.Good,L.IStyle.BuiltInName.Neutral],F.length>0)),M.push(P("Data and Model",[L.IStyle.BuiltInName.Calculation,L.IStyle.BuiltInName.CheckCell,L.IStyle.BuiltInName.ExplanatoryText,L.IStyle.BuiltInName.FollowedHyperlink,L.IStyle.BuiltInName.Hyperlink,L.IStyle.BuiltInName.Input,L.IStyle.BuiltInName.LinkedCell,L.IStyle.BuiltInName.Note,L.IStyle.BuiltInName.Output,L.IStyle.BuiltInName.WarningText])),M.push(P("Titles and Headings",[L.IStyle.BuiltInName.Heading1,L.IStyle.BuiltInName.Heading2,L.IStyle.BuiltInName.Heading3,L.IStyle.BuiltInName.Heading4,L.IStyle.BuiltInName.Title,L.IStyle.BuiltInName.Total]));let H=[];var A,V;return H.push(v("Accent 1",[L.IStyle.BuiltInName.Accent1_20,L.IStyle.BuiltInName.Accent1_40,L.IStyle.BuiltInName.Accent1_60,L.IStyle.BuiltInName.Accent1])),H.push(v("Accent 2",[L.IStyle.BuiltInName.Accent2_20,L.IStyle.BuiltInName.Accent2_40,L.IStyle.BuiltInName.Accent2_60,L.IStyle.BuiltInName.Accent2])),H.push(v("Accent 3",[L.IStyle.BuiltInName.Accent3_20,L.IStyle.BuiltInName.Accent3_40,L.IStyle.BuiltInName.Accent3_60,L.IStyle.BuiltInName.Accent3])),H.push(v("Accent 4",[L.IStyle.BuiltInName.Accent4_20,L.IStyle.BuiltInName.Accent4_40,L.IStyle.BuiltInName.Accent4_60,L.IStyle.BuiltInName.Accent4])),H.push(v("Accent 5",[L.IStyle.BuiltInName.Accent5_20,L.IStyle.BuiltInName.Accent5_40,L.IStyle.BuiltInName.Accent5_60,L.IStyle.BuiltInName.Accent5])),H.push(v("Accent 6",[L.IStyle.BuiltInName.Accent6_20,L.IStyle.BuiltInName.Accent6_40,L.IStyle.BuiltInName.Accent6_60,L.IStyle.BuiltInName.Accent6])),M.push((A="Themed Cell Styles",V=H,e.jsxs(E.Box,{children:[e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.ExhibitMenuHeader,{children:A},A+"-header"),e.jsx(E.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:V},A+"-presets")]},A))),M.push(P("Number Format",[L.IStyle.BuiltInName.Comma,L.IStyle.BuiltInName.Comma0,L.IStyle.BuiltInName.Currency,L.IStyle.BuiltInName.Currency0,L.IStyle.BuiltInName.Percent])),e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:N=>`${N.shape.borderRadius}px`,paddingBottom:N=>`${N.shape.borderRadius}px`},children:[e.jsx(E.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",paddingTop:"6px",paddingBottom:"0px",paddingLeft:"16px",paddingRight:"16px"},children:M}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{variant:k.CommandButtonType.Menuitem,commandState:u,command:T.getCommand("newCellStyle"),context:"styles",commandHook:a,disabled:h,icon:o.themeIcon(e.jsx(o.NewPresetStylesIcon,{}))})]})},[u,x?.().getTheme(),g]),C=k.useCallbackRef(j=>{const T=18/L.IFont.getDeviceScale(),B=p?.createTemporaryCell(j);return B.getStyle().getFont().getSize()<=T?B:B.createTemporaryCell({style:{font:{size:T}}})},[p?.createTemporaryCell]),b=h||!t||t.disabled(),w=r.useMemo(()=>p&&d?e.jsx(Yr,{value:u?.getName()??"Custom",cellStyle:u?{named:u.getName()}:void 0,styles:p.styles(),createTemporaryCell:C,bodyStyle:p.bodyStyle(),className:"outline-hover",disabled:b,sx:{maxHeight:"24px",height:"24px",marginRight:"2px",outline:j=>`1px solid ${j.palette.action.hover}`},borderProps:{}}):o.themeIcon(e.jsx(o.PresetStylesIcon,{})),[u,g,b]);return e.jsx(o.CommandPopupButton,{ref:s,createPopupPanel:y,outlined:d,commands:n,createTooltip:({children:j},T)=>e.jsx(o.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:T,children:j}),selected:!1,disabled:b,label:t?.label(),icon:w,...f})})),Jr="_sheetxl-reset_11z3j_1",Ul=10,Qr=r.memo(r.forwardRef((l,s)=>{const{styles:n,table:t,tableStyle:a=t?.getStyle()??n.getDefaultTableStyle(),bodyStyle:c,sx:m,disabled:h,className:i,forceThinBorder:d,cellHeight:f=Ul,isLive:p=!1,...x}=l,u=Math.ceil(1.3*f),[g,S]=r.useReducer(j=>j+1,0);r.useEffect(()=>{if(p&&t)return t.addListeners({onAnyChange:()=>{S()}})},[t,p]);const y=r.useMemo(()=>{let j=t?.toJSON()??{};const T={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return j&&(j.styleOptions={...j.styleOptions,name:a.getName()}),j.ref=T,new L.Table({initialAnchor:T,json:j,styles:n})},[g,t,a,n]),C=r.useMemo(()=>{const j=[];for(let T=0;T<5;T++)for(let B=0;B<5;B++){const I=y.getStyleAt({colIndex:B,rowIndex:T});j.push(I)}return j},[y]),b=r.useMemo(()=>{const j=(B,I,D)=>{let F=D.getFill().toCSS(c?.darkMode??!1);const O=u-(I<4?1:0),P=f-(B<4?1:0),v=D.getFont().getFill().toCSS(c?.darkMode??!1);return F={...F,position:"absolute",boxSizing:"border-box",left:I*(u-1),top:B*(f-1),width:O,height:P},e.jsx("td",{className:`table-style-fill ${B}-${I}`,style:F,children:e.jsx("div",{className:`table-style-text ${B}-${I}`,style:{position:"absolute",boxSizing:"border-box",width:"6px",left:(O-6)/2,top:(P-1)/2,borderTop:`1px solid ${v}`}})},`${B}-${I}`)},T=[];for(let B=0;B<5;B++){const I=[];for(let D=0;D<5;D++){const F=C[5*B+D];I.push(j(B,D,F))}T.push(e.jsx("tr",{children:I},B))}return T},[y,a,c]),w=r.useCallback((j,T)=>C[T].getBorder()??null,[C]);return e.jsx(E.Box,{ref:s,className:"table-format-preview",sx:{background:c?.fill,filter:h?"grayscale(0.4) opacity(0.8);":"none","& .styled-element":{position:"absolute"},...m},...x,children:e.jsx(ie.StaticBorderRenderer,{getBorderAt:w,rowCount:5,columnCount:5,forceThinBorder:d,width:5*(u-1)+1,height:5*(f-1)+1,darkMode:c?.darkMode??!1,style:{pointerEvents:"none"},children:e.jsx("table",{className:ge(i,"sheetxl-table-preview",Jr),style:{borderCollapse:"collapse",width:5*(u-1)+1,height:5*(f-1)+1},children:e.jsx("tbody",{children:b})})})})})),Ct=(l,s,n,t,a)=>{l.beginPath(),l.moveTo(s+.5,n+.5),l.lineTo(t+.5,a+.5),l.stroke()},ea=r.memo(r.forwardRef((l,s)=>{const{table:n,tableStyle:t,styles:a,bodyStyle:c,disabled:m,style:h,className:i,canvas:d,...f}=l,p=r.useMemo(()=>{const g=n.toJSON(),S={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return g.styleOptions={...g.styleOptions,name:t.getName()},g.ref=S,new L.Table({initialAnchor:S,json:g,styles:a})},[n,t,a]),x=r.useMemo(()=>{const g=[];for(let S=0;S<5;S++)for(let y=0;y<5;y++){const C=p.getStyleAt({colIndex:y,rowIndex:S});g.push(C)}return g},[p]),u=r.useMemo(()=>{let g=d;if(d||(g=document.createElement("canvas")),!g)return null;g.width!==61&&(g.width=61),g.height!==46&&(g.height=46);const S=g.getContext("2d",{alpha:!1});if(!S)return null;const y=12,C=c?.darkMode??!1;for(let b=0;b<5;b++)for(let w=0;w<5;w++){const j=x[5*b+w].getFill();let T=c?.fill;j.getType()===L.IFill.Type.Solid?T=j.getColor().toCSS(C,!1):j.getType()===L.IFill.Type.Gradient?T=j.getStops[0]?.color.toCSS(C,!1):j.getType()===L.IFill.Type.Pattern&&(T=j.getForeground().toCSS(C,!1)),S.fillStyle=T;const B=w*y,I=9*b;S.fillRect(B,I,13,10)}S.lineWidth=1;for(let b=0;b<5;b++)for(let w=0;w<5;w++){const j=x[5*b+w],T=w*y,B=9*b,I=j.getBorder();if(!I.isEmpty()){const O=I.getLeft();O.isNone()||(S.strokeStyle=O.getColor().toCSS(C,!1),Ct(S,T,B,T,B+9));const P=I.getTop();P.isNone()||(S.strokeStyle=P.getColor().toCSS(C,!1),Ct(S,T,B,T+y,9*b));const v=I.getRight();v.isNone()||(S.strokeStyle=v.getColor().toCSS(C,!1),Ct(S,T+y,B,T+y,B+9));const M=I.getBottom();M.isNone()||(S.strokeStyle=M.getColor().toCSS(C,!1),Ct(S,T,B+9,T+y,B+9))}S.strokeStyle=j.getFont().getFill().toCSS(C,!1);const D=4,F=2.5;Ct(S,w*y+F,9*b+D,w*y+F+7,9*b+D)}return`url(${g.toDataURL()})`},[d,p,t,c]);return e.jsx("div",{ref:s,className:ge("table-style-preview",i),style:{backgroundImage:u,width:61,height:46,...h},...f})})),_l=r.memo(r.forwardRef((l,s)=>{const{styleOptions:n,onStyleOptionsChange:t,showHeaderRow:a,onShowHeaderRowChange:c,showTotalRow:m,onShowTotalRowChange:h,showFilterButton:i,onShowFilterButtonChange:d,sx:f,disabled:p,...x}=l;return e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",flexWrap:"wrap",userSelect:"none",pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:u=>`${u.spacing(2)}`,marginRight:u=>`${u.spacing(2)}`},"& .MuiCheckbox-root":{padding:u=>`${u.spacing(.5)}`},...f},...x,ref:s,children:[c&&e.jsx(E.FormControlLabel,{control:e.jsx(E.Checkbox,{checked:a??!1,indeterminate:a==null,onChange:()=>c(!a),disabled:p||a==null}),label:"Header Row",labelPlacement:"end"}),h&&e.jsx(E.FormControlLabel,{control:e.jsx(E.Checkbox,{checked:m??!1,indeterminate:m==null,onChange:()=>h(!m),disabled:p||m==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(E.FormControlLabel,{control:e.jsx(E.Checkbox,{checked:n?.showRowStripes??!1,indeterminate:!n,disabled:p||!n,onChange:()=>{t?.({...n,showRowStripes:!n?.showRowStripes})}}),label:"Banded Rows",labelPlacement:"end"}),e.jsx(E.FormControlLabel,{control:e.jsx(E.Checkbox,{checked:n?.showFirstColumn??!1,indeterminate:!n,disabled:p||!n,onChange:()=>{t?.({...n,showFirstColumn:!n?.showFirstColumn})}}),label:"First Column",labelPlacement:"end"}),e.jsx(E.FormControlLabel,{control:e.jsx(E.Checkbox,{checked:n?.showLastColumn??!1,indeterminate:!n,disabled:p||!n,onChange:()=>{t?.({...n,showLastColumn:!n?.showLastColumn})}}),label:"Last Column",labelPlacement:"end"}),e.jsx(E.FormControlLabel,{control:e.jsx(E.Checkbox,{checked:n?.showColumnStripes??!1,indeterminate:!n,disabled:p||!n,onChange:()=>{t?.({...n,showColumnStripes:!n?.showColumnStripes})}}),label:"Banded Columns",labelPlacement:"end"}),d&&e.jsx(E.FormControlLabel,{control:e.jsx(E.Checkbox,{checked:i??!1,indeterminate:i==null,disabled:p||!n||i==null,onChange:()=>d(!i)}),label:"Filter Button",labelPlacement:"end"})]})})),Kl=r.memo(l=>{const{table:s,tableStyle:n,selectedTableStyleName:t,onSelectTableStyleName:a,styles:c,hasContextMenu:m=!0,bodyStyle:h,parentFloat:i,commands:d,disabled:f,commandHook:p,useCanvasPreview:x=!0,canvas:u,...g}=l,S=r.useCallback(w=>{const j={variant:k.CommandButtonType.Menuitem,commandHook:p,context:"table"},T=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...j,command:d.getCommand("formatTableStyleClearCellStyles"),commandState:n,disabled:f,icon:o.themeIcon(e.jsx(o.PresetStylesIcon,{}))}),e.jsx(o.CommandButton,{...j,sx:{fontWeight:550},command:d.getCommand("formatTableStyle"),commandState:{name:n.getName()},disabled:f,icon:o.themeIcon(e.jsx(o.PresetStylesIcon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...j,command:d.getCommand("setDefaultTableStyle"),commandState:n.getName(),disabled:f}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...j,command:d.getCommand("deleteTableStyle"),commandState:n?.getName(),disabled:f||!n||n.isBuiltIn()})]}),B=e.jsx(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:T})});return o.defaultCreatePopupPanel({...w,children:B})},[d]),y=n?.getName()===t,C=r.useMemo(()=>{const w={table:s,tableStyle:n,styles:c,bodyStyle:h};return x?e.jsx(ea,{canvas:u,...w}):e.jsx(Qr,{...w})},[s,n,c,h]);let b=e.jsx(o.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:w=>`solid ${y?w.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:n.getName()??"None",placement:"bottom-start"},disabled:f,icon:null,onClick:()=>{a?.(n?.getName())},...g,children:C},n.getName());return m&&(b=e.jsx(o.ContextMenu,{label:s.getStyleOptions().name,parentFloat:i,createPopupPanel:S,children:b})),b}),ta=r.memo(r.forwardRef((l,s)=>{const{commands:n,command:t,commandHook:a,selectedTable:c,onSelectTableStyleName:m,disabled:h=!1,bodyStyle:i,usePreviewIcon:d=!1,...f}=l;k.useCommand(t);const p=t?.context(),x=p?.styles,u=c??p?.table?.();let g="insertTable";u&&(g="editTable");const S=r.useMemo(()=>((F,O)=>{const P={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new L.Table({initialAnchor:P,styles:O,json:{name:"PreviewTable",ref:P,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:F}})})(u?.getStyleOptions(),x?.()),[x?.().getDefaultTableStyle(),u?.getStyleOptions()]),y=u??S,[C,b]=r.useState(y);r.useEffect(()=>{b(y)},[y]);const w=i??p?.bodyStyle(),j=k.useCallbackRef(F=>{m?.(F),t?.execute({name:F},a)},[t,m,a]),T=r.useRef(null),B=r.useCallback((F,O)=>{const P={onSelectTableStyleName:j,styles:x(),parentFloat:F.floatReference};T.current||(T.current=document.createElement("canvas"));const v=q=>{const U=x().getTableStyle(q);return U?e.jsx(Kl,{table:C,tableStyle:U,selectedTableStyleName:C.getStyleOptions().name,bodyStyle:p.bodyStyle(),commands:O,commandHook:a,canvas:T.current,...P},q):null},M=(q,U,Z=!0)=>{const ee=[];for(let K=0;K<U.length;K++){const z=v(U[K]);z&&ee.push(z)}return ee.length===0?null:e.jsxs(E.Box,{children:[Z?e.jsx(o.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(o.ExhibitMenuHeader,{children:q},q+"-header"),e.jsx(E.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"481px",maxWidth:"100%"},children:ee},q+"-presets")]},q)},H=[],A=x().getCustomTableStyles(),V=[];if(A.length>0){for(let q=0;q<A.length;q++)A[q].isShownInTableStyles()&&V.push(A[q].getName());H.push(M("Custom",V,!1))}const N=[];u&&!u.getStyleOptions().name&&N.push(null);for(let q=0;q<21;q++)N.push("TableStyleLight"+(q+1));H.push(M("Light",N,V.length>0));const R=[];for(let q=0;q<28;q++)R.push("TableStyleMedium"+(q+1));H.push(M("Medium",R));const _=[];for(let q=0;q<11;q++)_.push("TableStyleDark"+(q+1));H.push(M("Dark",_));let X=null;return u&&(X=e.jsxs(e.Fragment,{children:[e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{variant:k.CommandButtonType.Menuitem,command:O.getCommand("formatTableStyleClearTableStyle"),commandHook:a,disabled:h,icon:o.themeIcon(e.jsx(o.ClearFormatsIcon,{}))})]})),e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:q=>`${q.shape.borderRadius}px`,paddingBottom:q=>`${q.shape.borderRadius}px`},children:[e.jsx(E.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",padding:"6px 16px"},children:H}),X]})},[x,x?.().getTheme(),w,C]),I=h||!t||t.disabled(),D=r.useMemo(()=>{if(!p||!d)return o.themeIcon(e.jsx(o.PresetStylesIcon,{}))},[C,w,I]);return e.jsx(o.CommandPopupButton,{ref:s,quickCommand:g,createPopupPanel:B,commands:n,label:t?.label(),commandState:u,commandHook:a,selected:u!==null,createTooltip:({children:F},O)=>e.jsx(o.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:O,children:F}),disabled:I,icon:D,...f})})),Ie=[];Ie.push(De("Primary Background","bg1")),Ie.push(De("Primary Text","tx1")),Ie.push(De("Secondary Background","bg2")),Ie.push(De("Secondary Text","tx2")),Ie.push(De("Accent 1","accent1")),Ie.push(De("Accent 2","accent2")),Ie.push(De("Accent 3","accent3")),Ie.push(De("Accent 4","accent4")),Ie.push(De("Accent 5","accent5")),Ie.push(De("Accent 6","accent6"));const oa=l=>{const{docTheme:s,onSelectTheme:n,darkMode:t,isSelected:a,outlined:c,sx:m,...h}=l,i=G.useTheme(),d=r.useMemo(()=>{let f=[];for(let p=0;p<Ie.length;p++){const x=Ie[p];f.push(e.jsx(lo,{schemeColorLookup:s.schemeLookup(),colorDef:x,darkMode:t,selectedColor:null},p+"-colorDef"))}return e.jsx(E.Box,{sx:{display:"flex",flexDirection:"row",flex:"none"},children:e.jsx(E.Box,{sx:{display:"flex",boxShadow:p=>p.shadows[2]},children:f})})},[s,i]);return e.jsx(o.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:f=>`solid ${a?f.palette.text.primary:"transparent"} 1px`,"&:hover:not([disabled])":{border:f=>`solid ${f.palette.text.primary} 1px !important`}},icon:null,...h,children:e.jsxs(E.Box,{sx:{border:f=>`solid ${f.palette.divider} 1px`,minWidth:"200px",borderRadius:"2px",padding:"4px 4px",textAlign:"left",display:"flex",gap:"4px",flexDirection:"column",alignItems:"stretch",color:f=>a?f.palette.text.primary:void 0,"&:hover:not([disabled])":{color:f=>f.palette.text.primary}},children:[e.jsx(E.Box,{sx:{},children:s.getName()}),e.jsxs(E.Box,{sx:{paddingTop:"6px",paddingLeft:"12px",paddingRight:"12px",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[d,e.jsx(E.Box,{sx:{flex:"1 1 100%",textOverflow:"ellipsis",overflow:"hidden",marginTop:"2px",whiteSpace:"pre",fontFamily:()=>s.getFontScheme().getMajorFont()},children:e.jsx(o.SimpleTooltip,{disableInteractive:!0,PopperProps:{style:{pointerEvents:"none"},disablePortal:!0,popperOptions:{strategy:"fixed",modifiers:[{name:"preventOverflow",enabled:!0,options:{boundariesElement:"viewport"}}]}},title:e.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"pre"},children:`The font used for the body.
7
- The heading font is '${s.getFontScheme().getMajorFont()}'.`}),placement:"bottom-start",children:e.jsx("div",{children:s.getFontScheme().getMinorFont()})})})]})]})})},na=r.memo(r.forwardRef((l,s)=>{const{themes:n,selectedTheme:t,onSelectTheme:a,sx:c,disabled:m=!1,darkMode:h,...i}=l,d=r.useMemo(()=>{const f=n?.getItems({selected:t})??[],p=[];if(f.length===0)return e.jsx(o.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"6px",paddingBottom:"6px"},children:"No themes"});const x=f.length;for(let u=0;u<x;u++){const g=f[u],S=t&&g?.getName()===t.getName(),y=f[u+1];y&&y.isCustom()!==g.isCustom()&&p.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${u}`)),p.push(e.jsx(oa,{docTheme:g,onSelectTheme:()=>a(g),isSelected:S,disabled:m,darkMode:h,onMouseDown:C=>{C.button===0&&C.preventDefault()},onMouseUp:C=>{C.button===0&&a(g)},onKeyDown:C=>{C.keyCode!==k.KeyCodes.Enter&&C.keyCode!==k.KeyCodes.Space||a(g)}},g.getName()))}return p},[t,a,h]);return e.jsx(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},ref:s,...i,children:e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx(o.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"2px"},children:"Themes"}),e.jsx(o.ExhibitDivider,{}),e.jsx(E.Box,{sx:{flex:"1 1 100%",overflow:"auto",padding:"6px 16px"},children:d})]})})})),ra=r.memo(r.forwardRef((l,s)=>{const{themes:n,selectedTheme:t,onSelectTheme:a,icon:c,tooltip:m,label:h,variant:i=o.PopupButtonType.Toolbar,darkMode:d,panelProps:f,...p}=l,x=c||o.themeIcon(e.jsx(o.Theme2Icon,{})),u=r.useCallback(S=>{const{closeFloatAll:y}=S;return e.jsx(na,{...f,themes:n,selectedTheme:t,onSelectTheme:a,darkMode:d,onKeyDown:C=>{C.which===k.KeyCodes.Enter&&y()}})},[n,t,a,f,d]),g={createPopupPanel:u,tooltip:m||h||"Theme",label:h,icon:x,...p};return i===o.PopupButtonType.Toolbar?e.jsx(o.ExhibitPopupIconButton,{ref:s,...g}):e.jsx(o.ExhibitPopupMenuItem,{ref:s,...g})})),aa=r.memo(r.forwardRef((l,s)=>{const{command:n,commandHook:t,selectedTheme:a,onSelectTheme:c,disabled:m=!1,darkMode:h,label:i,icon:d,variant:f,...p}=l;k.useCommand(n);const x=n?.context()?.themes,u=a||n?.context()?.theme,g=h??n?.context()?.darkMode,S=m||n?.disabled(),y=k.useCallbackRef(b=>{c?.(b),n?.execute(b,t)},[c,t]),C=r.useCallback((b,w)=>{const{children:j,title:T,...B}=b;let I=b.children;return(S||w)&&(I=e.jsx("div",{children:I})),e.jsx(o.CommandTooltip,{command:n,placement:f===k.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:S||w,...B,children:I})},[n,S]);return e.jsx(ra,{ref:s,themes:x,selectedTheme:u,onSelectTheme:y,variant:f===k.CommandButtonType.Menuitem?o.PopupButtonType.Menuitem:o.PopupButtonType.Toolbar,createTooltip:C,disabled:S,darkMode:g,icon:o.themeIcon(e.jsx(o.Theme2Icon,{})),...p})})),la=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h=k.useCommands(n,["themeMode"])[0],i=h?.state(),d=h?.state()!==null,f=E.useMediaQuery("(prefers-color-scheme: dark)"),p=i==="dark"||i===null&&f,x=k.useCallbackRef((u,g)=>{const S={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:c},y=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...S,command:h,icon:o.themeIcon(p?e.jsx(me.DarkMode,{}):e.jsx(me.LightMode,{}))}),e.jsx(o.CommandButton,{...S,command:g.getCommand("defaultThemeMode"),icon:o.themeIcon(f?e.jsx(o.SystemDefaultDarkMode,{}):e.jsx(o.SystemDefaultLightMode,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...S,command:g.getCommand("enableDarkGrid")}),e.jsx(o.CommandButton,{...S,command:g.getCommand("enableDarkImages")})]});return o.defaultCreatePopupPanel({...u,children:y})},[c,h,t,a,f,i,d]);return e.jsx(o.CommandPopupButton,{ref:s,quickCommand:"themeMode",commands:n,commandHook:t,createPopupPanel:x,label:"Appearance",tooltip:"Change the light/dark mode to match your viewing preference. This does not affect the view for others.",onQuickClick:()=>{h?.execute(p?"light":"dark",t)},selected:d,icon:o.themeIcon(p?e.jsx(me.DarkMode,{}):e.jsx(me.LightMode,{})),...m})})),ia=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,sx:m,...h}=l,i=r.useCallback((d,f)=>{const p={variant:k.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(u,g)=>t?.beforeExecute?.(u,g)!==!1&&d.floatReference.closeAll()},disabled:c},x=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...p,command:f.getCommand("showKeyboardShortcuts"),icon:o.themeIcon(e.jsx(me.Keyboard,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...p,command:f.getCommand("gotoUrlGithub"),icon:o.themeIcon(e.jsx(o.GithubIcon,{}))}),e.jsx(o.CommandButton,{...p,command:f.getCommand("gotoUrlDiscord"),icon:o.themeIcon(e.jsx(o.DiscordIcon,{}))}),e.jsx(o.CommandButton,{...p,command:f.getCommand("gotoUrlDocumentation"),icon:o.themeIcon(e.jsx(o.DocumentationIcon,{}))}),e.jsx(o.CommandButton,{...p,command:f.getCommand("gotoUrlIssue"),icon:o.themeIcon(e.jsx(o.TicketIcon,{}))})]});return o.defaultCreatePopupPanel({...d,children:x})},[c,t]);return e.jsx(o.CommandPopupButton,{ref:s,sx:m,commands:n,disabled:c,commandHook:t,scope:a,label:"Help",tooltip:"Help, feedback, and keyboard shortcuts.",createPopupPanel:i,icon:o.themeIcon(e.jsx(o.HelpIcon,{sx:{transform:"scale(0.75)"}})),...h})})),Go=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,preferSingleMenu:m=!0,showQuickButton:h=!0,variant:i=k.CommandButtonType.Toolbar,...d}=l,f=k.useCommands(n,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:p,allDisabled:x}=r.useMemo(()=>{let g=null,S=0;for(let y=0;y<f.length;y++)f[y]&&!f[y]?.disabled()&&(m&&i===k.CommandButtonType.Menuitem&&(g=S===0?f[y]:null),S++);return{singleMenuCommand:g,allDisabled:S===0}},[f]),u=r.useCallback((g,S)=>{const y={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:c},C=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...y,command:S.getCommand("insertImageFromFile"),icon:o.themeIcon(e.jsx(o.InsertImageIcon,{}))}),e.jsx(o.CommandButton,{...y,command:S.getCommand("insertImageFromURL"),icon:o.themeIcon(e.jsx(o.InsertImageIcon,{}))})]});return o.defaultCreatePopupPanel({...g,children:C})},[c,t,a]);return p?e.jsx(o.CommandButton,{ref:s,variant:i,commandHook:t,disabled:c,command:p,icon:o.themeIcon(e.jsx(o.InsertImageIcon,{})),...d}):e.jsx(o.CommandPopupButton,{ref:s,variant:i,quickCommand:"insertImageFromFile",commands:n,commandHook:t,scope:a,disabled:c||x,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:u,icon:o.themeIcon(e.jsx(o.InsertImageIcon,{})),...d})})),io=r.memo(r.forwardRef((l,s)=>{const{command:n,...t}=l,a=k.useEditMode(),[c,m]=r.useState(!1),[h,i]=r.useState("info");return r.useEffect(()=>{const d=a.getMode();m(d?.key==="copy"||d?.key==="cut"),i(d?.key==="cut"?"warning":"info")},[a]),e.jsx(o.CommandButton,{ref:s,command:n,icon:o.themeIcon(e.jsx(o.WalkingCopyIcon,{isWalking:c,themedType:h})),...t})})),sa=r.memo(r.forwardRef((l,s)=>{const{...n}=l;return e.jsx(o.SimpleCommandPopupButton,{ref:s,...n,popupCommandKeys:["insertFunctionSum","insertFunctionAverage","insertFunctionCount","insertFunctionMax","insertFunctionMin",null,"insertFunction"],quickCommand:"insertFunctionSum",popupScope:"insertFunction",label:"Quick Function",tooltip:"More functions.",icon:t=>{switch(t?.key()){case"insertFunctionSum":return o.themeIcon(e.jsx(o.FunctionSumIcon,{}));case"insertFunction":return o.themeIcon(e.jsx(o.FunctionThinIcon,{}));default:return null}}})}));sa.displayName="InsertFunctionSumCommandPopupButton";const ql=[{key:"financial",label:"Financial",icon:e.jsx(o.FormulaFinancialIcon,{})},{key:"logical",label:"Logical",icon:e.jsx(o.FormulaLogicalIcon,{})},{key:"text",label:"Text",icon:e.jsx(o.FormulaTextIcon,{})},{key:"dateTime",label:"Date & Time",icon:e.jsx(o.FormulaDateTimeIcon,{})},{key:"lookupReference",label:"Lookup & Reference",icon:e.jsx(o.FormulaLookupReferenceIcon,{})},{key:"mathTrig",label:"Math & Trig",icon:e.jsx(o.FormulaMathTrigIcon,{})},{key:"statDist",label:"Statistical",icon:e.jsx(o.FormulaStatisticalIcon,{})},{key:"engineering",label:"Engineering",icon:e.jsx(o.FormulaEngineeringIcon,{})},{key:"information",label:"Information",icon:e.jsx(o.FormulaInformationIcon,{})},{key:"cube",label:"Cube",icon:e.jsx(o.FormulaCubeIcon,{})},{key:"database",label:"Database",icon:e.jsx(o.FormulaDatabaseIcon,{})},{key:"web",label:"Web",icon:e.jsx(o.FormulaWebIcon,{})},{key:"custom",label:"Custom",icon:e.jsx(o.FormulaCustomIcon,{})}],Co=new Map(ql.map(l=>[l.key,l])),Gl=r.memo(l=>{const{command:s,formulaFunction:n,commandHook:t,disabled:a=!1,parentFloat:c,handleInsert:m,icon:h,label:i,sx:d,...f}=l,p=new Promise(x=>{n.getDescriptor().then(u=>{x(u.getSummary())})});return e.jsx(o.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...d},disabled:a,tooltipProps:{label:p,maxWidth:1e3},onMouseDown:x=>{x.button===0&&x.preventDefault()},onMouseUp:x=>{x.button===0&&m(n)},onKeyDown:x=>{x.keyCode===k.KeyCodes.Enter||(x.keyCode,k.KeyCodes.Space)},...f,children:e.jsx(E.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(E.Typography,{component:"div",children:n.getName()})})})}),ca=r.memo(r.forwardRef((l,s)=>{const{category:n,commands:t,commandHook:a,scope:c,sx:m,disabled:h=!1,parentFloat:i,...d}=l,f=k.useCommands(t,["insertFunction"])[0],p=r.useCallback((u,g)=>{const S=Co.get(n);if(!S)return console.warn("invalidate category",n),null;const y={commandHook:a,...u},C=e.jsx(Xl,{category:S.label,...y,commands:g});return o.defaultCreatePopupPanel({...u,children:C})},[n,f,a,c]),x=Co.get(n);return e.jsx(o.CommandPopupButton,{ref:s,commands:t,commandHook:a,createPopupPanel:p,label:x.label,tooltip:"Insert Function",icon:o.themeIcon(Co.get(n)?.icon??e.jsx(o.FormulaGroupIcon,{})),...d})}));ca.displayName="InsertFunctionCommandPopupButton";const Xl=r.memo(r.forwardRef((l,s)=>{const{commands:n,category:t,commandHook:a,...c}=l,m=k.useCommands(n,["insertFunction"]),[h,i]=r.useState([]),[d,f]=r.useState(!1);r.useEffect(()=>{(async()=>{f(!0);const y=m[0]?.context(),C=await y.searchByCategory(t);i(C),f(!1)})()},[]);const p=h.length,x=new Array(p),u=n.getCommand("insertFunction"),g=y=>{a?.beforeExecute?.(u,u?.state()),u.execute(y),a?.onExecute?.(u,u?.state())};for(let y=0;y<p;y++){const C=h[y];x[y]=e.jsx(Gl,{command:u,formulaFunction:C,handleInsert:g},`formula-${C.getName()}-${y}`)}const S=e.jsx(E.Box,{ref:s,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:p>0?e.jsx(e.Fragment,{children:e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:x})}):null});return o.defaultCreatePopupPanel({...c,children:S})})),da=r.createContext(null);da.displayName="HookFormContext";const ma=()=>r.useContext(da);typeof window<"u"?r.useLayoutEffect:r.useEffect;const ua=r.memo(r.forwardRef((l,s)=>{const{disabled:n,style:t,className:a,sx:c,defaultInput:m,value:h,formName:i,formOptions:d,onChangeInput:f,onValidate:p,onKeyDown:x,...u}=l,g=ma(),S=i&&g?g.register(i,d):null,[y,C]=r.useState(""),[b,w]=r.useState(""),[j,T]=r.useState(h);r.useEffect(()=>{T(h),w("")},[h]);const B=k.useCallbackRef(P=>{let v="";try{T(P),p?.(P),f?.(P)}catch(M){v=M.message??"Invalid Name"}i&&g&&(v?g.setError(i,{message:v}):g.clearErrors(i)),w(v)},[h,p,f]),I=k.useCallbackRef(async P=>{P.keyCode===k.KeyCodes.Escape&&y!==h&&(B(y),g?.setValue(i,y),g?.clearErrors(i),P.stopPropagation()),x?.(P)},[x,y,h,g]),D=k.useCallbackRef(P=>{C(P.target.value??"")},[]),F=k.useCallbackRef(P=>{C(""),S?.onBlur(P)},[]),O=r.useCallback(P=>{B(P.target.value),S?.onChange(P)},[S]);return e.jsx(E.FormControl,{sx:{paddingTop:P=>P.spacing(1.5),minWidth:135,width:"100%",...c},size:"small",ref:s,className:ge("named-input",a),...u,children:e.jsx(E.TextField,{label:"Name",placeholder:m,onFocus:D,onBlur:F,inputRef:S?.ref,disabled:n,error:!!b,helperText:b||" ",sx:{"& .MuiFormHelperText-root":{marginTop:P=>P.spacing(.5)}},InputLabelProps:{shrink:!0},InputProps:{inputProps:{className:"autoFocus",name:i,spellCheck:!1,autoComplete:"off",readOnly:n,sx:{paddingTop:P=>P.spacing(1.25),paddingBottom:P=>P.spacing(.75),backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`}}},value:j??"",onChange:O,onKeyDownCapture:I,onContextMenu:P=>{P.stopPropagation()}})})}));ua.displayName="NamedInput";const Wt=l=>l===null?"":l.toString(),pa=r.memo(r.forwardRef((l,s)=>{const{formName:n,formOptions:t,disabled:a,style:c,className:m,sx:h,onKeyDown:i,value:d,onChangeInput:f,resolvedAddress:p,...x}=l,u=ma(),g=n&&u?u.register(n,t):null,[S,y]=r.useState(""),[C,b]=r.useState(!1),[w,j]=r.useState(()=>Wt(d));r.useEffect(()=>{j(Wt(d)),y(""),n&&u&&u.clearErrors(n),b(!1)},[d]);const T=k.useCallbackRef(v=>{let M="";try{j(v);const H=Wt(d),A=p(v);A.toString()!==H&&f?.(A)}catch{M="Invalid Range"}n&&u&&(M?u.setError(n,{message:M}):u.clearErrors(n)),y(M),b(!0)},[w,f,n,u]),B=k.useCallbackRef(async v=>{if(C&&v.keyCode===k.KeyCodes.Escape){const M=Wt(d);j(M),y(""),b(!1),v.stopPropagation()}i?.(v)},[d,f,i,C]),I=k.useCallbackRef(v=>{g?.onBlur(v)},[g]),D=r.useCallback(v=>{T(v.target.value),g?.onChange(v)},[g]),[F,O]=r.useState(!1),P=r.useMemo(()=>e.jsx(E.InputAdornment,{tabIndex:-1,sx:{display:"flex",position:"relative",flex:"0"},position:"end",children:e.jsx(o.ExhibitOptionButton,{disabled:!0,selected:F,onSelectToggle:v=>{O(v)},label:"Select Range",icon:o.themeIcon(e.jsx(o.SelectRangeModeIcon,{}))})}),[F]);return e.jsx(E.FormControl,{sx:{paddingTop:v=>v.spacing(1.5),minWidth:135,width:"100%",...h},size:"small",ref:s,className:ge("range-input",m),...x,children:e.jsx(E.TextField,{label:"Range",placeholder:"Enter Range",onBlur:I,disabled:a,error:!!S,inputRef:g?.ref,helperText:S||" ",sx:{"& .MuiFormHelperText-root":{marginTop:v=>v.spacing(.5)}},InputLabelProps:{shrink:!0},InputProps:{inputProps:{spellCheck:!1,autoComplete:"off",readOnly:a,name:n,sx:{paddingTop:v=>v.spacing(1.25),paddingBottom:v=>v.spacing(.75)}},sx:{backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},endAdornment:P},value:w??"",onChange:D,onKeyDownCapture:B,onContextMenu:v=>{v.stopPropagation()}})})}));pa.displayName="RangeInput";const Xo=r.memo(r.forwardRef((l,s)=>{const{sheet:n,className:t,debounceDelay:a=220,sx:c,...m}=l,[h,i]=r.useState(()=>n.getView().getZoomScale()),[d,f]=r.useState(null),p=r.useRef(0);ie.useModelListener(n,{onViewChange:()=>{f(!0),p.current===0&&i(n.getView().getZoomScale())}}),r.useEffect(()=>{p.current=0,f(!1),i(n.getView().getZoomScale())},[n]),r.useEffect(()=>{p.current!==0&&L.CommonUtils.debounce(()=>{h===p.current&&(p.current=0,n.getView().update({zoomScale:h}))},a)()},[h,a]);const x=k.useCallbackRef(I=>{let D=I;I<100?D=Math.round(I/(10/9)+10):I>100&&(D=Math.round(3*I-200)),p.current=D,f(!0),i(D)},[n]),u=I=>{let D=I;return I<100?D=10/9*(I-10):I>100&&(D=(I+200)/3),D},g=u(h),[S,y]=r.useState(null),C=r.useRef(null),b=r.useCallback(()=>{const I=S;I&&requestAnimationFrame(()=>{C.current?.contains(document.activeElement)&&I.focus()})},[]),w=k.useMouseDownAndHoldListener(()=>{x(u(L.CommonUtils.findNextStep(n.getView().getZoomScale(),!1,10)))}),j=k.useMouseDownAndHoldListener(()=>x(u(L.CommonUtils.findNextStep(n.getView().getZoomScale(),!0,10)))),T=G.useTheme(),B=r.useMemo(()=>`${L.IFont.getSharedMeasurer()("100%",Math.round(T.typography.fontSize),T.typography.fontFamily).width}px`,[T]);return e.jsxs(E.Box,{ref:s,className:ge(t),sx:{padding:"0px 0px",display:"flex",alignItems:"center",color:I=>I.palette.text.secondary,...c},onFocus:I=>{I.relatedTarget&&!S&&y(I.relatedTarget)},onBlur:I=>{S&&!C?.current?.contains(I.relatedTarget)&&y(null)},onMouseDown:I=>{I.button===0&&I.preventDefault()},onMouseUp:I=>{I.button===0&&b()},...m,children:[e.jsx(o.SimpleTooltip,{disableInteractive:!0,title:"Zoom Out",children:e.jsx(E.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:I=>I.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:I=>{I.button!==0?I.preventDefault():w(I)},children:e.jsx(me.Remove,{})})}),e.jsx(E.Slider,{ref:C,sx:{flex:"1 1 100%",padding:"6px 0px !important",marginRight:"2px",marginLeft:"2px","& .MuiSlider-thumb":{height:14,width:6,borderRadius:.75,"&.Mui-focusVisible":{boxShadow:I=>`0px 0px 0px 3px ${o.hexToRGB(I.palette.primary.main,.16)}`},"&:focus, &:hover, &.Mui-active":{boxShadow:I=>`0px 0px 0px 2px ${o.hexToRGB(I.palette.primary.main,.16)}`}},"& .MuiSlider-mark":{width:"1px",height:"8px"},"& .MuiSlider-markActive":{backgroundColor:"currentColor"},"& .MuiSlider-thumb:not(.MuiSlider-active)":{transition:d?"left 260ms ease-in":"none"}},valueLabelDisplay:"auto",size:"small",track:!1,min:0,step:1,value:g,max:200,marks:[{value:100}],onAnimationEnd:()=>f(!1),onWheel:I=>{x(u(L.CommonUtils.findNextStep(n.getView().getZoomScale(),I.deltaY<0,10)))},onKeyDown:I=>{I.which===k.KeyCodes.Down||I.which===k.KeyCodes.Right?(x(u(L.CommonUtils.findNextStep(n.getView().getZoomScale(),!0,10))),I.preventDefault()):I.which===k.KeyCodes.Up||I.which===k.KeyCodes.Left?(x(u(L.CommonUtils.findNextStep(n.getView().getZoomScale(),!1,10))),I.preventDefault()):I.which!==k.KeyCodes.Enter&&I.which!==k.KeyCodes.Escape||b()},onChange:(I,D)=>{Math.abs(D-100)<3?x(100):x(D)},valueLabelFormat:(I,D)=>`Zoom: ${Math.round(h)}%`}),e.jsx(o.SimpleTooltip,{disableInteractive:!0,title:"Zoom In",children:e.jsx(E.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:I=>I.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:I=>{I.button!==0?I.preventDefault():j(I)},children:e.jsx(me.Add,{})})}),e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(E.Box,{sx:{minWidth:"8px"}}),e.jsx(E.Typography,{noWrap:!0,component:"div",onClick:()=>{x(100)},sx:{cursor:"pointer",display:"flex",flex:"1 1 100%",fontSize:"0.70rem",marginLeft:"2px",marginRight:"2px",userSelect:"none",justifyContent:"center",width:B},children:e.jsx("div",{children:Math.round(h)+"%"})})]})]})}));Xo.displayName="SheetZoomScale";const Yo=r.memo(r.forwardRef((l,s)=>{const{sx:n,sheet:t,gridStyle:a,children:c,childrenEnd:m,...h}=l;r.useImperativeHandle(s,()=>({}));const i=r.useRef(null);r.useEffect(()=>{const u=g=>g.preventDefault();return i.current?.addEventListener("wheel",u,{passive:!1}),()=>{i.current?.removeEventListener("wheel",u)}},[]);const d=k.useEditMode(),f=r.useMemo(()=>{const u=d.getMode();return u?.description?u.description:"Ready"},[d]),[p,x]=r.useState(!1);return e.jsxs(E.Box,{ref:i,sx:{display:"flex",alignItems:"stretch",flexDirection:"row",flex:"0",paddingLeft:"12px",paddingRight:"12px",gap:"8px",paddingTop:"1px",minHeight:"calc(1em + 8px)",overflow:p?"visible":"hidden",boxShadow:`0px -1px 0px ${a.header.edgeStrokeFill}`,...n},onMouseOver:()=>x(!0),onMouseLeave:()=>x(!1),...h,children:[c,e.jsx("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"end",overflow:"hidden"},children:e.jsx(E.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",color:u=>u.palette.text.secondary},variant:"caption",children:f})}),m?e.jsx(E.Box,{sx:{display:"flex",alignItems:"center"},children:m}):null,e.jsx(o.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(Xo,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));Yo.displayName="StatusBar";var st=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},An,On,So,Ln,Hn,Vt={exports:{}},St={},wt={exports:{}},zn={},Wn={exports:{}};function Yl(){return On?An:(On=1,An="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function Zl(){if(Ln)return So;Ln=1;var l=Yl();function s(){}function n(){}return n.resetWarningCache=s,So=function(){function t(m,h,i,d,f,p){if(p!==l){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}}function a(){return t}t.isRequired=t;var c={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:a,element:t,elementType:t,instanceOf:a,node:t,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:s};return c.PropTypes=c,c},So}function Ft(){return Hn||(Hn=1,Wn.exports=Zl()()),Wn.exports}var Vn,$t={exports:{}},$n,Se={},ze={};function so(){return $n||($n=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.dontSetMe=function(l,s,n){if(l[s])return new Error(`Invalid prop ${s} passed to ${n} - do not set this, set it on the child.`)},ze.findInArray=function(l,s){for(let n=0,t=l.length;n<t;n++)if(s.apply(s,[l[n],n,l]))return l[n]},ze.int=function(l){return parseInt(l,10)},ze.isFunction=function(l){return typeof l=="function"||Object.prototype.toString.call(l)==="[object Function]"},ze.isNum=function(l){return typeof l=="number"&&!isNaN(l)}),ze}var Un,_n,We={};function Zo(){if(_n)return Se;_n=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.addClassName=m,Se.addEvent=function(i,d,f,p){if(!i)return;const x={capture:!0,...p};i.addEventListener?i.addEventListener(d,f,x):i.attachEvent?i.attachEvent("on"+d,f):i["on"+d]=f},Se.addUserSelectStyles=function(i){if(!i)return;let d=i.getElementById("react-draggable-style-el");d||(d=i.createElement("style"),d.type="text/css",d.id="react-draggable-style-el",d.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
8
- `,d.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
9
- `,i.getElementsByTagName("head")[0].appendChild(d)),i.body&&m(i.body,"react-draggable-transparent-selection")},Se.createCSSTransform=function(i,d){const f=a(i,d,"px");return{[(0,s.browserPrefixToKey)("transform",s.default)]:f}},Se.createSVGTransform=function(i,d){return a(i,d,"")},Se.getTouch=function(i,d){return i.targetTouches&&(0,l.findInArray)(i.targetTouches,f=>d===f.identifier)||i.changedTouches&&(0,l.findInArray)(i.changedTouches,f=>d===f.identifier)},Se.getTouchIdentifier=function(i){if(i.targetTouches&&i.targetTouches[0])return i.targetTouches[0].identifier;if(i.changedTouches&&i.changedTouches[0])return i.changedTouches[0].identifier},Se.getTranslation=a,Se.innerHeight=function(i){let d=i.clientHeight;const f=i.ownerDocument.defaultView.getComputedStyle(i);return d-=(0,l.int)(f.paddingTop),d-=(0,l.int)(f.paddingBottom),d},Se.innerWidth=function(i){let d=i.clientWidth;const f=i.ownerDocument.defaultView.getComputedStyle(i);return d-=(0,l.int)(f.paddingLeft),d-=(0,l.int)(f.paddingRight),d},Se.matchesSelector=t,Se.matchesSelectorAndParentsTo=function(i,d,f){let p=i;do{if(t(p,d))return!0;if(p===f)return!1;p=p.parentNode}while(p);return!1},Se.offsetXYFromParent=function(i,d,f){const p=d===d.ownerDocument.body?{left:0,top:0}:d.getBoundingClientRect(),x=(i.clientX+d.scrollLeft-p.left)/f,u=(i.clientY+d.scrollTop-p.top)/f;return{x,y:u}},Se.outerHeight=function(i){let d=i.clientHeight;const f=i.ownerDocument.defaultView.getComputedStyle(i);return d+=(0,l.int)(f.borderTopWidth),d+=(0,l.int)(f.borderBottomWidth),d},Se.outerWidth=function(i){let d=i.clientWidth;const f=i.ownerDocument.defaultView.getComputedStyle(i);return d+=(0,l.int)(f.borderLeftWidth),d+=(0,l.int)(f.borderRightWidth),d},Se.removeClassName=h,Se.removeEvent=function(i,d,f,p){if(!i)return;const x={capture:!0,...p};i.removeEventListener?i.removeEventListener(d,f,x):i.detachEvent?i.detachEvent("on"+d,f):i["on"+d]=null},Se.scheduleRemoveUserSelectStyles=function(i){window.requestAnimationFrame?window.requestAnimationFrame(()=>{c(i)}):c(i)};var l=so(),s=(function(i,d){if(typeof WeakMap=="function")var f=new WeakMap,p=new WeakMap;return(function(x,u){if(!u&&x&&x.__esModule)return x;var g,S,y={__proto__:null,default:x};if(x===null||typeof x!="object"&&typeof x!="function")return y;if(g=u?p:f){if(g.has(x))return g.get(x);g.set(x,y)}for(const C in x)C!=="default"&&{}.hasOwnProperty.call(x,C)&&((S=(g=Object.defineProperty)&&Object.getOwnPropertyDescriptor(x,C))&&(S.get||S.set)?g(y,C,S):y[C]=x[C]);return y})(i,d)})((function(){if(Un)return We;Un=1,Object.defineProperty(We,"__esModule",{value:!0}),We.browserPrefixToKey=f,We.browserPrefixToStyle=function(p,x){return x?`-${x.toLowerCase()}-${p}`:p},We.default=void 0,We.getPrefix=d;const i=["Moz","Webkit","O","ms"];function d(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const x=window.document?.documentElement?.style;if(!x||p in x)return"";for(let u=0;u<i.length;u++)if(f(p,i[u])in x)return i[u];return""}function f(p,x){return x?`${x}${(function(u){let g="",S=!0;for(let y=0;y<u.length;y++)S?(g+=u[y].toUpperCase(),S=!1):u[y]==="-"?S=!0:g+=u[y];return g})(p)}`:p}return We.default=d(),We})());let n="";function t(i,d){return n||(n=(0,l.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(f){return(0,l.isFunction)(i[f])})),!!(0,l.isFunction)(i[n])&&i[n](d)}function a(i,d,f){let{x:p,y:x}=i,u=`translate(${p}${f},${x}${f})`;return d&&(u=`translate(${`${typeof d.x=="string"?d.x:d.x+f}`}, ${`${typeof d.y=="string"?d.y:d.y+f}`})`+u),u}function c(i){if(i)try{if(i.body&&h(i.body,"react-draggable-transparent-selection"),i.selection)i.selection.empty();else{const d=(i.defaultView||window).getSelection();d&&d.type!=="Caret"&&d.removeAllRanges()}}catch{}}function m(i,d){i.classList?i.classList.add(d):i.className.match(new RegExp(`(?:^|\\s)${d}(?!\\S)`))||(i.className+=` ${d}`)}function h(i,d){i.classList?i.classList.remove(d):i.className=i.className.replace(new RegExp(`(?:^|\\s)${d}(?!\\S)`,"g"),"")}return Se}var Kn,Ne={};function ha(){if(Kn)return Ne;Kn=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},Ne.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},Ne.createCoreData=function(t,a,c){const m=!(0,l.isNum)(t.lastX),h=n(t);return m?{node:h,deltaX:0,deltaY:0,lastX:a,lastY:c,x:a,y:c}:{node:h,deltaX:a-t.lastX,deltaY:c-t.lastY,lastX:t.lastX,lastY:t.lastY,x:a,y:c}},Ne.createDraggableData=function(t,a){const c=t.props.scale;return{node:a.node,x:t.state.x+a.deltaX/c,y:t.state.y+a.deltaY/c,deltaX:a.deltaX/c,deltaY:a.deltaY/c,lastX:t.state.x,lastY:t.state.y}},Ne.getBoundPosition=function(t,a,c){if(!t.props.bounds)return[a,c];let{bounds:m}=t.props;m=typeof m=="string"?m:(function(i){return{left:i.left,top:i.top,right:i.right,bottom:i.bottom}})(m);const h=n(t);if(typeof m=="string"){const{ownerDocument:i}=h,d=i.defaultView;let f;if(m==="parent"?f=h.parentNode:f=h.getRootNode().querySelector(m),!(f instanceof d.HTMLElement))throw new Error('Bounds selector "'+m+'" could not find an element.');const p=f,x=d.getComputedStyle(h),u=d.getComputedStyle(p);m={left:-h.offsetLeft+(0,l.int)(u.paddingLeft)+(0,l.int)(x.marginLeft),top:-h.offsetTop+(0,l.int)(u.paddingTop)+(0,l.int)(x.marginTop),right:(0,s.innerWidth)(p)-(0,s.outerWidth)(h)-h.offsetLeft+(0,l.int)(u.paddingRight)-(0,l.int)(x.marginRight),bottom:(0,s.innerHeight)(p)-(0,s.outerHeight)(h)-h.offsetTop+(0,l.int)(u.paddingBottom)-(0,l.int)(x.marginBottom)}}return(0,l.isNum)(m.right)&&(a=Math.min(a,m.right)),(0,l.isNum)(m.bottom)&&(c=Math.min(c,m.bottom)),(0,l.isNum)(m.left)&&(a=Math.max(a,m.left)),(0,l.isNum)(m.top)&&(c=Math.max(c,m.top)),[a,c]},Ne.getControlPosition=function(t,a,c){const m=typeof a=="number"?(0,s.getTouch)(t,a):null;if(typeof a=="number"&&!m)return null;const h=n(c),i=c.props.offsetParent||h.offsetParent||h.ownerDocument.body;return(0,s.offsetXYFromParent)(m||t,i,c.props.scale)},Ne.snapToGrid=function(t,a,c){const m=Math.round(a/t[0])*t[0],h=Math.round(c/t[1])*t[1];return[m,h]};var l=so(),s=Zo();function n(t){const a=t.findDOMNode();if(!a)throw new Error("<DraggableCore>: Unmounted during event!");return a}return Ne}var qn,Gn,Xn,Yn,kt={},Ut={};function fa(){return qn||(qn=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.default=function(){}),Ut}function Jl(){if(Gn)return kt;Gn=1,Object.defineProperty(kt,"__esModule",{value:!0}),kt.default=void 0;var l=(function(u,g){if(typeof WeakMap=="function")var S=new WeakMap,y=new WeakMap;return(function(C,b){if(!b&&C&&C.__esModule)return C;var w,j,T={__proto__:null,default:C};if(C===null||typeof C!="object"&&typeof C!="function")return T;if(w=b?y:S){if(w.has(C))return w.get(C);w.set(C,T)}for(const B in C)B!=="default"&&{}.hasOwnProperty.call(C,B)&&((j=(w=Object.defineProperty)&&Object.getOwnPropertyDescriptor(C,B))&&(j.get||j.set)?w(T,B,j):T[B]=C[B]);return T})(u,g)})(r),s=h(Ft()),n=h(Je),t=Zo(),a=ha(),c=so(),m=h(fa());function h(u){return u&&u.__esModule?u:{default:u}}function i(u,g,S){return(g=(function(y){var C=(function(b,w){if(typeof b!="object"||!b)return b;var j=b[Symbol.toPrimitive];if(j!==void 0){var T=j.call(b,w);if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(b)})(y,"string");return typeof C=="symbol"?C:C+""})(g))in u?Object.defineProperty(u,g,{value:S,enumerable:!0,configurable:!0,writable:!0}):u[g]=S,u}const d={start:"touchstart",move:"touchmove",stop:"touchend"},f={start:"mousedown",move:"mousemove",stop:"mouseup"};let p=f,x=class extends l.Component{constructor(){super(...arguments),i(this,"dragging",!1),i(this,"lastX",NaN),i(this,"lastY",NaN),i(this,"touchIdentifier",null),i(this,"mounted",!1),i(this,"handleDragStart",u=>{if(this.props.onMouseDown(u),!this.props.allowAnyClick&&typeof u.button=="number"&&u.button!==0)return!1;const g=this.findDOMNode();if(!g||!g.ownerDocument||!g.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:S}=g;if(this.props.disabled||!(u.target instanceof S.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(u.target,this.props.handle,g)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(u.target,this.props.cancel,g))return;u.type!=="touchstart"||this.props.allowMobileScroll||u.preventDefault();const y=(0,t.getTouchIdentifier)(u);this.touchIdentifier=y;const C=(0,a.getControlPosition)(u,y,this);if(C==null)return;const{x:b,y:w}=C,j=(0,a.createCoreData)(this,b,w);(0,m.default)("DraggableCore: handleDragStart: %j",j),(0,m.default)("calling",this.props.onStart),this.props.onStart(u,j)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(S),this.dragging=!0,this.lastX=b,this.lastY=w,(0,t.addEvent)(S,p.move,this.handleDrag),(0,t.addEvent)(S,p.stop,this.handleDragStop))}),i(this,"handleDrag",u=>{const g=(0,a.getControlPosition)(u,this.touchIdentifier,this);if(g==null)return;let{x:S,y}=g;if(Array.isArray(this.props.grid)){let b=S-this.lastX,w=y-this.lastY;if([b,w]=(0,a.snapToGrid)(this.props.grid,b,w),!b&&!w)return;S=this.lastX+b,y=this.lastY+w}const C=(0,a.createCoreData)(this,S,y);if((0,m.default)("DraggableCore: handleDrag: %j",C),this.props.onDrag(u,C)!==!1&&this.mounted!==!1)this.lastX=S,this.lastY=y;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const w=document.createEvent("MouseEvents");w.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(w)}}),i(this,"handleDragStop",u=>{if(!this.dragging)return;const g=(0,a.getControlPosition)(u,this.touchIdentifier,this);if(g==null)return;let{x:S,y}=g;if(Array.isArray(this.props.grid)){let w=S-this.lastX||0,j=y-this.lastY||0;[w,j]=(0,a.snapToGrid)(this.props.grid,w,j),S=this.lastX+w,y=this.lastY+j}const C=(0,a.createCoreData)(this,S,y);if(this.props.onStop(u,C)===!1||this.mounted===!1)return!1;const b=this.findDOMNode();b&&this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(b.ownerDocument),(0,m.default)("DraggableCore: handleDragStop: %j",C),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,b&&((0,m.default)("DraggableCore: Removing handlers"),(0,t.removeEvent)(b.ownerDocument,p.move,this.handleDrag),(0,t.removeEvent)(b.ownerDocument,p.stop,this.handleDragStop))}),i(this,"onMouseDown",u=>(p=f,this.handleDragStart(u))),i(this,"onMouseUp",u=>(p=f,this.handleDragStop(u))),i(this,"onTouchStart",u=>(p=d,this.handleDragStart(u))),i(this,"onTouchEnd",u=>(p=d,this.handleDragStop(u)))}componentDidMount(){this.mounted=!0;const u=this.findDOMNode();u&&(0,t.addEvent)(u,d.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const u=this.findDOMNode();if(u){const{ownerDocument:g}=u;(0,t.removeEvent)(g,f.move,this.handleDrag),(0,t.removeEvent)(g,d.move,this.handleDrag),(0,t.removeEvent)(g,f.stop,this.handleDragStop),(0,t.removeEvent)(g,d.stop,this.handleDragStop),(0,t.removeEvent)(u,d.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(g)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:n.default.findDOMNode(this)}render(){return l.cloneElement(l.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return kt.default=x,i(x,"displayName","DraggableCore"),i(x,"propTypes",{allowAnyClick:s.default.bool,allowMobileScroll:s.default.bool,children:s.default.node.isRequired,disabled:s.default.bool,enableUserSelectHack:s.default.bool,offsetParent:function(u,g){if(u[g]&&u[g].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:s.default.arrayOf(s.default.number),handle:s.default.string,cancel:s.default.string,nodeRef:s.default.object,onStart:s.default.func,onDrag:s.default.func,onStop:s.default.func,onMouseDown:s.default.func,scale:s.default.number,className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),i(x,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),kt}function Ql(){return Xn||(Xn=1,(function(l){Object.defineProperty(l,"__esModule",{value:!0}),Object.defineProperty(l,"DraggableCore",{enumerable:!0,get:function(){return i.default}}),l.default=void 0;var s=(function(g,S){if(typeof WeakMap=="function")var y=new WeakMap,C=new WeakMap;return(function(b,w){if(!w&&b&&b.__esModule)return b;var j,T,B={__proto__:null,default:b};if(b===null||typeof b!="object"&&typeof b!="function")return B;if(j=w?C:y){if(j.has(b))return j.get(b);j.set(b,B)}for(const I in b)I!=="default"&&{}.hasOwnProperty.call(b,I)&&((T=(j=Object.defineProperty)&&Object.getOwnPropertyDescriptor(b,I))&&(T.get||T.set)?j(B,I,T):B[I]=b[I]);return B})(g,S)})(r),n=f(Ft()),t=f(Je),a=(function(){if(Vn)return $t.exports;function g(y){var C,b,w="";if(typeof y=="string"||typeof y=="number")w+=y;else if(typeof y=="object")if(Array.isArray(y)){var j=y.length;for(C=0;C<j;C++)y[C]&&(b=g(y[C]))&&(w&&(w+=" "),w+=b)}else for(b in y)y[b]&&(w&&(w+=" "),w+=b);return w}function S(){for(var y,C,b=0,w="",j=arguments.length;b<j;b++)(y=arguments[b])&&(C=g(y))&&(w&&(w+=" "),w+=C);return w}return Vn=1,$t.exports=S,$t.exports.clsx=S,$t.exports})(),c=Zo(),m=ha(),h=so(),i=f(Jl()),d=f(fa());function f(g){return g&&g.__esModule?g:{default:g}}function p(){return p=Object.assign?Object.assign.bind():function(g){for(var S=1;S<arguments.length;S++){var y=arguments[S];for(var C in y)({}).hasOwnProperty.call(y,C)&&(g[C]=y[C])}return g},p.apply(null,arguments)}function x(g,S,y){return(S=(function(C){var b=(function(w,j){if(typeof w!="object"||!w)return w;var T=w[Symbol.toPrimitive];if(T!==void 0){var B=T.call(w,j);if(typeof B!="object")return B;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(w)})(C,"string");return typeof b=="symbol"?b:b+""})(S))in g?Object.defineProperty(g,S,{value:y,enumerable:!0,configurable:!0,writable:!0}):g[S]=y,g}class u extends s.Component{static getDerivedStateFromProps(S,y){let{position:C}=S,{prevPropsPosition:b}=y;return!C||b&&C.x===b.x&&C.y===b.y?null:((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:C,prevPropsPosition:b}),{x:C.x,y:C.y,prevPropsPosition:{...C}})}constructor(S){super(S),x(this,"onDragStart",(y,C)=>{if((0,d.default)("Draggable: onDragStart: %j",C),this.props.onStart(y,(0,m.createDraggableData)(this,C))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),x(this,"onDrag",(y,C)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",C);const b=(0,m.createDraggableData)(this,C),w={x:b.x,y:b.y,slackX:0,slackY:0};if(this.props.bounds){const{x:j,y:T}=w;w.x+=this.state.slackX,w.y+=this.state.slackY;const[B,I]=(0,m.getBoundPosition)(this,w.x,w.y);w.x=B,w.y=I,w.slackX=this.state.slackX+(j-w.x),w.slackY=this.state.slackY+(T-w.y),b.x=w.x,b.y=w.y,b.deltaX=w.x-this.state.x,b.deltaY=w.y-this.state.y}if(this.props.onDrag(y,b)===!1)return!1;this.setState(w)}),x(this,"onDragStop",(y,C)=>{if(!this.state.dragging||this.props.onStop(y,(0,m.createDraggableData)(this,C))===!1)return!1;(0,d.default)("Draggable: onDragStop: %j",C);const b={dragging:!1,slackX:0,slackY:0};if(this.props.position){const{x:w,y:j}=this.props.position;b.x=w,b.y=j}this.setState(b)}),this.state={dragging:!1,dragged:!1,x:S.position?S.position.x:S.defaultPosition.x,y:S.position?S.position.y:S.defaultPosition.y,prevPropsPosition:{...S.position},slackX:0,slackY:0,isElementSVG:!1},!S.position||S.onDrag||S.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??t.default.findDOMNode(this)}render(){const{axis:S,bounds:y,children:C,defaultPosition:b,defaultClassName:w,defaultClassNameDragging:j,defaultClassNameDragged:T,position:B,positionOffset:I,scale:D,...F}=this.props;let O={},P=null;const v=!B||this.state.dragging,M=B||b,H={x:(0,m.canDragX)(this)&&v?this.state.x:M.x,y:(0,m.canDragY)(this)&&v?this.state.y:M.y};this.state.isElementSVG?P=(0,c.createSVGTransform)(H,I):O=(0,c.createCSSTransform)(H,I);const A=(0,a.clsx)(C.props.className||"",w,{[j]:this.state.dragging,[T]:this.state.dragged});return s.createElement(i.default,p({},F,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),s.cloneElement(s.Children.only(C),{className:A,style:{...C.props.style,...O},transform:P}))}}l.default=u,x(u,"displayName","Draggable"),x(u,"propTypes",{...i.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:h.dontSetMe,style:h.dontSetMe,transform:h.dontSetMe}),x(u,"defaultProps",{...i.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(zn)),zn}function ga(){if(Yn)return wt.exports;Yn=1;const{default:l,DraggableCore:s}=Ql();return wt.exports=l,wt.exports.default=l,wt.exports.DraggableCore=s,wt.exports}var Zn,_t={};function ei(){if(Zn)return _t;Zn=1,_t.__esModule=!0,_t.cloneElement=function(c,m){return m.style&&c.props.style&&(m.style=t(t({},c.props.style),m.style)),m.className&&c.props.className&&(m.className=c.props.className+" "+m.className),s.default.cloneElement(c,m)};var l,s=(l=r)&&l.__esModule?l:{default:l};function n(c,m){var h=Object.keys(c);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(c);m&&(i=i.filter(function(d){return Object.getOwnPropertyDescriptor(c,d).enumerable})),h.push.apply(h,i)}return h}function t(c){for(var m=1;m<arguments.length;m++){var h=arguments[m]!=null?arguments[m]:{};m%2?n(Object(h),!0).forEach(function(i){a(c,i,h[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(h)):n(Object(h)).forEach(function(i){Object.defineProperty(c,i,Object.getOwnPropertyDescriptor(h,i))})}return c}function a(c,m,h){return(m=(function(i){var d=(function(f,p){if(typeof f!="object"||f===null)return f;var x=f[Symbol.toPrimitive];if(x!==void 0){var u=x.call(f,p);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(f)})(i,"string");return typeof d=="symbol"?d:String(d)})(m))in c?Object.defineProperty(c,m,{value:h,enumerable:!0,configurable:!0,writable:!0}):c[m]=h,c}return _t}var Jn,Qn,vt={};function xa(){if(Jn)return vt;Jn=1,vt.__esModule=!0,vt.resizableProps=void 0;var l,s=(l=Ft())&&l.__esModule?l:{default:l};ga();var n={axis:s.default.oneOf(["both","x","y","none"]),className:s.default.string,children:s.default.element.isRequired,draggableOpts:s.default.shape({allowAnyClick:s.default.bool,cancel:s.default.string,children:s.default.node,disabled:s.default.bool,enableUserSelectHack:s.default.bool,offsetParent:s.default.node,grid:s.default.arrayOf(s.default.number),handle:s.default.string,nodeRef:s.default.object,onStart:s.default.func,onDrag:s.default.func,onStop:s.default.func,onMouseDown:s.default.func,scale:s.default.number}),height:function(){for(var t=arguments.length,a=new Array(t),c=0;c<t;c++)a[c]=arguments[c];var m,h=a[0];return h.axis==="both"||h.axis==="y"?(m=s.default.number).isRequired.apply(m,a):s.default.number.apply(s.default,a)},handle:s.default.oneOfType([s.default.node,s.default.func]),handleSize:s.default.arrayOf(s.default.number),lockAspectRatio:s.default.bool,maxConstraints:s.default.arrayOf(s.default.number),minConstraints:s.default.arrayOf(s.default.number),onResizeStop:s.default.func,onResizeStart:s.default.func,onResize:s.default.func,resizeHandles:s.default.arrayOf(s.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:s.default.number,width:function(){for(var t=arguments.length,a=new Array(t),c=0;c<t;c++)a[c]=arguments[c];var m,h=a[0];return h.axis==="both"||h.axis==="x"?(m=s.default.number).isRequired.apply(m,a):s.default.number.apply(s.default,a)}};return vt.resizableProps=n,vt}function ba(){if(Qn)return St;Qn=1,St.__esModule=!0,St.default=void 0;var l=(function(x,u){if(x&&x.__esModule)return x;if(x===null||typeof x!="object"&&typeof x!="function")return{default:x};var g=c(u);if(g&&g.has(x))return g.get(x);var S={},y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in x)if(C!=="default"&&Object.prototype.hasOwnProperty.call(x,C)){var b=y?Object.getOwnPropertyDescriptor(x,C):null;b&&(b.get||b.set)?Object.defineProperty(S,C,b):S[C]=x[C]}return S.default=x,g&&g.set(x,S),S})(r),s=ga(),n=ei(),t=xa(),a=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function c(x){if(typeof WeakMap!="function")return null;var u=new WeakMap,g=new WeakMap;return(c=function(S){return S?g:u})(x)}function m(){return m=Object.assign?Object.assign.bind():function(x){for(var u=1;u<arguments.length;u++){var g=arguments[u];for(var S in g)Object.prototype.hasOwnProperty.call(g,S)&&(x[S]=g[S])}return x},m.apply(this,arguments)}function h(x,u){var g=Object.keys(x);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(x);u&&(S=S.filter(function(y){return Object.getOwnPropertyDescriptor(x,y).enumerable})),g.push.apply(g,S)}return g}function i(x){for(var u=1;u<arguments.length;u++){var g=arguments[u]!=null?arguments[u]:{};u%2?h(Object(g),!0).forEach(function(S){d(x,S,g[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(g)):h(Object(g)).forEach(function(S){Object.defineProperty(x,S,Object.getOwnPropertyDescriptor(g,S))})}return x}function d(x,u,g){return(u=(function(S){var y=(function(C,b){if(typeof C!="object"||C===null)return C;var w=C[Symbol.toPrimitive];if(w!==void 0){var j=w.call(C,b);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(C)})(S,"string");return typeof y=="symbol"?y:String(y)})(u))in x?Object.defineProperty(x,u,{value:g,enumerable:!0,configurable:!0,writable:!0}):x[u]=g,x}function f(x,u){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,S){return g.__proto__=S,g},f(x,u)}var p=(function(x){var u,g;function S(){for(var C,b=arguments.length,w=new Array(b),j=0;j<b;j++)w[j]=arguments[j];return(C=x.call.apply(x,[this].concat(w))||this).handleRefs={},C.lastHandleRect=null,C.slack=null,C}g=x,(u=S).prototype=Object.create(g.prototype),u.prototype.constructor=u,f(u,g);var y=S.prototype;return y.componentWillUnmount=function(){this.resetData()},y.resetData=function(){this.lastHandleRect=this.slack=null},y.runConstraints=function(C,b){var w=this.props,j=w.minConstraints,T=w.maxConstraints,B=w.lockAspectRatio;if(!j&&!T&&!B)return[C,b];if(B){var I=this.props.width/this.props.height,D=C-this.props.width,F=b-this.props.height;Math.abs(D)>Math.abs(F*I)?b=C/I:C=b*I}var O=C,P=b,v=this.slack||[0,0],M=v[0],H=v[1];return C+=M,b+=H,j&&(C=Math.max(j[0],C),b=Math.max(j[1],b)),T&&(C=Math.min(T[0],C),b=Math.min(T[1],b)),this.slack=[M+(O-C),H+(P-b)],[C,b]},y.resizeHandler=function(C,b){var w=this;return function(j,T){var B=T.node,I=T.deltaX,D=T.deltaY;C==="onResizeStart"&&w.resetData();var F=(w.props.axis==="both"||w.props.axis==="x")&&b!=="n"&&b!=="s",O=(w.props.axis==="both"||w.props.axis==="y")&&b!=="e"&&b!=="w";if(F||O){var P=b[0],v=b[b.length-1],M=B.getBoundingClientRect();w.lastHandleRect!=null&&(v==="w"&&(I+=M.left-w.lastHandleRect.left),P==="n"&&(D+=M.top-w.lastHandleRect.top)),w.lastHandleRect=M,v==="w"&&(I=-I),P==="n"&&(D=-D);var H=w.props.width+(F?I/w.props.transformScale:0),A=w.props.height+(O?D/w.props.transformScale:0),V=w.runConstraints(H,A);H=V[0],A=V[1];var N=H!==w.props.width||A!==w.props.height,R=typeof w.props[C]=="function"?w.props[C]:null;R&&!(C==="onResize"&&!N)&&(j.persist==null||j.persist(),R(j,{node:B,size:{width:H,height:A},handle:b})),C==="onResizeStop"&&w.resetData()}}},y.renderResizeHandle=function(C,b){var w=this.props.handle;if(!w)return l.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+C,ref:b});if(typeof w=="function")return w(C,b);var j=i({ref:b},typeof w.type=="string"?{}:{handleAxis:C});return l.cloneElement(w,j)},y.render=function(){var C=this,b=this.props,w=b.children,j=b.className,T=b.draggableOpts;b.width,b.height,b.handle,b.handleSize,b.lockAspectRatio,b.axis,b.minConstraints,b.maxConstraints,b.onResize,b.onResizeStop,b.onResizeStart;var B=b.resizeHandles;b.transformScale;var I=(function(D,F){if(D==null)return{};var O,P,v={},M=Object.keys(D);for(P=0;P<M.length;P++)O=M[P],F.indexOf(O)>=0||(v[O]=D[O]);return v})(b,a);return(0,n.cloneElement)(w,i(i({},I),{},{className:(j?j+" ":"")+"react-resizable",children:[].concat(w.props.children,B.map(function(D){var F,O=(F=C.handleRefs[D])!=null?F:C.handleRefs[D]=l.createRef();return l.createElement(s.DraggableCore,m({},T,{nodeRef:O,key:"resizableHandle-"+D,onStop:C.resizeHandler("onResizeStop",D),onStart:C.resizeHandler("onResizeStart",D),onDrag:C.resizeHandler("onResize",D)}),C.renderResizeHandle(D,O))}))}))},S})(l.Component);return St.default=p,p.propTypes=t.resizableProps,p.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},St}var er,tr,jt={};function ti(){if(er)return jt;er=1,jt.__esModule=!0,jt.default=void 0;var l=(function(u,g){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var S=m(g);if(S&&S.has(u))return S.get(u);var y={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var b in u)if(b!=="default"&&Object.prototype.hasOwnProperty.call(u,b)){var w=C?Object.getOwnPropertyDescriptor(u,b):null;w&&(w.get||w.set)?Object.defineProperty(y,b,w):y[b]=u[b]}return y.default=u,S&&S.set(u,y),y})(r),s=c(Ft()),n=c(ba()),t=xa(),a=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function c(u){return u&&u.__esModule?u:{default:u}}function m(u){if(typeof WeakMap!="function")return null;var g=new WeakMap,S=new WeakMap;return(m=function(y){return y?S:g})(u)}function h(){return h=Object.assign?Object.assign.bind():function(u){for(var g=1;g<arguments.length;g++){var S=arguments[g];for(var y in S)Object.prototype.hasOwnProperty.call(S,y)&&(u[y]=S[y])}return u},h.apply(this,arguments)}function i(u,g){var S=Object.keys(u);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(u);g&&(y=y.filter(function(C){return Object.getOwnPropertyDescriptor(u,C).enumerable})),S.push.apply(S,y)}return S}function d(u){for(var g=1;g<arguments.length;g++){var S=arguments[g]!=null?arguments[g]:{};g%2?i(Object(S),!0).forEach(function(y){f(u,y,S[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(S)):i(Object(S)).forEach(function(y){Object.defineProperty(u,y,Object.getOwnPropertyDescriptor(S,y))})}return u}function f(u,g,S){return(g=(function(y){var C=(function(b,w){if(typeof b!="object"||b===null)return b;var j=b[Symbol.toPrimitive];if(j!==void 0){var T=j.call(b,w);if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(b)})(y,"string");return typeof C=="symbol"?C:String(C)})(g))in u?Object.defineProperty(u,g,{value:S,enumerable:!0,configurable:!0,writable:!0}):u[g]=S,u}function p(u,g){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(S,y){return S.__proto__=y,S},p(u,g)}var x=(function(u){var g,S;function y(){for(var C,b=arguments.length,w=new Array(b),j=0;j<b;j++)w[j]=arguments[j];return(C=u.call.apply(u,[this].concat(w))||this).state={width:C.props.width,height:C.props.height,propsWidth:C.props.width,propsHeight:C.props.height},C.onResize=function(T,B){var I=B.size;C.props.onResize?(T.persist==null||T.persist(),C.setState(I,function(){return C.props.onResize&&C.props.onResize(T,B)})):C.setState(I)},C}return S=u,(g=y).prototype=Object.create(S.prototype),g.prototype.constructor=g,p(g,S),y.getDerivedStateFromProps=function(C,b){return b.propsWidth!==C.width||b.propsHeight!==C.height?{width:C.width,height:C.height,propsWidth:C.width,propsHeight:C.height}:null},y.prototype.render=function(){var C=this.props,b=C.handle,w=C.handleSize;C.onResize;var j=C.onResizeStart,T=C.onResizeStop,B=C.draggableOpts,I=C.minConstraints,D=C.maxConstraints,F=C.lockAspectRatio,O=C.axis;C.width,C.height;var P=C.resizeHandles,v=C.style,M=C.transformScale,H=(function(A,V){if(A==null)return{};var N,R,_={},X=Object.keys(A);for(R=0;R<X.length;R++)N=X[R],V.indexOf(N)>=0||(_[N]=A[N]);return _})(C,a);return l.createElement(n.default,{axis:O,draggableOpts:B,handle:b,handleSize:w,height:this.state.height,lockAspectRatio:F,maxConstraints:D,minConstraints:I,onResizeStart:j,onResize:this.onResize,onResizeStop:T,resizeHandles:P,transformScale:M,width:this.state.width},l.createElement("div",h({},H,{style:d(d({},v),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},y})(l.Component);return jt.default=x,x.propTypes=d(d({},t.resizableProps),{},{children:s.default.element}),jt}var oi=(tr||(tr=1,Vt.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Vt.exports.Resizable=ba().default,Vt.exports.ResizableBox=ti().default),Vt.exports);function wo(l,s){if(typeof l=="function")return l(s);l&&(l.current=s)}var Nt=parseInt(r.version.split(".")[0],10)>=19?function(l){return s=>{const n=[];for(const t of l){const a=wo(t,s),c=typeof a=="function";n.push(c?a:()=>wo(t,null))}return()=>{for(const t of n)t()}}}:function(l){return s=>{for(const n of l)wo(n,s)}};const Jo=r.memo(r.forwardRef((l,s)=>{const{disabled:n,names:t,workbook:a,restoreFocus:c,readonly:m=!1,disabled:h=!1,commandPopupButtonProps:i,sx:d,...f}=l,p=k.useNotifier(),[x,u]=r.useState(null),[g,S]=r.useState(()=>a.getSelectedRanges().getCoords()),[y,C]=r.useState(!1),{reference:b}=o.useFloatStack({parentFloat:i?.parentFloat}),[w,j]=r.useState(()=>m||!a.getProtection().isStructureAllowed()),T=()=>x?.text??"",[B,I]=r.useState(T),D=k.useCallbackRef(()=>{if(b?.closeAll(),!B){const K=T();return I(T()),K}if(T()===B)return B;const U=B.trim().toLowerCase();if(U==="r"||U==="c")return B;try{const K=a.getRanges(B);if(K)return K.toString()}catch{}const Z=t.getByName(B);if(Z&&Z.getRanges())return B;let ee=null;try{const K=a.getRanges(B),z=K.getCoords().map(J=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...J}));ee=a.getRanges(z)}catch{}if(!ee){const K=a.getSelectedRanges().getCoords().map(z=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...z}));ee=a.getRanges(K)}try{let K=t.getByName(B);w||K||(K=t.addReference(B,ee)),K&&u({text:K.getName()})}catch(K){I(T()),p.showMessage?.(K.message,{type:k.NotifierType.Error})}return null},[B,t,b,w,p]),F=k.useCallbackRef(()=>{if(a.isClosed())return;const U=[];for(let K=0;K<g.length;K++){const z=g[K];U.push({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...z})}let Z=null;try{Z=t.lookupByRanges(U)}catch{}let ee=null;ee=Z?.length>0?Z[0].getName():a.getSelectedSheet().getSelectedRange().toString(),u({text:ee})},[a,g]),[O,P]=r.useState(()=>t?.getItems()??null);ie.useModelListener(t,{onCollectionChange(U){P(t.getItems()),F()},onClose(U){P([])}}),r.useEffect(()=>{I(T())},[x,g]);const[v,M]=r.useState(a?.getSelectedSheet());ie.useModelListener(a,{onProtectionChange:U=>{j(m||!U.getProtection().isStructureAllowed())},onSheetsChange:U=>{M(U?.getSelectedSheet())},onViewChange(U){M(U?.getSelectedSheet())}});const[H,A]=r.useState(null),V=k.useCallbackRef(L.CommonUtils.debounce(F,H?320:0),[]);ie.useModelListener(v.getSelection(),{onChange:()=>{S(U=>{const Z=a.getSelectedRanges().getCoords();return L.CoordUtils.isEqualRangesArrays(Z,U)?U:Z})},onAdjustingChange:U=>{A(U.getAdjusting())}}),r.useEffect(()=>{if(H){const U=a.getSelectedRange(),Z=U.getRowCount(),ee=U.getColumnCount();let K=`${Z}R x ${ee}C`;if(K.length>17&&(K=`${Z}x${ee}`),Z>1||ee>1)return void u({text:K,fontStyle:"italic",justifyContent:"center"})}u({text:a.getSelectedSheet().getSelectedRange().toString()}),V()},[g,a,H]);const N=r.useRef(null),R=r.useCallback(U=>{const{onMouseDown:Z,onMouseUp:ee,...K}=U;return e.jsx(E.IconButton,{...K,sx:{...K?.sx,display:"flex",flex:"1 1 100%"},disableRipple:!0,children:e.jsx(E.Input,{inputMode:"text",inputProps:{tabIndex:0,name:"input-named-range",maxLength:255,className:"input",autoFocus:!1,spellCheck:!1,autoComplete:"off",ref:N},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:z=>`1px solid ${z.palette.text.icon??z.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:z=>`1px solid ${z.palette.primary.main}`},"::after":{borderBottom:z=>`1px solid ${z.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",fontSize:11*L.IFont.getDeviceScale(),fontStyle:x?.fontStyle,paddingLeft:z=>z.spacing(.75),paddingRight:z=>z.spacing(.75),boxShadow:"none",flex:"1",color:z=>z.palette.text.secondary,input:{padding:"0",textAlign:"left","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:z=>z.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:z=>z.palette.text.primary}}},value:B,onFocus:z=>{z.target?.select()},onKeyDown:z=>{if(z.which===k.KeyCodes.Enter||z.which===k.KeyCodes.Tab){let J=B;T()!==B&&(z.stopPropagation(),z.preventDefault(),J=D()),J?_(J):c?.()}else if(z.which===k.KeyCodes.Escape)T()!==B?(I(T()),setTimeout(()=>{z.target?.select()},0),z.stopPropagation(),z.preventDefault()):c?.();else if(z.which===k.KeyCodes.Space)return void z.stopPropagation()},onBlur:()=>{I(T())},onChange:z=>{I(z.target.value)}})})},[B,x]),_=k.useCallbackRef(async U=>{try{b?.closeAll();const Z=t.lookupByRanges(U)?.[0];Z&&await Z?.select(),await a.getRanges(U)?.select()}catch(Z){p.showMessage?.(Z.message,{type:k.NotifierType.Error})}},[t,p,a]),X=r.useCallback(U=>{setTimeout(()=>{C(!0)},0);const Z={variant:k.CommandButtonType.Menuitem,parentFloat:U.floatReference,commandHook:{...i?.commandHook,beforeExecute:(be,ye)=>(b?.closeAll(),i?.commandHook?.beforeExecute?.(be,ye))},scope:i?.scope,commands:i?.commands};let ee=t.getItems({scope:a?.getSelectedSheet().getName()});ee=ee.sort((be,ye)=>be.getType()===ye.getType()?be.getName().localeCompare(ye.getName()):be.getType()==="range"?-1:1);const K=w?null:["editNamedReference","deleteNamedReference"],z=w?null:["editTable",null,"convertTableToRange","deleteTable"],J=[],re=ee.length;for(let be=0;be<re;be++){const ye=ee[be],Be=ye.getRanges();if(!Be||ye.isHidden())continue;const ce=ye.getType();ce!==ee[be-1]?.getType()&&(be>0&&J.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal"},`type-divider-${J.length}`)),J.push(e.jsx(o.ExhibitMenuHeader,{variant:"subtitle2",sx:{paddingLeft:"16px"},children:ye.getType()==="reference"?"Ranges":"Tables"},`type-header-${J.length}`))),ce==="reference"?J.push(r.createElement(o.SimpleCommandPopupButton,{...Z,key:"named-"+J.length,popupCommandKeys:K,popupScope:"namedItem",scope:"namedItem",commandState:ye,commands:i?.commands,label:ye.getName(),quickCommand:"selectNamed",disabled:!ye.getRanges()||h,icon:Q=>{switch(Q.key()){case"editNamedReference":return o.themeIcon(e.jsx(o.CellSelectionEditIcon,{}));case"deleteNamedReference":return o.themeIcon(e.jsx(o.CellSelectionRemoveIcon,{}));default:return o.themeIcon(e.jsx(o.CellSelectionIcon,{}))}}})):ce==="table"&&J.push(r.createElement(o.SimpleCommandPopupButton,{...Z,key:"namedItem-"+J.length,popupCommandKeys:z,popupScope:"namedItem",scope:"namedItem",commands:i?.commands,commandState:ye,label:ye.getName(),quickCommand:"selectNamed",disabled:!Be||h,icon:Q=>(Q.key(),o.themeIcon(e.jsx(o.InsertTableIcon,{})))}))}const xe=e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...f,children:[w?null:e.jsx(o.CommandButton,{...Z,scope:"namedItem",command:i?.commands.getCommand("addNamedReference"),icon:o.themeIcon(e.jsx(o.CellSelectionInsertIcon,{}))}),J&&J.length>0?e.jsxs(e.Fragment,{children:[w?null:e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:J})]}):null]});return o.defaultCreatePopupPanel({...U,children:xe})},[a,O,t,x,w]),q=k.useImperativeElement(s,()=>({focus(U){N.current?.focus(U)}}),[]);return e.jsx(E.Box,{className:"outer",sx:{minWidth:120,flex:"1 1 100%",display:"flex",alignItems:"center",justifyContent:"start",...d},ref:Nt([q,s]),...f,children:e.jsx(o.ExhibitPopupIconButton,{className:"outer-button",sx:{display:"flex",flex:"1 1 100%","& .tooltip-wrapper":{display:"flex",flex:"1 1 100%",width:"100%",height:"27px"},...d},buttonProps:{sx:{backgroundColor:U=>U.palette.background.paper,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`}},tabIndex:-1,outlined:{color:U=>n?U.palette.action.disabled:G.alpha(U.palette.divider,.2)},parentFloat:b,createPopupPanel:X,onPopupOpen:()=>C(!0),onPopupClose:()=>C(!1),createTooltip:({children:U},Z)=>e.jsx(o.ExhibitTooltip,{title:Z||y?"":"Name Box",disabled:Z,leaveDelay:0,sx:{opacity:Z||y?0:1},children:U}),createQuickButton:R})})}));Jo.displayName="NamedCollectionEditor";const ni=(l,s)=>e.jsx(Jo,{ref:s,...l}),Qo=r.memo(r.forwardRef((l,s)=>{const{sx:n,workbook:t,sheetElement:a,gridStyle:c,showNamedCollectionEditor:m=!0,NamedCollectionEditorProps:h,renderNamedCollectionEditor:i=ni,disabled:d,commands:f,...p}=l,[x,u]=r.useState(t?.getSelectedSheet());ie.useModelListener(t,{onSheetsChange:z=>{u(z?.getSelectedSheet())},onViewChange(z){u(z?.getSelectedSheet())}});const[g,S]=r.useState(x.getSelection().getCoords().cell),y=x.getRange(g).getCell(),C=d||!y.isEditAllowed(),b=r.useRef(null),w=r.useMemo(()=>({fontSize:11}),[]);ie.useModelListener(x.getSelection(),{onChange:()=>{S(x.getSelection().getCoords().cell)}}),ie.useModelListener(x,{onProtectionChange(){S(x.getSelection().getCoords().cell)}});const j=b.current?.getLineHeight()??20,[T,B]=r.useState(j),[I,D]=r.useState(5),[F,O]=r.useState(1),P=k.useCallbackRef((z,{size:J})=>{z.preventDefault(),z.stopPropagation();const re=Math.floor(J.height/j);B(re*j+1),re>1&&D(re)},[j]),v=k.useCallbackRef((z,{size:J})=>{const re=Math.floor(J.height/j);O(re)},[j]),M=k.useEditMode(),H=M.getMode();let A=null;H?.key==="edit"&&(A=H.args?.stateAndCoords);const V=r.useMemo(()=>{let z=A?.editState;return z||(z=ie.createCellEditStateFromCell(()=>x.getRange(g).getCell())),e.jsx(E.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(ie.SheetCellEditor,{ref:b,activeCoords:g,sheet:x,onFocus:()=>{a?.startEdit({autoFocus:!1,editMode:!0,cell:g})},defaultTextStyle:w,useRichStyling:!1,disabled:C,onChangeEdit:J=>{if(J.dirty!==void 0){const re={sheet:x,coords:g,editState:J};M.setMode(xe=>({...xe,args:{...xe?.args,stateAndCoords:re}}))}},editState:z,commands:f,onCancelEdit:()=>{a?.cancelEdit(),a?.focus()},onSubmitEdit:()=>{a?.submitEdit(),a?.focus()},linesVisible:F})})},[x,A,g,F,a]),N=r.useRef(null),R=r.useMemo(()=>m?i({names:t.getNames(),workbook:t,...h},N):null,[i,h,m,x,t,C]),_=r.useMemo(()=>e.jsxs(E.Paper,{elevation:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:0,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,border:z=>`solid ${C?z.palette.action.disabled:G.alpha(z.palette.divider,.2)} 1px`},children:[e.jsx(o.ExhibitIconButton,{sx:{padding:"0px",margin:"0px 0px",border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"warning","aria-label":"cancel-formula-edit",icon:o.themeIcon(e.jsx(o.CloseErrorIcon,{})),tooltipProps:{label:"Cancel",simple:!0},disabled:C||A===null,onMouseDown:z=>{z.button===0&&z.preventDefault()},onClick:()=>{a.cancelEdit()}}),e.jsx(o.ExhibitIconButton,{sx:{padding:"0px",margin:"0px 0px",border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"primary","aria-label":"commit-formula-edit",icon:o.themeIcon(e.jsx(o.CheckSuccessIcon,{})),tooltipProps:{label:"Enter",simple:!0},disabled:C||A===null,onMouseDown:z=>{z.button===0&&z.preventDefault()},onClick:()=>{a.submitEdit()}}),e.jsx(o.ExhibitIconButton,{sx:{padding:"0px",margin:"0px 0px",border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,disabled:!0,"aria-label":"commit-formula-function",icon:o.themeIcon(e.jsx(o.FunctionIcon,{sx:{transform:"scale(0.85)"}})),tooltipProps:{label:"Insert Function",simple:!0},onMouseDown:z=>{z.button===0&&z.preventDefault()}})]}),[C,A]),X=G.useTheme(),[q,U]=r.useState(!1),Z=r.useMemo(()=>e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",gap:z=>z.spacing(.5),alignItems:"start"},children:[_,e.jsxs(E.Paper,{elevation:0,sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",fontFamily:z=>z.typography.fontFamily,fontSize:11*L.IFont.getDeviceScale(),"& .editor-placement":{top:"2px !important"},boxShadow:"none",borderRadius:z=>`${z.shape.borderRadius}px`,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,border:z=>`solid ${C?z.palette.action.disabled:G.alpha(z.palette.divider,.2)} 1px`,"& textarea":{color:z=>C?`${z.palette.text.disabled} !important`:z.palette.text.primary},"& .react-resizable-handle":{width:"100%",height:"8px",backgroundColor:"transparent",boxSizing:"content-box",zIndex:1e3},"& .react-resizable-handle-s":{position:"absolute",bottom:"-10px",cursor:"s-resize"}},onFocus:()=>U(!0),onBlur:()=>U(!1),onMouseDown:z=>{z.target?.classList.contains("react-resizable-handle")&&z.preventDefault()},children:[e.jsx(E.Box,{className:"formula-editor",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",alignSelf:"baseline",paddingLeft:z=>z.spacing(1),paddingRight:z=>z.spacing(1)},children:e.jsx(oi.ResizableBox,{height:T,draggableOpts:{grid:[j,j]},minConstraints:[j,j],maxConstraints:[15*j,15*j],onResize:v,onResizeStop:P,resizeHandles:["s"],axis:"y",style:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:V})}),e.jsx(o.ExhibitIconButton,{sx:{padding:"0px",margin:"0px 0px",border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,"aria-label":"toggle-expand-formula-edit",icon:o.themeIcon(F>1?e.jsx(me.ExpandLess,{}):e.jsx(me.ExpandMore,{})),tooltipProps:{label:(F>1?"Collapse":"Expand")+" Formula Bar",simple:!0},onMouseDown:z=>{z.button===0&&z.preventDefault()},onClick:()=>{const z=F>1?1:I;B(z*j+1),O(z)}}),e.jsx(E.Box,{sx:{position:"absolute",width:"100%",height:"2px",bottom:"0",willChange:"opacity",transition:"opacity 60ms ease-in",opacity:q?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:z=>z.palette.primary.main,borderRadius:z=>`${z.shape.borderRadius}px`}})]})]}),[_,V,q,F,j]),ee=r.useMemo(()=>R||Z?!R&&Z?Z:R&&!Z?R:e.jsx(e.Fragment,{children:e.jsx(k.SplitPane,{fixedPane:"before",minBefore:"165px",minAfter:"200px",paneBeforeProps:{style:{alignItems:"flex-start"}},paneAfterProps:{style:{overflow:"visible"}},resizerProps:{style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='6' height='13' viewBox='0 0 6 13' version='1.1' fill='${X.palette.text.icon??X.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='m 4.5961932,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.88365,0 -1.60005,-0.71626 -1.60005,-1.59991 0,-0.88365 0.7164,-1.6000508 1.60005,-1.6000508 0.88364,0 1.59991,0.7164008 1.59991,1.6000508 m 0,-4.881294 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 -0.88365,0 -1.60005,-0.7164 -1.60005,-1.60004 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-4.881226 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 -0.88365,0 -1.60005,-0.7164 -1.60005,-1.60005 0,-0.88365 0.7164,-1.59991 1.60005,-1.59991 0.88364,0 1.59991,0.71626 1.59991,1.59991' /%3E%3C/svg%3E%0A")`,backgroundRepeat:"no-repeat",backgroundPosition:"center 6.5px",minWidth:"18px"}},elementBefore:R,elementAfter:Z})}):null,[R,Z]),K=k.useImperativeElement(s,()=>({isFormulaBarElement:()=>!0,getNamedCollectionEditorElement:()=>N.current}),[]);return e.jsx(E.Box,{sx:{display:"flex",flexDirection:"row",gap:z=>z.spacing(.5),...n},ref:K,...p,children:ee})}));Qo.displayName="FormulaBar";const en=r.memo(r.forwardRef((l,s)=>{const{filter:n,commands:t,disabled:a,sx:c,floatReference:m,...h}=l,i=r.useMemo(()=>({}),[]),d=r.useMemo(()=>({commandHook:{beforeExecute:(x,u)=>m.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:a,parentFloat:m}),[a,m]),f=r.useMemo(()=>({...i,...d,variant:k.CommandButtonType.Menuitem}),[i,d]),p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:t.getCommand("sortAscending"),icon:o.themeIcon(e.jsx(o.SortIncreaseIcon,{}))}),e.jsx(o.CommandButton,{...f,command:t.getCommand("sortDescending"),icon:o.themeIcon(e.jsx(o.SortDecreaseIcon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...f,command:t.getCommand("autoFilterClear"),icon:o.themeIcon(e.jsx(o.FilterClearIcon,{}))}),[]]});return e.jsx(E.Box,{ref:s,sx:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...c},...h,children:p})}));en.displayName="FilterColumnMenu";const ya=r.memo(r.forwardRef((l,s)=>{const{children:n,className:t,disabled:a,style:c,filter:m,...h}=l,i=k.useImperativeElement(s,()=>({isFilters:()=>!0}),[]);return e.jsx("div",{ref:i,className:ge("filters",t),style:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",...c},...h,children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",minHeight:"100px",minWidth:"220px",alignItems:"center",border:"grey solid 1px",padding:"4px 4px",overflow:"hidden",flexDirection:"column",justifyContent:"space-evenly",marginTop:"4px",marginBottom:"4px",marginLeft:"16px",marginRight:"16px"},children:[e.jsx("div",{children:m.getName()}),e.jsx("div",{children:"Filter Widget"})]})})}));ya.displayName="Filters";const tn=r.memo(r.forwardRef((l,s)=>{const{children:n,sheet:t,style:a,className:c,value:m,index:h,editing:i,editable:d,disabled:f,selectedIndex:p,dragging:x,borderColor:u,borderWidth:g,activeColor:S,background:y="white",tabRadius:C=4,gridTheme:b,...w}=l,[j,T]=r.useState(()=>!!t&&t.getProtection().isLocked()),[B,I]=r.useState(()=>t?t.getTabColor():null);ie.useModelListener(t,{onProtectionChange:()=>{T(t.getProtection().isLocked())},onTabColorChange:()=>{I(t.getTabColor())},onStyleChange:()=>{I(t.getTabColor())}});const D=G.useTheme(),F=p===h;let O=null,P=null;if(B||x){let H=y;B?(P=B.toBlackOrWhite().toCSS(),H=B?.toCSS()):F||(H=D.palette.background.paper),O=e.jsx(E.Box,{sx:{position:"absolute",boxSizing:"border-box",top:"3px",left:"4px",right:"4.5px",bottom:"1.5px",opacity:F?"50%":"100%",borderRadius:"4px",border:A=>F?`${y} solid 1px`:`${A.palette.divider} solid 1px`,background:F&&B?`linear-gradient(0deg, ${H} 0%, transparent)`:H}})}let v=null;typeof u=="string"?v=u:u?.toCSS&&(v=u.toCSS());const M=F?e.jsx(E.Box,{sx:{width:"100%",borderRadius:"4px",minWidth:"4px",height:"2px",backgroundColor:H=>H.palette.primary.main}}):null;return e.jsx(G.ThemeProvider,{theme:F?b??D:D,children:e.jsx(E.Box,{ref:s,className:ge(c),sx:{...a,display:"flex",flexDirection:"column",minHeight:"0px",fontWeight:F?"700":"400",fontSize:"0.85rem",letterSpacing:"0",lineHeight:"1",textTransform:"none",minWidth:"unset",cursor:x?"grabbing":void 0},...w,children:e.jsx(k.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:C,strokeColor:F?v:"transparent",children:e.jsx(E.Button,{sx:{textTransform:"none",borderRadius:"0px",minHeight:"0px",paddingLeft:"11px",paddingRight:"12px",paddingTop:"3px",flex:"1 1 100%",paddingBottom:"3px",fontWeight:F?"700":"400",fontSize:"0.85rem",letterSpacing:"0",transition:"none",cursor:x?"grabbing":void 0,color:F?"primary":P||"text.secondary",backgroundColor:F?y:"transparent","&:hover:not([disabled])":{backgroundColor:F?y:"transparent"},"& input":{color:H=>`${H.palette.text.primary}`,textAlign:"center",fontWeight:"500"},marginTop:"0px",minWidth:"unset"},disabled:f,disableRipple:i,component:"div",children:e.jsxs(e.Fragment,{children:[O,e.jsxs(E.Box,{sx:{zIndex:"1",display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:"1px",lineHeight:"1",marginTop:F?void 0:"1px"},children:[n,M]}),j?e.jsx(me.Lock,{sx:{scale:"0.80",marginLeft:"2px",width:"22px",height:"22px"},color:"secondary"}):e.jsx(E.Box,{sx:{minHeight:"22px"}})]})]})},m+":"+h)})})})}));tn.displayName="SheetTab";const on=r.memo(r.forwardRef((l,s)=>{const{workbook:n,index:t,commands:a,scope:c="sheet",disabled:m,floatReference:h,sx:i,className:d,tabStripRef:f,...p}=l,[x,u]=r.useState(n?.getProtection());ie.useModelListener(n,{onProtectionChange:b=>{u(b?.getProtection())}});const g=r.useMemo(()=>({}),[]),S=r.useMemo(()=>({commandHook:{beforeExecute:(b,w)=>h.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:c,commandState:t,disabled:m||t===void 0,parentFloat:h}),[m,h]),y=r.useMemo(()=>({...g,...S}),[g,S]),C=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{command:a.getCommand("addSheet"),commandState:t,...y,variant:k.CommandButtonType.Menuitem}),e.jsx(o.CommandButton,{command:a.getCommand("deleteSheet"),...y,variant:k.CommandButtonType.Menuitem}),e.jsxs(o.ExhibitMenuItem,{onMouseDown:b=>{b.button===0&&b.preventDefault()},onMouseUp:()=>{Promise.resolve(h.closeAll()).then(()=>{f?.startEdit(t)})},disabled:m||!x.isStructureAllowed(),parentFloat:h,children:["Rename",c!=="sheet"?" Sheet":""]}),e.jsx(o.CommandButton,{command:a.getCommand("duplicateSheet"),...y,variant:k.CommandButtonType.Menuitem}),e.jsx(o.CommandButton,{command:a?.getCommand("protectionSheetToggle"),...y,variant:k.CommandButtonType.Menuitem,icon:e.jsx(me.Lock,{})}),e.jsx(ut,{variant:k.CommandButtonType.Menuitem,command:a.getCommand("formatSheetTabColor"),icon:e.jsx(o.ColorizedStrokeIcon,{}),panelProps:{disableAlpha:!0,autoColorLabel:"No Tab Color",autoColorPosition:dt.End},parentFloat:h}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{command:a.getCommand("hideSheet"),...y,variant:k.CommandButtonType.Menuitem,icon:o.themeIcon(e.jsx(o.VisibilityOffIcon,{}))})]});return e.jsx(E.Box,{ref:s,className:ge("menu",d),sx:{...i},...p,children:C})}));on.displayName="SheetTabMenu";const nn=r.memo(r.forwardRef((l,s)=>{const{workbook:n,gridStyle:t,floatReference:a,closeFloatAll:c,className:m,...h}=l,[i,d]=r.useState(n?.getSheets().getItems()),[f,p]=r.useState(n?.getProtection());ie.useModelListener(n,{onSheetsChange:u=>{d(u.getSheets().getItems())},onProtectionChange:u=>{p(u?.getProtection())}});const x=r.useMemo(()=>{const u=[],g=n.getSheets().getItems({visibility:L.ISheet.Visibility.Hidden}),S=n.getSelectedSheet();for(let y=0;y<g.length;y++){const C=g[y],b=C.getVisibility();if(b===L.ISheet.Visibility.VeryHidden)continue;const w=S===C,j=C.getProtection().isLocked(),T=C.getTabColor(),B=t?.body.fill??"transparent";let I=null,D=null,F=B;T&&(F=T.toCSS(),w||(D=T.toBlackOrWhite().toCSS()),I=e.jsx(E.Box,{sx:{position:"absolute",display:"flex",flexDirection:"column",top:"4px",left:"40px",right:"8px",bottom:"4px",background:w?F:"transparent",borderRadius:"4px",border:`solid 1px ${t.header.edgeStrokeFill}`},children:e.jsx(E.Box,{sx:{flex:"1 1 100%",boxSizing:"content-box",opacity:w||b===L.ISheet.Visibility.Hidden?"50%":"100%",border:P=>w?`${B} solid 1.5px`:`${P.palette.divider} solid 1px`,background:w&&T?`linear-gradient(0deg, ${F} 0%, ${B})`:F,borderRadius:"4px"}})}));let O=null;j&&(O=e.jsx(me.Lock,{color:"secondary"})),b!==L.ISheet.Visibility.Visible&&(O=o.themeIcon(e.jsx(o.VisibilityOffIcon,{style:{opacity:f.isStructureAllowed()?1:.7},color:"secondary"}))),O&&(O=e.jsx(E.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",ml:"16px","& *":{lineHeight:"1em",fontSize:"1.3em"}},children:O})),u.push(e.jsx(o.ExhibitMenuItem,{disabled:!f.isStructureAllowed()&&b===L.ISheet.Visibility.Hidden,sx:{color:P=>{let v=w?P.palette.primary.main:P.palette.text.secondary;return D&&(v=D),b===L.ISheet.Visibility.Hidden&&(v=Re.alpha(v,P.palette.action.disabledOpacity)),v},borderLeft:P=>`${w?P.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"4px",fontWeight:w?"700":"400","&:hover":{fontWeight:"700"}},icon:w?e.jsx(o.SelectedIcon,{}):void 0,onMouseDown:P=>P.preventDefault(),onMouseUp:()=>{Promise.resolve(a.closeAll()).then(()=>{try{C.select()}catch(P){console.error(P)}})},children:e.jsxs(e.Fragment,{children:[I,e.jsxs(E.Box,{sx:{paddingRight:"0px",paddingLeft:"4px",display:"flex",flexDirection:"row",flex:"1 1 100%",overflow:"hidden",alignItems:"center",zIndex:2},children:[e.jsxs(E.Box,{className:"sheet-name",sx:{display:"flex",flexDirection:"column",paddingLeft:"8px",paddingRight:"8px",alignItems:"center"},children:[C.getName(),e.jsx(E.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:C.getName()})]}),O]})]})},""+y))}return u},[n,f,i,a,t]);return e.jsx(E.Box,{ref:s,className:ge("menu",m),...h,children:x})}));nn.displayName="SheetsAllMenu";let Kt=!1,Ca=!1,qe=null;const or=async l=>{const s=await L.LicenseManager.getDetails();if(Ca||s.isEval()){try{const n=top??window;n.SheetXL||(n.SheetXL=Object.freeze({getSelectedWorkbook:()=>qe?.getWorkbook(),getSelectedSheet:()=>qe?.getWorkbook().getSelectedSheet(),getSelectedRange:()=>qe?.getWorkbook().getSelectedRange(),getRange:t=>qe?.getWorkbook().getRange(t),getSelectedWorkbookElement:()=>qe,getLicenseManager:()=>L.LicenseManager,moreExamples:()=>{console.table({"SheetXL.getRange('Sheet1!e5:f6').setValues([[110, 220], [210, 220]])":{Summary:"Set an array of values."},"SheetXL.getRange('a1:e5').setValue(100)":{Summary:"Set a single repeating value to a range."},"SheetXL.getRange('Sheet1!e5:f6').getValues()":{Summary:"Get the values as a 2d array (see forEach)."},"SheetXL.getSelectedRange().setValue(new Date())":{Summary:"Set current date/time using Javascript Date."},"SheetXL.getSelectedRange().setValue('10/23/95')":{Summary:"Set current date/time using string."},"SheetXL.getSelectedSheet().getUsedRange().getValues()":{Summary:"Get all of the values in a sheet."},"SheetXL.getSelectedRange().getStyle().update({ fill: 'accent4' })":{Summary:"Set fill to theme color 4."},"SheetXL.getRange('E:L').getStyle().update({ fill: 'accent1 lumMod 90 lumOff 40' })":{Summary:"Set some columns to a modified theme color."},"SheetXL.getRange('e5:f10').getStyle().update({ style: { border: 'double blue' }})":{Summary:"Set border."},"SheetXL.getCell().getStyle().fill.toCSS()":{Summary:"Get the fill style as css for the selected cell."},"SheetXL.getRange('a1:a3').autoFill('a1:a7')":{Summary:"Autofill down."},"SheetXL.getRange('e7:i9').merge({ orientation: 'rows' })":{Summary:"Merge cells horizontally."},"SheetXL.getSelectedRange().sort({ ascending: false, hasHeader: false })":{Summary:"Sort selected cells ascending with a header."},"SheetXL.getSelectedRange().clear('all')":{Summary:"Clear the current range a different way."},"SheetXL.getSelectedSheet().getTables().add('b2:e9')":{Summary:"Create a 4x8 table at b2 for current sheet."},"SheetXL.getRange('a1:c3').copyFrom('e1:g3')":{Summary:"Copy cells."},"SheetXL.getRange('c:t').getColumnHeaders().setSize(30)":{Summary:"Set the size of columns to 30 pixels."},"SheetXL.getRange('2:3').delete()":{Summary:"Remove rows 2 and 3 and shift up."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg')":{Summary:"Add an image."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg', { bounds: { height: 100 } })":{Summary:"Add an image of height 100."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue(1.50).getStyle().update({ numberFormat: '0%' }).autoFit(); }, 'Enter 150%')":{Summary:"Set value to 100 and numberformat to 0% as a single."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue('Remind Me Later').getStyle().update({ namedStyle: 'Note'}).autoFit(); }, 'Set Reminder')":{Summary:"Set a value and style to Note style and autofit text."},"SheetXL.getSelectedWorkbook().getNames().addReference('Small_Range', 'A2:E5');":{Summary:"Add a named range."},"SheetXL.getSelectedWorkbook().getRange('a1:e5').addListener((e) => { console.log('got an update for:', e.getSource().toString()) })":{Summary:"Listen for updates at a range."}})}}))}catch(n){n instanceof DOMException||console.error(n),Kt=!0}if(qe!==l&&(qe=l,!Kt))try{Kt=!0,(top??window).SheetXL&&(await L.LicenseManager._validate(!0),L.LicenseManager.wasPrinted()&&(()=>{Fe.CommonUtils.consoleWithNoSource(`%cTip: You can access the API directly in the console.
10
- Try
11
- %c>%c SheetXL.getRange('b2:c3').setValues([[42, 'Hello Word'], [new Date(), true]]) %c
12
- >%c SheetXL.moreExamples()`,"color:#ffa726;","font-family:monospace;color:#1976d2;font-size:12px;","font-family:monospace;","font-family:monospace;color:#1976d2;font-size:12px;","font-family:monospace;"),Kt=!0;const n=document.getElementById("openEditorLink");n&&n.addEventListener("click",t=>{t.preventDefault(),console.log("openScriptEditor called from console")})})())}catch(n){n instanceof DOMException||console.error(n)}}};var ri=function(){},Sa=typeof window<"u",ai=Sa?r.useLayoutEffect:r.useEffect,nr={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const pt=Sa&&window.ResizeObserver!==void 0?function(){var l=r.useState(null),s=l[0],n=l[1],t=r.useState(nr),a=t[0],c=t[1],m=r.useMemo(function(){return new window.ResizeObserver(function(h){if(h[0]){var i=h[0].contentRect,d=i.x,f=i.y,p=i.width,x=i.height,u=i.top,g=i.left,S=i.bottom,y=i.right;c({x:d,y:f,width:p,height:x,top:u,left:g,bottom:S,right:y})}})},[]);return ai(function(){if(s)return m.observe(s),function(){m.disconnect()}},[s]),[n,a]}:function(){return[ri,nr]};function oo(){return oo=Object.assign?Object.assign.bind():function(l){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var t in n)({}).hasOwnProperty.call(n,t)&&(l[t]=n[t])}return l},oo.apply(null,arguments)}function rn(l,s){if(l==null)return{};var n={};for(var t in l)if({}.hasOwnProperty.call(l,t)){if(s.indexOf(t)!==-1)continue;n[t]=l[t]}return n}function no(l,s){return no=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,t){return n.__proto__=t,n},no(l,s)}function wa(l,s){l.prototype=Object.create(s.prototype),l.prototype.constructor=l,no(l,s)}function rr(l,s){return l.replace(new RegExp("(^|\\s)"+s+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const ar=!1,ka=r.createContext(null);var va=function(l){return l.scrollTop},Mt="unmounted",Ge="exited",Xe="entering",at="entered",Ao="exiting",He=(function(l){function s(t,a){var c;c=l.call(this,t,a)||this;var m,h=a&&!a.isMounting?t.enter:t.appear;return c.appearStatus=null,t.in?h?(m=Ge,c.appearStatus=Xe):m=at:m=t.unmountOnExit||t.mountOnEnter?Mt:Ge,c.state={status:m},c.nextCallback=null,c}wa(s,l),s.getDerivedStateFromProps=function(t,a){return t.in&&a.status===Mt?{status:Ge}:null};var n=s.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(t){var a=null;if(t!==this.props){var c=this.state.status;this.props.in?c!==Xe&&c!==at&&(a=Xe):c!==Xe&&c!==at||(a=Ao)}this.updateStatus(!1,a)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var t,a,c,m=this.props.timeout;return t=a=c=m,m!=null&&typeof m!="number"&&(t=m.exit,a=m.enter,c=m.appear!==void 0?m.appear:a),{exit:t,enter:a,appear:c}},n.updateStatus=function(t,a){if(t===void 0&&(t=!1),a!==null)if(this.cancelNextCallback(),a===Xe){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:Je.findDOMNode(this);c&&va(c)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ge&&this.setState({status:Mt})},n.performEnter=function(t){var a=this,c=this.props.enter,m=this.context?this.context.isMounting:t,h=this.props.nodeRef?[m]:[Je.findDOMNode(this),m],i=h[0],d=h[1],f=this.getTimeouts(),p=m?f.appear:f.enter;!t&&!c||ar?this.safeSetState({status:at},function(){a.props.onEntered(i)}):(this.props.onEnter(i,d),this.safeSetState({status:Xe},function(){a.props.onEntering(i,d),a.onTransitionEnd(p,function(){a.safeSetState({status:at},function(){a.props.onEntered(i,d)})})}))},n.performExit=function(){var t=this,a=this.props.exit,c=this.getTimeouts(),m=this.props.nodeRef?void 0:Je.findDOMNode(this);a&&!ar?(this.props.onExit(m),this.safeSetState({status:Ao},function(){t.props.onExiting(m),t.onTransitionEnd(c.exit,function(){t.safeSetState({status:Ge},function(){t.props.onExited(m)})})})):this.safeSetState({status:Ge},function(){t.props.onExited(m)})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(t,a){a=this.setNextCallback(a),this.setState(t,a)},n.setNextCallback=function(t){var a=this,c=!0;return this.nextCallback=function(m){c&&(c=!1,a.nextCallback=null,t(m))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(t,a){this.setNextCallback(a);var c=this.props.nodeRef?this.props.nodeRef.current:Je.findDOMNode(this),m=t==null&&!this.props.addEndListener;if(c&&!m){if(this.props.addEndListener){var h=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],i=h[0],d=h[1];this.props.addEndListener(i,d)}t!=null&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},n.render=function(){var t=this.state.status;if(t===Mt)return null;var a=this.props,c=a.children;a.in,a.mountOnEnter,a.unmountOnExit,a.appear,a.enter,a.exit,a.timeout,a.addEndListener,a.onEnter,a.onEntering,a.onEntered,a.onExit,a.onExiting,a.onExited,a.nodeRef;var m=rn(a,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return r.createElement(ka.Provider,{value:null},typeof c=="function"?c(t,m):r.cloneElement(r.Children.only(c),m))},s})(r.Component);function tt(){}He.contextType=ka,He.propTypes={},He.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:tt,onEntering:tt,onEntered:tt,onExit:tt,onExiting:tt,onExited:tt},He.UNMOUNTED=Mt,He.EXITED=Ge,He.ENTERING=Xe,He.ENTERED=at,He.EXITING=Ao;var ko=function(l,s){return l&&s&&s.split(" ").forEach(function(n){return a=n,void((t=l).classList?t.classList.remove(a):typeof t.className=="string"?t.className=rr(t.className,a):t.setAttribute("class",rr(t.className&&t.className.baseVal||"",a)));var t,a})},Oo=(function(l){function s(){for(var t,a=arguments.length,c=new Array(a),m=0;m<a;m++)c[m]=arguments[m];return(t=l.call.apply(l,[this].concat(c))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(h,i){var d=t.resolveArguments(h,i),f=d[0],p=d[1];t.removeClasses(f,"exit"),t.addClass(f,p?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(h,i)},t.onEntering=function(h,i){var d=t.resolveArguments(h,i),f=d[0],p=d[1]?"appear":"enter";t.addClass(f,p,"active"),t.props.onEntering&&t.props.onEntering(h,i)},t.onEntered=function(h,i){var d=t.resolveArguments(h,i),f=d[0],p=d[1]?"appear":"enter";t.removeClasses(f,p),t.addClass(f,p,"done"),t.props.onEntered&&t.props.onEntered(h,i)},t.onExit=function(h){var i=t.resolveArguments(h)[0];t.removeClasses(i,"appear"),t.removeClasses(i,"enter"),t.addClass(i,"exit","base"),t.props.onExit&&t.props.onExit(h)},t.onExiting=function(h){var i=t.resolveArguments(h)[0];t.addClass(i,"exit","active"),t.props.onExiting&&t.props.onExiting(h)},t.onExited=function(h){var i=t.resolveArguments(h)[0];t.removeClasses(i,"exit"),t.addClass(i,"exit","done"),t.props.onExited&&t.props.onExited(h)},t.resolveArguments=function(h,i){return t.props.nodeRef?[t.props.nodeRef.current,h]:[h,i]},t.getClassNames=function(h){var i=t.props.classNames,d=typeof i=="string",f=d?(d&&i?i+"-":"")+h:i[h];return{baseClassName:f,activeClassName:d?f+"-active":i[h+"Active"],doneClassName:d?f+"-done":i[h+"Done"]}},t}wa(s,l);var n=s.prototype;return n.addClass=function(t,a,c){var m=this.getClassNames(a)[c+"ClassName"],h=this.getClassNames("enter").doneClassName;a==="appear"&&c==="done"&&h&&(m+=" "+h),c==="active"&&t&&va(t),m&&(this.appliedClasses[a][c]=m,(function(i,d){i&&d&&d.split(" ").forEach(function(f){return x=f,void((p=i).classList?p.classList.add(x):(function(u,g){return u.classList?!!g&&u.classList.contains(g):(" "+(u.className.baseVal||u.className)+" ").indexOf(" "+g+" ")!==-1})(p,x)||(typeof p.className=="string"?p.className=p.className+" "+x:p.setAttribute("class",(p.className&&p.className.baseVal||"")+" "+x)));var p,x})})(t,m))},n.removeClasses=function(t,a){var c=this.appliedClasses[a],m=c.base,h=c.active,i=c.done;this.appliedClasses[a]={},m&&ko(t,m),h&&ko(t,h),i&&ko(t,i)},n.render=function(){var t=this.props;t.classNames;var a=rn(t,["classNames"]);return r.createElement(He,oo({},a,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},s})(r.Component);Oo.defaultProps={classNames:""},Oo.propTypes={};const vo=.12,Lo=(l,s)=>{const n={},t=i=>{const d=i.palette?.background.default??"rgba(255,255,255,1)";return{text:{fontFamily:i.typography?.fontFamily??"Calibri",fontSize:i.typography?.fontSize??8.25,fontWeight:i.typography?.fontWeightRegular??"400",fill:i.palette.mode==="dark"?i.palette?.text?.secondary:i.palette?.text?.primary},fill:d,strokeFill:o.elevateColor(d,vo,i.palette?.mode),darkMode:i.palette.mode==="dark"}},a=t(s);n.body=t(l),n.header={...n.body,strokeFill:o.elevateColor(n.body.fill,vo,l.palette?.mode),fill:s&&l.palette.mode==="dark"&&s.palette.mode!==l.palette.mode?n.body.fill:o.elevateColor(n.body.fill,.055,l.palette?.mode),edgeStrokeFill:l.palette.mode==="dark"?n.body.strokeFill:o.elevateColor(n.body.fill,.328,l.palette?.mode)},n.headerHover=i=>({...n.header,strokeFill:o.elevateColor(i?.fill??n.body.fill,.22,l.palette?.mode),fill:o.elevateColor(i?.fill??n.header.fill,.065,l.palette?.mode),text:{...i?.text,fontWeight:l.typography?.fontWeightBold}});const c=o.elevateColor(l.palette.mode!=="dark"?l.palette.primary.light:l.palette.primary.main,.055,l.palette?.mode);n.headerSelect={...n.header,strokeFill:l.palette.primary.main,fill:Re.alpha(c,.2),text:{...n.header.text,fill:l.palette.primary.main},dividerStrokeFill:Re.alpha(c,.7)},n.headerSelectAll={...n.headerSelect,fill:Re.alpha(c,.9),text:{...n.headerSelect.text,fill:l.palette.primary.contrastText},edgeStrokeFill:n.headerSelect.strokeFill},n.buttonSurface={...a,strokeFill:o.elevateColor(a.fill,vo,s.palette?.mode),fill:s&&s.palette.mode==="dark"&&s.palette.mode!==l.palette.mode?a.fill:o.elevateColor(a.fill,.055,s.palette?.mode),edgeStrokeFill:s.palette.mode==="dark"?a.strokeFill:o.elevateColor(a.fill,.328,s.palette?.mode)},n.headerSelection={fill:l.palette?.primary?.main?Re.alpha(l.palette?.primary?.main,.1):void 0,strokeFill:l.palette?.primary?.main},n.headerSelectionInactive={...n.headerSelection,fill:l.palette?.divider?Re.alpha(l.palette?.divider,.05):void 0,strokeFill:"transparent"};const m=s??l,h=m.palette.mode==="dark";return n.selection={fill:m.palette?.primary?.main?Re.alpha(m.palette?.primary?.main,.1):void 0,strokeFill:m.palette?.primary?.main},n.selectionInactive={...n.selection,fill:m.palette?.divider?Re.alpha(m.palette?.divider,.05):void 0,strokeFill:"transparent"},n.selectionRemove={...n.selection,fill:Re.alpha(m.palette.warning.light,.05),strokeFill:m.palette.warning.dark},s&&(n.body=t(s)),n.colorShadow=Re.alpha(m.palette.action.active,.5),n.colorGrey=m.palette.action.active,n.filterDarkInvert=h?"hue-rotate(180deg) invert(1) brightness(95%)":"none",n},Dt=r.memo(r.forwardRef((l,s)=>{const{children:n,sx:t,parentFloat:a,...c}=l,m=k.useImperativeElement(s,()=>({}),[]),[h,i]=pt(),d=r.useRef(null),f=r.useRef(null),[p,x]=r.useReducer(T=>T+1,0),[u,g]=r.useState(null),[S,y]=r.useState(null),[C,b]=r.useState(null),{reference:w}=o.useFloatStack({parentFloat:a,label:"overflow"});r.useLayoutEffect(()=>{f.current={refs:[]};const T=[],B=r.Children.toArray(n);let I=0;B.forEach((D,F)=>{T.push(e.jsx(E.Box,{sx:{display:"flex"},ref:O=>{I++,I===B.length&&x();const P={current:null};P.current=O,f.current.refs[F]=P},children:D},F))}),g(T)},[n,i]),r.useLayoutEffect(()=>{if(!u)return;const T=f.current.refs,B=T?T.length:0;if(!m.current||B===0)return y(null),void b(null);const I=m.current?.getBoundingClientRect(),D=[],F=[];let O=0,P=!1;for(let M=0;!P&&M<B;M++){const H=T[M];if(!H)continue;if(!H.current){P=!0;continue}const A=H.current.getBoundingClientRect();O+=A?.width,O>I.width&&(P=!0)}if(!P)return y(null),void b([]);const v=d.current?.getBoundingClientRect();O=0;for(let M=0;M<B;M++){const H=T[M];let A=!1;if(H.current){const V=H.current.getBoundingClientRect();O+=V?.width,O<I.width-v.width&&(A=!0)}A?D.push(u[M]):F.push(u[M])}y(D.length>0?D:null),b(F.length>0?F:null)},[n,u,i,w,p]);const j=k.useCallbackRef(T=>{const B=[],I=C.length;for(let F=0;F<I;F++){const O=r.Children.toArray(C[F])[0];r.Children.toArray(O.props.children?.props?.children??O.props.children).forEach((P,v)=>{const M=P,H={...M.props,key:`overflow-${F}-${v}${M.key??""}`};H.parentFloat&&T&&(H.parentFloat=T.floatReference);const A=r.cloneElement(M,H);B.push(A)})}const D=e.jsx(E.Box,{className:"overflow-palette-popup-panel",sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:F=>F.spacing(.25),paddingTop:F=>F.spacing(.5),paddingBottom:F=>F.spacing(.5),paddingLeft:F=>F.spacing(1),paddingRight:F=>F.spacing(1),overflow:"hidden"},children:B});return o.defaultCreatePopupPanel({...T,children:D})},[C]);return e.jsxs(E.Box,{className:"overflow-palette",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",width:"100%",maxWidth:"100%",...t},ref:Nt([m,h,s]),...c,children:[e.jsx(E.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%"},children:S??u}),e.jsx(E.Box,{sx:{display:C!==null&&C.length===0?"none":"flex",flex:"1 1 0"},children:e.jsx(o.ExhibitPopupIconButton,{createPopupPanel:j,ref:d,parentFloat:w,createTooltip:({children:T},B)=>e.jsx(o.ExhibitTooltip,{label:"More",description:"More toolbar options…",disabled:B,children:T}),icon:e.jsx(o.ThemedIcon,{children:e.jsx(me.MoreHoriz,{})})})})]})})),ja="https://unpkg.com/@sheetxl/scripting-templates/dist",li=l=>{if(l.metadata?.name)return l.metadata.name;let s=(l.path.split("/").pop()||"").replace(/\.[^/.]+$/,"");return l.metadata?.icon==="formula"?s.toUpperCase():(s=s.replace(/([a-z])([A-Z])/g,"$1 $2"),s.replace(/[-_]/g," ").trim().split(/\s+/).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "))},Ta=async l=>{const s=it.IOUtils.relativePath(l,"./manifest.json"),n=await fetch(s);if(!n.ok)throw new Fe.ChainedError(`Failed to retrieve directory at '${l}': ${n.statusText}`);const t=await n.text();if(t.trim().toLowerCase().startsWith("<!doctype html")||t.trim().toLowerCase().startsWith("<html"))throw new Fe.ChainedError(`Failed to retrieve directory at '${l}'`);let a;try{a=JSON.parse(t)}catch(m){throw new Error(`Failed to parse directory: ${m.message}. Ensure the file is valid JSON.`)}const c=a.map(async m=>{try{const h=it.IOUtils.relativePath(l,m.path),i=await fetch(h);if(!i.ok)throw new Error(`Failed to fetch file at '${m.path}': ${i.statusText}`);const d=await i.text();let f=m.metadata;return f?.title||(f={title:li(m),...f}),{path:m.path,content:d,metadata:f}}catch(h){console.error(h.message)}return null});return(await Promise.all(c)).filter(m=>m!==null)},jo={fontSize:"0.8rem",marginRight:"4px"},ii=r.memo(l=>{const{disabled:s,snippet:n,description:t,handleInsert:a,sx:c,...m}=l;let h;return h=n.metadata?.icon==="formula"?e.jsx(o.ScriptFormulaIcon,{sx:jo}):n.metadata?.icon==="macro"?e.jsx(o.ScriptMacroIcon,{sx:jo}):e.jsx(me.WebhookOutlined,{sx:jo}),e.jsx(o.ExhibitMenuItem,{sx:{maxWidth:"460px",display:"flex","*":{lineHeight:"1.2"},...c},disabled:s,icon:h,onMouseDown:i=>{i.button===0&&i.preventDefault()},onMouseUp:i=>{i.button===0&&a(n)},onKeyDown:i=>{i.keyCode!==k.KeyCodes.Enter&&i.keyCode!==k.KeyCodes.Space||a(n)},...m,children:e.jsxs(E.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsx(E.Typography,{component:"div",children:n.metadata?.title??n.path}),e.jsx(E.Typography,{variant:"caption",component:"div",sx:{color:i=>Re.alpha(i.palette.text.secondary??i.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:n.metadata?.summary})]})})}),Ea=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,scriptPath:m=ja,...h}=l,[i,d]=r.useState([]),[f,p]=r.useState(!0),x=k.useCommands(n,["executeSelectedScript"]),u=x[0]?.context?.();r.useEffect(()=>{(async()=>{try{const S=await Ta(m);d(S)}catch{}finally{p(!1)}})()},[m]);const g=r.useCallback((S,y)=>{if(f)return e.jsx("div",{children:"Loading..."});const C={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:c},b=T=>{u.getEditor()?.insertSnippet(T.content),S.closeFloat()},w=[];for(let T=0;T<i.length;T++){const B=i[T];B&&w.push(e.jsx(ii,{handleInsert:b,snippet:B},B.path))}const j=e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[w.length>0?e.jsxs(e.Fragment,{children:[e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:w}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"})]}):null,r.createElement(o.CommandButton,{...C,key:"help",command:n.getCommand("help"),icon:o.themeIcon(e.jsx(o.DocumentationIcon,{}))})]});return o.defaultCreatePopupPanel({...S,children:j})},[c,t,a,f,u]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,disabled:c,commandHook:t,scope:a,label:"Insert Script",tooltip:"Inserts a script from a set of templates.",createPopupPanel:g,icon:o.themeIcon(e.jsx(o.ScriptNewIcon,{})),...h})})),an=r.memo(r.forwardRef((l,s)=>{const{commands:n,parentFloat:t,commandButtonProps:a,...c}=l,m=k.useCallbackRef(h=>{const{commandButtonProps:i,commandPopupProps:d}=h;return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flex:"1 1 100%"},children:[e.jsx("div",{children:e.jsx(Dt,{parentFloat:t,style:{},children:e.jsx(o.CommandButton,{...i,command:n.getCommand("saveScripts"),icon:o.themeIcon(e.jsx(o.ScriptSaveIcon,{}))})})}),e.jsx("div",{style:{flex:"1 1 100%"}}),e.jsx("div",{children:e.jsx(Dt,{parentFloat:t,style:{},children:e.jsx(Ea,{...i,commands:n})})})]})})},[n]);return e.jsx(o.CommandToolbar,{ref:s,commands:n,parentFloat:t,commandButtonProps:a,createToolbarPalette:m,...c})}));an.displayName="ScriptEditorToolbar";const To={fontSize:"1rem"},Ba=r.memo(r.forwardRef((l,s)=>{const{scriptPath:n=ja,onScriptSelect:t,sx:a=k.ReactUtils.EmptyCssProperties,className:c,buttonMinWidth:m=210,buttonMinHeight:h=80,gap:i=12,...d}=l,[f,p]=r.useState([]),[x,u]=r.useState(!0),[g,S]=r.useState(null);if(r.useEffect(()=>{(async()=>{const b=[{path:null,metadata:{title:"Blank Template...",summary:"Start with an empty script."},content:""}];try{u(!0),S(null);const w=await Ta(n);for(let j=0;j<w.length;j++){const T=w[j];T&&b.push(T)}}catch(w){S(w instanceof Error?w.message:"Failed to load scripts"),w instanceof Fe.ChainedError||console.error("Error loading scripts:",w)}finally{p(b),u(!1)}})()},[n]),x)return e.jsx(E.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:ge(c,"script-select"),sx:{background:b=>b.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,...a},...d,children:e.jsx(E.CircularProgress,{})});let y=null;g&&(y=e.jsxs(E.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:ge(c,"script-select","error-results"),sx:{background:b=>b.palette.error.light,flex:"0",zIndex:1e3,flexDirection:"column",padding:b=>b.spacing(1),border:b=>`1px solid ${b.palette.error.main}`,borderBottomLeftRadius:1,borderBottomRightRadius:1,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},...d,children:[e.jsx(E.Typography,{color:"error",variant:"h6",component:"div",gutterBottom:!0,children:"Error loading Templates"}),e.jsx(E.Typography,{color:"error",component:"div",children:g})]}));const C=b=>{const w=b.metadata?.icon;return w==="macro"?e.jsx(o.ScriptMacroIcon,{sx:To}):w==="formula"?e.jsx(o.ScriptFormulaIcon,{sx:To}):w==="autostart"?e.jsx(me.WebhookOutlined,{sx:To}):null};return e.jsxs(E.Box,{ref:s,className:ge(c,"script-select"),sx:{background:b=>b.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,...a},...d,children:[e.jsxs(E.Box,{p:3,className:"script-select-content",sx:{overflow:"auto",flex:"1 1 auto"},children:[e.jsx(E.Typography,{variant:"h6",gutterBottom:!0,children:"Script Template"}),e.jsx(E.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Choose from a template to provide a starting point to automate tasks or create user defined functions."}),e.jsx(E.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Templates provide a foundation to customize and meet your specific needs."}),e.jsx(E.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${m}px, 1fr))`,gap:`${i}px`,padding:2,paddingLeft:"0px",paddingRight:"0px"},children:f.map((b,w)=>e.jsxs(E.Button,{variant:"outlined",sx:{minWidth:m,minHeight:h,display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",textAlign:"left",padding:2,textTransform:"none",overflow:"hidden",...w===0&&{borderStyle:"dashed",marginBottom:"8px"},...w===1&&{gridColumn:"1"}},onClick:()=>t?.(b),children:[e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:.5},children:[e.jsx(E.Typography,{variant:"subtitle2",component:"div",children:b.metadata?.title||b.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),C(b)]}),b.metadata?.summary&&e.jsx(E.Typography,{variant:"body2",component:"div",color:"text.secondary",sx:{overflow:"hidden",display:"flex",flexDirection:"column",textOverflow:"ellipsis",alignItems:"flex-start"},children:b.metadata.summary})]},`${b.path}-${w}`))})]}),y]})}));Ba.displayName="TemplateSelectPanel";const ln=r.memo(r.forwardRef((l,s)=>{const{className:n,sx:t,editorProps:a,commands:c,readOnly:m=!1,onClose:h,autoFocusSel:i,autoFocus:d=!0,scripts:f,...p}=l,x=G.useTheme(),[u,g]=r.useState(!1),S=r.useRef(!1),[y,C]=r.useState({message:"Loading",cursor:"",dirty:!1}),[b,w]=r.useState(null);r.useEffect(()=>{let R=!1;return w(null),(async function(){if(f&&(await f.start(),!R)){const _=f.getModules().getItems()[0]?.getSource();w({source:_||null})}})(),()=>{R=!0}},[f]);const j=r.useCallback(R=>{C(_=>({..._,...R}))},[]),T=r.useRef(null),B=r.useRef(null),[I,D]=r.useState(null),F=r.useRef(null),O=k.useCallbackRef(R=>{if(I)return I.focus(R),!0;if(i){const _=B.current?.querySelectorAll?.(i);if(_&&_.length>0)return _[0]?.focus?.(R),!0}return B.current?.focus?.(R),!1},[I,i,d]),P=r.useMemo(()=>e.jsx(o.LoadingPanel,{transitionDelay:"160ms",style:{position:"absolute",width:"100%",height:"100%"},transparentBackground:!1}),[]),v=r.useMemo(()=>e.jsx(E.Paper,{elevation:1,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,marginLeft:R=>R.spacing(.5),marginRight:R=>R.spacing(.5),marginTop:R=>R.spacing(1),marginBottom:R=>R.spacing(1)},children:e.jsx(an,{commands:c})}),[x,c]),M=r.useMemo(()=>e.jsx(E.Box,{className:ge("script-status-panel","status-panel"),sx:{display:"flex",alignItems:"stretch",flexDirection:"row",flex:"0",paddingLeft:"12px",paddingRight:"12px",gap:"8px",paddingTop:"1px",minHeight:"calc(1em + 8px)",margin:0,borderTop:`solid 1px ${x.palette.divider}`},children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"center",flexDirection:"row",justifyContent:"center"},children:[e.jsx(E.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"1 1 100%",color:R=>R.palette.text.secondary},variant:"caption",children:y.message}),e.jsx(E.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",color:R=>R.palette.text.secondary},variant:"caption",children:y.dirty?"Unsaved":""}),e.jsx(E.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",marginLeft:"8px",minWidth:"90px",display:"flex",justifyContent:"end",color:R=>R.palette.text.secondary},variant:"caption",children:y.cursor})]})}),[y]),H=r.useMemo(()=>e.jsxs(E.Box,{className:ge("script-editor-content"),sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"column",boxSizing:"border-box"},children:[v,e.jsx(E.Box,{sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"row",position:"relative",boxSizing:"border-box"},children:e.jsx(ie.ScriptEditor,{ref:B,loadingPanel:P,readOnly:m,onClose:h,autoFocus:d,commands:c,onStatusChange:j,darkMode:x.palette.mode==="dark",...a})}),M]}),[x,c,v,M,u,P,m,a,d,i,h,j]),A=r.useMemo(()=>e.jsx(E.DialogTitle,{className:ge({"Mui-selected":S.current}),sx:{display:"flex",color:R=>R.palette.text.secondary,boxSizing:"border-box",padding:"0 0",transitionProperty:"opacity",transitionDuration:R=>`${R.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:R=>R.transitions.duration.shortest/2+"ms"},backgroundColor:R=>G.alpha(R.palette.action.hover,.03),borderBottom:R=>`solid ${G.alpha(R.palette.divider,.2)} 1px`},onPointerDown:R=>{R.isDefaultPrevented()||(R.preventDefault(),O())},children:e.jsxs(E.Box,{sx:{display:"flex",flex:"1 1 10%",flexDirection:"row",alignItems:"center",marginTop:R=>R.spacing(.25),marginBottom:R=>R.spacing(.25),marginLeft:R=>R.spacing(1),marginRight:R=>R.spacing(1)},children:[e.jsx(E.Box,{sx:{flex:"1 1 100%",paddingLeft:R=>R.spacing(1)},children:"Script (Typescript)"}),e.jsx(o.ExhibitTooltip,{label:"Close",children:e.jsx(E.IconButton,{"aria-label":"close",sx:{color:R=>R.palette.text.icon??R.palette.action.active},touchRippleRef:T,onPointerDown:R=>{T.current?.start(R,{center:!1}),R.stopPropagation(),R.preventDefault()},onPointerUp:()=>{B.current?.close()},children:e.jsx(me.Close,{})})})]})}),[x,u]),V=r.useMemo(()=>{let R;return b===null?null:(b.source===null&&(R=e.jsx(Ba,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:_=>{B.current?.getEditor().insertSnippet(_.content),w({source:_.content??""})}})),e.jsxs(E.Box,{tabIndex:0,className:ge("script-workspace",n),sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",alignItems:"stretch",userSelect:"none",flexGrow:0,outline:"none",backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},onPointerDown:_=>{_.isDefaultPrevented()||B.current?.focus()},children:[A,e.jsxs(E.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[H,R]})]}))},[v,H,n,b]),N=k.useImperativeElement(s,()=>({isScriptWorkspaceElement:()=>!0,focus:R=>{O(R)}}),[]);return e.jsx(E.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",...t},ref:N,...p,onFocus:R=>{g(!0),S.current=!0,N.current?.contains(R.target)&&R.target!==N.current&&D(R.target),R.relatedTarget&&!F.current&&(F.current=R.relatedTarget),p?.onFocus?.(R)},onBlur:R=>{N?.current?.contains(R.relatedTarget)||N?.current===R.relatedTarget||(F.current=null,S.current=!1,g(!1)),p?.onBlur?.(R)},children:V})}));ln.displayName="ScriptWorkspace";const Ia=r.memo(r.forwardRef((l,s)=>{const{commands:n,...t}=l,a=k.useCommands(n,["executeScript","showScriptEditor"]),[c,m]=r.useState([]),[h,i]=r.useState(!1),d=a[0]?.context?.();r.useEffect(()=>{const g=d?.getScripts();g&&(async()=>{i(!0);const S=await g.searchFunctions({type:"macro"});m(S),i(!1)})()},[]);const f={variant:k.CommandButtonType.Menuitem,parentFloat:l.floatReference,scope:"scripts",shortcut:null},p=[],x=c.length;for(let g=0;g<x;g++){const S=c[g];p.push(e.jsx(o.CommandButton,{...f,command:n.getCommand("executeScript"),commandState:{declaration:S},tooltipProps:{description:`Execute ${S.getName()??"macro"}`},icon:o.themeIcon(e.jsx(o.ScriptMacroIcon,{})),label:S.getName()??`Script '${S.getName()}'`},`macro-${S.getName()}-${g}`))}const u=e.jsxs(E.Box,{ref:s,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[p.length>0?e.jsxs(e.Fragment,{children:[e.jsx(E.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:p}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"})]}):null,r.createElement(o.CommandButton,{...f,key:"show-editor",command:n.getCommand("showScriptEditor"),icon:o.themeIcon(e.jsx(o.CodeIcon,{}))})]});return o.defaultCreatePopupPanel({...t,children:u})}));Ia.displayName="RunScriptPopupPanel";const sn=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a,disabled:c=!1,...m}=l,h="showScriptEditor",i=k.useCommands(n,["executeScript","showScriptEditor"])[0].context(),d=r.useCallback((f,p)=>{const x=e.jsx(Ia,{...f,commands:p});return o.defaultCreatePopupPanel({...f,children:x})},[c,i,t,a]);return e.jsx(o.CommandPopupButton,{ref:s,commands:n,commandHook:t,createPopupPanel:d,selected:n.getCommand(h).state(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:h,icon:o.themeIcon(e.jsx(o.ScriptRunIcon,{})),...m})})),Ra=r.memo(r.forwardRef((l,s)=>{const{commands:n,parentFloat:t,commandButtonProps:a,...c}=l,[m,h]=r.useState(!1),i=k.useCommands(n,["executeScript","showScriptEditor"]),d=i[0]?.context?.();r.useEffect(()=>{const p=d?.getScripts();if(!p)return;const x=i[1],u=async()=>{if(!x)return;let y=!1;if(!x.state()){const C=await p.searchFunctions({type:"macro"}),b=C?.length??0;for(let w=0;C&&!y&&w<b;w++)y=!0}h(y||!!x.state())};u();const g=x.addPropertyListener(()=>{u()}),S=p.addListeners({onChange:()=>{u()}});return()=>{S(),g()}},[d]);const f=r.useCallback(p=>{const{commandButtonProps:x,commandPopupProps:u}=p,g=e.jsx(ut,{...u,command:n.getCommand("formatFontColor"),icon:e.jsx(o.ColorizedTextIcon,{}),isSplit:!0,panelProps:{disableAlpha:!0}}),S=e.jsx(ut,{...u,command:n.getCommand("formatFillColor"),icon:e.jsx(o.ColorizedFillIcon,{}),isSplit:!0,panelProps:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:dt.End}}),y=n.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx(Ko,{...u,quickCommand:"undo"})}):null,C=n.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Hr,{...u})}):null;let b=null;return m&&(b=e.jsxs(e.Fragment,{children:[e.jsx(o.ExhibitDivider,{}),e.jsx(sn,{...u})]})),e.jsxs(Dt,{parentFloat:t,children:[y,null,y?e.jsx(o.ExhibitDivider,{}):null,e.jsx(qo,{...u,command:n.getCommand("paste")}),e.jsx(o.CommandButton,{...x,command:n.getCommand("formatPainterToggle"),icon:o.themeIcon(e.jsx(o.FormatPaintIcon,{}))}),e.jsx(io,{...x,command:n.getCommand("copy")}),e.jsx(o.ExhibitDivider,{}),e.jsx(_r,{...u,command:n.getCommand("formatFontFamily")}),e.jsx(zr,{...u,command:n.getCommand("formatFontSize")}),e.jsx(o.CommandButton,{...x,command:n.getCommand("formatBoldToggle"),icon:e.jsx(o.TextBoldIcon,{})}),e.jsx(o.CommandButton,{...x,command:n.getCommand("formatItalicToggle"),icon:e.jsx(o.TextItalicIcon,{})}),e.jsx(qr,{...u}),e.jsx(Kr,{...u}),g,e.jsx(o.ExhibitDivider,{}),S,e.jsx(Ar,{...u}),e.jsx(Or,{...u}),e.jsx(o.ExhibitDivider,{}),e.jsx(Er,{...u}),e.jsx(Br,{...u}),e.jsx(Ir,{...u}),e.jsx(Rr,{...u}),e.jsx(o.ExhibitDivider,{}),e.jsx(Wr,{...u}),e.jsx(Zr,{command:n.getCommand("formatCellStyle"),...u}),e.jsx(ta,{command:n.getCommand("formatTableStyle"),...u}),e.jsx(o.ExhibitDivider,{}),e.jsx($o,{...u}),e.jsx(Uo,{...u}),e.jsx(o.ExhibitDivider,{}),e.jsx(Vr,{...u}),null,e.jsx(Vo,{...u}),e.jsx(_o,{...u}),C,b]})},[n,i,m]);return e.jsx(o.CommandToolbar,{ref:s,commands:n,parentFloat:t,commandButtonProps:a,createToolbarPalette:f,...c})}));Ra.displayName="HomeToolbar";const Ma=r.memo(r.forwardRef((l,s)=>{const{commands:n,parentFloat:t,commandButtonProps:a,...c}=l,m=k.useCallbackRef(h=>{const{commandButtonProps:i,commandPopupProps:d}=h;return e.jsxs(Dt,{parentFloat:t,children:[null,e.jsx(o.CommandButton,{...i,command:n.getCommand("updateHyperlink"),icon:o.themeIcon(e.jsx(o.InsertHyperlinkIcon,{}))}),e.jsx(o.CommandButton,{...i,command:n.getCommand("updateComments"),icon:o.themeIcon(e.jsx(o.InsertCommentIcon,{}))}),e.jsx(Go,{...d}),e.jsx(o.CommandButton,{...i,command:n.getCommand("insertTable"),icon:o.themeIcon(e.jsx(o.InsertTableIcon,{}))})]})},[n]);return e.jsx(o.CommandToolbar,{ref:s,commands:n,parentFloat:t,commandButtonProps:a,createToolbarPalette:m,...c})}));Ma.displayName="InsertToolbar";const Pa=r.memo(r.forwardRef((l,s)=>{const{commands:n,parentFloat:t,commandButtonProps:a,...c}=l,m=k.useCallbackRef(h=>{const{commandButtonProps:i,commandPopupProps:d}=h;return e.jsxs(Dt,{parentFloat:t,children:[e.jsx(Lr,{...d}),e.jsx(o.CommandButton,{...i,command:n.getCommand("protectionSheetToggle"),icon:e.jsx(me.Lock,{color:"secondary"})}),e.jsx(o.ExhibitDivider,{}),e.jsx($r,{...d}),e.jsx(Gr,{...d}),e.jsx(o.ExhibitDivider,{}),e.jsx(o.CommandButton,{...i,command:n.getCommand("sheetViewToggleFormulaView"),scope:"view",icon:o.themeIcon(e.jsx(o.FormulaViewIcon,{}))}),e.jsx(o.CommandButton,{...i,command:n.getCommand("sheetViewToggleShowZeros"),scope:"view",icon:o.themeIcon(e.jsx(o.ViewZeroIcon,{}))}),e.jsx(o.ExhibitDivider,{}),e.jsx(Xr,{...d}),e.jsx(aa,{command:n.getCommand("selectTheme"),...d}),e.jsx(o.ExhibitDivider,{}),e.jsx(sn,{...d,scope:"view"}),e.jsx(o.ExhibitDivider,{}),e.jsx(o.CommandButton,{...i,command:n.getCommand("fullScreenToggle"),scope:"view",icon:()=>o.themeIcon(n.getCommand("fullScreenToggle").state()?e.jsx(o.FullScreenOffIcon,{}):e.jsx(o.FullScreenIcon,{}))})]})},[n]);return e.jsx(o.CommandToolbar,{ref:s,commands:n,parentFloat:t,commandButtonProps:a,createToolbarPalette:m,...c})}));Pa.displayName="ViewToolbar";const Da=l=>e.jsx(Fa,{...l}),si=r.memo(l=>{const{sx:s,...n}=l;return e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",position:"relative","&:hover:not([disabled]) .indicator":{borderBottom:t=>`${G.alpha(t.palette.primary.main,.35)} solid 2px`}},children:[e.jsx(E.Tab,{disableRipple:!0,onMouseDown:t=>{t.button===0&&t.preventDefault()},sx:{textTransform:"none",flex:"1 1 100%",fontWeight:t=>t.typography.fontWeightRegular,padding:"2px 6px",minHeight:"0px",minWidth:"0px",marginRight:t=>t.spacing(.5),"&.Mui-selected":{},"&.Mui-focusVisible":{},...s},...n}),e.jsx(E.Box,{className:"indicator",sx:{width:"90%",borderRadius:"4px",minWidth:"4px",position:"absolute",bottom:"0",alignSelf:"center",display:"flex"}})]})}),ci=r.memo(l=>{const{toolbars:s,value:n,onToolbarChange:t,sx:a,...c}=l,m=r.useMemo(()=>{const h=[];for(let i=0;i<s.length;i++)h.push(e.jsx(si,{label:s[i].label},s[i].label));return h},[s]);return e.jsx(E.Tabs,{value:n,onChange:(h,i)=>{t?.(i)},variant:"scrollable",scrollButtons:!1,sx:{paddingLeft:h=>h.spacing(1.5),paddingRight:h=>h.spacing(1.5),paddingTop:h=>h.spacing(0),paddingBottom:h=>h.spacing(0),minHeight:"26px",alignItems:"center","& .MuiTabs-indicator":{display:"flex",justifyContent:"center",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{width:"90%",borderRadius:"4px",minWidth:"4px",backgroundColor:h=>h.palette.primary.main},"& .MuiTab-root":{marginRight:"0px"},...a},TabIndicatorProps:{children:e.jsx("span",{className:"MuiTabs-indicatorSpan"})},...c,children:m})}),di=r.memo(l=>{const{toolbars:s,value:n,onToolbarChange:t,selectProps:a,...c}=l,m=r.useCallback(i=>{t?.(i.target.value)},[t]),h=r.useMemo(()=>{const i=[];for(let d=0;d<s.length;d++){const f=s[d].label;i.push(e.jsx(E.MenuItem,{value:d,sx:{color:p=>{if(n===d)return p.palette.primary.main}},children:f},f))}return i},[s,n]);return e.jsx(E.FormControl,{sx:{minWidth:"125px",maxWidth:"125px","& .MuiInputBase-root":{paddingLeft:"0px",paddingRight:"0px"},"& .MuiSelect-select":{paddingTop:i=>i.spacing(.5),paddingBottom:i=>i.spacing(.5),paddingLeft:i=>i.spacing(2),color:i=>i.palette.primary.main},"& .MuiSelect-icon":{fill:i=>i.palette.text.icon??i.palette.action.active,"&:hover:not(.Mui-disabled)":{color:i=>i.palette.text.icon??i.palette.action.active}},...a},size:"small",children:e.jsx(E.Select,{value:n,onChange:m,variant:"outlined",sx:{backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},...c,children:h})})}),Fa=r.memo(r.forwardRef((l,s)=>{const{commands:n,selectWrapper:t,selectProps:a={},renderCompact:c=!1,paletteWrapper:m,toolbarsProps:h,paletteProps:i={},workbook:d,sx:f,...p}=l,x=r.useMemo(()=>{const T=[],{ref:B,...I}=h?.Home||{};T.push({label:"Home",component:e.jsx(Ra,{commands:n,...I})});const{ref:D,...F}=h?.Insert||{};T.push({label:"Insert",component:e.jsx(Ma,{commands:n,...F})});const{ref:O,...P}=h?.View||{};return T.push({label:"View",component:e.jsx(Pa,{commands:n,...P})}),T},[n,d]),u=r.useMemo(()=>{const T=[];for(let B=0;B<x.length;B++)T.push(r.cloneElement(x[B].component,{...x[B].component.props,key:x[B].key??x[B].label}));return T},[x]),[g,S]=r.useState(0),y=T=>{S(T)},C=r.useMemo(()=>c?e.jsx(di,{toolbars:x,value:g,onToolbarChange:y,sx:a}):e.jsx(ci,{toolbars:x,value:g,onToolbarChange:y,sx:a}),[x,g,a,c]),{sx:b,...w}=i,j=e.jsx(E.Paper,{elevation:2,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,borderRadius:"8px",backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,marginLeft:T=>T.spacing(1),marginRight:T=>T.spacing(1),marginTop:T=>T.spacing(.5),marginBottom:T=>T.spacing(.5),...b},...w,children:u[g]});return e.jsxs(E.Box,{ref:s,className:"toolbarWrappers",sx:{display:"flex",flexDirection:"column",paddingTop:T=>T.spacing(.5),"*":{userSelect:"none"},...f},...p,children:[t?t(C):C,m?m(j):j]})}));var lr,ir;Fa.displayName="WorkbookToolbars",(function(){if(ir)return lr;ir=1;var l=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,t=/^0o[0-7]+$/i,a=parseInt,c=typeof st=="object"&&st&&st.Object===Object&&st,m=typeof self=="object"&&self&&self.Object===Object&&self,h=c||m||Function("return this")(),i=Object.prototype.toString,d=Math.max,f=Math.min,p=function(){return h.Date.now()};function x(g){var S=typeof g;return!!g&&(S=="object"||S=="function")}function u(g){if(typeof g=="number")return g;if((function(C){return typeof C=="symbol"||(function(b){return!!b&&typeof b=="object"})(C)&&i.call(C)=="[object Symbol]"})(g))return NaN;if(x(g)){var S=typeof g.valueOf=="function"?g.valueOf():g;g=x(S)?S+"":S}if(typeof g!="string")return g===0?g:+g;g=g.replace(l,"");var y=n.test(g);return y||t.test(g)?a(g.slice(2),y?2:8):s.test(g)?NaN:+g}lr=function(g,S,y){var C,b,w,j,T,B,I=0,D=!1,F=!1,O=!0;if(typeof g!="function")throw new TypeError("Expected a function");function P(V){var N=C,R=b;return C=b=void 0,I=V,j=g.apply(R,N)}function v(V){var N=V-B;return B===void 0||N>=S||N<0||F&&V-I>=w}function M(){var V=p();if(v(V))return H(V);T=setTimeout(M,(function(N){var R=S-(N-B);return F?f(R,w-(N-I)):R})(V))}function H(V){return T=void 0,O&&C?P(V):(C=b=void 0,j)}function A(){var V=p(),N=v(V);if(C=arguments,b=this,B=V,N){if(T===void 0)return(function(R){return I=R,T=setTimeout(M,S),D?P(R):j})(B);if(F)return T=setTimeout(M,S),P(B)}return T===void 0&&(T=setTimeout(M,S)),j}return S=u(S)||0,x(y)&&(D=!!y.leading,w=(F="maxWait"in y)?d(u(y.maxWait)||0,S):w,O="trailing"in y?!!y.trailing:O),A.cancel=function(){T!==void 0&&clearTimeout(T),I=0,C=B=b=T=void 0},A.flush=function(){return T===void 0?j:H(p())},A}})();var sr,cr,dr={exports:{}},Eo={};cr||(cr=1,dr.exports=(function(){if(sr)return Eo;sr=1;var l=r,s=typeof Object.is=="function"?Object.is:function(i,d){return i===d&&(i!==0||1/i==1/d)||i!=i&&d!=d},n=l.useState,t=l.useEffect,a=l.useLayoutEffect,c=l.useDebugValue;function m(i){var d=i.getSnapshot;i=i.value;try{var f=d();return!s(i,f)}catch{return!0}}var h=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(i,d){return d()}:function(i,d){var f=d(),p=n({inst:{value:f,getSnapshot:d}}),x=p[0].inst,u=p[1];return a(function(){x.value=f,x.getSnapshot=d,m(x)&&u({inst:x})},[i,f,d]),t(function(){return m(x)&&u({inst:x}),i(function(){m(x)&&u({inst:x})})},[i]),c(f),f};return Eo.useSyncExternalStore=l.useSyncExternalStore!==void 0?l.useSyncExternalStore:h,Eo})()),dr.exports;var mr,ur,Tt={exports:{}},lt={exports:{}},mi=lt.exports;(function(){if(ur)return Tt.exports;ur=1;for(var l=(mr||(mr=1,function(){var p,x,u,g,S,y;typeof performance<"u"&&performance!==null&&performance.now?lt.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(lt.exports=function(){return(p()-S)/1e6},x=process.hrtime,g=(p=function(){var C;return 1e9*(C=x())[0]+C[1]})(),y=1e9*process.uptime(),S=g-y):Date.now?(lt.exports=function(){return Date.now()-u},u=Date.now()):(lt.exports=function(){return new Date().getTime()-u},u=new Date().getTime())}.call(mi)),lt.exports),s=typeof window>"u"?st:window,n=["moz","webkit"],t="AnimationFrame",a=s["request"+t],c=s["cancel"+t]||s["cancelRequest"+t],m=0;!a&&m<n.length;m++)a=s[n[m]+"Request"+t],c=s[n[m]+"Cancel"+t]||s[n[m]+"CancelRequest"+t];if(!a||!c){var h=0,i=0,d=[],f=1e3/60;a=function(p){if(d.length===0){var x=l(),u=Math.max(0,f-(x-h));h=u+x,setTimeout(function(){var g=d.slice(0);d.length=0;for(var S=0;S<g.length;S++)if(!g[S].cancelled)try{g[S].callback(h)}catch(y){setTimeout(function(){throw y},0)}},Math.round(u))}return d.push({handle:++i,callback:p,cancelled:!1}),i},c=function(p){for(var x=0;x<d.length;x++)d[x].handle===p&&(d[x].cancelled=!0)}}Tt.exports=function(p){return a.call(s,p)},Tt.exports.cancel=function(){c.apply(s,arguments)},Tt.exports.polyfill=function(p){p||(p=s),p.requestAnimationFrame=a,p.cancelAnimationFrame=c},Tt.exports})();var Ae={DOM_UNAVAILABLE_ERROR:"DOM is unavailable server-side. Please use this method client-side only.",FULLSCREEN_UNSUPPORTED_ERROR:"Your browser does not support Fullscreen API.",getEventsNames(){if(typeof document>"u")return null;const l=document;return"exitFullscreen"in l?["fullscreenchange","fullscreenerror"]:"webkitExitFullscreen"in l||"webkitCancelFullScreen"in l?["webkitfullscreenchange","webkitfullscreenerror"]:"mozCancelFullScreen"in l?["mozfullscreenchange","mozfullscreenerror"]:"msExitFullscreen"in l?["MSFullscreenChange","MSFullscreenError"]:null},getEventName(l){const s=this.getEventsNames();return s?l==="change"?s[0]:s[1]:null},get fullscreenEnabled(){if(typeof document>"u")return!1;const l=document;return l.fullscreenEnabled||l.webkitFullscreenEnabled||!!l.webkitCancelFullScreen||l.mozFullScreenEnabled||l.msFullscreenEnabled||!1},get fullscreenElement(){if(typeof document>"u")return null;const l=document;return l.fullscreenElement||l.webkitFullscreenElement||l.webkitCurrentFullScreenElement||l.mozFullScreenElement||l.msFullscreenElement||null},requestFullscreen(l,s){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const n=l??document.documentElement,t=n.requestFullscreen||n.webkitRequestFullscreen||n.webkitRequestFullScreen||n.mozRequestFullScreen||n.msRequestFullscreen;if(!t)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return t.call(n,s)},exitFullscreen(){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const l=document,s=l.exitFullscreen||l.webkitExitFullscreen||l.webkitCancelFullScreen||l.mozCancelFullScreen||l.msExitFullscreen;if(!s)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return s.call(l)},on(l,s){const n=this.getEventName(l);n&&document.addEventListener(n,s)},off(l,s){const n=this.getEventName(l);n&&document.removeEventListener(n,s)}};const Na=l=>{const{workbook:s,workbookElement:n,target:t,commands:a,darkMode:c,onShowSidebar:m,onNewWorkbook:h=Aa}=l,i=k.useNotifier(),[d,f]=r.useState(s?.getSelectedSheet()),[p,x]=r.useState(s?.getSheets().getItems()),u=k.useCallbackRef(m,[m]),g=k.useCallbackRef(h,[h]),S=r.useMemo(()=>[new k.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.SimpleCommand("showFormat",t,{label:"Show Format",description:"Open the format pane.",shortcut:{key:"F",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.Command("newCellStyle",t,{label:"New Cell Style…",scopedLabels:{cellStyle:"New Cell Style"},description:"Create a new named style can can be quickly used later."}),new k.Command("deleteCellStyle",t,{label:"Delete Cell Style",scopedLabels:{cellStyle:"Delete"},description:"Remove a named style that is no longer needed."}),new k.Command("modifyCellStyle",t,{label:"Modify Cell Style",scopedLabels:{cellStyle:"Modify"},description:"Update a style with the currently style."}),new k.SimpleCommand("find",t,{label:"Find",description:"Open the Find window.",shortcut:[{key:"F",modifiers:[k.KeyModifiers.Ctrl]},{key:"F5",modifiers:[k.KeyModifiers.Shift]}]}),new k.SimpleCommand("findReplace",t,{label:"Find & Replace",description:"Open the Find & Replace window.",shortcut:[{key:"H",modifiers:[k.KeyModifiers.Ctrl]},{key:"H",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Alt]}]}),new k.SimpleCommand("goto",t,{label:"Go To",description:"Open the 'Go To' window.",shortcut:[{key:"G",modifiers:[k.KeyModifiers.Ctrl]}]}),new k.SimpleCommand("workbookViewToggleExpandFormulaBar",t,{label:"Toggle Expand Formula bar",description:"Expand or collapse the formula bar.",shortcut:{key:"U",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.SimpleCommand("workbookViewToggleShowFormulaBar",t,{label:"View Formula bar",scopedLabels:{view:"Formula Bar"},description:"Show or hide the formula bar."}),new k.SimpleCommand("workbookViewToggleShowTabs",t,{label:"View Sheet Tabs",description:"Show or hide the sheet tabs.",scopedLabels:{view:"Sheet Tabs"}}),new k.SimpleCommand("workbookViewToggleShowStatusBar",t,{label:"View Status Bar",description:"Show or hide the status bar.",scopedLabels:{view:"Status Bar"}}),new k.SimpleCommand("workbookViewToggleShowHorizontalScrollBar",t,{label:"View Horizontal Scrollbar",description:"Show or hide the horizontal scrollbar.",scopedLabels:{view:"Horizontal Scrollbar"}}),new k.SimpleCommand("workbookViewToggleShowVerticalScrollBar",t,{label:"View Vertical Scrollbar",description:"Show or hide the vertical scrollbar.",scopedLabels:{view:"Vertical Scrollbar"}}),new k.Command("hideSheet",t,{label:"Hide Sheet",scopedLabels:{sheet:"Hide"},description:"Hide the sheet from appearing in the tabs. This keeps the data but de-clutters the tabs."}),new k.Command("deleteSheet",t,{label:"Delete Sheet",scopedLabels:{sheet:"Delete"},description:"Delete the sheet and all the data."}),new k.Command("addSheet",t,{label:"Insert Sheet",scopedLabels:{sheet:"Insert"},description:"Insert sheet before the current sheet.",shortcut:[{key:"F11",modifiers:[k.KeyModifiers.Shift]},{key:"F1",modifiers:[k.KeyModifiers.Alt,k.KeyModifiers.Shift]}]}),new k.Command("duplicateSheet",t,{label:"Duplicate Sheet",description:"Duplicate the current sheet.",scopedLabels:{sheet:"Duplicate"}}),new k.Command("nextSheet",t,{label:"Next Sheet",scopedLabels:{sheet:"Next"},description:"Activate the next sheet.",shortcut:[{key:"PageDown",modifiers:[k.KeyModifiers.Ctrl]}]}),new k.Command("previousSheet",t,{label:"Previous Sheet",scopedLabels:{sheet:"Previous"},description:"Activate the previous sheet.",shortcut:[{key:"PageUp",modifiers:[k.KeyModifiers.Ctrl]}]}),new k.Command("selectNextSheet",t,{label:"Select Next Sheet",scopedLabels:{sheet:"Select Next"},description:"Select the next sheet.",shortcut:[{key:"PageDown",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}]}),new k.Command("selectPreviousSheet",t,{label:"Select Previous Sheet",scopedLabels:{sheet:"Select Previous"},description:"Select the previous sheet.",shortcut:[{key:"PageUp",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}]}),new k.Command("selectTheme",t,{label:"Theme",description:"Select a theme that coveys a style suitable for your data."}),new k.Command("selectNamed",t,{label:v=>v?.getName()??"Select Named Item",scopedLabels:{namedItem:v=>v?.getName()??"Select"},description:"Select the item."}),new k.Command("addNamedReference",t,{label:"Define Named Reference",scopedLabels:{namedItem:"Define Name…"},description:"Add a new named reference. Names can be used as a substitute for cell references."}),new k.Command("editNamedReference",t,{label:"Edit Named Reference…",scopedLabels:{namedItem:"Edit…"},description:"Add a new named reference. Names can be used as a substitute for cell references."}),new k.Command("deleteNamedReference",t,{label:"Delete Named Reference",scopedLabels:{namedItem:"Delete"},description:"Remove the named reference."}),new k.SimpleCommand("activeNameBox",t,{label:"Activate Name Box",description:"Move the focus to the name box.",shortcut:{key:"F3",modifiers:[k.KeyModifiers.Alt]}}),new k.SimpleCommand("createNamedReferenceFromSelection",t,{label:"Create from Selection",description:"Automatically generate names from the selected cells.",shortcut:{key:"F3",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.SimpleCommand("activeNameManager",t,{label:"Activate Name Manager",description:`Create, edit, delete, and find all the names used in the workbook.
13
-
14
- Names can be used as a substitute for cell references.`,shortcut:{key:"F3",modifiers:[k.KeyModifiers.Ctrl]}}),new k.Command("fullScreenToggle",t,{label:"FullScreen",description:"Toggle showing the workbook using the full screen.",shortcut:{key:"F11"}}),new k.Command("showScriptEditor",t,{label:"Scripts",scopedLabels:{scripts:"Script Editor…"},description:"Show the script editor.",shortcut:[{key:"F11",modifiers:[k.KeyModifiers.Alt]}]}),new k.Command("executeScript",t,{label:"Run Script",description:"Run the selected or last executed script.",shortcut:{key:"F8"}}),new k.Command("executeSelectedScript",t,{label:"Run Script",description:"Run the selected script.",shortcut:{key:"F8"}}),new k.Command("saveScripts",t,{label:"Save Script",description:"Save the current scripts."}),new k.Command("maximumWorkbookToggle",t,{label:"Maximize",description:"Toggle showing the workbook maximized.",shortcut:{key:"F10",modifiers:[k.KeyModifiers.Ctrl]}}),new k.Command("spellCheck",t,{label:"Spell Check",description:"Check the workbook for spelling mistakes.",shortcut:{key:"F7"}}),new k.Command("calculateAll",t,{label:"Calculate Now",description:"Recalculate all formulas.",shortcut:{key:"F9"}}),new k.SimpleCommand("closeWorkbook",t,{label:"Close Workbook",description:"Close the workbook.",shortcut:{key:"W",modifiers:[k.KeyModifiers.Ctrl]}}),new k.SimpleCommand("newWorkbook",t,{label:"New Workbook",description:"Create a new workbook in another tab."})],[]),y=r.useMemo(()=>{let v=null;return v=a?a.createChildGroup(t,"workbook",!1):new k.CommandGroup(t,"workbook"),v.addCommands(S,!0),v},[a,S]),C=k.useEditMode(),b=r.useRef(null),w=k.useCallbackRef(()=>{let v,M=null;const H=y.getCommand("executeScript");if(H.update({disabled:!1,context:{getScripts:()=>s.getScripts()}}),!H)return;const A=y.getCommand("showScriptEditor");A.updateCallback(function(R=!0){M?M.close():u?.()});const V=y.getCommand("executeSelectedScript");if(!V)return;const N={saveSource:async R=>{let _=null,X=null;const q=s.getScripts();try{R&&(X=await i?.showBusy?.("Saving Scripts..."),_=await q.createModule({source:R})),q.addModule("scripts",_,{replace:!0}),X?.()}catch(U){X?.(),console.warn("Unable to compile",U),i?.showError?.(U)}return _},addContainerListener:R=>(j.current=R,()=>{j.current=null}),setSelectedFunction:R=>{v=R??b.current??null,Promise.resolve(v).then(_=>{V.update({disabled:_===null})})},quickInsertFunction:R=>{const _=`=${R.toUpperCase()}(`,X={text:_+")",editMode:!0,initialSelection:{start:_.length,end:_.length+0}};C.setMode(q=>q?.key==="edit"?{...q,args:{...q.args}}:{key:"edit",args:{stateAndCoords:null,start:X}})},getSelectedFunction:()=>v,setEditor:R=>{M=R??null,A.update({state:M!==null})},getEditor:()=>M,getRanges:R=>{try{return s.getRanges(R)}catch{}return null},getScripts:()=>s.getScripts()};V.update({context:N})},[y,s,n,i]),j=r.useRef(null);ie.useModelListener(s,{onBeforeSave:async()=>{await j.current?.onBeforeSave()},onProtectionChange:()=>{j.current?.onReadonlyChange()},onLoad:()=>{(async()=>(await s.getCalculation().start(),s.getScripts().start(),j.current?.onScriptChange()))()}}),ie.useModelListener(s,{onSheetsChange:v=>{x(v.getSheets().getItems())},onViewChange(v){f(v?.getSelectedSheet())},onProtectionChange:v=>{const M={disabled:!v.getProtection().isStructureAllowed()};y.getCommand("hideSheet").update(M),y.getCommand("deleteSheet").update(M),y.getCommand("addSheet").update(M),y.getCommand("duplicateSheet").update(M),y.getCommand("selectTheme").update(M),y.getCommand("addNamedReference").update(M),y.getCommand("editNamedReference").update(M),y.getCommand("deleteNamedReference").update(M)},onScriptsChange:v=>{w()}});const{isFullscreenAvailable:T,isFullscreenEnabled:B,toggleFullscreen:I}=(function(v={}){const{target:M,onChange:H,onError:A,requestFullScreenOptions:V}=v,[N,R]=r.useState(!1),[_,X]=r.useState(null),[q,U]=r.useState(!1),Z=r.useCallback(()=>Ae.requestFullscreen(M?.current||null,V),[M,V]),ee=r.useCallback(()=>Ae.exitFullscreen(),[]),K=r.useCallback(()=>Ae.fullscreenElement?ee():Z(),[Z,ee]),z=r.useCallback(re=>{const xe=Ae.fullscreenElement;X(xe),U(!!xe),H?.(re)},[H]),J=r.useCallback(re=>{const xe=Ae.fullscreenElement;X(xe),U(!!xe),A?.(re)},[A]);return r.useEffect(()=>{R(Ae.fullscreenEnabled)},[]),r.useEffect(()=>(Ae.on("change",z),Ae.on("error",J),()=>{Ae.off("change",z),Ae.off("error",J)}),[z,J]),{isFullscreenAvailable:N,fullscreenElement:_,isFullscreenEnabled:q,enableFullscreen:Z,disableFullscreen:ee,toggleFullscreen:K}})({target:{current:n??document.body}}),D=ie.useDocThemes();r.useEffect(()=>{y.getCommand("selectTheme").update({state:()=>s.getTheme(),context:()=>({theme:s.getTheme(),themes:D,darkMode:c})})},[s?.getTheme(),c]);const F=k.useCallbackRef(async function(v,M){let H=null;const A=s.getScripts();if(v?.declaration||v?.functionName){const V=v.declaration?v.declaration.getName():v.functionName;(await A.searchFunctions({name:V})).length>0&&(H=V)}if(H)try{await A.executeMacro(H),b.current=Promise.resolve({source:null,name:H})}catch(V){return void i?.showError?.(V)}},[s,i]);r.useEffect(()=>{y.getCommand("newCellStyle").updateCallback(v=>{i?.showInputOptions?.({initialValue:(()=>{let M=0;for(;;){M++;const H=`Style ${M}`;try{return s.getStyles().validateStyleName(H,!0),H}catch{}}})(),title:y.getCommand("newCellStyle")?.label("cellStyle"),description:"Enter a name for the new cell style.",inputLabel:"Style Name",inputProps:{style:{minWidth:"300px"}},options:["Ok","Cancel"],defaultOption:"Ok",onValidateInputOption:async(M,H)=>{let A=null;try{s.getStyles().validateStyleName(M,!1)}catch(R){A=R.message}let V=s.getStyles().getNamed(M),N=A;return!N&&V&&(N=`Update style '${V.getName()}'.`),{valid:A===null,message:N}}}).then(({input:M,option:H})=>{const A=s.getSelectedSheet().getSelectedRange();if(H!=="Ok")return;const V=s.getStyles().setNamed({name:M,style:A.getCell().getStyle()});A.getStyle().update({named:V.getName()})})}),y.getCommand("deleteCellStyle").updateCallback(v=>{v.delete()}),y.getCommand("modifyCellStyle").updateCallback(({named:v})=>{const M=s.getSelectedSheet().getSelectedRange();s.getStyles().setNamed({name:v.getName(),style:M.getCell().getStyle()})}),y.getCommand("hideSheet").updateCallback(v=>{s.getSheetAt(v).setVisibility(L.ISheet.Visibility.Hidden)}),y.getCommand("deleteSheet").updateCallback(async v=>{s.getSheetAt(v??s.getSelectedSheetIndex())?.delete()}),y.getCommand("addSheet").updateCallback(v=>{s.getSheets().add({index:v,autoSelect:!0})}),y.getCommand("duplicateSheet").updateCallback(async v=>{(await s.getSheetAt(v??s.getSelectedSheetIndex())?.duplicate())?.select()}),y.getCommand("nextSheet").updateCallback(v=>{s.getNextSheet(v??s.getSelectedSheetIndex()).select()}),y.getCommand("previousSheet").updateCallback(v=>{s.getPreviousSheet(v??s.getSelectedSheetIndex()).select()}),y.getCommand("selectNextSheet").updateCallback(v=>{s.getNextSheet(v??s.getSelectedSheetIndex()).select()}),y.getCommand("selectPreviousSheet").updateCallback(v=>{s.getPreviousSheet(v??s.getSelectedSheetIndex()).select()}),y.getCommand("selectTheme").updateCallback(v=>{s.setTheme(v)}),y.getCommand("calculateAll").updateCallback(()=>{s.getSelectedSheet().getEntireRange().calculate(!0)}),y.getCommand("closeWorkbook").updateCallback(async()=>{await i?.showOptions({title:"Confirm",description:"This will close the current workbook tab. Do you want to continue?",options:["Close","Cancel"],defaultOption:"Close"})==="Close"&&window.close()}),y.getCommand("newWorkbook").updateCallback(()=>{g?.()}),y.getCommand("executeScript").updateCallback(F),y.getCommand("executeSelectedScript").updateCallback(F)},[s,i]);const O=k.useCallbackRef(async v=>{let M=0,H=null,A="Find & Replace";v?.replace&&!v?.replaceOptions?.maxCount&&(A="Replace All");const V=await i?.showBusy?.(A);try{const N=v?.scope??"sheet";let R=null;const _=s.getSelectedSheet(),X={from:_.getSelectedCell(),...v.findOptions};if(R=N==="sheet"?s.getSelectedSheet().find(v.findText,X):s.find(v.findText,X),v.replace){const q=s.replace(R,v.replaceText,v.replaceOptions);M=q.count,v.replaceOptions.maxCount&&(H=q.last)}else{let q=R.next();q.done||(M++,H=q.value)}H?.select({autoFocus:!1}),V?.(),!v.replaceOptions.maxCount&&M>1&&i?.showMessage?.(`We replaced ${M} cells.`)}catch(N){V?.(),i?.showError?.(N)}return M},[s,n]),P=k.useCallbackRef(v=>{const M={value:v,context:{selection:()=>{const H=s.getSelectedRanges(),A=[];for(let V=0;V<H.getCount();V++){const N=H.at(V).getFixed(!0).getCoords();A.push(N)}return s.getRanges(A)},getNames:()=>s.getNames()},onUpdate:async H=>{try{await H.select()}catch(A){i?.showMessage?.(A.message,{type:k.NotifierType.Error})}}};return i.showWindow?.("namedDetails",M)},[i,s,n]);return r.useEffect(()=>{const v=(M=!1)=>{const H=s.getSelectedCell(),A={onFindOrReplace:O,onKeyDown:V=>{y.findCommandByEvent(V)!==y.getCommand("find")&&y.findCommandByEvent(V)!==y.getCommand("findReplace")||V.preventDefault()},findOptions:{},findText:H.toTextUnformatted(!0)};A.replace=M,i.showWindow?.("find",A,{disableAutoDestroy:!0})};y.getCommand("find")?.update({disabled:!i?.showWindow}).updateCallback(()=>{v()}),y.getCommand("findReplace")?.update({disabled:!i?.showWindow}).updateCallback(()=>{v(!0)}),y.getCommand("goto")?.update({disabled:!i}).updateCallback(()=>{const M={onInputOption:async H=>{try{await s.getRanges(H).select()}catch(A){i?.showMessage?.(A.message,{type:k.NotifierType.Error})}},onKeyDown:H=>{y.findCommandByEvent(H)===y.getCommand("goto")&&H.preventDefault()},title:y.getCommand("goto")?.label(),inputLabel:"Location",options:["Go To"]};i?.showInputOptions?.(M)}),y.getCommand("selectNamed")?.update({disabled:!i}).updateCallback(async M=>{if(M)try{await M.select()}catch(H){i?.showError?.(H)}}),y.getCommand("addNamedReference")?.updateCallback(async function(M){P(null)}),y.getCommand("editNamedReference")?.updateCallback(async function(M){P(M)}),y.getCommand("deleteNamedReference")?.updateCallback(async function(M){M?.delete?.()}),y.getCommand("activeNameBox")?.updateCallback(async function(){n?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus()})},[n,s,i]),ie.useModelListener(s?.getView(),{onViewChange:v=>{y.getCommand("workbookViewToggleShowFormulaBar").update({state:v.isShowFormulaBar()}).updateCallback(()=>{v.setShowFormulaBar(!v.isShowFormulaBar())}),y.getCommand("workbookViewToggleShowTabs").update({state:v.isShowTabs()}).updateCallback(()=>{v.setShowTabs(!v.isShowTabs())}),y.getCommand("workbookViewToggleShowStatusBar").update({state:v.isShowStatusBar()}).updateCallback(()=>{v.setShowStatusBar(!v.isShowStatusBar())}),y.getCommand("workbookViewToggleShowHorizontalScrollBar").update({state:v.isShowHorizontalScrollbar()}).updateCallback(()=>{v.setShowHorizontalScrollbar(!v.isShowHorizontalScrollbar())}),y.getCommand("workbookViewToggleShowVerticalScrollBar").update({state:v.isShowVerticalScrollbar()}).updateCallback(()=>{v.setShowVerticalScrollbar(!v.isShowVerticalScrollbar())})}}),r.useEffect(()=>{y.getCommand("fullScreenToggle").update({state:B,disabled:!T}).updateCallback(()=>{I()})},[B,T]),r.useEffect(()=>{const v=s.getProtection().isStructureAllowed();y.getCommand("hideSheet").update({disabled:p.length<=1||!v}),y.getCommand("deleteSheet").update({disabled:p.length<=1||!v})},[p,d]),y},Aa=()=>{window.open(window.origin.toString(),"sheetxl-"+L.CommonUtils.uuidV4(),"popup=true")},ui="_sheetxl-theme_4opcr_2",pi="_sheetxl-workbook_g5t6x_5",hi=l=>e.jsx(on,{...l}),fi=l=>e.jsx(nn,{...l}),gi=l=>e.jsx(tn,{...l}),cn=r.memo(r.forwardRef((l,s)=>{const{workbook:n,commands:t,onBeforeUserChange:a,onUserChange:c,disabled:m=!1,readOnly:h=!1,contextMenuProps:i,renderContextMenu:d=hi,sheetsAllProps:f,renderSheetsAll:p=fi,sheetTabProps:x,renderSheetTab:u,background:g="transparent",className:S,sx:y,borderWidth:C,borderColor:b,gridTheme:w,gridStyle:j,...T}=l,[B,I]=r.useState(n?.getSelectedSheetIndex()),[D,F]=r.useState(n?.getSheets().getItems()),[O,P]=r.useState(n?.getProtection());ie.useModelListener(n,{onViewChange(Q){I(Q?.getSelectedSheetIndex())},onSheetsChange:Q=>{F(Q.getSheets().getItems())},onProtectionChange:Q=>{P(Q?.getProtection())}});const v=h||!O.isStructureAllowed(),M=r.useMemo(()=>{const Q=[];for(let $=0;$<D.length;$++)Q.push(D[$].getName());return Q},[D]),H=r.useCallback(Q=>{a?.(Q)!==!1&&(n.getSheetAt(Q).select(),c?.(Q))},[n,a,c]),A=r.useCallback((Q,$)=>{n.getSheetAt(Q).setName($),c?.(Q)},[n,c]),V=r.useCallback((Q,$)=>{n.getSheetAt(Q).setPosition($),c?.($)},[n,c]),N=k.useCallbackRef(()=>{if(a?.(B)===!1)return;const Q=B+1;n.getSheets().add({name:void 0,autoSelect:!0}),c?.(Q)},[n,a,c,B]),R=r.useMemo(()=>({placement:"top-start"}),[]),_=r.useRef(null),[X,q]=r.useState(!1),U=r.useCallback(Q=>{const{closeFloatAll:$,floatReference:te}=Q;return p({workbook:n,gridStyle:j,floatReference:te,closeFloatAll:$,...f})},[p,f,m,n,j]),{reference:Z,component:ee}=o.useFloatStack({label:"allSheet",popperProps:R,anchor:_.current,onOpen:()=>q(!0),onClose:()=>q(!1),createPopupPanel:U}),K=r.useRef(null),[z,J]=r.useState(null),re=r.useCallback(Q=>{const{floatReference:$}=Q;return d?.({workbook:n,index:z?.index,tabStripRef:K.current,commands:t,disabled:m,floatReference:$,...i})},[d,i,m,n,t,z]),{reference:xe,component:be}=o.useFloatStack({label:"sheetTab",popperProps:R,anchor:{getBoundingClientRect:()=>new DOMRect(z?.left||0,z?.top||0,0,0)},onClose:()=>J(null),createPopupPanel:re});r.useEffect(()=>{z?xe.open(0):xe.close(0)},[z]);const ye=r.useCallback((Q,$)=>{Q.preventDefault(),J({left:Q.clientX-2,top:Q.clientY-4,index:$})},[]),Be=k.useCallbackRef(Q=>{let $;try{$=n?.getSheetAt(Q.index)}catch{}return $?(u??gi)({sheet:$,gridTheme:w,onContextMenu:te=>{H(Q.index),ye(te,Q.index)},...Q,...x}):null},[u,x,n,w]),ce=r.useMemo(()=>v?null:e.jsx(o.SimpleTooltip,{disableInteractive:!0,title:"New sheet",children:e.jsx(E.IconButton,{disabled:m,component:"div",sx:{padding:"0","&:hover:not([disabled])":{color:Q=>Q.palette.primary.main},color:Q=>Q.palette.text.icon??Q.palette.action.active,"& svg":{width:"18px",height:"18px"}},"aria-label":"addTab",size:"small",onMouseDown:Q=>{Q.button===0&&Q.preventDefault()},onClick:()=>N(),children:e.jsx(me.AddCircleOutline,{})})}),[m,v,N]);return e.jsxs(E.Box,{ref:s,className:ge(S),sx:{position:"relative",display:"flex",alignItems:"stretch",flex:"1 1 100%",maxWidth:"100%",...y},...T,children:[e.jsx(ie.TabStrip,{ref:K,selectedTabIndex:B,tabNames:M,onSelectedTabIndexChange:H,onTabNameChange:A,onTabMove:V,background:g,borderColor:b,borderWidth:C,activeColor:null,disabled:m,disableDrag:v,createScrollStartButton:o.createScrollStartButton,createScrollEndButton:o.createScrollEndButton,createScrollEdgeButton:o.createScrollEdgeButton,createTabButton:Be,createTabDivider:Q=>{const{key:$,...te}=Q;return e.jsx(o.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:ue=>G.alpha(ue.palette.divider,.25)},...te},$)},editLabelProps:{readOnly:v,maxLength:31,styleHover:{fontWeight:"700"},onKeyPress:Q=>{n.isValidSheetNameCharacter(Q.key)||Q.preventDefault()},onCancel:()=>{c?.(B)}},children:e.jsx(o.SimpleTooltip,{disableInteractive:!0,title:X?"":"List all sheets",children:e.jsx(o.ExhibitIconButton,{sx:{padding:"0px",ml:.5,mr:0,mt:0,mb:0,"& svg":{transform:"scale(0.8, 1)"},color:Q=>Q.palette.text.icon??Q.palette.action.active},ref:_,dense:!0,outlined:!1,selected:X,color:"primary","aria-label":"menu",onMouseDown:Q=>{Q.button===0&&Q.preventDefault()},onClick:()=>{X?Z.close(0):Z.open(0)},icon:e.jsx(me.Menu,{})})})}),e.jsx("div",{style:{borderTop:`solid ${b} ${C}px`,minWidth:"4px"}}),e.jsx("div",{style:{borderTop:`solid ${b} ${C}px`,flex:"none",display:"flex",alignItems:"center"},children:ce}),e.jsx("div",{style:{borderTop:`solid ${b} ${C}px`,flex:1,minWidth:"24px"}}),be,ee]})}));cn.displayName="WorkbookStrip";const dn=r.memo(r.forwardRef((l,s)=>{const{workbook:n,commands:t,disabled:a,sx:c,floatReference:m,className:h,...i}=l,[d,f]=r.useReducer(v=>v+1,0),[p,x]=r.useState(n.getSelectedSheet()),[u,g]=r.useState(p.getSelectedRanges()),[S,y]=r.useState(p.getSelectedCell());ie.useModelListener(n,{onSheetsChange(){x(n.getSelectedSheet())}}),ie.useModelListener(p.getSelection(),{onChange(){g(p.getSelectedRanges()),y(p.getSelectedCell())}}),k.useCommands(t,[],{onChange:()=>{f()}});const C=r.useMemo(()=>({}),[]),b=r.useMemo(()=>({commandHook:{beforeExecute:(v,M)=>m.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:a,scope:"contextMenu",parentFloat:m}),[a,m]),w=r.useMemo(()=>({...C,...b,variant:k.CommandButtonType.Menuitem}),[C,b]),j=r.useMemo(()=>({commands:t,variant:k.CommandButtonType.Menuitem,parentFloat:m,...b}),[t,b,m]),T=[];let B=u.isEntireRows(),I=u.isEntireColumns();u&&(B&&(T.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal"},"context:"+T.length)),T.push(r.createElement(o.CommandButton,{command:t.getCommand("hideColumns"),...w,icon:o.themeIcon(e.jsx(o.HideColumnIcon,{})),key:"context:"+T.length})),T.push(r.createElement(o.CommandButton,{command:t.getCommand("unhideColumns"),...w,icon:o.themeIcon(e.jsx(o.ShowColumnIcon,{})),key:"context:"+T.length}))),I&&(T.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal"},"context:"+T.length)),T.push(r.createElement(o.CommandButton,{command:t.getCommand("hideRows"),...w,icon:o.themeIcon(e.jsx(o.HideRowIcon,{})),key:"context:"+T.length})),T.push(r.createElement(o.CommandButton,{command:t.getCommand("unhideRows"),...w,icon:o.themeIcon(e.jsx(o.ShowRowIcon,{})),key:"context:"+T.length}))),(B||I)&&T.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal"},"context:"+T.length)),B&&T.push(r.createElement(o.CommandButton,{command:t.getCommand("autoFitColumns"),...w,icon:o.themeIcon(e.jsx(o.ColumnsResizeAutoIcon,{})),key:"context:"+T.length})),I&&T.push(r.createElement(o.CommandButton,{command:t.getCommand("autoFitRows"),...w,icon:o.themeIcon(e.jsx(o.RowsResizeAutoIcon,{})),key:"context:"+T.length})));const D=[],F=t.getCommand("formatTableStyle"),O=F?.context()?.table();if(k.useCommand(F),!B&&!I){if(D.push(e.jsx(o.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+D.length)),S?.getHyperlink())D.push(r.createElement(o.SimpleCommandPopupButton,{...j,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+D.length,quickCommand:"openHyperlink",icon:v=>v.key()==="openHyperlink"?o.themeIcon(e.jsx(o.InsertHyperlinkIcon,{})):null}));else{const v=t.getCommand("updateHyperlink");D.push(r.createElement(o.CommandButton,{command:v,...w,icon:o.themeIcon(e.jsx(o.InsertHyperlinkIcon,{})),key:"contextBefore:"+D.length}))}if(S?.getComments())D.push(r.createElement(o.SimpleCommandPopupButton,{...j,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+D.length,quickCommand:"updateComments",icon:v=>v.key()==="updateComments"?o.themeIcon(e.jsx(o.InsertCommentIcon,{})):null}));else{const v=t.getCommand("updateComments");D.push(r.createElement(o.CommandButton,{command:v,...w,icon:o.themeIcon(e.jsx(o.InsertCommentIcon,{})),key:"contextBefore:"+D.length}))}O?D.push(r.createElement(o.SimpleCommandPopupButton,{...j,variant:k.CommandButtonType.Menuitem,key:"contextBefore:"+D.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:O,quickCommand:"editTable",icon:v=>(v.key(),o.themeIcon(e.jsx(o.InsertTableIcon,{})))})):D.push(r.createElement(o.CommandButton,{command:t.getCommand("insertTable"),...w,icon:o.themeIcon(e.jsx(o.InsertTableIcon,{})),key:"context:"+T.length})),D.push(r.createElement(Go,{...j,key:"contextBefore:"+D.length}))}const P=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{command:t.getCommand("cut"),...w,icon:e.jsx(o.CutIcon,{})}),e.jsx(io,{command:t.getCommand("copy"),...w}),e.jsx(qo,{command:t.getCommand("paste"),...j,includePasteAllInPopup:!1}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(_o,{...j}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx($o,{commands:t,...j,disableSheet:!0}),e.jsx(Uo,{commands:t,...j,disableSheet:!0}),e.jsx(Vo,{...j}),D,T]});return e.jsx(E.Box,{ref:s,className:ge("menu",h),sx:{...c},...i,children:P})}));dn.displayName="WorkbookContextMenu";const Oa=r.memo(r.forwardRef((l,s)=>{const{movable:n,commands:t,disabled:a,sx:c,floatReference:m,...h}=l;ie.useModelListener(n,{onAnyChange(g){}});const i=r.useMemo(()=>({}),[]),d=r.useMemo(()=>({commandHook:{beforeExecute:(g,S)=>m.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:a,parentFloat:m}),[a,m]),f=r.useMemo(()=>({variant:k.CommandButtonType.Menuitem,...i,...d}),[i,d]),p=r.useMemo(()=>({commands:t,variant:k.CommandButtonType.Menuitem,parentFloat:m,...d}),[t,d,m]),x=g=>{switch(g?.key()){case"moveToFront":return o.themeIcon(e.jsx(o.DrawToFrontIcon,{}));case"moveForward":return o.themeIcon(e.jsx(o.DrawMoveForwardIcon,{}));case"moveToBack":return o.themeIcon(e.jsx(o.DrawToBackIcon,{}));case"moveBackward":return o.themeIcon(e.jsx(o.DrawMoveBackwardIcon,{}));case"toggleLockAspectRatio":return o.themeIcon(e.jsx(o.DrawAspectIcon,{}));case"formatDrawAlignLeft":return o.themeIcon(e.jsx(o.DrawAlignLeftIcon,{}));case"formatDrawAlignCenter":return o.themeIcon(e.jsx(o.DrawAlignCenterIcon,{}));case"formatDrawAlignRight":return o.themeIcon(e.jsx(o.DrawAlignRightIcon,{}));case"formatDrawAlignTop":return o.themeIcon(e.jsx(o.DrawAlignTopIcon,{}));case"formatDrawAlignMiddle":return o.themeIcon(e.jsx(o.DrawAlignMiddleIcon,{}));case"formatDrawAlignBottom":return o.themeIcon(e.jsx(o.DrawAlignBottomIcon,{}));case"formatDrawDistributeHorz":return o.themeIcon(e.jsx(o.DrawAlignDistributeHorzIcon,{}));case"formatDrawDistributeVert":return o.themeIcon(e.jsx(o.DrawAlignDistributeVertIcon,{}));case"formatAnchorTypeTwoCell":case"formatAnchorTypeOneCell":case"formatAnchorTypeAbsolute":return o.themeIcon(e.jsx(o.DrawResizeIcon,{}));default:return null}},u=e.jsxs(e.Fragment,{children:[e.jsx(io,{command:t.getCommand("copy"),...f,variant:k.CommandButtonType.Menuitem}),[],e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.SimpleCommandPopupButton,{...p,popupCommandKeys:["moveToFront","moveForward"],quickCommand:"moveToFront",icon:x}),e.jsx(o.SimpleCommandPopupButton,{...p,popupCommandKeys:["moveToBack","moveBackward"],quickCommand:"moveToBack",icon:x}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...f,command:t.getCommand("toggleLockAspectRatio"),icon:o.themeIcon(e.jsx(o.DrawAspectIcon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.SimpleCommandPopupButton,{...p,popupCommandKeys:["formatDrawAlignLeft","formatDrawAlignCenter","formatDrawAlignRight",null,"formatDrawAlignTop","formatDrawAlignMiddle","formatDrawAlignBottom",null,"formatDrawDistributeHorz","formatDrawDistributeVert"],label:"Align",icon:g=>x(g)||o.themeIcon(e.jsx(o.DrawAlignLeftIcon,{})),tooltip:"Quickly change the placement of your drawings."}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.SimpleCommandPopupButton,{...p,popupCommandKeys:["formatAnchorTypeTwoCell","formatAnchorTypeOneCell","formatAnchorTypeAbsolute"],label:"Sizing",icon:g=>x(g)||o.themeIcon(e.jsx(o.DrawResizeIcon,{})),tooltip:"Determine how the drawing size will adjust as the cell sizes adjust."}),[]]});return e.jsx(E.Box,{ref:s,sx:{paddingTop:"4px",paddingBottom:"4px",...c},...h,children:u})}));Oa.displayName="MovableContextMenu";const xi=l=>e.jsx(Oa,{...l}),bi=l=>e.jsx(dn,{...l}),yi=l=>e.jsx(en,{...l}),Ci=(l,s)=>e.jsx(Qo,{ref:s,...l}),Si=l=>e.jsx(o.LoadingPanel,{...l}),wi=(l,s)=>e.jsx(ie.SheetElement,{ref:s,...l}),ki=l=>e.jsx(Yo,{...l}),vi=l=>e.jsx(cn,{...l}),ji={fireOnModelChange:!1},Bo={flex:"1 1 100%",display:"flex"},mn=r.memo(r.forwardRef((l,s)=>{const{workbook:n,createWorkbookOptions:t,onNewWorkbook:a,onElementLoad:c,autoFocus:m=!1,sx:h,style:i,className:d,onFocus:f,onBlur:p,onKeyDown:x,onRepeatCommandChange:u,commands:g,showFormulaBar:S,formulaBarProps:y,renderFormulaBar:C=Ci,showTabs:b,tabsProps:w,renderTabs:j=vi,showStatusBar:T,statusBarProps:B,renderStatusBar:I=ki,toolbarProps:D,renderToolbar:F=Da,contextMenuSx:O,renderContextMenu:P=bi,renderFilterMenu:v=yi,renderMovableMenu:M=xi,renderLoadingPanel:H=Si,loadingPanelProps:A,sheetProps:V,renderSheet:N=wi,showHorizontalScrollbar:R,showVerticalScrollbar:_,gridTheme:X,headersTheme:q,enableDarkImages:U,...Z}=l,ee=k.useNotifier(),K=G.useTheme(),z=ie.useDocThemes(),J=r.useMemo(()=>{const W={theme:z.getDefaultTheme(),...t};return n??new L.Workbook(W)},[n]),re=r.useRef(null),[xe,be]=r.useState(!1),ye=r.useRef(null),Be=r.useMemo(()=>e.jsx(E.Box,{className:"sheetxl-viewport",sx:{width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",pointerEvents:"none !important","& > :first-of-type":{position:"relative"}},ref:ye}),[]),[ce,Q]=r.useState(!1),[$,te]=r.useState(!1),ue=r.useCallback(()=>{Q(!0)},[]),le=r.useRef(null),ae=k.useImperativeElement(s,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>J,getSheetElement:()=>re.current,getViewportElement:()=>ye.current,getFormulaBarElement:()=>le.current,focus(){re&&re.current&&re.current.focus()}}),[J]),Y=r.useRef(null);r.useLayoutEffect(()=>{ce&&ae.current&&(te(!0),Y.current!==c&&(c?.({source:ae.current}),Y.current=c))},[ce,ae.current]),or(ae.current);const oe=r.useCallback(W=>(re.current?.submitEdit(),!0),[]),pe=r.useCallback(()=>{requestAnimationFrame(()=>{re?.current?.focus()})},[]),[se,je]=r.useState(J?.getSelectedSheet()),[Me,ht]=r.useState(J?.getProtection());ie.useModelListener(J,{onSheetsChange:W=>{je(W?.getSelectedSheet())},onViewChange(W){je(W?.getSelectedSheet())},onProtectionChange:W=>{ht(W?.getProtection())}}),ie.useModelListener(J,{onRequestSelect:async(W,ne)=>new Promise(de=>{re.current.getSheet()!==ne?re.current.getGridElement()?.onViewChangeOnce(()=>{re.current.getSheet()!==ne&&de(!1),de(!0)}):de(!0)})},ji);const[mo,gn]=r.useReducer(W=>W+1,0),Qe=J?.getView();ie.useModelListener(Qe,{onViewChange:W=>{gn()}});const ft=X??K,Ee=r.useMemo(()=>Lo(K,ft),[K,ft]),xn=q??K,nl=r.useMemo(()=>Lo(K,xn),[K,xn]),[bn,rl]=r.useState(null);r.useCallback(()=>{re.current.focus()},[]);const[uo,yn]=r.useState(!1),Cn=r.useRef(null),he=Na({workbook:J,workbookElement:ae.current,target:()=>re.current,commands:g,darkMode:Ee.body.darkMode,onNewWorkbook:a,onShowSidebar:()=>{uo?Cn.current?.focus():yn(!0)}}),gt=r.useRef(null),[po,Sn]=r.useState(!1),[wn,kn]=r.useState(null),[vn,al]=r.useState(k.ToolTipPlacement.Top),[xt,ll]=r.useState(L.TypesUtils.EmptyBounds),ho=r.useCallback(()=>{Sn(!1),kn(null)},[]),bt=r.useCallback((W,ne,de=k.ToolTipPlacement.Top)=>{ll(W),al(de),kn(ne),gt.current!==null&&setTimeout(()=>{gt.current!==null&&gt.current.update()},160),Sn(!0)},[]),[ls,jn]=r.useState("sheet"),Ue=b??Qe?.isShowTabs(),_e=R??Qe?.isShowHorizontalScrollbar(),il=S??Qe?.isShowFormulaBar(),Lt=T??Qe?.isShowStatusBar(),Tn=_??Qe?.isShowVerticalScrollbar(),et=Ee?.header?.edgeStrokeFill||"rgb(171,171,171)",sl=r.useMemo(()=>Lt?I({sheet:se,gridStyle:Ee,...B}):null,[I,B,Lt,Ee,se]),cl=r.useMemo(()=>F({commands:he,workbook:ae.current,...D}),[he,F,D,K]),[dl,{width:En}]=pt(),Te=En===0||En>560,fo=r.useMemo(()=>{if(!Ue)return null;let W=j({background:Ee.body.fill,borderWidth:1,borderColor:et,gridTheme:ft,gridStyle:Ee,onBeforeUserChange:oe,onUserChange:pe,workbook:J,commands:he,sheetTabProps:{},...w});return Te||(W=e.jsx("div",{style:{flex:"none",display:"flex"},children:W})),W},[j,w,ee,K,J,ft,Te,he,Ue]),Bn=r.useCallback(W=>{const ne=L.CommonUtils.getOS()===L.CommonUtils.OSType.Firefox;let de=null,ve=null,we=null;if(_e&&(ve=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${et} 1px`,maxWidth:"100%"},children:e.jsx(ie.SheetScrollbar,{style:{alignItems:"center",borderTop:(ne?6:3)+"px solid transparent",borderBottom:(Te?6:3)+"px solid transparent",borderLeft:(ne?3:0)+"px solid transparent",borderRight:(ne?3:0)+"px solid transparent"},...W,endGap:700,sheet:se,showCustomScrollButtons:!ne,onShowTooltip:ke=>{bt({x:ke.anchor.x,y:ke.anchor.y,width:0,height:0},ke.display,ke.placement)},onCloseTooltip:()=>ho()})})),Ue&&Te&&(we=fo),Ue&&Te&&!_e&&(we=e.jsxs(E.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[we,e.jsx(E.Box,{sx:{borderTop:`solid ${et} 1px`,flex:"1"}})]})),we&&_e)de=e.jsx(k.SplitPane,{position:J.getView().getTabRatio()/10+"%",onPositionChange:({percent:ke})=>{J.getView().setTabRatio(Math.round(10*ke))},minBefore:"200px",minAfter:"180px",resizerProps:{style:{minWidth:"11px",backgroundImage:`url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${K.palette.text.icon??K.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`,backgroundRepeat:"no-repeat",backgroundPosition:"center",borderTop:`solid ${et} 1px`,borderBottom:"solid 3px transparent"}},elementBefore:we,elementAfter:ve});else if(_e)de=ve;else{if(!we)return e.jsx(E.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:Lt?null:`solid ${et} 1px`}});de=we}return e.jsx(E.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:de})},[se,oe,J,Ee,ft,he,Ue,_e,Lt,Te]),[Pe,yt]=r.useState(null),ml=r.useMemo(()=>({placement:"right-start",...Pe?.popperProps}),[Pe?.popperProps]),{reference:In,component:ul}=o.useFloatStack({label:"contextMenu",popperProps:ml,anchor:Pe?.anchor??{getBoundingClientRect:()=>new DOMRect(Pe?.clientX||0,Pe?.clientY||0)},onClose:()=>yt(null),createPopupPanel:Pe?.createPopupPanel});r.useEffect(()=>{Pe?In.open(0):In.close(0)},[Pe]);const pl=k.useCallbackRef((W,ne)=>{if(W?.isDefaultPrevented())return!0;W.preventDefault(),Pe&&Pe.anchor===W.currentTarget?yt(null):yt({anchor:W.currentTarget,popperProps:{offsets:[-4,2]},createPopupPanel:de=>{const{floatReference:ve}=de;return v({filter:ne,commands:he,floatReference:ve,sx:{...O}})}})},[v,O,he,J,Pe]),Rn=k.useCallbackRef(W=>{if(W.originalEvent?.isDefaultPrevented())return!0;W.originalEvent?.preventDefault(),yt({clientX:W.clientX,clientY:W.clientY,createPopupPanel:ne=>{const{floatReference:de}=ne;return P({commands:he,workbook:J,floatReference:de,sx:{...O}})}})},[P,O,he,J]),hl=k.useCallbackRef((W,ne)=>{if(W?.isDefaultPrevented())return!0;W.preventDefault(),yt({clientX:W.clientX,clientY:W.clientY,createPopupPanel:de=>{const{floatReference:ve}=de;return M({movable:ne,commands:he,floatReference:ve,sx:{...O}})}})},[M,O,he]);r.useMemo(()=>{const W=[new k.SimpleCommand("openContextMenu",()=>re.current,{label:"Context Menu",description:"Open the context menu.",shortcut:[{key:"F10",modifiers:[k.KeyModifiers.Shift]},{key:"ContextMenu"}]})];he.addCommands(W,!0)},[he]),r.useEffect(()=>{he.getCommand("openContextMenu").updateCallback(()=>{const W=se.getSelection().getCoords().cell;re.current?.getGridElement()?.scrollCellCoordsIntoView(W).then(ne=>{requestAnimationFrame(()=>{const de=se.getView().getZoomScale()/100,ve=se.getColumnHeaders().findOffset(W.colIndex+1)*de,we=se.getRowHeaders().findOffset(W.rowIndex+1)*de,ke=re.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};Rn({clientX:ve-ke.x-ne.left+6,clientY:we-ke.y-ne.top+6})})})})},[se]);const fl=k.useCallbackRef(W=>{he?.dispatchToFocusedCommand(W)},[he]),gl=k.useCallbackRef(()=>{or(ae.current)},[J,ae.current]),xl=r.useCallback(()=>{jn("sheet")},[]),bl=r.useCallback(()=>{jn("formulaBar")},[]),yl=k.useCallbackRef(W=>{const ne=L.CommonUtils.getOS()===L.CommonUtils.OSType.Firefox;return e.jsx(ie.SheetScrollbar,{style:{borderLeft:"3px solid transparent",borderRight:"0px solid transparent",borderTop:(ne?3:0)+"px solid transparent",borderBottom:(ne?3:0)+"px solid transparent",width:ne?"13px":void 0},...W,sheet:se,endGap:700,showCustomScrollButtons:!ne,onShowTooltip:de=>{bt(de.anchor,de.display,k.ToolTipPlacement.Left)},onCloseTooltip:()=>ho()})},[se]);r.useEffect(()=>{m&&re&&re.current&&re.current.focus()},[]);const[Ht,go]=r.useState(null),xo=r.useCallback(W=>{he?.getCommand("openWorkbook")&&(W.type==="dragenter"||W.type==="dragover"?W.dataTransfer?.types.includes("Files")?W.dataTransfer.files[0]?.type?.startsWith("image/")||W.dataTransfer.items[0]?.type?.startsWith("image/")||W.dataTransfer.types.length===1&&go("Drop to open"):(W.dataTransfer?.types.includes("text/html")||W.dataTransfer?.types.includes("text/plain"),W.dataTransfer.effectAllowed="none",W.dataTransfer.dropEffect="none"):W.type==="dragleave"&&go(null),W.preventDefault())},[he]),Cl=k.useCallbackRef(W=>{if(he?.getCommand("openWorkbook")&&(W.preventDefault(),W.stopPropagation(),go(null),W.dataTransfer.files&&W.dataTransfer.files.length>0)){const ne=W.dataTransfer.files[0];if(!ne)return;if(ne?.type?.startsWith("image/")){const de=re.current?.getGridElement().getViewFromClient(W.clientX,W.clientY);if(!de)return;const ve=de.getRelativePointFromClient(W.clientX,W.clientY),we=de.toAbsoluteBounds({...ve,width:0,height:0}),ke=de.getCellCoordsFromClient(W.clientX,W.clientY);if(!ke)return;he?.getCommand("insertImageFromFile")?.execute({file:ne,options:{bounds:{x:we.x,y:we.y}},goto:{range:{...ke}}})}else he?.getCommand("openWorkbook")?.execute(ne)}},[he,Ht]),Sl=r.useMemo(()=>Ht?e.jsx(E.Box,{sx:{position:"absolute",width:"100%",height:"100%",boxSizing:"border-box",pointerEvents:"none",display:"flex",justifyContent:"center",alignItems:"center",background:W=>W.palette.divider,color:W=>W.palette.primary.dark},children:e.jsx(E.Typography,{variant:"h4",children:Ht})}):null,[Ht]),Mn=r.useRef(null),wl=r.useMemo(()=>e.jsx(Oo,{in:!$,nodeRef:Mn,timeout:500,classNames:"animating",unmountOnExit:!0,children:e.jsx(E.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",left:"0px",top:"0px",width:"100%",height:"100%",pointerEvents:$?"none":h?.pointerEvents,position:"absolute",boxSizing:"border-box"},children:H({ref:Mn,transitionDelay:"0",transparentBackground:!1,sx:{opacity:$?0:h?.opacity,pointerEvents:$?"none":h?.pointerEvents,position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%",...A}})})}),[$,H,A]),kl=r.useMemo(()=>C({sx:{marginTop:W=>W.spacing(.25),marginLeft:W=>W.spacing(1),marginRight:W=>W.spacing(1)},workbook:J,sheetElement:re.current,gridStyle:Ee,onFocus:bl,...y,NamedCollectionEditorProps:{restoreFocus:W=>re.current.focus(W),...y?.NamedCollectionEditorProps,commandPopupButtonProps:{commands:he,...y?.NamedCollectionEditorProps?.commandPopupButtonProps}}},le),[C,y,J,Ee,he,$]),vl=r.useCallback(W=>{const{movable:ne,...de}=W,ve={movable:ne,onContextMenuCapture:Ke=>{hl(Ke,ne)},...de},we=ne.getContent().getType();let ke=null;if(we==="picture")return e.jsx(ie.PictureEditor,{loadingPanel:e.jsx(o.LoadingPanel,{transitionDelay:"100",style:{position:"absolute"},sx:{border:Ke=>`solid 1px ${Ke.palette.action.active}`}}),picture:ne.getContent(),description:ne.getDescription()??ne?.getName(),...ve});if(we==="chart"){const Ke={...ve,chart:ne.getContent()};return e.jsx(ie.ChartEditor,{...Ke})}if(ke=`Float of type '${we}'.`,typeof ke=="string"){const Ke={...ve,description:ke};ke=e.jsx(ie.EmptyFrame,{...Ke})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:ke},ne.getUUID())},[]),Pn=r.useMemo(()=>N({style:Bo,onFocus:xl,gridStyle:Ee,headersStyle:nl,sheet:se,commands:he,onSheetContextMenu:Rn,onViewportChange:W=>{rl(W)},showScrollbars:!1,viewportComponent:Be,onRepeatCommandChange:u,onElementLoad:ue,onShowColumnTooltip:W=>{bt(W.anchor,W.display,k.ToolTipPlacement.Top)},onShowRowTooltip:W=>{bt(W.anchor,W.display,k.ToolTipPlacement.Right)},onShowTooltip:W=>{bt({x:W.anchor.x,y:W.anchor.y,width:0,height:0},W.display,W.placement)},onCloseTooltip:()=>ho(),renderMovable:vl,...V,cellRenderProps:{onFilterButtonMouseDown:(W,ne)=>{V?.cellRenderProps?.onFilterButtonMouseDown(W,ne),pl(W,ne)},...V?.cellRenderProps}},re),[N,he,V,se,Ee,ee,u]),bo=r.useMemo(()=>{if(!uo)return null;const W=!Me.isStructureAllowed();return e.jsx(ln,{sx:{marginBottom:ne=>ne.spacing(.5),border:ne=>`solid ${W?ne.palette.action.disabled:G.alpha(ne.palette.divider,.2)} 1px`,borderRadius:ne=>`${ne.shape.borderRadius}px`,overflow:"hidden"},onClose:()=>{yn(!1),requestAnimationFrame(()=>{re.current.focus()})},readOnly:W,commands:he,ref:Cn,scripts:J.getScripts()})},[uo,he,J,ee,Me]),jl=r.useMemo(()=>{const W=e.jsx(k.ScrollPane,{style:{...Bo,marginRight:bo&&Te?"0px":"6px"},viewport:bn,touchElement:re.current?.getGridElement()?.stage,onScrollViewport:ke=>{re.current?.getGridElement()?.scrollTo(ke)},showHorizontalScrollbar:_e||Ue,showVerticalScrollbar:Tn,createHorizontalScrollbar:Bn,createVerticalScrollbar:yl,children:Pn});let ne=W;Te||(ne=e.jsxs(e.Fragment,{children:[W,fo]}));let de=null,ve=4,we=13;return Te?de="m 3.6261898,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.8836498,0 -1.60004965,-0.71626 -1.60004965,-1.59991 0,-0.88365 0.71639985,-1.6000508 1.60004965,-1.6000508 0.88364,0 1.59991,0.7164008 1.59991,1.6000508 m 0,-4.881294 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 -0.8836498,0 -1.60004965,-0.7164 -1.60004965,-1.60004 0,-0.88365 0.71639985,-1.60005 1.60004965,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-4.881226 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 1.14263,3.19996 0.42623015,2.48356 0.42623015,1.59991 0.42623015,0.71626 1.14263,0 2.0262798,0 c 0.88364,0 1.59991,0.71626 1.59991,1.59991":(de="M 1.59991,3.62619 C 0.71626,3.62619 0,2.90992 0,2.02628 0,1.1426301 0.71626,0.42623015 1.59991,0.42623015 c 0.88365,0 1.6000508,0.71639995 1.6000508,1.60004985 0,0.88364 -0.7164008,1.59991 -1.6000508,1.59991 m 4.881294,0 c -0.88364,0 -1.60004,-0.71627 -1.60004,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60004,-1.60004985 0.88365,0 1.60005,0.71639995 1.60005,1.60004985 0,0.88364 -0.7164,1.59991 -1.60005,1.59991 m 4.881226,0 c -0.88365,0 -1.60005,-0.71627 -1.60005,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60005,-1.60004985 0.88365,0 1.59991,0.71639995 1.59991,1.60004985 0,0.88364 -0.71626,1.59991 -1.59991,1.59991",ve=13,we=4),e.jsx(k.SplitPane,{fixedPane:"after",position:"40%",minAfter:Te?"280px":"120px",splitDirection:Te?"row":"column",style:Bo,ref:dl,resizerProps:{className:"styled-resizer",style:{minWidth:Te?"6px":void 0,minHeight:Te?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${ve}' height='${we}' viewBox='0 0 ${ve} ${we}' version='1.1' fill='${K.palette.text.icon??K.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${de}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:Te?"left center":"top center"}},elementBefore:ne,paneBeforeProps:{style:{flexDirection:"column"}},elementAfter:bo,paneAfterProps:{style:{marginLeft:Te?"0px":"4px",marginRight:Te?"8px":"4px"}}})},[_e,Ue,Bn,Tn,bn,bo,Pn,fo,K,Te]),Tl=r.useMemo(()=>e.jsx(o.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:po,title:e.jsx(E.Typography,{variant:"subtitle2",component:"div",children:wn}),placement:vn,TransitionProps:{timeout:{exit:0}},PopperProps:{popperRef:gt,sx:{"& .MuiTooltip-tooltip":{padding:"2px 6px","& .MuiTooltip-arrow":{display:po?"visible":"none"}}},anchorEl:{getBoundingClientRect:()=>new DOMRect(xt.x,xt.y,xt.width,xt.height)},modifiers:[{name:"offset",options:{offset:[0,0]}}]},children:e.jsx(E.Box,{})}),[po,wn,vn,xt,gt]),El=r.useMemo(()=>({boxSizing:"border-box",background:W=>W.palette.mode!=="dark"?Ee.header.fill:W.palette.background.paper,"& *":{...o.scrollbarTheming(K),fontWeight:400},"&.Mui-focusVisible":{},"& .viewport-overlay":{borderRight:`solid ${et} 1px`},...h}),[h,Ee]),Bl=r.useMemo(()=>e.jsx(E.Box,{sx:{marginBottom:W=>W.spacing(.75)}}),[]),Il=r.useMemo(()=>({flex:"1 1 100%",width:"100%",display:"flex",flexDirection:"column",opacity:$?void 0:0,"--sxl-app-color-high-contrast":K.palette.primary.main,"--sxl-app-color-primary":K.palette.primary.main,"--sxl-app-color-primary-dark":K.palette.primary.dark,"--sxl-app-color-primary-light":K.palette.primary.light,"--sxl-app-color-info":K.palette.info.main,"--sxl-app-color-info-dark":K.palette.info.dark,"--sxl-app-color-info-light":K.palette.info.light,"--sxl-app-color-secondary":K.palette.secondary.main,"--sxl-app-color-secondary-dark":K.palette.secondary.dark,"--sxl-app-color-secondary-light":K.palette.secondary.light,"--sxl-app-color-success":K.palette.success.main,"--sxl-app-color-success-dark":K.palette.success.dark,"--sxl-app-color-success-light":K.palette.success.light,"--sxl-app-color-warning":K.palette.warning.main,"--sxl-app-color-warning-dark":K.palette.warning.dark,"--sxl-app-color-warning-light":K.palette.warning.light,"--sxl-app-color-error":K.palette.error.main,"--sxl-app-color-error-dark":K.palette.error.dark,"--sxl-app-color-error-light":K.palette.error.light,"--sxl-app-color-text":K.palette.text.primary,"--sxl-app-color-text-secondary":K.palette.text.secondary,"--sxl-app-color-text-disabled":K.palette.text.disabled,"--sxl-app-color-background":K.palette.background.paper,"--sxl-app-color-button-surface":K.palette.grey[600],"--sxl-app-color-shadow":K.palette.action.focus,"--sxl-app-color-grey":K.palette.grey[500],"--sxl-app-filter-dark-invert":Ee.body.darkMode&&U?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":Ee.body.darkMode?`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`:void 0}),[Ee,K,$]),Rl=r.useMemo(()=>ge(Jr),[]);return e.jsxs(E.Paper,{className:ge("sheetxl-workbook",pi,{"Mui-focusVisible":xe},ui,d),sx:El,style:i,square:!1,...Z,ref:ae,onFocus:W=>{be(!0),gl(),f?.(W)},onBlur:W=>{be(!1),p?.(W)},onKeyDown:W=>{fl(W),x?.(W)},onDragStart:W=>{if(W.target.src){const ne=new Image;ne.src=W.target.src,W.dataTransfer.setDragImage(ne,1,1)}},onDragEnter:xo,onDragLeave:xo,onDragOver:xo,onDrop:Cl,children:[e.jsxs("div",{className:Rl,style:Il,children:[cl,il?kl:null,Bl,jl,sl,Tl,ul,Sl]}),wl]})}));mn.displayName="WorkbookElement";const Ti=(l=!1,s=!1)=>s?null:{"& input:not(:focus):not(:hover)":{color:n=>n.palette.text.secondary},backgroundColor:n=>G.alpha(n.palette.background.paper,.6),borderRadius:n=>`${n.shape.borderRadius}px`,border:n=>`solid ${l?n.palette.divider:"transparent"} 1px`,"&.Mui-disabled":{border:n=>`solid ${l?n.palette.divider:"transparent"} 1px`},"&:focus-within:not([disabled])":{backgroundColor:n=>n.palette.background.paper},"&:hover:not([disabled])":{border:n=>`solid ${l?n.palette.text?.primary:n.palette.divider} 1px`,backgroundColor:null},"&.Mui-focusVisible":{outline:n=>`solid ${n.palette.primary.main} 1px !important`,border:n=>`1px solid ${n.palette?.primary?.main} !important`}},un=r.memo(r.forwardRef((l,s)=>{const{sx:n,workbook:t,title:a="",placeHolder:c="Untitled",onTitleChange:m,readOnly:h=!1,hidden:i,...d}=l,[f,p]=r.useState(!1),[x,u]=r.useState(!1),[g,S]=r.useState(a??""),[y,C]=r.useState(""),[b,{width:w}]=pt(),[j,{width:T}]=pt(),[B,I]=r.useState(!1),D=r.useRef(null),F=r.useRef(null),O=k.useImperativeElement(s,()=>({requestWorkbookTitle:(P=null,v)=>{F.current={onAccept:P,requestReason:v?.requestReason},v?.selectAll&&D.current?.select(),D.current?.focus(v)},focus:P=>{D.current?.focus(P)}}),[]);return r.useLayoutEffect(()=>{I(a!==g),C(a),S(a)},[a]),r.useEffect(()=>{B&&w!==0&&Fe.CommonUtils.debounce(()=>{I(!1)},300)()},[B,w]),r.useEffect(()=>{u(g&&!it.IOUtils.isValidWindowsFilename(g))},[g]),i?null:e.jsx(E.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",opacity:B?"0":"1",transition:B?void 0:"opacity .25s ease-in","& .tooltip-wrapper":{maxWidth:"100%"}},ref:Nt([O,j,s]),...d,children:e.jsx(o.ExhibitTooltip,{label:F.current?.requestReason??"Workbook Name",children:e.jsxs(E.Box,{className:ge({"Mui-focusVisible":f}),sx:{visibility:w===0?"hidden":"visible",display:"block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:"12px",paddingRight:"12px",marginLeft:"2px",marginRight:"2px",paddingTop:"2px",paddingBottom:"1px",...Ti(!0,h),...n},children:[h?e.jsx(E.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:g!==y?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:P=>x?P.palette.error.dark:void 0},children:a??c}):e.jsx(E.Input,{sx:{width:`${Math.min(w+3,Math.max(T,O.current?.getBoundingClientRect()?.width))}px`,overflow:"hidden",whiteSpace:"nowrap",fontWeight:"600",maxWidth:"100%",border:"none",padding:"0px",margin:"0px",color:P=>x?P.palette.error.dark:void 0,fontStyle:g!==y?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:h,spellCheck:!1,placeholder:c,onFocus:P=>{p(!0),P.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:D},onBlur:()=>{p(!1),x?S(y):(g!==y&&(m?.(g),g&&F.current?.onAccept?.(g,"blur")),F.current=null)},onChange:P=>{if(P.target.value.length>it.IOUtils.MAX_WORKBOOK_NAME_SIZE)return P.stopPropagation(),void P.preventDefault();S(P.target.value)},onKeyDown:P=>{(it.IOUtils.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(P.key)||P.target?.value.length>it.IOUtils.MAX_WORKBOOK_NAME_SIZE)&&P.preventDefault(),P.which===k.KeyCodes.Enter||P.which===k.KeyCodes.Tab?(x?S(y):(m?.(g),g&&(F.current?.onAccept?.(g,"keydown"),F.current=null)),P.stopPropagation(),P.preventDefault(),t?.focus()):P.which===k.KeyCodes.Escape&&(g===y?t?.focus():(S(y),setTimeout(()=>{P.target?.select()},0)),F.current=null,P.stopPropagation(),P.preventDefault())},value:g}),e.jsx(E.Box,{ref:b,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:g!==y?"italic":void 0,fontFamily:P=>P.typography.fontFamily,letterSpacing:"0.00938em"},children:g||c})]})})})}));un.displayName="WorkbookTitle";const La=r.memo(r.forwardRef((l,s)=>{const{sx:n,style:t,className:a,licenseKey:c,renderLoadingPanel:m,...h}=l;c&&L.LicenseManager.setLicenseKey(c);const i=r.useMemo(()=>{const f={transitionDelay:"160ms",transparentBackground:!0};return e.jsx(E.Box,{sx:n,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...t},children:m?.(f)??e.jsx(o.LoadingPanel,{...f})})},[n,t,m]),d=r.useMemo(()=>r.lazy(async()=>await Promise.resolve().then(()=>as)),[]);return e.jsx(e.Fragment,{children:e.jsx(r.Suspense,{fallback:i,children:e.jsx(d,{...h,className:a,renderLoadingPanel:m,sx:n,style:t,ref:s})})})}));La.displayName="Studio";const Ei=r.createContext(null),Io={didCatch:!1,error:null};class Bi extends r.Component{constructor(s){super(s),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Io}static getDerivedStateFromError(s){return{didCatch:!0,error:s}}resetErrorBoundary(){const{error:s}=this.state;if(s!==null){for(var n,t,a=arguments.length,c=new Array(a),m=0;m<a;m++)c[m]=arguments[m];(n=(t=this.props).onReset)===null||n===void 0||n.call(t,{args:c,reason:"imperative-api"}),this.setState(Io)}}componentDidCatch(s,n){var t,a;(t=(a=this.props).onError)===null||t===void 0||t.call(a,s,n)}componentDidUpdate(s,n){const{didCatch:t}=this.state,{resetKeys:a}=this.props;var c,m;t&&n.error!==null&&(function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return h.length!==i.length||h.some((d,f)=>!Object.is(d,i[f]))})(s.resetKeys,a)&&((c=(m=this.props).onReset)===null||c===void 0||c.call(m,{next:a,prev:s.resetKeys,reason:"keys"}),this.setState(Io))}render(){const{children:s,fallbackRender:n,FallbackComponent:t,fallback:a}=this.props,{didCatch:c,error:m}=this.state;let h=s;if(c){const i={error:m,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")h=n(i);else if(t)h=r.createElement(t,i);else{if(a===void 0)throw m;h=a}}return r.createElement(Ei.Provider,{value:{didCatch:c,error:m,resetErrorBoundary:this.resetErrorBoundary}},h)}}function Ha(l){var s,n,t="";if(typeof l=="string"||typeof l=="number")t+=l;else if(typeof l=="object")if(Array.isArray(l))for(s=0;s<l.length;s++)l[s]&&(n=Ha(l[s]))&&(t&&(t+=" "),t+=n);else for(s in l)l[s]&&(t&&(t+=" "),t+=s);return t}function $e(){for(var l,s,n=0,t="";n<arguments.length;)(l=arguments[n++])&&(s=Ha(l))&&(t&&(t+=" "),t+=s);return t}let Ii={data:""},Ri=l=>typeof window=="object"?((l?l.querySelector("#_goober"):window._goober)||Object.assign((l||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:l||Ii,Mi=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Pi=/\/\*[^]*?\*\/| +/g,pr=/\n+/g,Ze=(l,s)=>{let n="",t="",a="";for(let c in l){let m=l[c];c[0]=="@"?c[1]=="i"?n=c+" "+m+";":t+=c[1]=="f"?Ze(m,c):c+"{"+Ze(m,c[1]=="k"?"":s)+"}":typeof m=="object"?t+=Ze(m,s?s.replace(/([^,])+/g,h=>c.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,i=>/&/.test(i)?i.replace(/&/g,h):h?h+" "+i:i)):c):m!=null&&(c=/^--/.test(c)?c:c.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=Ze.p?Ze.p(c,m):c+":"+m+";")}return n+(s&&a?s+"{"+a+"}":a)+t},Oe={},za=l=>{if(typeof l=="object"){let s="";for(let n in l)s+=n+za(l[n]);return s}return l},Di=(l,s,n,t,a)=>{let c=za(l),m=Oe[c]||(Oe[c]=(i=>{let d=0,f=11;for(;d<i.length;)f=101*f+i.charCodeAt(d++)>>>0;return"go"+f})(c));if(!Oe[m]){let i=c!==l?l:(d=>{let f,p,x=[{}];for(;f=Mi.exec(d.replace(Pi,""));)f[4]?x.shift():f[3]?(p=f[3].replace(pr," ").trim(),x.unshift(x[0][p]=x[0][p]||{})):x[0][f[1]]=f[2].replace(pr," ").trim();return x[0]})(l);Oe[m]=Ze(a?{["@keyframes "+m]:i}:i,n?"":"."+m)}let h=n&&Oe.g?Oe.g:null;return n&&(Oe.g=Oe[m]),((i,d,f,p)=>{p?d.data=d.data.replace(p,i):d.data.indexOf(i)===-1&&(d.data=f?i+d.data:d.data+i)})(Oe[m],s,t,h),m};function Ho(l){let s=this||{},n=l.call?l(s.p):l;return Di(n.unshift?n.raw?((t,a,c)=>t.reduce((m,h,i)=>{let d=a[i];if(d&&d.call){let f=d(c),p=f&&f.props&&f.props.className||/^go/.test(f)&&f;d=p?"."+p:f&&typeof f=="object"?f.props?"":Ze(f,""):f===!1?"":f}return m+h+(d??"")},""))(n,[].slice.call(arguments,1),s.p):n.reduce((t,a)=>Object.assign(t,a&&a.call?a(s.p):a),{}):n,Ri(s.target),s.g,s.o,s.k)}function Wa(l,s,n){return s&&(function(t,a){for(var c=0;c<a.length;c++){var m=a[c];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(t,m.key,m)}})(l.prototype,s),l}function fe(){return fe=Object.assign||function(l){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(l[t]=n[t])}return l},fe.apply(this,arguments)}function Va(l,s){l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.__proto__=s}function At(l,s){if(l==null)return{};var n,t,a={},c=Object.keys(l);for(t=0;t<c.length;t++)n=c[t],s.indexOf(n)>=0||(a[n]=l[n]);return a}function hr(l){if(l===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}Ho.bind({g:1}),Ho.bind({k:1});var fr=function(){return""},$a=r.createContext({enqueueSnackbar:fr,closeSnackbar:fr}),Ro="@media (max-width:599.95px)",to="@media (min-width:600px)",gr=function(l){return l.charAt(0).toUpperCase()+l.slice(1)},pn=function(l){return""+gr(l.vertical)+gr(l.horizontal)},qt=function(l){return!!l||l===0},Gt="unmounted",ot="exited",nt="entering",Et="entered",xr="exiting",hn=(function(l){function s(t){var a;a=l.call(this,t)||this;var c,m=t.appear;return a.appearStatus=null,t.in?m?(c=ot,a.appearStatus=nt):c=Et:c=t.unmountOnExit||t.mountOnEnter?Gt:ot,a.state={status:c},a.nextCallback=null,a}Va(s,l),s.getDerivedStateFromProps=function(t,a){return t.in&&a.status===Gt?{status:ot}:null};var n=s.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(t){var a=null;if(t!==this.props){var c=this.state.status;this.props.in?c!==nt&&c!==Et&&(a=nt):c!==nt&&c!==Et||(a=xr)}this.updateStatus(!1,a)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var t=this.props.timeout,a=t,c=t;return t!=null&&typeof t!="number"&&typeof t!="string"&&(c=t.exit,a=t.enter),{exit:c,enter:a}},n.updateStatus=function(t,a){t===void 0&&(t=!1),a!==null?(this.cancelNextCallback(),a===nt?this.performEnter(t):this.performExit()):this.props.unmountOnExit&&this.state.status===ot&&this.setState({status:Gt})},n.performEnter=function(t){var a=this,c=this.props.enter,m=t,h=this.getTimeouts();t||c?(this.props.onEnter&&this.props.onEnter(this.node,m),this.safeSetState({status:nt},function(){a.props.onEntering&&a.props.onEntering(a.node,m),a.onTransitionEnd(h.enter,function(){a.safeSetState({status:Et},function(){a.props.onEntered&&a.props.onEntered(a.node,m)})})})):this.safeSetState({status:Et},function(){a.props.onEntered&&a.props.onEntered(a.node,m)})},n.performExit=function(){var t=this,a=this.props.exit,c=this.getTimeouts();a?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:xr},function(){t.props.onExiting&&t.props.onExiting(t.node),t.onTransitionEnd(c.exit,function(){t.safeSetState({status:ot},function(){t.props.onExited&&t.props.onExited(t.node)})})})):this.safeSetState({status:ot},function(){t.props.onExited&&t.props.onExited(t.node)})},n.cancelNextCallback=function(){this.nextCallback!==null&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(t,a){a=this.setNextCallback(a),this.setState(t,a)},n.setNextCallback=function(t){var a=this,c=!0;return this.nextCallback=function(){c&&(c=!1,a.nextCallback=null,t())},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(t,a){this.setNextCallback(a);var c=t==null&&!this.props.addEndListener;this.node&&!c?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),t!=null&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},n.render=function(){var t=this.state.status;if(t===Gt)return null;var a=this.props;return(0,a.children)(t,At(a,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Wa(s,[{key:"node",get:function(){var t,a=(t=this.props.nodeRef)===null||t===void 0?void 0:t.current;if(!a)throw new Error("notistack - Custom snackbar is not refForwarding");return a}}]),s})(r.Component);function rt(){}function br(l,s){typeof l=="function"?l(s):l&&(l.current=s)}function zo(l,s){return r.useMemo(function(){return l==null&&s==null?null:function(n){br(l,n),br(s,n)}},[l,s])}function ro(l){var s=l.timeout,n=l.style,t=n===void 0?{}:n,a=l.mode;return{duration:typeof s=="object"?s[a]||0:s,easing:t.transitionTimingFunction,delay:t.transitionDelay}}hn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:rt,onEntering:rt,onEntered:rt,onExit:rt,onExiting:rt,onExited:rt};var Fi="cubic-bezier(0.4, 0, 0.2, 1)",Ni="cubic-bezier(0.0, 0, 0.2, 1)",Ai="cubic-bezier(0.4, 0, 0.6, 1)",Ua=function(l){l.scrollTop=l.scrollTop},yr=function(l){return Math.round(l)+"ms"};function ct(l,s){l===void 0&&(l=["all"]);var n=s||{},t=n.duration,a=t===void 0?300:t,c=n.easing,m=c===void 0?Fi:c,h=n.delay,i=h===void 0?0:h;return(Array.isArray(l)?l:[l]).map(function(d){var f=typeof a=="string"?a:yr(a),p=typeof i=="string"?i:yr(i);return d+" "+f+" "+m+" "+p}).join(",")}function _a(l){var s=(function(n){return n&&n.ownerDocument||document})(l);return s.defaultView||window}function Xt(l,s){if(s){var n=(function(t,a){var c,m=a.getBoundingClientRect(),h=_a(a);if(a.fakeTransform)c=a.fakeTransform;else{var i=h.getComputedStyle(a);c=i.getPropertyValue("-webkit-transform")||i.getPropertyValue("transform")}var d=0,f=0;if(c&&c!=="none"&&typeof c=="string"){var p=c.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),f=parseInt(p[5],10)}switch(t){case"left":return"translateX("+(h.innerWidth+d-m.left)+"px)";case"right":return"translateX(-"+(m.left+m.width-d)+"px)";case"up":return"translateY("+(h.innerHeight+f-m.top)+"px)";default:return"translateY(-"+(m.top+m.height-f)+"px)"}})(l,s);n&&(s.style.webkitTransform=n,s.style.transform=n)}}var Ka=r.forwardRef(function(l,s){var n=l.children,t=l.direction,a=t===void 0?"down":t,c=l.in,m=l.style,h=l.timeout,i=h===void 0?0:h,d=l.onEnter,f=l.onEntered,p=l.onExit,x=l.onExited,u=At(l,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),g=r.useRef(null),S=zo(n.ref,g),y=zo(S,s),C=r.useCallback(function(){g.current&&Xt(a,g.current)},[a]);return r.useEffect(function(){if(!c&&a!=="down"&&a!=="right"){var b=(function(j,T){var B;function I(){for(var D=this,F=arguments.length,O=new Array(F),P=0;P<F;P++)O[P]=arguments[P];clearTimeout(B),B=setTimeout(function(){j.apply(D,O)},T)}return T===void 0&&(T=166),I.clear=function(){clearTimeout(B)},I})(function(){g.current&&Xt(a,g.current)}),w=_a(g.current);return w.addEventListener("resize",b),function(){b.clear(),w.removeEventListener("resize",b)}}},[a,c]),r.useEffect(function(){c||C()},[c,C]),r.createElement(hn,Object.assign({appear:!0,nodeRef:g,onEnter:function(b,w){Xt(a,b),Ua(b),d&&d(b,w)},onEntered:f,onEntering:function(b){var w=m?.transitionTimingFunction||Ni,j=ro({timeout:i,mode:"enter",style:fe({},m,{transitionTimingFunction:w})});b.style.webkitTransition=ct("-webkit-transform",j),b.style.transition=ct("transform",j),b.style.webkitTransform="none",b.style.transform="none"},onExit:function(b){var w=m?.transitionTimingFunction||Ai,j=ro({timeout:i,mode:"exit",style:fe({},m,{transitionTimingFunction:w})});b.style.webkitTransition=ct("-webkit-transform",j),b.style.transition=ct("transform",j),Xt(a,b),p&&p(b)},onExited:function(b){b.style.webkitTransition="",b.style.transition="",x&&x(b)},in:c,timeout:i},u),function(b,w){return r.cloneElement(n,fe({ref:y,style:fe({visibility:b!=="exited"||c?void 0:"hidden"},m,{},n.props.style)},w))})});Ka.displayName="Slide";var co=function(l){return r.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},l))},Oi=function(){return r.createElement(co,null,r.createElement("path",{d:`M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41
15
- 10.59L10 14.17L17.59 6.58L19 8L10 17Z`}))},Li=function(){return r.createElement(co,null,r.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Hi=function(){return r.createElement(co,null,r.createElement("path",{d:`M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,
16
- 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,
17
- 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z`}))},zi=function(){return r.createElement(co,null,r.createElement("path",{d:`M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,
18
- 0 22,12A10,10 0 0,0 12,2Z`}))},Ye={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:r.createElement(Oi,null),warning:r.createElement(Li,null),error:r.createElement(Hi,null),info:r.createElement(zi,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:Ka,transitionDuration:{enter:225,exit:195}},Wi=function(l,s){return function(n,t){return t===void 0&&(t=!1),t?fe({},Ye[n],{},s[n],{},l[n]):n==="autoHideDuration"?(a=l.autoHideDuration,c=s.autoHideDuration,(m=function(h){return typeof h=="number"||h===null})(a)?a:m(c)?c:Ye.autoHideDuration):n==="transitionDuration"?(function(h,i){var d=function(f,p){return p.some(function(x){return typeof f===x})};return d(h,["string","number"])?h:d(h,["object"])?fe({},Ye.transitionDuration,{},d(i,["object"])&&i,{},h):d(i,["string","number"])?i:d(i,["object"])?fe({},Ye.transitionDuration,{},i):Ye.transitionDuration})(l.transitionDuration,s.transitionDuration):l[n]||s[n]||Ye[n];var a,c,m}};function Ot(l){return Object.entries(l).reduce(function(s,n){var t,a=n[0],c=n[1];return fe({},s,((t={})[a]=Ho(c),t))},{})}var Vi="notistack-SnackbarContainer",$i="notistack-Snackbar",qa="notistack-CollapseWrapper",Ui="notistack-MuiContent",_i=function(l){return"notistack-MuiContent-"+l},Cr=Ot({root:{height:0},entered:{height:"auto"}}),Mo="0px",Ga=r.forwardRef(function(l,s){var n=l.children,t=l.in,a=l.onExited,c=r.useRef(null),m=r.useRef(null),h=zo(s,m),i=function(){return c.current?c.current.clientHeight:0};return r.createElement(hn,{in:t,unmountOnExit:!0,onEnter:function(d){d.style.height=Mo},onEntered:function(d){d.style.height="auto"},onEntering:function(d){var f=i(),p=ro({timeout:175,mode:"enter"}),x=p.duration,u=p.easing;d.style.transitionDuration=typeof x=="string"?x:x+"ms",d.style.height=f+"px",d.style.transitionTimingFunction=u||""},onExit:function(d){d.style.height=i()+"px"},onExited:a,onExiting:function(d){Ua(d);var f=ro({timeout:175,mode:"exit"}),p=f.duration,x=f.easing;d.style.transitionDuration=typeof p=="string"?p:p+"ms",d.style.height=Mo,d.style.transitionTimingFunction=x||""},nodeRef:m,timeout:175},function(d,f){return r.createElement("div",Object.assign({ref:h,className:$e(Cr.root,d==="entered"&&Cr.entered),style:fe({pointerEvents:"all",overflow:"hidden",minHeight:Mo,transition:ct("height")},d==="entered"&&{overflow:"visible"},{},d==="exited"&&!t&&{visibility:"hidden"})},f),r.createElement("div",{ref:c,className:qa,style:{display:"flex",width:"100%"}},n))})});Ga.displayName="Collapse";var Sr={right:"left",left:"right",bottom:"up",top:"down"},Ki=function(l){return"anchorOrigin"+pn(l)},qi=function(){};function Pt(l,s){return l.reduce(function(n,t){return t==null?n:function(){for(var a=arguments.length,c=new Array(a),m=0;m<a;m++)c[m]=arguments[m];var h=[].concat(c);s&&h.indexOf(s)===-1&&h.push(s),n.apply(this,h),t.apply(this,h)}},qi)}var Gi=typeof window<"u"?r.useLayoutEffect:r.useEffect;function wr(l){var s=r.useRef(l);return Gi(function(){s.current=l}),r.useCallback(function(){return s.current.apply(void 0,arguments)},[])}var Po,Xa=r.forwardRef(function(l,s){var n=l.children,t=l.className,a=l.autoHideDuration,c=l.disableWindowBlurListener,m=c!==void 0&&c,h=l.onClose,i=l.id,d=l.open,f=l.SnackbarProps,p=f===void 0?{}:f,x=r.useRef(),u=wr(function(){h&&h.apply(void 0,arguments)}),g=wr(function(C){h&&C!=null&&(x.current&&clearTimeout(x.current),x.current=setTimeout(function(){u(null,"timeout",i)},C))});r.useEffect(function(){return d&&g(a),function(){x.current&&clearTimeout(x.current)}},[d,a,g]);var S=function(){x.current&&clearTimeout(x.current)},y=r.useCallback(function(){a!=null&&g(.5*a)},[a,g]);return r.useEffect(function(){if(!m&&d)return window.addEventListener("focus",y),window.addEventListener("blur",S),function(){window.removeEventListener("focus",y),window.removeEventListener("blur",S)}},[m,y,d]),r.createElement("div",Object.assign({ref:s},p,{className:$e($i,t),onMouseEnter:function(C){p.onMouseEnter&&p.onMouseEnter(C),S()},onMouseLeave:function(C){p.onMouseLeave&&p.onMouseLeave(C),y()}}),n)});Xa.displayName="Snackbar";var Xi=Ot({root:(Po={display:"flex",flexWrap:"wrap",flexGrow:1},Po[to]={flexGrow:"initial",minWidth:"288px"},Po)}),fn=r.forwardRef(function(l,s){var n=l.className,t=At(l,["className"]);return r.createElement("div",Object.assign({ref:s,className:$e(Xi.root,n)},t))});fn.displayName="SnackbarContent";var Bt=Ot({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),kr="notistack-snackbar",Ya=r.forwardRef(function(l,s){var n=l.id,t=l.message,a=l.action,c=l.iconVariant,m=l.variant,h=l.hideIconVariant,i=l.style,d=l.className,f=c[m],p=a;return typeof p=="function"&&(p=p(n)),r.createElement(fn,{ref:s,role:"alert","aria-describedby":kr,style:i,className:$e(Ui,_i(m),Bt.root,Bt[m],d,!h&&f&&Bt.lessPadding)},r.createElement("div",{id:kr,className:Bt.message},h?null:f,t),p&&r.createElement("div",{className:Bt.action},p))});Ya.displayName="MaterialDesignContent";var It,Do,Yt,Zt,Fo,Yi=r.memo(Ya),Zi=Ot({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Ji=function(l){var s=r.useRef(),n=r.useState(!0),t=n[0],a=n[1],c=Pt([l.snack.onClose,l.onClose]),m=r.useCallback(function(){s.current=setTimeout(function(){a(function(D){return!D})},125)},[]);r.useEffect(function(){return function(){s.current&&clearTimeout(s.current)}},[]);var h,i=l.snack,d=l.classes,f=l.Component,p=f===void 0?Yi:f,x=r.useMemo(function(){return(function(D){D===void 0&&(D={});var F={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(D).filter(function(O){return!F[O]}).reduce(function(O,P){var v;return fe({},O,((v={})[P]=D[P],v))},{})})(d)},[d]),u=i.open,g=i.SnackbarProps,S=i.TransitionComponent,y=i.TransitionProps,C=i.transitionDuration,b=i.disableWindowBlurListener,w=i.content,j=At(i,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),T=fe({direction:(h=j.anchorOrigin,h.horizontal!=="center"?Sr[h.horizontal]:Sr[h.vertical]),timeout:C},y),B=w;typeof B=="function"&&(B=B(j.id,j.message));var I=["onEnter","onEntered","onExit","onExited"].reduce(function(D,F){var O;return fe({},D,((O={})[F]=Pt([l.snack[F],l[F]],j.id),O))},{});return r.createElement(Ga,{in:t,onExited:I.onExited},r.createElement(Xa,{open:u,id:j.id,disableWindowBlurListener:b,autoHideDuration:j.autoHideDuration,className:$e(Zi.wrappedRoot,x.root,x[Ki(j.anchorOrigin)]),SnackbarProps:g,onClose:c},r.createElement(S,Object.assign({},T,{appear:!0,in:u,onExit:I.onExit,onExited:m,onEnter:I.onEnter,onEntered:Pt([I.onEntered,function(){l.snack.requestClose&&c(null,"instructed",l.snack.id)}],j.id)}),B||r.createElement(p,Object.assign({},j)))))},Rt={default:20},Jt={default:6,dense:2},vr="."+qa,Qt=Ot({root:(It={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:ct(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},It[vr]={padding:Jt.default+"px 0px",transition:"padding 300ms ease 0ms"},It.maxWidth="calc(100% - "+2*Rt.default+"px)",It[Ro]={width:"100%",maxWidth:"calc(100% - 32px)"},It),rootDense:(Do={},Do[vr]={padding:Jt.dense+"px 0px"},Do),top:{top:Rt.default-Jt.default+"px",flexDirection:"column"},bottom:{bottom:Rt.default-Jt.default+"px",flexDirection:"column-reverse"},left:(Yt={left:Rt.default+"px"},Yt[to]={alignItems:"flex-start"},Yt[Ro]={left:"16px"},Yt),right:(Zt={right:Rt.default+"px"},Zt[to]={alignItems:"flex-end"},Zt[Ro]={right:"16px"},Zt),center:(Fo={left:"50%",transform:"translateX(-50%)"},Fo[to]={alignItems:"center"},Fo)}),Qi=function(l){var s=l.classes,n=s===void 0?{}:s,t=l.anchorOrigin,a=l.dense,c=l.children,m=$e(Vi,Qt[t.vertical],Qt[t.horizontal],Qt.root,n.containerRoot,n["containerAnchorOrigin"+pn(t)],a&&Qt.rootDense);return r.createElement("div",{className:m},c)},es=r.memo(Qi),jr=function(l){return!(typeof l=="string"||r.isValidElement(l))},ts=(function(l){function s(n){var t;return(t=l.call(this,n)||this).enqueueSnackbar=function(a,c){if(c===void 0&&(c={}),a==null)throw new Error("enqueueSnackbar called with invalid argument");var m=jr(a)?a:c,h=jr(a)?a.message:a,i=m.key,d=m.preventDuplicate,f=At(m,["key","preventDuplicate"]),p=qt(i),x=p?i:new Date().getTime()+Math.random(),u=Wi(f,t.props),g=fe({id:x},f,{message:h,open:!0,entered:!1,requestClose:!1,persist:u("persist"),action:u("action"),content:u("content"),variant:u("variant"),anchorOrigin:u("anchorOrigin"),disableWindowBlurListener:u("disableWindowBlurListener"),autoHideDuration:u("autoHideDuration"),hideIconVariant:u("hideIconVariant"),TransitionComponent:u("TransitionComponent"),transitionDuration:u("transitionDuration"),TransitionProps:u("TransitionProps",!0),iconVariant:u("iconVariant",!0),style:u("style",!0),SnackbarProps:u("SnackbarProps",!0),className:$e(t.props.className,f.className)});return g.persist&&(g.autoHideDuration=void 0),t.setState(function(S){if(d===void 0&&t.props.preventDuplicate||d){var y=function(w){return p?w.id===x:w.message===h},C=S.queue.findIndex(y)>-1,b=S.snacks.findIndex(y)>-1;if(C||b)return S}return t.handleDisplaySnack(fe({},S,{queue:[].concat(S.queue,[g])}))}),x},t.handleDisplaySnack=function(a){return a.snacks.length>=t.maxSnack?t.handleDismissOldest(a):t.processQueue(a)},t.processQueue=function(a){var c=a.queue,m=a.snacks;return c.length>0?fe({},a,{snacks:[].concat(m,[c[0]]),queue:c.slice(1,c.length)}):a},t.handleDismissOldest=function(a){if(a.snacks.some(function(i){return!i.open||i.requestClose}))return a;var c=!1,m=!1;a.snacks.reduce(function(i,d){return i+(d.open&&d.persist?1:0)},0)===t.maxSnack&&(m=!0);var h=a.snacks.map(function(i){return c||i.persist&&!m?fe({},i):(c=!0,i.entered?(i.onClose&&i.onClose(null,"maxsnack",i.id),t.props.onClose&&t.props.onClose(null,"maxsnack",i.id),fe({},i,{open:!1})):fe({},i,{requestClose:!0}))});return fe({},a,{snacks:h})},t.handleEnteredSnack=function(a,c,m){if(!qt(m))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState(function(h){return{snacks:h.snacks.map(function(i){return i.id===m?fe({},i,{entered:!0}):fe({},i)})}})},t.handleCloseSnack=function(a,c,m){t.props.onClose&&t.props.onClose(a,c,m);var h=m===void 0;t.setState(function(i){var d=i.snacks,f=i.queue;return{snacks:d.map(function(p){return h||p.id===m?p.entered?fe({},p,{open:!1}):fe({},p,{requestClose:!0}):fe({},p)}),queue:f.filter(function(p){return p.id!==m})}})},t.closeSnackbar=function(a){var c=t.state.snacks.find(function(m){return m.id===a});qt(a)&&c&&c.onClose&&c.onClose(null,"instructed",a),t.handleCloseSnack(null,"instructed",a)},t.handleExitedSnack=function(a,c){if(!qt(c))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState(function(m){var h=t.processQueue(fe({},m,{snacks:m.snacks.filter(function(i){return i.id!==c})}));return h.queue.length===0?h:t.handleDismissOldest(h)})},t.enqueueSnackbar,t.closeSnackbar,t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar.bind(hr(t)),closeSnackbar:t.closeSnackbar.bind(hr(t))}},t}return Va(s,l),s.prototype.render=function(){var n=this,t=this.state.contextValue,a=this.props,c=a.domRoot,m=a.children,h=a.dense,i=h!==void 0&&h,d=a.Components,f=d===void 0?{}:d,p=a.classes,x=this.state.snacks.reduce(function(g,S){var y,C=pn(S.anchorOrigin),b=g[C]||[];return fe({},g,((y={})[C]=[].concat(b,[S]),y))},{}),u=Object.keys(x).map(function(g){var S=x[g],y=S[0];return r.createElement(es,{key:g,dense:i,anchorOrigin:y.anchorOrigin,classes:p},S.map(function(C){return r.createElement(Ji,{key:C.id,snack:C,classes:p,Component:f[C.variant],onClose:n.handleCloseSnack,onEnter:n.props.onEnter,onExit:n.props.onExit,onExited:Pt([n.handleExitedSnack,n.props.onExited],C.id),onEntered:Pt([n.handleEnteredSnack,n.props.onEntered],C.id)})}))});return r.createElement($a.Provider,{value:t},m,c?Je.createPortal(u,c):u)},Wa(s,[{key:"maxSnack",get:function(){return this.props.maxSnack||Ye.maxSnack}}]),s})(r.Component),Za=function(){return r.useContext($a)};const os=[{key:"SheetXL",description:"SheetXL",mimeType:".sxl",exts:["sxl"],handler:null,isDefault:!0},{key:"CSV",description:"Comma Delimited",mimeType:"text/csv",exts:["csv"],handler:null},{key:"Excel",description:"Excel Workbook",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",exts:["xlsx","xls","xlsm"],handler:null}],ns=[{key:"SheetXL",mimeType:"application/vnd.sheetxl.sheet",description:"SheetXL",ext:"sxl",handler:null,isDefault:!0},{key:"CSV",mimeType:"text/csv",description:"Comma Delimited",ext:"csv",handler:null},{key:"Excel",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",description:"Excel Workbook",ext:"xlsx",tags:["SheetJS Pro"],handler:null}];class Ja{constructor(s=os,n=ns){this._readFormatType=[],this._writeFormatType=[],this._readFormatType=Object.freeze([...s]),this._writeFormatType=Object.freeze([...n])}getReadFormats(){return this._readFormatType}getWriteFormats(){return this._writeFormatType}getAllReadFormatTypeAsString(){const s=[],n=this._readFormatType;for(let t=0;t<n.length;t++)for(let a=0;a<n[t].exts.length;a++)s.push("."+n[t].exts[a]);return s}async writeFile(s,n,t){if(!n||!s)throw new Error("Workbook model or file name must be provided.");try{return(await import("@sheetxl/io")).WorkbookIO.writeFile(s,n,t)}catch(a){throw new Error("Unable to load io library",{cause:a})}}async read(s,n){let t,a;const c=await n?.showBusy?.(`Opening${s.name?` ${s.name}`:""}...`);try{a=await import("@sheetxl/io")}catch(m){throw m}try{return await a.WorkbookIO.read({...s,progress:{async onStart(m){await s?.progress?.onStart?.(m),t=await n?.showBusy?.(`Opening '${m}'...`)}}})}catch(m){throw c?.(),t?.(),m}finally{c?.(),t?.()}}}const Ve=new Ja,Le={card:"_card_1a398_7",actionRoot:"_actionRoot_1a398_11",icons:"_icons_1a398_16",expand:"_expand_1a398_22",expandOpen:"_expandOpen_1a398_29",stackTraceContainer:"_stackTraceContainer_1a398_33"},Qa=r.forwardRef((l,s)=>{const{id:n,message:t,iconVariant:a,error:c,hideIconVariant:m,...h}=l,{closeSnackbar:i}=Za(),d=G.useTheme(),[f,p]=r.useState(!1),x=r.useCallback(()=>{p(S=>!S)},[]),u=r.useCallback(()=>{i(n)},[n,i]);let g=c?.message;return!g&&r.isValidElement(t)&&(g=t),g||typeof t!="string"||(g=t),g||(g=`Unknown Error: ${t}`),e.jsx(fn,{ref:s,className:ge(Le.root,"error-snackbar"),children:e.jsxs(E.Card,{className:Le.card,style:{backgroundColor:d.palette.error.dark,border:`1px solid ${d.palette.error.dark}`},children:[e.jsxs(E.CardActions,{className:Le.actionRoot,children:[m?null:a?.error,e.jsx(E.Typography,{variant:"body2",component:"div",className:Le.typography,children:g}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Le.icons,children:[c?e.jsx(E.IconButton,{"aria-label":"Show more",size:"small",className:ge(Le.expand,{[Le.expandOpen]:f}),onClick:x,children:e.jsx(me.ExpandMore,{})}):null,e.jsx(E.IconButton,{size:"small",className:Le.expand,onClick:u,children:e.jsx(me.Close,{fontSize:"small"})})]})]}),c?e.jsx(E.Collapse,{in:f,timeout:"auto",unmountOnExit:!0,children:e.jsx("div",{className:Le.stackTraceContainer,style:{backgroundColor:d.palette.error.light,borderTop:`1px solid ${d.palette.error.main}`},children:e.jsx(o.StackTrace,{error:c,hideLineNumbers:!0})})}):null]})})});Qa.displayName="ToastError";const el=r.memo(r.forwardRef((l,s)=>{const{commands:n,commandHook:t,scope:a="workbook",disabled:c=!1,...m}=l,h=k.useCallbackRef(d=>{const f={variant:k.CommandButtonType.Menuitem,parentFloat:d.floatReference,commandHook:t,scope:a,disabled:c},p=e.jsxs(e.Fragment,{children:[e.jsx(o.CommandButton,{...f,command:n.getCommand("newWorkbook"),icon:o.themeIcon(e.jsx(o.FileNewIcon,{}))}),e.jsx(o.ExhibitDivider,{orientation:"horizontal"}),e.jsx(o.CommandButton,{...f,command:n.getCommand("openWorkbook"),icon:o.themeIcon(e.jsx(o.FileOpenIcon,{}))}),e.jsx(o.CommandPopupButton,{...f,commands:n,quickCommand:"saveWorkbook",icon:o.themeIcon(e.jsx(o.FileDownloadAsSheetIcon,{})),createPopupPanel:x=>{const u={...f,parentFloat:x.floatReference,scope:"saveWorkbook"},g=[];return Ve.getWriteFormats().forEach(S=>{if(S.isDefault)return;let y=null;S.key==="CSV"?y=o.themeIcon(e.jsx(o.FileDownloadAsCSVIcon,{})):S.key==="Excel"&&(y=o.themeIcon(e.jsx(o.FileDownloadAsExcelIcon,{})));const C=n.getCommand(`saveWorkbookAs${S.key}`);C?g.push(r.createElement(o.CommandButton,{...u,key:S.key,command:C,icon:y})):console.warn(`Unable to resolve command: 'saveWorkbookAs${S.key}'`)}),o.defaultCreatePopupPanel({...x,children:g,onClick:()=>{x.closeFloatAll()}})}})]});return o.defaultCreatePopupPanel({...d,children:p,onClick:x=>{x.isDefaultPrevented||d.closeFloatAll()}})},[c,n,t,a]),i="File";return e.jsx(o.CommandPopupButton,{commands:n,disabled:c,commandHook:t,scope:a,label:i,tooltip:"Options for saving and loading the workbook.",sx:{paddingBottom:"0px","& button":{paddingTop:"0px",paddingBottom:"0px",height:d=>`calc(1.25rem + ${d.spacing(2)}px)`}},...m,createPopupPanel:h,icon:e.jsx(o.LabelIcon,{className:"label",icon:null,label:i})})}));el.displayName="StandaloneFileCommandButton";const rs=e.jsx(o.ExhibitTooltip,{label:"SheetXL",description:"Visit me at sheetxl.com.",children:e.jsx(E.Box,{sx:{width:"24px",height:"24px",marginBottom:"4px",marginLeft:"6px"},children:e.jsx(ie.LogoNoPaddingIcon,{onClick:()=>{window?.open("https://www.sheetxl.com","_blank")},style:{width:"24px",height:"24px",cursor:"pointer"}})})}),tl=r.memo(r.forwardRef((l,s)=>{const{commands:n,workbook:t,logo:a=rs,mainElement:c,showFileMenu:m=!0,showAppearanceMenu:h=!0,...i}=l,{reference:d}=o.useFloatStack(),[f,{width:p}]=pt(),x=p<530,u=m?e.jsx(el,{commands:n,commandHook:{beforeExecute(){d?.closeAll()},onError(C,b,w){}}}):null,g=h?e.jsx(la,{commands:n,commandHook:{beforeExecute(){d?.closeAll()},onError(C,b,w){}}}):null,S=r.useMemo(()=>({paddingLeft:C=>C.spacing(1),paddingRight:C=>C.spacing(1)}),[]),y=r.useRef(null);return e.jsx(E.Box,{ref:Nt([y,f,s]),...i,children:Da({commands:n,renderCompact:x,workbook:t,selectWrapper:C=>e.jsxs(E.Box,{sx:{display:"flex",flex:"1",flexDirection:"row",alignItems:"stretch",gap:b=>b.spacing(1),paddingLeft:b=>b.spacing(1),paddingRight:b=>b.spacing(1)},children:[e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:b=>b.spacing(.5)},children:[a,e.jsxs(E.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:b=>b.spacing(.25)},children:[u,C]})]}),e.jsx(E.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 300%",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:c}),e.jsx(E.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"end",flex:x&&!g?"0 0 auto":"1 1 100%"},children:g})]}),selectProps:S,toolbarsProps:{Home:{sx:{}}}})})}));tl.displayName="StudioToolbar";const ol=r.memo(r.forwardRef((l,s)=>{const{workbook:n,setWorkbook:t,refWorkbookTitle:a,titleWorkbook:c,setWorkbookTitle:m,titlePlaceHolder:h,children:i,undoManager:d,commands:f,importExportDisabled:p,themeOptions:x}=l,u=Za(),g=u?u.enqueueSnackbar:()=>{},S=u?u.closeSnackbar:()=>{},[y,C]=r.useState({isMounted:!1,label:null,starting:new Map,running:new Map}),b=r.useCallback(()=>{C(V=>({...V,isMounted:!0}))},[]),w=r.useCallback(()=>{C(V=>({...V,isMounted:!1}))},[]),j={},T=o.useLazyWindow(j),B=o.useOptionsDialog(j),I=o.useInputDialog(j),D=r.useRef(new Set),F=r.useMemo(()=>{const V=(_,X)=>{if(X?.onceKey){if(D.current.has(X.onceKey))return;const U=new Set(D.current);U.add(X.onceKey),D.current=U}const q={variant:X?.type??k.NotifierType.Info,anchorOrigin:{vertical:"top",horizontal:"center"},preventDuplicate:X?.preventDuplicate,persist:X?.persist??X?.type===k.NotifierType.Error,action:U=>e.jsx(E.IconButton,{onClick:()=>S(U),children:e.jsx(me.CancelOutlined,{})})};X?.enqueueProps&&Object.assign(q,X.enqueueProps),_||console.log("message is 'null'",X),g(_??"Alert",q)},N={showMessage:V,showBusy:(_,X)=>{let q=null;const U=new Promise(Z=>{q=Z});return C(Z=>{const ee=new Map(Z.starting);return ee.set(U,q),{...Z,label:_,starting:ee}}),U},showWindow:(_,X,q)=>{const U={...X,onKeyDown:Z=>{f?.dispatchToFocusedCommand(Z),Z.isDefaultPrevented()||Z.isPropagationStopped()||X?.onKeyDown?.(Z)}};return T(_,{sort:()=>Promise.resolve().then(()=>require("./CJQkIVFa7S1AZcBP.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./Td2md8ruASYOp_Rr.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./jHU6TwhWd2lZX-VA.cjs")),comments:()=>Promise.resolve().then(()=>require("./CHyGxDKCce-XV53l.cjs")),find:()=>Promise.resolve().then(()=>require("./BnpPHKTC6_96pDcW.cjs")),tableDetails:()=>Promise.resolve().then(()=>require("./F4v-BOmzUXzCO3uz.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./D6pUyWwmIliDWT8B.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./JURSrTjvLJ8bc4Yl.cjs"))}[_],U,q)},showOptions:B,showInputOptions:I,showError:_=>{let X,q=k.NotifierType.Error,U="Unknown Error";typeof _=="string"?U=_:_ instanceof Error&&(X=_,_.message&&(U=_.message)),_ instanceof Fe.PartialError&&(q=k.NotifierType.Info),V(U,{type:q,enqueueProps:{error:X}})}},R=new k.DefaultReactNotifier;return R.setOverrides(N),R},[]),O=r.useCallback(()=>{},[]),P=(V=>{const{workbook:N,setWorkbook:R,notifier:_,importExportDisabled:X,workbookTitle:q="export",setWorkbookTitle:U,requestWorkbookTitle:Z,themeOptions:ee,undoManager:K,commands:z,onExecute:J}=V,re=k.useCallbackRef(ee?.onModeChange,[ee?.onModeChange]),xe=k.useCallbackRef(ee?.onEnabledDarkGridChange,[ee?.onEnabledDarkGridChange]),be=k.useCallbackRef(ee?.onEnabledDarkImagesChange,[ee?.onEnabledDarkImagesChange]),ye=k.useCallbackRef(async(le=null,ae=null)=>{const Y=[];let oe,pe=null,se=null;if(typeof le=="string"?se=le:pe=le,oe=pe?le:await Fe.CommonUtils.openFileDialog(se??Ve.getAllReadFormatTypeAsString().join(",")),!oe)return null;const je={source:oe,createWorkbookOptions:ae,onWarning:ht=>{Y.push(ht)}},Me=await Ve.read(je,_);return Y.length>0&&(_.showMessage("Some elements were not able to be imported. See console for details."),console.warn(`Import warnings:
19
- `+Y.join(`
20
- `))),Me},[J,_,N]),Be=k.useCallbackRef(async(le,ae,Y)=>{if(!ae&&Z){const oe=await Z("Enter Workbook name to "+(Y.isDefault?"Save.":`Export as ${Y.description}.`));return oe!==null&&Ve.writeFile(oe,le,{formatType:Y.key})}return Ve.writeFile(ae,le,{formatType:Y.key})},[_,N,Z]),ce=r.useCallback(()=>({contains:le=>!0,focus(){}}),[]),Q=r.useMemo(()=>{const le=[];X||(Ve.getWriteFormats().forEach(Y=>{const oe=Y.isDefault,pe={label:oe?"Save Workbook":`Save Workbook as ${Y.description}`,scopedLabels:{workbook:"Save",saveWorkbook:`as ${Y.description}`},tags:Y.tags,description:`Save the workbook to the desktop${oe?"":` as ${Y.description}`}.`};oe&&(pe.shortcut={key:"S",modifiers:[k.KeyModifiers.Ctrl]},le.push(new k.Command("saveWorkbookAs",ce,{label:"Save Workbook As…",scopedLabels:{workbook:"Save as…",saveWorkbook:"as…"},shortcut:[{key:"S",modifiers:[k.KeyModifiers.Shift,k.KeyModifiers.Ctrl]},{key:"F12"}],description:"Save the workbook to the desktop with the provided name."},()=>{Be(N,null,Y).catch(je=>{_.showError(je)})})));const se=oe?"saveWorkbook":`saveWorkbookAs${Y.key}`;le.push(new k.Command(se,ce,pe,je=>{Be(N,je??q,Y).catch(Me=>{_.showError(Me)})}))}),le.push(new k.Command("openWorkbook",ce,{label:"Open Workbook…",scopedLabels:{workbook:"Open…"},description:"Open a workbook from the desktop.",shortcut:{key:"O",modifiers:[k.KeyModifiers.Ctrl]}},async(Y=null)=>{const oe={date1904:N.isDate1904(),...N.options};try{const pe=await ye(Y,oe);if(!pe)return;const se=pe.title,je=pe.workbook,Me=je.getSelectedSheet();if(pe.formatType.mimeType==="text/csv"){const ht=N.findValidSheetName(se);await N.doBatch(async()=>{const mo=Me.getUsedRange();if(!mo)return void _.showMessage("The file appears to be blank.");await N.getSheets().add({name:ht,autoSelect:!0}).getRange({colStart:0,rowStart:0,colEnd:0,rowEnd:0}).copyFrom(mo)},`Import CSV '${se}'`)}else N?.close(),U?.(se),R(je)}catch(pe){_.showError(pe)}})),le.push(new k.Command("openWorkbookFromUrl",ce,{label:"Open Workbook From Web",scopedLabels:{insert:"From Web",workbook:"From Web…"},description:"Open a workbook from the web."},async function(Y){if(!Y){const oe=await _.showInputOptions({title:"Open Workbook from the Web",description:"Enter the web address for the workbook to open.",inputLabel:"Address",initialValue:"https://www.sheetxl.com/examples/features-checklist.xlsx",inputProps:{style:{minWidth:"440px"}},options:["Open"]});if(oe.option!=="Open")return;Y=oe.input}Y&&console.log("openWorkbookFromUrl",Y)})));let ae=[];return ee&&(ae=[new k.Command("themeMode",ce,{label:"Light/Dark Mode",scopedLabels:{appearance:"Light/Dark Mode"},description:"Toggle the application styling between light and dark mode."}),new k.Command("defaultThemeMode",ce,{label:"Use System Light/Dark Mode",scopedLabels:{appearance:"Use System Default"},description:"Use the system settings to determine styling for light and dark mode."}),new k.Command("enableDarkGrid",ce,{label:"Enable Dark Grid",description:"Allow the grid to render in dark mode if dark mode is being used. This is ensures that the grid will render the colors as specified in another tools (for example Excel)."}),new k.Command("enableDarkImages",ce,{label:"Enable Dark Images",description:"Allow the images to render in dark mode if dark mode is being used. This is ensures that the images will render the colors as specified in another tools (for example Excel). This only has any effect if the grid is in dark mode."})]),[...le,...ae,new k.SimpleCommand("help",ce,{label:"Show Help",description:"Provide Help.",shortcut:{key:"F1"}},()=>{}),new k.SimpleCommand("showKeyboardShortcuts",ce,{label:"Keyboard Shortcuts",description:"Show keyboard shortcuts.",shortcut:{key:"/",modifiers:[k.KeyModifiers.Ctrl]}},()=>{}),new k.Command("gotoUrlGithub",ce,{label:"Github",description:"Download examples, explore source code, and leave a star."},()=>{window?.open("https://github.com/sheetxl/sheetxl")}),new k.Command("gotoUrlDiscord",ce,{label:"Discord",description:"Join our community on discord."},()=>{window?.open("https://discord.gg/NTKdwUgK9p")}),new k.Command("gotoUrlDocumentation",ce,{label:"Documentation",description:"Read the documentation."},()=>{window?.open("https://www.sheetxl.com/docs")}),new k.Command("gotoUrlIssue",ce,{label:"Create Issue",description:"Create an issue to identify a bug or a feature request."},()=>{window?.open("https://github.com/sheetxl/sheetxl/issues")})]},[N,q,_,X,ee,z,K]),$=r.useMemo(()=>{let le=null;return le=z?z.createChildGroup(ce,"standaloneWorkbook",!1):new k.CommandGroup(ce,"standaloneWorkbook"),le.addCommands(Q,!0),le},[z,Q]);k.useUndoManager({manager:K,commands:$});const{themeMode:te}=o.useResolvedThemeMode();r.useEffect(()=>{if(!ee||!$)return;const le=ee.mode==="dark"||!ee.mode&&te==="dark";$.getCommand("themeMode").update({state:ee.mode??null,label:le?"Dark Mode":"Light Mode",scopedLabels:{appearance:le?"Dark Mode":"Light Mode"}}).updateCallback(()=>{re(le?o.ThemeMode.Light:o.ThemeMode.Dark)}),$.getCommand("defaultThemeMode").update({state:!ee.mode}).updateCallback(()=>{re(null)}),$.getCommand("enableDarkGrid").update({state:ee.enableDarkGrid}).updateCallback(()=>{xe(!ee.enableDarkGrid)}),$.getCommand("enableDarkImages").update({state:ee.enableDarkImages}).updateCallback(()=>{be(!ee.enableDarkImages)})},[te,ee,Q]);const{showModal:ue}=o.useModal();return r.useEffect(()=>{const le=()=>new Promise((ae,Y)=>{const oe=r.lazy(()=>Promise.resolve().then(()=>require("./D4c72fkCJiL-S_-a.cjs"))),pe=ue(oe,{title:"Shortcut Keys Reference",commands:$,onDone:()=>{pe.hide()},TransitionProps:{onExited:()=>{ae(!0)}}})});$.getCommand("showKeyboardShortcuts").updateCallback(()=>le()),$.getCommand("help").updateCallback(()=>le())},[Q,$]),$})({notifier:F,workbook:n,setWorkbook:t,importExportDisabled:p,workbookTitle:c,setWorkbookTitle:m,commands:f,requestWorkbookTitle:V=>new Promise(N=>{a.current?a.current.requestWorkbookTitle((R,_)=>{N(R)},{selectAll:!0,requestReason:V}):N(h)}),themeOptions:x,undoManager:d,onExecute:O});r.useEffect(()=>{y.starting.size<=0||!y.isMounted||C(V=>{const N=new Map(V.running);return V.starting.forEach((R,_)=>{const X=()=>{C(q=>{const U=new Map(q.running);return U.delete(_),{...q,running:U}})};N.set(_,X),R(X)}),{...V,starting:new Map,running:N}})},[y]);const[v,M]=r.useState(null);r.useEffect(()=>{y.starting.size!==0||y.running.size!==0?M(e.jsx(o.LoadingPanel,{icon:e.jsx(o.AnimatedTraversingEllipsisIcon,{sx:{transform:"scale(0.7)",marginLeft:"-6px"}}),panel:!0,label:y.label,onMount:b,onUnmount:w,sx:{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",zIndex:"9999"}})):M(null)},[y.starting,y.running]);const H=r.useMemo(()=>e.jsx(ia,{commands:P,disableHover:!0,sx:{padding:"0"},buttonProps:{sx:{maxHeight:"22px"}}}),[P]),A={commands:P};return n&&(A.statusBarProps={childrenEnd:H}),e.jsxs(k.NotifierProvider,{notifier:F,children:[v,i?r.cloneElement(i,A):null]})}));ol.displayName="SnackbarAndCommandsWrapper";const ao=r.memo(r.forwardRef((l,s)=>{const{className:n,sx:t,style:a,onElementLoad:c,onError:m,undoManager:h,errorPanel:i=o.ErrorPanel,onKeyDown:d,workbook:f,createWorkbookOptions:p,onWorkbookChange:x,logo:u,importExportDisabled:g=!1,themeOptions:S,autoFocus:y=!1,commands:C,title:b,onTitleChange:w,titleProps:j,renderLoadingPanel:T,...B}=l,I=r.useRef(null),D=k.useCallbackRef(x,[x]),F=k.useCallbackRef(w??j?.onTitleChange,[w??j?.onTitleChange]),O=j?.placeHolder??"Untitled",P=S?.mode,{themeMode:v,source:M}=o.useResolvedThemeMode({mode:P}),H=r.useMemo(()=>({...S,light:o.createExhibitTheme(!1,Fe.CommonUtils.deepMerge(S?.theme??{},S?.light??{})),dark:o.createExhibitTheme(!0,Fe.CommonUtils.deepMerge(S?.theme??{},S?.dark??{}))}),[S]),A=v===o.ThemeMode.Dark,[V,N]=r.useState(null);r.useEffect(()=>{N(h??new Fe.UndoManager)},[h]);const[R,_]=r.useState(null),[X,q]=r.useState(null),U=ie.useDocThemes();r.useLayoutEffect(()=>{if(!f||Object.keys(f).length===0&&!Fe.CommonUtils.isPromiseLike(f)){const Y={theme:U.getDefaultTheme(),...p};q(new L.Workbook(Y))}else q(f)},[f]),r.useLayoutEffect(()=>{if(X){if(X instanceof L.Workbook)return _({workbook:X}),void(f!==X&&D?.(X));(async()=>{try{let Y,oe=await Promise.resolve(X);oe&&oe.source&&(oe=await Ve.read(oe)),oe.workbook?(J(oe.title),Y=oe.workbook):Y=oe,D?.(Y),_({workbook:Y})}catch(Y){D?.(null),_({error:Y})}})()}},[X]);const[Z,ee]=r.useState(null);r.useEffect(()=>{if(!V||!R)return;V.clear();const Y=R?.workbook?.getTransactions();if(Y)return Y.addListener({onCommitEnd:oe=>{oe.getDescription()?V.addUndoOperation({description:oe.getDescription(),undo:()=>(Y.revert(oe.getId()),Z.source?.focus(),()=>{Y.restore(oe.getId()),Z.source?.focus()})}):console.warn("commit has no description",oe)}})},[V,R,Z]);const K=k.useCallbackRef(Y=>{Y?V.setRepeatableOperation({description:Y.label(),repeat:async()=>Y.execute()}):V.setRepeatableOperation(null)},[V]),[z,J]=r.useState(b??j?.title??"");r.useEffect(()=>{J(b??j?.title??"")},[b??j?.title]),r.useEffect(()=>{F?.(z)},[z]);const[re,xe]=r.useState(null),be=r.useMemo(()=>{const Y=()=>({contains:oe=>!0,focus(){}});return C?C.createChildGroup(Y,"application",!1):new k.CommandGroup(Y,"application")},[C]),ye=k.useCallbackRef(Y=>{xe(Y.source.getViewportElement()),ee(Y),be.activate("sheet"),c?.(Y)},[be]);r.useEffect(()=>{Z&&y&&Z.source?.focus(typeof y=="object"?y:void 0)},[Z]);const Be=r.useRef(null),ce=r.useCallback(Y=>{let oe=null;return j?.hidden||(oe=e.jsx(un,{...j,style:{maxWidth:"100%",...j?.style},workbook:I.current,ref:Be,title:z,placeHolder:O,onTitleChange:pe=>{J(pe)}})),e.jsx(tl,{...Y,logo:u,mainElement:oe,showFileMenu:!g,showAppearanceMenu:!!(H?.onEnabledDarkGridChange||H?.onEnabledDarkImagesChange||H?.onModeChange)})},[u,z,j,H,g,be]);r.useEffect(()=>{const Y=oe=>oe.preventDefault();return I.current?.addEventListener("wheel",Y,{passive:!1}),()=>{I.current?.removeEventListener("wheel",Y)}},[]);const Q=r.useMemo(()=>{const Y={transparentBackground:!0};return e.jsx(E.Box,{sx:t,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",...a},children:T?.(Y)??e.jsx(o.LoadingPanel,{...Y})})},[t,a,T]),$=r.useCallback(({error:Y})=>(m?.(Y),e.jsx(i,{sx:t,style:a,error:Y??"Unable to display empty workbook."})),[t,a,m]),te=r.useMemo(()=>({...t,"& .SnackbarContainer-root":{position:"absolute !important"},"& .notistack-SnackbarContainer > div":{maxWidth:"100%"},"& .notistack-Snackbar":{minWidth:"unset"},"& .notistack-Snackbar > .error-snackbar .MuiTypography-root":{color:Y=>Y.palette.getContrastText(Y.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiCardActions-root":{color:Y=>Y.palette.getContrastText(Y.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root":{color:Y=>Y.palette.getContrastText(Y.palette.error.main)},"& .notistack-MuiContent *":{fontFamily:Y=>Y.typography.fontFamily},"& #notistack-snackbar":{maxWidth:"560px",whiteSpace:"pre-wrap"},"*":{userSelect:"none"}}),[t]),ue=Nt([I,s]),le=r.useMemo(()=>{if(!R)return Q;if(R.error||!R.workbook)return $({error:R.error});let Y=null,oe=null,pe=!1;return H&&(Y=A?H.dark:H.light,oe=A&&H.enableDarkGrid?H.dark:H.light,pe=H.enableDarkImages),e.jsx(mn,{sx:te,style:a,tabIndex:0,autoFocus:!0,workbook:R.workbook,ref:ue,renderToolbar:ce,onElementLoad:ye,onRepeatCommandChange:K,onKeyDown:se=>{d?.(se)},renderLoadingPanel:T,gridTheme:oe,headersTheme:Y,enableDarkImages:pe,className:ge(n,"sheetxl-workbook"),onContextMenu:se=>se.preventDefault(),...B},"WorkbookElement")},[R,z,V,Q,T,H,B,ce,te]);let ae=e.jsx(Bi,{fallbackRender:$,children:e.jsx(ts,{maxSnack:3,domRoot:re,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(Y,oe,pe)=>{I.current?.focus()},Components:{error:Qa},iconVariant:{success:e.jsx(E.SvgIcon,{style:{marginRight:"8px"},children:e.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"})}),error:e.jsx(o.ErrorAlertIcon,{style:{marginRight:"8px"}})},children:e.jsx(o.ModalProvider,{children:e.jsx(ol,{workbook:R?.workbook,setWorkbook:q,importExportDisabled:g,titlePlaceHolder:O,titleWorkbook:z,setWorkbookTitle:J,refWorkbookTitle:Be,commands:be,undoManager:V,themeOptions:H,children:le})})})});return H&&(ae=e.jsxs(G.ThemeProvider,{theme:A?H.dark:H.light,children:[H.cssBaseline?e.jsx(E.CssBaseline,{}):null,ae]})),ae}));ao.displayName="EagerStudio";const as=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:ao,default:ao},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=la,exports.AutoColorPosition=dt,exports.BorderCommandButton=Ar,exports.BorderPopupButton=Nr,exports.BorderStyleButton=Fr,exports.Checkboard=Pr,exports.ClearCommandButton=Vo,exports.ColorButton=lo,exports.ColorCommandButton=ut,exports.ColorPanel=Dr,exports.ColorPanelType=Mr,exports.ColorPopupButton=Wo,exports.DeleteCellsCommandButton=Uo,exports.DocThemeCommandButton=aa,exports.EagerStudio=ao,exports.FillCommandButton=Vr,exports.FilterColumnMenu=en,exports.FilterCommandButton=Vl,exports.Filters=ya,exports.FindCommandButton=Hr,exports.FontFamilyCommandButton=_r,exports.FontSizeCommandButton=zr,exports.FormulaBar=Qo,exports.FreezeCommandButton=Lr,exports.HelpCommandButton=ia,exports.HorizontalAlignCommandButton=Er,exports.InsertCellsCommandButton=$o,exports.InsertFunctionCommandPopupButton=ca,exports.InsertFunctionSumCommandPopupButton=sa,exports.InsertImageCommandButton=Go,exports.InsertScriptCommandButton=Ea,exports.MergeCommandButton=Or,exports.NamedCollectionEditor=Jo,exports.NamedInput=ua,exports.NumberFormatCommandButton=Wr,exports.PasteCommandButton=qo,exports.PresetCellStylesCommandButton=Zr,exports.PresetTableStylesCommandButton=ta,exports.RangeInput=pa,exports.RunScriptCommandButton=sn,exports.ScriptEditorToolbar=an,exports.ScriptWorkspace=ln,exports.SheetTab=tn,exports.SheetTabMenu=on,exports.SheetZoomScale=Xo,exports.SheetsAllMenu=nn,exports.SortFilterCommandButton=_o,exports.StatusBar=Yo,exports.Studio=La,exports.StyledStrokeIcon=No,exports.TableStyleCanvasPreview=ea,exports.TableStyleOptionsPanel=_l,exports.TableStylePreview=Qr,exports.TextEffectsCommandButton=Kr,exports.TextOverflowCommandButton=Ir,exports.TextRotateCommandButton=Rr,exports.ThemeSelectButton=oa,exports.ThemeSelectPanel=na,exports.ThemeSelectPopupButton=ra,exports.UnderlineCommandButton=qr,exports.UndoRedoCommandButton=Ko,exports.VerticalAlignCommandButton=Br,exports.ViewGridLinesCommandButton=$r,exports.ViewHeadingsCommandButton=Gr,exports.WalkingCopyCommandButton=io,exports.WorkbookContextMenu=dn,exports.WorkbookElement=mn,exports.WorkbookIO=Ve,exports.WorkbookStrip=cn,exports.WorkbookTitle=un,exports.WorkbookViewCommandButton=Xr,exports._WorkbookIO=Ja,exports._extends=oo,exports._objectWithoutPropertiesLoose=rn,exports._setPrototypeOf=no,exports.clsx=$e,exports.clsx$1=ge,exports.commonjsGlobal=st,exports.createGridStyleFromMUITheme=Lo,exports.defaultNewWorkbook=Aa,exports.getDefaultExportFromCjs=function(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l},exports.requirePropTypes=Ft,exports.setPrintExamplesOnLoad=l=>{Ca=l},exports.useMeasure=pt,exports.useWorkbookCommands=Na;