@sheetxl/studio-mui 0.7.14 → 0.7.15

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 (38) hide show
  1. package/browser/cjs/{DqwSkMX3TSwbvSfO.cjs → BIVHB4D4Gd1WeeLi.cjs} +8 -8
  2. package/browser/cjs/{Ij3b1ONhNaWLtkRT.cjs → BaYmI4hURso6vppd.cjs} +2 -2
  3. package/browser/cjs/{CYMqmv5IamB1x14k.cjs → BbIg9meUh8UPbj5t.cjs} +3 -3
  4. package/browser/cjs/{CHc92OjHJrS2B3rB.cjs → BrHqwHQYxx_QoXOn.cjs} +2 -2
  5. package/browser/cjs/{CAxeR5WYtM_OKUqg.cjs → Caqz5dZzQdiFjnRX.cjs} +2 -2
  6. package/browser/cjs/{CC-q_GCvhI_uweI4.cjs → DGqqkGBv1nc0eMrE.cjs} +1 -1
  7. package/browser/cjs/{CwHuP4ot4XxM1FbL.cjs → DzrSXv2CLKkFc2iG.cjs} +2 -2
  8. package/browser/cjs/{CN5q08lr4Coj9gzy.cjs → NsGloilMLNL8CAF_.cjs} +1 -1
  9. package/browser/cjs/{-SJdVflEYXFC2raH.cjs → awYqXNcQZFnOqrrv.cjs} +1 -1
  10. package/browser/cjs/{NpKL7qsDwzMarfjO.cjs → byyZab6_Rq6ZwIYg.cjs} +1 -1
  11. package/browser/cjs/index.cjs +2 -2
  12. package/browser/cjs/{BE0n-qrL7I0lr2f8.cjs → ivFORJI1ljTPQpJ2.cjs} +1 -1
  13. package/browser/cjs/{DjU4LQ7p0jFx8PsW.cjs → tvv7jDqgAa8czbFA.cjs} +1 -1
  14. package/browser/esm/{BzkODf-EDNHsbeYC.mjs → 5qhzMLdi7OBuLx6W.mjs} +1 -1
  15. package/browser/esm/{D8YtOXZWnL-YI48g.mjs → B9PEZFokQCC6zWwX.mjs} +451 -451
  16. package/browser/esm/{Cd127EllJy0H1x8s.mjs → BPgEvjsqtBt1B2oO.mjs} +3 -3
  17. package/browser/esm/{BlDN4JPF9n_TeCyQ.mjs → BZduiiKwWAowYSJN.mjs} +2 -2
  18. package/browser/esm/{aWQ7-rGmyvVU_nRK.mjs → C5hFZQeTMy4agdCE.mjs} +2 -2
  19. package/browser/esm/{CfkKWfDbYhDDort6.mjs → CDCURsqip4PNsKB-.mjs} +2 -2
  20. package/browser/esm/{DezB6LbrlA_MqNpH.mjs → CM0ti_Ro-ofiPiXw.mjs} +1 -1
  21. package/browser/esm/{BzS-7g64cdTk8pFd.mjs → DA9w10YtGRm1py3s.mjs} +1 -1
  22. package/browser/esm/{XGwUZoREuZ029cPM.mjs → DC4JZaW8S6fOywMr.mjs} +1 -1
  23. package/browser/esm/{BLiSCviFgWhD9SmC.mjs → DDCEwJwqSNFJukUi.mjs} +1 -1
  24. package/browser/esm/{DlZXGLXt7KBqpCgX.mjs → DduI_lE9r-_xxx2i.mjs} +2 -2
  25. package/browser/esm/{BNF5wwVTFO0bKhDb.mjs → ZdlfLFFcDkayt99n.mjs} +1 -1
  26. package/browser/esm/index.mjs +2 -2
  27. package/node/esm/{CM8Jkahi0myGVt_v.mjs → BXf4P001RgMA5mab.mjs} +1 -1
  28. package/node/esm/{B6-CF_32FCaDZJDm.mjs → BqynBoGwxZpdEh30.mjs} +1 -1
  29. package/node/esm/{C8TcDhw9hCrJxqfJ.mjs → ByMXScn3ChpsqcAb.mjs} +1 -1
  30. package/node/esm/{C62EF6LSsPD4LAL6.mjs → By_L4EWHTADEr1Le.mjs} +1 -1
  31. package/node/esm/{4D3fLVzYqPTas9nR.mjs → C0dHRankOSZU4PNG.mjs} +1 -1
  32. package/node/esm/{xCdMLxN5xcpczFUI.mjs → D9ZBRNgjCgvdTHiX.mjs} +1 -1
  33. package/node/esm/{D9PLpUGQqMmk1V9n.mjs → DCsofbikio_bDbqi.mjs} +1 -1
  34. package/node/esm/{CeJ5myvgfYOUSKGq.mjs → DL58IAMOmJKHu2ka.mjs} +1 -1
  35. package/node/esm/{C21w0yQGlygcFqHI.mjs → DhGAUFPxQRjIn4QH.mjs} +1 -1
  36. package/node/esm/{CREPL1yvIjmYpU-r.mjs → N3PqbkXORQ3Qfzls.mjs} +1 -1
  37. package/node/esm/index.mjs +132 -132
  38. package/package.json +8 -8
@@ -1,20 +1,20 @@
1
1
  "use strict";var Di=Object.create;var Bn=Object.defineProperty;var Fi=Object.getOwnPropertyDescriptor;var Ii=Object.getOwnPropertyNames;var Ni=Object.getPrototypeOf,Oi=Object.prototype.hasOwnProperty;var Ai=(a,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Ii(i))!Oi.call(a,r)&&r!==o&&Bn(a,r,{get:()=>i[r],enumerable:!(t=Fi(i,r))||t.enumerable});return a};var Rn=(a,i,o)=>(o=a!=null?Di(Ni(a)):{},Ai(i||!a||!a.__esModule?Bn(o,"default",{value:a,enumerable:!0}):o,a));/**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.15
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
6
- */const A=require("@sheetxl/sdk"),oe=require("@sheetxl/react"),e=require("react/jsx-runtime"),n=require("react"),B=require("@mui/material"),y=require("@sheetxl/utils-mui"),w=require("@sheetxl/utils-react"),q=require("@mui/material/styles"),Re=require("@mui/system"),Je=require("react-dom"),je=require("@sheetxl/utils"),ct=require("@sheetxl/io");function ka(a){var i,o,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a)){var r=a.length;for(i=0;i<r;i++)a[i]&&(o=ka(a[i]))&&(t&&(t+=" "),t+=o)}else for(o in a)a[o]&&(t&&(t+=" "),t+=o);return t}function ie(){for(var a,i,o=0,t="",r=arguments.length;o<r;o++)(a=arguments[o])&&(i=ka(a))&&(t&&(t+=" "),t+=i);return t}const va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...p}=a,l=w.useCommands(o,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),c=n.useMemo(()=>{for(let f=0;f<l.length;f++)if(l[f]?.state())return l[f];return l[0]},[l]),g=n.useMemo(()=>{if(!t)return null;const f={...t};return delete f.beforeExecute,f},[t]),C=n.useCallback((f,u)=>{const m={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignLeftToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignCenterToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignRightToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignJustifyToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignCenterContinuousToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignFillToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignDistributedHorizontalToggle")})]}),S=e.jsxs(B.Box,{sx:{className:ie("quick-buttons"),display:"flex",alignItems:"center",justifyContent:"center"},onClick:h=>h.stopPropagation(),children:[e.jsx(y.CommandButton,{command:u.getCommand("formatIndentDecrease"),commandHook:g,scope:r,disabled:s}),e.jsx(y.CommandButton,{command:u.getCommand("formatIndentIncrease"),commandHook:g,scope:r,disabled:s})]}),x=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...p,children:[S,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:b})]});return y.defaultCreatePopupPanel({...f,children:x})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,commands:o,commandHook:t,scope:r,createPopupPanel:C,label:"Horizontal Alignment",tooltip:"Configure how text is placed in the horizontal direction of the cell.",quickCommand:c?.key(),icon:c?.icon()??"FormatAlignLeft",...p})})),ja=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),{activeCommand:l,allDisabled:c}=n.useMemo(()=>{const C=p.length;let f,u=0;for(let m=0;m<C;m++){const b=p[m];b&&!b.disabled()&&(!f&&b?.state()&&(f=b),u++)}return f=f??p[0],{activeCommand:f,allDisabled:u===0}},[p]),g=n.useCallback((C,f)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignTopToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignMiddleToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignBottomToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignJustifyVerticalToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignDistributedVerticalToggle")})]});return y.defaultCreatePopupPanel({...C,children:m})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:g,disabled:s||c,label:"Vertical Alignment",tooltip:"Configure how text is placed in the vertical direction of the cell.",icon:l?.icon()??"TextVerticalBottom",...d})})),Ta=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),{activeCommand:l,allDisabled:c}=n.useMemo(()=>{const C=p.length;let f,u=0;for(let m=0;m<C;m++){const b=p[m];b&&!b.disabled()&&(!f&&b?.state()&&(f=b),u++)}return f=f??p[0],{activeCommand:f,allDisabled:u===0}},[p]),g=w.useCallbackRef((C,f)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowVisibleToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowWrapToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowClipToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowShrinkToggle")})]});return y.defaultCreatePopupPanel({...C,children:m})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,disabled:s||c,scope:r,label:"Text Overflow",tooltip:"Configure how text behaves when it doesn't fit within a cell.",createPopupPanel:g,icon:l?.icon()??"TextHorizontalOverflow",...d})})),Ea=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),l=n.useMemo(()=>{const C=p.length;for(let f=0;f<C;f++){const u=p[f];if(u?.state())return u}return p[1]},[p]),c=n.useCallback((C,f)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate0")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate315")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate45")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate90")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate270")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.InputCommandButton,{...u,command:f.getCommand("formatTextRotateCustom"),label:"Custom"})]});return y.defaultCreatePopupPanel({...C,children:m})},[s,t,r,o]),g=n.useMemo(()=>(o.getCommand("formatTextRotateCustom")?.state()??0)!==0,[p]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,selected:g,label:"Text Orientation",tooltip:"Rotate your text diagonally or vertically. This is a great way to label narrow columns.",createPopupPanel:c,quickCommand:g?"formatTextRotate0":"formatTextRotate315",icon:l?.icon()??"TextRotation315",...d})})),Ba={Preset:"preset",Custom:"custom"},mt={Start:"start",End:"end"},xo={},Li=(a,i,o,t)=>{const r=a+"-"+i+"-"+o+(t?"-server":"");if(xo[r])return xo[r];const s=((d,p,l,c)=>{if(typeof document>"u"&&!c)return null;const g=c?new c:document.createElement("canvas");g.width=2*l,g.height=2*l;const C=g.getContext("2d");return C?(C.fillStyle=d,C.fillRect(0,0,g.width,g.height),C.fillStyle=p,C.fillRect(0,0,l,l),C.translate(l,l),C.fillRect(0,0,l,l),g.toDataURL()):null})(a,i,o,t);return xo[r]=s,s},zi={},Ra=n.memo(a=>{const{className:i,style:o=w.ReactUtils.EmptyCssProperties,white:t="transparent",grey:r="grey",size:s=8,borderRadius:d,boxShadow:p,renderers:l=zi,children:c,...g}=a,C=c,f=n.useMemo(()=>Object.assign({borderRadius:d,boxShadow:p,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Li(t,r,s,l?.canvas)}) center left`},o),[t,r,s,l]);return n.isValidElement(c)?n.cloneElement(c,{...C.props}):e.jsx("div",{style:f,...g})}),Hi=n.memo(a=>{const{selectedColor:i,onSelectColor:o,onPreviewColor:t,onClick:r,onKeyDown:s,onMouseOver:d,onMouseLeave:p,onFocus:l,style:c=w.ReactUtils.EmptyCssProperties,children:g,alphaWhite:C,alphaGrey:f,darkMode:u,alphaCheckSize:m=7,...b}=a;if(!i)throw new Error("a selectedColor is required");const S=n.useCallback(T=>{r?.(T),T.isDefaultPrevented()||(T.ctrlKey?t?.(i.toRGBA()):o?.(i.toRGBA()))},[o,t,r,i]),x=n.useCallback(T=>{d?.(T),T.isDefaultPrevented()||t?.(i.toRGBA())},[t,d,i]),h=n.useCallback(T=>{p?.(T),T.isDefaultPrevented()},[t,p]),k=n.useCallback(T=>{l?.(T),T.isDefaultPrevented()||t?.(i.toRGBA())},[t,l,i]),j=n.useCallback(T=>{s?.(T),T.isDefaultPrevented()||T.keyCode===w.KeyCodes.Enter&&o?.(i.toRGBA())},[o,s,i]),v=n.useMemo(()=>i.toRGBA().alpha===1?null:e.jsx(Ra,{size:m,white:C,grey:f,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[C,f,i]);return e.jsxs("div",{style:{position:"absolute",height:"100%",width:"100%",top:"0px",left:"0px",cursor:"pointer",outline:"none",...c},tabIndex:0,...b,onClick:S,onKeyDown:j,onMouseOver:x,onMouseLeave:h,onFocus:k,children:[v,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:i.toCSS(u)},children:g})]})}),io=n.memo(a=>{const{schemeColorLookup:i,selectedColor:o,previewColor:t,colorDef:r,onSelectColorDef:s,onPreviewColorDef:d,swatchProps:p,defaultButtonSize:l=24,isLarge:c=!1,compareRGB:g=!1,darkMode:C=!1,...f}=a,u=new A.Color({val:r.definition.val,adjs:r.definition.adjs},v=>i(v)),m=g?u.toRGBA().toString():u.toString(),b=o&&(g?o.toRGBA().toString():o.toString())===m,S=t&&(g?t.toRGBA().toString():t.toString())===m,x=[];x.push({[A.IColor.AdjustmentType.Inv]:!0}),x.push({[A.IColor.AdjustmentType.Alpha]:100});const h=u.adjust(x),k=n.useCallback(()=>{s?.(r)},[s,r]),j=n.useCallback(v=>{d?.(v?r:null)},[d,r]);return e.jsx(y.SimpleTooltip,{disableInteractive:!0,PopperProps:{style:{pointerEvents:"none"},disablePortal:!0,popperOptions:{strategy:"fixed",modifiers:[{name:"preventOverflow",enabled:!0,options:{boundariesElement:"viewport"}}]}},title:r.description,placement:"bottom-start",children:e.jsx("div",{style:{width:l*(c?1.2:1)+"px",height:l*(c?1.2:1)+"px",position:"relative",boxSizing:"border-box",cursor:"pointer",outline:"none"},...f,children:e.jsxs(Hi,{selectedColor:u,title:null,onSelectColor:k,onPreviewColor:j,alphaCheckSize:c?9:void 0,darkMode:C,...p,children:[e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",top:"0px",left:"0px",pointerEvents:"none",borderColor:h.toRGBA(C).toString(),borderWidth:"2px",borderStyle:"solid",boxSizing:"border-box",opacity:b?"1":"0"}}),e.jsx("div",{style:{position:"absolute",width:.33*l*(c?1.2:1)+"px",height:.33*l*(c?1.2:1)+"px",left:"calc(50% - 0.5px)",top:"calc(50% - 0.5px)",transform:"translate(-50%,-50%)",pointerEvents:"none",background:h.toRGBA(C).toString(),borderRadius:"50%",opacity:S?"1":"0"}})]})})})}),Dt=n.memo(a=>{const{title:i,schemeColorLookup:o,colorDefs:t,selectedColor:r,previewColor:s,onSelectColorDef:d,onPreviewColorDef:p,style:l=w.ReactUtils.EmptyCssProperties,compareRGB:c=!1,darkMode:g,swatchProps:C,...f}=a;let u;if(Array.isArray(t[0]))u=t;else{u=[];for(let h=0;h<t.length;h++)u.push([t[h]])}const m=n.useCallback(h=>{d?.(h)},[d]),b=n.useCallback(h=>{p?.(h)},[p]),S=n.useMemo(()=>{let h=[];for(let k=0;k<u.length;k++){let j=[],v=u[k];for(let M=0;M<v.length;M++){let P=v[M];j.push(e.jsx(io,{schemeColorLookup:o,colorDef:P,selectedColor:r,previewColor:s,onSelectColorDef:m,onPreviewColorDef:b,swatchProps:C,compareRGB:c,darkMode:g},k+" "+M))}let T=e.jsx(B.Box,{className:"button-col",sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",boxShadow:M=>M.shadows[2],borderRadius:"2px",overflow:"hidden"},children:j},""+k);h.push(T)}return h},[u,r,s,m,b]),x=n.useMemo(()=>i?e.jsx(B.Typography,{noWrap:!0,component:"div",sx:{display:"flex",flexShrink:"0",paddingLeft:"6px",paddingBottom:"4px",paddingTop:"0px",userSelect:"none",color:h=>h.palette.text.secondary},children:i}):null,[i]);return e.jsxs(B.Box,{style:{...l},children:[x,e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...f,children:S})]})}),Me=(a,i)=>({description:a,definition:{val:i,adjs:[]}}),ge=(a,i,o,t,r,s)=>{const d=Me(a,i);t?.push(d);const p=new A.Color({val:d.definition.val,adjs:d.definition.adjs},o),l=p.toString();r?.set(l,p);const c=p.toRGBA().toString();s?.set(c,p)},Wi=n.lazy(()=>Promise.resolve().then(()=>require("./CHc92OjHJrS2B3rB.cjs"))),Pa=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o=null,previewColor:t=a.selectedColor??null,recentColors:r,schemeLookup:s,disableAlpha:d=!1,previewDebounceTime:p=100,initialPanelType:l,defaultButtonSize:c=24,width:g,onElementLoad:C,onDone:f,onEyeDropStart:u,onEyeDropStop:m,onPreviewColor:b,onPreviewColorImmediate:S,onSelectColor:x,autoColor:h,autoColorLabel:k="Automatic",autoColorPosition:j=mt.Start,compareRGB:v=!1,darkMode:T=!1,...M}=a,P=t||o,D=w.useCallbackRef(b,[b]),F=w.useCallbackRef(S,[S]),E=w.useCallbackRef(x,[x]),R=w.useCallbackRef(u,[u]),N=w.useCallbackRef(m,[m]),[z,O]=n.useState(!1),H=q.useTheme(),I=n.useMemo(()=>s||A.Color.getDefaultSchemeLookup(),[s]),W=n.useMemo(()=>{const K=new Map,te=new Map,de=[];ge("Primary Background","bg1",I,de,K,te),ge("Primary Text","tx1",I,de,K,te),ge("Secondary Background","bg2",I,de,K,te),ge("Secondary Text","tx2",I,de,K,te),ge("Accent 1","accent1",I,de,K,te),ge("Accent 2","accent2",I,de,K,te),ge("Accent 3","accent3",I,de,K,te),ge("Accent 4","accent4",I,de,K,te),ge("Accent 5","accent5",I,de,K,te),ge("Accent 6","accent6",I,de,K,te);const ve=A.ITheme.buildPalette(de,I,K,te),se=[];if(ge("Dark Red","C00000",I,se,K,te),ge("Red","FF0000",I,se,K,te),ge("Orange","FFC000",I,se,K,te),ge("Yellow","FFFF00",I,se,K,te),ge("Light Green","92D050",I,se,K,te),ge("Green","00B050",I,se,K,te),ge("Light Blue","00B0F0",I,se,K,te),ge("Blue","0070C0",I,se,K,te),ge("Dark Blue","002060",I,se,K,te),d?ge("Purple Is A Fruit","7030A0",I,se,K,te):ge("Transparent","00000000",I,se,K,te),h){const ue=h.toString();K.set(ue,h)}const De=new Map,Te=typeof r=="function"?r():r,Ne=[];for(let ue=0;Te&&ue<Te.length;ue++){const Z=Te[ue].toString();De.set(Z,Te[ue]),Ne.push({description:"Recent "+(ue+1),definition:{val:Te[ue].toString()}})}return{primaryColors:de,modifiedPresets:ve,standardColors:se,recentColorsLimited:Ne,mapAllPresets:K,mapAllPresetsRGB:te,mapRecent:De}},[I,r,d,h]);n.useEffect(()=>{C?.()},[]);const[ee,X]=n.useState(!1),ne=n.useCallback(()=>{X(K=>!K)},[]);n.useEffect(()=>{if(l)X(l===Ba.Custom);else if(o){let K=o.toString(),te=W.mapAllPresets.get(K);te||(K=o.toRGBA().toString(),te=W.mapAllPresetsRGB.get(K));const de=W.mapRecent.get(K);X(!te&&!de)}},[o,l]);const $=n.useCallback(A.CommonUtils.debounce(K=>{D?.(K)},p),[D,p]),[U,Y]=n.useState();n.useEffect(()=>{Y(t||o)},[t,o]);const _=w.useCallbackRef(K=>{F&&(F(K),$(K))},[F]),L=w.useCallbackRef(K=>{_(K?new A.Color({val:K.definition.val,adjs:K.definition.adjs},I):null)},[I]),G=n.useCallback(K=>{K.ctrlKey&&X(!0)},[]),Q=w.useCallbackRef(K=>{let te=!1;if(K){const de=K.toString();te=!W.mapAllPresets.has(de)}E?.(K,te)},[E,W]),fe=w.useCallbackRef(K=>{const te=K?new A.Color({val:K.definition.val,adjs:K.definition.adjs},I):null;Promise.resolve(f?.()).then(()=>{Q(te)})},[I,f]),re=w.useCallbackRef(K=>{_(K?new A.Color(K,I):null)},[I]),me=n.useMemo(()=>window.EyeDropper===void 0?e.jsx(e.Fragment,{}):e.jsx(B.IconButton,{"aria-label":"eye dropper",size:"small",sx:{color:K=>K.palette.text.icon??K.palette.action.active},onClick:async()=>{O(!0),R?.(),await new EyeDropper().open().then(K=>{O(!1),N?.();let te=new A.Color(K.sRGBHex),de=te.toString(),ve=W.mapAllPresets.get(de);if(ve||(de=te.toRGBA().toString(),ve=W.mapAllPresetsRGB.get(de)),!ve){const se=te.toRGBA(),De=3;let Te=255;W.mapAllPresetsRGB.forEach((Ne,ue)=>{const Z=Ne.toRGBA(),le=Math.abs(Z.red-se.red)+Math.abs(Z.blue-se.blue)+Math.abs(Z.green-se.green);le<De&&le<Te&&(ve=Ne)})}X(!ve),_(ve||te)}).catch(K=>{O(!1),K?.name!=="AbortError"&&console.error(K)})},children:e.jsx(w.DynamicIcon,{iconKey:"Colorize"})}),[W,T]),Se=n.useMemo(()=>{if(!ee)return;const K={opacity:ee?1:"0",position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box"};return e.jsx(n.Suspense,{fallback:e.jsx("div",{style:K,children:e.jsx(y.LoadingPanel,{})}),children:e.jsx(Wi,{style:K,selectedColor:P?P.toRGBA().toString():"transparent",onColorChange:re,disableAlpha:d})})},[ee,P]),Ce=n.useMemo(()=>({onClick:G,alphaGrey:H.palette.text.icon??H.palette.action.active}),[G,H]),J=n.useMemo(()=>{if(!h)return null;const K={description:k,definition:{val:h.getVal(),adjs:h.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(B.MenuItem,{sx:{display:"flex",color:te=>te.palette.text.secondary},onMouseOver:()=>{L(null)},onClick:()=>{fe(null)},children:[e.jsx(B.Box,{sx:{flex:"none",boxShadow:te=>te.shadows[2],borderRadius:te=>te.spacing(.5),overflow:"hidden"},children:e.jsx(io,{schemeColorLookup:I,colorDef:K,selectedColor:o===null?h:o,previewColor:t===null?h:t,defaultButtonSize:c,isLarge:!0,darkMode:T,compareRGB:v,swatchProps:Ce})}),e.jsx(B.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:k})]})})},[h,k,I,o,t]);return e.jsxs(B.Box,{ref:i,sx:{width:g,outline:"none",padding:"10px 10px",overflow:"hidden",boxSizing:"content-box"},...M,children:[e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("div",{style:{opacity:ee?"0":1},children:[J&&j===mt.Start?e.jsxs(e.Fragment,{children:[J,e.jsx(B.Divider,{light:!0,style:{marginTop:"2px",marginBottom:"10px"}})]}):null,e.jsx(Dt,{title:"Theme Colors",schemeColorLookup:I,colorDefs:W.primaryColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T}),e.jsx(Dt,{schemeColorLookup:I,colorDefs:W.modifiedPresets,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T}),e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Standard Colors",schemeColorLookup:I,colorDefs:W.standardColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T}),e.jsxs("div",{style:{opacity:W.recentColorsLimited.length===0?"0":void 0,display:W.recentColorsLimited.length===0?"none":void 0},children:[e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Recent Colors",schemeColorLookup:I,colorDefs:W.recentColorsLimited,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T})]}),J&&j===mt.End?e.jsxs(e.Fragment,{children:[e.jsx(B.Divider,{light:!0,sx:{marginTop:"2px",marginBottom:"2px"}}),J,e.jsx("div",{style:{marginBottom:"2px"}})]}):null]}),Se]}),e.jsx(B.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:[me,e.jsx("div",{style:{flex:"1 1 100%",background:"pink"}}),e.jsx(B.Button,{style:{minWidth:"75px",maxWidth:"75px"},value:"check",variant:"outlined",size:"small",onClick:()=>{ne()},children:ee?e.jsx("div",{children:"Preset"}):e.jsx("div",{children:"Custom"})}),e.jsx(B.Button,{variant:"contained",size:"small",style:{minWidth:"75px"},onClick:()=>{Promise.resolve(f?.()).then(()=>{Q(U)})},children:"Done"})]})]})})),$i=e.jsx(w.DynamicIcon,{iconKey:"circle.colored"}),Ao=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o,quickColor:t,icon:r=$i,tooltip:s,label:d,onPreviewColor:p,onPreviewColorImmediate:l,onSelectColor:c,variant:g=y.PopupButtonType.Toolbar,panelProps:C,shouldCloseFloatAll:f=!0,compareRGB:u=!1,darkMode:m=!1,...b}=a,S=w.useCallbackRef(p,[p]),x=w.useCallbackRef(l,[l]),h=w.useCallbackRef(c,[c]),[k,j]=n.useState(()=>{}),v=t||k||o||C?.autoColor,T=n.useRef(!1),M=n.useCallback(()=>{},[]),P=w.useCallbackRef(()=>{j(o)},[o]),D=w.useCallbackRef(W=>{T.current||(j(W),S?.(W))},[S]),F=w.useCallbackRef(W=>{T.current||(j(W),x?.(W))},[x]),E=w.useCallbackRef((W,ee)=>{T.current||(j(void 0),h?.(W,ee))},[h]),R=n.useMemo(()=>e.jsx(B.Box,{className:"color-wrapper",sx:{lineHeight:"0",color:"inherit","--sxl-color-active":`${v?.toCSS(m)??"transparent"}`,"& .activeColor":{fill:`${v?.toCSS(m)??"transparent"}`},"& .style_grey":{fill:W=>W.palette.text.icon??W.palette.action.active}},children:typeof r=="function"?r():r}),[v,r,m]),N=w.useCallbackRef(W=>{h?.(t,!1)},[h,t]),[z,O]=n.useState(!1),H=n.useCallback(W=>{const{closeFloat:ee,closeFloatAll:X}=W;return e.jsx(Pa,{...C,selectedColor:o,previewColor:k,onDone:f?X:ee,onKeyDown:ne=>{ne.which===w.KeyCodes.Enter&&(f?X():ee())},onPreviewColorImmediate:F,onPreviewColor:D,onSelectColor:E,onEyeDropStart:()=>O(!0),onEyeDropStop:()=>O(!1),compareRGB:u,darkMode:m})},[o,k,f,v,C?.autoColor,m]),I={onQuickClick:t?N:void 0,createPopupPanel:H,popupProps:{popperProps:{resizeOnOverflow:!1}},onPopupOpen:P,onPopupClose:M,tooltip:s||d||"Color",label:d,icon:R,...b};return g===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...I}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...I})})),eo=82,Mo=a=>{const{styleColor:i,length:o=eo,width:t=1,dashArray:r=null,sx:s,isDouble:d=!1,isAngled:p=!1,darkMode:l=!1,...c}=a;return e.jsx(B.SvgIcon,{sx:{width:`${o}px`,height:`${t}px`,color:"inherit",overflow:"visible","& .activeColor":{stroke:g=>`${i?i.toRGBA(l).toString():g.palette.text.icon??g.palette.action.active}`},"& .style_grey":{stroke:g=>g.palette.text.icon??g.palette.action.active},...s},height:t,width:o,viewBox:`0 0 ${o} ${t}`,...c,children:e.jsx(oe.StyledStrokePath,{length:o,width:t,dashArray:r,isDouble:d,isAngled:p,className:"activeColor"})})},Ma=n.memo(n.forwardRef((a,i)=>{const{variant:o,showLabels:t=!1,disabled:r=!1,createPopupPanel:s,styleColor:d,selectedStyle:p,onSelectStyle:l,showNone:c=!0,darkMode:g,sx:C,...f}=a,u=w.useCallbackRef(l,[]),m=n.useCallback(h=>{const{popupContainer:k,floatReference:j,closeFloat:v,...T}=h,M=[],P=A.IBorder.BuiltInDefinitionsArray;for(let D=0;D<P.length;D++){const F=P[D];if(F.description==="None"&&!c)continue;const E=e.jsx(Mo,{styleColor:d,length:eo,width:F.width,darkMode:g,dashArray:F.pattern,isDouble:F.description.toLowerCase().includes("double"),isAngled:F.description.toLowerCase().includes("slant")});let R=null;R=t?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{marginRight:"6px"},children:F.description}),e.jsxs(B.Box,{sx:{marginLeft:"6px",marginRight:"6px",display:"flex",alignItems:"center",flex:"1 1 100%"},children:[e.jsx("div",{style:{flex:"1 1 100%"}}),E]})]}):F.description==="None"?"None":E,M.push(e.jsx(y.ExhibitMenuItem,{className:"border-stroke",tabIndex:0,sx:{height:"28px","& svg path.activeColor":{filter:y.createStrokeShadowFilter(4)},paddingLeft:"16px",background:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},tooltipProps:{description:t?"":F.description},icon:null,disabled:r,onMouseDown:N=>N.preventDefault(),onMouseUp:()=>{v(),u(F.style)},onKeyDown:N=>{N.which===w.KeyCodes.Enter&&v()},selected:F.style===p,parentFloat:j,children:R},D))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:M})},[r,c,d,p,g]),b=n.useMemo(()=>{const h=A.IBorder.BuiltInDefinitions.get(p);let k;return k=h.description==="None"?e.jsx(B.Box,{sx:{minWidth:`${eo}px`},children:"None"}):e.jsx(Mo,{styleColor:d,length:eo,width:h.width,dashArray:h.pattern,darkMode:g,isDouble:h.description.toLowerCase().includes("double"),isAngled:h.description.toLowerCase().includes("slant")}),e.jsx(B.Box,{className:"border-stroke",sx:{paddingLeft:"12px",marginLeft:"4px",marginRight:"4px",height:"24px",display:"flex",alignItems:"center","& svg path.activeColor":{filter:y.createStrokeShadowFilter()}},children:k})},[p,d]),S=n.useMemo(()=>A.IBorder.BuiltInDefinitions.get(p),[p]),x={disabled:r,icon:b,tooltip:"Border Style: "+S.description,sx:{background:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,...C},createPopupPanel:m,...f};return o===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{...x}):e.jsx(y.ExhibitPopupMenuItem,{...x})})),Da=n.memo(n.forwardRef((a,i)=>{const{autoColor:o=null,schemeLookup:t,autoStrokeStyle:r=A.IBorder.StrokeStyle.Thin,disabled:s=!1,darkMode:d=!1,showStylingBefore:p=!0,onSelectBorder:l,onPreviewBorder:c,selectedBorder:g,createTemporaryBorder:C,...f}=a,u=w.useCallbackRef(l,[l]),m=w.useCallbackRef(c,[c]),[b,S]=n.useState(),[x,h]=n.useState(),k=b??r,j=x??o,v=g||{bottom:{style:r,color:o?.toString()}},T=w.useCallbackRef(R=>{const N={},z=R?Object.keys(R):[];let O=!1;const H=z.length;for(let Y=0;Y<H;Y++){const _=z[Y];R[_]?.style&&(N[_]={style:R[_].style,color:R[_].color},O||N[_].style===A.IBorder.StrokeStyle.None||(O=!0))}z.length<6&&(O=!0);const I=O?N.left:null,W=O?N.top:null,ee=O?N.right:null,X=O?N.bottom:null,ne=O?N.vertical:null,$=O?N.horizontal:null;let U="";return W||I||(U+="M 3,5 H 5 V 3 H 3 "),W||(U+="M 7,5 H 9 V 3 H 7 "),W||ne||(U+="M 11,5 h 2 V 3 h -2 "),W||(U+="M 15,5 h 2 V 3 h -2 "),W||ee||(U+="M 19,5 h 2 V 3 h -2 "),I||(U+="M 3,9 H 5 V 7 H 3 "),ne||(U+="M 11,9 h 2 V 7 h -2 "),ee||(U+="M 19,9 h 2 V 7 h -2 "),$||I||(U+="M 3,13 H 5 V 11 H 3 "),$||(U+="M 7,13 H 9 V 11 H 7 "),$||ne||(U+="M 11,13 h 2 v -2 h -2 "),$||ee||(U+="M 19,13 h 2 v -2 h -2 "),$||(U+="M 15,13 h 2 v -2 h -2 "),I||(U+="M 3,17 H 5 V 15 H 3 "),ne||(U+="M 11,17 h 2 v -2 h -2 "),ee||(U+="M 19,17 h 2 v -2 h -2 "),X||I||(U+="M 3,21 H 5 V 19 H 3 "),X||(U+="M 7,21 H 9 V 19 H 7 "),X||ne||(U+="M 11,21 h 2 v -2 h -2 "),X||(U+="M 15,21 h 2 v -2 h -2 "),X||ee||(U+="M 19,21 h 2 v -2 h -2 "),e.jsxs(w.DynamicIcon,{children:[" ",e.jsxs(B.Box,{className:"border-icon",sx:{width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",position:"relative","& .grid > path":{opacity:"0.8"}},children:[e.jsx("svg",{viewBox:"0 0 24 24",className:"grid",style:{top:"0px",left:"0px",width:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",height:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",position:"absolute"},children:e.jsx("path",{className:"fill",d:U})}),e.jsx(B.Box,{className:"border-container",sx:{position:"absolute",display:"flex",justifyContent:"stretch",alignItems:"stretch",top:"0px",left:"0px",width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",padding:"1px 1px","& svg path":{filter:y.strokeShadowFilter}},children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:(Y,_)=>{if(!C||z.length===0)return null;const L=Y.rowIndex,G=Y.colIndex,Q={};return L===0?(Q.top=N.top,Q.bottom=N.horizontal):(Q.top=N.horizontal,Q.bottom=N.bottom),G===0?(Q.left=N.left,Q.right=N.vertical):(Q.left=N.vertical,Q.right=N.right),C?.(Q)},darkMode:d,style:{top:"2px",left:"2px",width:"calc(100% - 5px)",height:"calc(100% - 5px)",position:"absolute"}})})]})]})},[j,k,d]),M=n.useCallback((R,N,z)=>{let O=null;if(R&&R.length>0){let H=null;(N||z)&&(H={style:z,color:N?.toString()??null}),O={};const I=R.length;for(let W=0;W<I;W++)O[R[W]]=H}return O},[]),P=n.useCallback(R=>{u?.(R)},[]),D=n.useCallback(R=>{m?.(R)},[]),F=n.useCallback(R=>{const{closeFloatAll:N,floatReference:z}=R,O=(W,ee,X="bottom",ne=!1)=>{const $=M(W,j??null,ne?A.IBorder.StrokeStyle.None:k??null),U=ne?M([],j??null,k??null):$;return e.jsx(y.ExhibitIconButton,{icon:T(U),sx:{background:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},tooltipProps:{label:ee,simple:!0,placement:X},onClick:()=>{N(),D($),P($)}})},H=e.jsxs(e.Fragment,{children:[e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"All Borders","top"),O([A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"Inner Borders","top"),O([A.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),O([A.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom],"Outside Borders","top")]}),e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left],"Left Borders"),O([A.IBorder.Edge.Top],"Top Borders"),O([A.IBorder.Edge.Right],"Right Borders"),O([A.IBorder.Edge.Bottom],"Bottom Borders"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical,A.IBorder.Edge.DiagonalUp,A.IBorder.Edge.DiagonalDown],"No Borders","bottom",!0)]})]}),I=e.jsx(e.Fragment,{children:e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",flexDirection:"row",gap:"6px"},children:[e.jsx(Ao,{variant:y.PopupButtonType.Toolbar,icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),selectedColor:k===A.IBorder.StrokeStyle.None?new A.Color("transparent"):j,onPreviewColor:W=>{h(W)},onSelectColor:(W,ee)=>{h(W)},darkMode:d,tooltip:"Border Color",panelProps:{disableAlpha:!0,autoColor:o,schemeLookup:t},disabled:s||k===A.IBorder.StrokeStyle.None,parentFloat:z,shouldCloseFloatAll:!1}),e.jsx(Ma,{selectedStyle:k,onSelectStyle:S,styleColor:j,darkMode:d,variant:y.PopupButtonType.Toolbar,parentFloat:z})]})});return e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},onClick:W=>W.stopPropagation(),children:[p?I:H,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),p?H:I]})},[k,j,o,t,d]),E=n.useMemo(()=>T(v),[v,d]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,createPopupPanel:F,popupProps:{popperProps:{resizeOnOverflow:!1}},createTooltip:({children:R},N)=>e.jsx(y.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:N,children:R}),onQuickClick:()=>{u?.(v)},quickButtonProps:{sx:{}},disabled:s,icon:E,...f})})),Fa=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,variant:s=w.CommandButtonType.Toolbar,disabled:d=!1,autoColor:p,autoStrokeStyle:l,schemeLookup:c,createTemporaryBorder:g,selectedBorder:C,onSelectBorder:f,darkMode:u,icon:m,label:b,...S}=a,x=w.useCommands(o,["formatBorder"]),h=t??x[0],k=h?.context()??null,j=k?.autoColor??p,v=k?.autoStyle??l,T=C??k?.quickBorder,M=u??k?.darkMode,P=g??k?.createTemporaryBorder,D=c??k?.schemeLookup,F=w.useCallbackRef(R=>{k?.onBorderSelect&&k.onBorderSelect(R),f?.(R),h?.execute(R,r)},[h,f,r]),E=n.useCallback((R,N)=>{const{children:z,title:O,...H}=R;let I=R.children;return(h?.disabled()||d)&&(I=e.jsx("div",{children:I})),e.jsx(y.CommandTooltip,{command:h,placement:s===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:N,...H,children:I})},[h,d]);return e.jsx(Da,{ref:i,autoColor:j,darkMode:M,autoStrokeStyle:v,createTemporaryBorder:P,schemeLookup:D,selectedBorder:T,onSelectBorder:F,createTooltip:E,disabled:d||!h||h.disabled(),...S})})),Ia=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:c.getCommand("mergeToggle")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("mergeHorizontal")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("mergeVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:c.getCommand("unmerge")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,quickCommand:"mergeToggle",commandHook:t,scope:r,tooltip:"Combine or split cells.",createPopupPanel:p,icon:"MergeAll",...d})})),Na=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:c.getCommand("freezeToggle")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("freezeToggleHorizontal")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("freezeToggleVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:c.getCommand("unfreeze")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:p,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:"Freeze",...d})})),Oa=n.memo(n.forwardRef((a,i)=>e.jsx(y.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["find","findReplace","goto"],scope:"find",label:"Find & Select",tooltip:"Find and replace cells or go to a specific location.",quickCommand:"find",icon:"Find"}))),Aa=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,showQuickButtons:r=!!a.commands,commands:s,fontSizes:d=A.FontUtils.DefaultFontSizes,disabled:p=!1,parentFloat:l,icon:c,label:g,sx:C,...f}=a;w.useCommand(o);const u=()=>o?.state()?.toString()||"11",[m,b]=n.useState(u),S=w.useCallbackRef(()=>{const P=parseFloat(m);isNaN(P)?b(u()):parseFloat(u())!==P&&o.execute(P,t)},[u,o,m,t]);n.useEffect(()=>{b(u())},[o?.state()]);const x=n.useMemo(()=>{if(!t)return null;const P={...t};return delete P.beforeExecute,P},[t]),h=w.useCommands(s,["formatFontSizeIncrease","formatFontSizeDecrease"]),k=n.useMemo(()=>h?e.jsxs(B.Box,{className:ie("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:P=>P.stopPropagation(),children:[e.jsx(y.CommandButton,{command:h[0],commandHook:x}),e.jsx(y.CommandButton,{command:h[1],commandHook:x})]}):null,[h]),j=q.useTheme(),v=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("12.3",Math.round(j.typography.fontSize),j.typography.fontFamily).width}px`,[j]),T=n.useCallback(P=>{const{onMouseDown:D,onMouseUp:F,...E}=P;return e.jsx(B.IconButton,{component:"div",...E,disableRipple:!0,children:e.jsx(B.Input,{inputMode:"numeric",disabled:p||!o||o.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:R=>`1px solid ${R.palette.text.icon??R.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:R=>`1px solid ${R.palette.error.main}`},"::after":{borderBottom:R=>`1px solid ${R.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:R=>`${Math.round(R.typography.fontSize)}px`,width:v,color:R=>R.palette.text.secondary,input:{padding:"0 0",textAlign:"center",height:"1rem",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:R=>R.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:R=>R.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"}},value:m,onFocus:R=>{R.target?.select()},onKeyDown:R=>{if(R.which===w.KeyCodes.Enter)u()!==m&&(R.stopPropagation(),R.preventDefault(),S());else if(R.which===w.KeyCodes.Escape)u()!==m&&(b(u()),setTimeout(()=>{R.target?.select()},0),R.stopPropagation(),R.preventDefault());else{if(R.key.match("[-]")||R.key.match("[0-9.]")&&(m+R.key).length>4)return R.stopPropagation(),void R.preventDefault();if(R.which===w.KeyCodes.Space)return void R.preventDefault()}},onBlur:()=>{S()},onChange:R=>{if(R.target.value.length>4)return R.stopPropagation(),void R.preventDefault();b(R.target.value)}})})},[m,p,o]),M=n.useCallback(P=>{const D=N=>{o?.execute(N,t)},F=o?.state(),E=[];for(let N=0;N<d.length;N++){const z=d[N]===F;E.push(e.jsx(y.ExhibitMenuItem,{selected:z,icon:z?e.jsx(y.SelectedIcon,{}):void 0,disabled:p||!o||o.disabled(),onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&D(d[N])},onKeyDown:O=>{O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||D(d[N])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:d[N]})},"fontSize-"+N))}const R=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...f,children:[k,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:E})]});return y.defaultCreatePopupPanel({...P,children:R})},[p,o?.state(),t]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...C},tabIndex:-1,outlined:!0,disabled:p,parentFloat:l,createPopupPanel:M,createTooltip:({children:P},D)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:D||o?.disabled(),children:P}),createQuickButton:T,...f})})),Pn=n.memo(a=>{const{selected:i,disabled:o,formattedValue:t,handleSetFormat:r,format:s,sx:d,...p}=a;return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...d},disabled:o,selected:i,icon:i?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:l=>{l.button===0&&l.preventDefault()},onMouseUp:l=>{l.button===0&&r(s.numberFormat)},onKeyDown:l=>{l.keyCode!==w.KeyCodes.Enter&&l.keyCode!==w.KeyCodes.Space||r(s.numberFormat)},...p,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(B.Typography,{component:"div",children:[s.formatType,s.formatType===A.NumberFormat.Type.Custom?"…":""]}),e.jsx(B.Typography,{variant:"caption",component:"div",sx:{color:l=>Re.alpha(l.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),La=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,sx:s,disabled:d=!1,parentFloat:p,...l}=a,c=w.useCommands(o,["formatNumberFormat"])[0],g=c?.state()?A.NumberFormat.Styles.lookupStyle(c?.state()).formatType:A.NumberFormat.Type.General,C=n.useMemo(()=>{if(!t)return null;const b={...t};return delete b.beforeExecute,b},[t]),f=n.useCallback((b,S)=>{const x=F=>{t?.beforeExecute?.(c,c?.state()),c.execute(F,t),t?.onExecute?.(c,c?.state())},h=c?.context()(),k=A.NumberFormat.Styles.lookupPrimary(),j=[];for(let F=0;F<k.length;F++){let E="";if(h&&!h.isEmpty())try{E=h.getNumberFormat(k[F].numberFormat).displayText}catch(N){console.warn(N)}E===""&&k[F].formatType===A.NumberFormat.Type.General&&(E="No specific format");const R=k[F].formatType===g;j.push(e.jsx(Pn,{selected:R,disabled:d||!c||c.disabled(),formattedValue:E,handleSetFormat:x,format:k[F]},k[F].formatType))}const v={numberFormat:"",formatType:A.NumberFormat.Type.Custom},T=g===A.NumberFormat.Type.Custom,M=e.jsx(Pn,{selected:T,disabled:d||!c||c.disabled(),formattedValue:T?h.getNumberFormat().displayText:"",handleSetFormat:()=>{t?.beforeExecute?.(c,c?.state()),S.getCommand("formatNumberDialog")?.execute(c?.state()),t?.onExecute?.(c,c?.state())},format:v,sx:{flex:"0",width:"100%"}},A.NumberFormat.Type.Custom),P=e.jsxs(B.Box,{className:"quick-buttons",sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:F=>F.stopPropagation(),children:[e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatAccountingStyle"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatPercentStyle"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatCommaStyle"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatIncreaseDecimal"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatDecreaseDecimal"),commandHook:C,scope:r})]}),D=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...l,children:[P,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:j}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),M]});return y.defaultCreatePopupPanel({...b,children:D})},[c?.context(),c?.state(),t,r]),u=q.useTheme(),m=n.useMemo(()=>{const b=A.NumberFormat.Type.MediumTime;return`${A.IFont.getSharedMeasurer()(b,Math.round(u.typography.fontSize),u.typography.fontFamily).width}px`},[u]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,sx:s,outlined:!0,disabled:d,parentFloat:p,createPopupPanel:f,createTooltip:({children:b},S)=>e.jsx(y.ExhibitTooltip,{label:c?.label(),description:c?.description(),disabled:S,children:b}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:b=>`${Math.round(b.typography.fontSize)}px`,color:b=>b.palette.text.secondary,fontFamily:b=>b.typography.fontFamily,width:m},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...l})})),Lo=n.memo(n.forwardRef((a,i)=>e.jsx(y.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["clearAll","clearFormats","clearContents","clearComments","clearHyperlinks"],scope:"clear",label:"Clear",tooltip:"Clear everything in the cell, or remove just the formatting or contents.",icon:"ClearAll"}))),za=n.memo(n.forwardRef((a,i)=>e.jsx(y.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["fillDown","fillRight","fillUp","fillLeft"],scope:"fill",label:"Fill",tooltip:"Fill the selected cells with the value from one of the corners.",icon:"FillDown"}))),zo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:p=!0,showQuickButton:l=!0,variant:c=w.CommandButtonType.Toolbar,...g}=a,C=["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns","addSheet"];d||C.push("addSheet");const f=w.useCommands(o,C),{singleCommand:u,allDisabled:m}=n.useMemo(()=>{let S=null,x=0;const h=f.length;for(let k=0;k<h;k++){const j=f[k];j&&!j.disabled()&&(p&&c===w.CommandButtonType.Menuitem&&(S=x===0?j:null),x++)}return{singleCommand:S,allDisabled:x===0}},[f]),b=n.useCallback((S,x)=>{let h=null;const k={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertCells",disabled:s};d||(h=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...k,command:x.getCommand("addSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...k,command:f[0]}),e.jsx(y.CommandButton,{...k,command:f[1]}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...k,command:f[2]}),e.jsx(y.CommandButton,{...k,command:f[3]}),h]});return y.defaultCreatePopupPanel({...S,children:j})},[s,f,t,r]);return u?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:u,...g}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,quickCommand:"insertCells",commands:o,commandHook:t,scope:r,disabled:s||m,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:b,...g})})),Ho=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:p=!0,showQuickButton:l=!0,variant:c=w.CommandButtonType.Toolbar,...g}=a,C=["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"];d||C.push("deleteSheet");const f=w.useCommands(o,C),{singleCommand:u,allDisabled:m}=n.useMemo(()=>{let S=null,x=0;const h=f.length;for(let k=0;k<h;k++){const j=f[k];j&&!j.disabled()&&(p&&c===w.CommandButtonType.Menuitem&&(S=x===0?j:null),x++)}return{singleCommand:S,allDisabled:x===0}},[f]),b=n.useCallback((S,x)=>{const h={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:s};let k=null;d||(k=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteCellsShiftUp")}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteCellsShiftLeft")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteRows")}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteColumns")}),k]});return y.defaultCreatePopupPanel({...S,children:j})},[s,t,r]);return u?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:u,...g}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,quickCommand:"deleteCells",commands:o,commandHook:t,scope:r,disabled:s||m,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:b,...g})})),Wo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,...s}=a,d=n.useCallback((p,l)=>{const c={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"formatCells"},g={commands:l,parentFloat:p.floatReference,...c},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...c,command:l.getCommand("resizeRows")}),e.jsx(y.CommandButton,{...c,command:l.getCommand("autoFitRows")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...c,command:l.getCommand("resizeColumns")}),e.jsx(y.CommandButton,{...c,command:l.getCommand("autoFitColumns")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{ref:i,...g,popupCommandKeys:["hideColumns","hideRows",null,"unhideColumns","unhideRows"],popupScope:"hideUnhide",label:"Hide & Unhide"})]});return y.defaultCreatePopupPanel({...p,children:C})},[t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,createPopupPanel:d,icon:"CellsFormat",label:"Format Cells",tooltip:"Change row and column sizes or visibility.",...s})}));Wo.displayName="CellsFormatCommandButton";const ft=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,onSelectColor:r,disabled:s=!1,variant:d=w.CommandButtonType.Toolbar,quickColor:p,panelProps:l,isSplit:c=!1,darkMode:g,icon:C,...f}=a,{autoColor:u,schemeLookup:m,recentColors:b,...S}=l;if(f.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");w.useCommand(o);const x=o?.context();let h=p??x?.quickColor;c&&!h&&(h=new A.Color("transparent"));const k=u??x?.autoColor,j=m??x?.schemeLookup,v=b??x?.recentColors,T=g??x?.darkMode,M=n.useMemo(()=>({autoColor:k,schemeLookup:j,recentColors:v,darkMode:T,...S}),[k,j,v,T]),P=w.useCallbackRef((F,E)=>{F&&E&&x?.addRecentColor&&x.addRecentColor(F),x?.onColorSelect&&x.onColorSelect(F),r?.(F,E),o?.execute(F,t)},[o,r,t,x]),D=n.useCallback((F,E)=>{const{children:R,title:N,...z}=F;let O=F.children;return(o?.disabled()||s)&&(O=e.jsx("div",{children:O})),e.jsx(y.CommandTooltip,{command:o,placement:d===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:E,...z,children:O})},[o,s]);return e.jsx(Ao,{ref:i,panelProps:M,icon:C??o?.icon(x),quickColor:h,selectedColor:o?.state(),onSelectColor:P,variant:d===w.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:D,label:o?.label(),disabled:s||!o||o.disabled(),compareRGB:!0,darkMode:T,...f})}));ft.displayName="ColorCommandButton";const Ha=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...p}=a,l=w.useCommands(o,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("gridlinesToggle")}),e.jsx(ft,{...f,command:C.getCommand("sheetViewFormatGridlinesColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleGridlinesRows")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Gridlines",tooltip:"Configure how the lines between rows and columns in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:l[0],scope:"view"}),...p})})),$o=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},C=c.getCommand("sortCustom"),f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:c.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("sortDescending")}),C?e.jsx(y.CommandButton,{...g,command:C}):null,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...l,children:f})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,disabled:s,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:p,icon:"SortFilter",...d})})),Vi=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,disabled:s,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:p,icon:"FilterToggle",...d})})),Vo=n.memo(n.forwardRef((a,i)=>{const{quickCommand:o,icon:t,isRedo:r=!1,nestRedo:s=!0,undoManager:d,scope:p,sx:l,disabled:c,commands:g,...C}=a,f=[o];!r&&s&&f.push("redo");const u=w.useCommands(g,f),m=u[0],b=u[1],S=d??m?.context?.()?.undoManager;let x=c;c||(x=!m||m.disabled(),b&&!b.disabled()&&(x=!1));const[h,k]=n.useState(0),j=n.useCallback((v,T)=>{let M=h===0?"Cancel":`${m.label()} ${h} Action${h===1?"":"s"}`,P=!1;S||(P=!0),P||(P=s?!S.hasRedo()&&!S.hasUndo():!S.hasRedo());const D=O=>{m.execute(O)},F=e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:P?void 0:"0 0",minWidth:"180px"},icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(0)},onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&D(h)},onKeyDown:O=>{O.isDefaultPrevented()||O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||D(h)},children:e.jsx(B.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:M})});if(P)return F;const E=r?S?.getRedoDescriptions():S?.getUndoDescriptions(),R=[];for(let O=0;O<E.length;O++){const H=E[O];R.push(e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},disabled:x,selected:O<h,icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(O+1)},onMouseDown:I=>{I.button===0&&I.preventDefault()},onMouseUp:I=>{I.button===0&&D(O+1)},onKeyDown:I=>{I.isDefaultPrevented()||I.keyCode!==w.KeyCodes.Enter&&I.keyCode!==w.KeyCodes.Space||D(O+1)},children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",alignItems:"center",overflow:"hidden"},children:[e.jsx(B.Typography,{component:"div",children:H}),e.jsx(w.DynamicIcon,{})]})},`action:${O}`))}let N=null;if(!r&&s){const O={scope:"undo",commands:T,variant:w.CommandButtonType.Menuitem,parentFloat:v.floatReference};N=[],N.push(e.jsx(Vo,{...O,quickCommand:"redo",isRedo:!0},"nested:redo")),S.hasRedo()&&S.hasUndo()&&N.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"action:redo-div"))}const z=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},onClick:()=>{v.closeFloatAll()},onMouseLeave:()=>{k(0)},children:[N,e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:R}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),F]});return y.defaultCreatePopupPanel({...v,children:z})},[m?.context(),m?.state(),p,S,h,x]);return e.jsx(y.CommandPopupButton,{ref:i,commands:g,quickCommand:o,scope:p,disabled:x,label:m?.label()??(r?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${m?.label()??"No"} last actions.`})}),createPopupPanel:j,icon:t??(r?"Redo":"Undo"),selected:!1,...C})})),pt=A.IFontCollection.getFontList(),Wa=new Map;for(let a=0;a<pt.length;a++)Wa.set(pt[a].fontRef.getFamily(),pt[a]);const $a=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,sx:r,disabled:s=!1,parentFloat:d,icon:p,label:l,...c}=a;w.useCommand(o);const g=o?.state(),C=q.useTheme(),f=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("Times New Roman",Math.round(C.typography.fontSize),C.typography.fontFamily).width}px`,[C]),u=n.useCallback(m=>{const b=k=>{o?.execute(k,t)},S=[];for(let k=0;k<pt.length;k++)S.push({key:pt[k].fontRef.getFamily(),description:pt[k].fontRef.getFamily()});Wa.get(g)||S.unshift({key:g,description:g});const x=[];for(let k=0;k<S.length;k++){const j=S[k].key===g;x.push(e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",paddingTop:"4px",paddingBottom:"4px"},selected:j,disabled:s||!o||o.disabled(),icon:j?e.jsx(y.SelectedIcon,{}):void 0,onMouseUp:v=>{v.button===0&&b(S[k].key)},onMouseDown:v=>{v.button===0&&v.preventDefault()},onKeyDown:v=>{v.keyCode!==w.KeyCodes.Enter&&v.keyCode!==w.KeyCodes.Space||b(S[k].key)},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:()=>S[k]?.key},children:S[k].description})})},k+""+S[k].key))}const h=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},...c,children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:x})});return y.defaultCreatePopupPanel({...m,children:h})},[s,o?.state()]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...r},outlined:!0,disabled:s,parentFloat:d,createPopupPanel:u,createTooltip:({children:m},b)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:b,children:m}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:m=>`${Math.round(m.typography.fontSize)}px`,fontFamily:m=>m.typography.fontFamily,color:m=>m.palette.text.secondary,width:f},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...c})})),Va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),l=n.useMemo(()=>{const g=p.length;for(let C=0;C<g;C++){const f=p[C];if(f?.state())return f}return p[0]},[p]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("formatStrikeThroughToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatSuperscriptToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatSubscriptToggle")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Text Effects",tooltip:"Style your text to differentiate it.",icon:l?.icon()??"TextStrike",...d})})),_a=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),l=n.useMemo(()=>{const g=p.length;for(let C=0;C<g;C++)if(p[C]?.state())return p[C];return p[0]},[p]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedDoubleToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedAccountingToggle"),commandHook:t}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedAccountingDoubleToggle")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,label:"Underline",tooltip:"All underline stylings.",createPopupPanel:c,icon:l?.icon()??"TextUnderline",...d})})),_o=n.memo(n.forwardRef((a,i)=>{const{command:o,commands:t,commandHook:r,scope:s,includePasteAllInPopup:d=!0,disabled:p=!1,...l}=a,c=w.useCallbackRef((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,commandHook:r,scope:"paste",disabled:p},u=[];return d&&(u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("paste"),key:"paste"})),u.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteValues"),key:"pasteValues"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteFormats"),key:"pasteFormats"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteFormulas"),key:"pasteFormulas"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteTranspose"),key:"pasteTranspose"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteLinks"),key:"pasteLinks"})),y.defaultCreatePopupPanel({...g,children:u})},[p,r,s,d]);return e.jsx(y.CommandPopupButton,{ref:i,commands:t,commandHook:r,scope:s,createPopupPanel:c,label:"Paste",tooltip:"Add content to the clipboard to your document.",quickCommand:"paste",...l})})),Ka=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...p}=a,l=w.useCommands(o,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadings")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadingRows")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Headings",tooltip:"Configure how the column and rows headings in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:l[0],scope:"view"}),...p})})),Ua=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="view",disabled:s=!1,...d}=a,p=n.useCallback(l=>{const c={variant:w.CommandButtonType.Menuitem,parentFloat:l.floatReference,commandHook:t,scope:r,disabled:s},g=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowFormulaBar")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowTabs")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowStatusBar")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowHorizontalScrollBar")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowVerticalScrollBar")})]});return y.defaultCreatePopupPanel({...l,children:g})},[s,o,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Workbook View",tooltip:"Options to configure how the workbook is displayed.",createPopupPanel:p,icon:e.jsx(y.LabelIcon,{icon:null,label:"Workbook View"}),...d})})),qa=n.memo(n.forwardRef((a,i)=>{const{value:o,cellStyle:t,styles:r,createTemporaryCell:s,bodyStyle:d,sx:p,borderProps:l,disabled:c,...g}=a,C=n.useMemo(()=>s({value:o,style:t}),[o,t,s]),f=n.useMemo(()=>C.getStyle(),[C,d]),u=n.useMemo(()=>f.getFill().toCSS(d?.darkMode??!1),[f]),m=f.getInsets(),b=f.getFont(),S=n.useCallback(()=>f.getBorder(),[f]);return e.jsx(B.Box,{ref:i,sx:{width:"100px",height:"100%",textOverflow:"ellipsis",display:"flex",alignItems:"stretch",background:d?.fill,filter:c?"grayscale(0.4) opacity(0.8);":"none","& .fill":{flex:"1 1 100%",overflow:"hidden",...u},"& .text":{flex:"1 1 100%",...b.toCSS(d?.darkMode??!1,1),boxSizing:"border-box",padding:`${m.top}px ${m.right}px ${m.bottom}px ${m.left}px`,margin:"0px",outline:"none",resize:"none",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"baseline",textDecoration:b.toCSS().textDecoration,textAlign:A.ITextFrame.toCSSHorizontalTextAlign(C.getRenderHorizontalAlignment()),background:"transparent",maxHeight:"100%",whiteSpace:"pre",wordWrap:"break-word"},...p},...g,children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:S,darkMode:d?.darkMode??!1,rowCount:1,columnCount:1,style:{height:"100%",width:"100%",...l?.style},...l,children:e.jsx(B.Box,{className:"fill",sx:{paddingLeft:"4px",paddingRight:"4px",marginLeft:"-1px",marginTop:"-1px",marginRight:"-2px",marginBottom:"-2px",display:"flex",alignItems:"center"},children:e.jsx(B.Box,{className:"text",children:o})})})})})),_i=n.memo(a=>{const{styles:i,namedStyle:o,selectedNamed:t,hasContextMenu:r=!0,bodyStyle:s,onSelectNamed:d,createTemporaryCell:p,parentFloat:l,commands:c,disabled:g,commandHook:C,...f}=a,u=n.useCallback(S=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:C,context:"cellStyle"},h=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,style:{fontWeight:550},command:c.getCommand("formatCellStyle"),commandState:o,disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:c.getCommand("modifyCellStyle"),commandState:{named:o}}),e.jsx(y.CommandButton,{...x,command:c.getCommand("deleteCellStyle"),commandState:o,disabled:g||o?.getName()===A.IStyle.BuiltInName.Normal})]}),k=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:h})});return y.defaultCreatePopupPanel({...S,children:k})},[]),m=o?.getName()===t?.getName();let b=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:S=>`solid ${m?S.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName(),placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{d?.(o)},...f,children:e.jsx(qa,{value:o.getName(),cellStyle:{named:o.getName()},styles:i,createTemporaryCell:p,bodyStyle:s})},o.getName());return r&&(b=e.jsx(y.ContextMenu,{label:o.getName(),parentFloat:l,createPopupPanel:u,children:b})),b}),Ga=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedNamed:s,onSelectNamed:d,disabled:p=!1,bodyStyle:l,usePreviewIcon:c=!0,...g}=a;w.useCommand(t);const C=t?.context(),f=C?.styles,u=s??C?.named(),m=l??C?.bodyStyle(),b=w.useCallbackRef(j=>{d?.(j),t?.execute(j,r)},[t,d,r]),S=n.useCallback((j,v)=>{const T={onSelectNamed:b,styles:f(),parentFloat:j.floatReference},M=f().getCustomNamed(),P=new Map,D=[];for(let I=0;I<M.length;I++)P.set(M[I].getName(),M[I]),f().getNamed(M[I].getName()).getBuiltInID()===null&&D.push(M[I].getName());const F=I=>{let W=P.get(I);return W||(W=f().getNamed(I)),!W||W.isHidden()?null:e.jsx(_i,{namedStyle:W,selectedNamed:u,bodyStyle:C.bodyStyle(),createTemporaryCell:C.createTemporaryCell,commands:o,commandHook:r,...T},I)},E=(I,W,ee=!0)=>{const X=[];for(let ne=0;ne<W.length;ne++){const $=F(W[ne]);$&&X.push($)}return X.length===0?null:e.jsxs(B.Box,{children:[ee?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:I},I+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:X},I+"-presets")]},I)},R=(I,W)=>{const ee=[];for(let X=0;X<W.length;X++){const ne=F(W[X]);ne&&ee.push(ne)}return ee.length===0?null:e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",flexDirection:"column",flex:"0 0 0%"},children:ee},I+"-presets")},N=[];N.push(E("Custom",D,!1)),N.push(E("Good, Bad and Neutral",[A.IStyle.BuiltInName.Normal,A.IStyle.BuiltInName.Bad,A.IStyle.BuiltInName.Good,A.IStyle.BuiltInName.Neutral],D.length>0)),N.push(E("Data and Model",[A.IStyle.BuiltInName.Calculation,A.IStyle.BuiltInName.CheckCell,A.IStyle.BuiltInName.ExplanatoryText,A.IStyle.BuiltInName.FollowedHyperlink,A.IStyle.BuiltInName.Hyperlink,A.IStyle.BuiltInName.Input,A.IStyle.BuiltInName.LinkedCell,A.IStyle.BuiltInName.Note,A.IStyle.BuiltInName.Output,A.IStyle.BuiltInName.WarningText])),N.push(E("Titles and Headings",[A.IStyle.BuiltInName.Heading1,A.IStyle.BuiltInName.Heading2,A.IStyle.BuiltInName.Heading3,A.IStyle.BuiltInName.Heading4,A.IStyle.BuiltInName.Title,A.IStyle.BuiltInName.Total]));let z=[];var O,H;return z.push(R("Accent 1",[A.IStyle.BuiltInName.Accent1_20,A.IStyle.BuiltInName.Accent1_40,A.IStyle.BuiltInName.Accent1_60,A.IStyle.BuiltInName.Accent1])),z.push(R("Accent 2",[A.IStyle.BuiltInName.Accent2_20,A.IStyle.BuiltInName.Accent2_40,A.IStyle.BuiltInName.Accent2_60,A.IStyle.BuiltInName.Accent2])),z.push(R("Accent 3",[A.IStyle.BuiltInName.Accent3_20,A.IStyle.BuiltInName.Accent3_40,A.IStyle.BuiltInName.Accent3_60,A.IStyle.BuiltInName.Accent3])),z.push(R("Accent 4",[A.IStyle.BuiltInName.Accent4_20,A.IStyle.BuiltInName.Accent4_40,A.IStyle.BuiltInName.Accent4_60,A.IStyle.BuiltInName.Accent4])),z.push(R("Accent 5",[A.IStyle.BuiltInName.Accent5_20,A.IStyle.BuiltInName.Accent5_40,A.IStyle.BuiltInName.Accent5_60,A.IStyle.BuiltInName.Accent5])),z.push(R("Accent 6",[A.IStyle.BuiltInName.Accent6_20,A.IStyle.BuiltInName.Accent6_40,A.IStyle.BuiltInName.Accent6_60,A.IStyle.BuiltInName.Accent6])),N.push((O="Themed Cell Styles",H=z,e.jsxs(B.Box,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.ExhibitMenuHeader,{children:O},O+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:H},O+"-presets")]},O))),N.push(E("Number Format",[A.IStyle.BuiltInName.Comma,A.IStyle.BuiltInName.Comma0,A.IStyle.BuiltInName.Currency,A.IStyle.BuiltInName.Currency0,A.IStyle.BuiltInName.Percent])),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:I=>`${I.shape.borderRadius}px`,paddingBottom:I=>`${I.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",paddingTop:"6px",paddingBottom:"0px",paddingLeft:"16px",paddingRight:"16px"},children:N}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:u,command:v.getCommand("newCellStyle"),context:"styles",commandHook:r,disabled:p})]})},[u,f?.().getTheme(),m]),x=w.useCallbackRef(j=>{const v=18/A.IFont.getDeviceScale(),T=C?.createTemporaryCell(j);return T.getStyle().getFont().getSize()<=v?T:T.createTemporaryCell({style:{font:{size:v}}})},[C?.createTemporaryCell]),h=p||!t||t.disabled(),k=n.useMemo(()=>C&&c?e.jsx(qa,{value:u?.getName()??"Custom",cellStyle:u?{named:u.getName()}:void 0,styles:C.styles(),createTemporaryCell:x,bodyStyle:C.bodyStyle(),className:"outline-hover",disabled:h,sx:{marginRight:"4px",borderRadius:"2px",minHeight:"calc(100% - 2px)",overflow:"hidden",outline:j=>`1px solid ${j.palette.action.hover}`},borderProps:{style:{height:"calc(100% - 2px)",width:"calc(100% - 1px)"}}}):t?.icon(),[u,m,h,t]);return e.jsx(y.CommandPopupButton,{ref:i,createPopupPanel:S,outlined:c,commands:o,createTooltip:({children:j},v)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:v,children:j}),selected:!1,disabled:h,label:t?.label(),icon:k,...g})})),Xa="_sheetxl-reset_11z3j_1",Ki=10,Ko=n.memo(n.forwardRef((a,i)=>{const{styles:o,table:t,tableStyle:r=t?.getStyle()??o.getDefaultTableStyle(),bodyStyle:s,sx:d,disabled:p,className:l,forceThinBorder:c,cellHeight:g=Ki,isLive:C=!1,...f}=a,u=Math.ceil(1.3*g),[m,b]=n.useReducer(j=>j+1,0);n.useEffect(()=>{if(C&&t)return t.addListeners({onAnyChange:()=>{b()}})},[t,C]);const S=n.useMemo(()=>{let j=t?.toJSON()??{};const v={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return j&&(j.styleOptions={...j.styleOptions,name:r.getName()}),j.ref=v,new A.Table({initialAnchor:v,json:j,styles:o})},[m,t,r,o]),x=n.useMemo(()=>{const j=[];for(let v=0;v<5;v++)for(let T=0;T<5;T++){const M=S.getStyleAt({colIndex:T,rowIndex:v});j.push(M)}return j},[S]),h=n.useMemo(()=>{const j=(T,M,P)=>{let D=P.getFill().toCSS(s?.darkMode??!1);const F=u-(M<4?1:0),E=g-(T<4?1:0),R=P.getFont().getFill().toCSS(s?.darkMode??!1);return D={...D,position:"absolute",boxSizing:"border-box",left:M*(u-1),top:T*(g-1),width:F,height:E},e.jsx("td",{className:`table-style-fill ${T}-${M}`,style:D,children:e.jsx("div",{className:`table-style-text ${T}-${M}`,style:{position:"absolute",boxSizing:"border-box",width:"6px",left:(F-6)/2,top:(E-1)/2,borderTop:`1px solid ${R}`}})},`${T}-${M}`)},v=[];for(let T=0;T<5;T++){const M=[];for(let P=0;P<5;P++){const D=x[5*T+P];M.push(j(T,P,D))}v.push(e.jsx("tr",{children:M},T))}return v},[S,r,s]),k=n.useCallback((j,v)=>x[v].getBorder()??null,[x]);return e.jsx(B.Box,{ref:i,className:"table-format-preview",sx:{background:s?.fill,filter:p?"grayscale(0.4) opacity(0.8);":"none","& .styled-element":{position:"absolute"},...d},...f,children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:k,rowCount:5,columnCount:5,forceThinBorder:c,width:5*(u-1)+1,height:5*(g-1)+1,darkMode:s?.darkMode??!1,style:{pointerEvents:"none"},children:e.jsx("table",{className:ie(l,"sheetxl-table-preview",Xa),style:{borderCollapse:"collapse",width:5*(u-1)+1,height:5*(g-1)+1},children:e.jsx("tbody",{children:h})})})})})),St=(a,i,o,t,r)=>{a.beginPath(),a.moveTo(i+.5,o+.5),a.lineTo(t+.5,r+.5),a.stroke()},Ya=n.memo(n.forwardRef((a,i)=>{const{table:o,tableStyle:t,styles:r,bodyStyle:s,disabled:d,style:p,className:l,canvas:c,...g}=a,C=n.useMemo(()=>{const m=o.toJSON(),b={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return m.styleOptions={...m.styleOptions,name:t.getName()},m.ref=b,new A.Table({initialAnchor:b,json:m,styles:r})},[o,t,r]),f=n.useMemo(()=>{const m=[];for(let b=0;b<5;b++)for(let S=0;S<5;S++){const x=C.getStyleAt({colIndex:S,rowIndex:b});m.push(x)}return m},[C]),u=n.useMemo(()=>{let m=c;if(c||(m=document.createElement("canvas")),!m)return null;m.width!==61&&(m.width=61),m.height!==46&&(m.height=46);const b=m.getContext("2d",{alpha:!1});if(!b)return null;const S=12,x=s?.darkMode??!1;for(let h=0;h<5;h++)for(let k=0;k<5;k++){const j=f[5*h+k].getFill();let v=s?.fill;j.getType()===A.IFill.Type.Solid?v=j.getColor().toCSS(x,!1):j.getType()===A.IFill.Type.Gradient?v=j.getStops[0]?.color.toCSS(x,!1):j.getType()===A.IFill.Type.Pattern&&(v=j.getForeground().toCSS(x,!1)),b.fillStyle=v;const T=k*S,M=9*h;b.fillRect(T,M,13,10)}b.lineWidth=1;for(let h=0;h<5;h++)for(let k=0;k<5;k++){const j=f[5*h+k],v=k*S,T=9*h,M=j.getBorder();if(!M.isEmpty()){const F=M.getLeft();F.isNone()||(b.strokeStyle=F.getColor().toCSS(x,!1),St(b,v,T,v,T+9));const E=M.getTop();E.isNone()||(b.strokeStyle=E.getColor().toCSS(x,!1),St(b,v,T,v+S,9*h));const R=M.getRight();R.isNone()||(b.strokeStyle=R.getColor().toCSS(x,!1),St(b,v+S,T,v+S,T+9));const N=M.getBottom();N.isNone()||(b.strokeStyle=N.getColor().toCSS(x,!1),St(b,v,T+9,v+S,T+9))}b.strokeStyle=j.getFont().getFill().toCSS(x,!1);const P=4,D=2.5;St(b,k*S+D,9*h+P,k*S+D+7,9*h+P)}return`url(${m.toDataURL()})`},[c,C,t,s]);return e.jsx("div",{ref:i,className:ie("table-style-preview",l),style:{backgroundImage:u,width:61,height:46,...p},...g})})),Ui="_table-style-options-container_1kfn2_1",qi="_table-style-options_1kfn2_1",Za=n.memo(n.forwardRef((a,i)=>{const{styleOptions:o,onStyleOptionsChange:t,showHeaderRow:r,onShowHeaderRowChange:s,showTotalRow:d,onShowTotalRowChange:p,showFilterButton:l,onShowFilterButtonChange:c,sx:g,className:C,disabled:f,...u}=a;return e.jsx("div",{className:Ui,children:e.jsxs(B.Box,{sx:{pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:m=>`${m.spacing(2)}`,marginRight:m=>`${m.spacing(2)}`},"& .MuiCheckbox-root":{padding:m=>`${m.spacing(.5)}`},...g},...u,ref:i,className:ie(C,qi),children:[s&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:r??!1,indeterminate:r==null,onChange:()=>s(!r),disabled:f||r==null}),label:"Header Row",labelPlacement:"end"}),p&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:d??!1,indeterminate:d==null,onChange:()=>p(!d),disabled:f||d==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showRowStripes??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showRowStripes:!o?.showRowStripes})}}),label:"Banded Rows",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showFirstColumn??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showFirstColumn:!o?.showFirstColumn})}}),label:"First Column",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showLastColumn??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showLastColumn:!o?.showLastColumn})}}),label:"Last Column",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showColumnStripes??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showColumnStripes:!o?.showColumnStripes})}}),label:"Banded Columns",labelPlacement:"end"}),c&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:l??!1,indeterminate:l==null,disabled:f||!o||l==null,onChange:()=>c(!l)}),label:"Filter Button",labelPlacement:"end"})]})})}));function bo(a,i){if(typeof a=="function")return a(i);a&&(a.current=i)}var et=parseInt(n.version.split(".")[0],10)>=19?function(a){return i=>{const o=[];for(const t of a){const r=bo(t,i),s=typeof r=="function";o.push(s?r:()=>bo(t,null))}return()=>{for(const t of o)t()}}}:function(a){return i=>{for(const o of a)bo(o,i)}},Gi=function(){},Qa=typeof window<"u",dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Xi=Qa?n.useLayoutEffect:n.useEffect,Mn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const Ve=Qa&&window.ResizeObserver!==void 0?function(){var a=n.useState(null),i=a[0],o=a[1],t=n.useState(Mn),r=t[0],s=t[1],d=n.useMemo(function(){return new window.ResizeObserver(function(p){if(p[0]){var l=p[0].contentRect,c=l.x,g=l.y,C=l.width,f=l.height,u=l.top,m=l.left,b=l.bottom,S=l.right;s({x:c,y:g,width:C,height:f,top:u,left:m,bottom:b,right:S})}})},[]);return Xi(function(){if(i)return d.observe(i),function(){d.disconnect()}},[i]),[o,r]}:function(){return[Gi,Mn]},Yi="_range-row_akhf4_1",Zi="_action-row_akhf4_15",Ja=n.createContext(null);Ja.displayName="HookFormContext";const er=()=>n.useContext(Ja);typeof window<"u"?n.useLayoutEffect:n.useEffect;const Uo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,style:t,className:r,sx:s,defaultInput:d,value:p,formName:l,formOptions:c,onChangeInput:g,onValidate:C,onKeyDown:f,...u}=a,m=er(),b=l&&m?m.register(l,c):null,[S,x]=n.useState(""),[h,k]=n.useState(""),[j,v]=n.useState(p);n.useEffect(()=>{v(p),k("")},[p]);const T=w.useCallbackRef(E=>{let R="";try{v(E),C?.(E),g?.(E)}catch(N){R=N.message??"Invalid Name"}l&&m&&(R?m.setError(l,{message:R}):m.clearErrors(l)),k(R)},[p,C,g]),M=w.useCallbackRef(async E=>{E.keyCode===w.KeyCodes.Escape&&S!==p&&(T(S),m?.setValue(l,S),m?.clearErrors(l),E.stopPropagation()),f?.(E)},[f,S,p,m]),P=w.useCallbackRef(E=>{x(E.target.value??"")},[]),D=w.useCallbackRef(E=>{x(""),b?.onBlur(E)},[]),F=n.useCallback(E=>{T(E.target.value),b?.onChange(E)},[b]);return e.jsx(B.FormControl,{sx:{paddingTop:E=>E.spacing(1.5),minWidth:135,width:"100%",...s},size:"small",ref:i,className:ie("named-input",r),...u,children:e.jsx(B.TextField,{label:"Name",placeholder:d,onFocus:P,onBlur:D,inputRef:b?.ref,disabled:o,error:!!h,helperText:h||" ",sx:{"& .MuiFormHelperText-root":{marginTop:E=>E.spacing(.5)}},slotProps:{inputLabel:{shrink:!0},htmlInput:{className:"autoFocus",name:l,spellCheck:!1,autoComplete:"off",readOnly:o,sx:{paddingTop:E=>E.spacing(1.25),paddingBottom:E=>E.spacing(.75),backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`}}},value:j??"",onChange:F,onKeyDownCapture:M,onContextMenu:E=>{E.stopPropagation()}})})}));Uo.displayName="NamedInput";const Wt=a=>a===null?"":a.toString(),qo=n.memo(n.forwardRef((a,i)=>{const{formName:o,formOptions:t,disabled:r,style:s,className:d,sx:p,onKeyDown:l,value:c,onChangeInput:g,resolvedAddress:C,...f}=a,u=er(),m=o&&u?u.register(o,t):null,[b,S]=n.useState(""),[x,h]=n.useState(!1),[k,j]=n.useState(()=>Wt(c));n.useEffect(()=>{j(Wt(c)),S(""),o&&u&&u.clearErrors(o),h(!1)},[c]);const v=w.useCallbackRef(R=>{let N="";try{j(R);const z=Wt(c),O=C(R);O.toString()!==z&&g?.(O)}catch{N="Invalid Range"}o&&u&&(N?u.setError(o,{message:N}):u.clearErrors(o)),S(N),h(!0)},[k,g,o,u]),T=w.useCallbackRef(async R=>{if(x&&R.keyCode===w.KeyCodes.Escape){const N=Wt(c);j(N),S(""),h(!1),R.stopPropagation()}l?.(R)},[c,g,l,x]),M=w.useCallbackRef(R=>{m?.onBlur(R)},[m]),P=n.useCallback(R=>{v(R.target.value),m?.onChange(R)},[m]),[D,F]=n.useState(!1),E=n.useMemo(()=>e.jsx(B.InputAdornment,{tabIndex:-1,sx:{display:"flex",position:"relative",flex:"0"},position:"end",children:e.jsx(y.ExhibitOptionButton,{disabled:!0,selected:D,onSelectToggle:R=>{F(R)},label:"Select Range",icon:e.jsx(w.DynamicIcon,{iconKey:"SelectRangeMode"})})}),[D]);return e.jsx(B.FormControl,{sx:{paddingTop:R=>R.spacing(1.5),minWidth:135,width:"100%",...p},size:"small",ref:i,className:ie("range-input",d),...f,children:e.jsx(B.TextField,{label:"Range",placeholder:"Enter Range",onBlur:M,disabled:r,error:!!b,inputRef:m?.ref,helperText:b||" ",sx:{"& .MuiFormHelperText-root":{marginTop:R=>R.spacing(.5)}},slotProps:{input:{endAdornment:E},inputLabel:{shrink:!0},htmlInput:{spellCheck:!1,autoComplete:"off",readOnly:r,name:o,sx:{paddingTop:R=>R.spacing(1.25),paddingBottom:R=>R.spacing(.75)}}},value:k??"",onChange:P,onKeyDownCapture:T,onContextMenu:R=>{R.stopPropagation()}})})}));qo.displayName="RangeInput";const Be=[];Be.push(Me("Primary Background","bg1")),Be.push(Me("Primary Text","tx1")),Be.push(Me("Secondary Background","bg2")),Be.push(Me("Secondary Text","tx2")),Be.push(Me("Accent 1","accent1")),Be.push(Me("Accent 2","accent2")),Be.push(Me("Accent 3","accent3")),Be.push(Me("Accent 4","accent4")),Be.push(Me("Accent 5","accent5")),Be.push(Me("Accent 6","accent6"));const tr=a=>{const{docTheme:i,onSelectTheme:o,darkMode:t,isSelected:r,outlined:s,sx:d,...p}=a,l=q.useTheme(),c=n.useMemo(()=>{let g=[];for(let C=0;C<Be.length;C++){const f=Be[C];g.push(e.jsx(io,{schemeColorLookup:i.schemeLookup(),colorDef:f,darkMode:t,selectedColor:null},C+"-colorDef"))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"none"},children:e.jsx(B.Box,{sx:{display:"flex",boxShadow:C=>C.shadows[2]},children:g})})},[i,l]);return e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:g=>`solid ${r?g.palette.text.primary:"transparent"} 1px`,"&:hover:not([disabled])":{border:g=>`solid ${g.palette.text.primary} 1px !important`}},icon:null,...p,children:e.jsxs(B.Box,{sx:{border:g=>`solid ${g.palette.divider} 1px`,minWidth:"200px",borderRadius:"2px",padding:"4px 4px",textAlign:"left",display:"flex",gap:"4px",flexDirection:"column",alignItems:"stretch",color:g=>r?g.palette.text.primary:void 0,"&:hover:not([disabled])":{color:g=>g.palette.text.primary}},children:[e.jsx(B.Box,{sx:{},children:i.getName()}),e.jsxs(B.Box,{sx:{paddingTop:"6px",paddingLeft:"12px",paddingRight:"12px",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[c,e.jsx(B.Box,{sx:{flex:"1 1 100%",textOverflow:"ellipsis",overflow:"hidden",marginTop:"2px",whiteSpace:"pre",fontFamily:()=>i.getFontScheme().getMajorFont()},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,slotProps:{popper:{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 '${i.getFontScheme().getMajorFont()}'.`}),placement:"bottom-start",children:e.jsx("div",{children:i.getFontScheme().getMinorFont()})})})]})]})})},or=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,sx:s,disabled:d=!1,darkMode:p,...l}=a,c=n.useMemo(()=>{const g=o?.getItems({selected:t})??[],C=[];if(g.length===0)return e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"6px",paddingBottom:"6px"},children:"No themes"});const f=g.length;for(let u=0;u<f;u++){const m=g[u],b=t&&m?.getName()===t.getName(),S=g[u+1];S&&S.isCustom()!==m.isCustom()&&C.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${u}`)),C.push(e.jsx(tr,{docTheme:m,onSelectTheme:()=>r(m),isSelected:b,disabled:d,darkMode:p,onMouseDown:x=>{x.button===0&&x.preventDefault()},onMouseUp:x=>{x.button===0&&r(m)},onKeyDown:x=>{x.keyCode!==w.KeyCodes.Enter&&x.keyCode!==w.KeyCodes.Space||r(m)}},m.getName()))}return C},[t,r,p]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},ref:i,...l,children:e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"2px"},children:"Themes"}),e.jsx(y.ExhibitDivider,{}),e.jsx(B.Box,{sx:{flex:"1 1 100%",overflow:"auto",padding:"6px 16px"},children:c})]})})})),nr=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,icon:s,tooltip:d,label:p,variant:l=y.PopupButtonType.Toolbar,darkMode:c,panelProps:g,...C}=a,f=s||e.jsx(w.DynamicIcon,{iconKey:"Theme2"}),u=n.useCallback(b=>{const{closeFloatAll:S}=b;return e.jsx(or,{...g,themes:o,selectedTheme:t,onSelectTheme:r,darkMode:c,onKeyDown:x=>{x.which===w.KeyCodes.Enter&&S()}})},[o,t,r,g,c]),m={createPopupPanel:u,tooltip:d||p||"Theme",label:p,icon:f,...C};return l===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...m}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...m})})),Go=n.memo(n.forwardRef((a,i)=>{const{sheet:o,className:t,debounceDelay:r=220,sx:s,...d}=a,[p,l]=n.useState(()=>o.getView().getZoomScale()),[c,g]=n.useState(null),C=n.useRef(0);oe.useModelListener(o,{onViewChange:()=>{g(!0),C.current===0&&l(o.getView().getZoomScale())}}),n.useEffect(()=>{C.current=0,g(!1),l(o.getView().getZoomScale())},[o]),n.useEffect(()=>{C.current!==0&&A.CommonUtils.debounce(()=>{p===C.current&&(C.current=0,o.getView().update({zoomScale:p}))},r)()},[p,r]);const f=w.useCallbackRef(M=>{let P=M;M<100?P=Math.round(M/(10/9)+10):M>100&&(P=Math.round(3*M-200)),C.current=P,g(!0),l(P)},[o]),u=M=>{let P=M;return M<100?P=10/9*(M-10):M>100&&(P=(M+200)/3),P},m=u(p),[b,S]=n.useState(null),x=n.useRef(null),h=n.useCallback(()=>{const M=b;M&&requestAnimationFrame(()=>{x.current?.contains(document.activeElement)&&M.focus()})},[]),k=w.useMouseDownAndHoldListener(()=>{f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10)))}),j=w.useMouseDownAndHoldListener(()=>f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10)))),v=q.useTheme(),T=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("100%",Math.round(v.typography.fontSize),v.typography.fontFamily).width}px`,[v]);return e.jsxs(B.Box,{ref:i,className:ie(t),sx:{padding:"0px 0px",display:"flex",alignItems:"center",color:M=>M.palette.text.secondary,...s},onFocus:M=>{M.relatedTarget&&!b&&S(M.relatedTarget)},onBlur:M=>{b&&!x?.current?.contains(M.relatedTarget)&&S(null)},onMouseDown:M=>{M.button===0&&M.preventDefault()},onMouseUp:M=>{M.button===0&&h()},...d,children:[e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom Out",children:e.jsx(B.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:M=>M.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:M=>{M.button!==0?M.preventDefault():k(M)},children:e.jsx(w.DynamicIcon,{iconKey:"Remove"})})}),e.jsx(B.Slider,{ref:x,sx:{flex:"1 1 100%",padding:"6px 0px !important",marginRight:"2px",marginLeft:"2px","& .MuiSlider-thumb":{height:14,width:6,borderRadius:.75,"&.Mui-focusVisible":{boxShadow:M=>`0px 0px 0px 3px ${y.hexToRGB(M.palette.primary.main,.16)}`},"&:focus, &:hover, &.Mui-active":{boxShadow:M=>`0px 0px 0px 2px ${y.hexToRGB(M.palette.primary.main,.16)}`}},"& .MuiSlider-mark":{width:"1px",height:"8px"},"& .MuiSlider-markActive":{backgroundColor:"currentColor"},"& .MuiSlider-thumb:not(.MuiSlider-active)":{transition:c?"left 260ms ease-in":"none"}},valueLabelDisplay:"auto",size:"small",track:!1,min:0,step:1,value:m,max:200,marks:[{value:100}],onAnimationEnd:()=>g(!1),onWheel:M=>{f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),M.deltaY<0,10)))},onKeyDown:M=>{M.which===w.KeyCodes.Down||M.which===w.KeyCodes.Right?(f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10))),M.preventDefault()):M.which===w.KeyCodes.Up||M.which===w.KeyCodes.Left?(f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10))),M.preventDefault()):M.which!==w.KeyCodes.Enter&&M.which!==w.KeyCodes.Escape||h()},onChange:(M,P)=>{Math.abs(P-100)<3?f(100):f(P)},valueLabelFormat:(M,P)=>`Zoom: ${Math.round(p)}%`}),e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom In",children:e.jsx(B.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:M=>M.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:M=>{M.button!==0?M.preventDefault():j(M)},children:e.jsx(w.DynamicIcon,{iconKey:"Add"})})}),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(B.Box,{sx:{minWidth:"8px"}}),e.jsx(B.Typography,{noWrap:!0,component:"div",onClick:()=>{f(100)},sx:{cursor:"pointer",display:"flex",flex:"1 1 100%",fontSize:"0.70rem",marginLeft:"2px",marginRight:"2px",userSelect:"none",justifyContent:"center",width:T},children:e.jsx("div",{children:Math.round(p)+"%"})})]})]})}));Go.displayName="SheetZoomScale";const Xo=n.memo(n.forwardRef((a,i)=>{const{sx:o,sheet:t,gridStyle:r,children:s,childrenEnd:d,...p}=a;n.useImperativeHandle(i,()=>({}));const l=n.useRef(null);n.useEffect(()=>{const u=m=>m.preventDefault();return l.current?.addEventListener("wheel",u,{passive:!1}),()=>{l.current?.removeEventListener("wheel",u)}},[]);const c=w.useEditMode(),g=n.useMemo(()=>{const u=c.getMode();return u?.description?u.description:"Ready"},[c]),[C,f]=n.useState(!1);return e.jsxs(B.Box,{ref:l,sx:{display:"flex",alignItems:"stretch",flexDirection:"row",flex:"0",paddingLeft:"12px",paddingRight:"12px",gap:"8px",paddingTop:"1px",minHeight:"calc(1em + 8px)",overflow:C?"visible":"hidden",boxShadow:`0px -1px 0px ${r.header.edgeStrokeFill}`,...o},onMouseOver:()=>f(!0),onMouseLeave:()=>f(!1),...p,children:[s,e.jsx("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"end",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",color:u=>u.palette.text.secondary},variant:"caption",children:g})}),d?e.jsx(B.Box,{sx:{display:"flex",alignItems:"center"},children:d}):null,e.jsx(y.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(Go,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));Xo.displayName="StatusBar";var Dn,Fn,yo,In,Nn,$t={exports:{}},wt={},kt={exports:{}},On={},An={exports:{}};function Qi(){return Fn?Dn:(Fn=1,Dn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function Ji(){if(In)return yo;In=1;var a=Qi();function i(){}function o(){}return o.resetWarningCache=i,yo=function(){function t(d,p,l,c,g,C){if(C!==a){var f=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 f.name="Invariant Violation",f}}function r(){return t}t.isRequired=t;var s={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:r,element:t,elementType:t,instanceOf:r,node:t,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:o,resetWarningCache:i};return s.PropTypes=s,s},yo}function Ot(){return Nn||(Nn=1,An.exports=Ji()()),An.exports}var Ln,Vt={exports:{}},zn,xe={},ze={};function lo(){return zn||(zn=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.dontSetMe=function(a,i,o){if(a[i])return new Error(`Invalid prop ${i} passed to ${o} - do not set this, set it on the child.`)},ze.findInArray=function(a,i){for(let o=0,t=a.length;o<t;o++)if(i.apply(i,[a[o],o,a]))return a[o]},ze.int=function(a){return parseInt(a,10)},ze.isFunction=function(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Function]"},ze.isNum=function(a){return typeof a=="number"&&!isNaN(a)}),ze}var Hn,Wn,He={};function Yo(){if(Wn)return xe;Wn=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.addClassName=d,xe.addEvent=function(l,c,g,C){if(!l)return;const f={capture:!0,...C};l.addEventListener?l.addEventListener(c,g,f):l.attachEvent?l.attachEvent("on"+c,g):l["on"+c]=g},xe.addUserSelectStyles=function(l){if(!l)return;let c=l.getElementById("react-draggable-style-el");c||(c=l.createElement("style"),c.type="text/css",c.id="react-draggable-style-el",c.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
6
+ */const A=require("@sheetxl/sdk"),oe=require("@sheetxl/react"),e=require("react/jsx-runtime"),n=require("react"),B=require("@mui/material"),y=require("@sheetxl/utils-mui"),w=require("@sheetxl/utils-react"),q=require("@mui/material/styles"),Re=require("@mui/system"),et=require("react-dom"),je=require("@sheetxl/utils"),dt=require("@sheetxl/io");function ka(a){var i,o,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a)){var r=a.length;for(i=0;i<r;i++)a[i]&&(o=ka(a[i]))&&(t&&(t+=" "),t+=o)}else for(o in a)a[o]&&(t&&(t+=" "),t+=o);return t}function ie(){for(var a,i,o=0,t="",r=arguments.length;o<r;o++)(a=arguments[o])&&(i=ka(a))&&(t&&(t+=" "),t+=i);return t}const va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...p}=a,l=w.useCommands(o,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),c=n.useMemo(()=>{for(let f=0;f<l.length;f++)if(l[f]?.state())return l[f];return l[0]},[l]),g=n.useMemo(()=>{if(!t)return null;const f={...t};return delete f.beforeExecute,f},[t]),C=n.useCallback((f,u)=>{const m={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignLeftToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignCenterToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignRightToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignJustifyToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignCenterContinuousToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignFillToggle")}),e.jsx(y.CommandButton,{...m,command:u.getCommand("formatAlignDistributedHorizontalToggle")})]}),S=e.jsxs(B.Box,{sx:{className:ie("quick-buttons"),display:"flex",alignItems:"center",justifyContent:"center"},onClick:h=>h.stopPropagation(),children:[e.jsx(y.CommandButton,{command:u.getCommand("formatIndentDecrease"),commandHook:g,scope:r,disabled:s}),e.jsx(y.CommandButton,{command:u.getCommand("formatIndentIncrease"),commandHook:g,scope:r,disabled:s})]}),x=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...p,children:[S,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:b})]});return y.defaultCreatePopupPanel({...f,children:x})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,commands:o,commandHook:t,scope:r,createPopupPanel:C,label:"Horizontal Alignment",tooltip:"Configure how text is placed in the horizontal direction of the cell.",quickCommand:c?.key(),icon:c?.icon()??"FormatAlignLeft",...p})})),ja=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),{activeCommand:l,allDisabled:c}=n.useMemo(()=>{const C=p.length;let f,u=0;for(let m=0;m<C;m++){const b=p[m];b&&!b.disabled()&&(!f&&b?.state()&&(f=b),u++)}return f=f??p[0],{activeCommand:f,allDisabled:u===0}},[p]),g=n.useCallback((C,f)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignTopToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignMiddleToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignBottomToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignJustifyVerticalToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatAlignDistributedVerticalToggle")})]});return y.defaultCreatePopupPanel({...C,children:m})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:g,disabled:s||c,label:"Vertical Alignment",tooltip:"Configure how text is placed in the vertical direction of the cell.",icon:l?.icon()??"TextVerticalBottom",...d})})),Ta=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),{activeCommand:l,allDisabled:c}=n.useMemo(()=>{const C=p.length;let f,u=0;for(let m=0;m<C;m++){const b=p[m];b&&!b.disabled()&&(!f&&b?.state()&&(f=b),u++)}return f=f??p[0],{activeCommand:f,allDisabled:u===0}},[p]),g=w.useCallbackRef((C,f)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowVisibleToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowWrapToggle")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowClipToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextOverflowShrinkToggle")})]});return y.defaultCreatePopupPanel({...C,children:m})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,disabled:s||c,scope:r,label:"Text Overflow",tooltip:"Configure how text behaves when it doesn't fit within a cell.",createPopupPanel:g,icon:l?.icon()??"TextHorizontalOverflow",...d})})),Ea=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),l=n.useMemo(()=>{const C=p.length;for(let f=0;f<C;f++){const u=p[f];if(u?.state())return u}return p[1]},[p]),c=n.useCallback((C,f)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate0")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate315")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate45")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate90")}),e.jsx(y.CommandButton,{...u,command:f.getCommand("formatTextRotate270")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.InputCommandButton,{...u,command:f.getCommand("formatTextRotateCustom"),label:"Custom"})]});return y.defaultCreatePopupPanel({...C,children:m})},[s,t,r,o]),g=n.useMemo(()=>(o.getCommand("formatTextRotateCustom")?.state()??0)!==0,[p]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,selected:g,label:"Text Orientation",tooltip:"Rotate your text diagonally or vertically. This is a great way to label narrow columns.",createPopupPanel:c,quickCommand:g?"formatTextRotate0":"formatTextRotate315",icon:l?.icon()??"TextRotation315",...d})})),Ba={Preset:"preset",Custom:"custom"},pt={Start:"start",End:"end"},xo={},Li=(a,i,o,t)=>{const r=a+"-"+i+"-"+o+(t?"-server":"");if(xo[r])return xo[r];const s=((d,p,l,c)=>{if(typeof document>"u"&&!c)return null;const g=c?new c:document.createElement("canvas");g.width=2*l,g.height=2*l;const C=g.getContext("2d");return C?(C.fillStyle=d,C.fillRect(0,0,g.width,g.height),C.fillStyle=p,C.fillRect(0,0,l,l),C.translate(l,l),C.fillRect(0,0,l,l),g.toDataURL()):null})(a,i,o,t);return xo[r]=s,s},zi={},Ra=n.memo(a=>{const{className:i,style:o=w.ReactUtils.EmptyCssProperties,white:t="transparent",grey:r="grey",size:s=8,borderRadius:d,boxShadow:p,renderers:l=zi,children:c,...g}=a,C=c,f=n.useMemo(()=>Object.assign({borderRadius:d,boxShadow:p,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Li(t,r,s,l?.canvas)}) center left`},o),[t,r,s,l]);return n.isValidElement(c)?n.cloneElement(c,{...C.props}):e.jsx("div",{style:f,...g})}),Hi=n.memo(a=>{const{selectedColor:i,onSelectColor:o,onPreviewColor:t,onClick:r,onKeyDown:s,onMouseOver:d,onMouseLeave:p,onFocus:l,style:c=w.ReactUtils.EmptyCssProperties,children:g,alphaWhite:C,alphaGrey:f,darkMode:u,alphaCheckSize:m=7,...b}=a;if(!i)throw new Error("a selectedColor is required");const S=n.useCallback(T=>{r?.(T),T.isDefaultPrevented()||(T.ctrlKey?t?.(i.toRGBA()):o?.(i.toRGBA()))},[o,t,r,i]),x=n.useCallback(T=>{d?.(T),T.isDefaultPrevented()||t?.(i.toRGBA())},[t,d,i]),h=n.useCallback(T=>{p?.(T),T.isDefaultPrevented()},[t,p]),k=n.useCallback(T=>{l?.(T),T.isDefaultPrevented()||t?.(i.toRGBA())},[t,l,i]),j=n.useCallback(T=>{s?.(T),T.isDefaultPrevented()||T.keyCode===w.KeyCodes.Enter&&o?.(i.toRGBA())},[o,s,i]),v=n.useMemo(()=>i.toRGBA().alpha===1?null:e.jsx(Ra,{size:m,white:C,grey:f,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[C,f,i]);return e.jsxs("div",{style:{position:"absolute",height:"100%",width:"100%",top:"0px",left:"0px",cursor:"pointer",outline:"none",...c},tabIndex:0,...b,onClick:S,onKeyDown:j,onMouseOver:x,onMouseLeave:h,onFocus:k,children:[v,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:i.toCSS(u)},children:g})]})}),io=n.memo(a=>{const{schemeColorLookup:i,selectedColor:o,previewColor:t,colorDef:r,onSelectColorDef:s,onPreviewColorDef:d,swatchProps:p,defaultButtonSize:l=24,isLarge:c=!1,compareRGB:g=!1,darkMode:C=!1,...f}=a,u=new A.Color({val:r.definition.val,adjs:r.definition.adjs},v=>i(v)),m=g?u.toRGBA().toString():u.toString(),b=o&&(g?o.toRGBA().toString():o.toString())===m,S=t&&(g?t.toRGBA().toString():t.toString())===m,x=[];x.push({[A.IColor.AdjustmentType.Inv]:!0}),x.push({[A.IColor.AdjustmentType.Alpha]:100});const h=u.adjust(x),k=n.useCallback(()=>{s?.(r)},[s,r]),j=n.useCallback(v=>{d?.(v?r:null)},[d,r]);return e.jsx(y.SimpleTooltip,{disableInteractive:!0,PopperProps:{style:{pointerEvents:"none"},disablePortal:!0,popperOptions:{strategy:"fixed",modifiers:[{name:"preventOverflow",enabled:!0,options:{boundariesElement:"viewport"}}]}},title:r.description,placement:"bottom-start",children:e.jsx("div",{style:{width:l*(c?1.2:1)+"px",height:l*(c?1.2:1)+"px",position:"relative",boxSizing:"border-box",cursor:"pointer",outline:"none"},...f,children:e.jsxs(Hi,{selectedColor:u,title:null,onSelectColor:k,onPreviewColor:j,alphaCheckSize:c?9:void 0,darkMode:C,...p,children:[e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",top:"0px",left:"0px",pointerEvents:"none",borderColor:h.toRGBA(C).toString(),borderWidth:"2px",borderStyle:"solid",boxSizing:"border-box",opacity:b?"1":"0"}}),e.jsx("div",{style:{position:"absolute",width:.33*l*(c?1.2:1)+"px",height:.33*l*(c?1.2:1)+"px",left:"calc(50% - 0.5px)",top:"calc(50% - 0.5px)",transform:"translate(-50%,-50%)",pointerEvents:"none",background:h.toRGBA(C).toString(),borderRadius:"50%",opacity:S?"1":"0"}})]})})})}),Dt=n.memo(a=>{const{title:i,schemeColorLookup:o,colorDefs:t,selectedColor:r,previewColor:s,onSelectColorDef:d,onPreviewColorDef:p,style:l=w.ReactUtils.EmptyCssProperties,compareRGB:c=!1,darkMode:g,swatchProps:C,...f}=a;let u;if(Array.isArray(t[0]))u=t;else{u=[];for(let h=0;h<t.length;h++)u.push([t[h]])}const m=n.useCallback(h=>{d?.(h)},[d]),b=n.useCallback(h=>{p?.(h)},[p]),S=n.useMemo(()=>{let h=[];for(let k=0;k<u.length;k++){let j=[],v=u[k];for(let M=0;M<v.length;M++){let P=v[M];j.push(e.jsx(io,{schemeColorLookup:o,colorDef:P,selectedColor:r,previewColor:s,onSelectColorDef:m,onPreviewColorDef:b,swatchProps:C,compareRGB:c,darkMode:g},k+" "+M))}let T=e.jsx(B.Box,{className:"button-col",sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",boxShadow:M=>M.shadows[2],borderRadius:"2px",overflow:"hidden"},children:j},""+k);h.push(T)}return h},[u,r,s,m,b]),x=n.useMemo(()=>i?e.jsx(B.Typography,{noWrap:!0,component:"div",sx:{display:"flex",flexShrink:"0",paddingLeft:"6px",paddingBottom:"4px",paddingTop:"0px",userSelect:"none",color:h=>h.palette.text.secondary},children:i}):null,[i]);return e.jsxs(B.Box,{style:{...l},children:[x,e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...f,children:S})]})}),De=(a,i)=>({description:a,definition:{val:i,adjs:[]}}),ge=(a,i,o,t,r,s)=>{const d=De(a,i);t?.push(d);const p=new A.Color({val:d.definition.val,adjs:d.definition.adjs},o),l=p.toString();r?.set(l,p);const c=p.toRGBA().toString();s?.set(c,p)},Wi=n.lazy(()=>Promise.resolve().then(()=>require("./BrHqwHQYxx_QoXOn.cjs"))),Pa=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o=null,previewColor:t=a.selectedColor??null,recentColors:r,schemeLookup:s,disableAlpha:d=!1,previewDebounceTime:p=100,initialPanelType:l,defaultButtonSize:c=24,width:g,onElementLoad:C,onDone:f,onEyeDropStart:u,onEyeDropStop:m,onPreviewColor:b,onPreviewColorImmediate:S,onSelectColor:x,autoColor:h,autoColorLabel:k="Automatic",autoColorPosition:j=pt.Start,compareRGB:v=!1,darkMode:T=!1,...M}=a,P=t||o,D=w.useCallbackRef(b,[b]),F=w.useCallbackRef(S,[S]),E=w.useCallbackRef(x,[x]),R=w.useCallbackRef(u,[u]),N=w.useCallbackRef(m,[m]),[z,O]=n.useState(!1),H=q.useTheme(),I=n.useMemo(()=>s||A.Color.getDefaultSchemeLookup(),[s]),W=n.useMemo(()=>{const K=new Map,te=new Map,de=[];ge("Primary Background","bg1",I,de,K,te),ge("Primary Text","tx1",I,de,K,te),ge("Secondary Background","bg2",I,de,K,te),ge("Secondary Text","tx2",I,de,K,te),ge("Accent 1","accent1",I,de,K,te),ge("Accent 2","accent2",I,de,K,te),ge("Accent 3","accent3",I,de,K,te),ge("Accent 4","accent4",I,de,K,te),ge("Accent 5","accent5",I,de,K,te),ge("Accent 6","accent6",I,de,K,te);const ve=A.ITheme.buildPalette(de,I,K,te),se=[];if(ge("Dark Red","C00000",I,se,K,te),ge("Red","FF0000",I,se,K,te),ge("Orange","FFC000",I,se,K,te),ge("Yellow","FFFF00",I,se,K,te),ge("Light Green","92D050",I,se,K,te),ge("Green","00B050",I,se,K,te),ge("Light Blue","00B0F0",I,se,K,te),ge("Blue","0070C0",I,se,K,te),ge("Dark Blue","002060",I,se,K,te),d?ge("Purple Is A Fruit","7030A0",I,se,K,te):ge("Transparent","00000000",I,se,K,te),h){const ue=h.toString();K.set(ue,h)}const Fe=new Map,Te=typeof r=="function"?r():r,Oe=[];for(let ue=0;Te&&ue<Te.length;ue++){const Z=Te[ue].toString();Fe.set(Z,Te[ue]),Oe.push({description:"Recent "+(ue+1),definition:{val:Te[ue].toString()}})}return{primaryColors:de,modifiedPresets:ve,standardColors:se,recentColorsLimited:Oe,mapAllPresets:K,mapAllPresetsRGB:te,mapRecent:Fe}},[I,r,d,h]);n.useEffect(()=>{C?.()},[]);const[ee,X]=n.useState(!1),ne=n.useCallback(()=>{X(K=>!K)},[]);n.useEffect(()=>{if(l)X(l===Ba.Custom);else if(o){let K=o.toString(),te=W.mapAllPresets.get(K);te||(K=o.toRGBA().toString(),te=W.mapAllPresetsRGB.get(K));const de=W.mapRecent.get(K);X(!te&&!de)}},[o,l]);const $=n.useCallback(A.CommonUtils.debounce(K=>{D?.(K)},p),[D,p]),[U,Y]=n.useState();n.useEffect(()=>{Y(t||o)},[t,o]);const _=w.useCallbackRef(K=>{F&&(F(K),$(K))},[F]),L=w.useCallbackRef(K=>{_(K?new A.Color({val:K.definition.val,adjs:K.definition.adjs},I):null)},[I]),G=n.useCallback(K=>{K.ctrlKey&&X(!0)},[]),Q=w.useCallbackRef(K=>{let te=!1;if(K){const de=K.toString();te=!W.mapAllPresets.has(de)}E?.(K,te)},[E,W]),fe=w.useCallbackRef(K=>{const te=K?new A.Color({val:K.definition.val,adjs:K.definition.adjs},I):null;Promise.resolve(f?.()).then(()=>{Q(te)})},[I,f]),re=w.useCallbackRef(K=>{_(K?new A.Color(K,I):null)},[I]),me=n.useMemo(()=>window.EyeDropper===void 0?e.jsx(e.Fragment,{}):e.jsx(B.IconButton,{"aria-label":"eye dropper",size:"small",sx:{color:K=>K.palette.text.icon??K.palette.action.active},onClick:async()=>{O(!0),R?.(),await new EyeDropper().open().then(K=>{O(!1),N?.();let te=new A.Color(K.sRGBHex),de=te.toString(),ve=W.mapAllPresets.get(de);if(ve||(de=te.toRGBA().toString(),ve=W.mapAllPresetsRGB.get(de)),!ve){const se=te.toRGBA(),Fe=3;let Te=255;W.mapAllPresetsRGB.forEach((Oe,ue)=>{const Z=Oe.toRGBA(),le=Math.abs(Z.red-se.red)+Math.abs(Z.blue-se.blue)+Math.abs(Z.green-se.green);le<Fe&&le<Te&&(ve=Oe)})}X(!ve),_(ve||te)}).catch(K=>{O(!1),K?.name!=="AbortError"&&console.error(K)})},children:e.jsx(w.DynamicIcon,{iconKey:"Colorize"})}),[W,T]),Se=n.useMemo(()=>{if(!ee)return;const K={opacity:ee?1:"0",position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box"};return e.jsx(n.Suspense,{fallback:e.jsx("div",{style:K,children:e.jsx(y.LoadingPanel,{})}),children:e.jsx(Wi,{style:K,selectedColor:P?P.toRGBA().toString():"transparent",onColorChange:re,disableAlpha:d})})},[ee,P]),Ce=n.useMemo(()=>({onClick:G,alphaGrey:H.palette.text.icon??H.palette.action.active}),[G,H]),J=n.useMemo(()=>{if(!h)return null;const K={description:k,definition:{val:h.getVal(),adjs:h.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(B.MenuItem,{sx:{display:"flex",color:te=>te.palette.text.secondary},onMouseOver:()=>{L(null)},onClick:()=>{fe(null)},children:[e.jsx(B.Box,{sx:{flex:"none",boxShadow:te=>te.shadows[2],borderRadius:te=>te.spacing(.5),overflow:"hidden"},children:e.jsx(io,{schemeColorLookup:I,colorDef:K,selectedColor:o===null?h:o,previewColor:t===null?h:t,defaultButtonSize:c,isLarge:!0,darkMode:T,compareRGB:v,swatchProps:Ce})}),e.jsx(B.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:k})]})})},[h,k,I,o,t]);return e.jsxs(B.Box,{ref:i,sx:{width:g,outline:"none",padding:"10px 10px",overflow:"hidden",boxSizing:"content-box"},...M,children:[e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("div",{style:{opacity:ee?"0":1},children:[J&&j===pt.Start?e.jsxs(e.Fragment,{children:[J,e.jsx(B.Divider,{light:!0,style:{marginTop:"2px",marginBottom:"10px"}})]}):null,e.jsx(Dt,{title:"Theme Colors",schemeColorLookup:I,colorDefs:W.primaryColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T}),e.jsx(Dt,{schemeColorLookup:I,colorDefs:W.modifiedPresets,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T}),e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Standard Colors",schemeColorLookup:I,colorDefs:W.standardColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T}),e.jsxs("div",{style:{opacity:W.recentColorsLimited.length===0?"0":void 0,display:W.recentColorsLimited.length===0?"none":void 0},children:[e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Recent Colors",schemeColorLookup:I,colorDefs:W.recentColorsLimited,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:Ce,onPreviewColorDef:L,onSelectColorDef:fe,compareRGB:v,darkMode:T})]}),J&&j===pt.End?e.jsxs(e.Fragment,{children:[e.jsx(B.Divider,{light:!0,sx:{marginTop:"2px",marginBottom:"2px"}}),J,e.jsx("div",{style:{marginBottom:"2px"}})]}):null]}),Se]}),e.jsx(B.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:[me,e.jsx("div",{style:{flex:"1 1 100%",background:"pink"}}),e.jsx(B.Button,{style:{minWidth:"75px",maxWidth:"75px"},value:"check",variant:"outlined",size:"small",onClick:()=>{ne()},children:ee?e.jsx("div",{children:"Preset"}):e.jsx("div",{children:"Custom"})}),e.jsx(B.Button,{variant:"contained",size:"small",style:{minWidth:"75px"},onClick:()=>{Promise.resolve(f?.()).then(()=>{Q(U)})},children:"Done"})]})]})})),$i=e.jsx(w.DynamicIcon,{iconKey:"circle.colored"}),Ao=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o,quickColor:t,icon:r=$i,tooltip:s,label:d,onPreviewColor:p,onPreviewColorImmediate:l,onSelectColor:c,variant:g=y.PopupButtonType.Toolbar,panelProps:C,shouldCloseFloatAll:f=!0,compareRGB:u=!1,darkMode:m=!1,...b}=a,S=w.useCallbackRef(p,[p]),x=w.useCallbackRef(l,[l]),h=w.useCallbackRef(c,[c]),[k,j]=n.useState(()=>{}),v=t||k||o||C?.autoColor,T=n.useRef(!1),M=n.useCallback(()=>{},[]),P=w.useCallbackRef(()=>{j(o)},[o]),D=w.useCallbackRef(W=>{T.current||(j(W),S?.(W))},[S]),F=w.useCallbackRef(W=>{T.current||(j(W),x?.(W))},[x]),E=w.useCallbackRef((W,ee)=>{T.current||(j(void 0),h?.(W,ee))},[h]),R=n.useMemo(()=>e.jsx(B.Box,{className:"color-wrapper",sx:{lineHeight:"0",color:"inherit","--sxl-color-active":`${v?.toCSS(m)??"transparent"}`,"& .activeColor":{fill:`${v?.toCSS(m)??"transparent"}`},"& .style_grey":{fill:W=>W.palette.text.icon??W.palette.action.active}},children:typeof r=="function"?r():r}),[v,r,m]),N=w.useCallbackRef(W=>{h?.(t,!1)},[h,t]),[z,O]=n.useState(!1),H=n.useCallback(W=>{const{closeFloat:ee,closeFloatAll:X}=W;return e.jsx(Pa,{...C,selectedColor:o,previewColor:k,onDone:f?X:ee,onKeyDown:ne=>{ne.which===w.KeyCodes.Enter&&(f?X():ee())},onPreviewColorImmediate:F,onPreviewColor:D,onSelectColor:E,onEyeDropStart:()=>O(!0),onEyeDropStop:()=>O(!1),compareRGB:u,darkMode:m})},[o,k,f,v,C?.autoColor,m]),I={onQuickClick:t?N:void 0,createPopupPanel:H,popupProps:{popperProps:{resizeOnOverflow:!1}},onPopupOpen:P,onPopupClose:M,tooltip:s||d||"Color",label:d,icon:R,...b};return g===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...I}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...I})})),eo=82,Mo=a=>{const{styleColor:i,length:o=eo,width:t=1,dashArray:r=null,sx:s,isDouble:d=!1,isAngled:p=!1,darkMode:l=!1,...c}=a;return e.jsx(B.SvgIcon,{sx:{width:`${o}px`,height:`${t}px`,color:"inherit",overflow:"visible","& .activeColor":{stroke:g=>`${i?i.toRGBA(l).toString():g.palette.text.icon??g.palette.action.active}`},"& .style_grey":{stroke:g=>g.palette.text.icon??g.palette.action.active},...s},height:t,width:o,viewBox:`0 0 ${o} ${t}`,...c,children:e.jsx(oe.StyledStrokePath,{length:o,width:t,dashArray:r,isDouble:d,isAngled:p,className:"activeColor"})})},Ma=n.memo(n.forwardRef((a,i)=>{const{variant:o,showLabels:t=!1,disabled:r=!1,createPopupPanel:s,styleColor:d,selectedStyle:p,onSelectStyle:l,showNone:c=!0,darkMode:g,sx:C,...f}=a,u=w.useCallbackRef(l,[]),m=n.useCallback(h=>{const{popupContainer:k,floatReference:j,closeFloat:v,...T}=h,M=[],P=A.IBorder.BuiltInDefinitionsArray;for(let D=0;D<P.length;D++){const F=P[D];if(F.description==="None"&&!c)continue;const E=e.jsx(Mo,{styleColor:d,length:eo,width:F.width,darkMode:g,dashArray:F.pattern,isDouble:F.description.toLowerCase().includes("double"),isAngled:F.description.toLowerCase().includes("slant")});let R=null;R=t?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{marginRight:"6px"},children:F.description}),e.jsxs(B.Box,{sx:{marginLeft:"6px",marginRight:"6px",display:"flex",alignItems:"center",flex:"1 1 100%"},children:[e.jsx("div",{style:{flex:"1 1 100%"}}),E]})]}):F.description==="None"?"None":E,M.push(e.jsx(y.ExhibitMenuItem,{className:"border-stroke",tabIndex:0,sx:{height:"28px","& svg path.activeColor":{filter:y.createStrokeShadowFilter(4)},paddingLeft:"16px",background:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},tooltipProps:{description:t?"":F.description},icon:null,disabled:r,onMouseDown:N=>N.preventDefault(),onMouseUp:()=>{v(),u(F.style)},onKeyDown:N=>{N.which===w.KeyCodes.Enter&&v()},selected:F.style===p,parentFloat:j,children:R},D))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:M})},[r,c,d,p,g]),b=n.useMemo(()=>{const h=A.IBorder.BuiltInDefinitions.get(p);let k;return k=h.description==="None"?e.jsx(B.Box,{sx:{minWidth:`${eo}px`},children:"None"}):e.jsx(Mo,{styleColor:d,length:eo,width:h.width,dashArray:h.pattern,darkMode:g,isDouble:h.description.toLowerCase().includes("double"),isAngled:h.description.toLowerCase().includes("slant")}),e.jsx(B.Box,{className:"border-stroke",sx:{paddingLeft:"12px",marginLeft:"4px",marginRight:"4px",height:"24px",display:"flex",alignItems:"center","& svg path.activeColor":{filter:y.createStrokeShadowFilter()}},children:k})},[p,d]),S=n.useMemo(()=>A.IBorder.BuiltInDefinitions.get(p),[p]),x={disabled:r,icon:b,tooltip:"Border Style: "+S.description,sx:{background:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,...C},createPopupPanel:m,...f};return o===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{...x}):e.jsx(y.ExhibitPopupMenuItem,{...x})})),Da=n.memo(n.forwardRef((a,i)=>{const{autoColor:o=null,schemeLookup:t,autoStrokeStyle:r=A.IBorder.StrokeStyle.Thin,disabled:s=!1,darkMode:d=!1,showStylingBefore:p=!0,onSelectBorder:l,onPreviewBorder:c,selectedBorder:g,createTemporaryBorder:C,...f}=a,u=w.useCallbackRef(l,[l]),m=w.useCallbackRef(c,[c]),[b,S]=n.useState(),[x,h]=n.useState(),k=b??r,j=x??o,v=g||{bottom:{style:r,color:o?.toString()}},T=w.useCallbackRef(R=>{const N={},z=R?Object.keys(R):[];let O=!1;const H=z.length;for(let Y=0;Y<H;Y++){const _=z[Y];R[_]?.style&&(N[_]={style:R[_].style,color:R[_].color},O||N[_].style===A.IBorder.StrokeStyle.None||(O=!0))}z.length<6&&(O=!0);const I=O?N.left:null,W=O?N.top:null,ee=O?N.right:null,X=O?N.bottom:null,ne=O?N.vertical:null,$=O?N.horizontal:null;let U="";return W||I||(U+="M 3,5 H 5 V 3 H 3 "),W||(U+="M 7,5 H 9 V 3 H 7 "),W||ne||(U+="M 11,5 h 2 V 3 h -2 "),W||(U+="M 15,5 h 2 V 3 h -2 "),W||ee||(U+="M 19,5 h 2 V 3 h -2 "),I||(U+="M 3,9 H 5 V 7 H 3 "),ne||(U+="M 11,9 h 2 V 7 h -2 "),ee||(U+="M 19,9 h 2 V 7 h -2 "),$||I||(U+="M 3,13 H 5 V 11 H 3 "),$||(U+="M 7,13 H 9 V 11 H 7 "),$||ne||(U+="M 11,13 h 2 v -2 h -2 "),$||ee||(U+="M 19,13 h 2 v -2 h -2 "),$||(U+="M 15,13 h 2 v -2 h -2 "),I||(U+="M 3,17 H 5 V 15 H 3 "),ne||(U+="M 11,17 h 2 v -2 h -2 "),ee||(U+="M 19,17 h 2 v -2 h -2 "),X||I||(U+="M 3,21 H 5 V 19 H 3 "),X||(U+="M 7,21 H 9 V 19 H 7 "),X||ne||(U+="M 11,21 h 2 v -2 h -2 "),X||(U+="M 15,21 h 2 v -2 h -2 "),X||ee||(U+="M 19,21 h 2 v -2 h -2 "),e.jsxs(w.DynamicIcon,{children:[" ",e.jsxs(B.Box,{className:"border-icon",sx:{width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",position:"relative","& .grid > path":{opacity:"0.8"}},children:[e.jsx("svg",{viewBox:"0 0 24 24",className:"grid",style:{top:"0px",left:"0px",width:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",height:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",position:"absolute"},children:e.jsx("path",{className:"fill",d:U})}),e.jsx(B.Box,{className:"border-container",sx:{position:"absolute",display:"flex",justifyContent:"stretch",alignItems:"stretch",top:"0px",left:"0px",width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",padding:"1px 1px","& svg path":{filter:y.strokeShadowFilter}},children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:(Y,_)=>{if(!C||z.length===0)return null;const L=Y.rowIndex,G=Y.colIndex,Q={};return L===0?(Q.top=N.top,Q.bottom=N.horizontal):(Q.top=N.horizontal,Q.bottom=N.bottom),G===0?(Q.left=N.left,Q.right=N.vertical):(Q.left=N.vertical,Q.right=N.right),C?.(Q)},darkMode:d,style:{top:"2px",left:"2px",width:"calc(100% - 5px)",height:"calc(100% - 5px)",position:"absolute"}})})]})]})},[j,k,d]),M=n.useCallback((R,N,z)=>{let O=null;if(R&&R.length>0){let H=null;(N||z)&&(H={style:z,color:N?.toString()??null}),O={};const I=R.length;for(let W=0;W<I;W++)O[R[W]]=H}return O},[]),P=n.useCallback(R=>{u?.(R)},[]),D=n.useCallback(R=>{m?.(R)},[]),F=n.useCallback(R=>{const{closeFloatAll:N,floatReference:z}=R,O=(W,ee,X="bottom",ne=!1)=>{const $=M(W,j??null,ne?A.IBorder.StrokeStyle.None:k??null),U=ne?M([],j??null,k??null):$;return e.jsx(y.ExhibitIconButton,{icon:T(U),sx:{background:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},tooltipProps:{label:ee,simple:!0,placement:X},onClick:()=>{N(),D($),P($)}})},H=e.jsxs(e.Fragment,{children:[e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"All Borders","top"),O([A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"Inner Borders","top"),O([A.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),O([A.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom],"Outside Borders","top")]}),e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left],"Left Borders"),O([A.IBorder.Edge.Top],"Top Borders"),O([A.IBorder.Edge.Right],"Right Borders"),O([A.IBorder.Edge.Bottom],"Bottom Borders"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical,A.IBorder.Edge.DiagonalUp,A.IBorder.Edge.DiagonalDown],"No Borders","bottom",!0)]})]}),I=e.jsx(e.Fragment,{children:e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",flexDirection:"row",gap:"6px"},children:[e.jsx(Ao,{variant:y.PopupButtonType.Toolbar,icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),selectedColor:k===A.IBorder.StrokeStyle.None?new A.Color("transparent"):j,onPreviewColor:W=>{h(W)},onSelectColor:(W,ee)=>{h(W)},darkMode:d,tooltip:"Border Color",panelProps:{disableAlpha:!0,autoColor:o,schemeLookup:t},disabled:s||k===A.IBorder.StrokeStyle.None,parentFloat:z,shouldCloseFloatAll:!1}),e.jsx(Ma,{selectedStyle:k,onSelectStyle:S,styleColor:j,darkMode:d,variant:y.PopupButtonType.Toolbar,parentFloat:z})]})});return e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},onClick:W=>W.stopPropagation(),children:[p?I:H,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),p?H:I]})},[k,j,o,t,d]),E=n.useMemo(()=>T(v),[v,d]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,createPopupPanel:F,popupProps:{popperProps:{resizeOnOverflow:!1}},createTooltip:({children:R},N)=>e.jsx(y.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:N,children:R}),onQuickClick:()=>{u?.(v)},quickButtonProps:{sx:{}},disabled:s,icon:E,...f})})),Fa=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,variant:s=w.CommandButtonType.Toolbar,disabled:d=!1,autoColor:p,autoStrokeStyle:l,schemeLookup:c,createTemporaryBorder:g,selectedBorder:C,onSelectBorder:f,darkMode:u,icon:m,label:b,...S}=a,x=w.useCommands(o,["formatBorder"]),h=t??x[0],k=h?.context()??null,j=k?.autoColor??p,v=k?.autoStyle??l,T=C??k?.quickBorder,M=u??k?.darkMode,P=g??k?.createTemporaryBorder,D=c??k?.schemeLookup,F=w.useCallbackRef(R=>{k?.onBorderSelect&&k.onBorderSelect(R),f?.(R),h?.execute(R,r)},[h,f,r]),E=n.useCallback((R,N)=>{const{children:z,title:O,...H}=R;let I=R.children;return(h?.disabled()||d)&&(I=e.jsx("div",{children:I})),e.jsx(y.CommandTooltip,{command:h,placement:s===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:N,...H,children:I})},[h,d]);return e.jsx(Da,{ref:i,autoColor:j,darkMode:M,autoStrokeStyle:v,createTemporaryBorder:P,schemeLookup:D,selectedBorder:T,onSelectBorder:F,createTooltip:E,disabled:d||!h||h.disabled(),...S})})),Ia=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:c.getCommand("mergeToggle")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("mergeHorizontal")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("mergeVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:c.getCommand("unmerge")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,quickCommand:"mergeToggle",commandHook:t,scope:r,tooltip:"Combine or split cells.",createPopupPanel:p,icon:"MergeAll",...d})})),Na=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:c.getCommand("freezeToggle")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("freezeToggleHorizontal")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("freezeToggleVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:c.getCommand("unfreeze")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:p,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:"Freeze",...d})})),Oa=n.memo(n.forwardRef((a,i)=>e.jsx(y.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["find","findReplace","goto"],scope:"find",label:"Find & Select",tooltip:"Find and replace cells or go to a specific location.",quickCommand:"find",icon:"Find"}))),Aa=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,showQuickButtons:r=!!a.commands,commands:s,fontSizes:d=A.FontUtils.DefaultFontSizes,disabled:p=!1,parentFloat:l,icon:c,label:g,sx:C,...f}=a;w.useCommand(o);const u=()=>o?.state()?.toString()||"11",[m,b]=n.useState(u),S=w.useCallbackRef(()=>{const P=parseFloat(m);isNaN(P)?b(u()):parseFloat(u())!==P&&o.execute(P,t)},[u,o,m,t]);n.useEffect(()=>{b(u())},[o?.state()]);const x=n.useMemo(()=>{if(!t)return null;const P={...t};return delete P.beforeExecute,P},[t]),h=w.useCommands(s,["formatFontSizeIncrease","formatFontSizeDecrease"]),k=n.useMemo(()=>h?e.jsxs(B.Box,{className:ie("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:P=>P.stopPropagation(),children:[e.jsx(y.CommandButton,{command:h[0],commandHook:x}),e.jsx(y.CommandButton,{command:h[1],commandHook:x})]}):null,[h]),j=q.useTheme(),v=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("12.3",Math.round(j.typography.fontSize),j.typography.fontFamily).width}px`,[j]),T=n.useCallback(P=>{const{onMouseDown:D,onMouseUp:F,...E}=P;return e.jsx(B.IconButton,{component:"div",...E,disableRipple:!0,children:e.jsx(B.Input,{inputMode:"numeric",disabled:p||!o||o.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:R=>`1px solid ${R.palette.text.icon??R.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:R=>`1px solid ${R.palette.error.main}`},"::after":{borderBottom:R=>`1px solid ${R.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:R=>`${Math.round(R.typography.fontSize)}px`,width:v,color:R=>R.palette.text.secondary,input:{padding:"0 0",textAlign:"center",height:"1rem",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:R=>R.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:R=>R.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"}},value:m,onFocus:R=>{R.target?.select()},onKeyDown:R=>{if(R.which===w.KeyCodes.Enter)u()!==m&&(R.stopPropagation(),R.preventDefault(),S());else if(R.which===w.KeyCodes.Escape)u()!==m&&(b(u()),setTimeout(()=>{R.target?.select()},0),R.stopPropagation(),R.preventDefault());else{if(R.key.match("[-]")||R.key.match("[0-9.]")&&(m+R.key).length>4)return R.stopPropagation(),void R.preventDefault();if(R.which===w.KeyCodes.Space)return void R.preventDefault()}},onBlur:()=>{S()},onChange:R=>{if(R.target.value.length>4)return R.stopPropagation(),void R.preventDefault();b(R.target.value)}})})},[m,p,o]),M=n.useCallback(P=>{const D=N=>{o?.execute(N,t)},F=o?.state(),E=[];for(let N=0;N<d.length;N++){const z=d[N]===F;E.push(e.jsx(y.ExhibitMenuItem,{selected:z,icon:z?e.jsx(y.SelectedIcon,{}):void 0,disabled:p||!o||o.disabled(),onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&D(d[N])},onKeyDown:O=>{O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||D(d[N])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:d[N]})},"fontSize-"+N))}const R=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...f,children:[k,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:E})]});return y.defaultCreatePopupPanel({...P,children:R})},[p,o?.state(),t]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...C},tabIndex:-1,outlined:!0,disabled:p,parentFloat:l,createPopupPanel:M,createTooltip:({children:P},D)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:D||o?.disabled(),children:P}),createQuickButton:T,...f})})),Pn=n.memo(a=>{const{selected:i,disabled:o,formattedValue:t,handleSetFormat:r,format:s,sx:d,...p}=a;return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...d},disabled:o,selected:i,icon:i?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:l=>{l.button===0&&l.preventDefault()},onMouseUp:l=>{l.button===0&&r(s.numberFormat)},onKeyDown:l=>{l.keyCode!==w.KeyCodes.Enter&&l.keyCode!==w.KeyCodes.Space||r(s.numberFormat)},...p,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(B.Typography,{component:"div",children:[s.formatType,s.formatType===A.NumberFormat.Type.Custom?"…":""]}),e.jsx(B.Typography,{variant:"caption",component:"div",sx:{color:l=>Re.alpha(l.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),La=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,sx:s,disabled:d=!1,parentFloat:p,...l}=a,c=w.useCommands(o,["formatNumberFormat"])[0],g=c?.state()?A.NumberFormat.Styles.lookupStyle(c?.state()).formatType:A.NumberFormat.Type.General,C=n.useMemo(()=>{if(!t)return null;const b={...t};return delete b.beforeExecute,b},[t]),f=n.useCallback((b,S)=>{const x=F=>{t?.beforeExecute?.(c,c?.state()),c.execute(F,t),t?.onExecute?.(c,c?.state())},h=c?.context()(),k=A.NumberFormat.Styles.lookupPrimary(),j=[];for(let F=0;F<k.length;F++){let E="";if(h&&!h.isEmpty())try{E=h.getNumberFormat(k[F].numberFormat).displayText}catch(N){console.warn(N)}E===""&&k[F].formatType===A.NumberFormat.Type.General&&(E="No specific format");const R=k[F].formatType===g;j.push(e.jsx(Pn,{selected:R,disabled:d||!c||c.disabled(),formattedValue:E,handleSetFormat:x,format:k[F]},k[F].formatType))}const v={numberFormat:"",formatType:A.NumberFormat.Type.Custom},T=g===A.NumberFormat.Type.Custom,M=e.jsx(Pn,{selected:T,disabled:d||!c||c.disabled(),formattedValue:T?h.getNumberFormat().displayText:"",handleSetFormat:()=>{t?.beforeExecute?.(c,c?.state()),S.getCommand("formatNumberDialog")?.execute(c?.state()),t?.onExecute?.(c,c?.state())},format:v,sx:{flex:"0",width:"100%"}},A.NumberFormat.Type.Custom),P=e.jsxs(B.Box,{className:"quick-buttons",sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:F=>F.stopPropagation(),children:[e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatAccountingStyle"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatPercentStyle"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatCommaStyle"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatIncreaseDecimal"),commandHook:C,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatDecreaseDecimal"),commandHook:C,scope:r})]}),D=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...l,children:[P,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:j}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),M]});return y.defaultCreatePopupPanel({...b,children:D})},[c?.context(),c?.state(),t,r]),u=q.useTheme(),m=n.useMemo(()=>{const b=A.NumberFormat.Type.MediumTime;return`${A.IFont.getSharedMeasurer()(b,Math.round(u.typography.fontSize),u.typography.fontFamily).width}px`},[u]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,sx:s,outlined:!0,disabled:d,parentFloat:p,createPopupPanel:f,createTooltip:({children:b},S)=>e.jsx(y.ExhibitTooltip,{label:c?.label(),description:c?.description(),disabled:S,children:b}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:b=>`${Math.round(b.typography.fontSize)}px`,color:b=>b.palette.text.secondary,fontFamily:b=>b.typography.fontFamily,width:m},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...l})})),Lo=n.memo(n.forwardRef((a,i)=>e.jsx(y.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["clearAll","clearFormats","clearContents","clearComments","clearHyperlinks"],scope:"clear",label:"Clear",tooltip:"Clear everything in the cell, or remove just the formatting or contents.",icon:"ClearAll"}))),za=n.memo(n.forwardRef((a,i)=>e.jsx(y.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["fillDown","fillRight","fillUp","fillLeft"],scope:"fill",label:"Fill",tooltip:"Fill the selected cells with the value from one of the corners.",icon:"FillDown"}))),zo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:p=!0,showQuickButton:l=!0,variant:c=w.CommandButtonType.Toolbar,...g}=a,C=["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns","addSheet"];d||C.push("addSheet");const f=w.useCommands(o,C),{singleCommand:u,allDisabled:m}=n.useMemo(()=>{let S=null,x=0;const h=f.length;for(let k=0;k<h;k++){const j=f[k];j&&!j.disabled()&&(p&&c===w.CommandButtonType.Menuitem&&(S=x===0?j:null),x++)}return{singleCommand:S,allDisabled:x===0}},[f]),b=n.useCallback((S,x)=>{let h=null;const k={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertCells",disabled:s};d||(h=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...k,command:x.getCommand("addSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...k,command:f[0]}),e.jsx(y.CommandButton,{...k,command:f[1]}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...k,command:f[2]}),e.jsx(y.CommandButton,{...k,command:f[3]}),h]});return y.defaultCreatePopupPanel({...S,children:j})},[s,f,t,r]);return u?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:u,...g}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,quickCommand:"insertCells",commands:o,commandHook:t,scope:r,disabled:s||m,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:b,...g})})),Ho=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:p=!0,showQuickButton:l=!0,variant:c=w.CommandButtonType.Toolbar,...g}=a,C=["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"];d||C.push("deleteSheet");const f=w.useCommands(o,C),{singleCommand:u,allDisabled:m}=n.useMemo(()=>{let S=null,x=0;const h=f.length;for(let k=0;k<h;k++){const j=f[k];j&&!j.disabled()&&(p&&c===w.CommandButtonType.Menuitem&&(S=x===0?j:null),x++)}return{singleCommand:S,allDisabled:x===0}},[f]),b=n.useCallback((S,x)=>{const h={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:s};let k=null;d||(k=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteCellsShiftUp")}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteCellsShiftLeft")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteRows")}),e.jsx(y.CommandButton,{...h,command:x.getCommand("deleteColumns")}),k]});return y.defaultCreatePopupPanel({...S,children:j})},[s,t,r]);return u?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:u,...g}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,quickCommand:"deleteCells",commands:o,commandHook:t,scope:r,disabled:s||m,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:b,...g})})),Wo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,...s}=a,d=n.useCallback((p,l)=>{const c={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"formatCells"},g={commands:l,parentFloat:p.floatReference,...c},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...c,command:l.getCommand("resizeRows")}),e.jsx(y.CommandButton,{...c,command:l.getCommand("autoFitRows")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...c,command:l.getCommand("resizeColumns")}),e.jsx(y.CommandButton,{...c,command:l.getCommand("autoFitColumns")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{ref:i,...g,popupCommandKeys:["hideColumns","hideRows",null,"unhideColumns","unhideRows"],popupScope:"hideUnhide",label:"Hide & Unhide"})]});return y.defaultCreatePopupPanel({...p,children:C})},[t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,createPopupPanel:d,icon:"CellsFormat",label:"Format Cells",tooltip:"Change row and column sizes or visibility.",...s})}));Wo.displayName="CellsFormatCommandButton";const ht=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,onSelectColor:r,disabled:s=!1,variant:d=w.CommandButtonType.Toolbar,quickColor:p,panelProps:l,isSplit:c=!1,darkMode:g,icon:C,...f}=a,{autoColor:u,schemeLookup:m,recentColors:b,...S}=l;if(f.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");w.useCommand(o);const x=o?.context();let h=p??x?.quickColor;c&&!h&&(h=new A.Color("transparent"));const k=u??x?.autoColor,j=m??x?.schemeLookup,v=b??x?.recentColors,T=g??x?.darkMode,M=n.useMemo(()=>({autoColor:k,schemeLookup:j,recentColors:v,darkMode:T,...S}),[k,j,v,T]),P=w.useCallbackRef((F,E)=>{F&&E&&x?.addRecentColor&&x.addRecentColor(F),x?.onColorSelect&&x.onColorSelect(F),r?.(F,E),o?.execute(F,t)},[o,r,t,x]),D=n.useCallback((F,E)=>{const{children:R,title:N,...z}=F;let O=F.children;return(o?.disabled()||s)&&(O=e.jsx("div",{children:O})),e.jsx(y.CommandTooltip,{command:o,placement:d===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:E,...z,children:O})},[o,s]);return e.jsx(Ao,{ref:i,panelProps:M,icon:C??o?.icon(x),quickColor:h,selectedColor:o?.state(),onSelectColor:P,variant:d===w.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:D,label:o?.label(),disabled:s||!o||o.disabled(),compareRGB:!0,darkMode:T,...f})}));ht.displayName="ColorCommandButton";const Ha=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...p}=a,l=w.useCommands(o,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("gridlinesToggle")}),e.jsx(ht,{...f,command:C.getCommand("sheetViewFormatGridlinesColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleGridlinesRows")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Gridlines",tooltip:"Configure how the lines between rows and columns in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:l[0],scope:"view"}),...p})})),$o=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},C=c.getCommand("sortCustom"),f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:c.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...g,command:c.getCommand("sortDescending")}),C?e.jsx(y.CommandButton,{...g,command:C}):null,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...l,children:f})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,disabled:s,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:p,icon:"SortFilter",...d})})),Vi=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=n.useCallback((l,c)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:c.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,disabled:s,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:p,icon:"FilterToggle",...d})})),Vo=n.memo(n.forwardRef((a,i)=>{const{quickCommand:o,icon:t,isRedo:r=!1,nestRedo:s=!0,undoManager:d,scope:p,sx:l,disabled:c,commands:g,...C}=a,f=[o];!r&&s&&f.push("redo");const u=w.useCommands(g,f),m=u[0],b=u[1],S=d??m?.context?.()?.undoManager;let x=c;c||(x=!m||m.disabled(),b&&!b.disabled()&&(x=!1));const[h,k]=n.useState(0),j=n.useCallback((v,T)=>{let M=h===0?"Cancel":`${m.label()} ${h} Action${h===1?"":"s"}`,P=!1;S||(P=!0),P||(P=s?!S.hasRedo()&&!S.hasUndo():!S.hasRedo());const D=O=>{m.execute(O)},F=e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:P?void 0:"0 0",minWidth:"180px"},icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(0)},onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&D(h)},onKeyDown:O=>{O.isDefaultPrevented()||O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||D(h)},children:e.jsx(B.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:M})});if(P)return F;const E=r?S?.getRedoDescriptions():S?.getUndoDescriptions(),R=[];for(let O=0;O<E.length;O++){const H=E[O];R.push(e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},disabled:x,selected:O<h,icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(O+1)},onMouseDown:I=>{I.button===0&&I.preventDefault()},onMouseUp:I=>{I.button===0&&D(O+1)},onKeyDown:I=>{I.isDefaultPrevented()||I.keyCode!==w.KeyCodes.Enter&&I.keyCode!==w.KeyCodes.Space||D(O+1)},children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",alignItems:"center",overflow:"hidden"},children:[e.jsx(B.Typography,{component:"div",children:H}),e.jsx(w.DynamicIcon,{})]})},`action:${O}`))}let N=null;if(!r&&s){const O={scope:"undo",commands:T,variant:w.CommandButtonType.Menuitem,parentFloat:v.floatReference};N=[],N.push(e.jsx(Vo,{...O,quickCommand:"redo",isRedo:!0},"nested:redo")),S.hasRedo()&&S.hasUndo()&&N.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"action:redo-div"))}const z=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},onClick:()=>{v.closeFloatAll()},onMouseLeave:()=>{k(0)},children:[N,e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:R}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),F]});return y.defaultCreatePopupPanel({...v,children:z})},[m?.context(),m?.state(),p,S,h,x]);return e.jsx(y.CommandPopupButton,{ref:i,commands:g,quickCommand:o,scope:p,disabled:x,label:m?.label()??(r?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${m?.label()??"No"} last actions.`})}),createPopupPanel:j,icon:t??(r?"Redo":"Undo"),selected:!1,...C})})),ft=A.IFontCollection.getFontList(),Wa=new Map;for(let a=0;a<ft.length;a++)Wa.set(ft[a].fontRef.getFamily(),ft[a]);const $a=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,sx:r,disabled:s=!1,parentFloat:d,icon:p,label:l,...c}=a;w.useCommand(o);const g=o?.state(),C=q.useTheme(),f=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("Times New Roman",Math.round(C.typography.fontSize),C.typography.fontFamily).width}px`,[C]),u=n.useCallback(m=>{const b=k=>{o?.execute(k,t)},S=[];for(let k=0;k<ft.length;k++)S.push({key:ft[k].fontRef.getFamily(),description:ft[k].fontRef.getFamily()});Wa.get(g)||S.unshift({key:g,description:g});const x=[];for(let k=0;k<S.length;k++){const j=S[k].key===g;x.push(e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",paddingTop:"4px",paddingBottom:"4px"},selected:j,disabled:s||!o||o.disabled(),icon:j?e.jsx(y.SelectedIcon,{}):void 0,onMouseUp:v=>{v.button===0&&b(S[k].key)},onMouseDown:v=>{v.button===0&&v.preventDefault()},onKeyDown:v=>{v.keyCode!==w.KeyCodes.Enter&&v.keyCode!==w.KeyCodes.Space||b(S[k].key)},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:()=>S[k]?.key},children:S[k].description})})},k+""+S[k].key))}const h=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},...c,children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:x})});return y.defaultCreatePopupPanel({...m,children:h})},[s,o?.state()]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...r},outlined:!0,disabled:s,parentFloat:d,createPopupPanel:u,createTooltip:({children:m},b)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:b,children:m}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:m=>`${Math.round(m.typography.fontSize)}px`,fontFamily:m=>m.typography.fontFamily,color:m=>m.palette.text.secondary,width:f},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...c})})),Va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),l=n.useMemo(()=>{const g=p.length;for(let C=0;C<g;C++){const f=p[C];if(f?.state())return f}return p[0]},[p]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("formatStrikeThroughToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatSuperscriptToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatSubscriptToggle")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Text Effects",tooltip:"Style your text to differentiate it.",icon:l?.icon()??"TextStrike",...d})})),_a=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),l=n.useMemo(()=>{const g=p.length;for(let C=0;C<g;C++)if(p[C]?.state())return p[C];return p[0]},[p]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedDoubleToggle")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedAccountingToggle"),commandHook:t}),e.jsx(y.CommandButton,{...f,command:C.getCommand("formatUnderlinedAccountingDoubleToggle")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,label:"Underline",tooltip:"All underline stylings.",createPopupPanel:c,icon:l?.icon()??"TextUnderline",...d})})),_o=n.memo(n.forwardRef((a,i)=>{const{command:o,commands:t,commandHook:r,scope:s,includePasteAllInPopup:d=!0,disabled:p=!1,...l}=a,c=w.useCallbackRef((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,commandHook:r,scope:"paste",disabled:p},u=[];return d&&(u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("paste"),key:"paste"})),u.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteValues"),key:"pasteValues"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteFormats"),key:"pasteFormats"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteFormulas"),key:"pasteFormulas"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteTranspose"),key:"pasteTranspose"})),u.push(n.createElement(y.CommandButton,{...f,command:C.getCommand("pasteLinks"),key:"pasteLinks"})),y.defaultCreatePopupPanel({...g,children:u})},[p,r,s,d]);return e.jsx(y.CommandPopupButton,{ref:i,commands:t,commandHook:r,scope:s,createPopupPanel:c,label:"Paste",tooltip:"Add content to the clipboard to your document.",quickCommand:"paste",...l})})),Ka=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...p}=a,l=w.useCommands(o,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),c=n.useCallback((g,C)=>{const f={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadings")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(y.CommandButton,{...f,command:C.getCommand("sheetViewToggleShowHeadingRows")})]});return y.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Headings",tooltip:"Configure how the column and rows headings in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:l[0],scope:"view"}),...p})})),Ua=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="view",disabled:s=!1,...d}=a,p=n.useCallback(l=>{const c={variant:w.CommandButtonType.Menuitem,parentFloat:l.floatReference,commandHook:t,scope:r,disabled:s},g=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowFormulaBar")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowTabs")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowStatusBar")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowHorizontalScrollBar")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowVerticalScrollBar")})]});return y.defaultCreatePopupPanel({...l,children:g})},[s,o,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Workbook View",tooltip:"Options to configure how the workbook is displayed.",createPopupPanel:p,icon:e.jsx(y.LabelIcon,{icon:null,label:"Workbook View"}),...d})})),qa=n.memo(n.forwardRef((a,i)=>{const{value:o,cellStyle:t,styles:r,createTemporaryCell:s,bodyStyle:d,sx:p,borderProps:l,disabled:c,...g}=a,C=n.useMemo(()=>s({value:o,style:t}),[o,t,s]),f=n.useMemo(()=>C.getStyle(),[C,d]),u=n.useMemo(()=>f.getFill().toCSS(d?.darkMode??!1),[f]),m=f.getInsets(),b=f.getFont(),S=n.useCallback(()=>f.getBorder(),[f]);return e.jsx(B.Box,{ref:i,sx:{width:"100px",height:"100%",textOverflow:"ellipsis",display:"flex",alignItems:"stretch",background:d?.fill,filter:c?"grayscale(0.4) opacity(0.8);":"none","& .fill":{flex:"1 1 100%",overflow:"hidden",...u},"& .text":{flex:"1 1 100%",...b.toCSS(d?.darkMode??!1,1),boxSizing:"border-box",padding:`${m.top}px ${m.right}px ${m.bottom}px ${m.left}px`,margin:"0px",outline:"none",resize:"none",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"baseline",textDecoration:b.toCSS().textDecoration,textAlign:A.ITextFrame.toCSSHorizontalTextAlign(C.getRenderHorizontalAlignment()),background:"transparent",maxHeight:"100%",whiteSpace:"pre",wordWrap:"break-word"},...p},...g,children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:S,darkMode:d?.darkMode??!1,rowCount:1,columnCount:1,style:{height:"100%",width:"100%",...l?.style},...l,children:e.jsx(B.Box,{className:"fill",sx:{paddingLeft:"4px",paddingRight:"4px",marginLeft:"-1px",marginTop:"-1px",marginRight:"-2px",marginBottom:"-2px",display:"flex",alignItems:"center"},children:e.jsx(B.Box,{className:"text",children:o})})})})})),_i=n.memo(a=>{const{styles:i,namedStyle:o,selectedNamed:t,hasContextMenu:r=!0,bodyStyle:s,onSelectNamed:d,createTemporaryCell:p,parentFloat:l,commands:c,disabled:g,commandHook:C,...f}=a,u=n.useCallback(S=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:C,context:"cellStyle"},h=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,style:{fontWeight:550},command:c.getCommand("formatCellStyle"),commandState:o,disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:c.getCommand("modifyCellStyle"),commandState:{named:o}}),e.jsx(y.CommandButton,{...x,command:c.getCommand("deleteCellStyle"),commandState:o,disabled:g||o?.getName()===A.IStyle.BuiltInName.Normal})]}),k=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:h})});return y.defaultCreatePopupPanel({...S,children:k})},[]),m=o?.getName()===t?.getName();let b=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:S=>`solid ${m?S.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName(),placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{d?.(o)},...f,children:e.jsx(qa,{value:o.getName(),cellStyle:{named:o.getName()},styles:i,createTemporaryCell:p,bodyStyle:s})},o.getName());return r&&(b=e.jsx(y.ContextMenu,{label:o.getName(),parentFloat:l,createPopupPanel:u,children:b})),b}),Ga=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedNamed:s,onSelectNamed:d,disabled:p=!1,bodyStyle:l,usePreviewIcon:c=!0,...g}=a;w.useCommand(t);const C=t?.context(),f=C?.styles,u=s??C?.named(),m=l??C?.bodyStyle(),b=w.useCallbackRef(j=>{d?.(j),t?.execute(j,r)},[t,d,r]),S=n.useCallback((j,v)=>{const T={onSelectNamed:b,styles:f(),parentFloat:j.floatReference},M=f().getCustomNamed(),P=new Map,D=[];for(let I=0;I<M.length;I++)P.set(M[I].getName(),M[I]),f().getNamed(M[I].getName()).getBuiltInID()===null&&D.push(M[I].getName());const F=I=>{let W=P.get(I);return W||(W=f().getNamed(I)),!W||W.isHidden()?null:e.jsx(_i,{namedStyle:W,selectedNamed:u,bodyStyle:C.bodyStyle(),createTemporaryCell:C.createTemporaryCell,commands:o,commandHook:r,...T},I)},E=(I,W,ee=!0)=>{const X=[];for(let ne=0;ne<W.length;ne++){const $=F(W[ne]);$&&X.push($)}return X.length===0?null:e.jsxs(B.Box,{children:[ee?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:I},I+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:X},I+"-presets")]},I)},R=(I,W)=>{const ee=[];for(let X=0;X<W.length;X++){const ne=F(W[X]);ne&&ee.push(ne)}return ee.length===0?null:e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",flexDirection:"column",flex:"0 0 0%"},children:ee},I+"-presets")},N=[];N.push(E("Custom",D,!1)),N.push(E("Good, Bad and Neutral",[A.IStyle.BuiltInName.Normal,A.IStyle.BuiltInName.Bad,A.IStyle.BuiltInName.Good,A.IStyle.BuiltInName.Neutral],D.length>0)),N.push(E("Data and Model",[A.IStyle.BuiltInName.Calculation,A.IStyle.BuiltInName.CheckCell,A.IStyle.BuiltInName.ExplanatoryText,A.IStyle.BuiltInName.FollowedHyperlink,A.IStyle.BuiltInName.Hyperlink,A.IStyle.BuiltInName.Input,A.IStyle.BuiltInName.LinkedCell,A.IStyle.BuiltInName.Note,A.IStyle.BuiltInName.Output,A.IStyle.BuiltInName.WarningText])),N.push(E("Titles and Headings",[A.IStyle.BuiltInName.Heading1,A.IStyle.BuiltInName.Heading2,A.IStyle.BuiltInName.Heading3,A.IStyle.BuiltInName.Heading4,A.IStyle.BuiltInName.Title,A.IStyle.BuiltInName.Total]));let z=[];var O,H;return z.push(R("Accent 1",[A.IStyle.BuiltInName.Accent1_20,A.IStyle.BuiltInName.Accent1_40,A.IStyle.BuiltInName.Accent1_60,A.IStyle.BuiltInName.Accent1])),z.push(R("Accent 2",[A.IStyle.BuiltInName.Accent2_20,A.IStyle.BuiltInName.Accent2_40,A.IStyle.BuiltInName.Accent2_60,A.IStyle.BuiltInName.Accent2])),z.push(R("Accent 3",[A.IStyle.BuiltInName.Accent3_20,A.IStyle.BuiltInName.Accent3_40,A.IStyle.BuiltInName.Accent3_60,A.IStyle.BuiltInName.Accent3])),z.push(R("Accent 4",[A.IStyle.BuiltInName.Accent4_20,A.IStyle.BuiltInName.Accent4_40,A.IStyle.BuiltInName.Accent4_60,A.IStyle.BuiltInName.Accent4])),z.push(R("Accent 5",[A.IStyle.BuiltInName.Accent5_20,A.IStyle.BuiltInName.Accent5_40,A.IStyle.BuiltInName.Accent5_60,A.IStyle.BuiltInName.Accent5])),z.push(R("Accent 6",[A.IStyle.BuiltInName.Accent6_20,A.IStyle.BuiltInName.Accent6_40,A.IStyle.BuiltInName.Accent6_60,A.IStyle.BuiltInName.Accent6])),N.push((O="Themed Cell Styles",H=z,e.jsxs(B.Box,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.ExhibitMenuHeader,{children:O},O+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:H},O+"-presets")]},O))),N.push(E("Number Format",[A.IStyle.BuiltInName.Comma,A.IStyle.BuiltInName.Comma0,A.IStyle.BuiltInName.Currency,A.IStyle.BuiltInName.Currency0,A.IStyle.BuiltInName.Percent])),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:I=>`${I.shape.borderRadius}px`,paddingBottom:I=>`${I.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",paddingTop:"6px",paddingBottom:"0px",paddingLeft:"16px",paddingRight:"16px"},children:N}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:u,command:v.getCommand("newCellStyle"),context:"styles",commandHook:r,disabled:p})]})},[u,f?.().getTheme(),m]),x=w.useCallbackRef(j=>{const v=18/A.IFont.getDeviceScale(),T=C?.createTemporaryCell(j);return T.getStyle().getFont().getSize()<=v?T:T.createTemporaryCell({style:{font:{size:v}}})},[C?.createTemporaryCell]),h=p||!t||t.disabled(),k=n.useMemo(()=>C&&c?e.jsx(qa,{value:u?.getName()??"Custom",cellStyle:u?{named:u.getName()}:void 0,styles:C.styles(),createTemporaryCell:x,bodyStyle:C.bodyStyle(),className:"outline-hover",disabled:h,sx:{marginRight:"4px",borderRadius:"2px",minHeight:"calc(100% - 2px)",overflow:"hidden",outline:j=>`1px solid ${j.palette.action.hover}`},borderProps:{style:{height:"calc(100% - 2px)",width:"calc(100% - 1px)"}}}):t?.icon(),[u,m,h,t]);return e.jsx(y.CommandPopupButton,{ref:i,createPopupPanel:S,outlined:c,commands:o,createTooltip:({children:j},v)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:v,children:j}),selected:!1,disabled:h,label:t?.label(),icon:k,...g})})),Xa="_sheetxl-reset_11z3j_1",Ki=10,Ko=n.memo(n.forwardRef((a,i)=>{const{styles:o,table:t,tableStyle:r=t?.getStyle()??o.getDefaultTableStyle(),bodyStyle:s,sx:d,disabled:p,className:l,forceThinBorder:c,cellHeight:g=Ki,isLive:C=!1,...f}=a,u=Math.ceil(1.3*g),[m,b]=n.useReducer(j=>j+1,0);n.useEffect(()=>{if(C&&t)return t.addListeners({onAnyChange:()=>{b()}})},[t,C]);const S=n.useMemo(()=>{let j=t?.toJSON()??{};const v={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return j&&(j.styleOptions={...j.styleOptions,name:r.getName()}),j.ref=v,new A.Table({initialAnchor:v,json:j,styles:o})},[m,t,r,o]),x=n.useMemo(()=>{const j=[];for(let v=0;v<5;v++)for(let T=0;T<5;T++){const M=S.getStyleAt({colIndex:T,rowIndex:v});j.push(M)}return j},[S]),h=n.useMemo(()=>{const j=(T,M,P)=>{let D=P.getFill().toCSS(s?.darkMode??!1);const F=u-(M<4?1:0),E=g-(T<4?1:0),R=P.getFont().getFill().toCSS(s?.darkMode??!1);return D={...D,position:"absolute",boxSizing:"border-box",left:M*(u-1),top:T*(g-1),width:F,height:E},e.jsx("td",{className:`table-style-fill ${T}-${M}`,style:D,children:e.jsx("div",{className:`table-style-text ${T}-${M}`,style:{position:"absolute",boxSizing:"border-box",width:"6px",left:(F-6)/2,top:(E-1)/2,borderTop:`1px solid ${R}`}})},`${T}-${M}`)},v=[];for(let T=0;T<5;T++){const M=[];for(let P=0;P<5;P++){const D=x[5*T+P];M.push(j(T,P,D))}v.push(e.jsx("tr",{children:M},T))}return v},[S,r,s]),k=n.useCallback((j,v)=>x[v].getBorder()??null,[x]);return e.jsx(B.Box,{ref:i,className:"table-format-preview",sx:{background:s?.fill,filter:p?"grayscale(0.4) opacity(0.8);":"none","& .styled-element":{position:"absolute"},...d},...f,children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:k,rowCount:5,columnCount:5,forceThinBorder:c,width:5*(u-1)+1,height:5*(g-1)+1,darkMode:s?.darkMode??!1,style:{pointerEvents:"none"},children:e.jsx("table",{className:ie(l,"sheetxl-table-preview",Xa),style:{borderCollapse:"collapse",width:5*(u-1)+1,height:5*(g-1)+1},children:e.jsx("tbody",{children:h})})})})})),St=(a,i,o,t,r)=>{a.beginPath(),a.moveTo(i+.5,o+.5),a.lineTo(t+.5,r+.5),a.stroke()},Ya=n.memo(n.forwardRef((a,i)=>{const{table:o,tableStyle:t,styles:r,bodyStyle:s,disabled:d,style:p,className:l,canvas:c,...g}=a,C=n.useMemo(()=>{const m=o.toJSON(),b={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return m.styleOptions={...m.styleOptions,name:t.getName()},m.ref=b,new A.Table({initialAnchor:b,json:m,styles:r})},[o,t,r]),f=n.useMemo(()=>{const m=[];for(let b=0;b<5;b++)for(let S=0;S<5;S++){const x=C.getStyleAt({colIndex:S,rowIndex:b});m.push(x)}return m},[C]),u=n.useMemo(()=>{let m=c;if(c||(m=document.createElement("canvas")),!m)return null;m.width!==61&&(m.width=61),m.height!==46&&(m.height=46);const b=m.getContext("2d",{alpha:!1});if(!b)return null;const S=12,x=s?.darkMode??!1;for(let h=0;h<5;h++)for(let k=0;k<5;k++){const j=f[5*h+k].getFill();let v=s?.fill;j.getType()===A.IFill.Type.Solid?v=j.getColor().toCSS(x,!1):j.getType()===A.IFill.Type.Gradient?v=j.getStops[0]?.color.toCSS(x,!1):j.getType()===A.IFill.Type.Pattern&&(v=j.getForeground().toCSS(x,!1)),b.fillStyle=v;const T=k*S,M=9*h;b.fillRect(T,M,13,10)}b.lineWidth=1;for(let h=0;h<5;h++)for(let k=0;k<5;k++){const j=f[5*h+k],v=k*S,T=9*h,M=j.getBorder();if(!M.isEmpty()){const F=M.getLeft();F.isNone()||(b.strokeStyle=F.getColor().toCSS(x,!1),St(b,v,T,v,T+9));const E=M.getTop();E.isNone()||(b.strokeStyle=E.getColor().toCSS(x,!1),St(b,v,T,v+S,9*h));const R=M.getRight();R.isNone()||(b.strokeStyle=R.getColor().toCSS(x,!1),St(b,v+S,T,v+S,T+9));const N=M.getBottom();N.isNone()||(b.strokeStyle=N.getColor().toCSS(x,!1),St(b,v,T+9,v+S,T+9))}b.strokeStyle=j.getFont().getFill().toCSS(x,!1);const P=4,D=2.5;St(b,k*S+D,9*h+P,k*S+D+7,9*h+P)}return`url(${m.toDataURL()})`},[c,C,t,s]);return e.jsx("div",{ref:i,className:ie("table-style-preview",l),style:{backgroundImage:u,width:61,height:46,...p},...g})})),Ui="_table-style-options-container_1kfn2_1",qi="_table-style-options_1kfn2_1",Za=n.memo(n.forwardRef((a,i)=>{const{styleOptions:o,onStyleOptionsChange:t,showHeaderRow:r,onShowHeaderRowChange:s,showTotalRow:d,onShowTotalRowChange:p,showFilterButton:l,onShowFilterButtonChange:c,sx:g,className:C,disabled:f,...u}=a;return e.jsx("div",{className:Ui,children:e.jsxs(B.Box,{sx:{pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:m=>`${m.spacing(2)}`,marginRight:m=>`${m.spacing(2)}`},"& .MuiCheckbox-root":{padding:m=>`${m.spacing(.5)}`},...g},...u,ref:i,className:ie(C,qi),children:[s&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:r??!1,indeterminate:r==null,onChange:()=>s(!r),disabled:f||r==null}),label:"Header Row",labelPlacement:"end"}),p&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:d??!1,indeterminate:d==null,onChange:()=>p(!d),disabled:f||d==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showRowStripes??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showRowStripes:!o?.showRowStripes})}}),label:"Banded Rows",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showFirstColumn??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showFirstColumn:!o?.showFirstColumn})}}),label:"First Column",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showLastColumn??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showLastColumn:!o?.showLastColumn})}}),label:"Last Column",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showColumnStripes??!1,indeterminate:!o,disabled:f||!o,onChange:()=>{t?.({...o,showColumnStripes:!o?.showColumnStripes})}}),label:"Banded Columns",labelPlacement:"end"}),c&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:l??!1,indeterminate:l==null,disabled:f||!o||l==null,onChange:()=>c(!l)}),label:"Filter Button",labelPlacement:"end"})]})})}));function bo(a,i){if(typeof a=="function")return a(i);a&&(a.current=i)}var tt=parseInt(n.version.split(".")[0],10)>=19?function(a){return i=>{const o=[];for(const t of a){const r=bo(t,i),s=typeof r=="function";o.push(s?r:()=>bo(t,null))}return()=>{for(const t of o)t()}}}:function(a){return i=>{for(const o of a)bo(o,i)}},Gi=function(){},Qa=typeof window<"u",ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Xi=Qa?n.useLayoutEffect:n.useEffect,Mn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const _e=Qa&&window.ResizeObserver!==void 0?function(){var a=n.useState(null),i=a[0],o=a[1],t=n.useState(Mn),r=t[0],s=t[1],d=n.useMemo(function(){return new window.ResizeObserver(function(p){if(p[0]){var l=p[0].contentRect,c=l.x,g=l.y,C=l.width,f=l.height,u=l.top,m=l.left,b=l.bottom,S=l.right;s({x:c,y:g,width:C,height:f,top:u,left:m,bottom:b,right:S})}})},[]);return Xi(function(){if(i)return d.observe(i),function(){d.disconnect()}},[i]),[o,r]}:function(){return[Gi,Mn]},Yi="_range-row_akhf4_1",Zi="_action-row_akhf4_15",Ja=n.createContext(null);Ja.displayName="HookFormContext";const er=()=>n.useContext(Ja);typeof window<"u"?n.useLayoutEffect:n.useEffect;const Uo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,style:t,className:r,sx:s,defaultInput:d,value:p,formName:l,formOptions:c,onChangeInput:g,onValidate:C,onKeyDown:f,...u}=a,m=er(),b=l&&m?m.register(l,c):null,[S,x]=n.useState(""),[h,k]=n.useState(""),[j,v]=n.useState(p);n.useEffect(()=>{v(p),k("")},[p]);const T=w.useCallbackRef(E=>{let R="";try{v(E),C?.(E),g?.(E)}catch(N){R=N.message??"Invalid Name"}l&&m&&(R?m.setError(l,{message:R}):m.clearErrors(l)),k(R)},[p,C,g]),M=w.useCallbackRef(async E=>{E.keyCode===w.KeyCodes.Escape&&S!==p&&(T(S),m?.setValue(l,S),m?.clearErrors(l),E.stopPropagation()),f?.(E)},[f,S,p,m]),P=w.useCallbackRef(E=>{x(E.target.value??"")},[]),D=w.useCallbackRef(E=>{x(""),b?.onBlur(E)},[]),F=n.useCallback(E=>{T(E.target.value),b?.onChange(E)},[b]);return e.jsx(B.FormControl,{sx:{paddingTop:E=>E.spacing(1.5),minWidth:135,width:"100%",...s},size:"small",ref:i,className:ie("named-input",r),...u,children:e.jsx(B.TextField,{label:"Name",placeholder:d,onFocus:P,onBlur:D,inputRef:b?.ref,disabled:o,error:!!h,helperText:h||" ",sx:{"& .MuiFormHelperText-root":{marginTop:E=>E.spacing(.5)}},slotProps:{inputLabel:{shrink:!0},htmlInput:{className:"autoFocus",name:l,spellCheck:!1,autoComplete:"off",readOnly:o,sx:{paddingTop:E=>E.spacing(1.25),paddingBottom:E=>E.spacing(.75),backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`}}},value:j??"",onChange:F,onKeyDownCapture:M,onContextMenu:E=>{E.stopPropagation()}})})}));Uo.displayName="NamedInput";const Wt=a=>a===null?"":a.toString(),qo=n.memo(n.forwardRef((a,i)=>{const{formName:o,formOptions:t,disabled:r,style:s,className:d,sx:p,onKeyDown:l,value:c,onChangeInput:g,resolvedAddress:C,...f}=a,u=er(),m=o&&u?u.register(o,t):null,[b,S]=n.useState(""),[x,h]=n.useState(!1),[k,j]=n.useState(()=>Wt(c));n.useEffect(()=>{j(Wt(c)),S(""),o&&u&&u.clearErrors(o),h(!1)},[c]);const v=w.useCallbackRef(R=>{let N="";try{j(R);const z=Wt(c),O=C(R);O.toString()!==z&&g?.(O)}catch{N="Invalid Range"}o&&u&&(N?u.setError(o,{message:N}):u.clearErrors(o)),S(N),h(!0)},[k,g,o,u]),T=w.useCallbackRef(async R=>{if(x&&R.keyCode===w.KeyCodes.Escape){const N=Wt(c);j(N),S(""),h(!1),R.stopPropagation()}l?.(R)},[c,g,l,x]),M=w.useCallbackRef(R=>{m?.onBlur(R)},[m]),P=n.useCallback(R=>{v(R.target.value),m?.onChange(R)},[m]),[D,F]=n.useState(!1),E=n.useMemo(()=>e.jsx(B.InputAdornment,{tabIndex:-1,sx:{display:"flex",position:"relative",flex:"0"},position:"end",children:e.jsx(y.ExhibitOptionButton,{disabled:!0,selected:D,onSelectToggle:R=>{F(R)},label:"Select Range",icon:e.jsx(w.DynamicIcon,{iconKey:"SelectRangeMode"})})}),[D]);return e.jsx(B.FormControl,{sx:{paddingTop:R=>R.spacing(1.5),minWidth:135,width:"100%",...p},size:"small",ref:i,className:ie("range-input",d),...f,children:e.jsx(B.TextField,{label:"Range",placeholder:"Enter Range",onBlur:M,disabled:r,error:!!b,inputRef:m?.ref,helperText:b||" ",sx:{"& .MuiFormHelperText-root":{marginTop:R=>R.spacing(.5)}},slotProps:{input:{endAdornment:E},inputLabel:{shrink:!0},htmlInput:{spellCheck:!1,autoComplete:"off",readOnly:r,name:o,sx:{paddingTop:R=>R.spacing(1.25),paddingBottom:R=>R.spacing(.75)}}},value:k??"",onChange:P,onKeyDownCapture:T,onContextMenu:R=>{R.stopPropagation()}})})}));qo.displayName="RangeInput";const Be=[];Be.push(De("Primary Background","bg1")),Be.push(De("Primary Text","tx1")),Be.push(De("Secondary Background","bg2")),Be.push(De("Secondary Text","tx2")),Be.push(De("Accent 1","accent1")),Be.push(De("Accent 2","accent2")),Be.push(De("Accent 3","accent3")),Be.push(De("Accent 4","accent4")),Be.push(De("Accent 5","accent5")),Be.push(De("Accent 6","accent6"));const tr=a=>{const{docTheme:i,onSelectTheme:o,darkMode:t,isSelected:r,outlined:s,sx:d,...p}=a,l=q.useTheme(),c=n.useMemo(()=>{let g=[];for(let C=0;C<Be.length;C++){const f=Be[C];g.push(e.jsx(io,{schemeColorLookup:i.schemeLookup(),colorDef:f,darkMode:t,selectedColor:null},C+"-colorDef"))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"none"},children:e.jsx(B.Box,{sx:{display:"flex",boxShadow:C=>C.shadows[2]},children:g})})},[i,l]);return e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:g=>`solid ${r?g.palette.text.primary:"transparent"} 1px`,"&:hover:not([disabled])":{border:g=>`solid ${g.palette.text.primary} 1px !important`}},icon:null,...p,children:e.jsxs(B.Box,{sx:{border:g=>`solid ${g.palette.divider} 1px`,minWidth:"200px",borderRadius:"2px",padding:"4px 4px",textAlign:"left",display:"flex",gap:"4px",flexDirection:"column",alignItems:"stretch",color:g=>r?g.palette.text.primary:void 0,"&:hover:not([disabled])":{color:g=>g.palette.text.primary}},children:[e.jsx(B.Box,{sx:{},children:i.getName()}),e.jsxs(B.Box,{sx:{paddingTop:"6px",paddingLeft:"12px",paddingRight:"12px",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[c,e.jsx(B.Box,{sx:{flex:"1 1 100%",textOverflow:"ellipsis",overflow:"hidden",marginTop:"2px",whiteSpace:"pre",fontFamily:()=>i.getFontScheme().getMajorFont()},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,slotProps:{popper:{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 '${i.getFontScheme().getMajorFont()}'.`}),placement:"bottom-start",children:e.jsx("div",{children:i.getFontScheme().getMinorFont()})})})]})]})})},or=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,sx:s,disabled:d=!1,darkMode:p,...l}=a,c=n.useMemo(()=>{const g=o?.getItems({selected:t})??[],C=[];if(g.length===0)return e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"6px",paddingBottom:"6px"},children:"No themes"});const f=g.length;for(let u=0;u<f;u++){const m=g[u],b=t&&m?.getName()===t.getName(),S=g[u+1];S&&S.isCustom()!==m.isCustom()&&C.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${u}`)),C.push(e.jsx(tr,{docTheme:m,onSelectTheme:()=>r(m),isSelected:b,disabled:d,darkMode:p,onMouseDown:x=>{x.button===0&&x.preventDefault()},onMouseUp:x=>{x.button===0&&r(m)},onKeyDown:x=>{x.keyCode!==w.KeyCodes.Enter&&x.keyCode!==w.KeyCodes.Space||r(m)}},m.getName()))}return C},[t,r,p]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},ref:i,...l,children:e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"2px"},children:"Themes"}),e.jsx(y.ExhibitDivider,{}),e.jsx(B.Box,{sx:{flex:"1 1 100%",overflow:"auto",padding:"6px 16px"},children:c})]})})})),nr=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,icon:s,tooltip:d,label:p,variant:l=y.PopupButtonType.Toolbar,darkMode:c,panelProps:g,...C}=a,f=s||e.jsx(w.DynamicIcon,{iconKey:"Theme2"}),u=n.useCallback(b=>{const{closeFloatAll:S}=b;return e.jsx(or,{...g,themes:o,selectedTheme:t,onSelectTheme:r,darkMode:c,onKeyDown:x=>{x.which===w.KeyCodes.Enter&&S()}})},[o,t,r,g,c]),m={createPopupPanel:u,tooltip:d||p||"Theme",label:p,icon:f,...C};return l===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...m}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...m})})),Go=n.memo(n.forwardRef((a,i)=>{const{sheet:o,className:t,debounceDelay:r=220,sx:s,...d}=a,[p,l]=n.useState(()=>o.getView().getZoomScale()),[c,g]=n.useState(null),C=n.useRef(0);oe.useModelListener(o,{onViewChange:()=>{g(!0),C.current===0&&l(o.getView().getZoomScale())}}),n.useEffect(()=>{C.current=0,g(!1),l(o.getView().getZoomScale())},[o]),n.useEffect(()=>{C.current!==0&&A.CommonUtils.debounce(()=>{p===C.current&&(C.current=0,o.getView().update({zoomScale:p}))},r)()},[p,r]);const f=w.useCallbackRef(M=>{let P=M;M<100?P=Math.round(M/(10/9)+10):M>100&&(P=Math.round(3*M-200)),C.current=P,g(!0),l(P)},[o]),u=M=>{let P=M;return M<100?P=10/9*(M-10):M>100&&(P=(M+200)/3),P},m=u(p),[b,S]=n.useState(null),x=n.useRef(null),h=n.useCallback(()=>{const M=b;M&&requestAnimationFrame(()=>{x.current?.contains(document.activeElement)&&M.focus()})},[]),k=w.useMouseDownAndHoldListener(()=>{f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10)))}),j=w.useMouseDownAndHoldListener(()=>f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10)))),v=q.useTheme(),T=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("100%",Math.round(v.typography.fontSize),v.typography.fontFamily).width}px`,[v]);return e.jsxs(B.Box,{ref:i,className:ie(t),sx:{padding:"0px 0px",display:"flex",alignItems:"center",color:M=>M.palette.text.secondary,...s},onFocus:M=>{M.relatedTarget&&!b&&S(M.relatedTarget)},onBlur:M=>{b&&!x?.current?.contains(M.relatedTarget)&&S(null)},onMouseDown:M=>{M.button===0&&M.preventDefault()},onMouseUp:M=>{M.button===0&&h()},...d,children:[e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom Out",children:e.jsx(B.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:M=>M.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:M=>{M.button!==0?M.preventDefault():k(M)},children:e.jsx(w.DynamicIcon,{iconKey:"Remove"})})}),e.jsx(B.Slider,{ref:x,sx:{flex:"1 1 100%",padding:"6px 0px !important",marginRight:"2px",marginLeft:"2px","& .MuiSlider-thumb":{height:14,width:6,borderRadius:.75,"&.Mui-focusVisible":{boxShadow:M=>`0px 0px 0px 3px ${y.hexToRGB(M.palette.primary.main,.16)}`},"&:focus, &:hover, &.Mui-active":{boxShadow:M=>`0px 0px 0px 2px ${y.hexToRGB(M.palette.primary.main,.16)}`}},"& .MuiSlider-mark":{width:"1px",height:"8px"},"& .MuiSlider-markActive":{backgroundColor:"currentColor"},"& .MuiSlider-thumb:not(.MuiSlider-active)":{transition:c?"left 260ms ease-in":"none"}},valueLabelDisplay:"auto",size:"small",track:!1,min:0,step:1,value:m,max:200,marks:[{value:100}],onAnimationEnd:()=>g(!1),onWheel:M=>{f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),M.deltaY<0,10)))},onKeyDown:M=>{M.which===w.KeyCodes.Down||M.which===w.KeyCodes.Right?(f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10))),M.preventDefault()):M.which===w.KeyCodes.Up||M.which===w.KeyCodes.Left?(f(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10))),M.preventDefault()):M.which!==w.KeyCodes.Enter&&M.which!==w.KeyCodes.Escape||h()},onChange:(M,P)=>{Math.abs(P-100)<3?f(100):f(P)},valueLabelFormat:(M,P)=>`Zoom: ${Math.round(p)}%`}),e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom In",children:e.jsx(B.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:M=>M.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:M=>{M.button!==0?M.preventDefault():j(M)},children:e.jsx(w.DynamicIcon,{iconKey:"Add"})})}),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(B.Box,{sx:{minWidth:"8px"}}),e.jsx(B.Typography,{noWrap:!0,component:"div",onClick:()=>{f(100)},sx:{cursor:"pointer",display:"flex",flex:"1 1 100%",fontSize:"0.70rem",marginLeft:"2px",marginRight:"2px",userSelect:"none",justifyContent:"center",width:T},children:e.jsx("div",{children:Math.round(p)+"%"})})]})]})}));Go.displayName="SheetZoomScale";const Xo=n.memo(n.forwardRef((a,i)=>{const{sx:o,sheet:t,gridStyle:r,children:s,childrenEnd:d,...p}=a;n.useImperativeHandle(i,()=>({}));const l=n.useRef(null);n.useEffect(()=>{const u=m=>m.preventDefault();return l.current?.addEventListener("wheel",u,{passive:!1}),()=>{l.current?.removeEventListener("wheel",u)}},[]);const c=w.useEditMode(),g=n.useMemo(()=>{const u=c.getMode();return u?.description?u.description:"Ready"},[c]),[C,f]=n.useState(!1);return e.jsxs(B.Box,{ref:l,sx:{display:"flex",alignItems:"stretch",flexDirection:"row",flex:"0",paddingLeft:"12px",paddingRight:"12px",gap:"8px",paddingTop:"1px",minHeight:"calc(1em + 8px)",overflow:C?"visible":"hidden",boxShadow:`0px -1px 0px ${r.header.edgeStrokeFill}`,...o},onMouseOver:()=>f(!0),onMouseLeave:()=>f(!1),...p,children:[s,e.jsx("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"end",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",color:u=>u.palette.text.secondary},variant:"caption",children:g})}),d?e.jsx(B.Box,{sx:{display:"flex",alignItems:"center"},children:d}):null,e.jsx(y.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(Go,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));Xo.displayName="StatusBar";var Dn,Fn,yo,In,Nn,$t={exports:{}},wt={},kt={exports:{}},On={},An={exports:{}};function Qi(){return Fn?Dn:(Fn=1,Dn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function Ji(){if(In)return yo;In=1;var a=Qi();function i(){}function o(){}return o.resetWarningCache=i,yo=function(){function t(d,p,l,c,g,C){if(C!==a){var f=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 f.name="Invariant Violation",f}}function r(){return t}t.isRequired=t;var s={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:r,element:t,elementType:t,instanceOf:r,node:t,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:o,resetWarningCache:i};return s.PropTypes=s,s},yo}function Ot(){return Nn||(Nn=1,An.exports=Ji()()),An.exports}var Ln,Vt={exports:{}},zn,xe={},He={};function lo(){return zn||(zn=1,Object.defineProperty(He,"__esModule",{value:!0}),He.dontSetMe=function(a,i,o){if(a[i])return new Error(`Invalid prop ${i} passed to ${o} - do not set this, set it on the child.`)},He.findInArray=function(a,i){for(let o=0,t=a.length;o<t;o++)if(i.apply(i,[a[o],o,a]))return a[o]},He.int=function(a){return parseInt(a,10)},He.isFunction=function(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Function]"},He.isNum=function(a){return typeof a=="number"&&!isNaN(a)}),He}var Hn,Wn,We={};function Yo(){if(Wn)return xe;Wn=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.addClassName=d,xe.addEvent=function(l,c,g,C){if(!l)return;const f={capture:!0,...C};l.addEventListener?l.addEventListener(c,g,f):l.attachEvent?l.attachEvent("on"+c,g):l["on"+c]=g},xe.addUserSelectStyles=function(l){if(!l)return;let c=l.getElementById("react-draggable-style-el");c||(c=l.createElement("style"),c.type="text/css",c.id="react-draggable-style-el",c.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
8
8
  `,c.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
9
- `,l.getElementsByTagName("head")[0].appendChild(c)),l.body&&d(l.body,"react-draggable-transparent-selection")},xe.createCSSTransform=function(l,c){const g=r(l,c,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:g}},xe.createSVGTransform=function(l,c){return r(l,c,"")},xe.getTouch=function(l,c){return l.targetTouches&&(0,a.findInArray)(l.targetTouches,g=>c===g.identifier)||l.changedTouches&&(0,a.findInArray)(l.changedTouches,g=>c===g.identifier)},xe.getTouchIdentifier=function(l){if(l.targetTouches&&l.targetTouches[0])return l.targetTouches[0].identifier;if(l.changedTouches&&l.changedTouches[0])return l.changedTouches[0].identifier},xe.getTranslation=r,xe.innerHeight=function(l){let c=l.clientHeight;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(g.paddingTop),c-=(0,a.int)(g.paddingBottom),c},xe.innerWidth=function(l){let c=l.clientWidth;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(g.paddingLeft),c-=(0,a.int)(g.paddingRight),c},xe.matchesSelector=t,xe.matchesSelectorAndParentsTo=function(l,c,g){let C=l;do{if(t(C,c))return!0;if(C===g)return!1;C=C.parentNode}while(C);return!1},xe.offsetXYFromParent=function(l,c,g){const C=c===c.ownerDocument.body?{left:0,top:0}:c.getBoundingClientRect(),f=(l.clientX+c.scrollLeft-C.left)/g,u=(l.clientY+c.scrollTop-C.top)/g;return{x:f,y:u}},xe.outerHeight=function(l){let c=l.clientHeight;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(g.borderTopWidth),c+=(0,a.int)(g.borderBottomWidth),c},xe.outerWidth=function(l){let c=l.clientWidth;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(g.borderLeftWidth),c+=(0,a.int)(g.borderRightWidth),c},xe.removeClassName=p,xe.removeEvent=function(l,c,g,C){if(!l)return;const f={capture:!0,...C};l.removeEventListener?l.removeEventListener(c,g,f):l.detachEvent?l.detachEvent("on"+c,g):l["on"+c]=null},xe.scheduleRemoveUserSelectStyles=function(l){window.requestAnimationFrame?window.requestAnimationFrame(()=>{s(l)}):s(l)};var a=lo(),i=(function(l,c){if(typeof WeakMap=="function")var g=new WeakMap,C=new WeakMap;return(function(f,u){if(!u&&f&&f.__esModule)return f;var m,b,S={__proto__:null,default:f};if(f===null||typeof f!="object"&&typeof f!="function")return S;if(m=u?C:g){if(m.has(f))return m.get(f);m.set(f,S)}for(const x in f)x!=="default"&&{}.hasOwnProperty.call(f,x)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(f,x))&&(b.get||b.set)?m(S,x,b):S[x]=f[x]);return S})(l,c)})((function(){if(Hn)return He;Hn=1,Object.defineProperty(He,"__esModule",{value:!0}),He.browserPrefixToKey=g,He.browserPrefixToStyle=function(C,f){return f?`-${f.toLowerCase()}-${C}`:C},He.default=void 0,He.getPrefix=c;const l=["Moz","Webkit","O","ms"];function c(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const f=window.document?.documentElement?.style;if(!f||C in f)return"";for(let u=0;u<l.length;u++)if(g(C,l[u])in f)return l[u];return""}function g(C,f){return f?`${f}${(function(u){let m="",b=!0;for(let S=0;S<u.length;S++)b?(m+=u[S].toUpperCase(),b=!1):u[S]==="-"?b=!0:m+=u[S];return m})(C)}`:C}return He.default=c(),He})());let o="";function t(l,c){return o||(o=(0,a.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(g){return(0,a.isFunction)(l[g])})),!!(0,a.isFunction)(l[o])&&l[o](c)}function r(l,c,g){let{x:C,y:f}=l,u=`translate(${C}${g},${f}${g})`;return c&&(u=`translate(${`${typeof c.x=="string"?c.x:c.x+g}`}, ${`${typeof c.y=="string"?c.y:c.y+g}`})`+u),u}function s(l){if(l)try{if(l.body&&p(l.body,"react-draggable-transparent-selection"),l.selection)l.selection.empty();else{const c=(l.defaultView||window).getSelection();c&&c.type!=="Caret"&&c.removeAllRanges()}}catch{}}function d(l,c){l.classList?l.classList.add(c):l.className.match(new RegExp(`(?:^|\\s)${c}(?!\\S)`))||(l.className+=` ${c}`)}function p(l,c){l.classList?l.classList.remove(c):l.className=l.className.replace(new RegExp(`(?:^|\\s)${c}(?!\\S)`,"g"),"")}return xe}var $n,Fe={};function ar(){if($n)return Fe;$n=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},Fe.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},Fe.createCoreData=function(t,r,s){const d=!(0,a.isNum)(t.lastX),p=o(t);return d?{node:p,deltaX:0,deltaY:0,lastX:r,lastY:s,x:r,y:s}:{node:p,deltaX:r-t.lastX,deltaY:s-t.lastY,lastX:t.lastX,lastY:t.lastY,x:r,y:s}},Fe.createDraggableData=function(t,r){const s=t.props.scale;return{node:r.node,x:t.state.x+r.deltaX/s,y:t.state.y+r.deltaY/s,deltaX:r.deltaX/s,deltaY:r.deltaY/s,lastX:t.state.x,lastY:t.state.y}},Fe.getBoundPosition=function(t,r,s){if(!t.props.bounds)return[r,s];let{bounds:d}=t.props;d=typeof d=="string"?d:(function(l){return{left:l.left,top:l.top,right:l.right,bottom:l.bottom}})(d);const p=o(t);if(typeof d=="string"){const{ownerDocument:l}=p,c=l.defaultView;let g;if(d==="parent"?g=p.parentNode:g=p.getRootNode().querySelector(d),!(g instanceof c.HTMLElement))throw new Error('Bounds selector "'+d+'" could not find an element.');const C=g,f=c.getComputedStyle(p),u=c.getComputedStyle(C);d={left:-p.offsetLeft+(0,a.int)(u.paddingLeft)+(0,a.int)(f.marginLeft),top:-p.offsetTop+(0,a.int)(u.paddingTop)+(0,a.int)(f.marginTop),right:(0,i.innerWidth)(C)-(0,i.outerWidth)(p)-p.offsetLeft+(0,a.int)(u.paddingRight)-(0,a.int)(f.marginRight),bottom:(0,i.innerHeight)(C)-(0,i.outerHeight)(p)-p.offsetTop+(0,a.int)(u.paddingBottom)-(0,a.int)(f.marginBottom)}}return(0,a.isNum)(d.right)&&(r=Math.min(r,d.right)),(0,a.isNum)(d.bottom)&&(s=Math.min(s,d.bottom)),(0,a.isNum)(d.left)&&(r=Math.max(r,d.left)),(0,a.isNum)(d.top)&&(s=Math.max(s,d.top)),[r,s]},Fe.getControlPosition=function(t,r,s){const d=typeof r=="number"?(0,i.getTouch)(t,r):null;if(typeof r=="number"&&!d)return null;const p=o(s),l=s.props.offsetParent||p.offsetParent||p.ownerDocument.body;return(0,i.offsetXYFromParent)(d||t,l,s.props.scale)},Fe.snapToGrid=function(t,r,s){const d=Math.round(r/t[0])*t[0],p=Math.round(s/t[1])*t[1];return[d,p]};var a=lo(),i=Yo();function o(t){const r=t.findDOMNode();if(!r)throw new Error("<DraggableCore>: Unmounted during event!");return r}return Fe}var Vn,_n,Kn,Un,vt={},_t={};function rr(){return Vn||(Vn=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.default=function(){}),_t}function el(){if(_n)return vt;_n=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var a=(function(u,m){if(typeof WeakMap=="function")var b=new WeakMap,S=new WeakMap;return(function(x,h){if(!h&&x&&x.__esModule)return x;var k,j,v={__proto__:null,default:x};if(x===null||typeof x!="object"&&typeof x!="function")return v;if(k=h?S:b){if(k.has(x))return k.get(x);k.set(x,v)}for(const T in x)T!=="default"&&{}.hasOwnProperty.call(x,T)&&((j=(k=Object.defineProperty)&&Object.getOwnPropertyDescriptor(x,T))&&(j.get||j.set)?k(v,T,j):v[T]=x[T]);return v})(u,m)})(n),i=p(Ot()),o=p(Je),t=Yo(),r=ar(),s=lo(),d=p(rr());function p(u){return u&&u.__esModule?u:{default:u}}function l(u,m,b){return(m=(function(S){var x=(function(h,k){if(typeof h!="object"||!h)return h;var j=h[Symbol.toPrimitive];if(j!==void 0){var v=j.call(h,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(h)})(S,"string");return typeof x=="symbol"?x:x+""})(m))in u?Object.defineProperty(u,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):u[m]=b,u}const c={start:"touchstart",move:"touchmove",stop:"touchend"},g={start:"mousedown",move:"mousemove",stop:"mouseup"};let C=g,f=class extends a.Component{constructor(){super(...arguments),l(this,"dragging",!1),l(this,"lastX",NaN),l(this,"lastY",NaN),l(this,"touchIdentifier",null),l(this,"mounted",!1),l(this,"handleDragStart",u=>{if(this.props.onMouseDown(u),!this.props.allowAnyClick&&typeof u.button=="number"&&u.button!==0)return!1;const m=this.findDOMNode();if(!m||!m.ownerDocument||!m.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:b}=m;if(this.props.disabled||!(u.target instanceof b.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(u.target,this.props.handle,m)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(u.target,this.props.cancel,m))return;u.type!=="touchstart"||this.props.allowMobileScroll||u.preventDefault();const S=(0,t.getTouchIdentifier)(u);this.touchIdentifier=S;const x=(0,r.getControlPosition)(u,S,this);if(x==null)return;const{x:h,y:k}=x,j=(0,r.createCoreData)(this,h,k);(0,d.default)("DraggableCore: handleDragStart: %j",j),(0,d.default)("calling",this.props.onStart),this.props.onStart(u,j)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(b),this.dragging=!0,this.lastX=h,this.lastY=k,(0,t.addEvent)(b,C.move,this.handleDrag),(0,t.addEvent)(b,C.stop,this.handleDragStop))}),l(this,"handleDrag",u=>{const m=(0,r.getControlPosition)(u,this.touchIdentifier,this);if(m==null)return;let{x:b,y:S}=m;if(Array.isArray(this.props.grid)){let h=b-this.lastX,k=S-this.lastY;if([h,k]=(0,r.snapToGrid)(this.props.grid,h,k),!h&&!k)return;b=this.lastX+h,S=this.lastY+k}const x=(0,r.createCoreData)(this,b,S);if((0,d.default)("DraggableCore: handleDrag: %j",x),this.props.onDrag(u,x)!==!1&&this.mounted!==!1)this.lastX=b,this.lastY=S;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const k=document.createEvent("MouseEvents");k.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(k)}}),l(this,"handleDragStop",u=>{if(!this.dragging)return;const m=(0,r.getControlPosition)(u,this.touchIdentifier,this);if(m==null)return;let{x:b,y:S}=m;if(Array.isArray(this.props.grid)){let k=b-this.lastX||0,j=S-this.lastY||0;[k,j]=(0,r.snapToGrid)(this.props.grid,k,j),b=this.lastX+k,S=this.lastY+j}const x=(0,r.createCoreData)(this,b,S);if(this.props.onStop(u,x)===!1||this.mounted===!1)return!1;const h=this.findDOMNode();h&&this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(h.ownerDocument),(0,d.default)("DraggableCore: handleDragStop: %j",x),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,h&&((0,d.default)("DraggableCore: Removing handlers"),(0,t.removeEvent)(h.ownerDocument,C.move,this.handleDrag),(0,t.removeEvent)(h.ownerDocument,C.stop,this.handleDragStop))}),l(this,"onMouseDown",u=>(C=g,this.handleDragStart(u))),l(this,"onMouseUp",u=>(C=g,this.handleDragStop(u))),l(this,"onTouchStart",u=>(C=c,this.handleDragStart(u))),l(this,"onTouchEnd",u=>(C=c,this.handleDragStop(u)))}componentDidMount(){this.mounted=!0;const u=this.findDOMNode();u&&(0,t.addEvent)(u,c.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const u=this.findDOMNode();if(u){const{ownerDocument:m}=u;(0,t.removeEvent)(m,g.move,this.handleDrag),(0,t.removeEvent)(m,c.move,this.handleDrag),(0,t.removeEvent)(m,g.stop,this.handleDragStop),(0,t.removeEvent)(m,c.stop,this.handleDragStop),(0,t.removeEvent)(u,c.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(m)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:o.default.findDOMNode(this)}render(){return a.cloneElement(a.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return vt.default=f,l(f,"displayName","DraggableCore"),l(f,"propTypes",{allowAnyClick:i.default.bool,allowMobileScroll:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:function(u,m){if(u[m]&&u[m].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:i.default.arrayOf(i.default.number),handle:i.default.string,cancel:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number,className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),l(f,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),vt}function tl(){return Kn||(Kn=1,(function(a){Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),a.default=void 0;var i=(function(m,b){if(typeof WeakMap=="function")var S=new WeakMap,x=new WeakMap;return(function(h,k){if(!k&&h&&h.__esModule)return h;var j,v,T={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return T;if(j=k?x:S){if(j.has(h))return j.get(h);j.set(h,T)}for(const M in h)M!=="default"&&{}.hasOwnProperty.call(h,M)&&((v=(j=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,M))&&(v.get||v.set)?j(T,M,v):T[M]=h[M]);return T})(m,b)})(n),o=g(Ot()),t=g(Je),r=(function(){if(Ln)return Vt.exports;function m(S){var x,h,k="";if(typeof S=="string"||typeof S=="number")k+=S;else if(typeof S=="object")if(Array.isArray(S)){var j=S.length;for(x=0;x<j;x++)S[x]&&(h=m(S[x]))&&(k&&(k+=" "),k+=h)}else for(h in S)S[h]&&(k&&(k+=" "),k+=h);return k}function b(){for(var S,x,h=0,k="",j=arguments.length;h<j;h++)(S=arguments[h])&&(x=m(S))&&(k&&(k+=" "),k+=x);return k}return Ln=1,Vt.exports=b,Vt.exports.clsx=b,Vt.exports})(),s=Yo(),d=ar(),p=lo(),l=g(el()),c=g(rr());function g(m){return m&&m.__esModule?m:{default:m}}function C(){return C=Object.assign?Object.assign.bind():function(m){for(var b=1;b<arguments.length;b++){var S=arguments[b];for(var x in S)({}).hasOwnProperty.call(S,x)&&(m[x]=S[x])}return m},C.apply(null,arguments)}function f(m,b,S){return(b=(function(x){var h=(function(k,j){if(typeof k!="object"||!k)return k;var v=k[Symbol.toPrimitive];if(v!==void 0){var T=v.call(k,j);if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(k)})(x,"string");return typeof h=="symbol"?h:h+""})(b))in m?Object.defineProperty(m,b,{value:S,enumerable:!0,configurable:!0,writable:!0}):m[b]=S,m}class u extends i.Component{static getDerivedStateFromProps(b,S){let{position:x}=b,{prevPropsPosition:h}=S;return!x||h&&x.x===h.x&&x.y===h.y?null:((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:x,prevPropsPosition:h}),{x:x.x,y:x.y,prevPropsPosition:{...x}})}constructor(b){super(b),f(this,"onDragStart",(S,x)=>{if((0,c.default)("Draggable: onDragStart: %j",x),this.props.onStart(S,(0,d.createDraggableData)(this,x))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),f(this,"onDrag",(S,x)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",x);const h=(0,d.createDraggableData)(this,x),k={x:h.x,y:h.y,slackX:0,slackY:0};if(this.props.bounds){const{x:j,y:v}=k;k.x+=this.state.slackX,k.y+=this.state.slackY;const[T,M]=(0,d.getBoundPosition)(this,k.x,k.y);k.x=T,k.y=M,k.slackX=this.state.slackX+(j-k.x),k.slackY=this.state.slackY+(v-k.y),h.x=k.x,h.y=k.y,h.deltaX=k.x-this.state.x,h.deltaY=k.y-this.state.y}if(this.props.onDrag(S,h)===!1)return!1;this.setState(k)}),f(this,"onDragStop",(S,x)=>{if(!this.state.dragging||this.props.onStop(S,(0,d.createDraggableData)(this,x))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",x);const h={dragging:!1,slackX:0,slackY:0};if(this.props.position){const{x:k,y:j}=this.props.position;h.x=k,h.y=j}this.setState(h)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},!b.position||b.onDrag||b.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:b,bounds:S,children:x,defaultPosition:h,defaultClassName:k,defaultClassNameDragging:j,defaultClassNameDragged:v,position:T,positionOffset:M,scale:P,...D}=this.props;let F={},E=null;const R=!T||this.state.dragging,N=T||h,z={x:(0,d.canDragX)(this)&&R?this.state.x:N.x,y:(0,d.canDragY)(this)&&R?this.state.y:N.y};this.state.isElementSVG?E=(0,s.createSVGTransform)(z,M):F=(0,s.createCSSTransform)(z,M);const O=(0,r.clsx)(x.props.className||"",k,{[j]:this.state.dragging,[v]:this.state.dragged});return i.createElement(l.default,C({},D,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),i.cloneElement(i.Children.only(x),{className:O,style:{...x.props.style,...F},transform:E}))}}a.default=u,f(u,"displayName","Draggable"),f(u,"propTypes",{...l.default.propTypes,axis:o.default.oneOf(["both","x","y","none"]),bounds:o.default.oneOfType([o.default.shape({left:o.default.number,right:o.default.number,top:o.default.number,bottom:o.default.number}),o.default.string,o.default.oneOf([!1])]),defaultClassName:o.default.string,defaultClassNameDragging:o.default.string,defaultClassNameDragged:o.default.string,defaultPosition:o.default.shape({x:o.default.number,y:o.default.number}),positionOffset:o.default.shape({x:o.default.oneOfType([o.default.number,o.default.string]),y:o.default.oneOfType([o.default.number,o.default.string])}),position:o.default.shape({x:o.default.number,y:o.default.number}),className:p.dontSetMe,style:p.dontSetMe,transform:p.dontSetMe}),f(u,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(On)),On}function ir(){if(Un)return kt.exports;Un=1;const{default:a,DraggableCore:i}=tl();return kt.exports=a,kt.exports.default=a,kt.exports.DraggableCore=i,kt.exports}var qn,Kt={};function ol(){if(qn)return Kt;qn=1,Kt.__esModule=!0,Kt.cloneElement=function(s,d){return d.style&&s.props.style&&(d.style=t(t({},s.props.style),d.style)),d.className&&s.props.className&&(d.className=s.props.className+" "+d.className),i.default.cloneElement(s,d)};var a,i=(a=n)&&a.__esModule?a:{default:a};function o(s,d){var p=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);d&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),p.push.apply(p,l)}return p}function t(s){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?o(Object(p),!0).forEach(function(l){r(s,l,p[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(p)):o(Object(p)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(p,l))})}return s}function r(s,d,p){return(d=(function(l){var c=(function(g,C){if(typeof g!="object"||g===null)return g;var f=g[Symbol.toPrimitive];if(f!==void 0){var u=f.call(g,C);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(g)})(l,"string");return typeof c=="symbol"?c:String(c)})(d))in s?Object.defineProperty(s,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):s[d]=p,s}return Kt}var Gn,Xn,jt={};function lr(){if(Gn)return jt;Gn=1,jt.__esModule=!0,jt.resizableProps=void 0;var a,i=(a=Ot())&&a.__esModule?a:{default:a};ir();var o={axis:i.default.oneOf(["both","x","y","none"]),className:i.default.string,children:i.default.element.isRequired,draggableOpts:i.default.shape({allowAnyClick:i.default.bool,cancel:i.default.string,children:i.default.node,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:i.default.node,grid:i.default.arrayOf(i.default.number),handle:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number}),height:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var d,p=r[0];return p.axis==="both"||p.axis==="y"?(d=i.default.number).isRequired.apply(d,r):i.default.number.apply(i.default,r)},handle:i.default.oneOfType([i.default.node,i.default.func]),handleSize:i.default.arrayOf(i.default.number),lockAspectRatio:i.default.bool,maxConstraints:i.default.arrayOf(i.default.number),minConstraints:i.default.arrayOf(i.default.number),onResizeStop:i.default.func,onResizeStart:i.default.func,onResize:i.default.func,resizeHandles:i.default.arrayOf(i.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:i.default.number,width:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var d,p=r[0];return p.axis==="both"||p.axis==="x"?(d=i.default.number).isRequired.apply(d,r):i.default.number.apply(i.default,r)}};return jt.resizableProps=o,jt}function sr(){if(Xn)return wt;Xn=1,wt.__esModule=!0,wt.default=void 0;var a=(function(f,u){if(f&&f.__esModule)return f;if(f===null||typeof f!="object"&&typeof f!="function")return{default:f};var m=s(u);if(m&&m.has(f))return m.get(f);var b={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in f)if(x!=="default"&&Object.prototype.hasOwnProperty.call(f,x)){var h=S?Object.getOwnPropertyDescriptor(f,x):null;h&&(h.get||h.set)?Object.defineProperty(b,x,h):b[x]=f[x]}return b.default=f,m&&m.set(f,b),b})(n),i=ir(),o=ol(),t=lr(),r=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(f){if(typeof WeakMap!="function")return null;var u=new WeakMap,m=new WeakMap;return(s=function(b){return b?m:u})(f)}function d(){return d=Object.assign?Object.assign.bind():function(f){for(var u=1;u<arguments.length;u++){var m=arguments[u];for(var b in m)Object.prototype.hasOwnProperty.call(m,b)&&(f[b]=m[b])}return f},d.apply(this,arguments)}function p(f,u){var m=Object.keys(f);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(f);u&&(b=b.filter(function(S){return Object.getOwnPropertyDescriptor(f,S).enumerable})),m.push.apply(m,b)}return m}function l(f){for(var u=1;u<arguments.length;u++){var m=arguments[u]!=null?arguments[u]:{};u%2?p(Object(m),!0).forEach(function(b){c(f,b,m[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(m)):p(Object(m)).forEach(function(b){Object.defineProperty(f,b,Object.getOwnPropertyDescriptor(m,b))})}return f}function c(f,u,m){return(u=(function(b){var S=(function(x,h){if(typeof x!="object"||x===null)return x;var k=x[Symbol.toPrimitive];if(k!==void 0){var j=k.call(x,h);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(x)})(b,"string");return typeof S=="symbol"?S:String(S)})(u))in f?Object.defineProperty(f,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):f[u]=m,f}function g(f,u){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,b){return m.__proto__=b,m},g(f,u)}var C=(function(f){var u,m;function b(){for(var x,h=arguments.length,k=new Array(h),j=0;j<h;j++)k[j]=arguments[j];return(x=f.call.apply(f,[this].concat(k))||this).handleRefs={},x.lastHandleRect=null,x.slack=null,x}m=f,(u=b).prototype=Object.create(m.prototype),u.prototype.constructor=u,g(u,m);var S=b.prototype;return S.componentWillUnmount=function(){this.resetData()},S.resetData=function(){this.lastHandleRect=this.slack=null},S.runConstraints=function(x,h){var k=this.props,j=k.minConstraints,v=k.maxConstraints,T=k.lockAspectRatio;if(!j&&!v&&!T)return[x,h];if(T){var M=this.props.width/this.props.height,P=x-this.props.width,D=h-this.props.height;Math.abs(P)>Math.abs(D*M)?h=x/M:x=h*M}var F=x,E=h,R=this.slack||[0,0],N=R[0],z=R[1];return x+=N,h+=z,j&&(x=Math.max(j[0],x),h=Math.max(j[1],h)),v&&(x=Math.min(v[0],x),h=Math.min(v[1],h)),this.slack=[N+(F-x),z+(E-h)],[x,h]},S.resizeHandler=function(x,h){var k=this;return function(j,v){var T=v.node,M=v.deltaX,P=v.deltaY;x==="onResizeStart"&&k.resetData();var D=(k.props.axis==="both"||k.props.axis==="x")&&h!=="n"&&h!=="s",F=(k.props.axis==="both"||k.props.axis==="y")&&h!=="e"&&h!=="w";if(D||F){var E=h[0],R=h[h.length-1],N=T.getBoundingClientRect();k.lastHandleRect!=null&&(R==="w"&&(M+=N.left-k.lastHandleRect.left),E==="n"&&(P+=N.top-k.lastHandleRect.top)),k.lastHandleRect=N,R==="w"&&(M=-M),E==="n"&&(P=-P);var z=k.props.width+(D?M/k.props.transformScale:0),O=k.props.height+(F?P/k.props.transformScale:0),H=k.runConstraints(z,O);z=H[0],O=H[1];var I=z!==k.props.width||O!==k.props.height,W=typeof k.props[x]=="function"?k.props[x]:null;W&&!(x==="onResize"&&!I)&&(j.persist==null||j.persist(),W(j,{node:T,size:{width:z,height:O},handle:h})),x==="onResizeStop"&&k.resetData()}}},S.renderResizeHandle=function(x,h){var k=this.props.handle;if(!k)return a.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+x,ref:h});if(typeof k=="function")return k(x,h);var j=l({ref:h},typeof k.type=="string"?{}:{handleAxis:x});return a.cloneElement(k,j)},S.render=function(){var x=this,h=this.props,k=h.children,j=h.className,v=h.draggableOpts;h.width,h.height,h.handle,h.handleSize,h.lockAspectRatio,h.axis,h.minConstraints,h.maxConstraints,h.onResize,h.onResizeStop,h.onResizeStart;var T=h.resizeHandles;h.transformScale;var M=(function(P,D){if(P==null)return{};var F,E,R={},N=Object.keys(P);for(E=0;E<N.length;E++)F=N[E],D.indexOf(F)>=0||(R[F]=P[F]);return R})(h,r);return(0,o.cloneElement)(k,l(l({},M),{},{className:(j?j+" ":"")+"react-resizable",children:[].concat(k.props.children,T.map(function(P){var D,F=(D=x.handleRefs[P])!=null?D:x.handleRefs[P]=a.createRef();return a.createElement(i.DraggableCore,d({},v,{nodeRef:F,key:"resizableHandle-"+P,onStop:x.resizeHandler("onResizeStop",P),onStart:x.resizeHandler("onResizeStart",P),onDrag:x.resizeHandler("onResize",P)}),x.renderResizeHandle(P,F))}))}))},b})(a.Component);return wt.default=C,C.propTypes=t.resizableProps,C.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},wt}var Yn,Zn,Tt={};function nl(){if(Yn)return Tt;Yn=1,Tt.__esModule=!0,Tt.default=void 0;var a=(function(u,m){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var b=d(m);if(b&&b.has(u))return b.get(u);var S={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in u)if(h!=="default"&&Object.prototype.hasOwnProperty.call(u,h)){var k=x?Object.getOwnPropertyDescriptor(u,h):null;k&&(k.get||k.set)?Object.defineProperty(S,h,k):S[h]=u[h]}return S.default=u,b&&b.set(u,S),S})(n),i=s(Ot()),o=s(sr()),t=lr(),r=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function s(u){return u&&u.__esModule?u:{default:u}}function d(u){if(typeof WeakMap!="function")return null;var m=new WeakMap,b=new WeakMap;return(d=function(S){return S?b:m})(u)}function p(){return p=Object.assign?Object.assign.bind():function(u){for(var m=1;m<arguments.length;m++){var b=arguments[m];for(var S in b)Object.prototype.hasOwnProperty.call(b,S)&&(u[S]=b[S])}return u},p.apply(this,arguments)}function l(u,m){var b=Object.keys(u);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(u);m&&(S=S.filter(function(x){return Object.getOwnPropertyDescriptor(u,x).enumerable})),b.push.apply(b,S)}return b}function c(u){for(var m=1;m<arguments.length;m++){var b=arguments[m]!=null?arguments[m]:{};m%2?l(Object(b),!0).forEach(function(S){g(u,S,b[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(b)):l(Object(b)).forEach(function(S){Object.defineProperty(u,S,Object.getOwnPropertyDescriptor(b,S))})}return u}function g(u,m,b){return(m=(function(S){var x=(function(h,k){if(typeof h!="object"||h===null)return h;var j=h[Symbol.toPrimitive];if(j!==void 0){var v=j.call(h,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(h)})(S,"string");return typeof x=="symbol"?x:String(x)})(m))in u?Object.defineProperty(u,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):u[m]=b,u}function C(u,m){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,S){return b.__proto__=S,b},C(u,m)}var f=(function(u){var m,b;function S(){for(var x,h=arguments.length,k=new Array(h),j=0;j<h;j++)k[j]=arguments[j];return(x=u.call.apply(u,[this].concat(k))||this).state={width:x.props.width,height:x.props.height,propsWidth:x.props.width,propsHeight:x.props.height},x.onResize=function(v,T){var M=T.size;x.props.onResize?(v.persist==null||v.persist(),x.setState(M,function(){return x.props.onResize&&x.props.onResize(v,T)})):x.setState(M)},x}return b=u,(m=S).prototype=Object.create(b.prototype),m.prototype.constructor=m,C(m,b),S.getDerivedStateFromProps=function(x,h){return h.propsWidth!==x.width||h.propsHeight!==x.height?{width:x.width,height:x.height,propsWidth:x.width,propsHeight:x.height}:null},S.prototype.render=function(){var x=this.props,h=x.handle,k=x.handleSize;x.onResize;var j=x.onResizeStart,v=x.onResizeStop,T=x.draggableOpts,M=x.minConstraints,P=x.maxConstraints,D=x.lockAspectRatio,F=x.axis;x.width,x.height;var E=x.resizeHandles,R=x.style,N=x.transformScale,z=(function(O,H){if(O==null)return{};var I,W,ee={},X=Object.keys(O);for(W=0;W<X.length;W++)I=X[W],H.indexOf(I)>=0||(ee[I]=O[I]);return ee})(x,r);return a.createElement(o.default,{axis:F,draggableOpts:T,handle:h,handleSize:k,height:this.state.height,lockAspectRatio:D,maxConstraints:P,minConstraints:M,onResizeStart:j,onResize:this.onResize,onResizeStop:v,resizeHandles:E,transformScale:N,width:this.state.width},a.createElement("div",p({},z,{style:c(c({},R),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},S})(a.Component);return Tt.default=f,f.propTypes=c(c({},t.resizableProps),{},{children:i.default.element}),Tt}var al=(Zn||(Zn=1,$t.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},$t.exports.Resizable=sr().default,$t.exports.ResizableBox=nl().default),$t.exports);const Zo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,names:t,workbook:r,restoreFocus:s,readonly:d=!1,disabled:p=!1,commandPopupButtonProps:l,sx:c,...g}=a,C=w.useNotifier(),[f,u]=n.useState(null),[m,b]=n.useState(()=>r.getSelectedRanges().getCoords()),[S,x]=n.useState(!1),{reference:h}=y.useFloatStack({parentFloat:l?.parentFloat}),[k,j]=n.useState(()=>d||!r.getProtection().isStructureAllowed()),v=()=>f?.text??"",[T,M]=n.useState(v),P=w.useCallbackRef(()=>{if(h?.closeAll(),!T){const _=v();return M(v()),_}if(v()===T)return T;const $=T.trim().toLowerCase();if($==="r"||$==="c")return T;try{const _=r.getRanges(T);if(_)return _.toString()}catch{}const U=t.getByName(T);if(U&&U.getRanges())return T;let Y=null;try{const _=r.getRanges(T),L=_.getCoords().map(G=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...G}));Y=r.getRanges(L)}catch{}if(!Y){const _=r.getSelectedRanges().getCoords().map(L=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...L}));Y=r.getRanges(_)}try{let _=t.getByName(T);k||_||(_=t.addReference(T,Y)),_&&u({text:_.getName()})}catch(_){M(v()),C.showMessage?.(_.message,{type:w.NotifierType.Error})}return null},[T,t,h,k,C]),D=w.useCallbackRef(()=>{if(r.isClosed())return;const $=[];for(let _=0;_<m.length;_++){const L=m[_];$.push({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...L})}let U=null;try{U=t.lookupByRanges($)}catch{}let Y=null;Y=U?.length>0?U[0].getName():r.getSelectedSheet().getSelectedRange().toString(),u({text:Y})},[r,m]),[F,E]=n.useState(()=>t?.getItems()??null);oe.useModelListener(t,{onCollectionChange($){E(t.getItems()),D()},onClose($){E([])}}),n.useEffect(()=>{M(v())},[f,m]);const[R,N]=n.useState(r?.getSelectedSheet());oe.useModelListener(r,{onProtectionChange:$=>{j(d||!$.getProtection().isStructureAllowed())},onSheetsChange:$=>{N($?.getSelectedSheet())},onViewChange($){N($?.getSelectedSheet())}});const[z,O]=n.useState(null),H=w.useCallbackRef(A.CommonUtils.debounce(D,z?320:0),[]);oe.useModelListener(R.getSelection(),{onChange:()=>{b($=>{const U=r.getSelectedRanges().getCoords();return A.CoordUtils.isEqualRangesArrays(U,$)?$:U})},onAdjustingChange:$=>{O($.getAdjusting())}}),n.useEffect(()=>{if(z){const $=r.getSelectedRange(),U=$.getRowCount(),Y=$.getColumnCount();let _=`${U}R x ${Y}C`;if(_.length>17&&(_=`${U}x${Y}`),U>1||Y>1)return void u({text:_,fontStyle:"italic",justifyContent:"center"})}u({text:r.getSelectedSheet().getSelectedRange().toString()}),H()},[m,r,z]);const I=n.useRef(null),W=n.useCallback($=>{const{onMouseDown:U,onMouseUp:Y,..._}=$;return e.jsx(B.IconButton,{..._,sx:{..._?.sx,display:"flex",flex:"1 1 100%"},disableRipple:!0,children:e.jsx(B.Input,{inputMode:"text",inputProps:{tabIndex:0,name:"input-named-range",maxLength:255,className:"input",autoFocus:!1,spellCheck:!1,autoComplete:"off",ref:I},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:L=>`1px solid ${L.palette.text.icon??L.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:L=>`1px solid ${L.palette.primary.main}`},"::after":{borderBottom:L=>`1px solid ${L.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",height:"1rem",fontSize:11*A.IFont.getDeviceScale(),fontStyle:f?.fontStyle,paddingLeft:L=>L.spacing(.75),paddingRight:L=>L.spacing(.75),boxShadow:"none",flex:"1",color:L=>L.palette.text.secondary,input:{padding:"0",height:"1rem",textAlign:"left","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:L=>L.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:L=>L.palette.text.primary}}},value:T,onFocus:L=>{L.target?.select()},onKeyDown:L=>{if(L.which===w.KeyCodes.Enter||L.which===w.KeyCodes.Tab){let G=T;v()!==T&&(L.stopPropagation(),L.preventDefault(),G=P()),G?ee(G):s?.()}else if(L.which===w.KeyCodes.Escape)v()!==T?(M(v()),setTimeout(()=>{L.target?.select()},0),L.stopPropagation(),L.preventDefault()):s?.();else if(L.which===w.KeyCodes.Space)return void L.stopPropagation()},onBlur:()=>{M(v())},onChange:L=>{M(L.target.value)}})})},[T,f]),ee=w.useCallbackRef(async $=>{try{h?.closeAll();const U=t.lookupByRanges($)?.[0];U&&await U?.select(),await r.getRanges($)?.select()}catch(U){C.showMessage?.(U.message,{type:w.NotifierType.Error})}},[t,C,r]),X=n.useCallback($=>{setTimeout(()=>{x(!0)},0);const U={variant:w.CommandButtonType.Menuitem,parentFloat:$.floatReference,commandHook:{...l?.commandHook,beforeExecute:(re,me)=>(h?.closeAll(),l?.commandHook?.beforeExecute?.(re,me))},scope:l?.scope,commands:l?.commands};let Y=t.getItems({scope:r?.getSelectedSheet().getName()});Y=Y.sort((re,me)=>re.getType()===me.getType()?re.getName().localeCompare(me.getName()):re.getType()==="range"?-1:1);const _=k?null:["editNamedReference","deleteNamedReference"],L=k?null:["editTable",null,"convertTableToRange","deleteTable"],G=[],Q=Y.length;for(let re=0;re<Q;re++){const me=Y[re],Se=me.getRanges();if(!Se||me.isHidden())continue;const Ce=me.getType();Ce!==Y[re-1]?.getType()&&(re>0&&G.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},`type-divider-${G.length}`)),G.push(e.jsx(y.ExhibitMenuHeader,{variant:"subtitle2",sx:{paddingLeft:"16px"},children:me.getType()==="reference"?"Ranges":"Tables"},`type-header-${G.length}`))),Ce==="reference"?G.push(n.createElement(y.SimpleCommandPopupButton,{...U,key:"named-"+G.length,popupCommandKeys:_,popupScope:"namedItem",scope:"namedItem",commandState:me,commands:l?.commands,label:me.getName(),quickCommand:"selectNamed",disabled:!me.getRanges()||p,icon:"NamedRange"})):Ce==="table"&&G.push(n.createElement(y.SimpleCommandPopupButton,{...U,key:"namedItem-"+G.length,popupCommandKeys:L,popupScope:"namedItem",scope:"namedItem",commands:l?.commands,commandState:me,label:me.getName(),quickCommand:"selectNamed",disabled:!Se||p,icon:"InsertTable"}))}const fe=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...g,children:[k?null:e.jsx(y.CommandButton,{...U,scope:"namedItem",command:l?.commands.getCommand("addNamedReference")}),G&&G.length>0?e.jsxs(e.Fragment,{children:[k?null:e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:G})]}):null]});return y.defaultCreatePopupPanel({...$,children:fe})},[r,F,t,f,k]),ne=w.useImperativeElement(i,()=>({focus($){I.current?.focus($)}}),[]);return e.jsx(B.Box,{className:"outer",sx:{minWidth:120,flex:"1 1 100%",display:"flex",alignItems:"center",justifyContent:"start",...c},ref:et([ne,i]),...g,children:e.jsx(y.ExhibitPopupIconButton,{className:"outer-button",sx:{display:"flex",flex:"1 1 100%","& .tooltip-wrapper":{display:"flex",flex:"1 1 100%",width:"100%"},...c},buttonProps:{sx:{backgroundColor:$=>$.palette.background.paper,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`}},tabIndex:-1,outlined:{color:$=>o?$.palette.action.disabled:q.alpha($.palette.divider,.2)},parentFloat:h,createPopupPanel:X,onPopupOpen:()=>x(!0),onPopupClose:()=>x(!1),createTooltip:({children:$},U)=>e.jsx(y.ExhibitTooltip,{title:U||S?"":"Name Box",disabled:U,leaveDelay:0,sx:{opacity:U||S?0:1},children:$}),createQuickButton:W})})}));Zo.displayName="NamedCollectionEditor";const rl=(a,i)=>e.jsx(Zo,{ref:i,...a}),Qo=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,sheetElement:r,gridStyle:s,showNamedCollectionEditor:d=!0,NamedCollectionEditorProps:p,renderNamedCollectionEditor:l=rl,disabled:c,commands:g,...C}=a,[f,u]=n.useState(t?.getSelectedSheet());oe.useModelListener(t,{onSheetsChange:L=>{u(L?.getSelectedSheet())},onViewChange(L){u(L?.getSelectedSheet())}});const[m,b]=n.useState(f.getSelection().getCoords().cell),S=f.getRange(m).getCell(),x=c||!S.isEditAllowed(),h=n.useRef(null),k=n.useMemo(()=>({fontSize:11}),[]);oe.useModelListener(f.getSelection(),{onChange:()=>{b(f.getSelection().getCoords().cell)}}),oe.useModelListener(f,{onProtectionChange(){b(f.getSelection().getCoords().cell)}});const j=h.current?.getLineHeight()??20,[v,T]=n.useState(j),[M,P]=n.useState(5),[D,F]=n.useState(1),E=w.useCallbackRef((L,{size:G})=>{L.preventDefault(),L.stopPropagation();const Q=Math.floor(G.height/j);T(Q*j+1),Q>1&&P(Q)},[j]),R=w.useCallbackRef((L,{size:G})=>{const Q=Math.floor(G.height/j);F(Q)},[j]),N=w.useEditMode(),z=N.getMode();let O=null;z?.key==="edit"&&(O=z.args?.stateAndCoords);const H=n.useMemo(()=>{let L=O?.editState;return L||(L=oe.createCellEditStateFromCell(()=>f.getRange(m).getCell())),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(oe.SheetCellEditor,{ref:h,activeCoords:m,sheet:f,onFocus:()=>{r?.startEdit({autoFocus:!1,editMode:!0,cell:m})},defaultTextStyle:k,useRichStyling:!1,disabled:x,onChangeEdit:G=>{if(G.dirty!==void 0){const Q={sheet:f,coords:m,editState:G};N.setMode(fe=>({...fe,args:{...fe?.args,stateAndCoords:Q}}))}},editState:L,commands:g,onCancelEdit:()=>{r?.cancelEdit(),r?.focus()},onSubmitEdit:()=>{r?.submitEdit(),r?.focus()},linesVisible:D})})},[f,O,m,D,r]),I=n.useRef(null),W=n.useMemo(()=>d?l({names:t.getNames(),workbook:t,...p},I):null,[l,p,d,f,t,x]),ee=n.useMemo(()=>e.jsxs(B.Paper,{elevation:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:0,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,border:L=>`solid ${x?L.palette.action.disabled:q.alpha(L.palette.divider,.2)} 1px`},children:[e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"warning","aria-label":"cancel-formula-edit",icon:e.jsx(w.DynamicIcon,{iconKey:"CloseError"}),tooltipProps:{label:"Cancel",simple:!0},disabled:x||O===null,onMouseDown:L=>{L.button===0&&L.preventDefault()},onClick:()=>{r.cancelEdit()}}),e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"primary","aria-label":"commit-formula-edit",icon:e.jsx(w.DynamicIcon,{iconKey:"CheckSuccess"}),tooltipProps:{label:"Enter",simple:!0},disabled:x||O===null,onMouseDown:L=>{L.button===0&&L.preventDefault()},onClick:()=>{r.submitEdit()}}),e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,disabled:!0,"aria-label":"commit-formula-function",icon:e.jsx(w.DynamicIcon,{iconKey:"Function",style:{transform:"scale(0.85)"}}),tooltipProps:{label:"Insert Function",simple:!0},onMouseDown:L=>{L.button===0&&L.preventDefault()}})]}),[x,O]),X=q.useTheme(),[ne,$]=n.useState(!1),U=n.useMemo(()=>e.jsxs(B.Box,{className:"formula-bar",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",gap:L=>L.spacing(.5),alignItems:"start"},children:[ee,e.jsxs(B.Paper,{elevation:0,sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",fontFamily:L=>L.typography.fontFamily,fontSize:11*A.IFont.getDeviceScale(),alignItems:"stretch",paddingTop:"2px",paddingBottom:"2px",boxShadow:"none",borderRadius:L=>`${L.shape.borderRadius}px`,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,border:L=>`solid ${x?L.palette.action.disabled:q.alpha(L.palette.divider,.2)} 1px`,"& textarea":{color:L=>x?`${L.palette.text.disabled} !important`:L.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:()=>$(!0),onBlur:()=>$(!1),onMouseDown:L=>{L.target?.classList.contains("react-resizable-handle")&&L.preventDefault()},children:[e.jsx(B.Box,{className:"formula-editor",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",alignItems:"center",marginTop:"0px",paddingLeft:L=>L.spacing(1),paddingRight:L=>L.spacing(1)},children:e.jsx(al.ResizableBox,{height:v,draggableOpts:{grid:[j,j]},minConstraints:[j,j],maxConstraints:[15*j,15*j],onResize:R,onResizeStop:E,resizeHandles:["s"],axis:"y",style:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:H})}),e.jsx(y.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:e.jsx(w.DynamicIcon,{iconKey:D>1?"ExpandLess":"ExpandMore"}),tooltipProps:{label:(D>1?"Collapse":"Expand")+" Formula Bar",simple:!0},onMouseDown:L=>{L.button===0&&L.preventDefault()},onClick:()=>{const L=D>1?1:M;T(L*j+1),F(L)}}),e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"2px",bottom:"0",willChange:"opacity",transition:"opacity 60ms ease-in",opacity:ne?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:L=>L.palette.primary.main,borderRadius:L=>`${L.shape.borderRadius}px`}})]})]}),[ee,H,ne,D,j]),Y=n.useMemo(()=>W||U?!W&&U?U:W&&!U?W:e.jsx(e.Fragment,{children:e.jsx(w.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:W,elementAfter:U})}):null,[W,U]),_=w.useImperativeElement(i,()=>({isFormulaBarElement:()=>!0,getNamedCollectionEditorElement:()=>I.current}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:L=>L.spacing(.5),...o},ref:_,...C,children:Y})}));Qo.displayName="FormulaBar";const Jo=n.memo(n.forwardRef((a,i)=>{const{filter:o,commands:t,disabled:r,sx:s,floatReference:d,...p}=a,l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(f,u)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),g=n.useMemo(()=>({...l,...c,variant:w.CommandButtonType.Menuitem}),[l,c]),C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:t.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...g,command:t.getCommand("sortDescending")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:t.getCommand("autoFilterClear")}),[]]});return e.jsx(B.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...s},...p,children:C})}));Jo.displayName="FilterColumnMenu";const cr=n.memo(n.forwardRef((a,i)=>{const{children:o,className:t,disabled:r,style:s,filter:d,...p}=a,l=w.useImperativeElement(i,()=>({isFilters:()=>!0}),[]);return e.jsx("div",{ref:l,className:ie("filters",t),style:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",...s},...p,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:d.getName()}),e.jsx("div",{children:"Filter Widget"})]})})}));cr.displayName="Filters";const en=n.memo(n.forwardRef((a,i)=>{const{children:o,sheet:t,style:r,className:s,value:d,index:p,editing:l,editable:c,disabled:g,selectedIndex:C,dragging:f,borderColor:u,borderWidth:m,activeColor:b,background:S="white",tabRadius:x=4,gridTheme:h,...k}=a,[j,v]=n.useState(()=>!!t&&t.getProtection().isLocked()),[T,M]=n.useState(()=>t?t.getTabColor():null);oe.useModelListener(t,{onProtectionChange:()=>{v(t.getProtection().isLocked())},onTabColorChange:()=>{M(t.getTabColor())},onStyleChange:()=>{M(t.getTabColor())}});const P=q.useTheme(),D=C===p;let F=null,E=null;if(T||f){let z=S;T?(E=T.toBlackOrWhite().toCSS(),z=T?.toCSS()):D||(z=P.palette.background.paper),F=e.jsx(B.Box,{sx:{position:"absolute",boxSizing:"border-box",top:"3px",left:"4px",right:"4.5px",bottom:"1.5px",opacity:D?"50%":"100%",borderRadius:"4px",border:O=>D?`${S} solid 1px`:`${O.palette.divider} solid 1px`,background:D&&T?`linear-gradient(0deg, ${z} 0%, transparent)`:z}})}let R=null;typeof u=="string"?R=u:u?.toCSS&&(R=u.toCSS());const N=D?e.jsx(B.Box,{sx:{width:"100%",borderRadius:"4px",minWidth:"4px",height:"2px",backgroundColor:z=>z.palette.primary.main}}):null;return e.jsx(q.ThemeProvider,{theme:D?h??P:P,children:e.jsx(B.Box,{ref:i,className:ie(s),sx:{...r,display:"flex",flexDirection:"column",minHeight:"0px",fontWeight:D?"700":"400",fontSize:"0.85rem",letterSpacing:"0",lineHeight:"1",textTransform:"none",minWidth:"unset",cursor:f?"grabbing":void 0},...k,children:e.jsx(w.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:x,strokeColor:D?R:"transparent",children:e.jsx(B.Button,{sx:{textTransform:"none",borderRadius:"0px",minHeight:"0px",paddingLeft:"11px",paddingRight:"12px",paddingTop:"3px",flex:"1 1 100%",paddingBottom:"3px",fontWeight:D?"700":"400",fontSize:"0.85rem",letterSpacing:"0",transition:"none",cursor:f?"grabbing":void 0,color:D?"primary":E||"text.secondary",backgroundColor:D?S:"transparent","&:hover:not([disabled])":{backgroundColor:D?S:"transparent"},"& input":{color:z=>`${z.palette.text.primary}`,textAlign:"center",fontWeight:"500"},marginTop:"0px",minWidth:"unset"},disabled:g,disableRipple:l,component:"div",children:e.jsxs(e.Fragment,{children:[F,e.jsxs(B.Box,{sx:{zIndex:"1",display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:"1px",lineHeight:"1",marginTop:D?void 0:"1px"},children:[o,N]}),j?e.jsx(w.DynamicIcon,{iconKey:"Lock",style:{scale:"0.80",marginLeft:"2px",width:"22px",height:"22px"},color:"secondary"}):e.jsx(B.Box,{sx:{minHeight:"22px"}})]})]})},d+":"+p)})})})}));en.displayName="SheetTab";const tn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,index:t,commands:r,scope:s="sheet",disabled:d,floatReference:p,sx:l,className:c,tabStripRef:g,...C}=a,[f,u]=n.useState(o?.getProtection());oe.useModelListener(o,{onProtectionChange:h=>{u(h?.getProtection())}});const m=n.useMemo(()=>({}),[]),b=n.useMemo(()=>({commandHook:{beforeExecute:(h,k)=>p.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:s,commandState:t,disabled:d||t===void 0,parentFloat:p}),[d,p]),S=n.useMemo(()=>({...m,...b}),[m,b]),x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:r.getCommand("addSheet"),commandState:t,...S,variant:w.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r.getCommand("deleteSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsxs(y.ExhibitMenuItem,{onMouseDown:h=>{h.button===0&&h.preventDefault()},onMouseUp:()=>{Promise.resolve(p.closeAll()).then(()=>{g?.startEdit(t)})},disabled:d||!f.isStructureAllowed(),parentFloat:p,children:["Rename",s!=="sheet"?" Sheet":""]}),e.jsx(y.CommandButton,{command:r.getCommand("duplicateSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r?.getCommand("protectionSheetToggle"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(ft,{variant:w.CommandButtonType.Menuitem,command:r.getCommand("formatSheetTabColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0,autoColorLabel:"No Tab Color",autoColorPosition:mt.End},parentFloat:p}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{command:r.getCommand("hideSheet"),...S,variant:w.CommandButtonType.Menuitem})]});return e.jsx(B.Box,{ref:i,className:ie("menu",c),sx:{...l},...C,children:x})}));tn.displayName="SheetTabMenu";const on=n.memo(n.forwardRef((a,i)=>{const{workbook:o,gridStyle:t,floatReference:r,closeFloatAll:s,className:d,...p}=a,[l,c]=n.useState(o?.getSheets().getItems()),[g,C]=n.useState(o?.getProtection());oe.useModelListener(o,{onSheetsChange:u=>{c(u.getSheets().getItems())},onProtectionChange:u=>{C(u?.getProtection())}});const f=n.useMemo(()=>{const u=[],m=o.getSheets().getItems({visibility:A.ISheet.Visibility.Hidden}),b=o.getSelectedSheet();for(let S=0;S<m.length;S++){const x=m[S],h=x.getVisibility();if(h===A.ISheet.Visibility.VeryHidden)continue;const k=b===x,j=x.getProtection().isLocked(),v=x.getTabColor(),T=t?.body.fill??"transparent";let M=null,P=null,D=T;v&&(D=v.toCSS(),k||(P=v.toBlackOrWhite().toCSS()),M=e.jsx(B.Box,{sx:{position:"absolute",display:"flex",flexDirection:"column",top:"4px",left:"40px",right:"8px",bottom:"4px",background:k?D:"transparent",borderRadius:"4px",border:`solid 1px ${t.header.edgeStrokeFill}`},children:e.jsx(B.Box,{sx:{flex:"1 1 100%",boxSizing:"content-box",opacity:k||h===A.ISheet.Visibility.Hidden?"50%":"100%",border:E=>k?`${T} solid 1.5px`:`${E.palette.divider} solid 1px`,background:k&&v?`linear-gradient(0deg, ${D} 0%, ${T})`:D,borderRadius:"4px"}})}));let F=null;j&&(F=e.jsx(w.DynamicIcon,{iconKey:"Lock"})),h!==A.ISheet.Visibility.Visible&&(F=e.jsx(w.DynamicIcon,{iconKey:"VisibilityOff",style:{opacity:g.isStructureAllowed()?1:.7},color:"secondary"})),F&&(F=e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",ml:"16px","& *":{lineHeight:"1em",fontSize:"1.3em"}},children:F})),u.push(e.jsx(y.ExhibitMenuItem,{disabled:!g.isStructureAllowed()&&h===A.ISheet.Visibility.Hidden,sx:{color:E=>{let R=k?E.palette.primary.main:E.palette.text.secondary;return P&&(R=P),h===A.ISheet.Visibility.Hidden&&(R=Re.alpha(R,E.palette.action.disabledOpacity)),R},borderLeft:E=>`${k?E.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"4px",paddingTop:"4px",paddingBottom:"4px",fontWeight:k?"700":"400","&:hover":{fontWeight:"700"}},icon:k?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:E=>E.preventDefault(),onMouseUp:()=>{Promise.resolve(r.closeAll()).then(()=>{try{x.select()}catch(E){console.error(E)}})},children:e.jsxs(e.Fragment,{children:[M,e.jsxs(B.Box,{sx:{paddingRight:"0px",paddingLeft:"4px",display:"flex",flexDirection:"row",flex:"1 1 100%",overflow:"hidden",alignItems:"center",zIndex:2},children:[e.jsxs(B.Box,{className:"sheet-name",sx:{display:"flex",flexDirection:"column",paddingLeft:"8px",paddingRight:"8px",alignItems:"center"},children:[x.getName(),e.jsx(B.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:x.getName()})]}),F]})]})},""+S))}return u},[o,g,l,r,t]);return e.jsx(B.Box,{ref:i,className:ie("menu",d),...p,children:f})}));on.displayName="SheetsAllMenu";let Ut=!1,dr=!1,We=null;const Qn=async a=>{const i=await A.LicenseManager.getDetails();if(dr||i.isEval()){try{const o=top??window;o.SheetXL||(o.SheetXL=Object.freeze({getSelectedWorkbook:()=>We?.getWorkbook(),getSelectedSheet:()=>We?.getWorkbook().getSelectedSheet(),getSelectedRange:()=>We?.getWorkbook().getSelectedRange(),getSelectedRanges:()=>We?.getWorkbook().getSelectedRanges(),getRange:t=>We?.getWorkbook().getRange(t),getSelectedWorkbookElement:()=>We,getLicenseManager:()=>A.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(o){o instanceof DOMException||console.error(o),Ut=!0}if(We!==a&&(We=a,!Ut))try{Ut=!0,(top??window).SheetXL&&(await A.LicenseManager._validate(!0),A.LicenseManager.wasPrinted()&&(()=>{je.CommonUtils.consoleWithNoSource(`%cTip: You can access the API directly in the console.
9
+ `,l.getElementsByTagName("head")[0].appendChild(c)),l.body&&d(l.body,"react-draggable-transparent-selection")},xe.createCSSTransform=function(l,c){const g=r(l,c,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:g}},xe.createSVGTransform=function(l,c){return r(l,c,"")},xe.getTouch=function(l,c){return l.targetTouches&&(0,a.findInArray)(l.targetTouches,g=>c===g.identifier)||l.changedTouches&&(0,a.findInArray)(l.changedTouches,g=>c===g.identifier)},xe.getTouchIdentifier=function(l){if(l.targetTouches&&l.targetTouches[0])return l.targetTouches[0].identifier;if(l.changedTouches&&l.changedTouches[0])return l.changedTouches[0].identifier},xe.getTranslation=r,xe.innerHeight=function(l){let c=l.clientHeight;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(g.paddingTop),c-=(0,a.int)(g.paddingBottom),c},xe.innerWidth=function(l){let c=l.clientWidth;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(g.paddingLeft),c-=(0,a.int)(g.paddingRight),c},xe.matchesSelector=t,xe.matchesSelectorAndParentsTo=function(l,c,g){let C=l;do{if(t(C,c))return!0;if(C===g)return!1;C=C.parentNode}while(C);return!1},xe.offsetXYFromParent=function(l,c,g){const C=c===c.ownerDocument.body?{left:0,top:0}:c.getBoundingClientRect(),f=(l.clientX+c.scrollLeft-C.left)/g,u=(l.clientY+c.scrollTop-C.top)/g;return{x:f,y:u}},xe.outerHeight=function(l){let c=l.clientHeight;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(g.borderTopWidth),c+=(0,a.int)(g.borderBottomWidth),c},xe.outerWidth=function(l){let c=l.clientWidth;const g=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(g.borderLeftWidth),c+=(0,a.int)(g.borderRightWidth),c},xe.removeClassName=p,xe.removeEvent=function(l,c,g,C){if(!l)return;const f={capture:!0,...C};l.removeEventListener?l.removeEventListener(c,g,f):l.detachEvent?l.detachEvent("on"+c,g):l["on"+c]=null},xe.scheduleRemoveUserSelectStyles=function(l){window.requestAnimationFrame?window.requestAnimationFrame(()=>{s(l)}):s(l)};var a=lo(),i=(function(l,c){if(typeof WeakMap=="function")var g=new WeakMap,C=new WeakMap;return(function(f,u){if(!u&&f&&f.__esModule)return f;var m,b,S={__proto__:null,default:f};if(f===null||typeof f!="object"&&typeof f!="function")return S;if(m=u?C:g){if(m.has(f))return m.get(f);m.set(f,S)}for(const x in f)x!=="default"&&{}.hasOwnProperty.call(f,x)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(f,x))&&(b.get||b.set)?m(S,x,b):S[x]=f[x]);return S})(l,c)})((function(){if(Hn)return We;Hn=1,Object.defineProperty(We,"__esModule",{value:!0}),We.browserPrefixToKey=g,We.browserPrefixToStyle=function(C,f){return f?`-${f.toLowerCase()}-${C}`:C},We.default=void 0,We.getPrefix=c;const l=["Moz","Webkit","O","ms"];function c(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const f=window.document?.documentElement?.style;if(!f||C in f)return"";for(let u=0;u<l.length;u++)if(g(C,l[u])in f)return l[u];return""}function g(C,f){return f?`${f}${(function(u){let m="",b=!0;for(let S=0;S<u.length;S++)b?(m+=u[S].toUpperCase(),b=!1):u[S]==="-"?b=!0:m+=u[S];return m})(C)}`:C}return We.default=c(),We})());let o="";function t(l,c){return o||(o=(0,a.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(g){return(0,a.isFunction)(l[g])})),!!(0,a.isFunction)(l[o])&&l[o](c)}function r(l,c,g){let{x:C,y:f}=l,u=`translate(${C}${g},${f}${g})`;return c&&(u=`translate(${`${typeof c.x=="string"?c.x:c.x+g}`}, ${`${typeof c.y=="string"?c.y:c.y+g}`})`+u),u}function s(l){if(l)try{if(l.body&&p(l.body,"react-draggable-transparent-selection"),l.selection)l.selection.empty();else{const c=(l.defaultView||window).getSelection();c&&c.type!=="Caret"&&c.removeAllRanges()}}catch{}}function d(l,c){l.classList?l.classList.add(c):l.className.match(new RegExp(`(?:^|\\s)${c}(?!\\S)`))||(l.className+=` ${c}`)}function p(l,c){l.classList?l.classList.remove(c):l.className=l.className.replace(new RegExp(`(?:^|\\s)${c}(?!\\S)`,"g"),"")}return xe}var $n,Ie={};function ar(){if($n)return Ie;$n=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},Ie.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},Ie.createCoreData=function(t,r,s){const d=!(0,a.isNum)(t.lastX),p=o(t);return d?{node:p,deltaX:0,deltaY:0,lastX:r,lastY:s,x:r,y:s}:{node:p,deltaX:r-t.lastX,deltaY:s-t.lastY,lastX:t.lastX,lastY:t.lastY,x:r,y:s}},Ie.createDraggableData=function(t,r){const s=t.props.scale;return{node:r.node,x:t.state.x+r.deltaX/s,y:t.state.y+r.deltaY/s,deltaX:r.deltaX/s,deltaY:r.deltaY/s,lastX:t.state.x,lastY:t.state.y}},Ie.getBoundPosition=function(t,r,s){if(!t.props.bounds)return[r,s];let{bounds:d}=t.props;d=typeof d=="string"?d:(function(l){return{left:l.left,top:l.top,right:l.right,bottom:l.bottom}})(d);const p=o(t);if(typeof d=="string"){const{ownerDocument:l}=p,c=l.defaultView;let g;if(d==="parent"?g=p.parentNode:g=p.getRootNode().querySelector(d),!(g instanceof c.HTMLElement))throw new Error('Bounds selector "'+d+'" could not find an element.');const C=g,f=c.getComputedStyle(p),u=c.getComputedStyle(C);d={left:-p.offsetLeft+(0,a.int)(u.paddingLeft)+(0,a.int)(f.marginLeft),top:-p.offsetTop+(0,a.int)(u.paddingTop)+(0,a.int)(f.marginTop),right:(0,i.innerWidth)(C)-(0,i.outerWidth)(p)-p.offsetLeft+(0,a.int)(u.paddingRight)-(0,a.int)(f.marginRight),bottom:(0,i.innerHeight)(C)-(0,i.outerHeight)(p)-p.offsetTop+(0,a.int)(u.paddingBottom)-(0,a.int)(f.marginBottom)}}return(0,a.isNum)(d.right)&&(r=Math.min(r,d.right)),(0,a.isNum)(d.bottom)&&(s=Math.min(s,d.bottom)),(0,a.isNum)(d.left)&&(r=Math.max(r,d.left)),(0,a.isNum)(d.top)&&(s=Math.max(s,d.top)),[r,s]},Ie.getControlPosition=function(t,r,s){const d=typeof r=="number"?(0,i.getTouch)(t,r):null;if(typeof r=="number"&&!d)return null;const p=o(s),l=s.props.offsetParent||p.offsetParent||p.ownerDocument.body;return(0,i.offsetXYFromParent)(d||t,l,s.props.scale)},Ie.snapToGrid=function(t,r,s){const d=Math.round(r/t[0])*t[0],p=Math.round(s/t[1])*t[1];return[d,p]};var a=lo(),i=Yo();function o(t){const r=t.findDOMNode();if(!r)throw new Error("<DraggableCore>: Unmounted during event!");return r}return Ie}var Vn,_n,Kn,Un,vt={},_t={};function rr(){return Vn||(Vn=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.default=function(){}),_t}function el(){if(_n)return vt;_n=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var a=(function(u,m){if(typeof WeakMap=="function")var b=new WeakMap,S=new WeakMap;return(function(x,h){if(!h&&x&&x.__esModule)return x;var k,j,v={__proto__:null,default:x};if(x===null||typeof x!="object"&&typeof x!="function")return v;if(k=h?S:b){if(k.has(x))return k.get(x);k.set(x,v)}for(const T in x)T!=="default"&&{}.hasOwnProperty.call(x,T)&&((j=(k=Object.defineProperty)&&Object.getOwnPropertyDescriptor(x,T))&&(j.get||j.set)?k(v,T,j):v[T]=x[T]);return v})(u,m)})(n),i=p(Ot()),o=p(et),t=Yo(),r=ar(),s=lo(),d=p(rr());function p(u){return u&&u.__esModule?u:{default:u}}function l(u,m,b){return(m=(function(S){var x=(function(h,k){if(typeof h!="object"||!h)return h;var j=h[Symbol.toPrimitive];if(j!==void 0){var v=j.call(h,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(h)})(S,"string");return typeof x=="symbol"?x:x+""})(m))in u?Object.defineProperty(u,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):u[m]=b,u}const c={start:"touchstart",move:"touchmove",stop:"touchend"},g={start:"mousedown",move:"mousemove",stop:"mouseup"};let C=g,f=class extends a.Component{constructor(){super(...arguments),l(this,"dragging",!1),l(this,"lastX",NaN),l(this,"lastY",NaN),l(this,"touchIdentifier",null),l(this,"mounted",!1),l(this,"handleDragStart",u=>{if(this.props.onMouseDown(u),!this.props.allowAnyClick&&typeof u.button=="number"&&u.button!==0)return!1;const m=this.findDOMNode();if(!m||!m.ownerDocument||!m.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:b}=m;if(this.props.disabled||!(u.target instanceof b.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(u.target,this.props.handle,m)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(u.target,this.props.cancel,m))return;u.type!=="touchstart"||this.props.allowMobileScroll||u.preventDefault();const S=(0,t.getTouchIdentifier)(u);this.touchIdentifier=S;const x=(0,r.getControlPosition)(u,S,this);if(x==null)return;const{x:h,y:k}=x,j=(0,r.createCoreData)(this,h,k);(0,d.default)("DraggableCore: handleDragStart: %j",j),(0,d.default)("calling",this.props.onStart),this.props.onStart(u,j)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(b),this.dragging=!0,this.lastX=h,this.lastY=k,(0,t.addEvent)(b,C.move,this.handleDrag),(0,t.addEvent)(b,C.stop,this.handleDragStop))}),l(this,"handleDrag",u=>{const m=(0,r.getControlPosition)(u,this.touchIdentifier,this);if(m==null)return;let{x:b,y:S}=m;if(Array.isArray(this.props.grid)){let h=b-this.lastX,k=S-this.lastY;if([h,k]=(0,r.snapToGrid)(this.props.grid,h,k),!h&&!k)return;b=this.lastX+h,S=this.lastY+k}const x=(0,r.createCoreData)(this,b,S);if((0,d.default)("DraggableCore: handleDrag: %j",x),this.props.onDrag(u,x)!==!1&&this.mounted!==!1)this.lastX=b,this.lastY=S;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const k=document.createEvent("MouseEvents");k.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(k)}}),l(this,"handleDragStop",u=>{if(!this.dragging)return;const m=(0,r.getControlPosition)(u,this.touchIdentifier,this);if(m==null)return;let{x:b,y:S}=m;if(Array.isArray(this.props.grid)){let k=b-this.lastX||0,j=S-this.lastY||0;[k,j]=(0,r.snapToGrid)(this.props.grid,k,j),b=this.lastX+k,S=this.lastY+j}const x=(0,r.createCoreData)(this,b,S);if(this.props.onStop(u,x)===!1||this.mounted===!1)return!1;const h=this.findDOMNode();h&&this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(h.ownerDocument),(0,d.default)("DraggableCore: handleDragStop: %j",x),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,h&&((0,d.default)("DraggableCore: Removing handlers"),(0,t.removeEvent)(h.ownerDocument,C.move,this.handleDrag),(0,t.removeEvent)(h.ownerDocument,C.stop,this.handleDragStop))}),l(this,"onMouseDown",u=>(C=g,this.handleDragStart(u))),l(this,"onMouseUp",u=>(C=g,this.handleDragStop(u))),l(this,"onTouchStart",u=>(C=c,this.handleDragStart(u))),l(this,"onTouchEnd",u=>(C=c,this.handleDragStop(u)))}componentDidMount(){this.mounted=!0;const u=this.findDOMNode();u&&(0,t.addEvent)(u,c.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const u=this.findDOMNode();if(u){const{ownerDocument:m}=u;(0,t.removeEvent)(m,g.move,this.handleDrag),(0,t.removeEvent)(m,c.move,this.handleDrag),(0,t.removeEvent)(m,g.stop,this.handleDragStop),(0,t.removeEvent)(m,c.stop,this.handleDragStop),(0,t.removeEvent)(u,c.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(m)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:o.default.findDOMNode(this)}render(){return a.cloneElement(a.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return vt.default=f,l(f,"displayName","DraggableCore"),l(f,"propTypes",{allowAnyClick:i.default.bool,allowMobileScroll:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:function(u,m){if(u[m]&&u[m].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:i.default.arrayOf(i.default.number),handle:i.default.string,cancel:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number,className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),l(f,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),vt}function tl(){return Kn||(Kn=1,(function(a){Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),a.default=void 0;var i=(function(m,b){if(typeof WeakMap=="function")var S=new WeakMap,x=new WeakMap;return(function(h,k){if(!k&&h&&h.__esModule)return h;var j,v,T={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return T;if(j=k?x:S){if(j.has(h))return j.get(h);j.set(h,T)}for(const M in h)M!=="default"&&{}.hasOwnProperty.call(h,M)&&((v=(j=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,M))&&(v.get||v.set)?j(T,M,v):T[M]=h[M]);return T})(m,b)})(n),o=g(Ot()),t=g(et),r=(function(){if(Ln)return Vt.exports;function m(S){var x,h,k="";if(typeof S=="string"||typeof S=="number")k+=S;else if(typeof S=="object")if(Array.isArray(S)){var j=S.length;for(x=0;x<j;x++)S[x]&&(h=m(S[x]))&&(k&&(k+=" "),k+=h)}else for(h in S)S[h]&&(k&&(k+=" "),k+=h);return k}function b(){for(var S,x,h=0,k="",j=arguments.length;h<j;h++)(S=arguments[h])&&(x=m(S))&&(k&&(k+=" "),k+=x);return k}return Ln=1,Vt.exports=b,Vt.exports.clsx=b,Vt.exports})(),s=Yo(),d=ar(),p=lo(),l=g(el()),c=g(rr());function g(m){return m&&m.__esModule?m:{default:m}}function C(){return C=Object.assign?Object.assign.bind():function(m){for(var b=1;b<arguments.length;b++){var S=arguments[b];for(var x in S)({}).hasOwnProperty.call(S,x)&&(m[x]=S[x])}return m},C.apply(null,arguments)}function f(m,b,S){return(b=(function(x){var h=(function(k,j){if(typeof k!="object"||!k)return k;var v=k[Symbol.toPrimitive];if(v!==void 0){var T=v.call(k,j);if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(k)})(x,"string");return typeof h=="symbol"?h:h+""})(b))in m?Object.defineProperty(m,b,{value:S,enumerable:!0,configurable:!0,writable:!0}):m[b]=S,m}class u extends i.Component{static getDerivedStateFromProps(b,S){let{position:x}=b,{prevPropsPosition:h}=S;return!x||h&&x.x===h.x&&x.y===h.y?null:((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:x,prevPropsPosition:h}),{x:x.x,y:x.y,prevPropsPosition:{...x}})}constructor(b){super(b),f(this,"onDragStart",(S,x)=>{if((0,c.default)("Draggable: onDragStart: %j",x),this.props.onStart(S,(0,d.createDraggableData)(this,x))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),f(this,"onDrag",(S,x)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",x);const h=(0,d.createDraggableData)(this,x),k={x:h.x,y:h.y,slackX:0,slackY:0};if(this.props.bounds){const{x:j,y:v}=k;k.x+=this.state.slackX,k.y+=this.state.slackY;const[T,M]=(0,d.getBoundPosition)(this,k.x,k.y);k.x=T,k.y=M,k.slackX=this.state.slackX+(j-k.x),k.slackY=this.state.slackY+(v-k.y),h.x=k.x,h.y=k.y,h.deltaX=k.x-this.state.x,h.deltaY=k.y-this.state.y}if(this.props.onDrag(S,h)===!1)return!1;this.setState(k)}),f(this,"onDragStop",(S,x)=>{if(!this.state.dragging||this.props.onStop(S,(0,d.createDraggableData)(this,x))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",x);const h={dragging:!1,slackX:0,slackY:0};if(this.props.position){const{x:k,y:j}=this.props.position;h.x=k,h.y=j}this.setState(h)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},!b.position||b.onDrag||b.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:b,bounds:S,children:x,defaultPosition:h,defaultClassName:k,defaultClassNameDragging:j,defaultClassNameDragged:v,position:T,positionOffset:M,scale:P,...D}=this.props;let F={},E=null;const R=!T||this.state.dragging,N=T||h,z={x:(0,d.canDragX)(this)&&R?this.state.x:N.x,y:(0,d.canDragY)(this)&&R?this.state.y:N.y};this.state.isElementSVG?E=(0,s.createSVGTransform)(z,M):F=(0,s.createCSSTransform)(z,M);const O=(0,r.clsx)(x.props.className||"",k,{[j]:this.state.dragging,[v]:this.state.dragged});return i.createElement(l.default,C({},D,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),i.cloneElement(i.Children.only(x),{className:O,style:{...x.props.style,...F},transform:E}))}}a.default=u,f(u,"displayName","Draggable"),f(u,"propTypes",{...l.default.propTypes,axis:o.default.oneOf(["both","x","y","none"]),bounds:o.default.oneOfType([o.default.shape({left:o.default.number,right:o.default.number,top:o.default.number,bottom:o.default.number}),o.default.string,o.default.oneOf([!1])]),defaultClassName:o.default.string,defaultClassNameDragging:o.default.string,defaultClassNameDragged:o.default.string,defaultPosition:o.default.shape({x:o.default.number,y:o.default.number}),positionOffset:o.default.shape({x:o.default.oneOfType([o.default.number,o.default.string]),y:o.default.oneOfType([o.default.number,o.default.string])}),position:o.default.shape({x:o.default.number,y:o.default.number}),className:p.dontSetMe,style:p.dontSetMe,transform:p.dontSetMe}),f(u,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(On)),On}function ir(){if(Un)return kt.exports;Un=1;const{default:a,DraggableCore:i}=tl();return kt.exports=a,kt.exports.default=a,kt.exports.DraggableCore=i,kt.exports}var qn,Kt={};function ol(){if(qn)return Kt;qn=1,Kt.__esModule=!0,Kt.cloneElement=function(s,d){return d.style&&s.props.style&&(d.style=t(t({},s.props.style),d.style)),d.className&&s.props.className&&(d.className=s.props.className+" "+d.className),i.default.cloneElement(s,d)};var a,i=(a=n)&&a.__esModule?a:{default:a};function o(s,d){var p=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);d&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),p.push.apply(p,l)}return p}function t(s){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?o(Object(p),!0).forEach(function(l){r(s,l,p[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(p)):o(Object(p)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(p,l))})}return s}function r(s,d,p){return(d=(function(l){var c=(function(g,C){if(typeof g!="object"||g===null)return g;var f=g[Symbol.toPrimitive];if(f!==void 0){var u=f.call(g,C);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(g)})(l,"string");return typeof c=="symbol"?c:String(c)})(d))in s?Object.defineProperty(s,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):s[d]=p,s}return Kt}var Gn,Xn,jt={};function lr(){if(Gn)return jt;Gn=1,jt.__esModule=!0,jt.resizableProps=void 0;var a,i=(a=Ot())&&a.__esModule?a:{default:a};ir();var o={axis:i.default.oneOf(["both","x","y","none"]),className:i.default.string,children:i.default.element.isRequired,draggableOpts:i.default.shape({allowAnyClick:i.default.bool,cancel:i.default.string,children:i.default.node,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:i.default.node,grid:i.default.arrayOf(i.default.number),handle:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number}),height:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var d,p=r[0];return p.axis==="both"||p.axis==="y"?(d=i.default.number).isRequired.apply(d,r):i.default.number.apply(i.default,r)},handle:i.default.oneOfType([i.default.node,i.default.func]),handleSize:i.default.arrayOf(i.default.number),lockAspectRatio:i.default.bool,maxConstraints:i.default.arrayOf(i.default.number),minConstraints:i.default.arrayOf(i.default.number),onResizeStop:i.default.func,onResizeStart:i.default.func,onResize:i.default.func,resizeHandles:i.default.arrayOf(i.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:i.default.number,width:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var d,p=r[0];return p.axis==="both"||p.axis==="x"?(d=i.default.number).isRequired.apply(d,r):i.default.number.apply(i.default,r)}};return jt.resizableProps=o,jt}function sr(){if(Xn)return wt;Xn=1,wt.__esModule=!0,wt.default=void 0;var a=(function(f,u){if(f&&f.__esModule)return f;if(f===null||typeof f!="object"&&typeof f!="function")return{default:f};var m=s(u);if(m&&m.has(f))return m.get(f);var b={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in f)if(x!=="default"&&Object.prototype.hasOwnProperty.call(f,x)){var h=S?Object.getOwnPropertyDescriptor(f,x):null;h&&(h.get||h.set)?Object.defineProperty(b,x,h):b[x]=f[x]}return b.default=f,m&&m.set(f,b),b})(n),i=ir(),o=ol(),t=lr(),r=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(f){if(typeof WeakMap!="function")return null;var u=new WeakMap,m=new WeakMap;return(s=function(b){return b?m:u})(f)}function d(){return d=Object.assign?Object.assign.bind():function(f){for(var u=1;u<arguments.length;u++){var m=arguments[u];for(var b in m)Object.prototype.hasOwnProperty.call(m,b)&&(f[b]=m[b])}return f},d.apply(this,arguments)}function p(f,u){var m=Object.keys(f);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(f);u&&(b=b.filter(function(S){return Object.getOwnPropertyDescriptor(f,S).enumerable})),m.push.apply(m,b)}return m}function l(f){for(var u=1;u<arguments.length;u++){var m=arguments[u]!=null?arguments[u]:{};u%2?p(Object(m),!0).forEach(function(b){c(f,b,m[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(m)):p(Object(m)).forEach(function(b){Object.defineProperty(f,b,Object.getOwnPropertyDescriptor(m,b))})}return f}function c(f,u,m){return(u=(function(b){var S=(function(x,h){if(typeof x!="object"||x===null)return x;var k=x[Symbol.toPrimitive];if(k!==void 0){var j=k.call(x,h);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(x)})(b,"string");return typeof S=="symbol"?S:String(S)})(u))in f?Object.defineProperty(f,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):f[u]=m,f}function g(f,u){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,b){return m.__proto__=b,m},g(f,u)}var C=(function(f){var u,m;function b(){for(var x,h=arguments.length,k=new Array(h),j=0;j<h;j++)k[j]=arguments[j];return(x=f.call.apply(f,[this].concat(k))||this).handleRefs={},x.lastHandleRect=null,x.slack=null,x}m=f,(u=b).prototype=Object.create(m.prototype),u.prototype.constructor=u,g(u,m);var S=b.prototype;return S.componentWillUnmount=function(){this.resetData()},S.resetData=function(){this.lastHandleRect=this.slack=null},S.runConstraints=function(x,h){var k=this.props,j=k.minConstraints,v=k.maxConstraints,T=k.lockAspectRatio;if(!j&&!v&&!T)return[x,h];if(T){var M=this.props.width/this.props.height,P=x-this.props.width,D=h-this.props.height;Math.abs(P)>Math.abs(D*M)?h=x/M:x=h*M}var F=x,E=h,R=this.slack||[0,0],N=R[0],z=R[1];return x+=N,h+=z,j&&(x=Math.max(j[0],x),h=Math.max(j[1],h)),v&&(x=Math.min(v[0],x),h=Math.min(v[1],h)),this.slack=[N+(F-x),z+(E-h)],[x,h]},S.resizeHandler=function(x,h){var k=this;return function(j,v){var T=v.node,M=v.deltaX,P=v.deltaY;x==="onResizeStart"&&k.resetData();var D=(k.props.axis==="both"||k.props.axis==="x")&&h!=="n"&&h!=="s",F=(k.props.axis==="both"||k.props.axis==="y")&&h!=="e"&&h!=="w";if(D||F){var E=h[0],R=h[h.length-1],N=T.getBoundingClientRect();k.lastHandleRect!=null&&(R==="w"&&(M+=N.left-k.lastHandleRect.left),E==="n"&&(P+=N.top-k.lastHandleRect.top)),k.lastHandleRect=N,R==="w"&&(M=-M),E==="n"&&(P=-P);var z=k.props.width+(D?M/k.props.transformScale:0),O=k.props.height+(F?P/k.props.transformScale:0),H=k.runConstraints(z,O);z=H[0],O=H[1];var I=z!==k.props.width||O!==k.props.height,W=typeof k.props[x]=="function"?k.props[x]:null;W&&!(x==="onResize"&&!I)&&(j.persist==null||j.persist(),W(j,{node:T,size:{width:z,height:O},handle:h})),x==="onResizeStop"&&k.resetData()}}},S.renderResizeHandle=function(x,h){var k=this.props.handle;if(!k)return a.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+x,ref:h});if(typeof k=="function")return k(x,h);var j=l({ref:h},typeof k.type=="string"?{}:{handleAxis:x});return a.cloneElement(k,j)},S.render=function(){var x=this,h=this.props,k=h.children,j=h.className,v=h.draggableOpts;h.width,h.height,h.handle,h.handleSize,h.lockAspectRatio,h.axis,h.minConstraints,h.maxConstraints,h.onResize,h.onResizeStop,h.onResizeStart;var T=h.resizeHandles;h.transformScale;var M=(function(P,D){if(P==null)return{};var F,E,R={},N=Object.keys(P);for(E=0;E<N.length;E++)F=N[E],D.indexOf(F)>=0||(R[F]=P[F]);return R})(h,r);return(0,o.cloneElement)(k,l(l({},M),{},{className:(j?j+" ":"")+"react-resizable",children:[].concat(k.props.children,T.map(function(P){var D,F=(D=x.handleRefs[P])!=null?D:x.handleRefs[P]=a.createRef();return a.createElement(i.DraggableCore,d({},v,{nodeRef:F,key:"resizableHandle-"+P,onStop:x.resizeHandler("onResizeStop",P),onStart:x.resizeHandler("onResizeStart",P),onDrag:x.resizeHandler("onResize",P)}),x.renderResizeHandle(P,F))}))}))},b})(a.Component);return wt.default=C,C.propTypes=t.resizableProps,C.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},wt}var Yn,Zn,Tt={};function nl(){if(Yn)return Tt;Yn=1,Tt.__esModule=!0,Tt.default=void 0;var a=(function(u,m){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var b=d(m);if(b&&b.has(u))return b.get(u);var S={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in u)if(h!=="default"&&Object.prototype.hasOwnProperty.call(u,h)){var k=x?Object.getOwnPropertyDescriptor(u,h):null;k&&(k.get||k.set)?Object.defineProperty(S,h,k):S[h]=u[h]}return S.default=u,b&&b.set(u,S),S})(n),i=s(Ot()),o=s(sr()),t=lr(),r=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function s(u){return u&&u.__esModule?u:{default:u}}function d(u){if(typeof WeakMap!="function")return null;var m=new WeakMap,b=new WeakMap;return(d=function(S){return S?b:m})(u)}function p(){return p=Object.assign?Object.assign.bind():function(u){for(var m=1;m<arguments.length;m++){var b=arguments[m];for(var S in b)Object.prototype.hasOwnProperty.call(b,S)&&(u[S]=b[S])}return u},p.apply(this,arguments)}function l(u,m){var b=Object.keys(u);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(u);m&&(S=S.filter(function(x){return Object.getOwnPropertyDescriptor(u,x).enumerable})),b.push.apply(b,S)}return b}function c(u){for(var m=1;m<arguments.length;m++){var b=arguments[m]!=null?arguments[m]:{};m%2?l(Object(b),!0).forEach(function(S){g(u,S,b[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(b)):l(Object(b)).forEach(function(S){Object.defineProperty(u,S,Object.getOwnPropertyDescriptor(b,S))})}return u}function g(u,m,b){return(m=(function(S){var x=(function(h,k){if(typeof h!="object"||h===null)return h;var j=h[Symbol.toPrimitive];if(j!==void 0){var v=j.call(h,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(h)})(S,"string");return typeof x=="symbol"?x:String(x)})(m))in u?Object.defineProperty(u,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):u[m]=b,u}function C(u,m){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,S){return b.__proto__=S,b},C(u,m)}var f=(function(u){var m,b;function S(){for(var x,h=arguments.length,k=new Array(h),j=0;j<h;j++)k[j]=arguments[j];return(x=u.call.apply(u,[this].concat(k))||this).state={width:x.props.width,height:x.props.height,propsWidth:x.props.width,propsHeight:x.props.height},x.onResize=function(v,T){var M=T.size;x.props.onResize?(v.persist==null||v.persist(),x.setState(M,function(){return x.props.onResize&&x.props.onResize(v,T)})):x.setState(M)},x}return b=u,(m=S).prototype=Object.create(b.prototype),m.prototype.constructor=m,C(m,b),S.getDerivedStateFromProps=function(x,h){return h.propsWidth!==x.width||h.propsHeight!==x.height?{width:x.width,height:x.height,propsWidth:x.width,propsHeight:x.height}:null},S.prototype.render=function(){var x=this.props,h=x.handle,k=x.handleSize;x.onResize;var j=x.onResizeStart,v=x.onResizeStop,T=x.draggableOpts,M=x.minConstraints,P=x.maxConstraints,D=x.lockAspectRatio,F=x.axis;x.width,x.height;var E=x.resizeHandles,R=x.style,N=x.transformScale,z=(function(O,H){if(O==null)return{};var I,W,ee={},X=Object.keys(O);for(W=0;W<X.length;W++)I=X[W],H.indexOf(I)>=0||(ee[I]=O[I]);return ee})(x,r);return a.createElement(o.default,{axis:F,draggableOpts:T,handle:h,handleSize:k,height:this.state.height,lockAspectRatio:D,maxConstraints:P,minConstraints:M,onResizeStart:j,onResize:this.onResize,onResizeStop:v,resizeHandles:E,transformScale:N,width:this.state.width},a.createElement("div",p({},z,{style:c(c({},R),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},S})(a.Component);return Tt.default=f,f.propTypes=c(c({},t.resizableProps),{},{children:i.default.element}),Tt}var al=(Zn||(Zn=1,$t.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},$t.exports.Resizable=sr().default,$t.exports.ResizableBox=nl().default),$t.exports);const Zo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,names:t,workbook:r,restoreFocus:s,readonly:d=!1,disabled:p=!1,commandPopupButtonProps:l,sx:c,...g}=a,C=w.useNotifier(),[f,u]=n.useState(null),[m,b]=n.useState(()=>r.getSelectedRanges().getCoords()),[S,x]=n.useState(!1),{reference:h}=y.useFloatStack({parentFloat:l?.parentFloat}),[k,j]=n.useState(()=>d||!r.getProtection().isStructureAllowed()),v=()=>f?.text??"",[T,M]=n.useState(v),P=w.useCallbackRef(()=>{if(h?.closeAll(),!T){const _=v();return M(v()),_}if(v()===T)return T;const $=T.trim().toLowerCase();if($==="r"||$==="c")return T;try{const _=r.getRanges(T);if(_)return _.toString()}catch{}const U=t.getByName(T);if(U&&U.getRanges())return T;let Y=null;try{const _=r.getRanges(T),L=_.getCoords().map(G=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...G}));Y=r.getRanges(L)}catch{}if(!Y){const _=r.getSelectedRanges().getCoords().map(L=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...L}));Y=r.getRanges(_)}try{let _=t.getByName(T);k||_||(_=t.addReference(T,Y)),_&&u({text:_.getName()})}catch(_){M(v()),C.showMessage?.(_.message,{type:w.NotifierType.Error})}return null},[T,t,h,k,C]),D=w.useCallbackRef(()=>{if(r.isClosed())return;const $=[];for(let _=0;_<m.length;_++){const L=m[_];$.push({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...L})}let U=null;try{U=t.lookupByRanges($)}catch{}let Y=null;Y=U?.length>0?U[0].getName():r.getSelectedSheet().getSelectedRange().toString(),u({text:Y})},[r,m]),[F,E]=n.useState(()=>t?.getItems()??null);oe.useModelListener(t,{onCollectionChange($){E(t.getItems()),D()},onClose($){E([])}}),n.useEffect(()=>{M(v())},[f,m]);const[R,N]=n.useState(r?.getSelectedSheet());oe.useModelListener(r,{onProtectionChange:$=>{j(d||!$.getProtection().isStructureAllowed())},onSheetsChange:$=>{N($?.getSelectedSheet())},onViewChange($){N($?.getSelectedSheet())}});const[z,O]=n.useState(null),H=w.useCallbackRef(A.CommonUtils.debounce(D,z?320:0),[]);oe.useModelListener(R.getSelection(),{onChange:()=>{b($=>{const U=r.getSelectedRanges().getCoords();return A.CoordUtils.isEqualRangesArrays(U,$)?$:U})},onAdjustingChange:$=>{O($.getAdjusting())}}),n.useEffect(()=>{if(z){const $=r.getSelectedRange(),U=$.getRowCount(),Y=$.getColumnCount();let _=`${U}R x ${Y}C`;if(_.length>17&&(_=`${U}x${Y}`),U>1||Y>1)return void u({text:_,fontStyle:"italic",justifyContent:"center"})}u({text:r.getSelectedSheet().getSelectedRange().toString()}),H()},[m,r,z]);const I=n.useRef(null),W=n.useCallback($=>{const{onMouseDown:U,onMouseUp:Y,..._}=$;return e.jsx(B.IconButton,{..._,sx:{..._?.sx,display:"flex",flex:"1 1 100%"},disableRipple:!0,children:e.jsx(B.Input,{inputMode:"text",inputProps:{tabIndex:0,name:"input-named-range",maxLength:255,className:"input",autoFocus:!1,spellCheck:!1,autoComplete:"off",ref:I},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:L=>`1px solid ${L.palette.text.icon??L.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:L=>`1px solid ${L.palette.primary.main}`},"::after":{borderBottom:L=>`1px solid ${L.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",height:"1rem",fontSize:11*A.IFont.getDeviceScale(),fontStyle:f?.fontStyle,paddingLeft:L=>L.spacing(.75),paddingRight:L=>L.spacing(.75),boxShadow:"none",flex:"1",color:L=>L.palette.text.secondary,input:{padding:"0",height:"1rem",textAlign:"left","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:L=>L.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:L=>L.palette.text.primary}}},value:T,onFocus:L=>{L.target?.select()},onKeyDown:L=>{if(L.which===w.KeyCodes.Enter||L.which===w.KeyCodes.Tab){let G=T;v()!==T&&(L.stopPropagation(),L.preventDefault(),G=P()),G?ee(G):s?.()}else if(L.which===w.KeyCodes.Escape)v()!==T?(M(v()),setTimeout(()=>{L.target?.select()},0),L.stopPropagation(),L.preventDefault()):s?.();else if(L.which===w.KeyCodes.Space)return void L.stopPropagation()},onBlur:()=>{M(v())},onChange:L=>{M(L.target.value)}})})},[T,f]),ee=w.useCallbackRef(async $=>{try{h?.closeAll();const U=t.lookupByRanges($)?.[0];U&&await U?.select(),await r.getRanges($)?.select()}catch(U){C.showMessage?.(U.message,{type:w.NotifierType.Error})}},[t,C,r]),X=n.useCallback($=>{setTimeout(()=>{x(!0)},0);const U={variant:w.CommandButtonType.Menuitem,parentFloat:$.floatReference,commandHook:{...l?.commandHook,beforeExecute:(re,me)=>(h?.closeAll(),l?.commandHook?.beforeExecute?.(re,me))},scope:l?.scope,commands:l?.commands};let Y=t.getItems({scope:r?.getSelectedSheet().getName()});Y=Y.sort((re,me)=>re.getType()===me.getType()?re.getName().localeCompare(me.getName()):re.getType()==="range"?-1:1);const _=k?null:["editNamedReference","deleteNamedReference"],L=k?null:["editTable",null,"convertTableToRange","deleteTable"],G=[],Q=Y.length;for(let re=0;re<Q;re++){const me=Y[re],Se=me.getRanges();if(!Se||me.isHidden())continue;const Ce=me.getType();Ce!==Y[re-1]?.getType()&&(re>0&&G.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},`type-divider-${G.length}`)),G.push(e.jsx(y.ExhibitMenuHeader,{variant:"subtitle2",sx:{paddingLeft:"16px"},children:me.getType()==="reference"?"Ranges":"Tables"},`type-header-${G.length}`))),Ce==="reference"?G.push(n.createElement(y.SimpleCommandPopupButton,{...U,key:"named-"+G.length,popupCommandKeys:_,popupScope:"namedItem",scope:"namedItem",commandState:me,commands:l?.commands,label:me.getName(),quickCommand:"selectNamed",disabled:!me.getRanges()||p,icon:"NamedRange"})):Ce==="table"&&G.push(n.createElement(y.SimpleCommandPopupButton,{...U,key:"namedItem-"+G.length,popupCommandKeys:L,popupScope:"namedItem",scope:"namedItem",commands:l?.commands,commandState:me,label:me.getName(),quickCommand:"selectNamed",disabled:!Se||p,icon:"InsertTable"}))}const fe=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...g,children:[k?null:e.jsx(y.CommandButton,{...U,scope:"namedItem",command:l?.commands.getCommand("addNamedReference")}),G&&G.length>0?e.jsxs(e.Fragment,{children:[k?null:e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:G})]}):null]});return y.defaultCreatePopupPanel({...$,children:fe})},[r,F,t,f,k]),ne=w.useImperativeElement(i,()=>({focus($){I.current?.focus($)}}),[]);return e.jsx(B.Box,{className:"outer",sx:{minWidth:120,flex:"1 1 100%",display:"flex",alignItems:"center",justifyContent:"start",...c},ref:tt([ne,i]),...g,children:e.jsx(y.ExhibitPopupIconButton,{className:"outer-button",sx:{display:"flex",flex:"1 1 100%","& .tooltip-wrapper":{display:"flex",flex:"1 1 100%",width:"100%"},...c},buttonProps:{sx:{backgroundColor:$=>$.palette.background.paper,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`}},tabIndex:-1,outlined:{color:$=>o?$.palette.action.disabled:q.alpha($.palette.divider,.2)},parentFloat:h,createPopupPanel:X,onPopupOpen:()=>x(!0),onPopupClose:()=>x(!1),createTooltip:({children:$},U)=>e.jsx(y.ExhibitTooltip,{title:U||S?"":"Name Box",disabled:U,leaveDelay:0,sx:{opacity:U||S?0:1},children:$}),createQuickButton:W})})}));Zo.displayName="NamedCollectionEditor";const rl=(a,i)=>e.jsx(Zo,{ref:i,...a}),Qo=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,sheetElement:r,gridStyle:s,showNamedCollectionEditor:d=!0,NamedCollectionEditorProps:p,renderNamedCollectionEditor:l=rl,disabled:c,commands:g,...C}=a,[f,u]=n.useState(t?.getSelectedSheet());oe.useModelListener(t,{onSheetsChange:L=>{u(L?.getSelectedSheet())},onViewChange(L){u(L?.getSelectedSheet())}});const[m,b]=n.useState(f.getSelection().getCoords().cell),S=f.getRange(m).getCell(),x=c||!S.isEditAllowed(),h=n.useRef(null),k=n.useMemo(()=>({fontSize:11}),[]);oe.useModelListener(f.getSelection(),{onChange:()=>{b(f.getSelection().getCoords().cell)}}),oe.useModelListener(f,{onProtectionChange(){b(f.getSelection().getCoords().cell)}});const j=h.current?.getLineHeight()??20,[v,T]=n.useState(j),[M,P]=n.useState(5),[D,F]=n.useState(1),E=w.useCallbackRef((L,{size:G})=>{L.preventDefault(),L.stopPropagation();const Q=Math.floor(G.height/j);T(Q*j+1),Q>1&&P(Q)},[j]),R=w.useCallbackRef((L,{size:G})=>{const Q=Math.floor(G.height/j);F(Q)},[j]),N=w.useEditMode(),z=N.getMode();let O=null;z?.key==="edit"&&(O=z.args?.stateAndCoords);const H=n.useMemo(()=>{let L=O?.editState;return L||(L=oe.createCellEditStateFromCell(()=>f.getRange(m).getCell())),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(oe.SheetCellEditor,{ref:h,activeCoords:m,sheet:f,onFocus:()=>{r?.startEdit({autoFocus:!1,editMode:!0,cell:m})},defaultTextStyle:k,useRichStyling:!1,disabled:x,onChangeEdit:G=>{if(G.dirty!==void 0){const Q={sheet:f,coords:m,editState:G};N.setMode(fe=>({...fe,args:{...fe?.args,stateAndCoords:Q}}))}},editState:L,commands:g,onCancelEdit:()=>{r?.cancelEdit(),r?.focus()},onSubmitEdit:()=>{r?.submitEdit(),r?.focus()},linesVisible:D})})},[f,O,m,D,r]),I=n.useRef(null),W=n.useMemo(()=>d?l({names:t.getNames(),workbook:t,...p},I):null,[l,p,d,f,t,x]),ee=n.useMemo(()=>e.jsxs(B.Paper,{elevation:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:0,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,border:L=>`solid ${x?L.palette.action.disabled:q.alpha(L.palette.divider,.2)} 1px`},children:[e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"warning","aria-label":"cancel-formula-edit",icon:e.jsx(w.DynamicIcon,{iconKey:"CloseError"}),tooltipProps:{label:"Cancel",simple:!0},disabled:x||O===null,onMouseDown:L=>{L.button===0&&L.preventDefault()},onClick:()=>{r.cancelEdit()}}),e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"primary","aria-label":"commit-formula-edit",icon:e.jsx(w.DynamicIcon,{iconKey:"CheckSuccess"}),tooltipProps:{label:"Enter",simple:!0},disabled:x||O===null,onMouseDown:L=>{L.button===0&&L.preventDefault()},onClick:()=>{r.submitEdit()}}),e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,disabled:!0,"aria-label":"commit-formula-function",icon:e.jsx(w.DynamicIcon,{iconKey:"Function",style:{transform:"scale(0.85)"}}),tooltipProps:{label:"Insert Function",simple:!0},onMouseDown:L=>{L.button===0&&L.preventDefault()}})]}),[x,O]),X=q.useTheme(),[ne,$]=n.useState(!1),U=n.useMemo(()=>e.jsxs(B.Box,{className:"formula-bar",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",gap:L=>L.spacing(.5),alignItems:"start"},children:[ee,e.jsxs(B.Paper,{elevation:0,sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",fontFamily:L=>L.typography.fontFamily,fontSize:11*A.IFont.getDeviceScale(),alignItems:"stretch",paddingTop:"2px",paddingBottom:"2px",boxShadow:"none",borderRadius:L=>`${L.shape.borderRadius}px`,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,border:L=>`solid ${x?L.palette.action.disabled:q.alpha(L.palette.divider,.2)} 1px`,"& textarea":{color:L=>x?`${L.palette.text.disabled} !important`:L.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:()=>$(!0),onBlur:()=>$(!1),onMouseDown:L=>{L.target?.classList.contains("react-resizable-handle")&&L.preventDefault()},children:[e.jsx(B.Box,{className:"formula-editor",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",alignItems:"center",marginTop:"0px",paddingLeft:L=>L.spacing(1),paddingRight:L=>L.spacing(1)},children:e.jsx(al.ResizableBox,{height:v,draggableOpts:{grid:[j,j]},minConstraints:[j,j],maxConstraints:[15*j,15*j],onResize:R,onResizeStop:E,resizeHandles:["s"],axis:"y",style:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:H})}),e.jsx(y.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:e.jsx(w.DynamicIcon,{iconKey:D>1?"ExpandLess":"ExpandMore"}),tooltipProps:{label:(D>1?"Collapse":"Expand")+" Formula Bar",simple:!0},onMouseDown:L=>{L.button===0&&L.preventDefault()},onClick:()=>{const L=D>1?1:M;T(L*j+1),F(L)}}),e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"2px",bottom:"0",willChange:"opacity",transition:"opacity 60ms ease-in",opacity:ne?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:L=>L.palette.primary.main,borderRadius:L=>`${L.shape.borderRadius}px`}})]})]}),[ee,H,ne,D,j]),Y=n.useMemo(()=>W||U?!W&&U?U:W&&!U?W:e.jsx(e.Fragment,{children:e.jsx(w.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 calc(((var(--icon-size, 24) - 13px + 5px) / 2))",minWidth:"18px",marginRight:"1px"}},elementBefore:W,elementAfter:U})}):null,[W,U]),_=w.useImperativeElement(i,()=>({isFormulaBarElement:()=>!0,getNamedCollectionEditorElement:()=>I.current}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:L=>L.spacing(.5),...o},ref:_,...C,children:Y})}));Qo.displayName="FormulaBar";const Jo=n.memo(n.forwardRef((a,i)=>{const{filter:o,commands:t,disabled:r,sx:s,floatReference:d,...p}=a,l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(f,u)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),g=n.useMemo(()=>({...l,...c,variant:w.CommandButtonType.Menuitem}),[l,c]),C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:t.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...g,command:t.getCommand("sortDescending")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:t.getCommand("autoFilterClear")}),[]]});return e.jsx(B.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...s},...p,children:C})}));Jo.displayName="FilterColumnMenu";const cr=n.memo(n.forwardRef((a,i)=>{const{children:o,className:t,disabled:r,style:s,filter:d,...p}=a,l=w.useImperativeElement(i,()=>({isFilters:()=>!0}),[]);return e.jsx("div",{ref:l,className:ie("filters",t),style:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",...s},...p,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:d.getName()}),e.jsx("div",{children:"Filter Widget"})]})})}));cr.displayName="Filters";const en=n.memo(n.forwardRef((a,i)=>{const{children:o,sheet:t,style:r,className:s,value:d,index:p,editing:l,editable:c,disabled:g,selectedIndex:C,dragging:f,borderColor:u,borderWidth:m,activeColor:b,background:S="white",tabRadius:x=4,gridTheme:h,...k}=a,[j,v]=n.useState(()=>!!t&&t.getProtection().isLocked()),[T,M]=n.useState(()=>t?t.getTabColor():null);oe.useModelListener(t,{onProtectionChange:()=>{v(t.getProtection().isLocked())},onTabColorChange:()=>{M(t.getTabColor())},onStyleChange:()=>{M(t.getTabColor())}});const P=q.useTheme(),D=C===p;let F=null,E=null;if(T||f){let z=S;T?(E=T.toBlackOrWhite().toCSS(),z=T?.toCSS()):D||(z=P.palette.background.paper),F=e.jsx(B.Box,{sx:{position:"absolute",boxSizing:"border-box",top:"3px",left:"4px",right:"4.5px",bottom:"1.5px",opacity:D?"50%":"100%",borderRadius:"4px",border:O=>D?`${S} solid 1px`:`${O.palette.divider} solid 1px`,background:D&&T?`linear-gradient(0deg, ${z} 0%, transparent)`:z}})}let R=null;typeof u=="string"?R=u:u?.toCSS&&(R=u.toCSS());const N=D?e.jsx(B.Box,{sx:{width:"100%",borderRadius:"4px",minWidth:"4px",height:"2px",backgroundColor:z=>z.palette.primary.main}}):null;return e.jsx(q.ThemeProvider,{theme:D?h??P:P,children:e.jsx(B.Box,{ref:i,className:ie(s),sx:{...r,display:"flex",flexDirection:"column",minHeight:"0px",fontWeight:D?"700":"400",fontSize:"0.85rem",letterSpacing:"0",lineHeight:"1",textTransform:"none",minWidth:"unset",cursor:f?"grabbing":void 0},...k,children:e.jsx(w.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:x,strokeColor:D?R:"transparent",children:e.jsx(B.Button,{sx:{textTransform:"none",borderRadius:"0px",minHeight:"0px",paddingLeft:"11px",paddingRight:"12px",paddingTop:"3px",flex:"1 1 100%",paddingBottom:"3px",fontWeight:D?"700":"400",fontSize:"0.85rem",letterSpacing:"0",transition:"none",cursor:f?"grabbing":void 0,color:D?"primary":E||"text.secondary",backgroundColor:D?S:"transparent","&:hover:not([disabled])":{backgroundColor:D?S:"transparent"},"& input":{color:z=>`${z.palette.text.primary}`,textAlign:"center",fontWeight:"500"},marginTop:"0px",minWidth:"unset"},disabled:g,disableRipple:l,component:"div",children:e.jsxs(e.Fragment,{children:[F,e.jsxs(B.Box,{sx:{zIndex:"1",display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:"1px",lineHeight:"1",marginTop:D?void 0:"1px"},children:[o,N]}),j?e.jsx(w.DynamicIcon,{iconKey:"Lock",style:{scale:"0.80",marginLeft:"2px",width:"22px",height:"22px"},color:"secondary"}):e.jsx(B.Box,{sx:{minHeight:"22px"}})]})]})},d+":"+p)})})})}));en.displayName="SheetTab";const tn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,index:t,commands:r,scope:s="sheet",disabled:d,floatReference:p,sx:l,className:c,tabStripRef:g,...C}=a,[f,u]=n.useState(o?.getProtection());oe.useModelListener(o,{onProtectionChange:h=>{u(h?.getProtection())}});const m=n.useMemo(()=>({}),[]),b=n.useMemo(()=>({commandHook:{beforeExecute:(h,k)=>p.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:s,commandState:t,disabled:d||t===void 0,parentFloat:p}),[d,p]),S=n.useMemo(()=>({...m,...b}),[m,b]),x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:r.getCommand("addSheet"),commandState:t,...S,variant:w.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r.getCommand("deleteSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsxs(y.ExhibitMenuItem,{onMouseDown:h=>{h.button===0&&h.preventDefault()},onMouseUp:()=>{Promise.resolve(p.closeAll()).then(()=>{g?.startEdit(t)})},disabled:d||!f.isStructureAllowed(),parentFloat:p,children:["Rename",s!=="sheet"?" Sheet":""]}),e.jsx(y.CommandButton,{command:r.getCommand("duplicateSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r?.getCommand("protectionSheetToggle"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(ht,{variant:w.CommandButtonType.Menuitem,command:r.getCommand("formatSheetTabColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0,autoColorLabel:"No Tab Color",autoColorPosition:pt.End},parentFloat:p}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{command:r.getCommand("hideSheet"),...S,variant:w.CommandButtonType.Menuitem})]});return e.jsx(B.Box,{ref:i,className:ie("menu",c),sx:{...l},...C,children:x})}));tn.displayName="SheetTabMenu";const on=n.memo(n.forwardRef((a,i)=>{const{workbook:o,gridStyle:t,floatReference:r,closeFloatAll:s,className:d,...p}=a,[l,c]=n.useState(o?.getSheets().getItems()),[g,C]=n.useState(o?.getProtection());oe.useModelListener(o,{onSheetsChange:u=>{c(u.getSheets().getItems())},onProtectionChange:u=>{C(u?.getProtection())}});const f=n.useMemo(()=>{const u=[],m=o.getSheets().getItems({visibility:A.ISheet.Visibility.Hidden}),b=o.getSelectedSheet();for(let S=0;S<m.length;S++){const x=m[S],h=x.getVisibility();if(h===A.ISheet.Visibility.VeryHidden)continue;const k=b===x,j=x.getProtection().isLocked(),v=x.getTabColor(),T=t?.body.fill??"transparent";let M=null,P=null,D=T;v&&(D=v.toCSS(),k||(P=v.toBlackOrWhite().toCSS()),M=e.jsx(B.Box,{sx:{position:"absolute",display:"flex",flexDirection:"column",top:"4px",left:"40px",right:"8px",bottom:"4px",background:k?D:"transparent",borderRadius:"4px",border:`solid 1px ${t.header.edgeStrokeFill}`},children:e.jsx(B.Box,{sx:{flex:"1 1 100%",boxSizing:"content-box",opacity:k||h===A.ISheet.Visibility.Hidden?"50%":"100%",border:E=>k?`${T} solid 1.5px`:`${E.palette.divider} solid 1px`,background:k&&v?`linear-gradient(0deg, ${D} 0%, ${T})`:D,borderRadius:"4px"}})}));let F=null;j&&(F=e.jsx(w.DynamicIcon,{iconKey:"Lock"})),h!==A.ISheet.Visibility.Visible&&(F=e.jsx(w.DynamicIcon,{iconKey:"VisibilityOff",style:{opacity:g.isStructureAllowed()?1:.7},color:"secondary"})),F&&(F=e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",ml:"16px","& *":{lineHeight:"1em",fontSize:"1.3em"}},children:F})),u.push(e.jsx(y.ExhibitMenuItem,{disabled:!g.isStructureAllowed()&&h===A.ISheet.Visibility.Hidden,sx:{color:E=>{let R=k?E.palette.primary.main:E.palette.text.secondary;return P&&(R=P),h===A.ISheet.Visibility.Hidden&&(R=Re.alpha(R,E.palette.action.disabledOpacity)),R},borderLeft:E=>`${k?E.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"4px",paddingTop:"4px",paddingBottom:"4px",fontWeight:k?"700":"400","&:hover":{fontWeight:"700"}},icon:k?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:E=>E.preventDefault(),onMouseUp:()=>{Promise.resolve(r.closeAll()).then(()=>{try{x.select()}catch(E){console.error(E)}})},children:e.jsxs(e.Fragment,{children:[M,e.jsxs(B.Box,{sx:{paddingRight:"0px",paddingLeft:"4px",display:"flex",flexDirection:"row",flex:"1 1 100%",overflow:"hidden",alignItems:"center",zIndex:2},children:[e.jsxs(B.Box,{className:"sheet-name",sx:{display:"flex",flexDirection:"column",paddingLeft:"8px",paddingRight:"8px",alignItems:"center"},children:[x.getName(),e.jsx(B.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:x.getName()})]}),F]})]})},""+S))}return u},[o,g,l,r,t]);return e.jsx(B.Box,{ref:i,className:ie("menu",d),...p,children:f})}));on.displayName="SheetsAllMenu";let Ut=!1,dr=!1,$e=null;const Qn=async a=>{const i=await A.LicenseManager.getDetails();if(dr||i.isEval()){try{const o=top??window;o.SheetXL||(o.SheetXL=Object.freeze({getSelectedWorkbook:()=>$e?.getWorkbook(),getSelectedSheet:()=>$e?.getWorkbook().getSelectedSheet(),getSelectedRange:()=>$e?.getWorkbook().getSelectedRange(),getSelectedRanges:()=>$e?.getWorkbook().getSelectedRanges(),getRange:t=>$e?.getWorkbook().getRange(t),getSelectedWorkbookElement:()=>$e,getLicenseManager:()=>A.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(o){o instanceof DOMException||console.error(o),Ut=!0}if($e!==a&&($e=a,!Ut))try{Ut=!0,(top??window).SheetXL&&(await A.LicenseManager._validate(!0),A.LicenseManager.wasPrinted()&&(()=>{je.CommonUtils.consoleWithNoSource(`%cTip: You can access the API directly in the console.
10
10
  Try
11
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;"),Ut=!0;const o=document.getElementById("openEditorLink");o&&o.addEventListener("click",t=>{t.preventDefault(),console.log("openScriptEditor called from console")})})())}catch(o){o instanceof DOMException||console.error(o)}}};function oo(){return oo=Object.assign?Object.assign.bind():function(a){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var t in o)({}).hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},oo.apply(null,arguments)}function nn(a,i){if(a==null)return{};var o={};for(var t in a)if({}.hasOwnProperty.call(a,t)){if(i.indexOf(t)!==-1)continue;o[t]=a[t]}return o}function no(a,i){return no=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,t){return o.__proto__=t,o},no(a,i)}function ur(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,no(a,i)}function Jn(a,i){return a.replace(new RegExp("(^|\\s)"+i+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const ea=!1,mr=n.createContext(null);var pr=function(a){return a.scrollTop},Ft="unmounted",Xe="exited",Ye="entering",lt="entered",Do="exiting",Le=(function(a){function i(t,r){var s;s=a.call(this,t,r)||this;var d,p=r&&!r.isMounting?t.enter:t.appear;return s.appearStatus=null,t.in?p?(d=Xe,s.appearStatus=Ye):d=lt:d=t.unmountOnExit||t.mountOnEnter?Ft:Xe,s.state={status:d},s.nextCallback=null,s}ur(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Ft?{status:Xe}:null};var o=i.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==Ye&&s!==lt&&(r=Ye):s!==Ye&&s!==lt||(r=Do)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t,r,s,d=this.props.timeout;return t=r=s=d,d!=null&&typeof d!="number"&&(t=d.exit,r=d.enter,s=d.appear!==void 0?d.appear:r),{exit:t,enter:r,appear:s}},o.updateStatus=function(t,r){if(t===void 0&&(t=!1),r!==null)if(this.cancelNextCallback(),r===Ye){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:Je.findDOMNode(this);s&&pr(s)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Xe&&this.setState({status:Ft})},o.performEnter=function(t){var r=this,s=this.props.enter,d=this.context?this.context.isMounting:t,p=this.props.nodeRef?[d]:[Je.findDOMNode(this),d],l=p[0],c=p[1],g=this.getTimeouts(),C=d?g.appear:g.enter;!t&&!s||ea?this.safeSetState({status:lt},function(){r.props.onEntered(l)}):(this.props.onEnter(l,c),this.safeSetState({status:Ye},function(){r.props.onEntering(l,c),r.onTransitionEnd(C,function(){r.safeSetState({status:lt},function(){r.props.onEntered(l,c)})})}))},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts(),d=this.props.nodeRef?void 0:Je.findDOMNode(this);r&&!ea?(this.props.onExit(d),this.safeSetState({status:Do},function(){t.props.onExiting(d),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:Xe},function(){t.props.onExited(d)})})})):this.safeSetState({status:Xe},function(){t.props.onExited(d)})},o.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(d){s&&(s=!1,r.nextCallback=null,t(d))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=this.props.nodeRef?this.props.nodeRef.current:Je.findDOMNode(this),d=t==null&&!this.props.addEndListener;if(s&&!d){if(this.props.addEndListener){var p=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],l=p[0],c=p[1];this.props.addEndListener(l,c)}t!=null&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Ft)return null;var r=this.props,s=r.children;r.in,r.mountOnEnter,r.unmountOnExit,r.appear,r.enter,r.exit,r.timeout,r.addEndListener,r.onEnter,r.onEntering,r.onEntered,r.onExit,r.onExiting,r.onExited,r.nodeRef;var d=nn(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return n.createElement(mr.Provider,{value:null},typeof s=="function"?s(t,d):n.cloneElement(n.Children.only(s),d))},i})(n.Component);function nt(){}Le.contextType=mr,Le.propTypes={},Le.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:nt,onEntering:nt,onEntered:nt,onExit:nt,onExiting:nt,onExited:nt},Le.UNMOUNTED=Ft,Le.EXITED=Xe,Le.ENTERING=Ye,Le.ENTERED=lt,Le.EXITING=Do;var Co=function(a,i){return a&&i&&i.split(" ").forEach(function(o){return r=o,void((t=a).classList?t.classList.remove(r):typeof t.className=="string"?t.className=Jn(t.className,r):t.setAttribute("class",Jn(t.className&&t.className.baseVal||"",r)));var t,r})},Fo=(function(a){function i(){for(var t,r=arguments.length,s=new Array(r),d=0;d<r;d++)s[d]=arguments[d];return(t=a.call.apply(a,[this].concat(s))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(p,l){var c=t.resolveArguments(p,l),g=c[0],C=c[1];t.removeClasses(g,"exit"),t.addClass(g,C?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(p,l)},t.onEntering=function(p,l){var c=t.resolveArguments(p,l),g=c[0],C=c[1]?"appear":"enter";t.addClass(g,C,"active"),t.props.onEntering&&t.props.onEntering(p,l)},t.onEntered=function(p,l){var c=t.resolveArguments(p,l),g=c[0],C=c[1]?"appear":"enter";t.removeClasses(g,C),t.addClass(g,C,"done"),t.props.onEntered&&t.props.onEntered(p,l)},t.onExit=function(p){var l=t.resolveArguments(p)[0];t.removeClasses(l,"appear"),t.removeClasses(l,"enter"),t.addClass(l,"exit","base"),t.props.onExit&&t.props.onExit(p)},t.onExiting=function(p){var l=t.resolveArguments(p)[0];t.addClass(l,"exit","active"),t.props.onExiting&&t.props.onExiting(p)},t.onExited=function(p){var l=t.resolveArguments(p)[0];t.removeClasses(l,"exit"),t.addClass(l,"exit","done"),t.props.onExited&&t.props.onExited(p)},t.resolveArguments=function(p,l){return t.props.nodeRef?[t.props.nodeRef.current,p]:[p,l]},t.getClassNames=function(p){var l=t.props.classNames,c=typeof l=="string",g=c?(c&&l?l+"-":"")+p:l[p];return{baseClassName:g,activeClassName:c?g+"-active":l[p+"Active"],doneClassName:c?g+"-done":l[p+"Done"]}},t}ur(i,a);var o=i.prototype;return o.addClass=function(t,r,s){var d=this.getClassNames(r)[s+"ClassName"],p=this.getClassNames("enter").doneClassName;r==="appear"&&s==="done"&&p&&(d+=" "+p),s==="active"&&t&&pr(t),d&&(this.appliedClasses[r][s]=d,(function(l,c){l&&c&&c.split(" ").forEach(function(g){return f=g,void((C=l).classList?C.classList.add(f):(function(u,m){return u.classList?!!m&&u.classList.contains(m):(" "+(u.className.baseVal||u.className)+" ").indexOf(" "+m+" ")!==-1})(C,f)||(typeof C.className=="string"?C.className=C.className+" "+f:C.setAttribute("class",(C.className&&C.className.baseVal||"")+" "+f)));var C,f})})(t,d))},o.removeClasses=function(t,r){var s=this.appliedClasses[r],d=s.base,p=s.active,l=s.done;this.appliedClasses[r]={},d&&Co(t,d),p&&Co(t,p),l&&Co(t,l)},o.render=function(){var t=this.props;t.classNames;var r=nn(t,["classNames"]);return n.createElement(Le,oo({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},i})(n.Component);Fo.defaultProps={classNames:""},Fo.propTypes={};const So=.12,Io=(a,i)=>{const o={},t=l=>{const c=l.palette?.background.default??"rgba(255,255,255,1)";return{text:{fontFamily:l.typography?.fontFamily??"Calibri",fontSize:l.typography?.fontSize??8.25,fontWeight:l.typography?.fontWeightRegular??"400",fill:l.palette.mode==="dark"?l.palette?.text?.secondary:l.palette?.text?.primary},fill:c,strokeFill:y.elevateColor(c,So,l.palette?.mode),darkMode:l.palette.mode==="dark"}},r=t(i);o.body=t(a),o.header={...o.body,strokeFill:y.elevateColor(o.body.fill,So,a.palette?.mode),fill:i&&a.palette.mode==="dark"&&i.palette.mode!==a.palette.mode?o.body.fill:y.elevateColor(o.body.fill,.055,a.palette?.mode),edgeStrokeFill:a.palette.mode==="dark"?o.body.strokeFill:y.elevateColor(o.body.fill,.328,a.palette?.mode)},o.headerHover=l=>({...o.header,strokeFill:y.elevateColor(l?.fill??o.body.fill,.22,a.palette?.mode),fill:y.elevateColor(l?.fill??o.header.fill,.065,a.palette?.mode),text:{...l?.text,fontWeight:a.typography?.fontWeightBold}});const s=y.elevateColor(a.palette.mode!=="dark"?a.palette.primary.light:a.palette.primary.main,.055,a.palette?.mode);o.headerSelect={...o.header,strokeFill:a.palette.primary.main,fill:Re.alpha(s,.2),text:{...o.header.text,fill:a.palette.primary.main},dividerStrokeFill:Re.alpha(s,.7)},o.headerSelectAll={...o.headerSelect,fill:Re.alpha(s,.9),text:{...o.headerSelect.text,fill:a.palette.primary.contrastText},edgeStrokeFill:o.headerSelect.strokeFill},o.buttonSurface={...r,strokeFill:y.elevateColor(r.fill,So,i.palette?.mode),fill:i&&i.palette.mode==="dark"&&i.palette.mode!==a.palette.mode?r.fill:y.elevateColor(r.fill,.055,i.palette?.mode),edgeStrokeFill:i.palette.mode==="dark"?r.strokeFill:y.elevateColor(r.fill,.328,i.palette?.mode)},o.headerSelection={fill:a.palette?.primary?.main?Re.alpha(a.palette?.primary?.main,.1):void 0,strokeFill:a.palette?.primary?.main},o.headerSelectionInactive={...o.headerSelection,fill:a.palette?.divider?Re.alpha(a.palette?.divider,.05):void 0,strokeFill:"transparent"};const d=i??a,p=d.palette.mode==="dark";return o.selection={fill:d.palette?.primary?.main?Re.alpha(d.palette?.primary?.main,.1):void 0,strokeFill:d.palette?.primary?.main},o.selectionInactive={...o.selection,fill:d.palette?.divider?Re.alpha(d.palette?.divider,.05):void 0,strokeFill:"transparent"},o.selectionRemove={...o.selection,fill:Re.alpha(d.palette.warning.light,.05),strokeFill:d.palette.warning.dark},i&&(o.body=t(i)),o.colorShadow=Re.alpha(d.palette.action.active,.5),o.colorGrey=d.palette.action.active,o.filterDarkInvert=p?"hue-rotate(180deg) invert(1) brightness(95%)":"none",o},Nt=n.memo(n.forwardRef((a,i)=>{const{children:o,sx:t,parentFloat:r,...s}=a,d=w.useImperativeElement(i,()=>({}),[]),[p,l]=Ve(),c=n.useRef(null),g=n.useRef(null),[C,f]=n.useReducer(v=>v+1,0),[u,m]=n.useState(null),[b,S]=n.useState(null),[x,h]=n.useState(null),{reference:k}=y.useFloatStack({parentFloat:r,label:"overflow"});n.useLayoutEffect(()=>{g.current={refs:[]};const v=[],T=n.Children.toArray(o);let M=0;T.forEach((P,D)=>{v.push(e.jsx(B.Box,{sx:{display:"flex"},ref:F=>{M++,M===T.length&&f();const E={current:null};E.current=F,g.current.refs[D]=E},children:P},D))}),m(v)},[o,l]),n.useLayoutEffect(()=>{if(!u)return;const v=g.current.refs,T=v?v.length:0;if(!d.current||T===0)return S(null),void h(null);const M=d.current?.getBoundingClientRect(),P=[],D=[];let F=0,E=!1;for(let N=0;!E&&N<T;N++){const z=v[N];if(!z)continue;if(!z.current){E=!0;continue}const O=z.current.getBoundingClientRect();F+=O?.width,F>M.width&&(E=!0)}if(!E)return S(null),void h([]);const R=c.current?.getBoundingClientRect();F=0;for(let N=0;N<T;N++){const z=v[N];let O=!1;if(z.current){const H=z.current.getBoundingClientRect();F+=H?.width,F<M.width-R.width&&(O=!0)}O?P.push(u[N]):D.push(u[N])}S(P.length>0?P:null),h(D.length>0?D:null)},[o,u,l,k,C]);const j=w.useCallbackRef(v=>{const T=[],M=x.length;for(let D=0;D<M;D++){const F=n.Children.toArray(x[D])[0];n.Children.toArray(F.props.children?.props?.children??F.props.children).forEach((E,R)=>{const N=E,z={...N.props,key:`overflow-${D}-${R}${N.key??""}`};z.parentFloat&&v&&(z.parentFloat=v.floatReference);const O=n.cloneElement(N,z);T.push(O)})}const P=e.jsx(B.Box,{className:"overflow-palette-popup-panel",sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:D=>D.spacing(.25),paddingTop:D=>D.spacing(.5),paddingBottom:D=>D.spacing(.5),paddingLeft:D=>D.spacing(1),paddingRight:D=>D.spacing(1),overflow:"hidden"},children:T});return y.defaultCreatePopupPanel({...v,children:P})},[x]);return e.jsxs(B.Box,{className:"overflow-palette",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",width:"100%",maxWidth:"100%",...t},ref:et([d,p,i]),...s,children:[e.jsx(B.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%",alignItems:"center"},children:b??u}),e.jsx(B.Box,{className:"overflow-palette-popup-button",sx:{display:x!==null&&x.length===0?"none":"flex",flex:"1 1 0"},children:e.jsx(y.ExhibitPopupIconButton,{createPopupPanel:j,ref:c,parentFloat:k,createTooltip:({children:v},T)=>e.jsx(y.ExhibitTooltip,{label:"More",description:"More toolbar options…",disabled:T,children:v}),icon:e.jsx(w.DynamicIcon,{iconKey:"MoreHorizontal"})})})]})})),fr="https://unpkg.com/@sheetxl/scripting-templates/dist",il=a=>{if(a.metadata?.name)return a.metadata.name;let i=(a.path.split("/").pop()||"").replace(/\.[^/.]+$/,"");return a.metadata?.icon==="formula"?i.toUpperCase():(i=i.replace(/([a-z])([A-Z])/g,"$1 $2"),i.replace(/[-_]/g," ").trim().split(/\s+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "))},hr=async a=>{const i=ct.IOUtils.relativePath(a,"./manifest.json"),o=await fetch(i);if(!o.ok)throw new je.ChainedError(`Failed to retrieve directory at '${a}': ${o.statusText}`);const t=await o.text();if(t.trim().toLowerCase().startsWith("<!doctype html")||t.trim().toLowerCase().startsWith("<html"))throw new je.ChainedError(`Failed to retrieve directory at '${a}'`);let r;try{r=JSON.parse(t)}catch(d){throw new Error(`Failed to parse directory: ${d.message}. Ensure the file is valid JSON.`)}const s=r.map(async d=>{try{const p=ct.IOUtils.relativePath(a,d.path),l=await fetch(p);if(!l.ok)throw new Error(`Failed to fetch file at '${d.path}': ${l.statusText}`);const c=await l.text();let g=d.metadata;return g?.title||(g={title:il(d),...g}),{path:d.path,content:c,metadata:g}}catch(p){console.error(p.message)}return null});return(await Promise.all(s)).filter(d=>d!==null)},wo={marginRight:"4px"},ko="1em",ll=n.memo(a=>{const{disabled:i,snippet:o,description:t,handleInsert:r,sx:s,...d}=a;let p;const l=o.metadata?.icon;return p=l==="formula"?e.jsx(w.DynamicIcon,{iconKey:"ScriptFormula",size:ko,style:wo}):l==="macro"?e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro",size:ko,style:wo}):e.jsx(w.DynamicIcon,{iconKey:"ScriptAutoStart",size:ko,style:wo}),e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"460px",display:"flex","*":{lineHeight:"1.2"},...s},disabled:i,icon:p,onMouseDown:c=>{c.button===0&&c.preventDefault()},onMouseUp:c=>{c.button===0&&r(o)},onKeyDown:c=>{c.keyCode!==w.KeyCodes.Enter&&c.keyCode!==w.KeyCodes.Space||r(o)},...d,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsx(B.Typography,{component:"div",children:o.metadata?.title??o.path}),e.jsx(B.Typography,{variant:"caption",component:"div",sx:{color:c=>Re.alpha(c.palette.text.secondary??c.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:o.metadata?.summary})]})})}),sl=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,scriptPath:d=fr,...p}=a,[l,c]=n.useState([]),[g,C]=n.useState(!0),f=w.useCommands(o,["executeSelectedScript"]),u=f[0]?.context?.();n.useEffect(()=>{(async()=>{try{const b=await hr(d);c(b)}catch{}finally{C(!1)}})()},[d]);const m=n.useCallback((b,S)=>{if(g)return e.jsx("div",{children:"Loading..."});const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:s},h=v=>{u.getEditor()?.insertSnippet(v.content),b.closeFloat()},k=[];for(let v=0;v<l.length;v++){const T=l[v];T&&k.push(e.jsx(ll,{handleInsert:h,snippet:T},T.path))}const j=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[k.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:k}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...x,key:"help",command:o.getCommand("help")})]});return y.defaultCreatePopupPanel({...b,children:j})},[s,t,r,g,u]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Insert Script",tooltip:"Inserts a script from a set of templates.",createPopupPanel:m,icon:"ScriptInsert",...p})})),gr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(p=>{const{commandButtonProps:l,commandPopupProps:c}=p;return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flex:"1 1 100%"},children:[e.jsx("div",{children:e.jsx(Nt,{parentFloat:t,style:{},children:e.jsx(y.CommandButton,{...l,command:o?.getCommand("saveScripts")})})}),e.jsx("div",{style:{flex:"1 1 100%"}}),e.jsx("div",{children:e.jsx(Nt,{parentFloat:t,style:{},children:e.jsx(sl,{...l,commands:o})})})]})})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));gr.displayName="ScriptEditorToolbar";const xr=n.memo(n.forwardRef((a,i)=>{const{scriptPath:o=fr,onScriptSelect:t,sx:r=w.ReactUtils.EmptyCssProperties,className:s,buttonMinWidth:d=210,buttonMinHeight:p=80,gap:l=12,...c}=a,[g,C]=n.useState([]),[f,u]=n.useState(!0),[m,b]=n.useState(null);if(n.useEffect(()=>{(async()=>{const h=[{path:null,metadata:{title:"Blank Template...",summary:"Start with an empty script."},content:""}];try{u(!0),b(null);const k=await hr(o);for(let j=0;j<k.length;j++){const v=k[j];v&&h.push(v)}}catch(k){b(k instanceof Error?k.message:"Failed to load scripts"),k instanceof je.ChainedError||console.error("Error loading scripts:",k)}finally{C(h),u(!1)}})()},[o]),f)return e.jsx(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:ie(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,...r},...c,children:e.jsx(B.CircularProgress,{})});let S=null;m&&(S=e.jsxs(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:ie(s,"script-select","error-results"),sx:{background:h=>h.palette.error.light,flex:"0",zIndex:1e3,flexDirection:"column",padding:h=>h.spacing(1),border:h=>`1px solid ${h.palette.error.main}`,borderBottomLeftRadius:1,borderBottomRightRadius:1,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},...c,children:[e.jsx(B.Typography,{color:"error",variant:"h6",component:"div",gutterBottom:!0,children:"Error loading Templates"}),e.jsx(B.Typography,{color:"error",component:"div",children:m})]}));const x=h=>{const k=h.metadata?.icon;return k==="macro"?e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro",size:"1em"}):k==="formula"?e.jsx(w.DynamicIcon,{iconKey:"ScriptFormula",size:"1em"}):k==="autostart"?e.jsx(w.DynamicIcon,{iconKey:"ScriptAutoStart",size:"1em"}):null};return e.jsxs(B.Box,{ref:i,className:ie(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,...r},...c,children:[e.jsxs(B.Box,{p:3,className:"script-select-content",sx:{overflow:"auto",flex:"1 1 auto"},children:[e.jsx(B.Typography,{variant:"h6",gutterBottom:!0,children:"Script Template"}),e.jsx(B.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(B.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Templates provide a foundation to customize and meet your specific needs."}),e.jsx(B.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${d}px, 1fr))`,gap:`${l}px`,padding:2,paddingLeft:"0px",paddingRight:"0px"},children:g.map((h,k)=>e.jsxs(B.Button,{variant:"outlined",sx:{minWidth:d,minHeight:p,display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",textAlign:"left",padding:2,textTransform:"none",overflow:"hidden",...k===0&&{borderStyle:"dashed",marginBottom:"8px"},...k===1&&{gridColumn:"1"}},onClick:()=>t?.(h),children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:.5},children:[e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:h.metadata?.title||h.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),x(h)]}),h.metadata?.summary&&e.jsx(B.Typography,{variant:"body2",component:"div",color:"text.secondary",sx:{overflow:"hidden",display:"flex",flexDirection:"column",textOverflow:"ellipsis",alignItems:"flex-start"},children:h.metadata.summary})]},`${h.path}-${k}`))})]}),S]})}));xr.displayName="TemplateSelectPanel";const br=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,editorProps:r,commands:s,readOnly:d=!1,frame:p,autoFocusSel:l,autoFocus:c=!0,scripts:g,...C}=a,f=q.useTheme(),[u,m]=n.useState(!1),b=n.useRef(!1),[S,x]=n.useState({message:"Loading",cursor:"",dirty:!1}),[h,k]=n.useState(null);n.useEffect(()=>{let H=!1;return k(null),(async function(){if(g&&(await g.start(),!H)){const I=g.getModules().getItems()[0]?.getSource();k({source:I||null})}})(),()=>{H=!0}},[g]);const j=n.useCallback(H=>{x(I=>({...I,...H}))},[]),v=n.useRef(null),[T,M]=n.useState(null),P=n.useRef(null),D=w.useCallbackRef(H=>{if(T)return T.focus(H),!0;if(l){const I=v.current?.querySelectorAll?.(l);if(I&&I.length>0)return I[0]?.focus?.(H),!0}return v.current?.focus?.(H),!1},[T,l,c]),F=n.useMemo(()=>e.jsx(y.LoadingPanel,{transitionDelay:"160ms",style:{position:"absolute",width:"100%",height:"100%"},transparentBackground:!1}),[]),E=n.useMemo(()=>e.jsx(B.Paper,{elevation:1,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,marginLeft:H=>H.spacing(.5),marginRight:H=>H.spacing(.5),marginTop:H=>H.spacing(1),marginBottom:H=>H.spacing(1)},children:e.jsx(gr,{commands:s})}),[f,s]),R=n.useMemo(()=>e.jsx(B.Box,{className:ie("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 ${f.palette.divider}`},children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"center",flexDirection:"row",justifyContent:"center"},children:[e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"1 1 100%",color:H=>H.palette.text.secondary},variant:"caption",children:S.message}),e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",color:H=>H.palette.text.secondary},variant:"caption",children:S.dirty?"Unsaved":""}),e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",marginLeft:"8px",minWidth:"90px",display:"flex",justifyContent:"end",color:H=>H.palette.text.secondary},variant:"caption",children:S.cursor})]})}),[S]),N=n.useMemo(()=>e.jsxs(B.Box,{className:ie("script-editor-content"),sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"column",boxSizing:"border-box"},children:[E,e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"row",position:"relative",boxSizing:"border-box"},children:e.jsx(oe.ScriptEditor,{ref:v,loadingPanel:F,readOnly:d,frame:p,autoFocus:c,commands:s,onStatusChange:j,darkMode:f.palette.mode==="dark",...r})}),R]}),[f,s,E,R,u,F,d,r,c,l,p,j]),z=n.useMemo(()=>{let H;return h===null?null:(h.source===null&&(H=e.jsx(xr,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:I=>{v.current?.getEditor()?.insertSnippet(I.content),k({source:I.content??""})}})),e.jsx(B.Box,{tabIndex:0,className:ie("script-workspace",o),sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",alignItems:"stretch",userSelect:"none",flexGrow:0,outline:"none"},onPointerDown:I=>{I.isDefaultPrevented()||v.current?.focus()},children:e.jsxs(B.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[N,H]})}))},[E,N,o,h]),O=w.useImperativeElement(i,()=>({isScriptWorkspaceElement:()=>!0,focus:H=>{D(H)}}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",...t},ref:O,...C,onFocus:H=>{m(!0),b.current=!0,O.current?.contains(H.target)&&H.target!==O.current&&M(H.target),H.relatedTarget&&!P.current&&(P.current=H.relatedTarget),C?.onFocus?.(H)},onBlur:H=>{O?.current?.contains(H.relatedTarget)||O?.current===H.relatedTarget||(P.current=null,b.current=!1,m(!1)),C?.onBlur?.(H)},children:z})}));br.displayName="ScriptWorkspace";const cl=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...d}=a;return e.jsx(br,{ref:i,readOnly:!1,commands:t,frame:s,scripts:o?.getScripts(),...d})},yr=n.memo(n.forwardRef((a,i)=>{const{commands:o,...t}=a,r=w.useCommands(o,["executeScript","showScriptEditor"]),[s,d]=n.useState([]),[p,l]=n.useState(!1),c=r[0]?.context?.();n.useEffect(()=>{const m=c?.getScripts();m&&(async()=>{l(!0);const b=await m.searchFunctions({type:"macro"});d(b),l(!1)})()},[]);const g={variant:w.CommandButtonType.Menuitem,parentFloat:a.floatReference,scope:"scripts",shortcut:null},C=[],f=s.length;for(let m=0;m<f;m++){const b=s[m];C.push(e.jsx(y.CommandButton,{...g,command:o.getCommand("executeScript"),commandState:{declaration:b},tooltipProps:{description:`Execute ${b.getName()??"macro"}`},icon:e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro"}),label:b.getName()??`Script '${b.getName()}'`},`macro-${b.getName()}-${m}`))}const u=e.jsxs(B.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[C.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:C}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...g,key:"show-editor",command:o.getCommand("showScriptEditor")})]});return y.defaultCreatePopupPanel({...t,children:u})}));yr.displayName="RunScriptPopupPanel";const Cr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p="showScriptEditor",l=w.useCommands(o,["executeScript","showScriptEditor"])[0].context(),c=n.useCallback((g,C)=>{const f=e.jsx(yr,{...g,commands:C});return y.defaultCreatePopupPanel({...g,children:f})},[s,l,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:c,selected:o.getCommand(p).state(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:p,...d})})),dl=a=>e.jsx(y.CommandButton,{...a}),Sr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,[d,p]=n.useState(!1),l=w.useCommands(o,["executeScript","showScriptEditor"]),c=l[0]?.context?.();n.useEffect(()=>{const f=c?.getScripts();if(!f)return;const u=l[1],m=async()=>{if(!u)return;let x=!1;if(!u.state()){const h=await f.searchFunctions({type:"macro"}),k=h?.length??0;for(let j=0;h&&!x&&j<k;j++)x=!0}p(x||!!u.state())};m();const b=u.addPropertyListener(()=>{m()}),S=f.addListeners({onChange:()=>{m()}});return()=>{S(),b()}},[c]);const g=oe.useTaskPaneArea(),C=n.useCallback(f=>{const{commandButtonProps:u,commandPopupProps:m}=f,b=oe.DefaultTaskPaneRegistry.findContributions("ribbon/home");let S;const x=b.length;if(x>0){S=[];for(let M=0;M<x;M++){const P=b[M],D=P.createCommand?.(g);if(!D)continue;const F={command:D,...m},E=(P.createCommandButton??dl)(F);S.push(E)}}const h=e.jsx(ft,{...m,command:o.getCommand("formatFontColor"),isSplit:!0,panelProps:{disableAlpha:!0}}),k=e.jsx(ft,{...m,command:o.getCommand("formatFillColor"),isSplit:!0,panelProps:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:mt.End}}),j=o.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx(Vo,{...m,quickCommand:"undo"})}):null,v=o.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Oa,{...m})}):null;let T=null;return d&&(T=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{}),e.jsx(Cr,{...m})]})),e.jsxs(Nt,{parentFloat:t,children:[j,null,j?e.jsx(y.ExhibitDivider,{}):null,e.jsx(_o,{...m,command:o.getCommand("paste")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("formatPainterToggle")}),e.jsx(so,{...u,command:o.getCommand("copy")}),e.jsx(y.ExhibitDivider,{}),e.jsx($a,{...m,command:o.getCommand("formatFontFamily")}),e.jsx(Aa,{...m,command:o.getCommand("formatFontSize")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("formatBoldToggle")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("formatItalicToggle")}),e.jsx(_a,{...m}),e.jsx(Va,{...m}),e.jsx(Fa,{...m}),k,h,e.jsx(y.ExhibitDivider,{}),e.jsx(va,{...m}),e.jsx(ja,{...m}),e.jsx(Ea,{...m}),e.jsx(Ta,{...m}),e.jsx(Ia,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(La,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ga,{command:o.getCommand("formatCellStyle"),...m}),e.jsx(cn,{command:o.getCommand("formatTableStyle"),...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(zo,{...m}),e.jsx(Ho,{...m}),e.jsx(Wo,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(un,{...m}),e.jsx(za,{...m}),e.jsx(Lo,{...m}),e.jsx($o,{...m}),v,T,S]})},[o,l,d,g]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:C,...s})}));Sr.displayName="HomeToolbar";const wr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(p=>{const{commandButtonProps:l,commandPopupProps:c}=p;return e.jsxs(Nt,{parentFloat:t,children:[e.jsx(y.CommandButton,{...l,command:o.getCommand("insertTable")}),e.jsx(dn,{...c}),null,e.jsx(y.CommandButton,{...l,command:o.getCommand("updateHyperlink")}),e.jsx(y.CommandButton,{...l,command:o.getCommand("updateComments")})]})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));wr.displayName="InsertToolbar";const kr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(p=>{const{commandButtonProps:l,commandPopupProps:c}=p;return e.jsxs(Nt,{parentFloat:t,children:[e.jsx(Na,{...c}),e.jsx(y.CommandButton,{...l,command:o.getCommand("protectionSheetToggle")}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ha,{...c}),e.jsx(Ka,{...c}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...l,command:o.getCommand("sheetViewToggleFormulaView"),scope:"view"}),e.jsx(y.CommandButton,{...l,command:o.getCommand("sheetViewToggleShowZeros"),scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ua,{...c}),e.jsx(Dr,{command:o.getCommand("selectTheme"),...c}),e.jsx(y.ExhibitDivider,{}),e.jsx(Cr,{...c,scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...l,command:o.getCommand("fullScreenToggle"),scope:"view"})]})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));kr.displayName="ViewToolbar";const vr=a=>e.jsx(jr,{...a}),ul=n.memo(a=>{const{sx:i,...o}=a;return e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",position:"relative","&:hover:not([disabled]) .indicator":{borderBottom:t=>`${q.alpha(t.palette.primary.main,.35)} solid 2px`}},children:[e.jsx(B.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":{},...i},...o}),e.jsx(B.Box,{className:"indicator",sx:{width:"90%",borderRadius:"4px",minWidth:"4px",position:"absolute",bottom:"0",alignSelf:"center",display:"flex"}})]})}),ml=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,sx:r,...s}=a,d=n.useMemo(()=>{const p=[];for(let l=0;l<i.length;l++)p.push(e.jsx(ul,{label:i[l].label},i[l].label));return p},[i]);return e.jsx(B.Tabs,{value:o,onChange:(p,l)=>{t?.(l)},variant:"scrollable",scrollButtons:!1,sx:{paddingLeft:p=>p.spacing(1.5),paddingRight:p=>p.spacing(1.5),paddingTop:p=>p.spacing(0),paddingBottom:p=>p.spacing(0),minHeight:"26px",alignItems:"center","& .MuiTabs-indicator":{display:"flex",justifyContent:"center",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{width:"90%",borderRadius:"4px",minWidth:"4px",backgroundColor:p=>p.palette.primary.main},"& .MuiTab-root":{marginRight:"0px"},...r},slotProps:{indicator:{children:e.jsx("span",{className:"MuiTabs-indicatorSpan"})}},...s,children:d})}),pl=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,selectProps:r,...s}=a,d=n.useCallback(l=>{t?.(l.target.value)},[t]),p=n.useMemo(()=>{const l=[];for(let c=0;c<i.length;c++){const g=i[c].label;l.push(e.jsx(B.MenuItem,{value:c,sx:{color:C=>{if(o===c)return C.palette.primary.main}},children:g},g))}return l},[i,o]);return e.jsx(B.FormControl,{sx:{minWidth:"125px",maxWidth:"125px","& .MuiInputBase-root":{paddingLeft:"0px",paddingRight:"0px"},"& .MuiSelect-select":{paddingTop:l=>l.spacing(.5),paddingBottom:l=>l.spacing(.5),paddingLeft:l=>l.spacing(2),color:l=>l.palette.primary.main},"& .MuiSelect-icon":{fill:l=>l.palette.text.icon??l.palette.action.active,"&:hover:not(.Mui-disabled)":{color:l=>l.palette.text.icon??l.palette.action.active}},...r},size:"small",children:e.jsx(B.Select,{value:o,onChange:d,variant:"outlined",sx:{backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},...s,children:p})})}),jr=n.memo(n.forwardRef((a,i)=>{const{commands:o,selectWrapper:t,selectProps:r={},renderCompact:s=!1,paletteWrapper:d,toolbarsProps:p,paletteProps:l={},workbook:c,sx:g,...C}=a,f=n.useMemo(()=>{const v=[],{ref:T,...M}=p?.Home||{};v.push({label:"Home",component:e.jsx(Sr,{commands:o,...M})});const{ref:P,...D}=p?.Insert||{};v.push({label:"Insert",component:e.jsx(wr,{commands:o,...D})});const{ref:F,...E}=p?.View||{};return v.push({label:"View",component:e.jsx(kr,{commands:o,...E})}),v},[o,c]),u=n.useMemo(()=>{const v=[];for(let T=0;T<f.length;T++)v.push(n.cloneElement(f[T].component,{...f[T].component.props,key:f[T].key??f[T].label}));return v},[f]),[m,b]=n.useState(0),S=v=>{b(v)},x=n.useMemo(()=>s?e.jsx(pl,{toolbars:f,value:m,onToolbarChange:S,sx:r}):e.jsx(ml,{toolbars:f,value:m,onToolbarChange:S,sx:r}),[f,m,r,s]),{sx:h,...k}=l,j=e.jsx(B.Paper,{elevation:2,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,borderRadius:"8px",backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,marginLeft:v=>v.spacing(1),marginRight:v=>v.spacing(1),marginTop:v=>v.spacing(.5),marginBottom:v=>v.spacing(.5),...h},...k,children:u[m]});return e.jsxs(B.Box,{ref:i,className:"toolbarWrappers",sx:{display:"flex",flexDirection:"column",paddingTop:v=>v.spacing(.5),"*":{userSelect:"none"},...g},...C,children:[t?t(x):x,d?d(j):j]})}));var ta,oa;jr.displayName="WorkbookToolbars",(function(){if(oa)return ta;oa=1;var a=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,t=/^0o[0-7]+$/i,r=parseInt,s=typeof dt=="object"&&dt&&dt.Object===Object&&dt,d=typeof self=="object"&&self&&self.Object===Object&&self,p=s||d||Function("return this")(),l=Object.prototype.toString,c=Math.max,g=Math.min,C=function(){return p.Date.now()};function f(m){var b=typeof m;return!!m&&(b=="object"||b=="function")}function u(m){if(typeof m=="number")return m;if((function(x){return typeof x=="symbol"||(function(h){return!!h&&typeof h=="object"})(x)&&l.call(x)=="[object Symbol]"})(m))return NaN;if(f(m)){var b=typeof m.valueOf=="function"?m.valueOf():m;m=f(b)?b+"":b}if(typeof m!="string")return m===0?m:+m;m=m.replace(a,"");var S=o.test(m);return S||t.test(m)?r(m.slice(2),S?2:8):i.test(m)?NaN:+m}ta=function(m,b,S){var x,h,k,j,v,T,M=0,P=!1,D=!1,F=!0;if(typeof m!="function")throw new TypeError("Expected a function");function E(H){var I=x,W=h;return x=h=void 0,M=H,j=m.apply(W,I)}function R(H){var I=H-T;return T===void 0||I>=b||I<0||D&&H-M>=k}function N(){var H=C();if(R(H))return z(H);v=setTimeout(N,(function(I){var W=b-(I-T);return D?g(W,k-(I-M)):W})(H))}function z(H){return v=void 0,F&&x?E(H):(x=h=void 0,j)}function O(){var H=C(),I=R(H);if(x=arguments,h=this,T=H,I){if(v===void 0)return(function(W){return M=W,v=setTimeout(N,b),P?E(W):j})(T);if(D)return v=setTimeout(N,b),E(T)}return v===void 0&&(v=setTimeout(N,b)),j}return b=u(b)||0,f(S)&&(P=!!S.leading,k=(D="maxWait"in S)?c(u(S.maxWait)||0,b):k,F="trailing"in S?!!S.trailing:F),O.cancel=function(){v!==void 0&&clearTimeout(v),M=0,x=T=h=v=void 0},O.flush=function(){return v===void 0?j:z(C())},O}})();var na,aa,ra={exports:{}},vo={};aa||(aa=1,ra.exports=(function(){if(na)return vo;na=1;var a=n,i=typeof Object.is=="function"?Object.is:function(l,c){return l===c&&(l!==0||1/l==1/c)||l!=l&&c!=c},o=a.useState,t=a.useEffect,r=a.useLayoutEffect,s=a.useDebugValue;function d(l){var c=l.getSnapshot;l=l.value;try{var g=c();return!i(l,g)}catch{return!0}}var p=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,c){return c()}:function(l,c){var g=c(),C=o({inst:{value:g,getSnapshot:c}}),f=C[0].inst,u=C[1];return r(function(){f.value=g,f.getSnapshot=c,d(f)&&u({inst:f})},[l,g,c]),t(function(){return d(f)&&u({inst:f}),l(function(){d(f)&&u({inst:f})})},[l]),s(g),g};return vo.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:p,vo})()),ra.exports;var ia,la,Et={exports:{}},st={exports:{}},fl=st.exports;(function(){if(la)return Et.exports;la=1;for(var a=(ia||(ia=1,function(){var C,f,u,m,b,S;typeof performance<"u"&&performance!==null&&performance.now?st.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(st.exports=function(){return(C()-b)/1e6},f=process.hrtime,m=(C=function(){var x;return 1e9*(x=f())[0]+x[1]})(),S=1e9*process.uptime(),b=m-S):Date.now?(st.exports=function(){return Date.now()-u},u=Date.now()):(st.exports=function(){return new Date().getTime()-u},u=new Date().getTime())}.call(fl)),st.exports),i=typeof window>"u"?dt:window,o=["moz","webkit"],t="AnimationFrame",r=i["request"+t],s=i["cancel"+t]||i["cancelRequest"+t],d=0;!r&&d<o.length;d++)r=i[o[d]+"Request"+t],s=i[o[d]+"Cancel"+t]||i[o[d]+"CancelRequest"+t];if(!r||!s){var p=0,l=0,c=[],g=1e3/60;r=function(C){if(c.length===0){var f=a(),u=Math.max(0,g-(f-p));p=u+f,setTimeout(function(){var m=c.slice(0);c.length=0;for(var b=0;b<m.length;b++)if(!m[b].cancelled)try{m[b].callback(p)}catch(S){setTimeout(function(){throw S},0)}},Math.round(u))}return c.push({handle:++l,callback:C,cancelled:!1}),l},s=function(C){for(var f=0;f<c.length;f++)c[f].handle===C&&(c[f].cancelled=!0)}}Et.exports=function(C){return r.call(i,C)},Et.exports.cancel=function(){s.apply(i,arguments)},Et.exports.polyfill=function(C){C||(C=i),C.requestAnimationFrame=r,C.cancelAnimationFrame=s},Et.exports})();var Ie={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 a=document;return"exitFullscreen"in a?["fullscreenchange","fullscreenerror"]:"webkitExitFullscreen"in a||"webkitCancelFullScreen"in a?["webkitfullscreenchange","webkitfullscreenerror"]:"mozCancelFullScreen"in a?["mozfullscreenchange","mozfullscreenerror"]:"msExitFullscreen"in a?["MSFullscreenChange","MSFullscreenError"]:null},getEventName(a){const i=this.getEventsNames();return i?a==="change"?i[0]:i[1]:null},get fullscreenEnabled(){if(typeof document>"u")return!1;const a=document;return a.fullscreenEnabled||a.webkitFullscreenEnabled||!!a.webkitCancelFullScreen||a.mozFullScreenEnabled||a.msFullscreenEnabled||!1},get fullscreenElement(){if(typeof document>"u")return null;const a=document;return a.fullscreenElement||a.webkitFullscreenElement||a.webkitCurrentFullScreenElement||a.mozFullScreenElement||a.msFullscreenElement||null},requestFullscreen(a,i){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const o=a??document.documentElement,t=o.requestFullscreen||o.webkitRequestFullscreen||o.webkitRequestFullScreen||o.mozRequestFullScreen||o.msRequestFullscreen;if(!t)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return t.call(o,i)},exitFullscreen(){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const a=document,i=a.exitFullscreen||a.webkitExitFullscreen||a.webkitCancelFullScreen||a.mozCancelFullScreen||a.msExitFullscreen;if(!i)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return i.call(a)},on(a,i){const o=this.getEventName(a);o&&document.addEventListener(o,i)},off(a,i){const o=this.getEventName(a);o&&document.removeEventListener(o,i)}};const Tr=a=>{const{workbook:i,workbookElement:o,target:t,commands:r,darkMode:s,onNewWorkbook:d=Er}=a,p=w.useNotifier(),[l,c]=n.useState(i?.getSelectedSheet()),[g,C]=n.useState(i?.getSheets().getItems()),f=w.useCallbackRef(d,[d]),u=oe.useTaskPaneArea(),m=n.useMemo(()=>[new w.SimpleCommand("activateTask",t,{label:"Activate Task",description:"Activate Task Pane.",shortcut:{key:"F6"}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("showFormat",t,{label:"Show Format",description:"Open the format pane.",shortcut:{key:"F",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.Command("newCellStyle",t,{label:"New Cell Style…",scopedLabels:{cellStyle:"New Cell Style"},description:"Create a new named style can can be quickly used later.",icon:"NewPresetStyles"}),new w.Command("deleteCellStyle",t,{label:"Delete Cell Style",scopedLabels:{cellStyle:"Delete"},description:"Remove a named style that is no longer needed."}),new w.Command("modifyCellStyle",t,{label:"Modify Cell Style",scopedLabels:{cellStyle:"Modify"},description:"Update a style with the currently style."}),new w.SimpleCommand("find",t,{label:"Find",description:"Open the Find window.",icon:"Find",shortcut:[{key:"F",modifiers:[w.KeyModifiers.Ctrl]},{key:"F5",modifiers:[w.KeyModifiers.Shift]}]}),new w.SimpleCommand("findReplace",t,{label:"Find & Replace",description:"Open the Find & Replace window.",icon:"FindReplace",shortcut:[{key:"H",modifiers:[w.KeyModifiers.Ctrl]},{key:"H",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Alt]}]}),new w.SimpleCommand("goto",t,{label:"Go To",description:"Open the 'Go To' window.",icon:"GoTo",shortcut:[{key:"G",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.SimpleCommand("workbookViewToggleExpandFormulaBar",t,{label:"Toggle Expand Formula bar",description:"Expand or collapse the formula bar.",shortcut:{key:"U",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookViewToggleShowFormulaBar",t,{label:"View Formula bar",scopedLabels:{view:"Formula Bar"},description:"Show or hide the formula bar."}),new w.SimpleCommand("workbookViewToggleShowTabs",t,{label:"View Sheet Tabs",description:"Show or hide the sheet tabs.",scopedLabels:{view:"Sheet Tabs"}}),new w.SimpleCommand("workbookViewToggleShowStatusBar",t,{label:"View Status Bar",description:"Show or hide the status bar.",scopedLabels:{view:"Status Bar"}}),new w.SimpleCommand("workbookViewToggleShowHorizontalScrollBar",t,{label:"View Horizontal Scrollbar",description:"Show or hide the horizontal scrollbar.",scopedLabels:{view:"Horizontal Scrollbar"}}),new w.SimpleCommand("workbookViewToggleShowVerticalScrollBar",t,{label:"View Vertical Scrollbar",description:"Show or hide the vertical scrollbar.",scopedLabels:{view:"Vertical Scrollbar"}}),new w.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.",icon:"VisibilityOff"}),new w.Command("deleteSheet",t,{label:"Delete Sheet",scopedLabels:{sheet:"Delete"},description:"Delete the sheet and all the data."}),new w.Command("addSheet",t,{label:"Insert Sheet",scopedLabels:{sheet:"Insert"},description:"Insert sheet before the current sheet.",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Shift]},{key:"F1",modifiers:[w.KeyModifiers.Alt,w.KeyModifiers.Shift]}]}),new w.Command("duplicateSheet",t,{label:"Duplicate Sheet",description:"Duplicate the current sheet.",scopedLabels:{sheet:"Duplicate"}}),new w.Command("nextSheet",t,{label:"Next Sheet",scopedLabels:{sheet:"Next"},description:"Activate the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("previousSheet",t,{label:"Previous Sheet",scopedLabels:{sheet:"Previous"},description:"Activate the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("selectNextSheet",t,{label:"Select Next Sheet",scopedLabels:{sheet:"Select Next"},description:"Select the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectPreviousSheet",t,{label:"Select Previous Sheet",scopedLabels:{sheet:"Select Previous"},description:"Select the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectTheme",t,{label:"Theme",description:"Select a theme that coveys a style suitable for your data."}),new w.Command("selectNamed",t,{label:E=>E?.getName()??"Select Named Item",scopedLabels:{namedItem:E=>E?.getName()??"Select"},description:"Select the item."}),new w.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.",icon:"InsertNamedRange"}),new w.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.",icon:"NamedRangeEdit"}),new w.Command("deleteNamedReference",t,{label:"Delete Named Reference",scopedLabels:{namedItem:"Delete"},description:"Remove the named reference.",icon:"DeleteNamedRange"}),new w.SimpleCommand("activeNameBox",t,{label:"Activate Name Box",description:"Move the focus to the name box.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Alt]}}),new w.SimpleCommand("createNamedReferenceFromSelection",t,{label:"Create from Selection",description:"Automatically generate names from the selected cells.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("activeNameManager",t,{label:"Activate Name Manager",description:`Create, edit, delete, and find all the names used in the workbook.
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;"),Ut=!0;const o=document.getElementById("openEditorLink");o&&o.addEventListener("click",t=>{t.preventDefault(),console.log("openScriptEditor called from console")})})())}catch(o){o instanceof DOMException||console.error(o)}}};function oo(){return oo=Object.assign?Object.assign.bind():function(a){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var t in o)({}).hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},oo.apply(null,arguments)}function nn(a,i){if(a==null)return{};var o={};for(var t in a)if({}.hasOwnProperty.call(a,t)){if(i.indexOf(t)!==-1)continue;o[t]=a[t]}return o}function no(a,i){return no=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,t){return o.__proto__=t,o},no(a,i)}function ur(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,no(a,i)}function Jn(a,i){return a.replace(new RegExp("(^|\\s)"+i+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const ea=!1,mr=n.createContext(null);var pr=function(a){return a.scrollTop},Ft="unmounted",Ye="exited",Ze="entering",st="entered",Do="exiting",ze=(function(a){function i(t,r){var s;s=a.call(this,t,r)||this;var d,p=r&&!r.isMounting?t.enter:t.appear;return s.appearStatus=null,t.in?p?(d=Ye,s.appearStatus=Ze):d=st:d=t.unmountOnExit||t.mountOnEnter?Ft:Ye,s.state={status:d},s.nextCallback=null,s}ur(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Ft?{status:Ye}:null};var o=i.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==Ze&&s!==st&&(r=Ze):s!==Ze&&s!==st||(r=Do)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t,r,s,d=this.props.timeout;return t=r=s=d,d!=null&&typeof d!="number"&&(t=d.exit,r=d.enter,s=d.appear!==void 0?d.appear:r),{exit:t,enter:r,appear:s}},o.updateStatus=function(t,r){if(t===void 0&&(t=!1),r!==null)if(this.cancelNextCallback(),r===Ze){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:et.findDOMNode(this);s&&pr(s)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ye&&this.setState({status:Ft})},o.performEnter=function(t){var r=this,s=this.props.enter,d=this.context?this.context.isMounting:t,p=this.props.nodeRef?[d]:[et.findDOMNode(this),d],l=p[0],c=p[1],g=this.getTimeouts(),C=d?g.appear:g.enter;!t&&!s||ea?this.safeSetState({status:st},function(){r.props.onEntered(l)}):(this.props.onEnter(l,c),this.safeSetState({status:Ze},function(){r.props.onEntering(l,c),r.onTransitionEnd(C,function(){r.safeSetState({status:st},function(){r.props.onEntered(l,c)})})}))},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts(),d=this.props.nodeRef?void 0:et.findDOMNode(this);r&&!ea?(this.props.onExit(d),this.safeSetState({status:Do},function(){t.props.onExiting(d),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:Ye},function(){t.props.onExited(d)})})})):this.safeSetState({status:Ye},function(){t.props.onExited(d)})},o.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(d){s&&(s=!1,r.nextCallback=null,t(d))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=this.props.nodeRef?this.props.nodeRef.current:et.findDOMNode(this),d=t==null&&!this.props.addEndListener;if(s&&!d){if(this.props.addEndListener){var p=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],l=p[0],c=p[1];this.props.addEndListener(l,c)}t!=null&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Ft)return null;var r=this.props,s=r.children;r.in,r.mountOnEnter,r.unmountOnExit,r.appear,r.enter,r.exit,r.timeout,r.addEndListener,r.onEnter,r.onEntering,r.onEntered,r.onExit,r.onExiting,r.onExited,r.nodeRef;var d=nn(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return n.createElement(mr.Provider,{value:null},typeof s=="function"?s(t,d):n.cloneElement(n.Children.only(s),d))},i})(n.Component);function at(){}ze.contextType=mr,ze.propTypes={},ze.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:at,onEntering:at,onEntered:at,onExit:at,onExiting:at,onExited:at},ze.UNMOUNTED=Ft,ze.EXITED=Ye,ze.ENTERING=Ze,ze.ENTERED=st,ze.EXITING=Do;var Co=function(a,i){return a&&i&&i.split(" ").forEach(function(o){return r=o,void((t=a).classList?t.classList.remove(r):typeof t.className=="string"?t.className=Jn(t.className,r):t.setAttribute("class",Jn(t.className&&t.className.baseVal||"",r)));var t,r})},Fo=(function(a){function i(){for(var t,r=arguments.length,s=new Array(r),d=0;d<r;d++)s[d]=arguments[d];return(t=a.call.apply(a,[this].concat(s))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(p,l){var c=t.resolveArguments(p,l),g=c[0],C=c[1];t.removeClasses(g,"exit"),t.addClass(g,C?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(p,l)},t.onEntering=function(p,l){var c=t.resolveArguments(p,l),g=c[0],C=c[1]?"appear":"enter";t.addClass(g,C,"active"),t.props.onEntering&&t.props.onEntering(p,l)},t.onEntered=function(p,l){var c=t.resolveArguments(p,l),g=c[0],C=c[1]?"appear":"enter";t.removeClasses(g,C),t.addClass(g,C,"done"),t.props.onEntered&&t.props.onEntered(p,l)},t.onExit=function(p){var l=t.resolveArguments(p)[0];t.removeClasses(l,"appear"),t.removeClasses(l,"enter"),t.addClass(l,"exit","base"),t.props.onExit&&t.props.onExit(p)},t.onExiting=function(p){var l=t.resolveArguments(p)[0];t.addClass(l,"exit","active"),t.props.onExiting&&t.props.onExiting(p)},t.onExited=function(p){var l=t.resolveArguments(p)[0];t.removeClasses(l,"exit"),t.addClass(l,"exit","done"),t.props.onExited&&t.props.onExited(p)},t.resolveArguments=function(p,l){return t.props.nodeRef?[t.props.nodeRef.current,p]:[p,l]},t.getClassNames=function(p){var l=t.props.classNames,c=typeof l=="string",g=c?(c&&l?l+"-":"")+p:l[p];return{baseClassName:g,activeClassName:c?g+"-active":l[p+"Active"],doneClassName:c?g+"-done":l[p+"Done"]}},t}ur(i,a);var o=i.prototype;return o.addClass=function(t,r,s){var d=this.getClassNames(r)[s+"ClassName"],p=this.getClassNames("enter").doneClassName;r==="appear"&&s==="done"&&p&&(d+=" "+p),s==="active"&&t&&pr(t),d&&(this.appliedClasses[r][s]=d,(function(l,c){l&&c&&c.split(" ").forEach(function(g){return f=g,void((C=l).classList?C.classList.add(f):(function(u,m){return u.classList?!!m&&u.classList.contains(m):(" "+(u.className.baseVal||u.className)+" ").indexOf(" "+m+" ")!==-1})(C,f)||(typeof C.className=="string"?C.className=C.className+" "+f:C.setAttribute("class",(C.className&&C.className.baseVal||"")+" "+f)));var C,f})})(t,d))},o.removeClasses=function(t,r){var s=this.appliedClasses[r],d=s.base,p=s.active,l=s.done;this.appliedClasses[r]={},d&&Co(t,d),p&&Co(t,p),l&&Co(t,l)},o.render=function(){var t=this.props;t.classNames;var r=nn(t,["classNames"]);return n.createElement(ze,oo({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},i})(n.Component);Fo.defaultProps={classNames:""},Fo.propTypes={};const So=.12,Io=(a,i)=>{const o={},t=l=>{const c=l.palette?.background.default??"rgba(255,255,255,1)";return{text:{fontFamily:l.typography?.fontFamily??"Calibri",fontSize:l.typography?.fontSize??8.25,fontWeight:l.typography?.fontWeightRegular??"400",fill:l.palette.mode==="dark"?l.palette?.text?.secondary:l.palette?.text?.primary},fill:c,strokeFill:y.elevateColor(c,So,l.palette?.mode),darkMode:l.palette.mode==="dark"}},r=t(i);o.body=t(a),o.header={...o.body,strokeFill:y.elevateColor(o.body.fill,So,a.palette?.mode),fill:i&&a.palette.mode==="dark"&&i.palette.mode!==a.palette.mode?o.body.fill:y.elevateColor(o.body.fill,.055,a.palette?.mode),edgeStrokeFill:a.palette.mode==="dark"?o.body.strokeFill:y.elevateColor(o.body.fill,.328,a.palette?.mode)},o.headerHover=l=>({...o.header,strokeFill:y.elevateColor(l?.fill??o.body.fill,.22,a.palette?.mode),fill:y.elevateColor(l?.fill??o.header.fill,.065,a.palette?.mode),text:{...l?.text,fontWeight:a.typography?.fontWeightBold}});const s=y.elevateColor(a.palette.mode!=="dark"?a.palette.primary.light:a.palette.primary.main,.055,a.palette?.mode);o.headerSelect={...o.header,strokeFill:a.palette.primary.main,fill:Re.alpha(s,.2),text:{...o.header.text,fill:a.palette.primary.main},dividerStrokeFill:Re.alpha(s,.7)},o.headerSelectAll={...o.headerSelect,fill:Re.alpha(s,.9),text:{...o.headerSelect.text,fill:a.palette.primary.contrastText},edgeStrokeFill:o.headerSelect.strokeFill},o.buttonSurface={...r,strokeFill:y.elevateColor(r.fill,So,i.palette?.mode),fill:i&&i.palette.mode==="dark"&&i.palette.mode!==a.palette.mode?r.fill:y.elevateColor(r.fill,.055,i.palette?.mode),edgeStrokeFill:i.palette.mode==="dark"?r.strokeFill:y.elevateColor(r.fill,.328,i.palette?.mode)},o.headerSelection={fill:a.palette?.primary?.main?Re.alpha(a.palette?.primary?.main,.1):void 0,strokeFill:a.palette?.primary?.main},o.headerSelectionInactive={...o.headerSelection,fill:a.palette?.divider?Re.alpha(a.palette?.divider,.05):void 0,strokeFill:"transparent"};const d=i??a,p=d.palette.mode==="dark";return o.selection={fill:d.palette?.primary?.main?Re.alpha(d.palette?.primary?.main,.1):void 0,strokeFill:d.palette?.primary?.main},o.selectionInactive={...o.selection,fill:d.palette?.divider?Re.alpha(d.palette?.divider,.05):void 0,strokeFill:"transparent"},o.selectionRemove={...o.selection,fill:Re.alpha(d.palette.warning.light,.05),strokeFill:d.palette.warning.dark},i&&(o.body=t(i)),o.colorShadow=Re.alpha(d.palette.action.active,.5),o.colorGrey=d.palette.action.active,o.filterDarkInvert=p?"hue-rotate(180deg) invert(1) brightness(95%)":"none",o},Nt=n.memo(n.forwardRef((a,i)=>{const{children:o,sx:t,parentFloat:r,...s}=a,d=w.useImperativeElement(i,()=>({}),[]),[p,l]=_e(),c=n.useRef(null),g=n.useRef(null),[C,f]=n.useReducer(v=>v+1,0),[u,m]=n.useState(null),[b,S]=n.useState(null),[x,h]=n.useState(null),{reference:k}=y.useFloatStack({parentFloat:r,label:"overflow"});n.useLayoutEffect(()=>{g.current={refs:[]};const v=[],T=n.Children.toArray(o);let M=0;T.forEach((P,D)=>{v.push(e.jsx(B.Box,{sx:{display:"flex"},ref:F=>{M++,M===T.length&&f();const E={current:null};E.current=F,g.current.refs[D]=E},children:P},D))}),m(v)},[o,l]),n.useLayoutEffect(()=>{if(!u)return;const v=g.current.refs,T=v?v.length:0;if(!d.current||T===0)return S(null),void h(null);const M=d.current?.getBoundingClientRect(),P=[],D=[];let F=0,E=!1;for(let N=0;!E&&N<T;N++){const z=v[N];if(!z)continue;if(!z.current){E=!0;continue}const O=z.current.getBoundingClientRect();F+=O?.width,F>M.width&&(E=!0)}if(!E)return S(null),void h([]);const R=c.current?.getBoundingClientRect();F=0;for(let N=0;N<T;N++){const z=v[N];let O=!1;if(z.current){const H=z.current.getBoundingClientRect();F+=H?.width,F<M.width-R.width&&(O=!0)}O?P.push(u[N]):D.push(u[N])}S(P.length>0?P:null),h(D.length>0?D:null)},[o,u,l,k,C]);const j=w.useCallbackRef(v=>{const T=[],M=x.length;for(let D=0;D<M;D++){const F=n.Children.toArray(x[D])[0];n.Children.toArray(F.props.children?.props?.children??F.props.children).forEach((E,R)=>{const N=E,z={...N.props,key:`overflow-${D}-${R}${N.key??""}`};z.parentFloat&&v&&(z.parentFloat=v.floatReference);const O=n.cloneElement(N,z);T.push(O)})}const P=e.jsx(B.Box,{className:"overflow-palette-popup-panel",sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:D=>D.spacing(.25),paddingTop:D=>D.spacing(.5),paddingBottom:D=>D.spacing(.5),paddingLeft:D=>D.spacing(1),paddingRight:D=>D.spacing(1),overflow:"hidden"},children:T});return y.defaultCreatePopupPanel({...v,children:P})},[x]);return e.jsxs(B.Box,{className:"overflow-palette",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",width:"100%",maxWidth:"100%",...t},ref:tt([d,p,i]),...s,children:[e.jsx(B.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%",alignItems:"center"},children:b??u}),e.jsx(B.Box,{className:"overflow-palette-popup-button",sx:{display:x!==null&&x.length===0?"none":"flex",flex:"1 1 0"},children:e.jsx(y.ExhibitPopupIconButton,{createPopupPanel:j,ref:c,parentFloat:k,createTooltip:({children:v},T)=>e.jsx(y.ExhibitTooltip,{label:"More",description:"More toolbar options…",disabled:T,children:v}),icon:e.jsx(w.DynamicIcon,{iconKey:"MoreHorizontal"})})})]})})),fr="https://unpkg.com/@sheetxl/scripting-templates/dist",il=a=>{if(a.metadata?.name)return a.metadata.name;let i=(a.path.split("/").pop()||"").replace(/\.[^/.]+$/,"");return a.metadata?.icon==="formula"?i.toUpperCase():(i=i.replace(/([a-z])([A-Z])/g,"$1 $2"),i.replace(/[-_]/g," ").trim().split(/\s+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "))},hr=async a=>{const i=dt.IOUtils.relativePath(a,"./manifest.json"),o=await fetch(i);if(!o.ok)throw new je.ChainedError(`Failed to retrieve directory at '${a}': ${o.statusText}`);const t=await o.text();if(t.trim().toLowerCase().startsWith("<!doctype html")||t.trim().toLowerCase().startsWith("<html"))throw new je.ChainedError(`Failed to retrieve directory at '${a}'`);let r;try{r=JSON.parse(t)}catch(d){throw new Error(`Failed to parse directory: ${d.message}. Ensure the file is valid JSON.`)}const s=r.map(async d=>{try{const p=dt.IOUtils.relativePath(a,d.path),l=await fetch(p);if(!l.ok)throw new Error(`Failed to fetch file at '${d.path}': ${l.statusText}`);const c=await l.text();let g=d.metadata;return g?.title||(g={title:il(d),...g}),{path:d.path,content:c,metadata:g}}catch(p){console.error(p.message)}return null});return(await Promise.all(s)).filter(d=>d!==null)},wo={marginRight:"4px"},ko="1em",ll=n.memo(a=>{const{disabled:i,snippet:o,description:t,handleInsert:r,sx:s,...d}=a;let p;const l=o.metadata?.icon;return p=l==="formula"?e.jsx(w.DynamicIcon,{iconKey:"ScriptFormula",size:ko,style:wo}):l==="macro"?e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro",size:ko,style:wo}):e.jsx(w.DynamicIcon,{iconKey:"ScriptAutoStart",size:ko,style:wo}),e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"460px",display:"flex","*":{lineHeight:"1.2"},...s},disabled:i,icon:p,onMouseDown:c=>{c.button===0&&c.preventDefault()},onMouseUp:c=>{c.button===0&&r(o)},onKeyDown:c=>{c.keyCode!==w.KeyCodes.Enter&&c.keyCode!==w.KeyCodes.Space||r(o)},...d,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsx(B.Typography,{component:"div",children:o.metadata?.title??o.path}),e.jsx(B.Typography,{variant:"caption",component:"div",sx:{color:c=>Re.alpha(c.palette.text.secondary??c.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:o.metadata?.summary})]})})}),sl=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,scriptPath:d=fr,...p}=a,[l,c]=n.useState([]),[g,C]=n.useState(!0),f=w.useCommands(o,["executeSelectedScript"]),u=f[0]?.context?.();n.useEffect(()=>{(async()=>{try{const b=await hr(d);c(b)}catch{}finally{C(!1)}})()},[d]);const m=n.useCallback((b,S)=>{if(g)return e.jsx("div",{children:"Loading..."});const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:s},h=v=>{u.getEditor()?.insertSnippet(v.content),b.closeFloat()},k=[];for(let v=0;v<l.length;v++){const T=l[v];T&&k.push(e.jsx(ll,{handleInsert:h,snippet:T},T.path))}const j=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[k.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:k}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...x,key:"help",command:o.getCommand("help")})]});return y.defaultCreatePopupPanel({...b,children:j})},[s,t,r,g,u]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Insert Script",tooltip:"Inserts a script from a set of templates.",createPopupPanel:m,icon:"ScriptInsert",...p})})),gr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(p=>{const{commandButtonProps:l,commandPopupProps:c}=p;return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flex:"1 1 100%"},children:[e.jsx("div",{children:e.jsx(Nt,{parentFloat:t,style:{},children:e.jsx(y.CommandButton,{...l,command:o?.getCommand("saveScripts")})})}),e.jsx("div",{style:{flex:"1 1 100%"}}),e.jsx("div",{children:e.jsx(Nt,{parentFloat:t,style:{},children:e.jsx(sl,{...l,commands:o})})})]})})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));gr.displayName="ScriptEditorToolbar";const xr=n.memo(n.forwardRef((a,i)=>{const{scriptPath:o=fr,onScriptSelect:t,sx:r=w.ReactUtils.EmptyCssProperties,className:s,buttonMinWidth:d=210,buttonMinHeight:p=80,gap:l=12,...c}=a,[g,C]=n.useState([]),[f,u]=n.useState(!0),[m,b]=n.useState(null);if(n.useEffect(()=>{(async()=>{const h=[{path:null,metadata:{title:"Blank Template...",summary:"Start with an empty script."},content:""}];try{u(!0),b(null);const k=await hr(o);for(let j=0;j<k.length;j++){const v=k[j];v&&h.push(v)}}catch(k){b(k instanceof Error?k.message:"Failed to load scripts"),k instanceof je.ChainedError||console.error("Error loading scripts:",k)}finally{C(h),u(!1)}})()},[o]),f)return e.jsx(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:ie(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,...r},...c,children:e.jsx(B.CircularProgress,{})});let S=null;m&&(S=e.jsxs(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:ie(s,"script-select","error-results"),sx:{background:h=>h.palette.error.light,flex:"0",zIndex:1e3,flexDirection:"column",padding:h=>h.spacing(1),border:h=>`1px solid ${h.palette.error.main}`,borderBottomLeftRadius:1,borderBottomRightRadius:1,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},...c,children:[e.jsx(B.Typography,{color:"error",variant:"h6",component:"div",gutterBottom:!0,children:"Error loading Templates"}),e.jsx(B.Typography,{color:"error",component:"div",children:m})]}));const x=h=>{const k=h.metadata?.icon;return k==="macro"?e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro",size:"1em"}):k==="formula"?e.jsx(w.DynamicIcon,{iconKey:"ScriptFormula",size:"1em"}):k==="autostart"?e.jsx(w.DynamicIcon,{iconKey:"ScriptAutoStart",size:"1em"}):null};return e.jsxs(B.Box,{ref:i,className:ie(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,...r},...c,children:[e.jsxs(B.Box,{p:3,className:"script-select-content",sx:{overflow:"auto",flex:"1 1 auto"},children:[e.jsx(B.Typography,{variant:"h6",gutterBottom:!0,children:"Script Template"}),e.jsx(B.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(B.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Templates provide a foundation to customize and meet your specific needs."}),e.jsx(B.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${d}px, 1fr))`,gap:`${l}px`,padding:2,paddingLeft:"0px",paddingRight:"0px"},children:g.map((h,k)=>e.jsxs(B.Button,{variant:"outlined",sx:{minWidth:d,minHeight:p,display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",textAlign:"left",padding:2,textTransform:"none",overflow:"hidden",...k===0&&{borderStyle:"dashed",marginBottom:"8px"},...k===1&&{gridColumn:"1"}},onClick:()=>t?.(h),children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:.5},children:[e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:h.metadata?.title||h.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),x(h)]}),h.metadata?.summary&&e.jsx(B.Typography,{variant:"body2",component:"div",color:"text.secondary",sx:{overflow:"hidden",display:"flex",flexDirection:"column",textOverflow:"ellipsis",alignItems:"flex-start"},children:h.metadata.summary})]},`${h.path}-${k}`))})]}),S]})}));xr.displayName="TemplateSelectPanel";const br=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,editorProps:r,commands:s,readOnly:d=!1,frame:p,autoFocusSel:l,autoFocus:c=!0,scripts:g,...C}=a,f=q.useTheme(),[u,m]=n.useState(!1),b=n.useRef(!1),[S,x]=n.useState({message:"Loading",cursor:"",dirty:!1}),[h,k]=n.useState(null);n.useEffect(()=>{let H=!1;return k(null),(async function(){if(g&&(await g.start(),!H)){const I=g.getModules().getItems()[0]?.getSource();k({source:I||null})}})(),()=>{H=!0}},[g]);const j=n.useCallback(H=>{x(I=>({...I,...H}))},[]),v=n.useRef(null),[T,M]=n.useState(null),P=n.useRef(null),D=w.useCallbackRef(H=>{if(T)return T.focus(H),!0;if(l){const I=v.current?.querySelectorAll?.(l);if(I&&I.length>0)return I[0]?.focus?.(H),!0}return v.current?.focus?.(H),!1},[T,l,c]),F=n.useMemo(()=>e.jsx(y.LoadingPanel,{transitionDelay:"160ms",style:{position:"absolute",width:"100%",height:"100%"},transparentBackground:!1}),[]),E=n.useMemo(()=>e.jsx(B.Paper,{elevation:1,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,marginLeft:H=>H.spacing(.5),marginRight:H=>H.spacing(.5),marginTop:H=>H.spacing(1),marginBottom:H=>H.spacing(1)},children:e.jsx(gr,{commands:s})}),[f,s]),R=n.useMemo(()=>e.jsx(B.Box,{className:ie("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 ${f.palette.divider}`},children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"center",flexDirection:"row",justifyContent:"center"},children:[e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"1 1 100%",color:H=>H.palette.text.secondary},variant:"caption",children:S.message}),e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",color:H=>H.palette.text.secondary},variant:"caption",children:S.dirty?"Unsaved":""}),e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",marginLeft:"8px",minWidth:"90px",display:"flex",justifyContent:"end",color:H=>H.palette.text.secondary},variant:"caption",children:S.cursor})]})}),[S]),N=n.useMemo(()=>e.jsxs(B.Box,{className:ie("script-editor-content"),sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"column",boxSizing:"border-box"},children:[E,e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"row",position:"relative",boxSizing:"border-box"},children:e.jsx(oe.ScriptEditor,{ref:v,loadingPanel:F,readOnly:d,frame:p,autoFocus:c,commands:s,onStatusChange:j,darkMode:f.palette.mode==="dark",...r})}),R]}),[f,s,E,R,u,F,d,r,c,l,p,j]),z=n.useMemo(()=>{let H;return h===null?null:(h.source===null&&(H=e.jsx(xr,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:I=>{v.current?.getEditor()?.insertSnippet(I.content),k({source:I.content??""})}})),e.jsx(B.Box,{tabIndex:0,className:ie("script-workspace",o),sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",alignItems:"stretch",userSelect:"none",flexGrow:0,outline:"none"},onPointerDown:I=>{I.isDefaultPrevented()||v.current?.focus()},children:e.jsxs(B.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[N,H]})}))},[E,N,o,h]),O=w.useImperativeElement(i,()=>({isScriptWorkspaceElement:()=>!0,focus:H=>{D(H)}}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",...t},ref:O,...C,onFocus:H=>{m(!0),b.current=!0,O.current?.contains(H.target)&&H.target!==O.current&&M(H.target),H.relatedTarget&&!P.current&&(P.current=H.relatedTarget),C?.onFocus?.(H)},onBlur:H=>{O?.current?.contains(H.relatedTarget)||O?.current===H.relatedTarget||(P.current=null,b.current=!1,m(!1)),C?.onBlur?.(H)},children:z})}));br.displayName="ScriptWorkspace";const cl=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...d}=a;return e.jsx(br,{ref:i,readOnly:!1,commands:t,frame:s,scripts:o?.getScripts(),...d})},yr=n.memo(n.forwardRef((a,i)=>{const{commands:o,...t}=a,r=w.useCommands(o,["executeScript","showScriptEditor"]),[s,d]=n.useState([]),[p,l]=n.useState(!1),c=r[0]?.context?.();n.useEffect(()=>{const m=c?.getScripts();m&&(async()=>{l(!0);const b=await m.searchFunctions({type:"macro"});d(b),l(!1)})()},[]);const g={variant:w.CommandButtonType.Menuitem,parentFloat:a.floatReference,scope:"scripts",shortcut:null},C=[],f=s.length;for(let m=0;m<f;m++){const b=s[m];C.push(e.jsx(y.CommandButton,{...g,command:o.getCommand("executeScript"),commandState:{declaration:b},tooltipProps:{description:`Execute ${b.getName()??"macro"}`},icon:e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro"}),label:b.getName()??`Script '${b.getName()}'`},`macro-${b.getName()}-${m}`))}const u=e.jsxs(B.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[C.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:C}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...g,key:"show-editor",command:o.getCommand("showScriptEditor")})]});return y.defaultCreatePopupPanel({...t,children:u})}));yr.displayName="RunScriptPopupPanel";const Cr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p="showScriptEditor",l=w.useCommands(o,["executeScript","showScriptEditor"])[0].context(),c=n.useCallback((g,C)=>{const f=e.jsx(yr,{...g,commands:C});return y.defaultCreatePopupPanel({...g,children:f})},[s,l,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:c,selected:o.getCommand(p).state(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:p,...d})})),dl=a=>e.jsx(y.CommandButton,{...a}),Sr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,[d,p]=n.useState(!1),l=w.useCommands(o,["executeScript","showScriptEditor"]),c=l[0]?.context?.();n.useEffect(()=>{const f=c?.getScripts();if(!f)return;const u=l[1],m=async()=>{if(!u)return;let x=!1;if(!u.state()){const h=await f.searchFunctions({type:"macro"}),k=h?.length??0;for(let j=0;h&&!x&&j<k;j++)x=!0}p(x||!!u.state())};m();const b=u.addPropertyListener(()=>{m()}),S=f.addListeners({onChange:()=>{m()}});return()=>{S(),b()}},[c]);const g=oe.useTaskPaneArea(),C=n.useCallback(f=>{const{commandButtonProps:u,commandPopupProps:m}=f,b=oe.DefaultTaskPaneRegistry.findContributions("ribbon/home");let S;const x=b.length;if(x>0){S=[];for(let M=0;M<x;M++){const P=b[M],D=P.createCommand?.(g);if(!D)continue;const F={command:D,...m},E=(P.createCommandButton??dl)(F);S.push(E)}}const h=e.jsx(ht,{...m,command:o.getCommand("formatFontColor"),isSplit:!0,panelProps:{disableAlpha:!0}}),k=e.jsx(ht,{...m,command:o.getCommand("formatFillColor"),isSplit:!0,panelProps:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:pt.End}}),j=o.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx(Vo,{...m,quickCommand:"undo"})}):null,v=o.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Oa,{...m})}):null;let T=null;return d&&(T=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{}),e.jsx(Cr,{...m})]})),e.jsxs(Nt,{parentFloat:t,children:[j,null,j?e.jsx(y.ExhibitDivider,{}):null,e.jsx(_o,{...m,command:o.getCommand("paste")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("formatPainterToggle")}),e.jsx(so,{...u,command:o.getCommand("copy")}),e.jsx(y.ExhibitDivider,{}),e.jsx($a,{...m,command:o.getCommand("formatFontFamily")}),e.jsx(Aa,{...m,command:o.getCommand("formatFontSize")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("formatBoldToggle")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("formatItalicToggle")}),e.jsx(_a,{...m}),e.jsx(Va,{...m}),e.jsx(Fa,{...m}),k,h,e.jsx(y.ExhibitDivider,{}),e.jsx(va,{...m}),e.jsx(ja,{...m}),e.jsx(Ea,{...m}),e.jsx(Ta,{...m}),e.jsx(Ia,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(La,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ga,{command:o.getCommand("formatCellStyle"),...m}),e.jsx(cn,{command:o.getCommand("formatTableStyle"),...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(zo,{...m}),e.jsx(Ho,{...m}),e.jsx(Wo,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(un,{...m}),e.jsx(za,{...m}),e.jsx(Lo,{...m}),e.jsx($o,{...m}),v,T,S]})},[o,l,d,g]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:C,...s})}));Sr.displayName="HomeToolbar";const wr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(p=>{const{commandButtonProps:l,commandPopupProps:c}=p;return e.jsxs(Nt,{parentFloat:t,children:[e.jsx(y.CommandButton,{...l,command:o.getCommand("insertTable")}),e.jsx(dn,{...c}),null,e.jsx(y.CommandButton,{...l,command:o.getCommand("updateHyperlink")}),e.jsx(y.CommandButton,{...l,command:o.getCommand("updateComments")})]})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));wr.displayName="InsertToolbar";const kr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(p=>{const{commandButtonProps:l,commandPopupProps:c}=p;return e.jsxs(Nt,{parentFloat:t,children:[e.jsx(Na,{...c}),e.jsx(y.CommandButton,{...l,command:o.getCommand("protectionSheetToggle")}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ha,{...c}),e.jsx(Ka,{...c}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...l,command:o.getCommand("sheetViewToggleFormulaView"),scope:"view"}),e.jsx(y.CommandButton,{...l,command:o.getCommand("sheetViewToggleShowZeros"),scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ua,{...c}),e.jsx(Dr,{command:o.getCommand("selectTheme"),...c}),e.jsx(y.ExhibitDivider,{}),e.jsx(Cr,{...c,scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...l,command:o.getCommand("fullScreenToggle"),scope:"view"})]})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));kr.displayName="ViewToolbar";const vr=a=>e.jsx(jr,{...a}),ul=n.memo(a=>{const{sx:i,...o}=a;return e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",position:"relative","&:hover:not([disabled]) .indicator":{borderBottom:t=>`${q.alpha(t.palette.primary.main,.35)} solid 2px`}},children:[e.jsx(B.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":{},...i},...o}),e.jsx(B.Box,{className:"indicator",sx:{width:"90%",borderRadius:"4px",minWidth:"4px",position:"absolute",bottom:"0",alignSelf:"center",display:"flex"}})]})}),ml=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,sx:r,...s}=a,d=n.useMemo(()=>{const p=[];for(let l=0;l<i.length;l++)p.push(e.jsx(ul,{label:i[l].label},i[l].label));return p},[i]);return e.jsx(B.Tabs,{value:o,onChange:(p,l)=>{t?.(l)},variant:"scrollable",scrollButtons:!1,sx:{paddingLeft:p=>p.spacing(1.5),paddingRight:p=>p.spacing(1.5),paddingTop:p=>p.spacing(0),paddingBottom:p=>p.spacing(0),minHeight:"26px",alignItems:"center","& .MuiTabs-indicator":{display:"flex",justifyContent:"center",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{width:"90%",borderRadius:"4px",minWidth:"4px",backgroundColor:p=>p.palette.primary.main},"& .MuiTab-root":{marginRight:"0px"},...r},slotProps:{indicator:{children:e.jsx("span",{className:"MuiTabs-indicatorSpan"})}},...s,children:d})}),pl=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,selectProps:r,...s}=a,d=n.useCallback(l=>{t?.(l.target.value)},[t]),p=n.useMemo(()=>{const l=[];for(let c=0;c<i.length;c++){const g=i[c].label;l.push(e.jsx(B.MenuItem,{value:c,sx:{color:C=>{if(o===c)return C.palette.primary.main}},children:g},g))}return l},[i,o]);return e.jsx(B.FormControl,{sx:{minWidth:"125px",maxWidth:"125px","& .MuiInputBase-root":{paddingLeft:"0px",paddingRight:"0px"},"& .MuiSelect-select":{paddingTop:l=>l.spacing(.5),paddingBottom:l=>l.spacing(.5),paddingLeft:l=>l.spacing(2),color:l=>l.palette.primary.main},"& .MuiSelect-icon":{fill:l=>l.palette.text.icon??l.palette.action.active,"&:hover:not(.Mui-disabled)":{color:l=>l.palette.text.icon??l.palette.action.active}},...r},size:"small",children:e.jsx(B.Select,{value:o,onChange:d,variant:"outlined",sx:{backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`},...s,children:p})})}),jr=n.memo(n.forwardRef((a,i)=>{const{commands:o,selectWrapper:t,selectProps:r={},renderCompact:s=!1,paletteWrapper:d,toolbarsProps:p,paletteProps:l={},workbook:c,sx:g,...C}=a,f=n.useMemo(()=>{const v=[],{ref:T,...M}=p?.Home||{};v.push({label:"Home",component:e.jsx(Sr,{commands:o,...M})});const{ref:P,...D}=p?.Insert||{};v.push({label:"Insert",component:e.jsx(wr,{commands:o,...D})});const{ref:F,...E}=p?.View||{};return v.push({label:"View",component:e.jsx(kr,{commands:o,...E})}),v},[o,c]),u=n.useMemo(()=>{const v=[];for(let T=0;T<f.length;T++)v.push(n.cloneElement(f[T].component,{...f[T].component.props,key:f[T].key??f[T].label}));return v},[f]),[m,b]=n.useState(0),S=v=>{b(v)},x=n.useMemo(()=>s?e.jsx(pl,{toolbars:f,value:m,onToolbarChange:S,sx:r}):e.jsx(ml,{toolbars:f,value:m,onToolbarChange:S,sx:r}),[f,m,r,s]),{sx:h,...k}=l,j=e.jsx(B.Paper,{elevation:2,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,borderRadius:"8px",backgroundImage:`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`,marginLeft:v=>v.spacing(1),marginRight:v=>v.spacing(1),marginTop:v=>v.spacing(.5),marginBottom:v=>v.spacing(.5),...h},...k,children:u[m]});return e.jsxs(B.Box,{ref:i,className:"toolbarWrappers",sx:{display:"flex",flexDirection:"column",paddingTop:v=>v.spacing(.5),"*":{userSelect:"none"},...g},...C,children:[t?t(x):x,d?d(j):j]})}));var ta,oa;jr.displayName="WorkbookToolbars",(function(){if(oa)return ta;oa=1;var a=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,t=/^0o[0-7]+$/i,r=parseInt,s=typeof ut=="object"&&ut&&ut.Object===Object&&ut,d=typeof self=="object"&&self&&self.Object===Object&&self,p=s||d||Function("return this")(),l=Object.prototype.toString,c=Math.max,g=Math.min,C=function(){return p.Date.now()};function f(m){var b=typeof m;return!!m&&(b=="object"||b=="function")}function u(m){if(typeof m=="number")return m;if((function(x){return typeof x=="symbol"||(function(h){return!!h&&typeof h=="object"})(x)&&l.call(x)=="[object Symbol]"})(m))return NaN;if(f(m)){var b=typeof m.valueOf=="function"?m.valueOf():m;m=f(b)?b+"":b}if(typeof m!="string")return m===0?m:+m;m=m.replace(a,"");var S=o.test(m);return S||t.test(m)?r(m.slice(2),S?2:8):i.test(m)?NaN:+m}ta=function(m,b,S){var x,h,k,j,v,T,M=0,P=!1,D=!1,F=!0;if(typeof m!="function")throw new TypeError("Expected a function");function E(H){var I=x,W=h;return x=h=void 0,M=H,j=m.apply(W,I)}function R(H){var I=H-T;return T===void 0||I>=b||I<0||D&&H-M>=k}function N(){var H=C();if(R(H))return z(H);v=setTimeout(N,(function(I){var W=b-(I-T);return D?g(W,k-(I-M)):W})(H))}function z(H){return v=void 0,F&&x?E(H):(x=h=void 0,j)}function O(){var H=C(),I=R(H);if(x=arguments,h=this,T=H,I){if(v===void 0)return(function(W){return M=W,v=setTimeout(N,b),P?E(W):j})(T);if(D)return v=setTimeout(N,b),E(T)}return v===void 0&&(v=setTimeout(N,b)),j}return b=u(b)||0,f(S)&&(P=!!S.leading,k=(D="maxWait"in S)?c(u(S.maxWait)||0,b):k,F="trailing"in S?!!S.trailing:F),O.cancel=function(){v!==void 0&&clearTimeout(v),M=0,x=T=h=v=void 0},O.flush=function(){return v===void 0?j:z(C())},O}})();var na,aa,ra={exports:{}},vo={};aa||(aa=1,ra.exports=(function(){if(na)return vo;na=1;var a=n,i=typeof Object.is=="function"?Object.is:function(l,c){return l===c&&(l!==0||1/l==1/c)||l!=l&&c!=c},o=a.useState,t=a.useEffect,r=a.useLayoutEffect,s=a.useDebugValue;function d(l){var c=l.getSnapshot;l=l.value;try{var g=c();return!i(l,g)}catch{return!0}}var p=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,c){return c()}:function(l,c){var g=c(),C=o({inst:{value:g,getSnapshot:c}}),f=C[0].inst,u=C[1];return r(function(){f.value=g,f.getSnapshot=c,d(f)&&u({inst:f})},[l,g,c]),t(function(){return d(f)&&u({inst:f}),l(function(){d(f)&&u({inst:f})})},[l]),s(g),g};return vo.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:p,vo})()),ra.exports;var ia,la,Et={exports:{}},ct={exports:{}},fl=ct.exports;(function(){if(la)return Et.exports;la=1;for(var a=(ia||(ia=1,function(){var C,f,u,m,b,S;typeof performance<"u"&&performance!==null&&performance.now?ct.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(ct.exports=function(){return(C()-b)/1e6},f=process.hrtime,m=(C=function(){var x;return 1e9*(x=f())[0]+x[1]})(),S=1e9*process.uptime(),b=m-S):Date.now?(ct.exports=function(){return Date.now()-u},u=Date.now()):(ct.exports=function(){return new Date().getTime()-u},u=new Date().getTime())}.call(fl)),ct.exports),i=typeof window>"u"?ut:window,o=["moz","webkit"],t="AnimationFrame",r=i["request"+t],s=i["cancel"+t]||i["cancelRequest"+t],d=0;!r&&d<o.length;d++)r=i[o[d]+"Request"+t],s=i[o[d]+"Cancel"+t]||i[o[d]+"CancelRequest"+t];if(!r||!s){var p=0,l=0,c=[],g=1e3/60;r=function(C){if(c.length===0){var f=a(),u=Math.max(0,g-(f-p));p=u+f,setTimeout(function(){var m=c.slice(0);c.length=0;for(var b=0;b<m.length;b++)if(!m[b].cancelled)try{m[b].callback(p)}catch(S){setTimeout(function(){throw S},0)}},Math.round(u))}return c.push({handle:++l,callback:C,cancelled:!1}),l},s=function(C){for(var f=0;f<c.length;f++)c[f].handle===C&&(c[f].cancelled=!0)}}Et.exports=function(C){return r.call(i,C)},Et.exports.cancel=function(){s.apply(i,arguments)},Et.exports.polyfill=function(C){C||(C=i),C.requestAnimationFrame=r,C.cancelAnimationFrame=s},Et.exports})();var Ne={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 a=document;return"exitFullscreen"in a?["fullscreenchange","fullscreenerror"]:"webkitExitFullscreen"in a||"webkitCancelFullScreen"in a?["webkitfullscreenchange","webkitfullscreenerror"]:"mozCancelFullScreen"in a?["mozfullscreenchange","mozfullscreenerror"]:"msExitFullscreen"in a?["MSFullscreenChange","MSFullscreenError"]:null},getEventName(a){const i=this.getEventsNames();return i?a==="change"?i[0]:i[1]:null},get fullscreenEnabled(){if(typeof document>"u")return!1;const a=document;return a.fullscreenEnabled||a.webkitFullscreenEnabled||!!a.webkitCancelFullScreen||a.mozFullScreenEnabled||a.msFullscreenEnabled||!1},get fullscreenElement(){if(typeof document>"u")return null;const a=document;return a.fullscreenElement||a.webkitFullscreenElement||a.webkitCurrentFullScreenElement||a.mozFullScreenElement||a.msFullscreenElement||null},requestFullscreen(a,i){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const o=a??document.documentElement,t=o.requestFullscreen||o.webkitRequestFullscreen||o.webkitRequestFullScreen||o.mozRequestFullScreen||o.msRequestFullscreen;if(!t)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return t.call(o,i)},exitFullscreen(){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const a=document,i=a.exitFullscreen||a.webkitExitFullscreen||a.webkitCancelFullScreen||a.mozCancelFullScreen||a.msExitFullscreen;if(!i)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return i.call(a)},on(a,i){const o=this.getEventName(a);o&&document.addEventListener(o,i)},off(a,i){const o=this.getEventName(a);o&&document.removeEventListener(o,i)}};const Tr=a=>{const{workbook:i,workbookElement:o,target:t,commands:r,darkMode:s,onNewWorkbook:d=Er}=a,p=w.useNotifier(),[l,c]=n.useState(i?.getSelectedSheet()),[g,C]=n.useState(i?.getSheets().getItems()),f=w.useCallbackRef(d,[d]),u=oe.useTaskPaneArea(),m=n.useMemo(()=>[new w.SimpleCommand("activateTask",t,{label:"Activate Task",description:"Activate Task Pane.",shortcut:{key:"F6"}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("showFormat",t,{label:"Show Format",description:"Open the format pane.",shortcut:{key:"F",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.Command("newCellStyle",t,{label:"New Cell Style…",scopedLabels:{cellStyle:"New Cell Style"},description:"Create a new named style can can be quickly used later.",icon:"NewPresetStyles"}),new w.Command("deleteCellStyle",t,{label:"Delete Cell Style",scopedLabels:{cellStyle:"Delete"},description:"Remove a named style that is no longer needed."}),new w.Command("modifyCellStyle",t,{label:"Modify Cell Style",scopedLabels:{cellStyle:"Modify"},description:"Update a style with the currently style."}),new w.SimpleCommand("find",t,{label:"Find",description:"Open the Find window.",icon:"Find",shortcut:[{key:"F",modifiers:[w.KeyModifiers.Ctrl]},{key:"F5",modifiers:[w.KeyModifiers.Shift]}]}),new w.SimpleCommand("findReplace",t,{label:"Find & Replace",description:"Open the Find & Replace window.",icon:"FindReplace",shortcut:[{key:"H",modifiers:[w.KeyModifiers.Ctrl]},{key:"H",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Alt]}]}),new w.SimpleCommand("goto",t,{label:"Go To",description:"Open the 'Go To' window.",icon:"GoTo",shortcut:[{key:"G",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.SimpleCommand("workbookViewToggleExpandFormulaBar",t,{label:"Toggle Expand Formula bar",description:"Expand or collapse the formula bar.",shortcut:{key:"U",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookViewToggleShowFormulaBar",t,{label:"View Formula bar",scopedLabels:{view:"Formula Bar"},description:"Show or hide the formula bar."}),new w.SimpleCommand("workbookViewToggleShowTabs",t,{label:"View Sheet Tabs",description:"Show or hide the sheet tabs.",scopedLabels:{view:"Sheet Tabs"}}),new w.SimpleCommand("workbookViewToggleShowStatusBar",t,{label:"View Status Bar",description:"Show or hide the status bar.",scopedLabels:{view:"Status Bar"}}),new w.SimpleCommand("workbookViewToggleShowHorizontalScrollBar",t,{label:"View Horizontal Scrollbar",description:"Show or hide the horizontal scrollbar.",scopedLabels:{view:"Horizontal Scrollbar"}}),new w.SimpleCommand("workbookViewToggleShowVerticalScrollBar",t,{label:"View Vertical Scrollbar",description:"Show or hide the vertical scrollbar.",scopedLabels:{view:"Vertical Scrollbar"}}),new w.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.",icon:"VisibilityOff"}),new w.Command("deleteSheet",t,{label:"Delete Sheet",scopedLabels:{sheet:"Delete"},description:"Delete the sheet and all the data."}),new w.Command("addSheet",t,{label:"Insert Sheet",scopedLabels:{sheet:"Insert"},description:"Insert sheet before the current sheet.",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Shift]},{key:"F1",modifiers:[w.KeyModifiers.Alt,w.KeyModifiers.Shift]}]}),new w.Command("duplicateSheet",t,{label:"Duplicate Sheet",description:"Duplicate the current sheet.",scopedLabels:{sheet:"Duplicate"}}),new w.Command("nextSheet",t,{label:"Next Sheet",scopedLabels:{sheet:"Next"},description:"Activate the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("previousSheet",t,{label:"Previous Sheet",scopedLabels:{sheet:"Previous"},description:"Activate the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("selectNextSheet",t,{label:"Select Next Sheet",scopedLabels:{sheet:"Select Next"},description:"Select the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectPreviousSheet",t,{label:"Select Previous Sheet",scopedLabels:{sheet:"Select Previous"},description:"Select the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectTheme",t,{label:"Theme",description:"Select a theme that coveys a style suitable for your data."}),new w.Command("selectNamed",t,{label:E=>E?.getName()??"Select Named Item",scopedLabels:{namedItem:E=>E?.getName()??"Select"},description:"Select the item."}),new w.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.",icon:"InsertNamedRange"}),new w.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.",icon:"NamedRangeEdit"}),new w.Command("deleteNamedReference",t,{label:"Delete Named Reference",scopedLabels:{namedItem:"Delete"},description:"Remove the named reference.",icon:"DeleteNamedRange"}),new w.SimpleCommand("activeNameBox",t,{label:"Activate Name Box",description:"Move the focus to the name box.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Alt]}}),new w.SimpleCommand("createNamedReferenceFromSelection",t,{label:"Create from Selection",description:"Automatically generate names from the selected cells.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("activeNameManager",t,{label:"Activate Name Manager",description:`Create, edit, delete, and find all the names used in the workbook.
13
13
 
14
- Names can be used as a substitute for cell references.`,shortcut:{key:"F3",modifiers:[w.KeyModifiers.Ctrl]}}),new w.Command("fullScreenToggle",t,{label:"FullScreen",description:"Toggle showing the workbook using the full screen.",shortcut:{key:"F11"},icon:"FullScreen"}),new w.Command("showScriptEditor",t,{label:"Scripts",scopedLabels:{scripts:"Script Editor…"},description:"Show the script editor.",icon:"ScriptRun",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Alt]}]}),new w.Command("executeScript",t,{label:"Run Script",description:"Run the selected or last executed script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("executeSelectedScript",t,{label:"Run Script",description:"Run the selected script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("saveScripts",t,{label:"Save Script",description:"Save the current scripts.",icon:"ScriptSave"}),new w.Command("maximumWorkbookToggle",t,{label:"Maximize",description:"Toggle showing the workbook maximized.",shortcut:{key:"F10",modifiers:[w.KeyModifiers.Ctrl]}}),new w.Command("spellCheck",t,{label:"Spell Check",description:"Check the workbook for spelling mistakes.",shortcut:{key:"F7"}}),new w.Command("calculateAll",t,{label:"Calculate Now",description:"Recalculate all formulas.",icon:"Calculate",shortcut:{key:"F9"}}),new w.SimpleCommand("closeWorkbook",t,{label:"Close Workbook",description:"Close the workbook.",shortcut:{key:"W",modifiers:[w.KeyModifiers.Ctrl]}}),new w.SimpleCommand("newWorkbook",t,{label:"New Workbook",description:"Create a new workbook in another tab.",icon:"FileNew"})],[]),b=n.useMemo(()=>{let E=null;return E=r?r.createChildGroup(t,"workbook",!1):new w.CommandGroup(t,"workbook"),E.addCommands(m,!0),E},[r,m]),S=w.useEditMode(),x=n.useRef(null),h=w.useCallbackRef(()=>{let E,R=null;const N=b.getCommand("executeScript");if(N.update({disabled:!1,context:{getScripts:()=>i.getScripts()}}),!N)return;const z=b.getCommand("showScriptEditor");z.updateCallback(function(I=!0){R?R.close():u.activateTaskPane("scriptEditor",{})});const O=b.getCommand("executeSelectedScript");if(!O)return;const H={saveSource:async I=>{let W=null,ee=null;const X=i.getScripts();try{I&&(ee=await p.showBusy("Saving Scripts..."),W=await X.createModule({source:I})),X.addModule("scripts",W,{replace:!0}),ee?.()}catch(ne){ee?.(),console.warn("Unable to compile",ne),p.showError(ne)}return W},addContainerListener:I=>(k.current=I,()=>{k.current=null}),setSelectedFunction:I=>{E=I??x.current??null,Promise.resolve(E).then(W=>{O.update({disabled:W===null})})},quickInsertFunction:I=>{const W=`=${I.toUpperCase()}(`,ee={text:W+")",editMode:!0,initialSelection:{start:W.length,end:W.length+0}};S.setMode(X=>X?.key==="edit"?{...X,args:{...X.args}}:{key:"edit",args:{stateAndCoords:null,start:ee}})},getSelectedFunction:()=>E,setEditor:I=>{R=I??null,z.update({state:R!==null})},getEditor:()=>R,getRanges:I=>{try{return i.getRanges(I)}catch{}return null},getScripts:()=>i.getScripts()};O.update({context:H})},[b,i,o,p]),k=n.useRef(null);oe.useModelListener(i,{onBeforeSave:async()=>{await k.current?.onBeforeSave()},onProtectionChange:()=>{k.current?.onReadonlyChange()},onLoad:()=>{(async()=>(await i.getCalculation().start(),i.getScripts().start(),k.current?.onScriptChange()))()}}),oe.useModelListener(i,{onSheetsChange:E=>{C(E.getSheets().getItems())},onViewChange(E){c(E?.getSelectedSheet())},onProtectionChange:E=>{const R={disabled:!E.getProtection().isStructureAllowed()};b.getCommand("hideSheet").update(R),b.getCommand("deleteSheet").update(R),b.getCommand("addSheet").update(R),b.getCommand("duplicateSheet").update(R),b.getCommand("selectTheme").update(R),b.getCommand("addNamedReference").update(R),b.getCommand("editNamedReference").update(R),b.getCommand("deleteNamedReference").update(R)},onScriptsChange:E=>{h()}});const{isFullscreenAvailable:j,isFullscreenEnabled:v,toggleFullscreen:T}=(function(E={}){const{target:R,onChange:N,onError:z,requestFullScreenOptions:O}=E,[H,I]=n.useState(!1),[W,ee]=n.useState(null),[X,ne]=n.useState(!1),$=n.useCallback(()=>Ie.requestFullscreen(R?.current||null,O),[R,O]),U=n.useCallback(()=>Ie.exitFullscreen(),[]),Y=n.useCallback(()=>Ie.fullscreenElement?U():$(),[$,U]),_=n.useCallback(G=>{const Q=Ie.fullscreenElement;ee(Q),ne(!!Q),N?.(G)},[N]),L=n.useCallback(G=>{const Q=Ie.fullscreenElement;ee(Q),ne(!!Q),z?.(G)},[z]);return n.useEffect(()=>{I(Ie.fullscreenEnabled)},[]),n.useEffect(()=>(Ie.on("change",_),Ie.on("error",L),()=>{Ie.off("change",_),Ie.off("error",L)}),[_,L]),{isFullscreenAvailable:H,fullscreenElement:W,isFullscreenEnabled:X,enableFullscreen:$,disableFullscreen:U,toggleFullscreen:Y}})({target:{current:o??document.body}}),M=oe.useDocThemes();n.useEffect(()=>{b.getCommand("selectTheme").update({state:()=>i.getTheme(),context:()=>({theme:i.getTheme(),themes:M,darkMode:s})})},[i?.getTheme(),s]);const P=w.useCallbackRef(async function(E,R){let N=null;const z=i.getScripts();if(E?.declaration||E?.functionName){const O=E.declaration?E.declaration.getName():E.functionName;(await z.searchFunctions({name:O})).length>0&&(N=O)}if(N)try{await z.executeMacro(N),x.current=Promise.resolve({source:null,name:N})}catch(O){return void p.showError(O)}},[i,p]);n.useEffect(()=>{b.getCommand("newCellStyle").updateCallback(E=>{p.showInput({initialValue:(()=>{let R=0;for(;;){R++;const N=`Style ${R}`;try{return i.getStyles().validateStyleName(N,!0),N}catch{}}})(),title:b.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",onValidateInput:async(R,N)=>{let z=null;try{i.getStyles().validateStyleName(R,!1)}catch(I){z=I.message}let O=i.getStyles().getNamed(R),H=z;return!H&&O&&(H=`Update style '${O.getName()}'.`),{valid:z===null,message:H}}}).then(({input:R,option:N})=>{const z=i.getSelectedSheet().getSelectedRange();if(N!=="Ok")return;const O=i.getStyles().setNamed({name:R,style:z.getCell().getStyle()});z.getStyle().update({named:O.getName()})})}),b.getCommand("deleteCellStyle").updateCallback(E=>{E.delete()}),b.getCommand("modifyCellStyle").updateCallback(({named:E})=>{const R=i.getSelectedSheet().getSelectedRange();i.getStyles().setNamed({name:E.getName(),style:R.getCell().getStyle()})}),b.getCommand("hideSheet").updateCallback(E=>{i.getSheetAt(E).setVisibility(A.ISheet.Visibility.Hidden)}),b.getCommand("deleteSheet").updateCallback(async E=>{i.getSheetAt(E??i.getSelectedSheetIndex())?.delete()}),b.getCommand("addSheet").updateCallback(E=>{i.getSheets().add({index:E,autoSelect:!0})}),b.getCommand("duplicateSheet").updateCallback(async E=>{(await i.getSheetAt(E??i.getSelectedSheetIndex())?.duplicate())?.select()}),b.getCommand("nextSheet").updateCallback(E=>{i.getNextSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("previousSheet").updateCallback(E=>{i.getPreviousSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectNextSheet").updateCallback(E=>{i.getNextSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectPreviousSheet").updateCallback(E=>{i.getPreviousSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectTheme").updateCallback(E=>{i.setTheme(E)}),b.getCommand("calculateAll").updateCallback(()=>{i.getSelectedSheet().getEntireRange().calculate(!0)}),b.getCommand("closeWorkbook").updateCallback(async()=>{await p.showOptions({title:"Confirm",description:"This will close the current workbook tab. Do you want to continue?",options:["Close","Cancel"],defaultOption:"Close"})==="Close"&&window.close()}),b.getCommand("newWorkbook").updateCallback(()=>{f?.()}),b.getCommand("executeScript").updateCallback(P),b.getCommand("executeSelectedScript").updateCallback(P)},[i,p]);const D=w.useCallbackRef(async E=>{let R=0,N=null,z="Find & Replace";E?.replace&&!E?.replaceOptions?.maxCount&&(z="Replace All");const O=await p.showBusy(z);try{const H=E?.scope??"sheet";let I=null;const W=i.getSelectedSheet(),ee={from:W.getSelectedCell(),...E.findOptions};if(I=H==="sheet"?i.getSelectedSheet().find(ee):i.find(ee),E.replace){const X=i.replace(I,E.replaceText,E.replaceOptions);R=X.count,E.replaceOptions.maxCount&&(N=X.last)}else{let X=I.next();X.done||(R++,N=X.value)}N?.select({autoFocus:!1}),O?.(),!E.replaceOptions.maxCount&&R>1&&p.showMessage(`We replaced ${R} cells.`)}catch(H){O?.(),p.showError(H)}return R},[i,o]),F=w.useCallbackRef(E=>{const R={selection:()=>{const z=i.getSelectedRanges(),O=z.getCount(),H=new Array(O);for(let I=0;I<O;I++){const W=z.at(I).getFixed(!0).getCoords();H[I]=W}return i.getRanges(H)},getNames:()=>i.getNames()},N={initialValue:E,context:()=>R,onInput:async z=>{try{await z.select()}catch(O){p.showMessage(O.message,{type:w.NotifierType.Error})}}};return p.showWindow("namedDetails",N)},[p,i,o]);return n.useEffect(()=>{const E=(R=!1)=>{const N={initialValue:{findOptions:{text:i.getSelectedCell().toTextUnformatted(!0)},replace:R},context:()=>D,onKeyDown:z=>{b.findCommandByEvent(z)!==b.getCommand("find")&&b.findCommandByEvent(z)!==b.getCommand("findReplace")||z.preventDefault()},autoFocus:!0,disableAutoDestroy:!0};p.showWindow("find",N)};b.getCommand("find")?.update({disabled:!p.showWindow}).updateCallback(()=>{E()}),b.getCommand("findReplace")?.update({disabled:!p.showWindow}).updateCallback(()=>{E(!0)}),b.getCommand("activateTask")?.update({disabled:!p}).updateCallback(()=>{const R={onInput:async N=>{try{u.activateTaskPane(N)}catch(z){p.showError(z.message)}},title:b.getCommand("activateTask")?.label(),inputLabel:"Task Name",options:["Activate"]};p.showInput(R)}),b.getCommand("goto")?.update({disabled:!p}).updateCallback(()=>{const R={onInput:async N=>{try{await i.getRanges(N).select()}catch(z){p.showMessage(z.message,{type:w.NotifierType.Error})}},title:b.getCommand("goto")?.label(),inputLabel:"Location",options:["Go To"]};p.showInput(R)}),b.getCommand("selectNamed")?.update({disabled:!p}).updateCallback(async R=>{if(R)try{await R.select()}catch(N){p.showError(N)}}),b.getCommand("addNamedReference")?.updateCallback(async function(R){F(null)}),b.getCommand("editNamedReference")?.updateCallback(async function(R){F(R)}),b.getCommand("deleteNamedReference")?.updateCallback(async function(R){R?.delete?.()}),b.getCommand("activeNameBox")?.updateCallback(async function(){o?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus()})},[o,i,p]),oe.useModelListener(i?.getView(),{onViewChange:E=>{b.getCommand("workbookViewToggleShowFormulaBar").update({state:E.isShowFormulaBar()}).updateCallback(()=>{E.setShowFormulaBar(!E.isShowFormulaBar())}),b.getCommand("workbookViewToggleShowTabs").update({state:E.isShowTabs()}).updateCallback(()=>{E.setShowTabs(!E.isShowTabs())}),b.getCommand("workbookViewToggleShowStatusBar").update({state:E.isShowStatusBar()}).updateCallback(()=>{E.setShowStatusBar(!E.isShowStatusBar())}),b.getCommand("workbookViewToggleShowHorizontalScrollBar").update({state:E.isShowHorizontalScrollbar()}).updateCallback(()=>{E.setShowHorizontalScrollbar(!E.isShowHorizontalScrollbar())}),b.getCommand("workbookViewToggleShowVerticalScrollBar").update({state:E.isShowVerticalScrollbar()}).updateCallback(()=>{E.setShowVerticalScrollbar(!E.isShowVerticalScrollbar())})}}),n.useEffect(()=>{b.getCommand("fullScreenToggle").update({state:v,disabled:!j,icon:v?"FullScreenOff":"FullScreen"}).updateCallback(()=>{T()})},[v,j]),n.useEffect(()=>{const E=i.getProtection().isStructureAllowed();b.getCommand("hideSheet").update({disabled:g.length<=1||!E}),b.getCommand("deleteSheet").update({disabled:g.length<=1||!E})},[g,l]),b},Er=()=>{window.open(window.origin.toString(),"sheetxl-"+A.CommonUtils.uuidV4(),"popup=true")},hl="_sheetxl-theme_4opcr_2",gl="_sheetxl-workbook_g5t6x_5",xl=a=>e.jsx(tn,{...a}),bl=a=>e.jsx(on,{...a}),yl=a=>e.jsx(en,{...a}),an=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,onBeforeUserChange:r,onUserChange:s,disabled:d=!1,readOnly:p=!1,contextMenuProps:l,renderContextMenu:c=xl,sheetsAllProps:g,renderSheetsAll:C=bl,sheetTabProps:f,renderSheetTab:u,background:m="transparent",className:b,sx:S,borderWidth:x,borderColor:h,gridTheme:k,gridStyle:j,...v}=a,[T,M]=n.useState(o?.getSelectedSheetIndex()),[P,D]=n.useState(o?.getSheets().getItems()),[F,E]=n.useState(o?.getProtection());oe.useModelListener(o,{onViewChange(J){M(J?.getSelectedSheetIndex())},onSheetsChange:J=>{D(J.getSheets().getItems())},onProtectionChange:J=>{E(J?.getProtection())}});const R=p||!F.isStructureAllowed(),N=n.useMemo(()=>{const J=[];for(let K=0;K<P.length;K++)J.push(P[K].getName());return J},[P]),z=n.useCallback(J=>{r?.(J)!==!1&&(o.getSheetAt(J).select(),s?.(J))},[o,r,s]),O=n.useCallback((J,K)=>{o.getSheetAt(J).setName(K),s?.(J)},[o,s]),H=n.useCallback((J,K)=>{o.getSheetAt(J).setPosition(K),s?.(K)},[o,s]),I=w.useCallbackRef(()=>{if(r?.(T)===!1)return;const J=T+1;o.getSheets().add({name:void 0,autoSelect:!0}),s?.(J)},[o,r,s,T]),W=n.useMemo(()=>({placement:"top-start"}),[]),ee=n.useRef(null),[X,ne]=n.useState(!1),$=n.useCallback(J=>{const{closeFloatAll:K,floatReference:te}=J;return C({workbook:o,gridStyle:j,floatReference:te,closeFloatAll:K,...g})},[C,g,d,o,j]),{reference:U,component:Y}=y.useFloatStack({label:"allSheet",popperProps:W,anchor:ee.current,onOpen:()=>ne(!0),onClose:()=>ne(!1),createPopupPanel:$}),_=n.useRef(null),[L,G]=n.useState(null),Q=n.useCallback(J=>{const{floatReference:K}=J;return c?.({workbook:o,index:L?.index,tabStripRef:_.current,commands:t,disabled:d,floatReference:K,...l})},[c,l,d,o,t,L]),{reference:fe,component:re}=y.useFloatStack({label:"sheetTab",popperProps:W,anchor:{getBoundingClientRect:()=>new DOMRect(L?.left||0,L?.top||0,0,0)},onClose:()=>G(null),createPopupPanel:Q});n.useEffect(()=>{L?fe.open(0):fe.close(0)},[L]);const me=n.useCallback((J,K)=>{J.preventDefault(),G({left:J.clientX-2,top:J.clientY-4,index:K})},[]),Se=w.useCallbackRef(J=>{let K;try{K=o?.getSheetAt(J.index)}catch{}return K?(u??yl)({sheet:K,gridTheme:k,onContextMenu:te=>{z(J.index),me(te,J.index)},...J,...f}):null},[u,f,o,k]),Ce=n.useMemo(()=>R?null:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"New sheet",children:e.jsx(B.IconButton,{disabled:d,component:"div",sx:{padding:"0","&:hover:not([disabled])":{color:J=>J.palette.primary.main},color:J=>J.palette.text.icon??J.palette.action.active,"& svg":{width:"18px",height:"18px"}},"aria-label":"addTab",size:"small",onMouseDown:J=>{J.button===0&&J.preventDefault()},onClick:()=>I(),children:e.jsx(w.DynamicIcon,{iconKey:"AddCircle"})})}),[d,R,I]);return e.jsxs(B.Box,{ref:i,className:ie(b),sx:{position:"relative",display:"flex",alignItems:"stretch",flex:"1 1 100%",maxWidth:"100%",...S},...v,children:[e.jsx(oe.TabStrip,{ref:_,selectedTabIndex:T,tabNames:N,onSelectedTabIndexChange:z,onTabNameChange:O,onTabMove:H,background:m,borderColor:h,borderWidth:x,activeColor:null,disabled:d,disableDrag:R,createScrollStartButton:y.createScrollStartButton,createScrollEndButton:y.createScrollEndButton,createScrollEdgeButton:y.createScrollEdgeButton,createTabButton:Se,createTabDivider:J=>{const{key:K,...te}=J;return e.jsx(y.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:de=>q.alpha(de.palette.divider,.25)},...te},K)},editLabelProps:{readOnly:R,maxLength:31,styleHover:{fontWeight:"700"},onKeyPress:J=>{o.isValidSheetNameCharacter(J.key)||J.preventDefault()},onCancel:()=>{s?.(T)}},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:X?"":"List all sheets",children:e.jsx(y.ExhibitIconButton,{sx:{padding:"0px",ml:.5,mr:0,mt:0,mb:0,"& svg":{transform:"scale(0.8, 1)"},color:J=>J.palette.text.icon??J.palette.action.active},ref:ee,dense:!0,outlined:!1,selected:X,color:"primary","aria-label":"menu",onMouseDown:J=>{J.button===0&&J.preventDefault()},onClick:()=>{X?U.close(0):U.open(0)},icon:e.jsx(w.DynamicIcon,{iconKey:"Menu"})})})}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,minWidth:"4px"}}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,flex:"none",display:"flex",alignItems:"center"},children:Ce}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,flex:1,minWidth:"24px"}}),re,Y]})}));an.displayName="WorkbookStrip";const rn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,disabled:r,sx:s,floatReference:d,className:p,...l}=a,[c,g]=n.useReducer(R=>R+1,0),[C,f]=n.useState(o.getSelectedSheet()),[u,m]=n.useState(C.getSelectedRanges()),[b,S]=n.useState(C.getSelectedCell());oe.useModelListener(o,{onSheetsChange(){f(o.getSelectedSheet())}}),oe.useModelListener(C.getSelection(),{onChange(){m(C.getSelectedRanges()),S(C.getSelectedCell())}}),w.useCommands(t,[],{onChange:()=>{g()}});const x=n.useMemo(()=>({}),[]),h=n.useMemo(()=>({commandHook:{beforeExecute:(R,N)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,scope:"contextMenu",parentFloat:d}),[r,d]),k=n.useMemo(()=>({...x,...h,variant:w.CommandButtonType.Menuitem}),[x,h]),j=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:d,...h}),[t,h,d]),v=[];let T=u.isEntireRows(),M=u.isEntireColumns();u&&(T&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideColumns"),...k,key:"context:"+v.length}))),M&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideRows"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideRows"),...k,key:"context:"+v.length}))),(T||M)&&v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),T&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...k,command:t.getCommand("resizeColumns"),key:"context:"+v.length}))),M&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitRows"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...k,command:t.getCommand("resizeRows"),key:"context:"+v.length}))));const P=[],D=t.getCommand("formatTableStyle"),F=D?.context()?.table();if(w.useCommand(D),!T&&!M){if(P.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+P.length)),b?.getHyperlink())P.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+P.length,quickCommand:"openHyperlink"}));else{const R=t.getCommand("updateHyperlink");P.push(n.createElement(y.CommandButton,{command:R,...k,key:"contextBefore:"+P.length}))}if(b?.getComments())P.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+P.length,quickCommand:"updateComments"}));else{const R=t.getCommand("updateComments");P.push(n.createElement(y.CommandButton,{command:R,...k,key:"contextBefore:"+P.length}))}F?P.push(n.createElement(y.SimpleCommandPopupButton,{...j,variant:w.CommandButtonType.Menuitem,key:"contextBefore:"+P.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:F,quickCommand:"editTable"})):P.push(n.createElement(y.CommandButton,{command:t.getCommand("insertTable"),...k,key:"context:"+v.length})),P.push(n.createElement(dn,{...j,key:"contextBefore:"+P.length}))}const E=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:t.getCommand("cut"),...k}),e.jsx(so,{command:t.getCommand("copy"),...k}),e.jsx(_o,{command:t.getCommand("paste"),...j,includePasteAllInPopup:!1}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx($o,{...j}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(zo,{commands:t,...j,disableSheet:!0}),e.jsx(Ho,{commands:t,...j,disableSheet:!0}),e.jsx(Lo,{...j}),P,v]});return e.jsx(B.Box,{ref:i,className:ie("menu",p),sx:{...s},...l,children:E})}));rn.displayName="WorkbookContextMenu";const so=n.memo(n.forwardRef((a,i)=>{const{command:o,...t}=a,r=w.useEditMode(),[s,d]=n.useState(!1),[p,l]=n.useState("info");return n.useEffect(()=>{const c=r.getMode();d(c?.key==="copy"||c?.key==="cut"),l(c?.key==="cut"?"warn":"accent")},[r]),e.jsx(y.CommandButton,{ref:i,command:o,icon:e.jsx(w.DynamicIcon,{iconKey:"copy.walking",sourceProps:{isWalking:s,themedType:p}}),...t})})),Br=n.memo(n.forwardRef((a,i)=>{const{movable:o,commands:t,disabled:r,sx:s,floatReference:d,...p}=a;oe.useModelListener(o,{onAnyChange(u){}});const l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(u,m)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),g=n.useMemo(()=>({variant:w.CommandButtonType.Menuitem,...l,...c}),[l,c]),C=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:d,...c}),[t,c,d]),f=e.jsxs(e.Fragment,{children:[e.jsx(so,{command:t.getCommand("copy"),...g,variant:w.CommandButtonType.Menuitem}),[],e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["moveToFront","moveForward"],quickCommand:"moveToFront"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["moveToBack","moveBackward"],quickCommand:"moveToBack"}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:t.getCommand("toggleLockAspectRatio")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["formatDrawAlignLeft","formatDrawAlignCenter","formatDrawAlignRight",null,"formatDrawAlignTop","formatDrawAlignMiddle","formatDrawAlignBottom",null,"formatDrawDistributeHorz","formatDrawDistributeVert"],label:"Align",icon:"DrawAlignLeft",tooltip:"Quickly change the placement of your drawings."}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["formatAnchorTypeTwoCell","formatAnchorTypeOneCell","formatAnchorTypeAbsolute"],label:"Sizing",icon:"DrawResize",tooltip:"Determine how the drawing size will adjust as the cell sizes adjust."}),[]]});return e.jsx(B.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",...s},...p,children:f})}));Br.displayName="MovableContextMenu";const Cl=a=>e.jsx(Br,{...a}),Sl=a=>e.jsx(rn,{...a}),wl=a=>e.jsx(Jo,{...a}),kl=(a,i)=>e.jsx(Qo,{ref:i,...a}),vl=a=>e.jsx(y.LoadingPanel,{...a}),jl=(a,i)=>e.jsx(oe.SheetElement,{ref:i,...a}),Tl=a=>e.jsx(Xo,{...a}),El=a=>e.jsx(an,{...a}),Bl={fireOnModelChange:!1},sa={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},ln=n.memo(n.forwardRef((a,i)=>{const{workbook:o,createWorkbookOptions:t,onNewWorkbook:r,onElementLoad:s,autoFocus:d=!1,sx:p,style:l,className:c,onFocus:g,onBlur:C,onKeyDown:f,onRepeatCommandChange:u,commands:m,showFormulaBar:b,formulaBarProps:S,renderFormulaBar:x=kl,showTabs:h,tabsProps:k,renderTabs:j=El,showStatusBar:v,statusBarProps:T,renderStatusBar:M=Tl,toolbarProps:P,renderToolbar:D=vr,contextMenuSx:F,renderContextMenu:E=Sl,renderFilterMenu:R=wl,renderMovableMenu:N=Cl,renderLoadingPanel:z=vl,loadingPanelProps:O,sheetProps:H,renderSheet:I=jl,mainWrapper:W,showHorizontalScrollbar:ee,showVerticalScrollbar:X,gridTheme:ne,headersTheme:$,enableDarkImages:U,...Y}=a,_=q.useTheme(),L=oe.useDocThemes(),G=n.useMemo(()=>{const V={theme:L.getDefaultTheme(),...t};return o??new A.Workbook(V)},[o]),Q=n.useRef(null),[fe,re]=n.useState(!1),me=n.useRef(null),Se=n.useMemo(()=>e.jsx(B.Box,{className:"sheetxl-viewport",sx:{width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",pointerEvents:"none !important","& > :first-of-type":{position:"relative"}},ref:me}),[]),[Ce,J]=n.useState(!1),[K,te]=n.useState(!1),de=n.useCallback(()=>{J(!0)},[]),ve=n.useRef(null),se=w.useImperativeElement(i,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>G,getSheetElement:()=>Q.current,getViewportElement:()=>me.current,getFormulaBarElement:()=>ve.current,focus(){Q&&Q.current&&Q.current.focus()}}),[G]),De=n.useRef(null);n.useLayoutEffect(()=>{!Ce||!se.current||(async()=>(De.current!==s&&(await s?.({source:se.current}),De.current=s),te(!0)))()},[Ce,se.current]),Qn(se.current);const Te=n.useCallback(V=>(Q.current?.submitEdit(),!0),[]),Ne=n.useCallback(()=>{requestAnimationFrame(()=>{Q?.current?.focus()})},[]),[ue,Z]=n.useState(G?.getSelectedSheet()),[le,Ke]=n.useState(G?.getProtection());oe.useModelListener(G,{onSheetsChange:V=>{Z(V?.getSelectedSheet())},onViewChange(V){Z(V?.getSelectedSheet())},onProtectionChange:V=>{Ke(V?.getProtection())}}),oe.useModelListener(G,{onRequestSelect:async(V,ae)=>new Promise(he=>{Q.current.getSheet()!==ae?Q.current.getGridElement()?.onViewChangeOnce(()=>{Q.current.getSheet()!==ae&&he(!1),he(!0)}):he(!0)})},Bl);const[ni,ht]=n.useReducer(V=>V+1,0),tt=G?.getView();oe.useModelListener(tt,{onViewChange:V=>{ht()}});const gt=ne??_,we=n.useMemo(()=>Io(_,gt),[_,gt]),hn=$??_,ai=n.useMemo(()=>Io(_,hn),[_,hn]),[gn,ri]=n.useState(null);n.useCallback(()=>{Q.current.focus()},[]);const pe=Tr({workbook:G,workbookElement:se.current,target:()=>Q.current,commands:m,darkMode:we.body.darkMode,onNewWorkbook:r}),xt=n.useRef(null),[uo,xn]=n.useState(!1),[bn,yn]=n.useState(null),[Cn,ii]=n.useState(w.ToolTipPlacement.Top),[bt,li]=n.useState(A.TypesUtils.EmptyBounds),mo=n.useCallback(()=>{xn(!1),yn(null)},[]),yt=n.useCallback((V,ae,he=w.ToolTipPlacement.Top)=>{li(V),ii(he),yn(ae),xt.current!==null&&setTimeout(()=>{xt.current!==null&&xt.current.update()},160),xn(!0)},[]),[ps,Sn]=n.useState("sheet"),Ue=h??tt?.isShowTabs(),qe=ee??tt?.isShowHorizontalScrollbar(),si=b??tt?.isShowFormulaBar(),zt=v??tt?.isShowStatusBar(),wn=X??tt?.isShowVerticalScrollbar(),ot=we?.header?.edgeStrokeFill||"rgb(171,171,171)",ci=n.useMemo(()=>zt?M({sheet:ue,gridStyle:we,...T}):null,[M,T,zt,we,ue]),di=n.useMemo(()=>D({commands:pe,workbook:se.current,...P}),[pe,D,P,_]),[ui,{width:po}]=Ve(),Ge=po===0||po>560,fo=n.useMemo(()=>{if(!Ue)return null;let V=j({background:we.body.fill,borderWidth:1,borderColor:ot,gridTheme:gt,gridStyle:we,onBeforeUserChange:Te,onUserChange:Ne,workbook:G,commands:pe,sheetTabProps:{},...k});return Ge||(V=e.jsx("div",{style:{flex:"none",display:"flex"},children:V})),V},[j,k,_,G,gt,Ge,pe,Ue]),kn=n.useCallback(V=>{const{style:ae,...he}=V;let be=null,Ee=null,ye=null;if(qe&&(Ee=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${ot} 1px`,flexDirection:"column",justifyContent:"center"},children:e.jsx(oe.SheetScrollbar,{...he,style:{paddingLeft:"4px",paddingRight:"4px",...ae},endGap:700,sheet:ue,onShowTooltip:ke=>{yt({x:ke.anchor.x,y:ke.anchor.y,width:0,height:0},ke.display,ke.placement)},onCloseTooltip:()=>mo()})})),Ue&&Ge&&(ye=fo),Ue&&Ge&&!qe&&(ye=e.jsxs(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[ye,e.jsx(B.Box,{sx:{borderTop:`solid ${ot} 1px`,flex:"1"}})]})),ye&&qe)be=e.jsx(w.SplitPane,{position:G.getView().getTabRatio()/10+"%",onPositionChange:({percent:ke})=>{G.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='${_.palette.text.icon??_.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 ${ot} 1px`,borderBottom:"solid 3px transparent"}},elementBefore:ye,elementAfter:Ee});else if(qe)be=Ee;else{if(!ye)return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:zt?null:`solid ${ot} 1px`}});be=ye}return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:be})},[ue,Te,G,we,gt,pe,Ue,qe,zt,Ge]),[Pe,Ct]=n.useState(null),mi=n.useMemo(()=>({placement:"right-start",...Pe?.popperProps}),[Pe?.popperProps]),{reference:vn,component:pi}=y.useFloatStack({label:"contextMenu",popperProps:mi,anchor:Pe?.anchor??{getBoundingClientRect:()=>new DOMRect(Pe?.clientX||0,Pe?.clientY||0)},onClose:()=>Ct(null),createPopupPanel:Pe?.createPopupPanel});n.useEffect(()=>{Pe?vn.open(0):vn.close(0)},[Pe]);const fi=w.useCallbackRef((V,ae)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Pe&&Pe.anchor===V.currentTarget?Ct(null):Ct({anchor:V.currentTarget,popperProps:{offsets:[-4,2]},createPopupPanel:he=>{const{floatReference:be}=he;return R({filter:ae,commands:pe,floatReference:be,sx:{...F}})}})},[R,F,pe,G,Pe]),jn=w.useCallbackRef(V=>{if(V.originalEvent?.isDefaultPrevented())return!0;V.originalEvent?.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:ae=>{const{floatReference:he}=ae;return E({commands:pe,workbook:G,floatReference:he,sx:{...F}})}})},[E,F,pe,G]),hi=w.useCallbackRef((V,ae)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:he=>{const{floatReference:be}=he;return N({movable:ae,commands:pe,floatReference:be,sx:{...F}})}})},[N,F,pe]);n.useMemo(()=>{const V=[new w.SimpleCommand("openContextMenu",()=>Q.current,{label:"Context Menu",description:"Open the context menu.",shortcut:[{key:"F10",modifiers:[w.KeyModifiers.Shift]},{key:"ContextMenu"}]})];pe.addCommands(V,!0)},[pe]),n.useEffect(()=>{pe.getCommand("openContextMenu").updateCallback(()=>{const V=ue.getSelection().getCoords().cell;Q.current?.getGridElement()?.scrollCellCoordsIntoView(V).then(ae=>{requestAnimationFrame(()=>{const he=ue.getView().getZoomScale()/100,be=ue.getColumnHeaders().findOffset(V.colIndex+1)*he,Ee=ue.getRowHeaders().findOffset(V.rowIndex+1)*he,ye=Q.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};jn({clientX:be-ye.x-ae.left+6,clientY:Ee-ye.y-ae.top+6})})})})},[ue]);const gi=w.useCallbackRef(V=>{pe?.dispatchToFocusedCommand(V)},[pe]),xi=w.useCallbackRef(()=>{Qn(se.current)},[G,se.current]),bi=n.useCallback(()=>{Sn("sheet")},[]),yi=n.useCallback(()=>{Sn("formulaBar")},[]),Ci=w.useCallbackRef(V=>{const{style:ae,...he}=V;return e.jsx(oe.SheetScrollbar,{style:{...ae,paddingTop:"4px",paddingBottom:"4px"},...he,sheet:ue,endGap:700,onShowTooltip:be=>{yt(be.anchor,be.display,w.ToolTipPlacement.Left)},onCloseTooltip:()=>mo()})},[ue]);n.useEffect(()=>{d&&Q&&Q.current&&Q.current.focus()},[]);const[Ht,ho]=n.useState(null),go=n.useCallback(V=>{pe?.getCommand("openWorkbook")&&(V.type==="dragenter"||V.type==="dragover"?V.dataTransfer?.types.includes("Files")?V.dataTransfer.files[0]?.type?.startsWith("image/")||V.dataTransfer.items[0]?.type?.startsWith("image/")||V.dataTransfer.types.length===1&&ho("Drop to open"):(V.dataTransfer?.types.includes("text/html")||V.dataTransfer?.types.includes("text/plain"),V.dataTransfer.effectAllowed="none",V.dataTransfer.dropEffect="none"):V.type==="dragleave"&&ho(null),V.preventDefault())},[pe]),Si=w.useCallbackRef(V=>{if(pe?.getCommand("openWorkbook")&&(V.preventDefault(),V.stopPropagation(),ho(null),V.dataTransfer.files&&V.dataTransfer.files.length>0)){const ae=V.dataTransfer.files[0];if(!ae)return;if(ae?.type?.startsWith("image/")){const he=Q.current?.getGridElement().getViewFromClient(V.clientX,V.clientY);if(!he)return;const be=he.getRelativePointFromClient(V.clientX,V.clientY),Ee=he.toAbsoluteBounds({...be,width:0,height:0}),ye=he.getCellCoordsFromClient(V.clientX,V.clientY);if(!ye)return;pe?.getCommand("insertImageFromFile")?.execute({file:ae,options:{bounds:{x:Ee.x,y:Ee.y}},goto:{range:{...ye}}})}else pe?.getCommand("openWorkbook")?.execute(ae)}},[pe,Ht]),wi=n.useMemo(()=>Ht?e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"100%",boxSizing:"border-box",pointerEvents:"none",display:"flex",justifyContent:"center",alignItems:"center",background:V=>V.palette.divider,color:V=>V.palette.primary.dark},children:e.jsx(B.Typography,{variant:"h4",children:Ht})}):null,[Ht]),Tn=n.useRef(null),ki=n.useMemo(()=>e.jsx(Fo,{in:!K,nodeRef:Tn,timeout:500,classNames:"animating",unmountOnExit:!0,children:e.jsx(B.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",left:"0px",top:"0px",width:"100%",height:"100%",pointerEvents:K?"none":p?.pointerEvents,position:"absolute",boxSizing:"border-box"},children:z({ref:Tn,transitionDelay:"0",transparentBackground:!1,sx:{opacity:K?0:p?.opacity,pointerEvents:K?"none":p?.pointerEvents,position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%",...O}})})}),[K,z,O]),vi=n.useMemo(()=>x({sx:{marginTop:V=>V.spacing(.25),marginLeft:V=>V.spacing(1),marginRight:V=>V.spacing(1)},workbook:G,sheetElement:Q.current,gridStyle:we,onFocus:yi,...S,NamedCollectionEditorProps:{restoreFocus:V=>Q.current.focus(V),...S?.NamedCollectionEditorProps,commandPopupButtonProps:{commands:pe,...S?.NamedCollectionEditorProps?.commandPopupButtonProps}}},ve),[x,S,G,we,pe,K]),ji=n.useCallback(V=>{const{movable:ae,...he}=V,be={movable:ae,onContextMenuCapture:ke=>{hi(ke,ae)},...he},Ee=ae.getContent().getType();let ye=null;if(Ee==="picture")return e.jsx(oe.PictureEditor,{loadingPanel:e.jsx(y.LoadingPanel,{transitionDelay:"100",style:{position:"absolute"},sx:{border:ke=>`solid 1px ${ke.palette.action.active}`}}),picture:ae.getContent(),description:ae.getDescription()??ae?.getName(),...be});if(Ee==="chart"){const ke={...be,chart:ae.getContent()};return e.jsx(oe.ChartEditor,{...ke})}if(ye=`Float of type '${Ee}'.`,typeof ye=="string"){const ke={...be,description:ye};ye=e.jsx(oe.EmptyFrame,{...ke})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:ye},ae.getUUID())},[]),En=n.useMemo(()=>I({style:sa,onFocus:bi,gridStyle:we,headersStyle:ai,sheet:ue,commands:pe,onSheetContextMenu:jn,onViewportChange:V=>{ri(V)},showScrollbars:!1,viewportComponent:Se,onRepeatCommandChange:u,onElementLoad:de,onShowColumnTooltip:V=>{yt(V.anchor,V.display,w.ToolTipPlacement.Top)},onShowRowTooltip:V=>{yt(V.anchor,V.display,w.ToolTipPlacement.Right)},onShowTooltip:V=>{yt({x:V.anchor.x,y:V.anchor.y,width:0,height:0},V.display,V.placement)},onCloseTooltip:()=>mo(),renderMovable:ji,...H,cellRenderProps:{onFilterButtonMouseDown:(V,ae)=>{H?.cellRenderProps?.onFilterButtonMouseDown(V,ae),fi(V,ae)},...H?.cellRenderProps}},Q),[pe,H,ue,we,u]),Ti=n.useMemo(()=>{let V=e.jsx(w.ScrollPane,{ref:ui,style:sa,viewport:gn,touchElement:Q.current?.getGridElement()?.stage,onScrollViewport:ae=>{Q.current?.getGridElement()?.scrollTo(ae)},showHorizontalScrollbar:qe||Ue,showVerticalScrollbar:wn,createHorizontalScrollbar:kn,createVerticalScrollbar:Ci,children:En});return Ge||po===0||(V=e.jsxs(e.Fragment,{children:[V,fo]})),W?W(V):V},[qe,Ue,kn,wn,gn,Ge,En,fo,_,W]),Ei=n.useMemo(()=>e.jsx(y.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:uo,title:e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:bn}),placement:Cn,slotProps:{transition:{timeout:{exit:0}},popper:{popperRef:xt,sx:{"& .MuiTooltip-tooltip":{padding:"2px 6px","& .MuiTooltip-arrow":{display:uo?"visible":"none"}}},anchorEl:{getBoundingClientRect:()=>new DOMRect(bt.x,bt.y,bt.width,bt.height)},modifiers:[{name:"offset",options:{offset:[0,0]}}]}},children:e.jsx(B.Box,{})}),[uo,bn,Cn,bt,xt]),Bi=n.useMemo(()=>({boxSizing:"border-box",background:V=>V.palette.mode!=="dark"?we.header.fill:V.palette.background.paper,"& *":{...y.scrollbarTheming(_),fontWeight:400},"&.Mui-focusVisible":{},"& .viewport-overlay":{borderRight:`solid ${ot} 1px`},...p}),[p,we]),Ri=n.useMemo(()=>e.jsx(B.Box,{sx:{marginBottom:V=>V.spacing(.75)}}),[]),Pi=n.useMemo(()=>({flex:"1 1 100%",width:"100%",display:"flex",flexDirection:"column",opacity:K?void 0:0,"--sxl-app-color-high-contrast":_.palette.primary.main,"--sxl-app-color-primary":_.palette.primary.main,"--sxl-app-color-primary-dark":_.palette.primary.dark,"--sxl-app-color-primary-light":_.palette.primary.light,"--sxl-app-color-info":_.palette.info.main,"--sxl-app-color-info-dark":_.palette.info.dark,"--sxl-app-color-info-light":_.palette.info.light,"--sxl-app-color-secondary":_.palette.secondary.main,"--sxl-app-color-secondary-dark":_.palette.secondary.dark,"--sxl-app-color-secondary-light":_.palette.secondary.light,"--sxl-app-color-success":_.palette.success.main,"--sxl-app-color-success-dark":_.palette.success.dark,"--sxl-app-color-success-light":_.palette.success.light,"--sxl-app-color-warning":_.palette.warning.main,"--sxl-app-color-warning-dark":_.palette.warning.dark,"--sxl-app-color-warning-light":_.palette.warning.light,"--sxl-app-color-error":_.palette.error.main,"--sxl-app-color-error-dark":_.palette.error.dark,"--sxl-app-color-error-light":_.palette.error.light,"--sxl-app-color-text":_.palette.text.primary,"--sxl-app-color-text-secondary":_.palette.text.secondary,"--sxl-app-color-text-disabled":_.palette.text.disabled,"--sxl-app-color-background":_.palette.background.paper,"--sxl-app-color-button-surface":_.palette.grey[600],"--sxl-app-color-shadow":_.palette.action.focus,"--sxl-app-color-grey":_.palette.grey[500],"--sxl-app-filter-dark-invert":we.body.darkMode&&U?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":we.body.darkMode?`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`:void 0}),[we,_,K]),Mi=n.useMemo(()=>ie(Xa),[]);return e.jsxs(B.Paper,{className:ie("sheetxl-workbook",gl,{"Mui-focusVisible":fe},hl,c),sx:Bi,style:l,square:!1,...Y,ref:se,onFocus:V=>{re(!0),xi(),g?.(V)},onBlur:V=>{re(!1),C?.(V)},onKeyDown:V=>{gi(V),f?.(V)},onDragStart:V=>{if(V.target.src){const ae=new Image;ae.src=V.target.src,V.dataTransfer.setDragImage(ae,1,1)}},onDragEnter:go,onDragLeave:go,onDragOver:go,onDrop:Si,children:[e.jsxs("div",{className:Mi,style:Pi,children:[di,si?vi:null,Ri,Ti,ci,Ei,pi,wi]}),ki]})}));ln.displayName="WorkbookElement";const Rl=(a=!1,i=!1)=>i?null:{"& input:not(:focus):not(:hover)":{color:o=>o.palette.text.secondary},backgroundColor:o=>q.alpha(o.palette.background.paper,.6),borderRadius:o=>`${o.shape.borderRadius}px`,border:o=>`solid ${a?o.palette.divider:"transparent"} 1px`,"&.Mui-disabled":{border:o=>`solid ${a?o.palette.divider:"transparent"} 1px`},"&:focus-within:not([disabled])":{backgroundColor:o=>o.palette.background.paper},"&:hover:not([disabled])":{border:o=>`solid ${a?o.palette.text?.primary:o.palette.divider} 1px`,backgroundColor:null},"&.Mui-focusVisible":{outline:o=>`solid ${o.palette.primary.main} 1px !important`,border:o=>`1px solid ${o.palette?.primary?.main} !important`}},sn=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,title:r="",placeHolder:s="Untitled",onTitleChange:d,readOnly:p=!1,hidden:l,...c}=a,[g,C]=n.useState(!1),[f,u]=n.useState(!1),[m,b]=n.useState(r??""),[S,x]=n.useState(""),[h,{width:k}]=Ve(),[j,{width:v}]=Ve(),[T,M]=n.useState(!1),P=n.useRef(null),D=n.useRef(null),F=w.useImperativeElement(i,()=>({requestWorkbookTitle:(E=null,R)=>{D.current={onAccept:E,requestReason:R?.requestReason},R?.selectAll&&P.current?.select(),P.current?.focus(R)},focus:E=>{P.current?.focus(E)}}),[]);return n.useLayoutEffect(()=>{M(r!==m),x(r),b(r)},[r]),n.useEffect(()=>{T&&k!==0&&je.CommonUtils.debounce(()=>{M(!1)},300)()},[T,k]),n.useEffect(()=>{u(m&&!ct.IOUtils.isValidWindowsFilename(m))},[m]),l?null:e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",opacity:T?"0":"1",transition:T?void 0:"opacity .25s ease-in","& .tooltip-wrapper":{maxWidth:"100%"}},ref:et([F,j,i]),...c,children:e.jsx(y.ExhibitTooltip,{label:D.current?.requestReason??"Workbook Name",children:e.jsxs(B.Box,{className:ie({"Mui-focusVisible":g}),sx:{visibility:k===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",...Rl(!0,p),...o},children:[p?e.jsx(B.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:m!==S?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:E=>f?E.palette.error.dark:void 0},children:r??s}):e.jsx(B.Input,{sx:{width:`${Math.min(k+3,Math.max(v,F.current?.getBoundingClientRect()?.width))}px`,overflow:"hidden",whiteSpace:"nowrap",fontWeight:"600",maxWidth:"100%",border:"none",padding:"0px",margin:"0px",color:E=>f?E.palette.error.dark:void 0,fontStyle:m!==S?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:p,spellCheck:!1,placeholder:s,onFocus:E=>{C(!0),E.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:P},onBlur:()=>{C(!1),f?b(S):(m!==S&&(d?.(m),m&&D.current?.onAccept?.(m,"blur")),D.current=null)},onChange:E=>{if(E.target.value.length>ct.IOUtils.MAX_WORKBOOK_NAME_SIZE)return E.stopPropagation(),void E.preventDefault();b(E.target.value)},onKeyDown:E=>{(ct.IOUtils.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(E.key)||E.target?.value.length>ct.IOUtils.MAX_WORKBOOK_NAME_SIZE)&&E.preventDefault(),E.which===w.KeyCodes.Enter||E.which===w.KeyCodes.Tab?(f?b(S):(d?.(m),m&&(D.current?.onAccept?.(m,"keydown"),D.current=null)),E.stopPropagation(),E.preventDefault(),t?.focus()):E.which===w.KeyCodes.Escape&&(m===S?t?.focus():(b(S),setTimeout(()=>{E.target?.select()},0)),D.current=null,E.stopPropagation(),E.preventDefault())},value:m}),e.jsx(B.Box,{ref:h,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:m!==S?"italic":void 0,fontFamily:E=>E.typography.fontFamily,letterSpacing:"0.00938em"},children:m||s})]})})})}));sn.displayName="WorkbookTitle";const Rr=n.memo(n.forwardRef((a,i)=>{const{title:o,commands:t,className:r,...s}=a,d=w.useNotifier(),[p,l]=n.useState(!1),[c,g]=n.useState(!1),C=n.useRef(null),[f,u]=n.useReducer(P=>P+1,0),[m,{width:b}]=Ve(),S=w.useCommands(t,["editTable"])[0].context(),x=S.table(),[h,k]=n.useState(()=>x?S.getNames().getRanges(x.getRange()):null),j=n.useMemo(()=>x?.getName()??"",[x]);oe.useModelListener(S.table(),{onAnchorCoordsChange(P){k(S.getNames().getRanges(P.getRange()))},onProtectedChange(P){u()}});const v=w.useCallbackRef(P=>{S?.table().setName(P)},[S]),T=w.useCallbackRef(P=>{S?.table().resize(P.at(0))},[S]);let M=null;return S.table()||(M=e.jsx(B.Typography,{component:"div",style:{top:"0",left:"0",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyItems:"center",justifyContent:"center"},children:"No table selected"})),e.jsx(B.Paper,{square:!0,onFocus:()=>l(!0),onBlur:P=>{C?.current?.contains(P.relatedTarget)||l(!1)},ref:et([C,m,i]),sx:{display:"flex",flexDirection:"column",flex:"1 1 auto",width:"100%",height:"100%",overflow:"auto",paddingLeft:P=>P.spacing(1.5),paddingRight:P=>P.spacing(1.5),paddingTop:P=>P.spacing(1.5),paddingBottom:P=>P.spacing(1.5),boxSizing:"border-box"},className:ie("sxl-table-details-panel",r,{"sxl-has-focus":p}),...s,children:M||e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 auto",flexDirection:"column",transition:"opacity 60ms",opacity:S.table()?1:0},children:[e.jsx(B.Box,{sx:{containerType:"inline-size",display:"flex",flexDirection:"column",maxWidth:"100%",boxSizing:"border-box",paddingTop:P=>P.spacing(2),paddingLeft:P=>P.spacing(2),paddingRight:P=>P.spacing(2)},children:e.jsxs(B.Box,{className:Yi,children:[e.jsx(Uo,{formName:"name",defaultInput:j,value:x?.getName()??"No table",onChangeInput:v,onValidate:P=>{x&&x.getName().toLowerCase()===P.toLowerCase()||S?.getNames().validateName(P)},disabled:x?.isProtected()??!0,onFocus:P=>{c||P.target?.select(),g(!0)}}),e.jsx(qo,{formName:"range",value:h,onChangeInput:T,resolvedAddress:S.getNames().getRanges.bind(S.getNames()),disabled:x?.isProtected()??!0,onFocus:P=>{c||P.target?.select(),g(!0)}})]})}),e.jsxs(B.Box,{sx:{minHeight:"10px",flex:"1 1 100%",display:"flex",flexDirection:"column",containerType:"inline-size",gap:P=>P.spacing(.5),marginTop:P=>P.spacing(1)},children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:P=>P.spacing(1.5),marginBottom:P=>P.spacing(.75)}}),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",justifyContent:"start",flexDirection:"column",marginTop:P=>P.spacing(1),marginBottom:P=>P.spacing(1)},children:e.jsxs("div",{style:{display:"flex",alignItems:"start",gap:"2px"},children:[e.jsx(Ko,{table:x,styles:S.styles(),bodyStyle:S.bodyStyle(),cellHeight:30,isLive:!0}),e.jsx(cn,{command:t.getCommand("formatTableStyle"),commands:t,disabledQuickKey:!0})]})}),e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:P=>P.spacing(1.5),marginBottom:P=>P.spacing(.75)}}),e.jsx(Za,{disabled:x?.isProtected(),styleOptions:x?.getStyleOptions()??null,onStyleOptionsChange:P=>{x.updateStyleOptions(P)},showHeaderRow:x?.getShowHeaders(),onShowHeaderRowChange:P=>{try{x.setShowHeaders(P)}catch(D){d.showError(D)}},showTotalRow:x?.getShowTotals(),onShowTotalRowChange:P=>{try{x.setShowTotals(P)}catch(D){d.showError(D)}},showFilterButton:x?.getFilter()?x.getShowFilterButton():null,onShowFilterButtonChange:P=>{try{x.setShowFilterButton(P)}catch(D){d.showError(D)}}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsxs(B.Box,{className:Zi,children:[e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,command:t.getCommand("convertTableToRange"),commandState:x}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:x,command:t.getCommand("deleteTable")})]})]})]})})})),Pr=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...d}=a;return e.jsx(Rr,{ref:i,commands:t,...d})},Mr=()=>{w.DefaultDynamicIconService.register("plugin-table",{icons:{}}),oe.DefaultTaskPaneRegistry.registerTaskPane({key:"tableDetails",getTitle:()=>"Table Details",getIcon:()=>"Table",renderTaskPane:Pr},!0)},Pl=n.memo(a=>{const{table:i,tableStyle:o,selectedTableStyleName:t,onSelectTableStyleName:r,styles:s,hasContextMenu:d=!0,bodyStyle:p,parentFloat:l,commands:c,disabled:g,commandHook:C,useCanvasPreview:f=!0,canvas:u,...m}=a,b=n.useCallback(k=>{const j={variant:w.CommandButtonType.Menuitem,commandHook:C,context:"table"},v=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...j,command:c.getCommand("formatTableStyleClearCellStyles"),commandState:o,disabled:g}),e.jsx(y.CommandButton,{...j,style:{fontWeight:550},command:c.getCommand("formatTableStyle"),commandState:{name:o.getName()},disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:c.getCommand("setDefaultTableStyle"),commandState:o.getName(),disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:c.getCommand("deleteTableStyle"),commandState:o?.getName(),disabled:g||!o||o.isBuiltIn()})]}),T=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:v})});return y.defaultCreatePopupPanel({...k,children:T})},[c]),S=o?.getName()===t,x=n.useMemo(()=>{const k={table:i,tableStyle:o,styles:s,bodyStyle:p};return f?e.jsx(Ya,{canvas:u,...k}):e.jsx(Ko,{...k})},[i,o,s,p]);let h=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:k=>`solid ${S?k.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName()??"None",placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{r?.(o?.getName())},...m,children:x},o.getName());return d&&(h=e.jsx(y.ContextMenu,{label:i.getStyleOptions().name,parentFloat:l,createPopupPanel:b,children:h})),h}),cn=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedTable:s,onSelectTableStyleName:d,disabled:p=!1,bodyStyle:l,disabledQuickKey:c=!1,usePreviewIcon:g=!1,...C}=a;w.useCommand(t);const f=t?.context(),u=f?.styles,m=s??f?.table?.();let b="insertTable";m&&(b="editTable");const S=n.useMemo(()=>((F,E)=>{const R={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new A.Table({initialAnchor:R,styles:E,json:{name:"PreviewTable",ref:R,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:F}})})(m?.getStyleOptions(),u?.()),[u?.().getDefaultTableStyle(),m?.getStyleOptions()]),x=m??S,[h,k]=n.useState(x);n.useEffect(()=>{k(x)},[x]);const j=l??f?.bodyStyle(),v=w.useCallbackRef(F=>{d?.(F),t?.execute({name:F},r)},[t,d,r]),T=n.useRef(null),M=n.useCallback((F,E)=>{const R={onSelectTableStyleName:v,styles:u(),parentFloat:F.floatReference};T.current||(T.current=document.createElement("canvas"));const N=$=>{const U=u().getTableStyle($);return U?e.jsx(Pl,{table:h,tableStyle:U,selectedTableStyleName:h.getStyleOptions().name,bodyStyle:f.bodyStyle(),commands:E,commandHook:r,canvas:T.current,...R},$):null},z=($,U,Y=!0)=>{const _=[];for(let L=0;L<U.length;L++){const G=N(U[L]);G&&_.push(G)}return _.length===0?null:e.jsxs(B.Box,{children:[Y?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:$},$+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"481px",maxWidth:"100%"},children:_},$+"-presets")]},$)},O=[],H=u().getCustomTableStyles(),I=[];if(H.length>0){for(let $=0;$<H.length;$++)H[$].isShownInTableStyles()&&I.push(H[$].getName());O.push(z("Custom",I,!1))}const W=[];m&&!m.getStyleOptions().name&&W.push(null);for(let $=0;$<21;$++)W.push("TableStyleLight"+($+1));O.push(z("Light",W,I.length>0));const ee=[];for(let $=0;$<28;$++)ee.push("TableStyleMedium"+($+1));O.push(z("Medium",ee));const X=[];for(let $=0;$<11;$++)X.push("TableStyleDark"+($+1));O.push(z("Dark",X));let ne=null;return m&&(ne=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,command:E.getCommand("formatTableStyleClearTableStyle"),commandHook:r,disabled:p})]})),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:$=>`${$.shape.borderRadius}px`,paddingBottom:$=>`${$.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",padding:"6px 16px"},children:O}),ne]})},[u,u?.().getTheme(),j,h]),P=p||!t||t.disabled(),D=n.useMemo(()=>{if(!f||!g)return t?.icon()},[h,j,P,t]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:c?void 0:b,createPopupPanel:M,commands:o,label:t?.label(),commandState:m,commandHook:r,selected:m!==null,createTooltip:({children:F},E)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:E,children:F}),disabled:P,icon:D,...C})})),Dr=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,selectedTheme:r,onSelectTheme:s,disabled:d=!1,darkMode:p,label:l,icon:c,variant:g,...C}=a;w.useCommand(o);const f=o?.context()?.themes,u=r||o?.context()?.theme,m=p??o?.context()?.darkMode,b=d||o?.disabled(),S=w.useCallbackRef(h=>{s?.(h),o?.execute(h,t)},[s,t]),x=n.useCallback((h,k)=>{const{children:j,title:v,...T}=h;let M=h.children;return(b||k)&&(M=e.jsx("div",{children:M})),e.jsx(y.CommandTooltip,{command:o,placement:g===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:b||k,...T,children:M})},[o,b]);return e.jsx(nr,{ref:i,themes:f,selectedTheme:u,onSelectTheme:S,variant:g===w.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:x,disabled:b,darkMode:m,...C})})),Fr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["themeMode"])[0],l=w.useCallbackRef((u,m)=>{const b={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:s},S=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...b,command:p}),e.jsx(y.CommandButton,{...b,command:m.getCommand("defaultThemeMode")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...b,command:m.getCommand("enableDarkGrid")}),e.jsx(y.CommandButton,{...b,command:m.getCommand("enableDarkImages")})]});return y.defaultCreatePopupPanel({...u,children:S})},[s,p,t,r]),c=p?.state(),g=B.useMediaQuery("(prefers-color-scheme: dark)"),C=c==="dark"||c===null&&g,f=p?.state()!==null;return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:"themeMode",commands:o,commandHook:t,createPopupPanel:l,label:"Appearance",tooltip:"Change the light/dark mode to match your viewing preference. This does not affect the view for others.",onQuickClick:()=>{p?.execute(C?"light":"dark",t)},selected:f,...d})})),Ir=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,sx:d,...p}=a,l=n.useCallback((c,g)=>{const C={variant:w.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(u,m)=>t?.beforeExecute?.(u,m)!==!1&&c.floatReference.closeAll()},disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...C,command:g.getCommand("showKeyboardShortcuts")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlGithub")}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlDiscord")}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlDocumentation")}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlIssue")})]});return y.defaultCreatePopupPanel({...c,children:f})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,sx:d,commands:o,disabled:s,commandHook:t,scope:r,label:"Help",tooltip:"Help, feedback, and keyboard shortcuts.",createPopupPanel:l,icon:e.jsx(w.DynamicIcon,{iconKey:"Help",style:{transform:"scale(0.75)"}}),...p})})),dn=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,preferSingleMenu:d=!0,showQuickButton:p=!0,variant:l=w.CommandButtonType.Toolbar,...c}=a,g=w.useCommands(o,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:C,allDisabled:f}=n.useMemo(()=>{let m=null,b=0;for(let S=0;S<g.length;S++)g[S]&&!g[S]?.disabled()&&(d&&l===w.CommandButtonType.Menuitem&&(m=b===0?g[S]:null),b++);return{singleMenuCommand:m,allDisabled:b===0}},[g]),u=n.useCallback((m,b)=>{const S={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...S,command:b.getCommand("insertImageFromFile")}),e.jsx(y.CommandButton,{...S,command:b.getCommand("insertImageFromURL")})]});return y.defaultCreatePopupPanel({...m,children:x})},[s,t,r]);return C?e.jsx(y.CommandButton,{ref:i,variant:l,commandHook:t,disabled:s,command:C,...c}):e.jsx(y.CommandPopupButton,{ref:i,variant:l,quickCommand:"insertImageFromFile",commands:o,commandHook:t,scope:r,disabled:s||f,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:u,icon:"InsertImage",...c})})),un=n.memo(n.forwardRef((a,i)=>{const{...o}=a;return e.jsx(y.SimpleCommandPopupButton,{ref:i,...o,popupCommandKeys:["insertFunctionSum","insertFunctionAverage","insertFunctionCount","insertFunctionMax","insertFunctionMin",null,"insertFunction"],quickCommand:"insertFunctionSum",popupScope:"insertFunction",label:"Quick Function",tooltip:"More functions."})}));un.displayName="InsertFunctionSumCommandPopupButton";const jo=new Map([{key:"financial",label:"Financial",icon:"FormulaFinancial"},{key:"logical",label:"Logical",icon:"FormulaLogical"},{key:"text",label:"Text",icon:"FormulaText"},{key:"dateTime",label:"Date & Time",icon:"FormulaDateTime"},{key:"lookupReference",label:"Lookup & Reference",icon:"FormulaLookupReference"},{key:"mathTrig",label:"Math & Trig",icon:"FormulaMathTrig"},{key:"statDist",label:"Statistical",icon:"FormulaStatistical"},{key:"engineering",label:"Engineering",icon:"FormulaEngineering"},{key:"information",label:"Information",icon:"FormulaInformation"},{key:"cube",label:"Cube",icon:"FormulaCube"},{key:"database",label:"Database",icon:"FormulaDatabase"},{key:"web",label:"Web",icon:"FormulaWeb"},{key:"custom",label:"Custom",icon:"FormulaCustom"}].map(a=>[a.key,a])),Ml=n.memo(a=>{const{command:i,formulaFunction:o,commandHook:t,disabled:r=!1,parentFloat:s,handleInsert:d,icon:p,label:l,sx:c,...g}=a,C=new Promise(f=>{o.getDescriptor().then(u=>{f(u.getSummary())})});return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...c},disabled:r,tooltipProps:{label:C,maxWidth:1e3},onMouseDown:f=>{f.button===0&&f.preventDefault()},onMouseUp:f=>{f.button===0&&d(o)},onKeyDown:f=>{f.keyCode===w.KeyCodes.Enter||(f.keyCode,w.KeyCodes.Space)},...g,children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",children:o.getName()})})})}),Nr=n.memo(n.forwardRef((a,i)=>{const{category:o,commands:t,commandHook:r,scope:s,sx:d,disabled:p=!1,parentFloat:l,...c}=a,g=w.useCommands(t,["insertFunction"])[0],C=n.useCallback((u,m)=>{const b=jo.get(o);if(!b)return console.warn("invalidate category",o),null;const S={commandHook:r,...u},x=e.jsx(Dl,{category:b.label,...S,commands:m});return y.defaultCreatePopupPanel({...u,children:x})},[o,g,r,s]),f=jo.get(o);return e.jsx(y.CommandPopupButton,{ref:i,commands:t,commandHook:r,createPopupPanel:C,label:f.label,tooltip:"Insert Function",icon:jo.get(o)?.icon??"FormulaGroup",...c})}));Nr.displayName="InsertFunctionCommandPopupButton";const Dl=n.memo(n.forwardRef((a,i)=>{const{commands:o,category:t,commandHook:r,...s}=a,d=w.useCommands(o,["insertFunction"]),[p,l]=n.useState([]),[c,g]=n.useState(!1);n.useEffect(()=>{(async()=>{g(!0);const S=d[0]?.context(),x=await S.searchByCategory(t);l(x),g(!1)})()},[]);const C=p.length,f=new Array(C),u=o.getCommand("insertFunction"),m=S=>{r?.beforeExecute?.(u,u?.state()),u.execute(S),r?.onExecute?.(u,u?.state())};for(let S=0;S<C;S++){const x=p[S];f[S]=e.jsx(Ml,{command:u,formulaFunction:x,handleInsert:m},`formula-${x.getName()}-${S}`)}const b=e.jsx(B.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:C>0?e.jsx(e.Fragment,{children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:f})}):null});return y.defaultCreatePopupPanel({...s,children:b})})),Or=n.memo(n.forwardRef((a,i)=>{const{sx:o,style:t,className:r,licenseKey:s,renderLoadingPanel:d,...p}=a;s&&A.LicenseManager.setLicenseKey(s);const l=n.useMemo(()=>{const g={transitionDelay:"160ms",transparentBackground:!0};return e.jsx(B.Box,{sx:o,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...t},children:d?.(g)??e.jsx(y.LoadingPanel,{...g})})},[o,t,d]),c=n.useMemo(()=>n.lazy(async()=>await Promise.resolve().then(()=>ms)),[]);return e.jsx(e.Fragment,{children:e.jsx(n.Suspense,{fallback:l,children:e.jsx(c,{...p,className:r,renderLoadingPanel:d,sx:o,style:t,ref:i})})})}));function Ar(a){var i,o,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a))for(i=0;i<a.length;i++)a[i]&&(o=Ar(a[i]))&&(t&&(t+=" "),t+=o);else for(i in a)a[i]&&(t&&(t+=" "),t+=i);return t}function _e(){for(var a,i,o=0,t="";o<arguments.length;)(a=arguments[o++])&&(i=Ar(a))&&(t&&(t+=" "),t+=i);return t}Or.displayName="Studio";let Fl={data:""},Il=a=>{if(typeof window=="object"){let i=(a?a.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return i.nonce=window.__nonce__,i.parentNode||(a||document.head).appendChild(i),i.firstChild}return a||Fl},Nl=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ol=/\/\*[^]*?\*\/| +/g,ca=/\n+/g,Qe=(a,i)=>{let o="",t="",r="";for(let s in a){let d=a[s];s[0]=="@"?s[1]=="i"?o=s+" "+d+";":t+=s[1]=="f"?Qe(d,s):s+"{"+Qe(d,s[1]=="k"?"":i)+"}":typeof d=="object"?t+=Qe(d,i?i.replace(/([^,])+/g,p=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,p):p?p+" "+l:l)):s):d!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=Qe.p?Qe.p(s,d):s+":"+d+";")}return o+(i&&r?i+"{"+r+"}":r)+t},Oe={},Lr=a=>{if(typeof a=="object"){let i="";for(let o in a)i+=o+Lr(a[o]);return i}return a},Al=(a,i,o,t,r)=>{let s=Lr(a),d=Oe[s]||(Oe[s]=(l=>{let c=0,g=11;for(;c<l.length;)g=101*g+l.charCodeAt(c++)>>>0;return"go"+g})(s));if(!Oe[d]){let l=s!==a?a:(c=>{let g,C,f=[{}];for(;g=Nl.exec(c.replace(Ol,""));)g[4]?f.shift():g[3]?(C=g[3].replace(ca," ").trim(),f.unshift(f[0][C]=f[0][C]||{})):f[0][g[1]]=g[2].replace(ca," ").trim();return f[0]})(a);Oe[d]=Qe(r?{["@keyframes "+d]:l}:l,o?"":"."+d)}let p=o&&Oe.g?Oe.g:null;return o&&(Oe.g=Oe[d]),((l,c,g,C)=>{C?c.data=c.data.replace(C,l):c.data.indexOf(l)===-1&&(c.data=g?l+c.data:c.data+l)})(Oe[d],i,t,p),d};function No(a){let i=this||{},o=a.call?a(i.p):a;return Al(o.unshift?o.raw?((t,r,s)=>t.reduce((d,p,l)=>{let c=r[l];if(c&&c.call){let g=c(s),C=g&&g.props&&g.props.className||/^go/.test(g)&&g;c=C?"."+C:g&&typeof g=="object"?g.props?"":Qe(g,""):g===!1?"":g}return d+p+(c??"")},""))(o,[].slice.call(arguments,1),i.p):o.reduce((t,r)=>Object.assign(t,r&&r.call?r(i.p):r),{}):o,Il(i.target),i.g,i.o,i.k)}function zr(a,i,o){return i&&(function(t,r){for(var s=0;s<r.length;s++){var d=r[s];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(t,d.key,d)}})(a.prototype,i),a}function ce(){return ce=Object.assign||function(a){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},ce.apply(this,arguments)}function Hr(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,a.__proto__=i}function At(a,i){if(a==null)return{};var o,t,r={},s=Object.keys(a);for(t=0;t<s.length;t++)o=s[t],i.indexOf(o)>=0||(r[o]=a[o]);return r}function da(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}No.bind({g:1}),No.bind({k:1});var ua=function(){return""},Wr=n.createContext({enqueueSnackbar:ua,closeSnackbar:ua}),To="@media (max-width:599.95px)",to="@media (min-width:600px)",ma=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},mn=function(a){return""+ma(a.vertical)+ma(a.horizontal)},qt=function(a){return!!a||a===0},Gt="unmounted",at="exited",rt="entering",Bt="entered",pa="exiting",pn=(function(a){function i(t){var r;r=a.call(this,t)||this;var s,d=t.appear;return r.appearStatus=null,t.in?d?(s=at,r.appearStatus=rt):s=Bt:s=t.unmountOnExit||t.mountOnEnter?Gt:at,r.state={status:s},r.nextCallback=null,r}Hr(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Gt?{status:at}:null};var o=i.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==rt&&s!==Bt&&(r=rt):s!==rt&&s!==Bt||(r=pa)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t=this.props.timeout,r=t,s=t;return t!=null&&typeof t!="number"&&typeof t!="string"&&(s=t.exit,r=t.enter),{exit:s,enter:r}},o.updateStatus=function(t,r){t===void 0&&(t=!1),r!==null?(this.cancelNextCallback(),r===rt?this.performEnter(t):this.performExit()):this.props.unmountOnExit&&this.state.status===at&&this.setState({status:Gt})},o.performEnter=function(t){var r=this,s=this.props.enter,d=t,p=this.getTimeouts();t||s?(this.props.onEnter&&this.props.onEnter(this.node,d),this.safeSetState({status:rt},function(){r.props.onEntering&&r.props.onEntering(r.node,d),r.onTransitionEnd(p.enter,function(){r.safeSetState({status:Bt},function(){r.props.onEntered&&r.props.onEntered(r.node,d)})})})):this.safeSetState({status:Bt},function(){r.props.onEntered&&r.props.onEntered(r.node,d)})},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts();r?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:pa},function(){t.props.onExiting&&t.props.onExiting(t.node),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:at},function(){t.props.onExited&&t.props.onExited(t.node)})})})):this.safeSetState({status:at},function(){t.props.onExited&&t.props.onExited(t.node)})},o.cancelNextCallback=function(){this.nextCallback!==null&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(){s&&(s=!1,r.nextCallback=null,t())},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=t==null&&!this.props.addEndListener;this.node&&!s?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),t!=null&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Gt)return null;var r=this.props;return(0,r.children)(t,At(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},zr(i,[{key:"node",get:function(){var t,r=(t=this.props.nodeRef)===null||t===void 0?void 0:t.current;if(!r)throw new Error("notistack - Custom snackbar is not refForwarding");return r}}]),i})(n.Component);function it(){}function fa(a,i){typeof a=="function"?a(i):a&&(a.current=i)}function Oo(a,i){return n.useMemo(function(){return a==null&&i==null?null:function(o){fa(a,o),fa(i,o)}},[a,i])}function ao(a){var i=a.timeout,o=a.style,t=o===void 0?{}:o,r=a.mode;return{duration:typeof i=="object"?i[r]||0:i,easing:t.transitionTimingFunction,delay:t.transitionDelay}}pn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:it,onEntering:it,onEntered:it,onExit:it,onExiting:it,onExited:it};var Ll="cubic-bezier(0.4, 0, 0.2, 1)",zl="cubic-bezier(0.0, 0, 0.2, 1)",Hl="cubic-bezier(0.4, 0, 0.6, 1)",$r=function(a){a.scrollTop=a.scrollTop},ha=function(a){return Math.round(a)+"ms"};function ut(a,i){a===void 0&&(a=["all"]);var o=i||{},t=o.duration,r=t===void 0?300:t,s=o.easing,d=s===void 0?Ll:s,p=o.delay,l=p===void 0?0:p;return(Array.isArray(a)?a:[a]).map(function(c){var g=typeof r=="string"?r:ha(r),C=typeof l=="string"?l:ha(l);return c+" "+g+" "+d+" "+C}).join(",")}function Vr(a){var i=(function(o){return o&&o.ownerDocument||document})(a);return i.defaultView||window}function Xt(a,i){if(i){var o=(function(t,r){var s,d=r.getBoundingClientRect(),p=Vr(r);if(r.fakeTransform)s=r.fakeTransform;else{var l=p.getComputedStyle(r);s=l.getPropertyValue("-webkit-transform")||l.getPropertyValue("transform")}var c=0,g=0;if(s&&s!=="none"&&typeof s=="string"){var C=s.split("(")[1].split(")")[0].split(",");c=parseInt(C[4],10),g=parseInt(C[5],10)}switch(t){case"left":return"translateX("+(p.innerWidth+c-d.left)+"px)";case"right":return"translateX(-"+(d.left+d.width-c)+"px)";case"up":return"translateY("+(p.innerHeight+g-d.top)+"px)";default:return"translateY(-"+(d.top+d.height-g)+"px)"}})(a,i);o&&(i.style.webkitTransform=o,i.style.transform=o)}}var _r=n.forwardRef(function(a,i){var o=a.children,t=a.direction,r=t===void 0?"down":t,s=a.in,d=a.style,p=a.timeout,l=p===void 0?0:p,c=a.onEnter,g=a.onEntered,C=a.onExit,f=a.onExited,u=At(a,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),m=n.useRef(null),b=Oo(o.ref,m),S=Oo(b,i),x=n.useCallback(function(){m.current&&Xt(r,m.current)},[r]);return n.useEffect(function(){if(!s&&r!=="down"&&r!=="right"){var h=(function(j,v){var T;function M(){for(var P=this,D=arguments.length,F=new Array(D),E=0;E<D;E++)F[E]=arguments[E];clearTimeout(T),T=setTimeout(function(){j.apply(P,F)},v)}return v===void 0&&(v=166),M.clear=function(){clearTimeout(T)},M})(function(){m.current&&Xt(r,m.current)}),k=Vr(m.current);return k.addEventListener("resize",h),function(){h.clear(),k.removeEventListener("resize",h)}}},[r,s]),n.useEffect(function(){s||x()},[s,x]),n.createElement(pn,Object.assign({appear:!0,nodeRef:m,onEnter:function(h,k){Xt(r,h),$r(h),c&&c(h,k)},onEntered:g,onEntering:function(h){var k=d?.transitionTimingFunction||zl,j=ao({timeout:l,mode:"enter",style:ce({},d,{transitionTimingFunction:k})});h.style.webkitTransition=ut("-webkit-transform",j),h.style.transition=ut("transform",j),h.style.webkitTransform="none",h.style.transform="none"},onExit:function(h){var k=d?.transitionTimingFunction||Hl,j=ao({timeout:l,mode:"exit",style:ce({},d,{transitionTimingFunction:k})});h.style.webkitTransition=ut("-webkit-transform",j),h.style.transition=ut("transform",j),Xt(r,h),C&&C(h)},onExited:function(h){h.style.webkitTransition="",h.style.transition="",f&&f(h)},in:s,timeout:l},u),function(h,k){return n.cloneElement(o,ce({ref:S,style:ce({visibility:h!=="exited"||s?void 0:"hidden"},d,{},o.props.style)},k))})});_r.displayName="Slide";var co=function(a){return n.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}},a))},Wl=function(){return n.createElement(co,null,n.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
14
+ Names can be used as a substitute for cell references.`,shortcut:{key:"F3",modifiers:[w.KeyModifiers.Ctrl]}}),new w.Command("fullScreenToggle",t,{label:"FullScreen",description:"Toggle showing the workbook using the full screen.",shortcut:{key:"F11"},icon:"FullScreen"}),new w.Command("showScriptEditor",t,{label:"Scripts",scopedLabels:{scripts:"Script Editor…"},description:"Show the script editor.",icon:"ScriptRun",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Alt]}]}),new w.Command("executeScript",t,{label:"Run Script",description:"Run the selected or last executed script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("executeSelectedScript",t,{label:"Run Script",description:"Run the selected script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("saveScripts",t,{label:"Save Script",description:"Save the current scripts.",icon:"ScriptSave"}),new w.Command("maximumWorkbookToggle",t,{label:"Maximize",description:"Toggle showing the workbook maximized.",shortcut:{key:"F10",modifiers:[w.KeyModifiers.Ctrl]}}),new w.Command("spellCheck",t,{label:"Spell Check",description:"Check the workbook for spelling mistakes.",shortcut:{key:"F7"}}),new w.Command("calculateAll",t,{label:"Calculate Now",description:"Recalculate all formulas.",icon:"Calculate",shortcut:{key:"F9"}}),new w.SimpleCommand("closeWorkbook",t,{label:"Close Workbook",description:"Close the workbook.",shortcut:{key:"W",modifiers:[w.KeyModifiers.Ctrl]}}),new w.SimpleCommand("newWorkbook",t,{label:"New Workbook",description:"Create a new workbook in another tab.",icon:"FileNew"})],[]),b=n.useMemo(()=>{let E=null;return E=r?r.createChildGroup(t,"workbook",!1):new w.CommandGroup(t,"workbook"),E.addCommands(m,!0),E},[r,m]),S=w.useEditMode(),x=n.useRef(null),h=w.useCallbackRef(()=>{let E,R=null;const N=b.getCommand("executeScript");if(N.update({disabled:!1,context:{getScripts:()=>i.getScripts()}}),!N)return;const z=b.getCommand("showScriptEditor");z.updateCallback(function(I=!0){R?R.close():u.activateTaskPane("scriptEditor",{})});const O=b.getCommand("executeSelectedScript");if(!O)return;const H={saveSource:async I=>{let W=null,ee=null;const X=i.getScripts();try{I&&(ee=await p.showBusy("Saving Scripts..."),W=await X.createModule({source:I})),X.addModule("scripts",W,{replace:!0}),ee?.()}catch(ne){ee?.(),console.warn("Unable to compile",ne),p.showError(ne)}return W},addContainerListener:I=>(k.current=I,()=>{k.current=null}),setSelectedFunction:I=>{E=I??x.current??null,Promise.resolve(E).then(W=>{O.update({disabled:W===null})})},quickInsertFunction:I=>{const W=`=${I.toUpperCase()}(`,ee={text:W+")",editMode:!0,initialSelection:{start:W.length,end:W.length+0}};S.setMode(X=>X?.key==="edit"?{...X,args:{...X.args}}:{key:"edit",args:{stateAndCoords:null,start:ee}})},getSelectedFunction:()=>E,setEditor:I=>{R=I??null,z.update({state:R!==null})},getEditor:()=>R,getRanges:I=>{try{return i.getRanges(I)}catch{}return null},getScripts:()=>i.getScripts()};O.update({context:H})},[b,i,o,p]),k=n.useRef(null);oe.useModelListener(i,{onBeforeSave:async()=>{await k.current?.onBeforeSave()},onProtectionChange:()=>{k.current?.onReadonlyChange()},onLoad:()=>{(async()=>(await i.getCalculation().start(),i.getScripts().start(),k.current?.onScriptChange()))()}}),oe.useModelListener(i,{onSheetsChange:E=>{C(E.getSheets().getItems())},onViewChange(E){c(E?.getSelectedSheet())},onProtectionChange:E=>{const R={disabled:!E.getProtection().isStructureAllowed()};b.getCommand("hideSheet").update(R),b.getCommand("deleteSheet").update(R),b.getCommand("addSheet").update(R),b.getCommand("duplicateSheet").update(R),b.getCommand("selectTheme").update(R),b.getCommand("addNamedReference").update(R),b.getCommand("editNamedReference").update(R),b.getCommand("deleteNamedReference").update(R)},onScriptsChange:E=>{h()}});const{isFullscreenAvailable:j,isFullscreenEnabled:v,toggleFullscreen:T}=(function(E={}){const{target:R,onChange:N,onError:z,requestFullScreenOptions:O}=E,[H,I]=n.useState(!1),[W,ee]=n.useState(null),[X,ne]=n.useState(!1),$=n.useCallback(()=>Ne.requestFullscreen(R?.current||null,O),[R,O]),U=n.useCallback(()=>Ne.exitFullscreen(),[]),Y=n.useCallback(()=>Ne.fullscreenElement?U():$(),[$,U]),_=n.useCallback(G=>{const Q=Ne.fullscreenElement;ee(Q),ne(!!Q),N?.(G)},[N]),L=n.useCallback(G=>{const Q=Ne.fullscreenElement;ee(Q),ne(!!Q),z?.(G)},[z]);return n.useEffect(()=>{I(Ne.fullscreenEnabled)},[]),n.useEffect(()=>(Ne.on("change",_),Ne.on("error",L),()=>{Ne.off("change",_),Ne.off("error",L)}),[_,L]),{isFullscreenAvailable:H,fullscreenElement:W,isFullscreenEnabled:X,enableFullscreen:$,disableFullscreen:U,toggleFullscreen:Y}})({target:{current:o??document.body}}),M=oe.useDocThemes();n.useEffect(()=>{b.getCommand("selectTheme").update({state:()=>i.getTheme(),context:()=>({theme:i.getTheme(),themes:M,darkMode:s})})},[i?.getTheme(),s]);const P=w.useCallbackRef(async function(E,R){let N=null;const z=i.getScripts();if(E?.declaration||E?.functionName){const O=E.declaration?E.declaration.getName():E.functionName;(await z.searchFunctions({name:O})).length>0&&(N=O)}if(N)try{await z.executeMacro(N),x.current=Promise.resolve({source:null,name:N})}catch(O){return void p.showError(O)}},[i,p]);n.useEffect(()=>{b.getCommand("newCellStyle").updateCallback(E=>{p.showInput({initialValue:(()=>{let R=0;for(;;){R++;const N=`Style ${R}`;try{return i.getStyles().validateStyleName(N,!0),N}catch{}}})(),title:b.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",onValidateInput:async(R,N)=>{let z=null;try{i.getStyles().validateStyleName(R,!1)}catch(I){z=I.message}let O=i.getStyles().getNamed(R),H=z;return!H&&O&&(H=`Update style '${O.getName()}'.`),{valid:z===null,message:H}}}).then(({input:R,option:N})=>{const z=i.getSelectedSheet().getSelectedRange();if(N!=="Ok")return;const O=i.getStyles().setNamed({name:R,style:z.getCell().getStyle()});z.getStyle().update({named:O.getName()})})}),b.getCommand("deleteCellStyle").updateCallback(E=>{E.delete()}),b.getCommand("modifyCellStyle").updateCallback(({named:E})=>{const R=i.getSelectedSheet().getSelectedRange();i.getStyles().setNamed({name:E.getName(),style:R.getCell().getStyle()})}),b.getCommand("hideSheet").updateCallback(E=>{i.getSheetAt(E).setVisibility(A.ISheet.Visibility.Hidden)}),b.getCommand("deleteSheet").updateCallback(async E=>{i.getSheetAt(E??i.getSelectedSheetIndex())?.delete()}),b.getCommand("addSheet").updateCallback(E=>{i.getSheets().add({index:E,autoSelect:!0})}),b.getCommand("duplicateSheet").updateCallback(async E=>{(await i.getSheetAt(E??i.getSelectedSheetIndex())?.duplicate())?.select()}),b.getCommand("nextSheet").updateCallback(E=>{i.getNextSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("previousSheet").updateCallback(E=>{i.getPreviousSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectNextSheet").updateCallback(E=>{i.getNextSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectPreviousSheet").updateCallback(E=>{i.getPreviousSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectTheme").updateCallback(E=>{i.setTheme(E)}),b.getCommand("calculateAll").updateCallback(()=>{i.getSelectedSheet().getEntireRange().calculate(!0)}),b.getCommand("closeWorkbook").updateCallback(async()=>{await p.showOptions({title:"Confirm",description:"This will close the current workbook tab. Do you want to continue?",options:["Close","Cancel"],defaultOption:"Close"})==="Close"&&window.close()}),b.getCommand("newWorkbook").updateCallback(()=>{f?.()}),b.getCommand("executeScript").updateCallback(P),b.getCommand("executeSelectedScript").updateCallback(P)},[i,p]);const D=w.useCallbackRef(async E=>{let R=0,N=null,z="Find & Replace";E?.replace&&!E?.replaceOptions?.maxCount&&(z="Replace All");const O=await p.showBusy(z);try{const H=E?.scope??"sheet";let I=null;const W=i.getSelectedSheet(),ee={from:W.getSelectedCell(),...E.findOptions};if(I=H==="sheet"?i.getSelectedSheet().find(ee):i.find(ee),E.replace){const X=i.replace(I,E.replaceText,E.replaceOptions);R=X.count,E.replaceOptions.maxCount&&(N=X.last)}else{let X=I.next();X.done||(R++,N=X.value)}N?.select({autoFocus:!1}),O?.(),!E.replaceOptions.maxCount&&R>1&&p.showMessage(`We replaced ${R} cells.`)}catch(H){O?.(),p.showError(H)}return R},[i,o]),F=w.useCallbackRef(E=>{const R={selection:()=>{const z=i.getSelectedRanges(),O=z.getCount(),H=new Array(O);for(let I=0;I<O;I++){const W=z.at(I).getFixed(!0).getCoords();H[I]=W}return i.getRanges(H)},getNames:()=>i.getNames()},N={initialValue:E,context:()=>R,onInput:async z=>{try{await z.select()}catch(O){p.showMessage(O.message,{type:w.NotifierType.Error})}}};return p.showWindow("namedDetails",N)},[p,i,o]);return n.useEffect(()=>{const E=(R=!1)=>{const N={initialValue:{findOptions:{text:i.getSelectedCell().toTextUnformatted(!0)},replace:R},context:()=>D,onKeyDown:z=>{b.findCommandByEvent(z)!==b.getCommand("find")&&b.findCommandByEvent(z)!==b.getCommand("findReplace")||z.preventDefault()},autoFocus:!0,disableAutoDestroy:!0};p.showWindow("find",N)};b.getCommand("find")?.update({disabled:!p.showWindow}).updateCallback(()=>{E()}),b.getCommand("findReplace")?.update({disabled:!p.showWindow}).updateCallback(()=>{E(!0)}),b.getCommand("activateTask")?.update({disabled:!p}).updateCallback(()=>{const R={onInput:async N=>{try{u.activateTaskPane(N)}catch(z){p.showError(z.message)}},title:b.getCommand("activateTask")?.label(),inputLabel:"Task Name",options:["Activate"]};p.showInput(R)}),b.getCommand("goto")?.update({disabled:!p}).updateCallback(()=>{const R={onInput:async N=>{try{await i.getRanges(N).select()}catch(z){p.showMessage(z.message,{type:w.NotifierType.Error})}},title:b.getCommand("goto")?.label(),inputLabel:"Location",options:["Go To"]};p.showInput(R)}),b.getCommand("selectNamed")?.update({disabled:!p}).updateCallback(async R=>{if(R)try{await R.select()}catch(N){p.showError(N)}}),b.getCommand("addNamedReference")?.updateCallback(async function(R){F(null)}),b.getCommand("editNamedReference")?.updateCallback(async function(R){F(R)}),b.getCommand("deleteNamedReference")?.updateCallback(async function(R){R?.delete?.()}),b.getCommand("activeNameBox")?.updateCallback(async function(){o?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus()})},[o,i,p]),oe.useModelListener(i?.getView(),{onViewChange:E=>{b.getCommand("workbookViewToggleShowFormulaBar").update({state:E.isShowFormulaBar()}).updateCallback(()=>{E.setShowFormulaBar(!E.isShowFormulaBar())}),b.getCommand("workbookViewToggleShowTabs").update({state:E.isShowTabs()}).updateCallback(()=>{E.setShowTabs(!E.isShowTabs())}),b.getCommand("workbookViewToggleShowStatusBar").update({state:E.isShowStatusBar()}).updateCallback(()=>{E.setShowStatusBar(!E.isShowStatusBar())}),b.getCommand("workbookViewToggleShowHorizontalScrollBar").update({state:E.isShowHorizontalScrollbar()}).updateCallback(()=>{E.setShowHorizontalScrollbar(!E.isShowHorizontalScrollbar())}),b.getCommand("workbookViewToggleShowVerticalScrollBar").update({state:E.isShowVerticalScrollbar()}).updateCallback(()=>{E.setShowVerticalScrollbar(!E.isShowVerticalScrollbar())})}}),n.useEffect(()=>{b.getCommand("fullScreenToggle").update({state:v,disabled:!j,icon:v?"FullScreenOff":"FullScreen"}).updateCallback(()=>{T()})},[v,j]),n.useEffect(()=>{const E=i.getProtection().isStructureAllowed();b.getCommand("hideSheet").update({disabled:g.length<=1||!E}),b.getCommand("deleteSheet").update({disabled:g.length<=1||!E})},[g,l]),b},Er=()=>{window.open(window.origin.toString(),"sheetxl-"+A.CommonUtils.uuidV4(),"popup=true")},hl="_sheetxl-theme_4opcr_2",gl="_sheetxl-workbook_g5t6x_5",xl=a=>e.jsx(tn,{...a}),bl=a=>e.jsx(on,{...a}),yl=a=>e.jsx(en,{...a}),an=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,onBeforeUserChange:r,onUserChange:s,disabled:d=!1,readOnly:p=!1,contextMenuProps:l,renderContextMenu:c=xl,sheetsAllProps:g,renderSheetsAll:C=bl,sheetTabProps:f,renderSheetTab:u,background:m="transparent",className:b,sx:S,borderWidth:x,borderColor:h,gridTheme:k,gridStyle:j,...v}=a,[T,M]=n.useState(o?.getSelectedSheetIndex()),[P,D]=n.useState(o?.getSheets().getItems()),[F,E]=n.useState(o?.getProtection());oe.useModelListener(o,{onViewChange(J){M(J?.getSelectedSheetIndex())},onSheetsChange:J=>{D(J.getSheets().getItems())},onProtectionChange:J=>{E(J?.getProtection())}});const R=p||!F.isStructureAllowed(),N=n.useMemo(()=>{const J=[];for(let K=0;K<P.length;K++)J.push(P[K].getName());return J},[P]),z=n.useCallback(J=>{r?.(J)!==!1&&(o.getSheetAt(J).select(),s?.(J))},[o,r,s]),O=n.useCallback((J,K)=>{o.getSheetAt(J).setName(K),s?.(J)},[o,s]),H=n.useCallback((J,K)=>{o.getSheetAt(J).setPosition(K),s?.(K)},[o,s]),I=w.useCallbackRef(()=>{if(r?.(T)===!1)return;const J=T+1;o.getSheets().add({name:void 0,autoSelect:!0}),s?.(J)},[o,r,s,T]),W=n.useMemo(()=>({placement:"top-start"}),[]),ee=n.useRef(null),[X,ne]=n.useState(!1),$=n.useCallback(J=>{const{closeFloatAll:K,floatReference:te}=J;return C({workbook:o,gridStyle:j,floatReference:te,closeFloatAll:K,...g})},[C,g,d,o,j]),{reference:U,component:Y}=y.useFloatStack({label:"allSheet",popperProps:W,anchor:ee.current,onOpen:()=>ne(!0),onClose:()=>ne(!1),createPopupPanel:$}),_=n.useRef(null),[L,G]=n.useState(null),Q=n.useCallback(J=>{const{floatReference:K}=J;return c?.({workbook:o,index:L?.index,tabStripRef:_.current,commands:t,disabled:d,floatReference:K,...l})},[c,l,d,o,t,L]),{reference:fe,component:re}=y.useFloatStack({label:"sheetTab",popperProps:W,anchor:{getBoundingClientRect:()=>new DOMRect(L?.left||0,L?.top||0,0,0)},onClose:()=>G(null),createPopupPanel:Q});n.useEffect(()=>{L?fe.open(0):fe.close(0)},[L]);const me=n.useCallback((J,K)=>{J.preventDefault(),G({left:J.clientX-2,top:J.clientY-4,index:K})},[]),Se=w.useCallbackRef(J=>{let K;try{K=o?.getSheetAt(J.index)}catch{}return K?(u??yl)({sheet:K,gridTheme:k,onContextMenu:te=>{z(J.index),me(te,J.index)},...J,...f}):null},[u,f,o,k]),Ce=n.useMemo(()=>R?null:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"New sheet",children:e.jsx(B.IconButton,{disabled:d,component:"div",sx:{padding:"0","&:hover:not([disabled])":{color:J=>J.palette.primary.main},color:J=>J.palette.text.icon??J.palette.action.active,"& svg":{width:"18px",height:"18px"}},"aria-label":"addTab",size:"small",onMouseDown:J=>{J.button===0&&J.preventDefault()},onClick:()=>I(),children:e.jsx(w.DynamicIcon,{iconKey:"AddCircle"})})}),[d,R,I]);return e.jsxs(B.Box,{ref:i,className:ie(b),sx:{position:"relative",display:"flex",alignItems:"stretch",flex:"1 1 100%",maxWidth:"100%",...S},...v,children:[e.jsx(oe.TabStrip,{ref:_,selectedTabIndex:T,tabNames:N,onSelectedTabIndexChange:z,onTabNameChange:O,onTabMove:H,background:m,borderColor:h,borderWidth:x,activeColor:null,disabled:d,disableDrag:R,createScrollStartButton:y.createScrollStartButton,createScrollEndButton:y.createScrollEndButton,createScrollEdgeButton:y.createScrollEdgeButton,createTabButton:Se,createTabDivider:J=>{const{key:K,...te}=J;return e.jsx(y.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:de=>q.alpha(de.palette.divider,.25)},...te},K)},editLabelProps:{readOnly:R,maxLength:31,styleHover:{fontWeight:"700"},onKeyPress:J=>{o.isValidSheetNameCharacter(J.key)||J.preventDefault()},onCancel:()=>{s?.(T)}},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:X?"":"List all sheets",children:e.jsx(y.ExhibitIconButton,{sx:{padding:"0px",ml:.5,mr:0,mt:0,mb:0,"& svg":{transform:"scale(0.8, 1)"},color:J=>J.palette.text.icon??J.palette.action.active},ref:ee,dense:!0,outlined:!1,selected:X,color:"primary","aria-label":"menu",onMouseDown:J=>{J.button===0&&J.preventDefault()},onClick:()=>{X?U.close(0):U.open(0)},icon:e.jsx(w.DynamicIcon,{iconKey:"Menu"})})})}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,minWidth:"4px"}}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,flex:"none",display:"flex",alignItems:"center"},children:Ce}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,flex:1,minWidth:"24px"}}),re,Y]})}));an.displayName="WorkbookStrip";const rn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,disabled:r,sx:s,floatReference:d,className:p,...l}=a,[c,g]=n.useReducer(R=>R+1,0),[C,f]=n.useState(o.getSelectedSheet()),[u,m]=n.useState(C.getSelectedRanges()),[b,S]=n.useState(C.getSelectedCell());oe.useModelListener(o,{onSheetsChange(){f(o.getSelectedSheet())}}),oe.useModelListener(C.getSelection(),{onChange(){m(C.getSelectedRanges()),S(C.getSelectedCell())}}),w.useCommands(t,[],{onChange:()=>{g()}});const x=n.useMemo(()=>({}),[]),h=n.useMemo(()=>({commandHook:{beforeExecute:(R,N)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,scope:"contextMenu",parentFloat:d}),[r,d]),k=n.useMemo(()=>({...x,...h,variant:w.CommandButtonType.Menuitem}),[x,h]),j=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:d,...h}),[t,h,d]),v=[];let T=u.isEntireRows(),M=u.isEntireColumns();u&&(T&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideColumns"),...k,key:"context:"+v.length}))),M&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideRows"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideRows"),...k,key:"context:"+v.length}))),(T||M)&&v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),T&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...k,command:t.getCommand("resizeColumns"),key:"context:"+v.length}))),M&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitRows"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...k,command:t.getCommand("resizeRows"),key:"context:"+v.length}))));const P=[],D=t.getCommand("formatTableStyle"),F=D?.context()?.table();if(w.useCommand(D),!T&&!M){if(P.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+P.length)),b?.getHyperlink())P.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+P.length,quickCommand:"openHyperlink"}));else{const R=t.getCommand("updateHyperlink");P.push(n.createElement(y.CommandButton,{command:R,...k,key:"contextBefore:"+P.length}))}if(b?.getComments())P.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+P.length,quickCommand:"updateComments"}));else{const R=t.getCommand("updateComments");P.push(n.createElement(y.CommandButton,{command:R,...k,key:"contextBefore:"+P.length}))}F?P.push(n.createElement(y.SimpleCommandPopupButton,{...j,variant:w.CommandButtonType.Menuitem,key:"contextBefore:"+P.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:F,quickCommand:"editTable"})):P.push(n.createElement(y.CommandButton,{command:t.getCommand("insertTable"),...k,key:"context:"+v.length})),P.push(n.createElement(dn,{...j,key:"contextBefore:"+P.length}))}const E=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:t.getCommand("cut"),...k}),e.jsx(so,{command:t.getCommand("copy"),...k}),e.jsx(_o,{command:t.getCommand("paste"),...j,includePasteAllInPopup:!1}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx($o,{...j}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(zo,{commands:t,...j,disableSheet:!0}),e.jsx(Ho,{commands:t,...j,disableSheet:!0}),e.jsx(Lo,{...j}),P,v]});return e.jsx(B.Box,{ref:i,className:ie("menu",p),sx:{...s},...l,children:E})}));rn.displayName="WorkbookContextMenu";const so=n.memo(n.forwardRef((a,i)=>{const{command:o,...t}=a,r=w.useEditMode(),[s,d]=n.useState(!1),[p,l]=n.useState("info");return n.useEffect(()=>{const c=r.getMode();d(c?.key==="copy"||c?.key==="cut"),l(c?.key==="cut"?"warn":"accent")},[r]),e.jsx(y.CommandButton,{ref:i,command:o,icon:e.jsx(w.DynamicIcon,{iconKey:"copy.walking",sourceProps:{isWalking:s,themedType:p}}),...t})})),Br=n.memo(n.forwardRef((a,i)=>{const{movable:o,commands:t,disabled:r,sx:s,floatReference:d,...p}=a;oe.useModelListener(o,{onAnyChange(u){}});const l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(u,m)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),g=n.useMemo(()=>({variant:w.CommandButtonType.Menuitem,...l,...c}),[l,c]),C=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:d,...c}),[t,c,d]),f=e.jsxs(e.Fragment,{children:[e.jsx(so,{command:t.getCommand("copy"),...g,variant:w.CommandButtonType.Menuitem}),[],e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["moveToFront","moveForward"],quickCommand:"moveToFront"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["moveToBack","moveBackward"],quickCommand:"moveToBack"}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:t.getCommand("toggleLockAspectRatio")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["formatDrawAlignLeft","formatDrawAlignCenter","formatDrawAlignRight",null,"formatDrawAlignTop","formatDrawAlignMiddle","formatDrawAlignBottom",null,"formatDrawDistributeHorz","formatDrawDistributeVert"],label:"Align",icon:"DrawAlignLeft",tooltip:"Quickly change the placement of your drawings."}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...C,popupCommandKeys:["formatAnchorTypeTwoCell","formatAnchorTypeOneCell","formatAnchorTypeAbsolute"],label:"Sizing",icon:"DrawResize",tooltip:"Determine how the drawing size will adjust as the cell sizes adjust."}),[]]});return e.jsx(B.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",...s},...p,children:f})}));Br.displayName="MovableContextMenu";const Cl=a=>e.jsx(Br,{...a}),Sl=a=>e.jsx(rn,{...a}),wl=a=>e.jsx(Jo,{...a}),kl=(a,i)=>e.jsx(Qo,{ref:i,...a}),vl=a=>e.jsx(y.LoadingPanel,{...a}),jl=(a,i)=>e.jsx(oe.SheetElement,{ref:i,...a}),Tl=a=>e.jsx(Xo,{...a}),El=a=>e.jsx(an,{...a}),Bl={fireOnModelChange:!1},sa={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},ln=n.memo(n.forwardRef((a,i)=>{const{workbook:o,createWorkbookOptions:t,onNewWorkbook:r,onElementLoad:s,autoFocus:d=!1,sx:p,style:l,className:c,onFocus:g,onBlur:C,onKeyDown:f,onRepeatCommandChange:u,commands:m,showFormulaBar:b,formulaBarProps:S,renderFormulaBar:x=kl,showTabs:h,tabsProps:k,renderTabs:j=El,showStatusBar:v,statusBarProps:T,renderStatusBar:M=Tl,toolbarProps:P,renderToolbar:D=vr,contextMenuSx:F,renderContextMenu:E=Sl,renderFilterMenu:R=wl,renderMovableMenu:N=Cl,renderLoadingPanel:z=vl,loadingPanelProps:O,sheetProps:H,renderSheet:I=jl,mainWrapper:W,showHorizontalScrollbar:ee,showVerticalScrollbar:X,gridTheme:ne,headersTheme:$,enableDarkImages:U,...Y}=a,_=q.useTheme(),L=oe.useDocThemes(),G=n.useMemo(()=>{const V={theme:L.getDefaultTheme(),...t};return o??new A.Workbook(V)},[o]),Q=n.useRef(null),[fe,re]=n.useState(!1),me=n.useRef(null),Se=n.useMemo(()=>e.jsx(B.Box,{className:"sheetxl-viewport",sx:{width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",pointerEvents:"none !important","& > :first-of-type":{position:"relative"}},ref:me}),[]),[Ce,J]=n.useState(!1),[K,te]=n.useState(!1),de=n.useCallback(()=>{J(!0)},[]),ve=n.useRef(null),se=w.useImperativeElement(i,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>G,getSheetElement:()=>Q.current,getViewportElement:()=>me.current,getFormulaBarElement:()=>ve.current,focus(){Q&&Q.current&&Q.current.focus()}}),[G]),Fe=n.useRef(null);n.useLayoutEffect(()=>{!Ce||!se.current||(async()=>(Fe.current!==s&&(await s?.({source:se.current}),Fe.current=s),te(!0)))()},[Ce,se.current]),Qn(se.current);const Te=n.useCallback(V=>(Q.current?.submitEdit(),!0),[]),Oe=n.useCallback(()=>{requestAnimationFrame(()=>{Q?.current?.focus()})},[]),[ue,Z]=n.useState(G?.getSelectedSheet()),[le,Ue]=n.useState(G?.getProtection());oe.useModelListener(G,{onSheetsChange:V=>{Z(V?.getSelectedSheet())},onViewChange(V){Z(V?.getSelectedSheet())},onProtectionChange:V=>{Ue(V?.getProtection())}}),oe.useModelListener(G,{onRequestSelect:async(V,ae)=>new Promise(he=>{Q.current.getSheet()!==ae?Q.current.getGridElement()?.onViewChangeOnce(()=>{Q.current.getSheet()!==ae&&he(!1),he(!0)}):he(!0)})},Bl);const[ni,gt]=n.useReducer(V=>V+1,0),ot=G?.getView();oe.useModelListener(ot,{onViewChange:V=>{gt()}});const Pe=ne??_,we=n.useMemo(()=>Io(_,Pe),[_,Pe]),hn=$??_,ai=n.useMemo(()=>Io(_,hn),[_,hn]),[gn,ri]=n.useState(null);n.useCallback(()=>{Q.current.focus()},[]);const pe=Tr({workbook:G,workbookElement:se.current,target:()=>Q.current,commands:m,darkMode:we.body.darkMode,onNewWorkbook:r}),xt=n.useRef(null),[uo,xn]=n.useState(!1),[bn,yn]=n.useState(null),[Cn,ii]=n.useState(w.ToolTipPlacement.Top),[bt,li]=n.useState(A.TypesUtils.EmptyBounds),mo=n.useCallback(()=>{xn(!1),yn(null)},[]),yt=n.useCallback((V,ae,he=w.ToolTipPlacement.Top)=>{li(V),ii(he),yn(ae),xt.current!==null&&setTimeout(()=>{xt.current!==null&&xt.current.update()},160),xn(!0)},[]),[ps,Sn]=n.useState("sheet"),qe=h??ot?.isShowTabs(),Ge=ee??ot?.isShowHorizontalScrollbar(),si=b??ot?.isShowFormulaBar(),zt=v??ot?.isShowStatusBar(),wn=X??ot?.isShowVerticalScrollbar(),nt=we?.header?.edgeStrokeFill||"rgb(171,171,171)",ci=n.useMemo(()=>zt?M({sheet:ue,gridStyle:we,...T}):null,[M,T,zt,we,ue]),di=n.useMemo(()=>D({commands:pe,workbook:se.current,...P}),[pe,D,P,_]),[ui,{width:po}]=_e(),Xe=po===0||po>560,fo=n.useMemo(()=>{if(!qe)return null;let V=j({background:we.body.fill,borderWidth:1,borderColor:nt,gridTheme:Pe,gridStyle:we,onBeforeUserChange:Te,onUserChange:Oe,workbook:G,commands:pe,sheetTabProps:{},...k});return Xe||(V=e.jsx("div",{style:{flex:"none",display:"flex"},children:V})),V},[j,k,_,G,Pe,Xe,pe,qe]),kn=n.useCallback(V=>{const{style:ae,...he}=V;let be=null,Ee=null,ye=null;if(Ge&&(Ee=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${nt} 1px`,flexDirection:"column",justifyContent:"center"},children:e.jsx(oe.SheetScrollbar,{...he,style:{paddingLeft:"4px",paddingRight:"4px",...ae},touchThumbProps:{backgroundColor:Pe.palette.background.paper,borderColor:Pe.palette.primary.main,fillColor:"grey"},endGap:700,sheet:ue,onShowTooltip:ke=>{yt({x:ke.anchor.x,y:ke.anchor.y,width:0,height:0},ke.display,ke.placement)},onCloseTooltip:()=>mo()})})),qe&&Xe&&(ye=fo),qe&&Xe&&!Ge&&(ye=e.jsxs(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[ye,e.jsx(B.Box,{sx:{borderTop:`solid ${nt} 1px`,flex:"1"}})]})),ye&&Ge)be=e.jsx(w.SplitPane,{position:G.getView().getTabRatio()/10+"%",onPositionChange:({percent:ke})=>{G.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='${_.palette.text.icon??_.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 ${nt} 1px`,borderBottom:"solid 3px transparent"}},elementBefore:ye,elementAfter:Ee});else if(Ge)be=Ee;else{if(!ye)return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:zt?null:`solid ${nt} 1px`}});be=ye}return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:be})},[ue,Te,G,we,Pe,pe,qe,Ge,zt,Xe]),[Me,Ct]=n.useState(null),mi=n.useMemo(()=>({placement:"right-start",...Me?.popperProps}),[Me?.popperProps]),{reference:vn,component:pi}=y.useFloatStack({label:"contextMenu",popperProps:mi,anchor:Me?.anchor??{getBoundingClientRect:()=>new DOMRect(Me?.clientX||0,Me?.clientY||0)},onClose:()=>Ct(null),createPopupPanel:Me?.createPopupPanel});n.useEffect(()=>{Me?vn.open(0):vn.close(0)},[Me]);const fi=w.useCallbackRef((V,ae)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Me&&Me.anchor===V.currentTarget?Ct(null):Ct({anchor:V.currentTarget,popperProps:{offsets:[-4,2]},createPopupPanel:he=>{const{floatReference:be}=he;return R({filter:ae,commands:pe,floatReference:be,sx:{...F}})}})},[R,F,pe,G,Me]),jn=w.useCallbackRef(V=>{if(V.originalEvent?.isDefaultPrevented())return!0;V.originalEvent?.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:ae=>{const{floatReference:he}=ae;return E({commands:pe,workbook:G,floatReference:he,sx:{...F}})}})},[E,F,pe,G]),hi=w.useCallbackRef((V,ae)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:he=>{const{floatReference:be}=he;return N({movable:ae,commands:pe,floatReference:be,sx:{...F}})}})},[N,F,pe]);n.useMemo(()=>{const V=[new w.SimpleCommand("openContextMenu",()=>Q.current,{label:"Context Menu",description:"Open the context menu.",shortcut:[{key:"F10",modifiers:[w.KeyModifiers.Shift]},{key:"ContextMenu"}]})];pe.addCommands(V,!0)},[pe]),n.useEffect(()=>{pe.getCommand("openContextMenu").updateCallback(()=>{const V=ue.getSelection().getCoords().cell;Q.current?.getGridElement()?.scrollCellCoordsIntoView(V).then(ae=>{requestAnimationFrame(()=>{const he=ue.getView().getZoomScale()/100,be=ue.getColumnHeaders().findOffset(V.colIndex+1)*he,Ee=ue.getRowHeaders().findOffset(V.rowIndex+1)*he,ye=Q.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};jn({clientX:be-ye.x-ae.left+6,clientY:Ee-ye.y-ae.top+6})})})})},[ue]);const gi=w.useCallbackRef(V=>{pe?.dispatchToFocusedCommand(V)},[pe]),xi=w.useCallbackRef(()=>{Qn(se.current)},[G,se.current]),bi=n.useCallback(()=>{Sn("sheet")},[]),yi=n.useCallback(()=>{Sn("formulaBar")},[]),Ci=n.useCallback(V=>{const{style:ae,...he}=V;return e.jsx(oe.SheetScrollbar,{...he,style:{...ae,paddingTop:"4px",paddingBottom:"4px"},touchThumbProps:{backgroundColor:Pe.palette.background.paper,borderColor:Pe.palette.primary.main,fillColor:"grey"},sheet:ue,endGap:700,onShowTooltip:be=>{yt(be.anchor,be.display,w.ToolTipPlacement.Left)},onCloseTooltip:()=>mo()})},[ue,Pe]);n.useEffect(()=>{d&&Q&&Q.current&&Q.current.focus()},[]);const[Ht,ho]=n.useState(null),go=n.useCallback(V=>{pe?.getCommand("openWorkbook")&&(V.type==="dragenter"||V.type==="dragover"?V.dataTransfer?.types.includes("Files")?V.dataTransfer.files[0]?.type?.startsWith("image/")||V.dataTransfer.items[0]?.type?.startsWith("image/")||V.dataTransfer.types.length===1&&ho("Drop to open"):(V.dataTransfer?.types.includes("text/html")||V.dataTransfer?.types.includes("text/plain"),V.dataTransfer.effectAllowed="none",V.dataTransfer.dropEffect="none"):V.type==="dragleave"&&ho(null),V.preventDefault())},[pe]),Si=w.useCallbackRef(V=>{if(pe?.getCommand("openWorkbook")&&(V.preventDefault(),V.stopPropagation(),ho(null),V.dataTransfer.files&&V.dataTransfer.files.length>0)){const ae=V.dataTransfer.files[0];if(!ae)return;if(ae?.type?.startsWith("image/")){const he=Q.current?.getGridElement().getViewFromClient(V.clientX,V.clientY);if(!he)return;const be=he.getRelativePointFromClient(V.clientX,V.clientY),Ee=he.toAbsoluteBounds({...be,width:0,height:0}),ye=he.getCellCoordsFromClient(V.clientX,V.clientY);if(!ye)return;pe?.getCommand("insertImageFromFile")?.execute({file:ae,options:{bounds:{x:Ee.x,y:Ee.y}},goto:{range:{...ye}}})}else pe?.getCommand("openWorkbook")?.execute(ae)}},[pe,Ht]),wi=n.useMemo(()=>Ht?e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"100%",boxSizing:"border-box",pointerEvents:"none",display:"flex",justifyContent:"center",alignItems:"center",background:V=>V.palette.divider,color:V=>V.palette.primary.dark},children:e.jsx(B.Typography,{variant:"h4",children:Ht})}):null,[Ht]),Tn=n.useRef(null),ki=n.useMemo(()=>e.jsx(Fo,{in:!K,nodeRef:Tn,timeout:500,classNames:"animating",unmountOnExit:!0,children:e.jsx(B.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",left:"0px",top:"0px",width:"100%",height:"100%",pointerEvents:K?"none":p?.pointerEvents,position:"absolute",boxSizing:"border-box"},children:z({ref:Tn,transitionDelay:"0",transparentBackground:!1,sx:{opacity:K?0:p?.opacity,pointerEvents:K?"none":p?.pointerEvents,position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%",...O}})})}),[K,z,O]),vi=n.useMemo(()=>x({sx:{marginTop:V=>V.spacing(.25),marginLeft:V=>V.spacing(1),marginRight:V=>V.spacing(1)},workbook:G,sheetElement:Q.current,gridStyle:we,onFocus:yi,...S,NamedCollectionEditorProps:{restoreFocus:V=>Q.current.focus(V),...S?.NamedCollectionEditorProps,commandPopupButtonProps:{commands:pe,...S?.NamedCollectionEditorProps?.commandPopupButtonProps}}},ve),[x,S,G,we,pe,K]),ji=n.useCallback(V=>{const{movable:ae,...he}=V,be={movable:ae,onContextMenuCapture:ke=>{hi(ke,ae)},...he},Ee=ae.getContent().getType();let ye=null;if(Ee==="picture")return e.jsx(oe.PictureEditor,{loadingPanel:e.jsx(y.LoadingPanel,{transitionDelay:"100",style:{position:"absolute"},sx:{border:ke=>`solid 1px ${ke.palette.action.active}`}}),picture:ae.getContent(),description:ae.getDescription()??ae?.getName(),...be});if(Ee==="chart"){const ke={...be,chart:ae.getContent()};return e.jsx(oe.ChartEditor,{...ke})}if(ye=`Float of type '${Ee}'.`,typeof ye=="string"){const ke={...be,description:ye};ye=e.jsx(oe.EmptyFrame,{...ke})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:ye},ae.getUUID())},[]),En=n.useMemo(()=>I({style:sa,onFocus:bi,gridStyle:we,headersStyle:ai,sheet:ue,commands:pe,onSheetContextMenu:jn,onViewportChange:V=>{ri(V)},showScrollbars:!1,viewportComponent:Se,onRepeatCommandChange:u,onElementLoad:de,onShowColumnTooltip:V=>{yt(V.anchor,V.display,w.ToolTipPlacement.Top)},onShowRowTooltip:V=>{yt(V.anchor,V.display,w.ToolTipPlacement.Right)},onShowTooltip:V=>{yt({x:V.anchor.x,y:V.anchor.y,width:0,height:0},V.display,V.placement)},onCloseTooltip:()=>mo(),renderMovable:ji,...H,cellRenderProps:{onFilterButtonMouseDown:(V,ae)=>{H?.cellRenderProps?.onFilterButtonMouseDown(V,ae),fi(V,ae)},...H?.cellRenderProps}},Q),[pe,H,ue,we,u]),Ti=n.useMemo(()=>{let V=e.jsx(w.ScrollPane,{ref:ui,style:sa,viewport:gn,touchElement:Q.current?.getGridElement()?.stage,onScrollViewport:ae=>{Q.current?.getGridElement()?.scrollTo(ae)},showHorizontalScrollbar:Ge||qe,showVerticalScrollbar:wn,createHorizontalScrollbar:kn,createVerticalScrollbar:Ci,children:En});return Xe||po===0||(V=e.jsxs(e.Fragment,{children:[V,fo]})),W?W(V):V},[Ge,qe,kn,wn,gn,Xe,En,fo,_,W,Pe]),Ei=n.useMemo(()=>e.jsx(y.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:uo,title:e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:bn}),placement:Cn,slotProps:{transition:{timeout:{exit:0}},popper:{popperRef:xt,sx:{"& .MuiTooltip-tooltip":{padding:"2px 6px","& .MuiTooltip-arrow":{display:uo?"visible":"none"}}},anchorEl:{getBoundingClientRect:()=>new DOMRect(bt.x,bt.y,bt.width,bt.height)},modifiers:[{name:"offset",options:{offset:[0,0]}}]}},children:e.jsx(B.Box,{})}),[uo,bn,Cn,bt,xt]),Bi=n.useMemo(()=>({boxSizing:"border-box",background:V=>V.palette.mode!=="dark"?we.header.fill:V.palette.background.paper,"& *":{...y.scrollbarTheming(_),fontWeight:400},"&.Mui-focusVisible":{},"& .viewport-overlay":{borderRight:`solid ${nt} 1px`},...p}),[p,we]),Ri=n.useMemo(()=>e.jsx(B.Box,{sx:{marginBottom:V=>V.spacing(.75)}}),[]),Pi=n.useMemo(()=>({flex:"1 1 100%",width:"100%",display:"flex",flexDirection:"column",opacity:K?void 0:0,"--sxl-app-color-high-contrast":_.palette.primary.main,"--sxl-app-color-primary":_.palette.primary.main,"--sxl-app-color-primary-dark":_.palette.primary.dark,"--sxl-app-color-primary-light":_.palette.primary.light,"--sxl-app-color-info":_.palette.info.main,"--sxl-app-color-info-dark":_.palette.info.dark,"--sxl-app-color-info-light":_.palette.info.light,"--sxl-app-color-secondary":_.palette.secondary.main,"--sxl-app-color-secondary-dark":_.palette.secondary.dark,"--sxl-app-color-secondary-light":_.palette.secondary.light,"--sxl-app-color-success":_.palette.success.main,"--sxl-app-color-success-dark":_.palette.success.dark,"--sxl-app-color-success-light":_.palette.success.light,"--sxl-app-color-warning":_.palette.warning.main,"--sxl-app-color-warning-dark":_.palette.warning.dark,"--sxl-app-color-warning-light":_.palette.warning.light,"--sxl-app-color-error":_.palette.error.main,"--sxl-app-color-error-dark":_.palette.error.dark,"--sxl-app-color-error-light":_.palette.error.light,"--sxl-app-color-text":_.palette.text.primary,"--sxl-app-color-text-secondary":_.palette.text.secondary,"--sxl-app-color-text-disabled":_.palette.text.disabled,"--sxl-app-color-background":_.palette.background.paper,"--sxl-app-color-button-surface":_.palette.grey[600],"--sxl-app-color-shadow":_.palette.action.focus,"--sxl-app-color-grey":_.palette.grey[500],"--sxl-app-filter-dark-invert":we.body.darkMode&&U?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":we.body.darkMode?`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`:void 0}),[we,_,K]),Mi=n.useMemo(()=>ie(Xa),[]);return e.jsxs(B.Paper,{className:ie("sheetxl-workbook",gl,{"Mui-focusVisible":fe},hl,c),sx:Bi,style:l,square:!1,...Y,ref:se,onFocus:V=>{re(!0),xi(),g?.(V)},onBlur:V=>{re(!1),C?.(V)},onKeyDown:V=>{gi(V),f?.(V)},onDragStart:V=>{if(V.target.src){const ae=new Image;ae.src=V.target.src,V.dataTransfer.setDragImage(ae,1,1)}},onDragEnter:go,onDragLeave:go,onDragOver:go,onDrop:Si,children:[e.jsxs("div",{className:Mi,style:Pi,children:[di,si?vi:null,Ri,Ti,ci,Ei,pi,wi]}),ki]})}));ln.displayName="WorkbookElement";const Rl=(a=!1,i=!1)=>i?null:{"& input:not(:focus):not(:hover)":{color:o=>o.palette.text.secondary},backgroundColor:o=>q.alpha(o.palette.background.paper,.6),borderRadius:o=>`${o.shape.borderRadius}px`,border:o=>`solid ${a?o.palette.divider:"transparent"} 1px`,"&.Mui-disabled":{border:o=>`solid ${a?o.palette.divider:"transparent"} 1px`},"&:focus-within:not([disabled])":{backgroundColor:o=>o.palette.background.paper},"&:hover:not([disabled])":{border:o=>`solid ${a?o.palette.text?.primary:o.palette.divider} 1px`,backgroundColor:null},"&.Mui-focusVisible":{outline:o=>`solid ${o.palette.primary.main} 1px !important`,border:o=>`1px solid ${o.palette?.primary?.main} !important`}},sn=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,title:r="",placeHolder:s="Untitled",onTitleChange:d,readOnly:p=!1,hidden:l,...c}=a,[g,C]=n.useState(!1),[f,u]=n.useState(!1),[m,b]=n.useState(r??""),[S,x]=n.useState(""),[h,{width:k}]=_e(),[j,{width:v}]=_e(),[T,M]=n.useState(!1),P=n.useRef(null),D=n.useRef(null),F=w.useImperativeElement(i,()=>({requestWorkbookTitle:(E=null,R)=>{D.current={onAccept:E,requestReason:R?.requestReason},R?.selectAll&&P.current?.select(),P.current?.focus(R)},focus:E=>{P.current?.focus(E)}}),[]);return n.useLayoutEffect(()=>{M(r!==m),x(r),b(r)},[r]),n.useEffect(()=>{T&&k!==0&&je.CommonUtils.debounce(()=>{M(!1)},300)()},[T,k]),n.useEffect(()=>{u(m&&!dt.IOUtils.isValidWindowsFilename(m))},[m]),l?null:e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",opacity:T?"0":"1",transition:T?void 0:"opacity .25s ease-in","& .tooltip-wrapper":{maxWidth:"100%"}},ref:tt([F,j,i]),...c,children:e.jsx(y.ExhibitTooltip,{label:D.current?.requestReason??"Workbook Name",children:e.jsxs(B.Box,{className:ie({"Mui-focusVisible":g}),sx:{visibility:k===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",...Rl(!0,p),...o},children:[p?e.jsx(B.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:m!==S?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:E=>f?E.palette.error.dark:void 0},children:r??s}):e.jsx(B.Input,{sx:{width:`${Math.min(k+3,Math.max(v,F.current?.getBoundingClientRect()?.width))}px`,overflow:"hidden",whiteSpace:"nowrap",fontWeight:"600",maxWidth:"100%",border:"none",padding:"0px",margin:"0px",color:E=>f?E.palette.error.dark:void 0,fontStyle:m!==S?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:p,spellCheck:!1,placeholder:s,onFocus:E=>{C(!0),E.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:P},onBlur:()=>{C(!1),f?b(S):(m!==S&&(d?.(m),m&&D.current?.onAccept?.(m,"blur")),D.current=null)},onChange:E=>{if(E.target.value.length>dt.IOUtils.MAX_WORKBOOK_NAME_SIZE)return E.stopPropagation(),void E.preventDefault();b(E.target.value)},onKeyDown:E=>{(dt.IOUtils.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(E.key)||E.target?.value.length>dt.IOUtils.MAX_WORKBOOK_NAME_SIZE)&&E.preventDefault(),E.which===w.KeyCodes.Enter||E.which===w.KeyCodes.Tab?(f?b(S):(d?.(m),m&&(D.current?.onAccept?.(m,"keydown"),D.current=null)),E.stopPropagation(),E.preventDefault(),t?.focus()):E.which===w.KeyCodes.Escape&&(m===S?t?.focus():(b(S),setTimeout(()=>{E.target?.select()},0)),D.current=null,E.stopPropagation(),E.preventDefault())},value:m}),e.jsx(B.Box,{ref:h,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:m!==S?"italic":void 0,fontFamily:E=>E.typography.fontFamily,letterSpacing:"0.00938em"},children:m||s})]})})})}));sn.displayName="WorkbookTitle";const Rr=n.memo(n.forwardRef((a,i)=>{const{title:o,commands:t,className:r,...s}=a,d=w.useNotifier(),[p,l]=n.useState(!1),[c,g]=n.useState(!1),C=n.useRef(null),[f,u]=n.useReducer(P=>P+1,0),[m,{width:b}]=_e(),S=w.useCommands(t,["editTable"])[0].context(),x=S.table(),[h,k]=n.useState(()=>x?S.getNames().getRanges(x.getRange()):null),j=n.useMemo(()=>x?.getName()??"",[x]);oe.useModelListener(S.table(),{onAnchorCoordsChange(P){k(S.getNames().getRanges(P.getRange()))},onProtectedChange(P){u()}});const v=w.useCallbackRef(P=>{S?.table().setName(P)},[S]),T=w.useCallbackRef(P=>{S?.table().resize(P.at(0))},[S]);let M=null;return S.table()||(M=e.jsx(B.Typography,{component:"div",style:{top:"0",left:"0",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyItems:"center",justifyContent:"center"},children:"No table selected"})),e.jsx(B.Paper,{square:!0,onFocus:()=>l(!0),onBlur:P=>{C?.current?.contains(P.relatedTarget)||l(!1)},ref:tt([C,m,i]),sx:{display:"flex",flexDirection:"column",flex:"1 1 auto",width:"100%",height:"100%",overflow:"auto",paddingLeft:P=>P.spacing(1.5),paddingRight:P=>P.spacing(1.5),paddingTop:P=>P.spacing(1.5),paddingBottom:P=>P.spacing(1.5),boxSizing:"border-box"},className:ie("sxl-table-details-panel",r,{"sxl-has-focus":p}),...s,children:M||e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 auto",flexDirection:"column",transition:"opacity 60ms",opacity:S.table()?1:0},children:[e.jsx(B.Box,{sx:{containerType:"inline-size",display:"flex",flexDirection:"column",maxWidth:"100%",boxSizing:"border-box",paddingTop:P=>P.spacing(2),paddingLeft:P=>P.spacing(2),paddingRight:P=>P.spacing(2)},children:e.jsxs(B.Box,{className:Yi,children:[e.jsx(Uo,{formName:"name",defaultInput:j,value:x?.getName()??"No table",onChangeInput:v,onValidate:P=>{x&&x.getName().toLowerCase()===P.toLowerCase()||S?.getNames().validateName(P)},disabled:x?.isProtected()??!0,onFocus:P=>{c||P.target?.select(),g(!0)}}),e.jsx(qo,{formName:"range",value:h,onChangeInput:T,resolvedAddress:S.getNames().getRanges.bind(S.getNames()),disabled:x?.isProtected()??!0,onFocus:P=>{c||P.target?.select(),g(!0)}})]})}),e.jsxs(B.Box,{sx:{minHeight:"10px",flex:"1 1 100%",display:"flex",flexDirection:"column",containerType:"inline-size",gap:P=>P.spacing(.5),marginTop:P=>P.spacing(1)},children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:P=>P.spacing(1.5),marginBottom:P=>P.spacing(.75)}}),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",justifyContent:"start",flexDirection:"column",marginTop:P=>P.spacing(1),marginBottom:P=>P.spacing(1)},children:e.jsxs("div",{style:{display:"flex",alignItems:"start",gap:"2px"},children:[e.jsx(Ko,{table:x,styles:S.styles(),bodyStyle:S.bodyStyle(),cellHeight:30,isLive:!0}),e.jsx(cn,{command:t.getCommand("formatTableStyle"),commands:t,disabledQuickKey:!0})]})}),e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:P=>P.spacing(1.5),marginBottom:P=>P.spacing(.75)}}),e.jsx(Za,{disabled:x?.isProtected(),styleOptions:x?.getStyleOptions()??null,onStyleOptionsChange:P=>{x.updateStyleOptions(P)},showHeaderRow:x?.getShowHeaders(),onShowHeaderRowChange:P=>{try{x.setShowHeaders(P)}catch(D){d.showError(D)}},showTotalRow:x?.getShowTotals(),onShowTotalRowChange:P=>{try{x.setShowTotals(P)}catch(D){d.showError(D)}},showFilterButton:x?.getFilter()?x.getShowFilterButton():null,onShowFilterButtonChange:P=>{try{x.setShowFilterButton(P)}catch(D){d.showError(D)}}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsxs(B.Box,{className:Zi,children:[e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,command:t.getCommand("convertTableToRange"),commandState:x}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:x,command:t.getCommand("deleteTable")})]})]})]})})})),Pr=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...d}=a;return e.jsx(Rr,{ref:i,commands:t,...d})},Mr=()=>{w.DefaultDynamicIconService.register("plugin-table",{icons:{}}),oe.DefaultTaskPaneRegistry.registerTaskPane({key:"tableDetails",getTitle:()=>"Table Details",getIcon:()=>"Table",renderTaskPane:Pr},!0)},Pl=n.memo(a=>{const{table:i,tableStyle:o,selectedTableStyleName:t,onSelectTableStyleName:r,styles:s,hasContextMenu:d=!0,bodyStyle:p,parentFloat:l,commands:c,disabled:g,commandHook:C,useCanvasPreview:f=!0,canvas:u,...m}=a,b=n.useCallback(k=>{const j={variant:w.CommandButtonType.Menuitem,commandHook:C,context:"table"},v=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...j,command:c.getCommand("formatTableStyleClearCellStyles"),commandState:o,disabled:g}),e.jsx(y.CommandButton,{...j,style:{fontWeight:550},command:c.getCommand("formatTableStyle"),commandState:{name:o.getName()},disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:c.getCommand("setDefaultTableStyle"),commandState:o.getName(),disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:c.getCommand("deleteTableStyle"),commandState:o?.getName(),disabled:g||!o||o.isBuiltIn()})]}),T=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:v})});return y.defaultCreatePopupPanel({...k,children:T})},[c]),S=o?.getName()===t,x=n.useMemo(()=>{const k={table:i,tableStyle:o,styles:s,bodyStyle:p};return f?e.jsx(Ya,{canvas:u,...k}):e.jsx(Ko,{...k})},[i,o,s,p]);let h=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:k=>`solid ${S?k.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName()??"None",placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{r?.(o?.getName())},...m,children:x},o.getName());return d&&(h=e.jsx(y.ContextMenu,{label:i.getStyleOptions().name,parentFloat:l,createPopupPanel:b,children:h})),h}),cn=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedTable:s,onSelectTableStyleName:d,disabled:p=!1,bodyStyle:l,disabledQuickKey:c=!1,usePreviewIcon:g=!1,...C}=a;w.useCommand(t);const f=t?.context(),u=f?.styles,m=s??f?.table?.();let b="insertTable";m&&(b="editTable");const S=n.useMemo(()=>((F,E)=>{const R={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new A.Table({initialAnchor:R,styles:E,json:{name:"PreviewTable",ref:R,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:F}})})(m?.getStyleOptions(),u?.()),[u?.().getDefaultTableStyle(),m?.getStyleOptions()]),x=m??S,[h,k]=n.useState(x);n.useEffect(()=>{k(x)},[x]);const j=l??f?.bodyStyle(),v=w.useCallbackRef(F=>{d?.(F),t?.execute({name:F},r)},[t,d,r]),T=n.useRef(null),M=n.useCallback((F,E)=>{const R={onSelectTableStyleName:v,styles:u(),parentFloat:F.floatReference};T.current||(T.current=document.createElement("canvas"));const N=$=>{const U=u().getTableStyle($);return U?e.jsx(Pl,{table:h,tableStyle:U,selectedTableStyleName:h.getStyleOptions().name,bodyStyle:f.bodyStyle(),commands:E,commandHook:r,canvas:T.current,...R},$):null},z=($,U,Y=!0)=>{const _=[];for(let L=0;L<U.length;L++){const G=N(U[L]);G&&_.push(G)}return _.length===0?null:e.jsxs(B.Box,{children:[Y?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:$},$+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"481px",maxWidth:"100%"},children:_},$+"-presets")]},$)},O=[],H=u().getCustomTableStyles(),I=[];if(H.length>0){for(let $=0;$<H.length;$++)H[$].isShownInTableStyles()&&I.push(H[$].getName());O.push(z("Custom",I,!1))}const W=[];m&&!m.getStyleOptions().name&&W.push(null);for(let $=0;$<21;$++)W.push("TableStyleLight"+($+1));O.push(z("Light",W,I.length>0));const ee=[];for(let $=0;$<28;$++)ee.push("TableStyleMedium"+($+1));O.push(z("Medium",ee));const X=[];for(let $=0;$<11;$++)X.push("TableStyleDark"+($+1));O.push(z("Dark",X));let ne=null;return m&&(ne=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,command:E.getCommand("formatTableStyleClearTableStyle"),commandHook:r,disabled:p})]})),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:$=>`${$.shape.borderRadius}px`,paddingBottom:$=>`${$.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",padding:"6px 16px"},children:O}),ne]})},[u,u?.().getTheme(),j,h]),P=p||!t||t.disabled(),D=n.useMemo(()=>{if(!f||!g)return t?.icon()},[h,j,P,t]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:c?void 0:b,createPopupPanel:M,commands:o,label:t?.label(),commandState:m,commandHook:r,selected:m!==null,createTooltip:({children:F},E)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:E,children:F}),disabled:P,icon:D,...C})})),Dr=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,selectedTheme:r,onSelectTheme:s,disabled:d=!1,darkMode:p,label:l,icon:c,variant:g,...C}=a;w.useCommand(o);const f=o?.context()?.themes,u=r||o?.context()?.theme,m=p??o?.context()?.darkMode,b=d||o?.disabled(),S=w.useCallbackRef(h=>{s?.(h),o?.execute(h,t)},[s,t]),x=n.useCallback((h,k)=>{const{children:j,title:v,...T}=h;let M=h.children;return(b||k)&&(M=e.jsx("div",{children:M})),e.jsx(y.CommandTooltip,{command:o,placement:g===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:b||k,...T,children:M})},[o,b]);return e.jsx(nr,{ref:i,themes:f,selectedTheme:u,onSelectTheme:S,variant:g===w.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:x,disabled:b,darkMode:m,...C})})),Fr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,p=w.useCommands(o,["themeMode"])[0],l=w.useCallbackRef((u,m)=>{const b={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:s},S=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...b,command:p}),e.jsx(y.CommandButton,{...b,command:m.getCommand("defaultThemeMode")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...b,command:m.getCommand("enableDarkGrid")}),e.jsx(y.CommandButton,{...b,command:m.getCommand("enableDarkImages")})]});return y.defaultCreatePopupPanel({...u,children:S})},[s,p,t,r]),c=p?.state(),g=B.useMediaQuery("(prefers-color-scheme: dark)"),C=c==="dark"||c===null&&g,f=p?.state()!==null;return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:"themeMode",commands:o,commandHook:t,createPopupPanel:l,label:"Appearance",tooltip:"Change the light/dark mode to match your viewing preference. This does not affect the view for others.",onQuickClick:()=>{p?.execute(C?"light":"dark",t)},selected:f,...d})})),Ir=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,sx:d,...p}=a,l=n.useCallback((c,g)=>{const C={variant:w.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(u,m)=>t?.beforeExecute?.(u,m)!==!1&&c.floatReference.closeAll()},disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...C,command:g.getCommand("showKeyboardShortcuts")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlGithub")}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlDiscord")}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlDocumentation")}),e.jsx(y.CommandButton,{...C,command:g.getCommand("gotoUrlIssue")})]});return y.defaultCreatePopupPanel({...c,children:f})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,sx:d,commands:o,disabled:s,commandHook:t,scope:r,label:"Help",tooltip:"Help, feedback, and keyboard shortcuts.",createPopupPanel:l,icon:e.jsx(w.DynamicIcon,{iconKey:"Help",style:{transform:"scale(0.75)"}}),...p})})),dn=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,preferSingleMenu:d=!0,showQuickButton:p=!0,variant:l=w.CommandButtonType.Toolbar,...c}=a,g=w.useCommands(o,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:C,allDisabled:f}=n.useMemo(()=>{let m=null,b=0;for(let S=0;S<g.length;S++)g[S]&&!g[S]?.disabled()&&(d&&l===w.CommandButtonType.Menuitem&&(m=b===0?g[S]:null),b++);return{singleMenuCommand:m,allDisabled:b===0}},[g]),u=n.useCallback((m,b)=>{const S={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...S,command:b.getCommand("insertImageFromFile")}),e.jsx(y.CommandButton,{...S,command:b.getCommand("insertImageFromURL")})]});return y.defaultCreatePopupPanel({...m,children:x})},[s,t,r]);return C?e.jsx(y.CommandButton,{ref:i,variant:l,commandHook:t,disabled:s,command:C,...c}):e.jsx(y.CommandPopupButton,{ref:i,variant:l,quickCommand:"insertImageFromFile",commands:o,commandHook:t,scope:r,disabled:s||f,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:u,icon:"InsertImage",...c})})),un=n.memo(n.forwardRef((a,i)=>{const{...o}=a;return e.jsx(y.SimpleCommandPopupButton,{ref:i,...o,popupCommandKeys:["insertFunctionSum","insertFunctionAverage","insertFunctionCount","insertFunctionMax","insertFunctionMin",null,"insertFunction"],quickCommand:"insertFunctionSum",popupScope:"insertFunction",label:"Quick Function",tooltip:"More functions."})}));un.displayName="InsertFunctionSumCommandPopupButton";const jo=new Map([{key:"financial",label:"Financial",icon:"FormulaFinancial"},{key:"logical",label:"Logical",icon:"FormulaLogical"},{key:"text",label:"Text",icon:"FormulaText"},{key:"dateTime",label:"Date & Time",icon:"FormulaDateTime"},{key:"lookupReference",label:"Lookup & Reference",icon:"FormulaLookupReference"},{key:"mathTrig",label:"Math & Trig",icon:"FormulaMathTrig"},{key:"statDist",label:"Statistical",icon:"FormulaStatistical"},{key:"engineering",label:"Engineering",icon:"FormulaEngineering"},{key:"information",label:"Information",icon:"FormulaInformation"},{key:"cube",label:"Cube",icon:"FormulaCube"},{key:"database",label:"Database",icon:"FormulaDatabase"},{key:"web",label:"Web",icon:"FormulaWeb"},{key:"custom",label:"Custom",icon:"FormulaCustom"}].map(a=>[a.key,a])),Ml=n.memo(a=>{const{command:i,formulaFunction:o,commandHook:t,disabled:r=!1,parentFloat:s,handleInsert:d,icon:p,label:l,sx:c,...g}=a,C=new Promise(f=>{o.getDescriptor().then(u=>{f(u.getSummary())})});return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...c},disabled:r,tooltipProps:{label:C,maxWidth:1e3},onMouseDown:f=>{f.button===0&&f.preventDefault()},onMouseUp:f=>{f.button===0&&d(o)},onKeyDown:f=>{f.keyCode===w.KeyCodes.Enter||(f.keyCode,w.KeyCodes.Space)},...g,children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",children:o.getName()})})})}),Nr=n.memo(n.forwardRef((a,i)=>{const{category:o,commands:t,commandHook:r,scope:s,sx:d,disabled:p=!1,parentFloat:l,...c}=a,g=w.useCommands(t,["insertFunction"])[0],C=n.useCallback((u,m)=>{const b=jo.get(o);if(!b)return console.warn("invalidate category",o),null;const S={commandHook:r,...u},x=e.jsx(Dl,{category:b.label,...S,commands:m});return y.defaultCreatePopupPanel({...u,children:x})},[o,g,r,s]),f=jo.get(o);return e.jsx(y.CommandPopupButton,{ref:i,commands:t,commandHook:r,createPopupPanel:C,label:f.label,tooltip:"Insert Function",icon:jo.get(o)?.icon??"FormulaGroup",...c})}));Nr.displayName="InsertFunctionCommandPopupButton";const Dl=n.memo(n.forwardRef((a,i)=>{const{commands:o,category:t,commandHook:r,...s}=a,d=w.useCommands(o,["insertFunction"]),[p,l]=n.useState([]),[c,g]=n.useState(!1);n.useEffect(()=>{(async()=>{g(!0);const S=d[0]?.context(),x=await S.searchByCategory(t);l(x),g(!1)})()},[]);const C=p.length,f=new Array(C),u=o.getCommand("insertFunction"),m=S=>{r?.beforeExecute?.(u,u?.state()),u.execute(S),r?.onExecute?.(u,u?.state())};for(let S=0;S<C;S++){const x=p[S];f[S]=e.jsx(Ml,{command:u,formulaFunction:x,handleInsert:m},`formula-${x.getName()}-${S}`)}const b=e.jsx(B.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:C>0?e.jsx(e.Fragment,{children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:f})}):null});return y.defaultCreatePopupPanel({...s,children:b})})),Or=n.memo(n.forwardRef((a,i)=>{const{sx:o,style:t,className:r,licenseKey:s,renderLoadingPanel:d,...p}=a;s&&A.LicenseManager.setLicenseKey(s);const l=n.useMemo(()=>{const g={transitionDelay:"160ms",transparentBackground:!0};return e.jsx(B.Box,{sx:o,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...t},children:d?.(g)??e.jsx(y.LoadingPanel,{...g})})},[o,t,d]),c=n.useMemo(()=>n.lazy(async()=>await Promise.resolve().then(()=>ms)),[]);return e.jsx(e.Fragment,{children:e.jsx(n.Suspense,{fallback:l,children:e.jsx(c,{...p,className:r,renderLoadingPanel:d,sx:o,style:t,ref:i})})})}));function Ar(a){var i,o,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a))for(i=0;i<a.length;i++)a[i]&&(o=Ar(a[i]))&&(t&&(t+=" "),t+=o);else for(i in a)a[i]&&(t&&(t+=" "),t+=i);return t}function Ke(){for(var a,i,o=0,t="";o<arguments.length;)(a=arguments[o++])&&(i=Ar(a))&&(t&&(t+=" "),t+=i);return t}Or.displayName="Studio";let Fl={data:""},Il=a=>{if(typeof window=="object"){let i=(a?a.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return i.nonce=window.__nonce__,i.parentNode||(a||document.head).appendChild(i),i.firstChild}return a||Fl},Nl=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ol=/\/\*[^]*?\*\/| +/g,ca=/\n+/g,Je=(a,i)=>{let o="",t="",r="";for(let s in a){let d=a[s];s[0]=="@"?s[1]=="i"?o=s+" "+d+";":t+=s[1]=="f"?Je(d,s):s+"{"+Je(d,s[1]=="k"?"":i)+"}":typeof d=="object"?t+=Je(d,i?i.replace(/([^,])+/g,p=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,p):p?p+" "+l:l)):s):d!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=Je.p?Je.p(s,d):s+":"+d+";")}return o+(i&&r?i+"{"+r+"}":r)+t},Ae={},Lr=a=>{if(typeof a=="object"){let i="";for(let o in a)i+=o+Lr(a[o]);return i}return a},Al=(a,i,o,t,r)=>{let s=Lr(a),d=Ae[s]||(Ae[s]=(l=>{let c=0,g=11;for(;c<l.length;)g=101*g+l.charCodeAt(c++)>>>0;return"go"+g})(s));if(!Ae[d]){let l=s!==a?a:(c=>{let g,C,f=[{}];for(;g=Nl.exec(c.replace(Ol,""));)g[4]?f.shift():g[3]?(C=g[3].replace(ca," ").trim(),f.unshift(f[0][C]=f[0][C]||{})):f[0][g[1]]=g[2].replace(ca," ").trim();return f[0]})(a);Ae[d]=Je(r?{["@keyframes "+d]:l}:l,o?"":"."+d)}let p=o&&Ae.g?Ae.g:null;return o&&(Ae.g=Ae[d]),((l,c,g,C)=>{C?c.data=c.data.replace(C,l):c.data.indexOf(l)===-1&&(c.data=g?l+c.data:c.data+l)})(Ae[d],i,t,p),d};function No(a){let i=this||{},o=a.call?a(i.p):a;return Al(o.unshift?o.raw?((t,r,s)=>t.reduce((d,p,l)=>{let c=r[l];if(c&&c.call){let g=c(s),C=g&&g.props&&g.props.className||/^go/.test(g)&&g;c=C?"."+C:g&&typeof g=="object"?g.props?"":Je(g,""):g===!1?"":g}return d+p+(c??"")},""))(o,[].slice.call(arguments,1),i.p):o.reduce((t,r)=>Object.assign(t,r&&r.call?r(i.p):r),{}):o,Il(i.target),i.g,i.o,i.k)}function zr(a,i,o){return i&&(function(t,r){for(var s=0;s<r.length;s++){var d=r[s];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(t,d.key,d)}})(a.prototype,i),a}function ce(){return ce=Object.assign||function(a){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},ce.apply(this,arguments)}function Hr(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,a.__proto__=i}function At(a,i){if(a==null)return{};var o,t,r={},s=Object.keys(a);for(t=0;t<s.length;t++)o=s[t],i.indexOf(o)>=0||(r[o]=a[o]);return r}function da(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}No.bind({g:1}),No.bind({k:1});var ua=function(){return""},Wr=n.createContext({enqueueSnackbar:ua,closeSnackbar:ua}),To="@media (max-width:599.95px)",to="@media (min-width:600px)",ma=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},mn=function(a){return""+ma(a.vertical)+ma(a.horizontal)},qt=function(a){return!!a||a===0},Gt="unmounted",rt="exited",it="entering",Bt="entered",pa="exiting",pn=(function(a){function i(t){var r;r=a.call(this,t)||this;var s,d=t.appear;return r.appearStatus=null,t.in?d?(s=rt,r.appearStatus=it):s=Bt:s=t.unmountOnExit||t.mountOnEnter?Gt:rt,r.state={status:s},r.nextCallback=null,r}Hr(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Gt?{status:rt}:null};var o=i.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==it&&s!==Bt&&(r=it):s!==it&&s!==Bt||(r=pa)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t=this.props.timeout,r=t,s=t;return t!=null&&typeof t!="number"&&typeof t!="string"&&(s=t.exit,r=t.enter),{exit:s,enter:r}},o.updateStatus=function(t,r){t===void 0&&(t=!1),r!==null?(this.cancelNextCallback(),r===it?this.performEnter(t):this.performExit()):this.props.unmountOnExit&&this.state.status===rt&&this.setState({status:Gt})},o.performEnter=function(t){var r=this,s=this.props.enter,d=t,p=this.getTimeouts();t||s?(this.props.onEnter&&this.props.onEnter(this.node,d),this.safeSetState({status:it},function(){r.props.onEntering&&r.props.onEntering(r.node,d),r.onTransitionEnd(p.enter,function(){r.safeSetState({status:Bt},function(){r.props.onEntered&&r.props.onEntered(r.node,d)})})})):this.safeSetState({status:Bt},function(){r.props.onEntered&&r.props.onEntered(r.node,d)})},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts();r?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:pa},function(){t.props.onExiting&&t.props.onExiting(t.node),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:rt},function(){t.props.onExited&&t.props.onExited(t.node)})})})):this.safeSetState({status:rt},function(){t.props.onExited&&t.props.onExited(t.node)})},o.cancelNextCallback=function(){this.nextCallback!==null&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(){s&&(s=!1,r.nextCallback=null,t())},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=t==null&&!this.props.addEndListener;this.node&&!s?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),t!=null&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Gt)return null;var r=this.props;return(0,r.children)(t,At(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},zr(i,[{key:"node",get:function(){var t,r=(t=this.props.nodeRef)===null||t===void 0?void 0:t.current;if(!r)throw new Error("notistack - Custom snackbar is not refForwarding");return r}}]),i})(n.Component);function lt(){}function fa(a,i){typeof a=="function"?a(i):a&&(a.current=i)}function Oo(a,i){return n.useMemo(function(){return a==null&&i==null?null:function(o){fa(a,o),fa(i,o)}},[a,i])}function ao(a){var i=a.timeout,o=a.style,t=o===void 0?{}:o,r=a.mode;return{duration:typeof i=="object"?i[r]||0:i,easing:t.transitionTimingFunction,delay:t.transitionDelay}}pn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:lt,onEntering:lt,onEntered:lt,onExit:lt,onExiting:lt,onExited:lt};var Ll="cubic-bezier(0.4, 0, 0.2, 1)",zl="cubic-bezier(0.0, 0, 0.2, 1)",Hl="cubic-bezier(0.4, 0, 0.6, 1)",$r=function(a){a.scrollTop=a.scrollTop},ha=function(a){return Math.round(a)+"ms"};function mt(a,i){a===void 0&&(a=["all"]);var o=i||{},t=o.duration,r=t===void 0?300:t,s=o.easing,d=s===void 0?Ll:s,p=o.delay,l=p===void 0?0:p;return(Array.isArray(a)?a:[a]).map(function(c){var g=typeof r=="string"?r:ha(r),C=typeof l=="string"?l:ha(l);return c+" "+g+" "+d+" "+C}).join(",")}function Vr(a){var i=(function(o){return o&&o.ownerDocument||document})(a);return i.defaultView||window}function Xt(a,i){if(i){var o=(function(t,r){var s,d=r.getBoundingClientRect(),p=Vr(r);if(r.fakeTransform)s=r.fakeTransform;else{var l=p.getComputedStyle(r);s=l.getPropertyValue("-webkit-transform")||l.getPropertyValue("transform")}var c=0,g=0;if(s&&s!=="none"&&typeof s=="string"){var C=s.split("(")[1].split(")")[0].split(",");c=parseInt(C[4],10),g=parseInt(C[5],10)}switch(t){case"left":return"translateX("+(p.innerWidth+c-d.left)+"px)";case"right":return"translateX(-"+(d.left+d.width-c)+"px)";case"up":return"translateY("+(p.innerHeight+g-d.top)+"px)";default:return"translateY(-"+(d.top+d.height-g)+"px)"}})(a,i);o&&(i.style.webkitTransform=o,i.style.transform=o)}}var _r=n.forwardRef(function(a,i){var o=a.children,t=a.direction,r=t===void 0?"down":t,s=a.in,d=a.style,p=a.timeout,l=p===void 0?0:p,c=a.onEnter,g=a.onEntered,C=a.onExit,f=a.onExited,u=At(a,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),m=n.useRef(null),b=Oo(o.ref,m),S=Oo(b,i),x=n.useCallback(function(){m.current&&Xt(r,m.current)},[r]);return n.useEffect(function(){if(!s&&r!=="down"&&r!=="right"){var h=(function(j,v){var T;function M(){for(var P=this,D=arguments.length,F=new Array(D),E=0;E<D;E++)F[E]=arguments[E];clearTimeout(T),T=setTimeout(function(){j.apply(P,F)},v)}return v===void 0&&(v=166),M.clear=function(){clearTimeout(T)},M})(function(){m.current&&Xt(r,m.current)}),k=Vr(m.current);return k.addEventListener("resize",h),function(){h.clear(),k.removeEventListener("resize",h)}}},[r,s]),n.useEffect(function(){s||x()},[s,x]),n.createElement(pn,Object.assign({appear:!0,nodeRef:m,onEnter:function(h,k){Xt(r,h),$r(h),c&&c(h,k)},onEntered:g,onEntering:function(h){var k=d?.transitionTimingFunction||zl,j=ao({timeout:l,mode:"enter",style:ce({},d,{transitionTimingFunction:k})});h.style.webkitTransition=mt("-webkit-transform",j),h.style.transition=mt("transform",j),h.style.webkitTransform="none",h.style.transform="none"},onExit:function(h){var k=d?.transitionTimingFunction||Hl,j=ao({timeout:l,mode:"exit",style:ce({},d,{transitionTimingFunction:k})});h.style.webkitTransition=mt("-webkit-transform",j),h.style.transition=mt("transform",j),Xt(r,h),C&&C(h)},onExited:function(h){h.style.webkitTransition="",h.style.transition="",f&&f(h)},in:s,timeout:l},u),function(h,k){return n.cloneElement(o,ce({ref:S,style:ce({visibility:h!=="exited"||s?void 0:"hidden"},d,{},o.props.style)},k))})});_r.displayName="Slide";var co=function(a){return n.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}},a))},Wl=function(){return n.createElement(co,null,n.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
15
  10.59L10 14.17L17.59 6.58L19 8L10 17Z`}))},$l=function(){return n.createElement(co,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Vl=function(){return n.createElement(co,null,n.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
16
  6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,
17
17
  13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z`}))},_l=function(){return n.createElement(co,null,n.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`}))},Ze={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(Wl,null),warning:n.createElement($l,null),error:n.createElement(Vl,null),info:n.createElement(_l,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:_r,transitionDuration:{enter:225,exit:195}},Kl=function(a,i){return function(o,t){return t===void 0&&(t=!1),t?ce({},Ze[o],{},i[o],{},a[o]):o==="autoHideDuration"?(r=a.autoHideDuration,s=i.autoHideDuration,(d=function(p){return typeof p=="number"||p===null})(r)?r:d(s)?s:Ze.autoHideDuration):o==="transitionDuration"?(function(p,l){var c=function(g,C){return C.some(function(f){return typeof g===f})};return c(p,["string","number"])?p:c(p,["object"])?ce({},Ze.transitionDuration,{},c(l,["object"])&&l,{},p):c(l,["string","number"])?l:c(l,["object"])?ce({},Ze.transitionDuration,{},l):Ze.transitionDuration})(a.transitionDuration,i.transitionDuration):a[o]||i[o]||Ze[o];var r,s,d}};function Lt(a){return Object.entries(a).reduce(function(i,o){var t,r=o[0],s=o[1];return ce({},i,((t={})[r]=No(s),t))},{})}var Ul="notistack-SnackbarContainer",ql="notistack-Snackbar",Kr="notistack-CollapseWrapper",Gl="notistack-MuiContent",Xl=function(a){return"notistack-MuiContent-"+a},ga=Lt({root:{height:0},entered:{height:"auto"}}),Eo="0px",Ur=n.forwardRef(function(a,i){var o=a.children,t=a.in,r=a.onExited,s=n.useRef(null),d=n.useRef(null),p=Oo(i,d),l=function(){return s.current?s.current.clientHeight:0};return n.createElement(pn,{in:t,unmountOnExit:!0,onEnter:function(c){c.style.height=Eo},onEntered:function(c){c.style.height="auto"},onEntering:function(c){var g=l(),C=ao({timeout:175,mode:"enter"}),f=C.duration,u=C.easing;c.style.transitionDuration=typeof f=="string"?f:f+"ms",c.style.height=g+"px",c.style.transitionTimingFunction=u||""},onExit:function(c){c.style.height=l()+"px"},onExited:r,onExiting:function(c){$r(c);var g=ao({timeout:175,mode:"exit"}),C=g.duration,f=g.easing;c.style.transitionDuration=typeof C=="string"?C:C+"ms",c.style.height=Eo,c.style.transitionTimingFunction=f||""},nodeRef:d,timeout:175},function(c,g){return n.createElement("div",Object.assign({ref:p,className:_e(ga.root,c==="entered"&&ga.entered),style:ce({pointerEvents:"all",overflow:"hidden",minHeight:Eo,transition:ut("height")},c==="entered"&&{overflow:"visible"},{},c==="exited"&&!t&&{visibility:"hidden"})},g),n.createElement("div",{ref:s,className:Kr,style:{display:"flex",width:"100%"}},o))})});Ur.displayName="Collapse";var xa={right:"left",left:"right",bottom:"up",top:"down"},Yl=function(a){return"anchorOrigin"+mn(a)},Zl=function(){};function It(a,i){return a.reduce(function(o,t){return t==null?o:function(){for(var r=arguments.length,s=new Array(r),d=0;d<r;d++)s[d]=arguments[d];var p=[].concat(s);i&&p.indexOf(i)===-1&&p.push(i),o.apply(this,p),t.apply(this,p)}},Zl)}var Ql=typeof window<"u"?n.useLayoutEffect:n.useEffect;function ba(a){var i=n.useRef(a);return Ql(function(){i.current=a}),n.useCallback(function(){return i.current.apply(void 0,arguments)},[])}var Bo,qr=n.forwardRef(function(a,i){var o=a.children,t=a.className,r=a.autoHideDuration,s=a.disableWindowBlurListener,d=s!==void 0&&s,p=a.onClose,l=a.id,c=a.open,g=a.SnackbarProps,C=g===void 0?{}:g,f=n.useRef(),u=ba(function(){p&&p.apply(void 0,arguments)}),m=ba(function(x){p&&x!=null&&(f.current&&clearTimeout(f.current),f.current=setTimeout(function(){u(null,"timeout",l)},x))});n.useEffect(function(){return c&&m(r),function(){f.current&&clearTimeout(f.current)}},[c,r,m]);var b=function(){f.current&&clearTimeout(f.current)},S=n.useCallback(function(){r!=null&&m(.5*r)},[r,m]);return n.useEffect(function(){if(!d&&c)return window.addEventListener("focus",S),window.addEventListener("blur",b),function(){window.removeEventListener("focus",S),window.removeEventListener("blur",b)}},[d,S,c]),n.createElement("div",Object.assign({ref:i},C,{className:_e(ql,t),onMouseEnter:function(x){C.onMouseEnter&&C.onMouseEnter(x),b()},onMouseLeave:function(x){C.onMouseLeave&&C.onMouseLeave(x),S()}}),o)});qr.displayName="Snackbar";var Jl=Lt({root:(Bo={display:"flex",flexWrap:"wrap",flexGrow:1},Bo[to]={flexGrow:"initial",minWidth:"288px"},Bo)}),fn=n.forwardRef(function(a,i){var o=a.className,t=At(a,["className"]);return n.createElement("div",Object.assign({ref:i,className:_e(Jl.root,o)},t))});fn.displayName="SnackbarContent";var Rt=Lt({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"}}),ya="notistack-snackbar",Gr=n.forwardRef(function(a,i){var o=a.id,t=a.message,r=a.action,s=a.iconVariant,d=a.variant,p=a.hideIconVariant,l=a.style,c=a.className,g=s[d],C=r;return typeof C=="function"&&(C=C(o)),n.createElement(fn,{ref:i,role:"alert","aria-describedby":ya,style:l,className:_e(Gl,Xl(d),Rt.root,Rt[d],c,!p&&g&&Rt.lessPadding)},n.createElement("div",{id:ya,className:Rt.message},p?null:g,t),C&&n.createElement("div",{className:Rt.action},C))});Gr.displayName="MaterialDesignContent";var Pt,Ro,Yt,Zt,Po,es=n.memo(Gr),ts=Lt({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),os=function(a){var i=n.useRef(),o=n.useState(!0),t=o[0],r=o[1],s=It([a.snack.onClose,a.onClose]),d=n.useCallback(function(){i.current=setTimeout(function(){r(function(P){return!P})},125)},[]);n.useEffect(function(){return function(){i.current&&clearTimeout(i.current)}},[]);var p,l=a.snack,c=a.classes,g=a.Component,C=g===void 0?es:g,f=n.useMemo(function(){return(function(P){P===void 0&&(P={});var D={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(P).filter(function(F){return!D[F]}).reduce(function(F,E){var R;return ce({},F,((R={})[E]=P[E],R))},{})})(c)},[c]),u=l.open,m=l.SnackbarProps,b=l.TransitionComponent,S=l.TransitionProps,x=l.transitionDuration,h=l.disableWindowBlurListener,k=l.content,j=At(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),v=ce({direction:(p=j.anchorOrigin,p.horizontal!=="center"?xa[p.horizontal]:xa[p.vertical]),timeout:x},S),T=k;typeof T=="function"&&(T=T(j.id,j.message));var M=["onEnter","onEntered","onExit","onExited"].reduce(function(P,D){var F;return ce({},P,((F={})[D]=It([a.snack[D],a[D]],j.id),F))},{});return n.createElement(Ur,{in:t,onExited:M.onExited},n.createElement(qr,{open:u,id:j.id,disableWindowBlurListener:h,autoHideDuration:j.autoHideDuration,className:_e(ts.wrappedRoot,f.root,f[Yl(j.anchorOrigin)]),SnackbarProps:m,onClose:s},n.createElement(b,Object.assign({},v,{appear:!0,in:u,onExit:M.onExit,onExited:d,onEnter:M.onEnter,onEntered:It([M.onEntered,function(){a.snack.requestClose&&s(null,"instructed",a.snack.id)}],j.id)}),T||n.createElement(C,Object.assign({},j)))))},Mt={default:20},Qt={default:6,dense:2},Ca="."+Kr,Jt=Lt({root:(Pt={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:ut(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Pt[Ca]={padding:Qt.default+"px 0px",transition:"padding 300ms ease 0ms"},Pt.maxWidth="calc(100% - "+2*Mt.default+"px)",Pt[To]={width:"100%",maxWidth:"calc(100% - 32px)"},Pt),rootDense:(Ro={},Ro[Ca]={padding:Qt.dense+"px 0px"},Ro),top:{top:Mt.default-Qt.default+"px",flexDirection:"column"},bottom:{bottom:Mt.default-Qt.default+"px",flexDirection:"column-reverse"},left:(Yt={left:Mt.default+"px"},Yt[to]={alignItems:"flex-start"},Yt[To]={left:"16px"},Yt),right:(Zt={right:Mt.default+"px"},Zt[to]={alignItems:"flex-end"},Zt[To]={right:"16px"},Zt),center:(Po={left:"50%",transform:"translateX(-50%)"},Po[to]={alignItems:"center"},Po)}),ns=function(a){var i=a.classes,o=i===void 0?{}:i,t=a.anchorOrigin,r=a.dense,s=a.children,d=_e(Ul,Jt[t.vertical],Jt[t.horizontal],Jt.root,o.containerRoot,o["containerAnchorOrigin"+mn(t)],r&&Jt.rootDense);return n.createElement("div",{className:d},s)},as=n.memo(ns),Sa=function(a){return!(typeof a=="string"||n.isValidElement(a))},rs=(function(a){function i(o){var t;return(t=a.call(this,o)||this).enqueueSnackbar=function(r,s){if(s===void 0&&(s={}),r==null)throw new Error("enqueueSnackbar called with invalid argument");var d=Sa(r)?r:s,p=Sa(r)?r.message:r,l=d.key,c=d.preventDuplicate,g=At(d,["key","preventDuplicate"]),C=qt(l),f=C?l:new Date().getTime()+Math.random(),u=Kl(g,t.props),m=ce({id:f},g,{message:p,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,g.className)});return m.persist&&(m.autoHideDuration=void 0),t.setState(function(b){if(c===void 0&&t.props.preventDuplicate||c){var S=function(k){return C?k.id===f:k.message===p},x=b.queue.findIndex(S)>-1,h=b.snacks.findIndex(S)>-1;if(x||h)return b}return t.handleDisplaySnack(ce({},b,{queue:[].concat(b.queue,[m])}))}),f},t.handleDisplaySnack=function(r){return r.snacks.length>=t.maxSnack?t.handleDismissOldest(r):t.processQueue(r)},t.processQueue=function(r){var s=r.queue,d=r.snacks;return s.length>0?ce({},r,{snacks:[].concat(d,[s[0]]),queue:s.slice(1,s.length)}):r},t.handleDismissOldest=function(r){if(r.snacks.some(function(l){return!l.open||l.requestClose}))return r;var s=!1,d=!1;r.snacks.reduce(function(l,c){return l+(c.open&&c.persist?1:0)},0)===t.maxSnack&&(d=!0);var p=r.snacks.map(function(l){return s||l.persist&&!d?ce({},l):(s=!0,l.entered?(l.onClose&&l.onClose(null,"maxsnack",l.id),t.props.onClose&&t.props.onClose(null,"maxsnack",l.id),ce({},l,{open:!1})):ce({},l,{requestClose:!0}))});return ce({},r,{snacks:p})},t.handleEnteredSnack=function(r,s,d){if(!qt(d))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState(function(p){return{snacks:p.snacks.map(function(l){return l.id===d?ce({},l,{entered:!0}):ce({},l)})}})},t.handleCloseSnack=function(r,s,d){t.props.onClose&&t.props.onClose(r,s,d);var p=d===void 0;t.setState(function(l){var c=l.snacks,g=l.queue;return{snacks:c.map(function(C){return p||C.id===d?C.entered?ce({},C,{open:!1}):ce({},C,{requestClose:!0}):ce({},C)}),queue:g.filter(function(C){return C.id!==d})}})},t.closeSnackbar=function(r){var s=t.state.snacks.find(function(d){return d.id===r});qt(r)&&s&&s.onClose&&s.onClose(null,"instructed",r),t.handleCloseSnack(null,"instructed",r)},t.handleExitedSnack=function(r,s){if(!qt(s))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState(function(d){var p=t.processQueue(ce({},d,{snacks:d.snacks.filter(function(l){return l.id!==s})}));return p.queue.length===0?p:t.handleDismissOldest(p)})},t.enqueueSnackbar,t.closeSnackbar,t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar.bind(da(t)),closeSnackbar:t.closeSnackbar.bind(da(t))}},t}return Hr(i,a),i.prototype.render=function(){var o=this,t=this.state.contextValue,r=this.props,s=r.domRoot,d=r.children,p=r.dense,l=p!==void 0&&p,c=r.Components,g=c===void 0?{}:c,C=r.classes,f=this.state.snacks.reduce(function(m,b){var S,x=mn(b.anchorOrigin),h=m[x]||[];return ce({},m,((S={})[x]=[].concat(h,[b]),S))},{}),u=Object.keys(f).map(function(m){var b=f[m],S=b[0];return n.createElement(as,{key:m,dense:l,anchorOrigin:S.anchorOrigin,classes:C},b.map(function(x){return n.createElement(os,{key:x.id,snack:x,classes:C,Component:g[x.variant],onClose:o.handleCloseSnack,onEnter:o.props.onEnter,onExit:o.props.onExit,onExited:It([o.handleExitedSnack,o.props.onExited],x.id),onEntered:It([o.handleEnteredSnack,o.props.onEntered],x.id)})}))});return n.createElement(Wr.Provider,{value:t},d,s?Je.createPortal(u,s):u)},zr(i,[{key:"maxSnack",get:function(){return this.props.maxSnack||Ze.maxSnack}}]),i})(n.Component),Xr=function(){return n.useContext(Wr)};const is=[{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}],ls=[{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 Yr{constructor(i=is,o=ls){this._readFormatType=[],this._writeFormatType=[],this._readFormatType=Object.freeze([...i]),this._writeFormatType=Object.freeze([...o])}getReadFormats(){return this._readFormatType}getWriteFormats(){return this._writeFormatType}getAllReadFormatTypeAsString(){const i=[],o=this._readFormatType;for(let t=0;t<o.length;t++)for(let r=0;r<o[t].exts.length;r++)i.push("."+o[t].exts[r]);return i}async writeFile(i,o,t){if(!o||!i)throw new Error("Workbook model or file name must be provided.");try{return(await import("@sheetxl/io")).WorkbookIO.writeFile(i,o,t)}catch(r){throw new Error("Unable to load io library",{cause:r})}}async read(i,o){let t,r;const s=await o?.showBusy?.(`Opening${i.name?` ${i.name}`:""}...`);try{r=await import("@sheetxl/io")}catch(d){throw d}try{return await r.WorkbookIO.read({...i,progress:{async onStart(d){await i?.progress?.onStart?.(d),t=await o?.showBusy?.(`Opening '${d}'...`)}}})}catch(d){throw s?.(),t?.(),d}finally{s?.(),t?.()}}}const $e=new Yr,Ae={card:"_card_1a398_7",actionRoot:"_actionRoot_1a398_11",icons:"_icons_1a398_16",expand:"_expand_1a398_22",expandOpen:"_expandOpen_1a398_29",stackTraceContainer:"_stackTraceContainer_1a398_33"},Zr=n.memo(n.forwardRef((a,i)=>{const{id:o,message:t,iconVariant:r,error:s,hideIconVariant:d,...p}=a,{closeSnackbar:l}=Xr(),c=q.useTheme(),[g,C]=n.useState(!1),f=je.ErrorUtils.collectErrorChain(s,!0)?.[0]?.error,u=f&&!(f instanceof je.ExpectedError),m=n.useCallback(()=>{C(x=>!x)},[]),b=n.useCallback(()=>{l(o)},[o,l]);let S=f?.message;return!S&&n.isValidElement(t)&&(S=t),S||typeof t!="string"||(S=t),S||(S=`Unknown Error: ${t}`),e.jsx(fn,{ref:i,className:ie(Ae.root,"error-snackbar"),children:e.jsxs(B.Card,{className:Ae.card,style:{backgroundColor:c.palette.error.dark,border:`1px solid ${c.palette.error.dark}`},children:[e.jsxs(B.CardActions,{className:Ae.actionRoot,children:[d?null:r?.error,e.jsx(B.Typography,{variant:"body2",component:"div",className:Ae.typography,children:S}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Ae.icons,children:[u?e.jsx(B.IconButton,{"aria-label":"Show more",size:"small",className:ie(Ae.expand,{[Ae.expandOpen]:g}),onClick:m,children:e.jsx(w.DynamicIcon,{iconKey:"ExpandMore"})}):null,e.jsx(B.IconButton,{size:"small",className:Ae.expand,onClick:b,children:e.jsx(w.DynamicIcon,{iconKey:"Close",style:{transform:"scale(0.8)"}})})]})]}),u?e.jsx(B.Collapse,{in:g,timeout:"auto",children:e.jsx("div",{className:Ae.stackTraceContainer,style:{backgroundColor:c.palette.error.light,borderTop:`1px solid ${c.palette.error.main}`},children:e.jsx(y.StackTrace,{error:s,hideLineNumbers:!0})})}):null]})})}));Zr.displayName="ToastError";const Qr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="workbook",disabled:s=!1,...d}=a,p=w.useCallbackRef(c=>{const g={variant:w.CommandButtonType.Menuitem,parentFloat:c.floatReference,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:o.getCommand("newWorkbook")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:o.getCommand("openWorkbook")}),e.jsx(y.CommandPopupButton,{...g,commands:o,quickCommand:"saveWorkbook",createPopupPanel:f=>{const u={...g,parentFloat:f.floatReference,scope:"saveWorkbook"},m=[];return $e.getWriteFormats().forEach(b=>{if(b.isDefault)return;const S=b.key,x=o.getCommand(`saveWorkbookAs${S}`);x?m.push(n.createElement(y.CommandButton,{...u,key:S,command:x})):console.warn(`Unable to resolve command: 'saveWorkbookAs${S}'`)}),y.defaultCreatePopupPanel({...f,children:m,onClick:()=>{f.closeFloatAll()}})}})]});return y.defaultCreatePopupPanel({...c,children:C,onClick:f=>{f.isDefaultPrevented||c.closeFloatAll()}})},[s,o,t,r]),l="File";return e.jsx(y.CommandPopupButton,{commands:o,disabled:s,commandHook:t,scope:r,label:l,tooltip:"Options for saving and loading the workbook.",sx:{paddingBottom:"0px","& button":{paddingTop:"0px",paddingBottom:"0px",height:c=>`calc(1.25rem + ${c.spacing(2)}px)`}},...d,createPopupPanel:p,icon:e.jsx(y.LabelIcon,{className:"label",icon:null,label:l})})}));Qr.displayName="StandaloneFileCommandButton";const ss=e.jsx(y.ExhibitTooltip,{label:"SheetXL",description:"Visit me at sheetxl.com.",children:e.jsx(B.Box,{sx:{width:"24px",height:"24px",marginBottom:"4px",marginLeft:"6px"},children:e.jsx(oe.LogoNoPaddingIcon,{onClick:()=>{window?.open("https://www.sheetxl.com","_blank")},style:{width:"24px",height:"24px",cursor:"pointer"}})})}),Jr=n.memo(n.forwardRef((a,i)=>{const{commands:o,workbook:t,logo:r=ss,mainElement:s,showFileMenu:d=!0,showAppearanceMenu:p=!0,...l}=a,{reference:c}=y.useFloatStack(),[g,{width:C}]=Ve(),f=C<530,u=d?e.jsx(Qr,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(x,h,k){}}}):null,m=p?e.jsx(Fr,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(x,h,k){}}}):null,b=n.useMemo(()=>({paddingLeft:x=>x.spacing(1),paddingRight:x=>x.spacing(1)}),[]),S=n.useRef(null);return e.jsx(B.Box,{ref:et([S,g,i]),...l,children:vr({commands:o,renderCompact:f,workbook:t,selectWrapper:x=>e.jsxs(B.Box,{sx:{display:"flex",flex:"1",flexDirection:"row",alignItems:"stretch",gap:h=>h.spacing(1),paddingLeft:h=>h.spacing(1),paddingRight:h=>h.spacing(1)},children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:h=>h.spacing(.5)},children:[r,e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:h=>h.spacing(.25)},children:[u,x]})]}),e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 300%",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:s}),e.jsx(B.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"end",flex:f&&!m?"0 0 auto":"1 1 100%"},children:m})]}),selectProps:b,toolbarsProps:{Home:{sx:{}}}})})}));Jr.displayName="StudioToolbar";const ei=n.memo(a=>{const{workbook:i,setWorkbook:o,refWorkbookTitle:t,titleWorkbook:r,setWorkbookTitle:s,titlePlaceHolder:d,children:p,undoManager:l,commands:c,importExportDisabled:g,themeOptions:C}=a,f=(b=>{const{workbook:S,setWorkbook:x,importExportDisabled:h,workbookTitle:k="export",setWorkbookTitle:j,requestWorkbookTitle:v,themeOptions:T,undoManager:M,commands:P,onExecute:D}=b,F=w.useNotifier(),E=w.useCallbackRef(T?.onModeChange,[T?.onModeChange]),R=w.useCallbackRef(T?.onEnabledDarkGridChange,[T?.onEnabledDarkGridChange]),N=w.useCallbackRef(T?.onEnabledDarkImagesChange,[T?.onEnabledDarkImagesChange]),z=w.useCallbackRef(async($=null,U=null)=>{const Y=[];let _,L=null,G=null;if(typeof $=="string"?G=$:L=$,_=L?$:await je.CommonUtils.openFileDialog(G??$e.getAllReadFormatTypeAsString().join(",")),!_)return null;const Q={source:_,createWorkbookOptions:U,onWarning:re=>{Y.push(re)}},fe=await $e.read(Q,F);return Y.length>0&&(F.showMessage("Some elements were not able to be imported. See console for details."),console.warn(`Import warnings:
18
+ 0 22,12A10,10 0 0,0 12,2Z`}))},Qe={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(Wl,null),warning:n.createElement($l,null),error:n.createElement(Vl,null),info:n.createElement(_l,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:_r,transitionDuration:{enter:225,exit:195}},Kl=function(a,i){return function(o,t){return t===void 0&&(t=!1),t?ce({},Qe[o],{},i[o],{},a[o]):o==="autoHideDuration"?(r=a.autoHideDuration,s=i.autoHideDuration,(d=function(p){return typeof p=="number"||p===null})(r)?r:d(s)?s:Qe.autoHideDuration):o==="transitionDuration"?(function(p,l){var c=function(g,C){return C.some(function(f){return typeof g===f})};return c(p,["string","number"])?p:c(p,["object"])?ce({},Qe.transitionDuration,{},c(l,["object"])&&l,{},p):c(l,["string","number"])?l:c(l,["object"])?ce({},Qe.transitionDuration,{},l):Qe.transitionDuration})(a.transitionDuration,i.transitionDuration):a[o]||i[o]||Qe[o];var r,s,d}};function Lt(a){return Object.entries(a).reduce(function(i,o){var t,r=o[0],s=o[1];return ce({},i,((t={})[r]=No(s),t))},{})}var Ul="notistack-SnackbarContainer",ql="notistack-Snackbar",Kr="notistack-CollapseWrapper",Gl="notistack-MuiContent",Xl=function(a){return"notistack-MuiContent-"+a},ga=Lt({root:{height:0},entered:{height:"auto"}}),Eo="0px",Ur=n.forwardRef(function(a,i){var o=a.children,t=a.in,r=a.onExited,s=n.useRef(null),d=n.useRef(null),p=Oo(i,d),l=function(){return s.current?s.current.clientHeight:0};return n.createElement(pn,{in:t,unmountOnExit:!0,onEnter:function(c){c.style.height=Eo},onEntered:function(c){c.style.height="auto"},onEntering:function(c){var g=l(),C=ao({timeout:175,mode:"enter"}),f=C.duration,u=C.easing;c.style.transitionDuration=typeof f=="string"?f:f+"ms",c.style.height=g+"px",c.style.transitionTimingFunction=u||""},onExit:function(c){c.style.height=l()+"px"},onExited:r,onExiting:function(c){$r(c);var g=ao({timeout:175,mode:"exit"}),C=g.duration,f=g.easing;c.style.transitionDuration=typeof C=="string"?C:C+"ms",c.style.height=Eo,c.style.transitionTimingFunction=f||""},nodeRef:d,timeout:175},function(c,g){return n.createElement("div",Object.assign({ref:p,className:Ke(ga.root,c==="entered"&&ga.entered),style:ce({pointerEvents:"all",overflow:"hidden",minHeight:Eo,transition:mt("height")},c==="entered"&&{overflow:"visible"},{},c==="exited"&&!t&&{visibility:"hidden"})},g),n.createElement("div",{ref:s,className:Kr,style:{display:"flex",width:"100%"}},o))})});Ur.displayName="Collapse";var xa={right:"left",left:"right",bottom:"up",top:"down"},Yl=function(a){return"anchorOrigin"+mn(a)},Zl=function(){};function It(a,i){return a.reduce(function(o,t){return t==null?o:function(){for(var r=arguments.length,s=new Array(r),d=0;d<r;d++)s[d]=arguments[d];var p=[].concat(s);i&&p.indexOf(i)===-1&&p.push(i),o.apply(this,p),t.apply(this,p)}},Zl)}var Ql=typeof window<"u"?n.useLayoutEffect:n.useEffect;function ba(a){var i=n.useRef(a);return Ql(function(){i.current=a}),n.useCallback(function(){return i.current.apply(void 0,arguments)},[])}var Bo,qr=n.forwardRef(function(a,i){var o=a.children,t=a.className,r=a.autoHideDuration,s=a.disableWindowBlurListener,d=s!==void 0&&s,p=a.onClose,l=a.id,c=a.open,g=a.SnackbarProps,C=g===void 0?{}:g,f=n.useRef(),u=ba(function(){p&&p.apply(void 0,arguments)}),m=ba(function(x){p&&x!=null&&(f.current&&clearTimeout(f.current),f.current=setTimeout(function(){u(null,"timeout",l)},x))});n.useEffect(function(){return c&&m(r),function(){f.current&&clearTimeout(f.current)}},[c,r,m]);var b=function(){f.current&&clearTimeout(f.current)},S=n.useCallback(function(){r!=null&&m(.5*r)},[r,m]);return n.useEffect(function(){if(!d&&c)return window.addEventListener("focus",S),window.addEventListener("blur",b),function(){window.removeEventListener("focus",S),window.removeEventListener("blur",b)}},[d,S,c]),n.createElement("div",Object.assign({ref:i},C,{className:Ke(ql,t),onMouseEnter:function(x){C.onMouseEnter&&C.onMouseEnter(x),b()},onMouseLeave:function(x){C.onMouseLeave&&C.onMouseLeave(x),S()}}),o)});qr.displayName="Snackbar";var Jl=Lt({root:(Bo={display:"flex",flexWrap:"wrap",flexGrow:1},Bo[to]={flexGrow:"initial",minWidth:"288px"},Bo)}),fn=n.forwardRef(function(a,i){var o=a.className,t=At(a,["className"]);return n.createElement("div",Object.assign({ref:i,className:Ke(Jl.root,o)},t))});fn.displayName="SnackbarContent";var Rt=Lt({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"}}),ya="notistack-snackbar",Gr=n.forwardRef(function(a,i){var o=a.id,t=a.message,r=a.action,s=a.iconVariant,d=a.variant,p=a.hideIconVariant,l=a.style,c=a.className,g=s[d],C=r;return typeof C=="function"&&(C=C(o)),n.createElement(fn,{ref:i,role:"alert","aria-describedby":ya,style:l,className:Ke(Gl,Xl(d),Rt.root,Rt[d],c,!p&&g&&Rt.lessPadding)},n.createElement("div",{id:ya,className:Rt.message},p?null:g,t),C&&n.createElement("div",{className:Rt.action},C))});Gr.displayName="MaterialDesignContent";var Pt,Ro,Yt,Zt,Po,es=n.memo(Gr),ts=Lt({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),os=function(a){var i=n.useRef(),o=n.useState(!0),t=o[0],r=o[1],s=It([a.snack.onClose,a.onClose]),d=n.useCallback(function(){i.current=setTimeout(function(){r(function(P){return!P})},125)},[]);n.useEffect(function(){return function(){i.current&&clearTimeout(i.current)}},[]);var p,l=a.snack,c=a.classes,g=a.Component,C=g===void 0?es:g,f=n.useMemo(function(){return(function(P){P===void 0&&(P={});var D={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(P).filter(function(F){return!D[F]}).reduce(function(F,E){var R;return ce({},F,((R={})[E]=P[E],R))},{})})(c)},[c]),u=l.open,m=l.SnackbarProps,b=l.TransitionComponent,S=l.TransitionProps,x=l.transitionDuration,h=l.disableWindowBlurListener,k=l.content,j=At(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),v=ce({direction:(p=j.anchorOrigin,p.horizontal!=="center"?xa[p.horizontal]:xa[p.vertical]),timeout:x},S),T=k;typeof T=="function"&&(T=T(j.id,j.message));var M=["onEnter","onEntered","onExit","onExited"].reduce(function(P,D){var F;return ce({},P,((F={})[D]=It([a.snack[D],a[D]],j.id),F))},{});return n.createElement(Ur,{in:t,onExited:M.onExited},n.createElement(qr,{open:u,id:j.id,disableWindowBlurListener:h,autoHideDuration:j.autoHideDuration,className:Ke(ts.wrappedRoot,f.root,f[Yl(j.anchorOrigin)]),SnackbarProps:m,onClose:s},n.createElement(b,Object.assign({},v,{appear:!0,in:u,onExit:M.onExit,onExited:d,onEnter:M.onEnter,onEntered:It([M.onEntered,function(){a.snack.requestClose&&s(null,"instructed",a.snack.id)}],j.id)}),T||n.createElement(C,Object.assign({},j)))))},Mt={default:20},Qt={default:6,dense:2},Ca="."+Kr,Jt=Lt({root:(Pt={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:mt(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Pt[Ca]={padding:Qt.default+"px 0px",transition:"padding 300ms ease 0ms"},Pt.maxWidth="calc(100% - "+2*Mt.default+"px)",Pt[To]={width:"100%",maxWidth:"calc(100% - 32px)"},Pt),rootDense:(Ro={},Ro[Ca]={padding:Qt.dense+"px 0px"},Ro),top:{top:Mt.default-Qt.default+"px",flexDirection:"column"},bottom:{bottom:Mt.default-Qt.default+"px",flexDirection:"column-reverse"},left:(Yt={left:Mt.default+"px"},Yt[to]={alignItems:"flex-start"},Yt[To]={left:"16px"},Yt),right:(Zt={right:Mt.default+"px"},Zt[to]={alignItems:"flex-end"},Zt[To]={right:"16px"},Zt),center:(Po={left:"50%",transform:"translateX(-50%)"},Po[to]={alignItems:"center"},Po)}),ns=function(a){var i=a.classes,o=i===void 0?{}:i,t=a.anchorOrigin,r=a.dense,s=a.children,d=Ke(Ul,Jt[t.vertical],Jt[t.horizontal],Jt.root,o.containerRoot,o["containerAnchorOrigin"+mn(t)],r&&Jt.rootDense);return n.createElement("div",{className:d},s)},as=n.memo(ns),Sa=function(a){return!(typeof a=="string"||n.isValidElement(a))},rs=(function(a){function i(o){var t;return(t=a.call(this,o)||this).enqueueSnackbar=function(r,s){if(s===void 0&&(s={}),r==null)throw new Error("enqueueSnackbar called with invalid argument");var d=Sa(r)?r:s,p=Sa(r)?r.message:r,l=d.key,c=d.preventDuplicate,g=At(d,["key","preventDuplicate"]),C=qt(l),f=C?l:new Date().getTime()+Math.random(),u=Kl(g,t.props),m=ce({id:f},g,{message:p,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:Ke(t.props.className,g.className)});return m.persist&&(m.autoHideDuration=void 0),t.setState(function(b){if(c===void 0&&t.props.preventDuplicate||c){var S=function(k){return C?k.id===f:k.message===p},x=b.queue.findIndex(S)>-1,h=b.snacks.findIndex(S)>-1;if(x||h)return b}return t.handleDisplaySnack(ce({},b,{queue:[].concat(b.queue,[m])}))}),f},t.handleDisplaySnack=function(r){return r.snacks.length>=t.maxSnack?t.handleDismissOldest(r):t.processQueue(r)},t.processQueue=function(r){var s=r.queue,d=r.snacks;return s.length>0?ce({},r,{snacks:[].concat(d,[s[0]]),queue:s.slice(1,s.length)}):r},t.handleDismissOldest=function(r){if(r.snacks.some(function(l){return!l.open||l.requestClose}))return r;var s=!1,d=!1;r.snacks.reduce(function(l,c){return l+(c.open&&c.persist?1:0)},0)===t.maxSnack&&(d=!0);var p=r.snacks.map(function(l){return s||l.persist&&!d?ce({},l):(s=!0,l.entered?(l.onClose&&l.onClose(null,"maxsnack",l.id),t.props.onClose&&t.props.onClose(null,"maxsnack",l.id),ce({},l,{open:!1})):ce({},l,{requestClose:!0}))});return ce({},r,{snacks:p})},t.handleEnteredSnack=function(r,s,d){if(!qt(d))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState(function(p){return{snacks:p.snacks.map(function(l){return l.id===d?ce({},l,{entered:!0}):ce({},l)})}})},t.handleCloseSnack=function(r,s,d){t.props.onClose&&t.props.onClose(r,s,d);var p=d===void 0;t.setState(function(l){var c=l.snacks,g=l.queue;return{snacks:c.map(function(C){return p||C.id===d?C.entered?ce({},C,{open:!1}):ce({},C,{requestClose:!0}):ce({},C)}),queue:g.filter(function(C){return C.id!==d})}})},t.closeSnackbar=function(r){var s=t.state.snacks.find(function(d){return d.id===r});qt(r)&&s&&s.onClose&&s.onClose(null,"instructed",r),t.handleCloseSnack(null,"instructed",r)},t.handleExitedSnack=function(r,s){if(!qt(s))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState(function(d){var p=t.processQueue(ce({},d,{snacks:d.snacks.filter(function(l){return l.id!==s})}));return p.queue.length===0?p:t.handleDismissOldest(p)})},t.enqueueSnackbar,t.closeSnackbar,t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar.bind(da(t)),closeSnackbar:t.closeSnackbar.bind(da(t))}},t}return Hr(i,a),i.prototype.render=function(){var o=this,t=this.state.contextValue,r=this.props,s=r.domRoot,d=r.children,p=r.dense,l=p!==void 0&&p,c=r.Components,g=c===void 0?{}:c,C=r.classes,f=this.state.snacks.reduce(function(m,b){var S,x=mn(b.anchorOrigin),h=m[x]||[];return ce({},m,((S={})[x]=[].concat(h,[b]),S))},{}),u=Object.keys(f).map(function(m){var b=f[m],S=b[0];return n.createElement(as,{key:m,dense:l,anchorOrigin:S.anchorOrigin,classes:C},b.map(function(x){return n.createElement(os,{key:x.id,snack:x,classes:C,Component:g[x.variant],onClose:o.handleCloseSnack,onEnter:o.props.onEnter,onExit:o.props.onExit,onExited:It([o.handleExitedSnack,o.props.onExited],x.id),onEntered:It([o.handleEnteredSnack,o.props.onEntered],x.id)})}))});return n.createElement(Wr.Provider,{value:t},d,s?et.createPortal(u,s):u)},zr(i,[{key:"maxSnack",get:function(){return this.props.maxSnack||Qe.maxSnack}}]),i})(n.Component),Xr=function(){return n.useContext(Wr)};const is=[{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}],ls=[{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 Yr{constructor(i=is,o=ls){this._readFormatType=[],this._writeFormatType=[],this._readFormatType=Object.freeze([...i]),this._writeFormatType=Object.freeze([...o])}getReadFormats(){return this._readFormatType}getWriteFormats(){return this._writeFormatType}getAllReadFormatTypeAsString(){const i=[],o=this._readFormatType;for(let t=0;t<o.length;t++)for(let r=0;r<o[t].exts.length;r++)i.push("."+o[t].exts[r]);return i}async writeFile(i,o,t){if(!o||!i)throw new Error("Workbook model or file name must be provided.");try{return(await import("@sheetxl/io")).WorkbookIO.writeFile(i,o,t)}catch(r){throw new Error("Unable to load io library",{cause:r})}}async read(i,o){let t,r;const s=await o?.showBusy?.(`Opening${i.name?` ${i.name}`:""}...`);try{r=await import("@sheetxl/io")}catch(d){throw d}try{return await r.WorkbookIO.read({...i,progress:{async onStart(d){await i?.progress?.onStart?.(d),t=await o?.showBusy?.(`Opening '${d}'...`)}}})}catch(d){throw s?.(),t?.(),d}finally{s?.(),t?.()}}}const Ve=new Yr,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"},Zr=n.memo(n.forwardRef((a,i)=>{const{id:o,message:t,iconVariant:r,error:s,hideIconVariant:d,...p}=a,{closeSnackbar:l}=Xr(),c=q.useTheme(),[g,C]=n.useState(!1),f=je.ErrorUtils.collectErrorChain(s,!0)?.[0]?.error,u=f&&!(f instanceof je.ExpectedError),m=n.useCallback(()=>{C(x=>!x)},[]),b=n.useCallback(()=>{l(o)},[o,l]);let S=f?.message;return!S&&n.isValidElement(t)&&(S=t),S||typeof t!="string"||(S=t),S||(S=`Unknown Error: ${t}`),e.jsx(fn,{ref:i,className:ie(Le.root,"error-snackbar"),children:e.jsxs(B.Card,{className:Le.card,style:{backgroundColor:c.palette.error.dark,border:`1px solid ${c.palette.error.dark}`},children:[e.jsxs(B.CardActions,{className:Le.actionRoot,children:[d?null:r?.error,e.jsx(B.Typography,{variant:"body2",component:"div",className:Le.typography,children:S}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Le.icons,children:[u?e.jsx(B.IconButton,{"aria-label":"Show more",size:"small",className:ie(Le.expand,{[Le.expandOpen]:g}),onClick:m,children:e.jsx(w.DynamicIcon,{iconKey:"ExpandMore"})}):null,e.jsx(B.IconButton,{size:"small",className:Le.expand,onClick:b,children:e.jsx(w.DynamicIcon,{iconKey:"Close",style:{transform:"scale(0.8)"}})})]})]}),u?e.jsx(B.Collapse,{in:g,timeout:"auto",children:e.jsx("div",{className:Le.stackTraceContainer,style:{backgroundColor:c.palette.error.light,borderTop:`1px solid ${c.palette.error.main}`},children:e.jsx(y.StackTrace,{error:s,hideLineNumbers:!0})})}):null]})})}));Zr.displayName="ToastError";const Qr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="workbook",disabled:s=!1,...d}=a,p=w.useCallbackRef(c=>{const g={variant:w.CommandButtonType.Menuitem,parentFloat:c.floatReference,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:o.getCommand("newWorkbook")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:o.getCommand("openWorkbook")}),e.jsx(y.CommandPopupButton,{...g,commands:o,quickCommand:"saveWorkbook",createPopupPanel:f=>{const u={...g,parentFloat:f.floatReference,scope:"saveWorkbook"},m=[];return Ve.getWriteFormats().forEach(b=>{if(b.isDefault)return;const S=b.key,x=o.getCommand(`saveWorkbookAs${S}`);x?m.push(n.createElement(y.CommandButton,{...u,key:S,command:x})):console.warn(`Unable to resolve command: 'saveWorkbookAs${S}'`)}),y.defaultCreatePopupPanel({...f,children:m,onClick:()=>{f.closeFloatAll()}})}})]});return y.defaultCreatePopupPanel({...c,children:C,onClick:f=>{f.isDefaultPrevented||c.closeFloatAll()}})},[s,o,t,r]),l="File";return e.jsx(y.CommandPopupButton,{commands:o,disabled:s,commandHook:t,scope:r,label:l,tooltip:"Options for saving and loading the workbook.",sx:{paddingBottom:"0px","& button":{paddingTop:"0px",paddingBottom:"0px",height:c=>`calc(1.25rem + ${c.spacing(2)}px)`}},...d,createPopupPanel:p,icon:e.jsx(y.LabelIcon,{className:"label",icon:null,label:l})})}));Qr.displayName="StandaloneFileCommandButton";const ss=e.jsx(y.ExhibitTooltip,{label:"SheetXL",description:"Visit me at sheetxl.com.",children:e.jsx(B.Box,{sx:{width:"24px",height:"24px",marginBottom:"4px",marginLeft:"6px"},children:e.jsx(oe.LogoNoPaddingIcon,{onClick:()=>{window?.open("https://www.sheetxl.com","_blank")},style:{width:"24px",height:"24px",cursor:"pointer"}})})}),Jr=n.memo(n.forwardRef((a,i)=>{const{commands:o,workbook:t,logo:r=ss,mainElement:s,showFileMenu:d=!0,showAppearanceMenu:p=!0,...l}=a,{reference:c}=y.useFloatStack(),[g,{width:C}]=_e(),f=C<530,u=d?e.jsx(Qr,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(x,h,k){}}}):null,m=p?e.jsx(Fr,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(x,h,k){}}}):null,b=n.useMemo(()=>({paddingLeft:x=>x.spacing(1),paddingRight:x=>x.spacing(1)}),[]),S=n.useRef(null);return e.jsx(B.Box,{ref:tt([S,g,i]),...l,children:vr({commands:o,renderCompact:f,workbook:t,selectWrapper:x=>e.jsxs(B.Box,{sx:{display:"flex",flex:"1",flexDirection:"row",alignItems:"stretch",gap:h=>h.spacing(1),paddingLeft:h=>h.spacing(1),paddingRight:h=>h.spacing(1)},children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:h=>h.spacing(.5)},children:[r,e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:h=>h.spacing(.25)},children:[u,x]})]}),e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 300%",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:s}),e.jsx(B.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"end",flex:f&&!m?"0 0 auto":"1 1 100%"},children:m})]}),selectProps:b,toolbarsProps:{Home:{sx:{}}}})})}));Jr.displayName="StudioToolbar";const ei=n.memo(a=>{const{workbook:i,setWorkbook:o,refWorkbookTitle:t,titleWorkbook:r,setWorkbookTitle:s,titlePlaceHolder:d,children:p,undoManager:l,commands:c,importExportDisabled:g,themeOptions:C}=a,f=(b=>{const{workbook:S,setWorkbook:x,importExportDisabled:h,workbookTitle:k="export",setWorkbookTitle:j,requestWorkbookTitle:v,themeOptions:T,undoManager:M,commands:P,onExecute:D}=b,F=w.useNotifier(),E=w.useCallbackRef(T?.onModeChange,[T?.onModeChange]),R=w.useCallbackRef(T?.onEnabledDarkGridChange,[T?.onEnabledDarkGridChange]),N=w.useCallbackRef(T?.onEnabledDarkImagesChange,[T?.onEnabledDarkImagesChange]),z=w.useCallbackRef(async($=null,U=null)=>{const Y=[];let _,L=null,G=null;if(typeof $=="string"?G=$:L=$,_=L?$:await je.CommonUtils.openFileDialog(G??Ve.getAllReadFormatTypeAsString().join(",")),!_)return null;const Q={source:_,createWorkbookOptions:U,onWarning:re=>{Y.push(re)}},fe=await Ve.read(Q,F);return Y.length>0&&(F.showMessage("Some elements were not able to be imported. See console for details."),console.warn(`Import warnings:
19
19
  `+Y.join(`
20
- `))),fe},[D,F,S]),O=w.useCallbackRef(async($,U,Y)=>{if(!U&&v){const _=await v("Enter Workbook name to "+(Y.isDefault?"Save.":`Export as ${Y.description}.`));return _!==null&&$e.writeFile(_,$,{formatType:Y.key})}return $e.writeFile(U,$,{formatType:Y.key})},[F,S,v]),H=n.useCallback(()=>({contains:$=>!0,focus(){}}),[]),I=n.useMemo(()=>{const $=[];h||($e.getWriteFormats().forEach(Y=>{const _=Y.isDefault,L={label:_?"Save Workbook":`Save Workbook as ${Y.description}`,scopedLabels:{workbook:"Save",saveWorkbook:`as ${Y.description}`},tags:Y.tags,description:`Save the workbook to the desktop${_?"":` as ${Y.description}`}.`,icon:"FileDownloadAsSheet"};_&&(L.shortcut={key:"S",modifiers:[w.KeyModifiers.Ctrl]},$.push(new w.Command("saveWorkbookAs",H,{label:"Save Workbook As…",scopedLabels:{workbook:"Save as…",saveWorkbook:"as…"},shortcut:[{key:"S",modifiers:[w.KeyModifiers.Shift,w.KeyModifiers.Ctrl]},{key:"F12"}],description:"Save the workbook to the desktop with the provided name."},()=>{O(S,null,Y).catch(fe=>{F.showError(fe)})})));const G=Y.key,Q=_?"saveWorkbook":`saveWorkbookAs${G}`;G==="CSV"?L.icon="FileDownloadAsCSV":G==="Excel"&&(L.icon="FileDownloadAsExcel"),$.push(new w.Command(Q,H,L,fe=>{O(S,fe??k,Y).catch(re=>{F.showError(re)})}))}),$.push(new w.Command("openWorkbook",H,{label:"Open Workbook…",scopedLabels:{workbook:"Open…"},description:"Open a workbook from the desktop.",icon:"FileOpen",shortcut:{key:"O",modifiers:[w.KeyModifiers.Ctrl]}},async(Y=null)=>{const _={date1904:S.isDate1904(),...S.options};try{const L=await z(Y,_);if(!L)return;const G=L.title,Q=L.workbook,fe=Q.getSelectedSheet();if(L.formatType.mimeType==="text/csv"){const re=S.findValidSheetName(G);await S.doBatch(async()=>{const me={colStart:0,rowStart:0,colEnd:0,rowEnd:0};let Se=fe.getUsedRange();if(!Se)return void F.showMessage("The file appears to be blank.");Se=Se.getUnion(me),await S.getSheets().add({name:re,autoSelect:!0}).getRange(me).copyFrom(Se)},`Import CSV '${G}'`)}else S?.close(),j?.(G),x(Q)}catch(L){F.showError(L)}})),$.push(new w.Command("openWorkbookFromUrl",H,{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 _=await F.showInput({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(_.option!=="Open")return;Y=_.input}Y&&console.log("openWorkbookFromUrl",Y)})));let U=[];return T&&(U=[new w.Command("themeMode",H,{label:"Light/Dark Mode",scopedLabels:{appearance:"Light/Dark Mode"},description:"Toggle the application styling between light and dark mode."}),new w.Command("defaultThemeMode",H,{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 w.Command("enableDarkGrid",H,{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 w.Command("enableDarkImages",H,{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."})]),[...$,...U,new w.SimpleCommand("help",H,{label:"Show Help",description:"Provide Help.",icon:"Documentation",shortcut:{key:"F1"}},()=>{}),new w.SimpleCommand("showKeyboardShortcuts",H,{label:"Keyboard Shortcuts",description:"Show keyboard shortcuts.",icon:"Keyboard",shortcut:{key:"/",modifiers:[w.KeyModifiers.Ctrl]}},()=>{}),new w.Command("gotoUrlGithub",H,{label:"Github",description:"Download examples, explore source code, and leave a star.",icon:"Github"},()=>{window?.open("https://github.com/sheetxl/sheetxl")}),new w.Command("gotoUrlDiscord",H,{label:"Discord",description:"Join our community on discord.",icon:"Discord"},()=>{window?.open("https://discord.gg/NTKdwUgK9p")}),new w.Command("gotoUrlDocumentation",H,{label:"Documentation",description:"Read the documentation.",icon:"Documentation"},()=>{window?.open("https://www.sheetxl.com/docs")}),new w.Command("gotoUrlIssue",H,{label:"Create Issue",description:"Create an issue to identify a bug or a feature request.",icon:"Ticket"},()=>{window?.open("https://github.com/sheetxl/sheetxl/issues")})]},[S,k,F,h,T,P,M]),W=n.useMemo(()=>{let $=null;return $=P?P.createChildGroup(H,"standaloneWorkbook",!1):new w.CommandGroup(H,"standaloneWorkbook"),$.addCommands(I,!0),$},[P,I]);w.useUndoManager({manager:M,commands:W});const ee=B.useMediaQuery("(prefers-color-scheme: dark)"),{themeMode:X}=y.useResolvedThemeMode();n.useEffect(()=>{if(!T||!W)return;const $=T.mode==="dark"||!T.mode&&X==="dark";W.getCommand("themeMode").update({state:T.mode??null,label:$?"Dark Mode":"Light Mode",scopedLabels:{appearance:$?"Dark Mode":"Light Mode"},icon:$?"DarkMode":"LightMode"}).updateCallback(()=>{E($?y.ThemeMode.Light:y.ThemeMode.Dark)}),W.getCommand("defaultThemeMode").update({state:!T.mode,icon:ee?"SystemDefaultDarkMode":"SystemDefaultLightMode"}).updateCallback(()=>{E(null)}),W.getCommand("enableDarkGrid").update({state:T.enableDarkGrid}).updateCallback(()=>{R(!T.enableDarkGrid)}),W.getCommand("enableDarkImages").update({state:T.enableDarkImages}).updateCallback(()=>{N(!T.enableDarkImages)})},[X,T,I]);const{showModal:ne}=y.useModal();return n.useEffect(()=>{const $=()=>new Promise((U,Y)=>{const _=n.lazy(()=>Promise.resolve().then(()=>require("./CYMqmv5IamB1x14k.cjs"))),L=ne(_,{title:"Shortcut Keys Reference",commands:W,onDone:()=>{L.hide()},slotProps:{transition:{onExited:()=>{U(!0)}}}})});W.getCommand("showKeyboardShortcuts").updateCallback(()=>$()),W.getCommand("help").updateCallback(()=>$())},[I,W]),W})({workbook:i,setWorkbook:o,importExportDisabled:g,workbookTitle:r,setWorkbookTitle:s,commands:c,requestWorkbookTitle:b=>new Promise(S=>{t.current?t.current.requestWorkbookTitle((x,h)=>{S(x)},{selectAll:!0,requestReason:b}):S(d)}),themeOptions:C,undoManager:l,onExecute:n.useCallback(()=>{},[])}),u=n.useMemo(()=>e.jsx(Ir,{commands:f,disableHover:!0,sx:{padding:"0"},buttonProps:{sx:{maxHeight:"22px"}}}),[f]),m={commands:f};return i&&(m.statusBarProps={childrenEnd:u}),p?n.cloneElement(p,m):null});ei.displayName="CommandsWrapper";const ti=n.memo(a=>{const{children:i}=a,o=Xr(),t=o?o.enqueueSnackbar:()=>{},r=o?o.closeSnackbar:()=>{},[s,d]=n.useState({isMounted:!1,label:null,starting:new Map,running:new Map}),p=n.useCallback(()=>{d(x=>({...x,isMounted:!0}))},[]),l=n.useCallback(()=>{d(x=>({...x,isMounted:!1}))},[]),c={},g=y.useLazyWindow(c),C=y.useOptionsDialog(c),f=y.useInputDialog(c),u=n.useRef(new Set),m=n.useMemo(()=>{const x=(j,v)=>{if(v?.onceKey){if(u.current.has(v.onceKey))return;const M=new Set(u.current);M.add(v.onceKey),u.current=M}const T={variant:v?.type??w.NotifierType.Info,anchorOrigin:{vertical:"top",horizontal:"center"},preventDuplicate:v?.preventDuplicate,persist:v?.persist??v?.type===w.NotifierType.Error,action:M=>e.jsx(B.IconButton,{onClick:()=>r(M),children:e.jsx(w.DynamicIcon,{iconKey:"Cancel"})})};v?.enqueueProps&&Object.assign(T,v.enqueueProps),j||console.log("message is 'null'",v),t(j??"Alert",T)},h={showMessage:x,showBusy:(j,v)=>{let T=null;const M=new Promise(P=>{T=P});return d(P=>{const D=new Map(P.starting);return D.set(M,T),{...P,label:j,starting:D}}),M},showWindow:(j,v)=>{const T=v;return v={...v,onKeyDown:M=>{M.isDefaultPrevented()||M.isPropagationStopped()||T?.onKeyDown?.(M)}},g(j,{sort:()=>Promise.resolve().then(()=>require("./CN5q08lr4Coj9gzy.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./CC-q_GCvhI_uweI4.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./-SJdVflEYXFC2raH.cjs")),comments:()=>Promise.resolve().then(()=>require("./BE0n-qrL7I0lr2f8.cjs")),find:()=>Promise.resolve().then(()=>require("./CAxeR5WYtM_OKUqg.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./CwHuP4ot4XxM1FbL.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./Ij3b1ONhNaWLtkRT.cjs")),resizeHeader:()=>Promise.resolve().then(()=>require("./NpKL7qsDwzMarfjO.cjs"))}[j],v)},showOptions:C,showInput:f,showError:j=>{let v,T=w.NotifierType.Error,M="Unknown Error";typeof j=="string"?M=j:j instanceof Error&&(v=j,j.message&&(M=j.message)),j instanceof je.PartialError&&(T=w.NotifierType.Info),x(M,{type:T,enqueueProps:{error:v}})}},k=new w.DefaultReactNotifier;return k.setOverrides(h),k},[]);n.useEffect(()=>{s.starting.size<=0||!s.isMounted||d(x=>{const h=new Map(x.running);return x.starting.forEach((k,j)=>{const v=()=>{d(T=>{const M=new Map(T.running);return M.delete(j),{...T,running:M}})};h.set(j,v),k(v)}),{...x,starting:new Map,running:h}})},[s]);const[b,S]=n.useState(null);return n.useEffect(()=>{s.starting.size!==0||s.running.size!==0?S(e.jsx(y.LoadingPanel,{icon:e.jsx(y.AnimatedTraversingEllipsisIcon,{sx:{transform:"scale(0.7)",marginLeft:"-6px"}}),panel:!0,label:s.label,onMount:p,onUnmount:l,sx:{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",zIndex:"9999"}})):S(null)},[s.starting,s.running]),e.jsxs(w.NotifierProvider,{notifier:m,children:[b,i]})});ti.displayName="SnackbarWrapper";const cs=n.memo(n.forwardRef((a,i)=>{const{children:o,title:t,taskPanes:r,onSelect:s,selected:d,registry:p=oe.DefaultTaskPaneRegistry,style:l,iconsOnly:c,className:g,...C}=a,f=n.useMemo(()=>r.map(b=>{const S=p.getRegisteredTaskPane(b);if(!S)return null;let x=S.getIcon?.();x&&(typeof x=="string"&&(x=e.jsx(w.DynamicIcon,{iconKey:x})),x=e.jsx("span",{style:{display:"inline-block",transform:"rotate(90deg)",transformOrigin:"center"},children:x}));const h=b===d;return e.jsx(B.Tab,{value:b,label:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:S.getTitle()??"",placement:"left-start",children:e.jsxs(B.Box,{sx:{padding:"0px 0px",writingMode:"vertical-rl",textOrientation:"mixed",display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:"0px",color:k=>k.palette.text.secondary},children:[x&&e.jsx(B.Box,{sx:{display:"inline-block",transformOrigin:"center",color:k=>k.palette.text.secondary},children:x}),c&&x?null:e.jsx(B.Typography,{component:"div",textTransform:"none",sx:{padding:"4px 0px",color:k=>h?k.palette.primary.main:k.palette.text.secondary},children:S.getTitle()})]})}),sx:{padding:"4px 4px",minWidth:"0px",minHeight:"0px",borderRadius:"4px"},className:ie("taskpane-strip-item",{"Mui-selected":h}),onClick:()=>a.onSelect(b)},b)}),[r,d,s,p]),u=w.useImperativeElement(i,()=>({isTaskPaneStrip:()=>!0}),[]),m=n.useMemo(()=>ie("taskpane-strip",g),[g]);return e.jsx(B.Box,{ref:u,className:m,sx:{paddingLeft:"2px",paddingTop:"4px",...l},...C,children:e.jsx(B.Tabs,{orientation:"vertical",variant:"scrollable",value:d,onChange:(b,S)=>{s(S)},slotProps:{list:{sx:{gap:"2px"}},indicator:{sx:{left:"0px",right:"unset"}}},children:f})})})),ds=(a,i)=>e.jsx(cs,{ref:i,...a}),us=n.forwardRef((a,i)=>{const{commands:o,model:t,...r}=a,s=q.useTheme(),d=`solid ${q.alpha(s.palette.divider,.2)} 1px`,p=`${s.shape.borderRadius??4}px`,l=`${s.spacing?.(.5)??4}px`,c=n.useRef(null);return e.jsx(oe.TaskPaneArea,{model:t,ref:i,frameProps:{style:{border:d,borderRadius:p,marginBottom:l}},alwaysShowStrip:!0,renderTaskPanelTitle:(g,C)=>{const{title:f,icon:u,onClose:m,readOnly:b,focused:S,...x}=g;return e.jsx(B.DialogTitle,{className:ie({"Mui-selected":S}),sx:{display:"flex",flex:"1 1 %0",color:h=>h.palette.text.secondary,boxSizing:"border-box",padding:"0 0",transitionProperty:"opacity",transitionDuration:h=>`${h.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:h=>h.transitions.duration.shortest/2+"ms"},backgroundColor:h=>q.alpha(h.palette.action.hover,.03),borderBottom:h=>`solid ${q.alpha(h.palette.divider,.2)} 1px`},...x,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 10%",flexDirection:"row",alignItems:"center",marginTop:h=>h.spacing(.25),marginBottom:h=>h.spacing(.25),marginLeft:h=>h.spacing(1),marginRight:h=>h.spacing(1)},children:[e.jsx(B.Box,{sx:{flex:"1 1 100%",paddingLeft:h=>h.spacing(1)},children:f}),e.jsx(y.ExhibitTooltip,{label:"Close",children:e.jsx(B.IconButton,{"aria-label":"close",sx:{color:h=>h.palette.text.icon??h.palette.action.active},touchRippleRef:c,onPointerDown:h=>{c.current?.start(h,{center:!1}),h.stopPropagation(),h.preventDefault()},onPointerUp:()=>{m()},children:e.jsx(w.DynamicIcon,{iconKey:"Close"})})})]})})},renderTaskPaneStrip:ds,...a,onOpen:()=>{a?.onOpen?.()},onClose:()=>{a?.onClose?.()},commands:o,...r})}),wa={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},oi=n.memo(n.forwardRef((a,i)=>{const{mainElement:o,sidebarElement:t,className:r,style:s,...d}=a,p=q.useTheme(),[l,{width:c}]=Ve(),g=c>530||c===0,C=n.useRef(null);let f=null,u=4,m=13;return g?f="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":(f="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",u=13,m=4),e.jsx(w.SplitPane,{ref:et([C,l,i]),className:r,style:s?{...wa,...s}:wa,...d,fixedPane:"after",position:"40%",minAfter:g?"280px":"120px",splitDirection:g?"row":"column",resizerProps:{className:"styled-resizer",style:{minWidth:g?"6px":void 0,minHeight:g?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${u}' height='${m}' viewBox='0 0 ${u} ${m}' version='1.1' fill='${p.palette.text.icon??p.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${f}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:g?"left center":"top center"}},elementBefore:o,paneBeforeProps:{style:{flexDirection:"column",marginRight:t?void 0:"6px"}},elementAfter:t,paneAfterProps:{style:{marginLeft:g?"0px":"4px",marginRight:g?"8px":"4px"}}})}));oi.displayName="StudioSplitPane",Mr(),w.DefaultDynamicIconService.register("plugin-scripts",{icons:{}}),oe.DefaultTaskPaneRegistry.registerTaskPane({key:"scriptEditor",getTitle:()=>"Script (Typescript)",getIcon:()=>"ScriptRun",renderTaskPane:cl},!0);const ro=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,style:r,onElementLoad:s,onError:d,undoManager:p,errorPanel:l=y.ErrorPanel,onKeyDown:c,workbook:g,createWorkbookOptions:C,onWorkbookChange:f,logo:u,importExportDisabled:m=!1,themeOptions:b,autoFocus:S=!1,commands:x,title:h,onTitleChange:k,titleProps:j,renderLoadingPanel:v,...T}=a,M=n.useRef(null),P=w.useCallbackRef(f,[f]),D=w.useCallbackRef(k??j?.onTitleChange,[k??j?.onTitleChange]),F=j?.placeHolder??"Untitled",E=b?.mode,{themeMode:R,source:N}=y.useResolvedThemeMode({mode:E}),z=n.useMemo(()=>({...b,light:y.createExhibitTheme(!1,je.CommonUtils.deepMerge(b?.theme??{},b?.light??{})),dark:y.createExhibitTheme(!0,je.CommonUtils.deepMerge(b?.theme??{},b?.dark??{}))}),[b]),O=R===y.ThemeMode.Dark,[H,I]=n.useState(null);n.useEffect(()=>{I(p??new je.UndoManager)},[p]);const[W,ee]=n.useState(null),[X,ne]=n.useState(null),$=oe.useDocThemes();n.useLayoutEffect(()=>{if(!g||Object.keys(g).length===0&&!je.CommonUtils.isPromiseLike(g)){const Z={theme:$.getDefaultTheme(),...C};ne(new A.Workbook(Z))}else ne(g)},[g]),n.useLayoutEffect(()=>{if(X){if(X instanceof A.Workbook)return ee({workbook:X}),void(g!==X&&P?.(X));(async()=>{try{let Z,le=await Promise.resolve(X);le&&le.source&&(le=await $e.read(le)),le.workbook?(G(le.title),Z=le.workbook):Z=le,P?.(Z),ee({workbook:Z})}catch(Z){P?.(null),ee({error:Z})}})()}},[X]);const[U,Y]=n.useState(null);n.useEffect(()=>{if(!H||!W)return;H.clear();const Z=W?.workbook?.getTransactions();if(Z)return Z.addListener({onCommitEnd:le=>{le.getDescription()?H.addUndoOperation({description:le.getDescription(),undo:()=>(Z.revert(le.getId()),U.source?.focus(),()=>{Z.restore(le.getId()),U.source?.focus()})}):console.warn("commit has no description",le)}})},[H,W,U]);const _=w.useCallbackRef(Z=>{Z?H.setRepeatableOperation({description:Z.label(),repeat:async()=>Z.execute()}):H.setRepeatableOperation(null)},[H]),[L,G]=n.useState(h??j?.title??"");n.useEffect(()=>{G(h??j?.title??"")},[h??j?.title]),n.useEffect(()=>{D?.(L)},[L]);const[Q,fe]=n.useState(null),re=n.useMemo(()=>{const Z=()=>({contains:le=>!0,focus(){}});return x?x.createChildGroup(Z,"application",!1):new w.CommandGroup(Z,"application")},[x]),me=w.useCallbackRef(async Z=>{fe(Z.source.getViewportElement()),Y(Z),re.activate("sheet"),await w.DefaultDynamicIconService.prefetch(),s?.(Z)},[re]);n.useEffect(()=>{U&&S&&U.source?.focus(typeof S=="object"?S:void 0)},[U]);const Se=n.useRef(null),Ce=n.useCallback(Z=>{let le=null;return j?.hidden||(le=e.jsx(sn,{...j,style:{maxWidth:"100%",...j?.style},workbook:M.current,ref:Se,title:L,placeHolder:F,onTitleChange:Ke=>{G(Ke)}})),e.jsx(Jr,{...Z,logo:u,mainElement:le,showFileMenu:!m,showAppearanceMenu:!!(z?.onEnabledDarkGridChange||z?.onEnabledDarkImagesChange||z?.onModeChange)})},[u,L,j,z,m,re]);n.useEffect(()=>{const Z=le=>le.preventDefault();return M.current?.addEventListener("wheel",Z,{passive:!1}),()=>{M.current?.removeEventListener("wheel",Z)}},[]);const J=n.useMemo(()=>{const Z={transparentBackground:!0};return e.jsx(B.Box,{sx:t,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",...r},children:v?.(Z)??e.jsx(y.LoadingPanel,{...Z})})},[t,r,v]),K=n.useCallback(({error:Z})=>(d?.(Z),e.jsx(l,{sx:t,style:r,error:Z??"Unable to display empty workbook."})),[t,r,d]),te=n.useMemo(()=>({...t,"& .SnackbarContainer-root":{position:"absolute !important"},"& .notistack-SnackbarContainer > div":{maxWidth:"100%"},"& .notistack-Snackbar":{minWidth:"unset"},"& .notistack-Snackbar > .error-snackbar .MuiTypography-root":{color:Z=>Z.palette.getContrastText(Z.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiCardActions-root":{color:Z=>Z.palette.getContrastText(Z.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root":{color:Z=>Z.palette.getContrastText(Z.palette.error.main)},"& .notistack-MuiContent *":{fontFamily:Z=>Z.typography.fontFamily},"& #notistack-snackbar":{maxWidth:"560px",whiteSpace:"pre-wrap"},"*":{userSelect:"none"}}),[t]),[de,ve]=n.useState(null),se=n.useCallback((Z,le)=>e.jsx(us,{ref:le,model:X,commands:re,...Z}),[re,X]),De=n.useCallback(Z=>e.jsx(oi,{mainElement:Z,sidebarElement:de}),[de]),Te=et([M,i]),Ne=n.useMemo(()=>{if(!W)return J;if(W.error||!W.workbook)return K({error:W.error});let Z=null,le=null,Ke=!1;return z&&(Z=O?z.dark:z.light,le=O&&z.enableDarkGrid?z.dark:z.light,Ke=z.enableDarkImages),e.jsx(ln,{sx:te,style:r,tabIndex:0,autoFocus:!0,workbook:W.workbook,ref:Te,renderToolbar:Ce,onElementLoad:me,onRepeatCommandChange:_,onKeyDown:ht=>{c?.(ht)},renderLoadingPanel:v,gridTheme:le,headersTheme:Z,enableDarkImages:Ke,mainWrapper:De,className:ie(o),onContextMenu:ht=>ht.preventDefault(),...T},"WorkbookElement")},[W,L,H,J,v,z,T,Ce,te,De]);let ue=e.jsx(rs,{maxSnack:3,domRoot:Q,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(Z,le,Ke)=>{M.current?.focus()},Components:{error:Zr},iconVariant:{success:e.jsx(B.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(w.DynamicIcon,{iconKey:"ErrorAlert",style:{marginRight:"8px"}})},children:e.jsx(oe.TaskPaneProvider,{createArea:se,onUpdateArea:Z=>{ve(Z)},children:e.jsx(y.ModalProvider,{children:e.jsx(ti,{children:e.jsx(w.UncaughtErrorBoundary,{children:e.jsx(w.ReactErrorBoundary,{children:e.jsx(ei,{workbook:W?.workbook,setWorkbook:ne,importExportDisabled:m,titlePlaceHolder:F,titleWorkbook:L,setWorkbookTitle:G,refWorkbookTitle:Se,commands:re,undoManager:H,themeOptions:z,children:Ne})})})})})})});return z&&(ue=e.jsxs(q.ThemeProvider,{theme:O?z.dark:z.light,children:[z.cssBaseline?e.jsx(B.CssBaseline,{}):null,ue]})),ue}));ro.displayName="EagerStudio";const ms=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:ro,default:ro},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=Fr,exports.AutoColorPosition=mt,exports.BorderCommandButton=Fa,exports.BorderPopupButton=Da,exports.BorderStylePopupButton=Ma,exports.CellsDeleteCommandButton=Ho,exports.CellsFormatCommandButton=Wo,exports.CellsInsertCommandButton=zo,exports.Checkboard=Ra,exports.ClearCommandButton=Lo,exports.ColorButton=io,exports.ColorButtonList=Dt,exports.ColorCommandButton=ft,exports.ColorPanel=Pa,exports.ColorPanelType=Ba,exports.ColorPopupButton=Ao,exports.DocThemeCommandButton=Dr,exports.EagerStudio=ro,exports.FillCommandButton=za,exports.FilterColumnMenu=Jo,exports.FilterCommandButton=Vi,exports.Filters=cr,exports.FindCommandButton=Oa,exports.FontFamilyCommandButton=$a,exports.FontSizeCommandButton=Aa,exports.FormulaBar=Qo,exports.FreezeCommandButton=Na,exports.HelpCommandButton=Ir,exports.HorizontalAlignCommandButton=va,exports.InsertFunctionCommandPopupButton=Nr,exports.InsertFunctionSumCommandPopupButton=un,exports.InsertImageCommandButton=dn,exports.MergeCommandButton=Ia,exports.NamedCollectionEditor=Zo,exports.NamedInput=Uo,exports.NumberFormatCommandButton=La,exports.PasteCommandButton=_o,exports.PresetCellStylesCommandButton=Ga,exports.PresetTableStylesCommandButton=cn,exports.RangeInput=qo,exports.SheetTab=en,exports.SheetTabMenu=tn,exports.SheetZoomScale=Go,exports.SheetsAllMenu=on,exports.SortFilterCommandButton=$o,exports.StatusBar=Xo,exports.Studio=Or,exports.StyledStrokeIcon=Mo,exports.TableDetailsPanel=Rr,exports.TableDetailsTaskPane=Pr,exports.TablePlugin=Mr,exports.TableStyleCanvasPreview=Ya,exports.TableStyleOptionsPanel=Za,exports.TableStylePreview=Ko,exports.TextEffectsCommandButton=Va,exports.TextOverflowCommandButton=Ta,exports.TextRotateCommandButton=Ea,exports.ThemeSelectButton=tr,exports.ThemeSelectPanel=or,exports.ThemeSelectPopupButton=nr,exports.UnderlineCommandButton=_a,exports.UndoRedoCommandButton=Vo,exports.VerticalAlignCommandButton=ja,exports.ViewGridLinesCommandButton=Ha,exports.ViewHeadingsCommandButton=Ka,exports.WalkingCopyCommandButton=so,exports.WorkbookContextMenu=rn,exports.WorkbookElement=ln,exports.WorkbookIO=$e,exports.WorkbookStrip=an,exports.WorkbookTitle=sn,exports.WorkbookViewCommandButton=Ua,exports._WorkbookIO=Yr,exports._extends=oo,exports._objectWithoutPropertiesLoose=nn,exports._setPrototypeOf=no,exports.clsx=_e,exports.clsx$1=ie,exports.commonjsGlobal=dt,exports.createGridStyleFromMUITheme=Io,exports.defaultNewWorkbook=Er,exports.getDefaultExportFromCjs=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},exports.requirePropTypes=Ot,exports.setPrintExamplesOnLoad=a=>{dr=a},exports.useMeasure=Ve,exports.useWorkbookCommands=Tr;
20
+ `))),fe},[D,F,S]),O=w.useCallbackRef(async($,U,Y)=>{if(!U&&v){const _=await v("Enter Workbook name to "+(Y.isDefault?"Save.":`Export as ${Y.description}.`));return _!==null&&Ve.writeFile(_,$,{formatType:Y.key})}return Ve.writeFile(U,$,{formatType:Y.key})},[F,S,v]),H=n.useCallback(()=>({contains:$=>!0,focus(){}}),[]),I=n.useMemo(()=>{const $=[];h||(Ve.getWriteFormats().forEach(Y=>{const _=Y.isDefault,L={label:_?"Save Workbook":`Save Workbook as ${Y.description}`,scopedLabels:{workbook:"Save",saveWorkbook:`as ${Y.description}`},tags:Y.tags,description:`Save the workbook to the desktop${_?"":` as ${Y.description}`}.`,icon:"FileDownloadAsSheet"};_&&(L.shortcut={key:"S",modifiers:[w.KeyModifiers.Ctrl]},$.push(new w.Command("saveWorkbookAs",H,{label:"Save Workbook As…",scopedLabels:{workbook:"Save as…",saveWorkbook:"as…"},shortcut:[{key:"S",modifiers:[w.KeyModifiers.Shift,w.KeyModifiers.Ctrl]},{key:"F12"}],description:"Save the workbook to the desktop with the provided name."},()=>{O(S,null,Y).catch(fe=>{F.showError(fe)})})));const G=Y.key,Q=_?"saveWorkbook":`saveWorkbookAs${G}`;G==="CSV"?L.icon="FileDownloadAsCSV":G==="Excel"&&(L.icon="FileDownloadAsExcel"),$.push(new w.Command(Q,H,L,fe=>{O(S,fe??k,Y).catch(re=>{F.showError(re)})}))}),$.push(new w.Command("openWorkbook",H,{label:"Open Workbook…",scopedLabels:{workbook:"Open…"},description:"Open a workbook from the desktop.",icon:"FileOpen",shortcut:{key:"O",modifiers:[w.KeyModifiers.Ctrl]}},async(Y=null)=>{const _={date1904:S.isDate1904(),...S.options};try{const L=await z(Y,_);if(!L)return;const G=L.title,Q=L.workbook,fe=Q.getSelectedSheet();if(L.formatType.mimeType==="text/csv"){const re=S.findValidSheetName(G);await S.doBatch(async()=>{const me={colStart:0,rowStart:0,colEnd:0,rowEnd:0};let Se=fe.getUsedRange();if(!Se)return void F.showMessage("The file appears to be blank.");Se=Se.getUnion(me),await S.getSheets().add({name:re,autoSelect:!0}).getRange(me).copyFrom(Se)},`Import CSV '${G}'`)}else S?.close(),j?.(G),x(Q)}catch(L){F.showError(L)}})),$.push(new w.Command("openWorkbookFromUrl",H,{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 _=await F.showInput({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(_.option!=="Open")return;Y=_.input}Y&&console.log("openWorkbookFromUrl",Y)})));let U=[];return T&&(U=[new w.Command("themeMode",H,{label:"Light/Dark Mode",scopedLabels:{appearance:"Light/Dark Mode"},description:"Toggle the application styling between light and dark mode."}),new w.Command("defaultThemeMode",H,{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 w.Command("enableDarkGrid",H,{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 w.Command("enableDarkImages",H,{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."})]),[...$,...U,new w.SimpleCommand("help",H,{label:"Show Help",description:"Provide Help.",icon:"Documentation",shortcut:{key:"F1"}},()=>{}),new w.SimpleCommand("showKeyboardShortcuts",H,{label:"Keyboard Shortcuts",description:"Show keyboard shortcuts.",icon:"Keyboard",shortcut:{key:"/",modifiers:[w.KeyModifiers.Ctrl]}},()=>{}),new w.Command("gotoUrlGithub",H,{label:"Github",description:"Download examples, explore source code, and leave a star.",icon:"Github"},()=>{window?.open("https://github.com/sheetxl/sheetxl")}),new w.Command("gotoUrlDiscord",H,{label:"Discord",description:"Join our community on discord.",icon:"Discord"},()=>{window?.open("https://discord.gg/NTKdwUgK9p")}),new w.Command("gotoUrlDocumentation",H,{label:"Documentation",description:"Read the documentation.",icon:"Documentation"},()=>{window?.open("https://www.sheetxl.com/docs")}),new w.Command("gotoUrlIssue",H,{label:"Create Issue",description:"Create an issue to identify a bug or a feature request.",icon:"Ticket"},()=>{window?.open("https://github.com/sheetxl/sheetxl/issues")})]},[S,k,F,h,T,P,M]),W=n.useMemo(()=>{let $=null;return $=P?P.createChildGroup(H,"standaloneWorkbook",!1):new w.CommandGroup(H,"standaloneWorkbook"),$.addCommands(I,!0),$},[P,I]);w.useUndoManager({manager:M,commands:W});const ee=B.useMediaQuery("(prefers-color-scheme: dark)"),{themeMode:X}=y.useResolvedThemeMode();n.useEffect(()=>{if(!T||!W)return;const $=T.mode==="dark"||!T.mode&&X==="dark";W.getCommand("themeMode").update({state:T.mode??null,label:$?"Dark Mode":"Light Mode",scopedLabels:{appearance:$?"Dark Mode":"Light Mode"},icon:$?"DarkMode":"LightMode"}).updateCallback(()=>{E($?y.ThemeMode.Light:y.ThemeMode.Dark)}),W.getCommand("defaultThemeMode").update({state:!T.mode,icon:ee?"SystemDefaultDarkMode":"SystemDefaultLightMode"}).updateCallback(()=>{E(null)}),W.getCommand("enableDarkGrid").update({state:T.enableDarkGrid}).updateCallback(()=>{R(!T.enableDarkGrid)}),W.getCommand("enableDarkImages").update({state:T.enableDarkImages}).updateCallback(()=>{N(!T.enableDarkImages)})},[X,T,I]);const{showModal:ne}=y.useModal();return n.useEffect(()=>{const $=()=>new Promise((U,Y)=>{const _=n.lazy(()=>Promise.resolve().then(()=>require("./BbIg9meUh8UPbj5t.cjs"))),L=ne(_,{title:"Shortcut Keys Reference",commands:W,onDone:()=>{L.hide()},slotProps:{transition:{onExited:()=>{U(!0)}}}})});W.getCommand("showKeyboardShortcuts").updateCallback(()=>$()),W.getCommand("help").updateCallback(()=>$())},[I,W]),W})({workbook:i,setWorkbook:o,importExportDisabled:g,workbookTitle:r,setWorkbookTitle:s,commands:c,requestWorkbookTitle:b=>new Promise(S=>{t.current?t.current.requestWorkbookTitle((x,h)=>{S(x)},{selectAll:!0,requestReason:b}):S(d)}),themeOptions:C,undoManager:l,onExecute:n.useCallback(()=>{},[])}),u=n.useMemo(()=>e.jsx(Ir,{commands:f,disableHover:!0,sx:{padding:"0"},buttonProps:{sx:{maxHeight:"22px"}}}),[f]),m={commands:f};return i&&(m.statusBarProps={childrenEnd:u}),p?n.cloneElement(p,m):null});ei.displayName="CommandsWrapper";const ti=n.memo(a=>{const{children:i}=a,o=Xr(),t=o?o.enqueueSnackbar:()=>{},r=o?o.closeSnackbar:()=>{},[s,d]=n.useState({isMounted:!1,label:null,starting:new Map,running:new Map}),p=n.useCallback(()=>{d(x=>({...x,isMounted:!0}))},[]),l=n.useCallback(()=>{d(x=>({...x,isMounted:!1}))},[]),c={},g=y.useLazyWindow(c),C=y.useOptionsDialog(c),f=y.useInputDialog(c),u=n.useRef(new Set),m=n.useMemo(()=>{const x=(j,v)=>{if(v?.onceKey){if(u.current.has(v.onceKey))return;const M=new Set(u.current);M.add(v.onceKey),u.current=M}const T={variant:v?.type??w.NotifierType.Info,anchorOrigin:{vertical:"top",horizontal:"center"},preventDuplicate:v?.preventDuplicate,persist:v?.persist??v?.type===w.NotifierType.Error,action:M=>e.jsx(B.IconButton,{onClick:()=>r(M),children:e.jsx(w.DynamicIcon,{iconKey:"Cancel"})})};v?.enqueueProps&&Object.assign(T,v.enqueueProps),j||console.log("message is 'null'",v),t(j??"Alert",T)},h={showMessage:x,showBusy:(j,v)=>{let T=null;const M=new Promise(P=>{T=P});return d(P=>{const D=new Map(P.starting);return D.set(M,T),{...P,label:j,starting:D}}),M},showWindow:(j,v)=>{const T=v;return v={...v,onKeyDown:M=>{M.isDefaultPrevented()||M.isPropagationStopped()||T?.onKeyDown?.(M)}},g(j,{sort:()=>Promise.resolve().then(()=>require("./NsGloilMLNL8CAF_.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./DGqqkGBv1nc0eMrE.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./awYqXNcQZFnOqrrv.cjs")),comments:()=>Promise.resolve().then(()=>require("./ivFORJI1ljTPQpJ2.cjs")),find:()=>Promise.resolve().then(()=>require("./Caqz5dZzQdiFjnRX.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./DzrSXv2CLKkFc2iG.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./BaYmI4hURso6vppd.cjs")),resizeHeader:()=>Promise.resolve().then(()=>require("./byyZab6_Rq6ZwIYg.cjs"))}[j],v)},showOptions:C,showInput:f,showError:j=>{let v,T=w.NotifierType.Error,M="Unknown Error";typeof j=="string"?M=j:j instanceof Error&&(v=j,j.message&&(M=j.message)),j instanceof je.PartialError&&(T=w.NotifierType.Info),x(M,{type:T,enqueueProps:{error:v}})}},k=new w.DefaultReactNotifier;return k.setOverrides(h),k},[]);n.useEffect(()=>{s.starting.size<=0||!s.isMounted||d(x=>{const h=new Map(x.running);return x.starting.forEach((k,j)=>{const v=()=>{d(T=>{const M=new Map(T.running);return M.delete(j),{...T,running:M}})};h.set(j,v),k(v)}),{...x,starting:new Map,running:h}})},[s]);const[b,S]=n.useState(null);return n.useEffect(()=>{s.starting.size!==0||s.running.size!==0?S(e.jsx(y.LoadingPanel,{icon:e.jsx(y.AnimatedTraversingEllipsisIcon,{sx:{transform:"scale(0.7)",marginLeft:"-6px"}}),panel:!0,label:s.label,onMount:p,onUnmount:l,sx:{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",zIndex:"9999"}})):S(null)},[s.starting,s.running]),e.jsxs(w.NotifierProvider,{notifier:m,children:[b,i]})});ti.displayName="SnackbarWrapper";const cs=n.memo(n.forwardRef((a,i)=>{const{children:o,title:t,taskPanes:r,onSelect:s,selected:d,registry:p=oe.DefaultTaskPaneRegistry,style:l,iconsOnly:c,className:g,...C}=a,f=n.useMemo(()=>r.map(b=>{const S=p.getRegisteredTaskPane(b);if(!S)return null;let x=S.getIcon?.();x&&(typeof x=="string"&&(x=e.jsx(w.DynamicIcon,{iconKey:x})),x=e.jsx("span",{style:{display:"inline-block",transform:"rotate(90deg)",transformOrigin:"center"},children:x}));const h=b===d;return e.jsx(B.Tab,{value:b,label:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:S.getTitle()??"",placement:"left-start",children:e.jsxs(B.Box,{sx:{padding:"0px 0px",writingMode:"vertical-rl",textOrientation:"mixed",display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:"0px",color:k=>k.palette.text.secondary},children:[x&&e.jsx(B.Box,{sx:{display:"inline-block",transformOrigin:"center",color:k=>k.palette.text.secondary},children:x}),c&&x?null:e.jsx(B.Typography,{component:"div",textTransform:"none",sx:{padding:"4px 0px",color:k=>h?k.palette.primary.main:k.palette.text.secondary},children:S.getTitle()})]})}),sx:{padding:"4px 4px",minWidth:"0px",minHeight:"0px",borderRadius:"4px"},className:ie("taskpane-strip-item",{"Mui-selected":h}),onClick:()=>a.onSelect(b)},b)}),[r,d,s,p]),u=w.useImperativeElement(i,()=>({isTaskPaneStrip:()=>!0}),[]),m=n.useMemo(()=>ie("taskpane-strip",g),[g]);return e.jsx(B.Box,{ref:u,className:m,sx:{paddingLeft:"2px",paddingTop:"4px",...l},...C,children:e.jsx(B.Tabs,{orientation:"vertical",variant:"scrollable",value:d,onChange:(b,S)=>{s(S)},slotProps:{list:{sx:{gap:"2px"}},indicator:{sx:{left:"0px",right:"unset"}}},children:f})})})),ds=(a,i)=>e.jsx(cs,{ref:i,...a}),us=n.forwardRef((a,i)=>{const{commands:o,model:t,...r}=a,s=q.useTheme(),d=`solid ${q.alpha(s.palette.divider,.2)} 1px`,p=`${s.shape.borderRadius??4}px`,l=`${s.spacing?.(.5)??4}px`,c=n.useRef(null);return e.jsx(oe.TaskPaneArea,{model:t,ref:i,frameProps:{style:{border:d,borderRadius:p,marginBottom:l}},alwaysShowStrip:!0,renderTaskPanelTitle:(g,C)=>{const{title:f,icon:u,onClose:m,readOnly:b,focused:S,...x}=g;return e.jsx(B.DialogTitle,{className:ie({"Mui-selected":S}),sx:{display:"flex",flex:"1 1 %0",color:h=>h.palette.text.secondary,boxSizing:"border-box",padding:"0 0",transitionProperty:"opacity",transitionDuration:h=>`${h.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:h=>h.transitions.duration.shortest/2+"ms"},backgroundColor:h=>q.alpha(h.palette.action.hover,.03),borderBottom:h=>`solid ${q.alpha(h.palette.divider,.2)} 1px`},...x,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 10%",flexDirection:"row",alignItems:"center",marginTop:h=>h.spacing(.25),marginBottom:h=>h.spacing(.25),marginLeft:h=>h.spacing(1),marginRight:h=>h.spacing(1)},children:[e.jsx(B.Box,{sx:{flex:"1 1 100%",paddingLeft:h=>h.spacing(1)},children:f}),e.jsx(y.ExhibitTooltip,{label:"Close",children:e.jsx(B.IconButton,{"aria-label":"close",sx:{color:h=>h.palette.text.icon??h.palette.action.active},touchRippleRef:c,onPointerDown:h=>{c.current?.start(h,{center:!1}),h.stopPropagation(),h.preventDefault()},onPointerUp:()=>{m()},children:e.jsx(w.DynamicIcon,{iconKey:"Close"})})})]})})},renderTaskPaneStrip:ds,...a,onOpen:()=>{a?.onOpen?.()},onClose:()=>{a?.onClose?.()},commands:o,...r})}),wa={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},oi=n.memo(n.forwardRef((a,i)=>{const{mainElement:o,sidebarElement:t,className:r,style:s,...d}=a,p=q.useTheme(),[l,{width:c}]=_e(),g=c>530||c===0,C=n.useRef(null);let f=null,u=4,m=13;return g?f="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":(f="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",u=13,m=4),e.jsx(w.SplitPane,{ref:tt([C,l,i]),className:r,style:s?{...wa,...s}:wa,...d,fixedPane:"after",position:"40%",minAfter:g?"280px":"120px",splitDirection:g?"row":"column",resizerProps:{className:"styled-resizer",style:{minWidth:g?"6px":void 0,minHeight:g?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${u}' height='${m}' viewBox='0 0 ${u} ${m}' version='1.1' fill='${p.palette.text.icon??p.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${f}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:g?"left center":"top center"}},elementBefore:o,paneBeforeProps:{style:{flexDirection:"column",marginRight:t?void 0:"6px"}},elementAfter:t,paneAfterProps:{style:{marginLeft:g?"0px":"4px",marginRight:g?"8px":"4px"}}})}));oi.displayName="StudioSplitPane",Mr(),w.DefaultDynamicIconService.register("plugin-scripts",{icons:{}}),oe.DefaultTaskPaneRegistry.registerTaskPane({key:"scriptEditor",getTitle:()=>"Script (Typescript)",getIcon:()=>"ScriptRun",renderTaskPane:cl},!0);const ro=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,style:r,onElementLoad:s,onError:d,undoManager:p,errorPanel:l=y.ErrorPanel,onKeyDown:c,workbook:g,createWorkbookOptions:C,onWorkbookChange:f,logo:u,importExportDisabled:m=!1,themeOptions:b,autoFocus:S=!1,commands:x,title:h,onTitleChange:k,titleProps:j,renderLoadingPanel:v,...T}=a,M=n.useRef(null),P=w.useCallbackRef(f,[f]),D=w.useCallbackRef(k??j?.onTitleChange,[k??j?.onTitleChange]),F=j?.placeHolder??"Untitled",E=b?.mode,{themeMode:R,source:N}=y.useResolvedThemeMode({mode:E}),z=n.useMemo(()=>({...b,light:y.createExhibitTheme(!1,je.CommonUtils.deepMerge(b?.theme??{},b?.light??{})),dark:y.createExhibitTheme(!0,je.CommonUtils.deepMerge(b?.theme??{},b?.dark??{}))}),[b]),O=R===y.ThemeMode.Dark,[H,I]=n.useState(null);n.useEffect(()=>{I(p??new je.UndoManager)},[p]);const[W,ee]=n.useState(null),[X,ne]=n.useState(null),$=oe.useDocThemes();n.useLayoutEffect(()=>{if(!g||Object.keys(g).length===0&&!je.CommonUtils.isPromiseLike(g)){const Z={theme:$.getDefaultTheme(),...C};ne(new A.Workbook(Z))}else ne(g)},[g]),n.useLayoutEffect(()=>{if(X){if(X instanceof A.Workbook)return ee({workbook:X}),void(g!==X&&P?.(X));(async()=>{try{let Z,le=await Promise.resolve(X);le&&le.source&&(le=await Ve.read(le)),le.workbook?(G(le.title),Z=le.workbook):Z=le,P?.(Z),ee({workbook:Z})}catch(Z){P?.(null),ee({error:Z})}})()}},[X]);const[U,Y]=n.useState(null);n.useEffect(()=>{if(!H||!W)return;H.clear();const Z=W?.workbook?.getTransactions();if(Z)return Z.addListener({onCommitEnd:le=>{le.getDescription()?H.addUndoOperation({description:le.getDescription(),undo:()=>(Z.revert(le.getId()),U.source?.focus(),()=>{Z.restore(le.getId()),U.source?.focus()})}):console.warn("commit has no description",le)}})},[H,W,U]);const _=w.useCallbackRef(Z=>{Z?H.setRepeatableOperation({description:Z.label(),repeat:async()=>Z.execute()}):H.setRepeatableOperation(null)},[H]),[L,G]=n.useState(h??j?.title??"");n.useEffect(()=>{G(h??j?.title??"")},[h??j?.title]),n.useEffect(()=>{D?.(L)},[L]);const[Q,fe]=n.useState(null),re=n.useMemo(()=>{const Z=()=>({contains:le=>!0,focus(){}});return x?x.createChildGroup(Z,"application",!1):new w.CommandGroup(Z,"application")},[x]),me=w.useCallbackRef(async Z=>{fe(Z.source.getViewportElement()),Y(Z),re.activate("sheet"),await w.DefaultDynamicIconService.prefetch(),s?.(Z)},[re]);n.useEffect(()=>{U&&S&&U.source?.focus(typeof S=="object"?S:void 0)},[U]);const Se=n.useRef(null),Ce=n.useCallback(Z=>{let le=null;return j?.hidden||(le=e.jsx(sn,{...j,style:{maxWidth:"100%",...j?.style},workbook:M.current,ref:Se,title:L,placeHolder:F,onTitleChange:Ue=>{G(Ue)}})),e.jsx(Jr,{...Z,logo:u,mainElement:le,showFileMenu:!m,showAppearanceMenu:!!(z?.onEnabledDarkGridChange||z?.onEnabledDarkImagesChange||z?.onModeChange)})},[u,L,j,z,m,re]);n.useEffect(()=>{const Z=le=>le.preventDefault();return M.current?.addEventListener("wheel",Z,{passive:!1}),()=>{M.current?.removeEventListener("wheel",Z)}},[]);const J=n.useMemo(()=>{const Z={transparentBackground:!0};return e.jsx(B.Box,{sx:t,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",...r},children:v?.(Z)??e.jsx(y.LoadingPanel,{...Z})})},[t,r,v]),K=n.useCallback(({error:Z})=>(d?.(Z),e.jsx(l,{sx:t,style:r,error:Z??"Unable to display empty workbook."})),[t,r,d]),te=n.useMemo(()=>({...t,"& .SnackbarContainer-root":{position:"absolute !important"},"& .notistack-SnackbarContainer > div":{maxWidth:"100%"},"& .notistack-Snackbar":{minWidth:"unset"},"& .notistack-Snackbar > .error-snackbar .MuiTypography-root":{color:Z=>Z.palette.getContrastText(Z.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiCardActions-root":{color:Z=>Z.palette.getContrastText(Z.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root":{color:Z=>Z.palette.getContrastText(Z.palette.error.main)},"& .notistack-MuiContent *":{fontFamily:Z=>Z.typography.fontFamily},"& #notistack-snackbar":{maxWidth:"560px",whiteSpace:"pre-wrap"},"*":{userSelect:"none"}}),[t]),[de,ve]=n.useState(null),se=n.useCallback((Z,le)=>e.jsx(us,{ref:le,model:X,commands:re,...Z}),[re,X]),Fe=n.useCallback(Z=>e.jsx(oi,{mainElement:Z,sidebarElement:de}),[de]),Te=tt([M,i]),Oe=n.useMemo(()=>{if(!W)return J;if(W.error||!W.workbook)return K({error:W.error});let Z=null,le=null,Ue=!1;return z&&(Z=O?z.dark:z.light,le=O&&z.enableDarkGrid?z.dark:z.light,Ue=z.enableDarkImages),e.jsx(ln,{sx:te,style:r,tabIndex:0,autoFocus:!0,workbook:W.workbook,ref:Te,renderToolbar:Ce,onElementLoad:me,onRepeatCommandChange:_,onKeyDown:gt=>{c?.(gt)},renderLoadingPanel:v,gridTheme:le,headersTheme:Z,enableDarkImages:Ue,mainWrapper:Fe,className:ie(o),onContextMenu:gt=>gt.preventDefault(),...T},"WorkbookElement")},[W,L,H,J,v,z,T,Ce,te,Fe]);let ue=e.jsx(rs,{maxSnack:3,domRoot:Q,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(Z,le,Ue)=>{M.current?.focus()},Components:{error:Zr},iconVariant:{success:e.jsx(B.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(w.DynamicIcon,{iconKey:"ErrorAlert",style:{marginRight:"8px"}})},children:e.jsx(oe.TaskPaneProvider,{createArea:se,onUpdateArea:Z=>{ve(Z)},children:e.jsx(y.ModalProvider,{children:e.jsx(ti,{children:e.jsx(w.UncaughtErrorBoundary,{children:e.jsx(w.ReactErrorBoundary,{children:e.jsx(ei,{workbook:W?.workbook,setWorkbook:ne,importExportDisabled:m,titlePlaceHolder:F,titleWorkbook:L,setWorkbookTitle:G,refWorkbookTitle:Se,commands:re,undoManager:H,themeOptions:z,children:Oe})})})})})})});return z&&(ue=e.jsxs(q.ThemeProvider,{theme:O?z.dark:z.light,children:[z.cssBaseline?e.jsx(B.CssBaseline,{}):null,ue]})),ue}));ro.displayName="EagerStudio";const ms=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:ro,default:ro},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=Fr,exports.AutoColorPosition=pt,exports.BorderCommandButton=Fa,exports.BorderPopupButton=Da,exports.BorderStylePopupButton=Ma,exports.CellsDeleteCommandButton=Ho,exports.CellsFormatCommandButton=Wo,exports.CellsInsertCommandButton=zo,exports.Checkboard=Ra,exports.ClearCommandButton=Lo,exports.ColorButton=io,exports.ColorButtonList=Dt,exports.ColorCommandButton=ht,exports.ColorPanel=Pa,exports.ColorPanelType=Ba,exports.ColorPopupButton=Ao,exports.DocThemeCommandButton=Dr,exports.EagerStudio=ro,exports.FillCommandButton=za,exports.FilterColumnMenu=Jo,exports.FilterCommandButton=Vi,exports.Filters=cr,exports.FindCommandButton=Oa,exports.FontFamilyCommandButton=$a,exports.FontSizeCommandButton=Aa,exports.FormulaBar=Qo,exports.FreezeCommandButton=Na,exports.HelpCommandButton=Ir,exports.HorizontalAlignCommandButton=va,exports.InsertFunctionCommandPopupButton=Nr,exports.InsertFunctionSumCommandPopupButton=un,exports.InsertImageCommandButton=dn,exports.MergeCommandButton=Ia,exports.NamedCollectionEditor=Zo,exports.NamedInput=Uo,exports.NumberFormatCommandButton=La,exports.PasteCommandButton=_o,exports.PresetCellStylesCommandButton=Ga,exports.PresetTableStylesCommandButton=cn,exports.RangeInput=qo,exports.SheetTab=en,exports.SheetTabMenu=tn,exports.SheetZoomScale=Go,exports.SheetsAllMenu=on,exports.SortFilterCommandButton=$o,exports.StatusBar=Xo,exports.Studio=Or,exports.StyledStrokeIcon=Mo,exports.TableDetailsPanel=Rr,exports.TableDetailsTaskPane=Pr,exports.TablePlugin=Mr,exports.TableStyleCanvasPreview=Ya,exports.TableStyleOptionsPanel=Za,exports.TableStylePreview=Ko,exports.TextEffectsCommandButton=Va,exports.TextOverflowCommandButton=Ta,exports.TextRotateCommandButton=Ea,exports.ThemeSelectButton=tr,exports.ThemeSelectPanel=or,exports.ThemeSelectPopupButton=nr,exports.UnderlineCommandButton=_a,exports.UndoRedoCommandButton=Vo,exports.VerticalAlignCommandButton=ja,exports.ViewGridLinesCommandButton=Ha,exports.ViewHeadingsCommandButton=Ka,exports.WalkingCopyCommandButton=so,exports.WorkbookContextMenu=rn,exports.WorkbookElement=ln,exports.WorkbookIO=Ve,exports.WorkbookStrip=an,exports.WorkbookTitle=sn,exports.WorkbookViewCommandButton=Ua,exports._WorkbookIO=Yr,exports._extends=oo,exports._objectWithoutPropertiesLoose=nn,exports._setPrototypeOf=no,exports.clsx=Ke,exports.clsx$1=ie,exports.commonjsGlobal=ut,exports.createGridStyleFromMUITheme=Io,exports.defaultNewWorkbook=Er,exports.getDefaultExportFromCjs=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},exports.requirePropTypes=Ot,exports.setPrintExamplesOnLoad=a=>{dr=a},exports.useMeasure=_e,exports.useWorkbookCommands=Tr;