@sheetxl/studio-mui 0.7.8 → 0.7.9

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/{UoOVKSpyeYQ3Z04Y.cjs → 1SqZN5MQ5PzAcIvC.cjs} +3 -3
  2. package/browser/cjs/{DPenF_1mYgI8WaQf.cjs → BBYVAwo4ouiMmtKC.cjs} +1 -1
  3. package/browser/cjs/{Q234HX63V75h22HJ.cjs → Bm-7dNP3FmSD8RKB.cjs} +1 -1
  4. package/browser/cjs/C_USiuvDG2dfWtXj.cjs +20 -0
  5. package/browser/cjs/{D36j1nR6-lEwM7Ht.cjs → Cf-kkPm1FigHKB2n.cjs} +2 -2
  6. package/browser/cjs/{zFlqPWNVl7CHv7Iw.cjs → D1OaqRgNJbMQkAd5.cjs} +1 -1
  7. package/browser/cjs/{DQ1bXdi-D0uVKGFA.cjs → DA9XIw3uWopubSOm.cjs} +2 -2
  8. package/browser/cjs/{CJW4-NCdaLzNEwgK.cjs → DQupeVKF6A0l_r2_.cjs} +1 -1
  9. package/browser/cjs/{D9RcTPcL8Gcds6uC.cjs → DWCZwMHAmHr_6pOv.cjs} +2 -2
  10. package/browser/cjs/{rrppjlxhsrfwBStx.cjs → T7VT7LHcSGCG0nHe.cjs} +2 -2
  11. package/browser/cjs/index.cjs +2 -2
  12. package/browser/cjs/{WN5FOSGC22Jy3dxz.cjs → pLwzHJC2rMpMNlmN.cjs} +1 -1
  13. package/browser/esm/{Cp-QoTwVeQkQClpI.mjs → 8ySqzQ-18kdZCc_T.mjs} +1 -1
  14. package/browser/esm/{BD3NSZsAOvF6yczu.mjs → BkLdZhD76b4clcIe.mjs} +3 -3
  15. package/browser/esm/{D7PjwOCMi075qK5G.mjs → Bx_qMvcXcJ9rsRW0.mjs} +2 -2
  16. package/browser/esm/{Ci4cqU4bR1IUSqrT.mjs → CrxCbPC8OsPYiu18.mjs} +1 -1
  17. package/browser/esm/{CagpAQXgCxrJrdGJ.mjs → CusJChXpaPfoicnm.mjs} +2 -2
  18. package/browser/esm/{CUiplQS9rUodJwPi.mjs → DLRGvvkeHamosHqQ.mjs} +1073 -1064
  19. package/browser/esm/{wenu-h35nL2_uEZp.mjs → DTxgrQXbG3N9lW1K.mjs} +2 -2
  20. package/browser/esm/{BiazW77hCkbuJPiW.mjs → DV6MYPn_wgUytG9p.mjs} +1 -1
  21. package/browser/esm/{Dx4t6SbPV2HSf_ub.mjs → DeBXIHYAvBBDeuyl.mjs} +1 -1
  22. package/browser/esm/{5Fbp4sZTl6CHhmHk.mjs → YpJtXAhMACxtW1Rk.mjs} +2 -2
  23. package/browser/esm/index.mjs +71 -70
  24. package/browser/esm/{CoIXNZVIp9Q12qM2.mjs → vrN0FWxqEeg1-vWU.mjs} +1 -1
  25. package/licenses/dependencies.txt +139 -139
  26. package/node/esm/{B21Usvp_sTqMHAZ4.mjs → 4Woq8PA_nHBBWJE_.mjs} +1 -1
  27. package/node/esm/{D1n7HgHfLVQZ0KhP.mjs → BVjsplqVie80wjNf.mjs} +1 -1
  28. package/node/esm/{BAgtosqQwtrUsOYl.mjs → BxpSw5aPIr7UXKbB.mjs} +1 -1
  29. package/node/esm/{Cfzjf7vBs29sO_g3.mjs → CN31EL9Soh-9w3jF.mjs} +1 -1
  30. package/node/esm/{DWhJA7EI9CmoBPDY.mjs → Cglez5pr5a5RTdHS.mjs} +1 -1
  31. package/node/esm/{CYU-oRRhaNiOTVNa.mjs → CrfdSYnd6drqE5fB.mjs} +1 -1
  32. package/node/esm/{GzNLdpzukdCxYbbC.mjs → DAMa-CbdXO0XKKam.mjs} +1 -1
  33. package/node/esm/{DmdldJQanZCNdfA5.mjs → DIXy8ZVj_kaaOwIJ.mjs} +1 -1
  34. package/node/esm/index.mjs +583 -574
  35. package/node/esm/{D60xUWK_BS-7PMLM.mjs → jsycByMMbwMZibUQ.mjs} +1 -1
  36. package/package.json +8 -8
  37. package/types/index.d.ts +40 -30
  38. package/browser/cjs/Bt0-HMKtnBRB6IpI.cjs +0 -20
@@ -1,20 +0,0 @@
1
- "use strict";var Bi=Object.create;var En=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var Pi=Object.getOwnPropertyNames;var Mi=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var Fi=(a,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Pi(i))!Di.call(a,r)&&r!==o&&En(a,r,{get:()=>i[r],enumerable:!(t=Ri(i,r))||t.enumerable});return a};var Bn=(a,i,o)=>(o=a!=null?Bi(Mi(a)):{},Fi(i||!a||!a.__esModule?En(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.8
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */const 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"),Be=require("@mui/system"),Je=require("react-dom"),je=require("@sheetxl/utils"),ct=require("@sheetxl/io");function wa(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=wa(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=wa(a))&&(t&&(t+=" "),t+=i);return t}const ka=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...m}=a,l=w.useCommands(o,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),c=n.useMemo(()=>{for(let x=0;x<l.length;x++)if(l[x]?.state())return l[x];return l[0]},[l]),u=n.useMemo(()=>{if(!t)return null;const x={...t};return delete x.beforeExecute,x},[t]),C=n.useCallback((x,f)=>{const p={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:f.getCommand("formatAlignLeftToggle")}),e.jsx(y.CommandButton,{...p,command:f.getCommand("formatAlignCenterToggle")}),e.jsx(y.CommandButton,{...p,command:f.getCommand("formatAlignRightToggle")}),e.jsx(y.CommandButton,{...p,command:f.getCommand("formatAlignJustifyToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...p,command:f.getCommand("formatAlignCenterContinuousToggle")}),e.jsx(y.CommandButton,{...p,command:f.getCommand("formatAlignFillToggle")}),e.jsx(y.CommandButton,{...p,command:f.getCommand("formatAlignDistributedHorizontalToggle")})]}),S=e.jsxs(B.Box,{sx:{className:ie("quick-buttons"),display:"flex",alignItems:"center",justifyContent:"center"},onClick:g=>g.stopPropagation(),children:[e.jsx(y.CommandButton,{command:f.getCommand("formatIndentDecrease"),commandHook:u,scope:r,disabled:s}),e.jsx(y.CommandButton,{command:f.getCommand("formatIndentIncrease"),commandHook:u,scope:r,disabled:s})]}),h=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...m,children:[S,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:b})]});return y.defaultCreatePopupPanel({...x,children:h})},[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",...m})})),va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=w.useCommands(o,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),l=n.useMemo(()=>{for(let u=0;u<m.length;u++)if(m[u]?.state())return m[u];return m[0]},[m]),c=n.useCallback((u,C)=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:C.getCommand("formatAlignTopToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatAlignMiddleToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatAlignBottomToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatAlignJustifyVerticalToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatAlignDistributedVerticalToggle")})]});return y.defaultCreatePopupPanel({...u,children:f})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:c,label:"Vertical Alignment",tooltip:"Configure how text is placed in the vertical direction of the cell.",icon:l?.icon()??"TextVerticalBottom",...d})})),ja=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=w.useCommands(o,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),l=n.useMemo(()=>{for(let u=0;u<m.length;u++)if(m[u]?.state())return m[u];return m[0]},[m]),c=w.useCallbackRef((u,C)=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:C.getCommand("formatTextOverflowVisibleToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatTextOverflowWrapToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatTextOverflowClipToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatTextOverflowShrinkToggle")})]});return y.defaultCreatePopupPanel({...u,children:f})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,label:"Text Overflow",tooltip:"Configure how text behaves when it doesn't fit within a cell.",createPopupPanel:c,icon:l?.icon()??"TextHorizontalOverflow",...d})})),Ta=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=w.useCommands(o,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),l=n.useMemo(()=>{const C=m.length;for(let x=0;x<C;x++){const f=m[x];if(f?.state())return f}return m[1]},[m]),c=n.useCallback((C,x)=>{const f={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:x.getCommand("formatTextRotate0")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...f,command:x.getCommand("formatTextRotate315")}),e.jsx(y.CommandButton,{...f,command:x.getCommand("formatTextRotate45")}),e.jsx(y.CommandButton,{...f,command:x.getCommand("formatTextRotate90")}),e.jsx(y.CommandButton,{...f,command:x.getCommand("formatTextRotate270")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.InputCommandButton,{...f,command:x.getCommand("formatTextRotateCustom"),label:"Custom"})]});return y.defaultCreatePopupPanel({...C,children:p})},[s,t,r,o]),u=n.useMemo(()=>(o.getCommand("formatTextRotateCustom")?.state()??0)!==0,[m]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,selected:u,label:"Text Orientation",tooltip:"Rotate your text diagonally or vertically. This is a great way to label narrow columns.",createPopupPanel:c,quickCommand:u?"formatTextRotate0":"formatTextRotate315",icon:l?.icon()??"TextRotation315",...d})})),Ea={Preset:"preset",Custom:"custom"},mt={Start:"start",End:"end"},xo={},Ii=(a,i,o,t)=>{const r=a+"-"+i+"-"+o+(t?"-server":"");if(xo[r])return xo[r];const s=((d,m,l,c)=>{if(typeof document>"u"&&!c)return null;const u=c?new c:document.createElement("canvas");u.width=2*l,u.height=2*l;const C=u.getContext("2d");return C?(C.fillStyle=d,C.fillRect(0,0,u.width,u.height),C.fillStyle=m,C.fillRect(0,0,l,l),C.translate(l,l),C.fillRect(0,0,l,l),u.toDataURL()):null})(a,i,o,t);return xo[r]=s,s},Ni={},Ba=n.memo(a=>{const{className:i,style:o=w.ReactUtils.EmptyCssProperties,white:t="transparent",grey:r="grey",size:s=8,borderRadius:d,boxShadow:m,renderers:l=Ni,children:c,...u}=a,C=c,x=n.useMemo(()=>Object.assign({borderRadius:d,boxShadow:m,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Ii(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:x,...u})}),Oi=n.memo(a=>{const{selectedColor:i,onSelectColor:o,onPreviewColor:t,onClick:r,onKeyDown:s,onMouseOver:d,onMouseLeave:m,onFocus:l,style:c=w.ReactUtils.EmptyCssProperties,children:u,alphaWhite:C,alphaGrey:x,darkMode:f,alphaCheckSize:p=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]),h=n.useCallback(T=>{d?.(T),T.isDefaultPrevented()||t?.(i.toRGBA())},[t,d,i]),g=n.useCallback(T=>{m?.(T),T.isDefaultPrevented()},[t,m]),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(Ba,{size:p,white:C,grey:x,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[C,x,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:h,onMouseLeave:g,onFocus:k,children:[v,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:i.toCSS(f)},children:u})]})}),io=n.memo(a=>{const{schemeColorLookup:i,selectedColor:o,previewColor:t,colorDef:r,onSelectColorDef:s,onPreviewColorDef:d,swatchProps:m,defaultButtonSize:l=24,isLarge:c=!1,compareRGB:u=!1,darkMode:C=!1,...x}=a,f=new A.Color({val:r.definition.val,adjs:r.definition.adjs},v=>i(v)),p=u?f.toRGBA().toString():f.toString(),b=o&&(u?o.toRGBA().toString():o.toString())===p,S=t&&(u?t.toRGBA().toString():t.toString())===p,h=[];h.push({[A.IColor.AdjustmentType.Inv]:!0}),h.push({[A.IColor.AdjustmentType.Alpha]:100});const g=f.adjust(h),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"},...x,children:e.jsxs(Oi,{selectedColor:f,title:null,onSelectColor:k,onPreviewColor:j,alphaCheckSize:c?9:void 0,darkMode:C,...m,children:[e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",top:"0px",left:"0px",pointerEvents:"none",borderColor:g.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:g.toRGBA(C).toString(),borderRadius:"50%",opacity:S?"1":"0"}})]})})})}),Ht=n.memo(a=>{const{title:i,schemeColorLookup:o,colorDefs:t,selectedColor:r,previewColor:s,onSelectColorDef:d,onPreviewColorDef:m,style:l=w.ReactUtils.EmptyCssProperties,compareRGB:c=!1,darkMode:u,swatchProps:C,...x}=a;let f;if(Array.isArray(t[0]))f=t;else{f=[];for(let g=0;g<t.length;g++)f.push([t[g]])}const p=n.useCallback(g=>{d?.(g)},[d]),b=n.useCallback(g=>{m?.(g)},[m]),S=n.useMemo(()=>{let g=[];for(let k=0;k<f.length;k++){let j=[],v=f[k];for(let M=0;M<v.length;M++){let R=v[M];j.push(e.jsx(io,{schemeColorLookup:o,colorDef:R,selectedColor:r,previewColor:s,onSelectColorDef:p,onPreviewColorDef:b,swatchProps:C,compareRGB:c,darkMode:u},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);g.push(T)}return g},[f,r,s,p,b]),h=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:g=>g.palette.text.secondary},children:i}):null,[i]);return e.jsxs(B.Box,{style:{...l},children:[h,e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...x,children:S})]})}),Pe=(a,i)=>({description:a,definition:{val:i,adjs:[]}}),ge=(a,i,o,t,r,s)=>{const d=Pe(a,i);t?.push(d);const m=new A.Color({val:d.definition.val,adjs:d.definition.adjs},o),l=m.toString();r?.set(l,m);const c=m.toRGBA().toString();s?.set(c,m)},Ai=n.lazy(()=>Promise.resolve().then(()=>require("./D9RcTPcL8Gcds6uC.cjs"))),Ra=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o=null,previewColor:t=a.selectedColor??null,recentColors:r,schemeLookup:s,disableAlpha:d=!1,previewDebounceTime:m=100,initialPanelType:l,defaultButtonSize:c=24,width:u,onElementLoad:C,onDone:x,onEyeDropStart:f,onEyeDropStop:p,onPreviewColor:b,onPreviewColorImmediate:S,onSelectColor:h,autoColor:g,autoColorLabel:k="Automatic",autoColorPosition:j=mt.Start,compareRGB:v=!1,darkMode:T=!1,...M}=a,R=t||o,D=w.useCallbackRef(b,[b]),F=w.useCallbackRef(S,[S]),E=w.useCallbackRef(h,[h]),P=w.useCallbackRef(f,[f]),I=w.useCallbackRef(p,[p]),[z,N]=n.useState(!1),H=q.useTheme(),O=n.useMemo(()=>s||A.Color.getDefaultSchemeLookup(),[s]),W=n.useMemo(()=>{const K=new Map,te=new Map,ue=[];ge("Primary Background","bg1",O,ue,K,te),ge("Primary Text","tx1",O,ue,K,te),ge("Secondary Background","bg2",O,ue,K,te),ge("Secondary Text","tx2",O,ue,K,te),ge("Accent 1","accent1",O,ue,K,te),ge("Accent 2","accent2",O,ue,K,te),ge("Accent 3","accent3",O,ue,K,te),ge("Accent 4","accent4",O,ue,K,te),ge("Accent 5","accent5",O,ue,K,te),ge("Accent 6","accent6",O,ue,K,te);const ve=A.ITheme.buildPalette(ue,O,K,te),ce=[];if(ge("Dark Red","C00000",O,ce,K,te),ge("Red","FF0000",O,ce,K,te),ge("Orange","FFC000",O,ce,K,te),ge("Yellow","FFFF00",O,ce,K,te),ge("Light Green","92D050",O,ce,K,te),ge("Green","00B050",O,ce,K,te),ge("Light Blue","00B0F0",O,ce,K,te),ge("Blue","0070C0",O,ce,K,te),ge("Dark Blue","002060",O,ce,K,te),d?ge("Purple Is A Fruit","7030A0",O,ce,K,te):ge("Transparent","00000000",O,ce,K,te),g){const me=g.toString();K.set(me,g)}const Me=new Map,Te=typeof r=="function"?r():r,Ie=[];for(let me=0;Te&&me<Te.length;me++){const Z=Te[me].toString();Me.set(Z,Te[me]),Ie.push({description:"Recent "+(me+1),definition:{val:Te[me].toString()}})}return{primaryColors:ue,modifiedPresets:ve,standardColors:ce,recentColorsLimited:Ie,mapAllPresets:K,mapAllPresetsRGB:te,mapRecent:Me}},[O,r,d,g]);n.useEffect(()=>{C?.()},[]);const[ee,X]=n.useState(!1),ae=n.useCallback(()=>{X(K=>!K)},[]);n.useEffect(()=>{if(l)X(l===Ea.Custom);else if(o){let K=o.toString(),te=W.mapAllPresets.get(K);te||(K=o.toRGBA().toString(),te=W.mapAllPresetsRGB.get(K));const ue=W.mapRecent.get(K);X(!te&&!ue)}},[o,l]);const $=n.useCallback(A.CommonUtils.debounce(K=>{D?.(K)},m),[D,m]),[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},O):null)},[O]),G=n.useCallback(K=>{K.ctrlKey&&X(!0)},[]),Q=w.useCallbackRef(K=>{let te=!1;if(K){const ue=K.toString();te=!W.mapAllPresets.has(ue)}E?.(K,te)},[E,W]),he=w.useCallbackRef(K=>{const te=K?new A.Color({val:K.definition.val,adjs:K.definition.adjs},O):null;Promise.resolve(x?.()).then(()=>{Q(te)})},[O,x]),re=w.useCallbackRef(K=>{_(K?new A.Color(K,O):null)},[O]),pe=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()=>{N(!0),P?.(),await new EyeDropper().open().then(K=>{N(!1),I?.();let te=new A.Color(K.sRGBHex),ue=te.toString(),ve=W.mapAllPresets.get(ue);if(ve||(ue=te.toRGBA().toString(),ve=W.mapAllPresetsRGB.get(ue)),!ve){const ce=te.toRGBA(),Me=3;let Te=255;W.mapAllPresetsRGB.forEach((Ie,me)=>{const Z=Ie.toRGBA(),le=Math.abs(Z.red-ce.red)+Math.abs(Z.blue-ce.blue)+Math.abs(Z.green-ce.green);le<Me&&le<Te&&(ve=Ie)})}X(!ve),_(ve||te)}).catch(K=>{N(!1),K?.name!=="AbortError"&&console.error(K)})},children:e.jsx(w.DynamicIcon,{iconKey:"Colorize"})}),[W,T]),Ce=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(Ai,{style:K,selectedColor:R?R.toRGBA().toString():"transparent",onColorChange:re,disableAlpha:d})})},[ee,R]),be=n.useMemo(()=>({onClick:G,alphaGrey:H.palette.text.icon??H.palette.action.active}),[G,H]),J=n.useMemo(()=>{if(!g)return null;const K={description:k,definition:{val:g.getVal(),adjs:g.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(B.MenuItem,{sx:{display:"flex",color:te=>te.palette.text.secondary},onMouseOver:()=>{L(null)},onClick:()=>{he(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:O,colorDef:K,selectedColor:o===null?g:o,previewColor:t===null?g:t,defaultButtonSize:c,isLarge:!0,darkMode:T,compareRGB:v,swatchProps:be})}),e.jsx(B.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:k})]})})},[g,k,O,o,t]);return e.jsxs(B.Box,{ref:i,sx:{width:u,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(Ht,{title:"Theme Colors",schemeColorLookup:O,colorDefs:W.primaryColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:be,onPreviewColorDef:L,onSelectColorDef:he,compareRGB:v,darkMode:T}),e.jsx(Ht,{schemeColorLookup:O,colorDefs:W.modifiedPresets,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:be,onPreviewColorDef:L,onSelectColorDef:he,compareRGB:v,darkMode:T}),e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Ht,{title:"Standard Colors",schemeColorLookup:O,colorDefs:W.standardColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:be,onPreviewColorDef:L,onSelectColorDef:he,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(Ht,{title:"Recent Colors",schemeColorLookup:O,colorDefs:W.recentColorsLimited,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:be,onPreviewColorDef:L,onSelectColorDef:he,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]}),Ce]}),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:[pe,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:()=>{ae()},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(x?.()).then(()=>{Q(U)})},children:"Done"})]})]})})),Li=e.jsx(w.DynamicIcon,{iconKey:"circle.colored"}),Ao=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o,quickColor:t,icon:r=Li,tooltip:s,label:d,onPreviewColor:m,onPreviewColorImmediate:l,onSelectColor:c,variant:u=y.PopupButtonType.Toolbar,panelProps:C,shouldCloseFloatAll:x=!0,compareRGB:f=!1,darkMode:p=!1,...b}=a,S=w.useCallbackRef(m,[m]),h=w.useCallbackRef(l,[l]),g=w.useCallbackRef(c,[c]),[k,j]=n.useState(()=>{}),v=t||k||o||C?.autoColor,T=n.useRef(!1),M=n.useCallback(()=>{},[]),R=w.useCallbackRef(()=>{j(o)},[o]),D=w.useCallbackRef(W=>{T.current||(j(W),S?.(W))},[S]),F=w.useCallbackRef(W=>{T.current||(j(W),h?.(W))},[h]),E=w.useCallbackRef((W,ee)=>{T.current||(j(void 0),g?.(W,ee))},[g]),P=n.useMemo(()=>e.jsx(B.Box,{className:"color-wrapper",sx:{lineHeight:"0",color:"inherit","--sxl-color-active":`${v?.toCSS(p)??"transparent"}`,"& .activeColor":{fill:`${v?.toCSS(p)??"transparent"}`},"& .style_grey":{fill:W=>W.palette.text.icon??W.palette.action.active}},children:typeof r=="function"?r():r}),[v,r,p]),I=w.useCallbackRef(W=>{g?.(t,!1)},[g,t]),[z,N]=n.useState(!1),H=n.useCallback(W=>{const{closeFloat:ee,closeFloatAll:X}=W;return e.jsx(Ra,{...C,selectedColor:o,previewColor:k,onDone:x?X:ee,onKeyDown:ae=>{ae.which===w.KeyCodes.Enter&&(x?X():ee())},onPreviewColorImmediate:F,onPreviewColor:D,onSelectColor:E,onEyeDropStart:()=>N(!0),onEyeDropStop:()=>N(!1),compareRGB:f,darkMode:p})},[o,k,x,v,C?.autoColor,p]),O={onQuickClick:t?I:void 0,createPopupPanel:H,popupProps:{popperProps:{resizeOnOverflow:!1}},onPopupOpen:R,onPopupClose:M,tooltip:s||d||"Color",label:d,icon:P,...b};return u===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...O}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...O})})),eo=82,Mo=a=>{const{styleColor:i,length:o=eo,width:t=1,dashArray:r=null,sx:s,isDouble:d=!1,isAngled:m=!1,darkMode:l=!1,...c}=a;return e.jsx(B.SvgIcon,{sx:{width:`${o}px`,height:`${t}px`,color:"inherit",overflow:"visible","& .activeColor":{stroke:u=>`${i?i.toRGBA(l).toString():u.palette.text.icon??u.palette.action.active}`},"& .style_grey":{stroke:u=>u.palette.text.icon??u.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:m,className:"activeColor"})})},Pa=n.memo(n.forwardRef((a,i)=>{const{variant:o,showLabels:t=!1,disabled:r=!1,createPopupPanel:s,styleColor:d,selectedStyle:m,onSelectStyle:l,showNone:c=!0,darkMode:u,sx:C,...x}=a,f=w.useCallbackRef(l,[]),p=n.useCallback(g=>{const{popupContainer:k,floatReference:j,closeFloat:v,...T}=g,M=[],R=A.IBorder.BuiltInDefinitionsArray;for(let D=0;D<R.length;D++){const F=R[D];if(F.description==="None"&&!c)continue;const E=e.jsx(Mo,{styleColor:d,length:eo,width:F.width,darkMode:u,dashArray:F.pattern,isDouble:F.description.toLowerCase().includes("double"),isAngled:F.description.toLowerCase().includes("slant")});let P=null;P=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:I=>I.preventDefault(),onMouseUp:()=>{v(),f(F.style)},onKeyDown:I=>{I.which===w.KeyCodes.Enter&&v()},selected:F.style===m,parentFloat:j,children:P},D))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:M})},[r,c,d,m,u]),b=n.useMemo(()=>{const g=A.IBorder.BuiltInDefinitions.get(m);let k;return k=g.description==="None"?e.jsx(B.Box,{sx:{minWidth:`${eo}px`},children:"None"}):e.jsx(Mo,{styleColor:d,length:eo,width:g.width,dashArray:g.pattern,darkMode:u,isDouble:g.description.toLowerCase().includes("double"),isAngled:g.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})},[m,d]),S=n.useMemo(()=>A.IBorder.BuiltInDefinitions.get(m),[m]),h={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:p,...x};return o===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{...h}):e.jsx(y.ExhibitPopupMenuItem,{...h})})),Ma=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:m=!0,onSelectBorder:l,onPreviewBorder:c,selectedBorder:u,createTemporaryBorder:C,...x}=a,f=w.useCallbackRef(l,[l]),p=w.useCallbackRef(c,[c]),[b,S]=n.useState(),[h,g]=n.useState(),k=b??r,j=h??o,v=u||{bottom:{style:r,color:o?.toString()}},T=w.useCallbackRef(P=>{const I={},z=P?Object.keys(P):[];let N=!1;const H=z.length;for(let Y=0;Y<H;Y++){const _=z[Y];P[_]?.style&&(I[_]={style:P[_].style,color:P[_].color},N||I[_].style===A.IBorder.StrokeStyle.None||(N=!0))}z.length<6&&(N=!0);const O=N?I.left:null,W=N?I.top:null,ee=N?I.right:null,X=N?I.bottom:null,ae=N?I.vertical:null,$=N?I.horizontal:null;let U="";return W||O||(U+="M 3,5 H 5 V 3 H 3 "),W||(U+="M 7,5 H 9 V 3 H 7 "),W||ae||(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 "),O||(U+="M 3,9 H 5 V 7 H 3 "),ae||(U+="M 11,9 h 2 V 7 h -2 "),ee||(U+="M 19,9 h 2 V 7 h -2 "),$||O||(U+="M 3,13 H 5 V 11 H 3 "),$||(U+="M 7,13 H 9 V 11 H 7 "),$||ae||(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 "),O||(U+="M 3,17 H 5 V 15 H 3 "),ae||(U+="M 11,17 h 2 v -2 h -2 "),ee||(U+="M 19,17 h 2 v -2 h -2 "),X||O||(U+="M 3,21 H 5 V 19 H 3 "),X||(U+="M 7,21 H 9 V 19 H 7 "),X||ae||(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=I.top,Q.bottom=I.horizontal):(Q.top=I.horizontal,Q.bottom=I.bottom),G===0?(Q.left=I.left,Q.right=I.vertical):(Q.left=I.vertical,Q.right=I.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((P,I,z)=>{let N=null;if(P&&P.length>0){let H=null;(I||z)&&(H={style:z,color:I?.toString()??null}),N={};const O=P.length;for(let W=0;W<O;W++)N[P[W]]=H}return N},[]),R=n.useCallback(P=>{f?.(P)},[]),D=n.useCallback(P=>{p?.(P)},[]),F=n.useCallback(P=>{const{closeFloatAll:I,floatReference:z}=P,N=(W,ee,X="bottom",ae=!1)=>{const $=M(W,j??null,ae?A.IBorder.StrokeStyle.None:k??null),U=ae?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:()=>{I(),D($),R($)}})},H=e.jsxs(e.Fragment,{children:[e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[N([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"),N([A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"Inner Borders","top"),N([A.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),N([A.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),N([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:[N([A.IBorder.Edge.Left],"Left Borders"),N([A.IBorder.Edge.Top],"Top Borders"),N([A.IBorder.Edge.Right],"Right Borders"),N([A.IBorder.Edge.Bottom],"Bottom Borders"),N([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)]})]}),O=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=>{g(W)},onSelectColor:(W,ee)=>{g(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(Pa,{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:[m?O:H,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),m?H:O]})},[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:P},I)=>e.jsx(y.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:I,children:P}),onQuickClick:()=>{f?.(v)},quickButtonProps:{sx:{}},disabled:s,icon:E,...x})})),Da=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,variant:s=w.CommandButtonType.Toolbar,disabled:d=!1,autoColor:m,autoStrokeStyle:l,schemeLookup:c,createTemporaryBorder:u,selectedBorder:C,onSelectBorder:x,darkMode:f,icon:p,label:b,...S}=a,h=w.useCommands(o,["formatBorder"]),g=t??h[0],k=g?.context()??null,j=k?.autoColor??m,v=k?.autoStyle??l,T=C??k?.quickBorder,M=f??k?.darkMode,R=u??k?.createTemporaryBorder,D=c??k?.schemeLookup,F=w.useCallbackRef(P=>{k?.onBorderSelect&&k.onBorderSelect(P),x?.(P),g?.execute(P,r)},[g,x,r]),E=n.useCallback((P,I)=>{const{children:z,title:N,...H}=P;let O=P.children;return(g?.disabled()||d)&&(O=e.jsx("div",{children:O})),e.jsx(y.CommandTooltip,{command:g,placement:s===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:I,...H,children:O})},[g,d]);return e.jsx(Ma,{ref:i,autoColor:j,darkMode:M,autoStrokeStyle:v,createTemporaryBorder:R,schemeLookup:D,selectedBorder:T,onSelectBorder:F,createTooltip:E,disabled:d||!g||g.disabled(),...S})})),Fa=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=n.useCallback((l,c)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:c.getCommand("mergeToggle")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("mergeHorizontal")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("mergeVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,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:m,icon:"MergeAll",...d})})),Ia=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=n.useCallback((l,c)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:c.getCommand("freezeToggle")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("freezeToggleHorizontal")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("freezeToggleVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,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:m,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})})),Na=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=n.useCallback((l,c)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:c.getCommand("find")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("findReplace")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("goto")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:m,label:"Find & Select",tooltip:"Find and replace cells or go to a specific location.",quickCommand:"find",icon:"Find",...d})})),Oa=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,showQuickButtons:r=!!a.commands,commands:s,fontSizes:d=oe.FontUtils.DefaultFontSizes,disabled:m=!1,parentFloat:l,icon:c,label:u,sx:C,...x}=a;w.useCommand(o);const f=()=>o?.state()?.toString()||"11",[p,b]=n.useState(f),S=w.useCallbackRef(()=>{const R=parseFloat(p);isNaN(R)?b(f()):parseFloat(f())!==R&&o.execute(R,t)},[f,o,p,t]);n.useEffect(()=>{b(f())},[o?.state()]);const h=n.useMemo(()=>{if(!t)return null;const R={...t};return delete R.beforeExecute,R},[t]),g=w.useCommands(s,["formatFontSizeIncrease","formatFontSizeDecrease"]),k=n.useMemo(()=>g?e.jsxs(B.Box,{className:ie("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:R=>R.stopPropagation(),children:[e.jsx(y.CommandButton,{command:g[0],commandHook:h}),e.jsx(y.CommandButton,{command:g[1],commandHook:h})]}):null,[g]),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(R=>{const{onMouseDown:D,onMouseUp:F,...E}=R;return e.jsx(B.IconButton,{component:"div",...E,disableRipple:!0,children:e.jsx(B.Input,{inputMode:"numeric",disabled:m||!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:P=>`1px solid ${P.palette.text.icon??P.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:P=>`1px solid ${P.palette.error.main}`},"::after":{borderBottom:P=>`1px solid ${P.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:P=>`${Math.round(P.typography.fontSize)}px`,width:v,color:P=>P.palette.text.secondary,input:{padding:"0 0",textAlign:"center",height:"1rem",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:P=>P.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:P=>P.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"}},value:p,onFocus:P=>{P.target?.select()},onKeyDown:P=>{if(P.which===w.KeyCodes.Enter)f()!==p&&(P.stopPropagation(),P.preventDefault(),S());else if(P.which===w.KeyCodes.Escape)f()!==p&&(b(f()),setTimeout(()=>{P.target?.select()},0),P.stopPropagation(),P.preventDefault());else{if(P.key.match("[-]")||P.key.match("[0-9.]")&&(p+P.key).length>4)return P.stopPropagation(),void P.preventDefault();if(P.which===w.KeyCodes.Space)return void P.preventDefault()}},onBlur:()=>{S()},onChange:P=>{if(P.target.value.length>4)return P.stopPropagation(),void P.preventDefault();b(P.target.value)}})})},[p,m,o]),M=n.useCallback(R=>{const D=I=>{o?.execute(I,t)},F=o?.state(),E=[];for(let I=0;I<d.length;I++){const z=d[I]===F;E.push(e.jsx(y.ExhibitMenuItem,{selected:z,icon:z?e.jsx(y.SelectedIcon,{}):void 0,disabled:m||!o||o.disabled(),onMouseDown:N=>{N.button===0&&N.preventDefault()},onMouseUp:N=>{N.button===0&&D(d[I])},onKeyDown:N=>{N.keyCode!==w.KeyCodes.Enter&&N.keyCode!==w.KeyCodes.Space||D(d[I])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:d[I]})},"fontSize-"+I))}const P=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...x,children:[k,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:E})]});return y.defaultCreatePopupPanel({...R,children:P})},[m,o?.state(),t]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...C},tabIndex:-1,outlined:!0,disabled:m,parentFloat:l,createPopupPanel:M,createTooltip:({children:R},D)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:D||o?.disabled(),children:R}),createQuickButton:T,...x})})),Rn=n.memo(a=>{const{selected:i,disabled:o,formattedValue:t,handleSetFormat:r,format:s,sx:d,...m}=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)},...m,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=>Be.alpha(l.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),Aa=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,sx:s,disabled:d=!1,parentFloat:m,...l}=a,c=w.useCommands(o,["formatNumberFormat"])[0],u=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]),x=n.useCallback((b,S)=>{const h=F=>{t?.beforeExecute?.(c,c?.state()),c.execute(F,t),t?.onExecute?.(c,c?.state())},g=c?.context()(),k=A.NumberFormat.Styles.lookupPrimary(),j=[];for(let F=0;F<k.length;F++){let E="";if(g&&!g.isEmpty())try{E=g.getNumberFormat(k[F].numberFormat).displayText}catch(I){console.warn(I)}E===""&&k[F].formatType===A.NumberFormat.Type.General&&(E="No specific format");const P=k[F].formatType===u;j.push(e.jsx(Rn,{selected:P,disabled:d||!c||c.disabled(),formattedValue:E,handleSetFormat:h,format:k[F]},k[F].formatType))}const v={numberFormat:"",formatType:A.NumberFormat.Type.Custom},T=u===A.NumberFormat.Type.Custom,M=e.jsx(Rn,{selected:T,disabled:d||!c||c.disabled(),formattedValue:T?g.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),R=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:[R,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]),f=q.useTheme(),p=n.useMemo(()=>{const b=A.NumberFormat.Type.MediumTime;return`${A.IFont.getSharedMeasurer()(b,Math.round(f.typography.fontSize),f.typography.fontFamily).width}px`},[f]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,sx:s,outlined:!0,disabled:d,parentFloat:m,createPopupPanel:x,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:p},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:u})}),...l})})),Lo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=n.useCallback((l,c)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"clear",disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:c.getCommand("clearAll")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("clearFormats")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("clearContents")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("clearComments")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("clearHyperlinks")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Clear",tooltip:"Clear everything in the cell, or remove just the formatting or contents.",createPopupPanel:m,icon:"ClearAll",...d})})),La=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=n.useCallback((l,c)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"fill",disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:c.getCommand("fillDown")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("fillRight")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("fillUp")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("fillLeft")})]});return y.defaultCreatePopupPanel({...l,children:C})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,label:"Fill",tooltip:"Fill the selected cells with the value from one of the corners.",createPopupPanel:m,icon:"FillDown",...d})})),zo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:m=!0,showQuickButton:l=!0,variant:c=w.CommandButtonType.Toolbar,...u}=a,C=w.useCommands(o,["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns"]),{singleCommand:x,allDisabled:f}=n.useMemo(()=>{let b=null,S=0;for(let h=0;h<C.length;h++)C[h]&&!C[h]?.disabled()&&(m&&c===w.CommandButtonType.Menuitem&&(b=S===0?C[h]:null),S++);return{singleCommand:b,allDisabled:S===0}},[C]),p=n.useCallback((b,S)=>{let h=null;const g={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,{...g,command:S.getCommand("addSheet")})]}));const k=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:C[0]}),e.jsx(y.CommandButton,{...g,command:C[1]}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:C[2]}),e.jsx(y.CommandButton,{...g,command:C[3]}),h]});return y.defaultCreatePopupPanel({...b,children:k})},[s,C,t,r]);return x?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:x,...u}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,quickCommand:"insertCells",commands:o,commandHook:t,scope:r,disabled:s||f,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:p,...u})})),Ho=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:m=!0,showQuickButton:l=!0,variant:c=w.CommandButtonType.Toolbar,...u}=a,C=w.useCommands(o,["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"]),{singleCommand:x,allDisabled:f}=n.useMemo(()=>{let b=null,S=0;for(let h=0;h<C.length;h++)C[h]&&!C[h]?.disabled()&&(m&&c===w.CommandButtonType.Menuitem&&(b=S===0?C[h]:null),S++);return{singleCommand:b,allDisabled:S===0}},[C]),p=n.useCallback((b,S)=>{const h={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:s};let g=null;d||(g=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:S.getCommand("deleteSheet")})]}));const k=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...h,command:S.getCommand("deleteCellsShiftUp")}),e.jsx(y.CommandButton,{...h,command:S.getCommand("deleteCellsShiftLeft")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:S.getCommand("deleteRows")}),e.jsx(y.CommandButton,{...h,command:S.getCommand("deleteColumns")}),g]});return y.defaultCreatePopupPanel({...b,children:k})},[s,t,r]);return x?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:x,...u}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,quickCommand:"deleteCells",commands:o,commandHook:t,scope:r,disabled:s||f,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:p,...u})})),ft=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,onSelectColor:r,disabled:s=!1,variant:d=w.CommandButtonType.Toolbar,quickColor:m,panelProps:l,isSplit:c=!1,darkMode:u,icon:C,...x}=a,{autoColor:f,schemeLookup:p,recentColors:b,...S}=l;if(x.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");w.useCommand(o);const h=o?.context();let g=m??h?.quickColor;c&&!g&&(g=new A.Color("transparent"));const k=f??h?.autoColor,j=p??h?.schemeLookup,v=b??h?.recentColors,T=u??h?.darkMode,M=n.useMemo(()=>({autoColor:k,schemeLookup:j,recentColors:v,darkMode:T,...S}),[k,j,v,T]),R=w.useCallbackRef((F,E)=>{F&&E&&h?.addRecentColor&&h.addRecentColor(F),h?.onColorSelect&&h.onColorSelect(F),r?.(F,E),o?.execute(F,t)},[o,r,t,h]),D=n.useCallback((F,E)=>{const{children:P,title:I,...z}=F;let N=F.children;return(o?.disabled()||s)&&(N=e.jsx("div",{children:N})),e.jsx(y.CommandTooltip,{command:o,placement:d===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:E,...z,children:N})},[o,s]);return e.jsx(Ao,{ref:i,panelProps:M,icon:C,quickColor:g,selectedColor:o?.state(),onSelectColor:R,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,...x})}));ft.displayName="ColorCommandButton";const za=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...m}=a,l=w.useCommands(o,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),c=n.useCallback((u,C)=>{const x={variant:w.CommandButtonType.Menuitem,parentFloat:u.floatReference,commandHook:t,scope:r,disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:C.getCommand("gridlinesToggle")}),e.jsx(ft,{...x,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,{...x,command:C.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("sheetViewToggleGridlinesRows")})]});return y.defaultCreatePopupPanel({...u,children:f})},[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"}),...m})})),Wo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=n.useCallback((l,c)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},C=c.getCommand("sortCustom"),x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:c.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...u,command:c.getCommand("sortDescending")}),C?e.jsx(y.CommandButton,{...u,command:C}):null,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...u,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...u,scope:"filter",command:c.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...l,children:x})},[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:m,icon:"SortIncrease",...d})})),zi=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=n.useCallback((l,c)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...u,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...u,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:m,icon:"FilterToggle",...d})})),$o=n.memo(n.forwardRef((a,i)=>{const{quickCommand:o,icon:t,isRedo:r=!1,nestRedo:s=!0,undoManager:d,scope:m,sx:l,disabled:c,commands:u,...C}=a,x=[o];!r&&s&&x.push("redo");const f=w.useCommands(u,x),p=f[0],b=f[1],S=d??p?.context?.()?.undoManager;let h=c;c||(h=!p||p.disabled(),b&&!b.disabled()&&(h=!1));const[g,k]=n.useState(0),j=n.useCallback((v,T)=>{let M=g===0?"Cancel":`${p.label()} ${g} Action${g===1?"":"s"}`,R=!1;S||(R=!0),R||(R=s?!S.hasRedo()&&!S.hasUndo():!S.hasRedo());const D=N=>{p.execute(N)},F=e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:R?void 0:"0 0",minWidth:"180px"},icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(0)},onMouseDown:N=>{N.button===0&&N.preventDefault()},onMouseUp:N=>{N.button===0&&D(g)},onKeyDown:N=>{N.isDefaultPrevented()||N.keyCode!==w.KeyCodes.Enter&&N.keyCode!==w.KeyCodes.Space||D(g)},children:e.jsx(B.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:M})});if(R)return F;const E=r?S?.getRedoDescriptions():S?.getUndoDescriptions(),P=[];for(let N=0;N<E.length;N++){const H=E[N];P.push(e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},disabled:h,selected:N<g,icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(N+1)},onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&D(N+1)},onKeyDown:O=>{O.isDefaultPrevented()||O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||D(N+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:${N}`))}let I=null;if(!r&&s){const N={scope:"undo",commands:T,variant:w.CommandButtonType.Menuitem,parentFloat:v.floatReference};I=[],I.push(e.jsx($o,{...N,quickCommand:"redo",isRedo:!0},"nested:redo")),S.hasRedo()&&S.hasUndo()&&I.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:[I,e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:P}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),F]});return y.defaultCreatePopupPanel({...v,children:z})},[p?.context(),p?.state(),m,S,g,h]);return e.jsx(y.CommandPopupButton,{ref:i,commands:u,quickCommand:o,scope:m,disabled:h,label:p?.label()??(r?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${p?.label()??"No"} last actions.`})}),createPopupPanel:j,icon:t??(r?"Redo":"Undo"),selected:!1,...C})})),pt=A.IFontCollection.getFontList(),Ha=new Map;for(let a=0;a<pt.length;a++)Ha.set(pt[a].fontRef.getFamily(),pt[a]);const Wa=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,sx:r,disabled:s=!1,parentFloat:d,icon:m,label:l,...c}=a;w.useCommand(o);const u=o?.state(),C=q.useTheme(),x=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("Times New Roman",Math.round(C.typography.fontSize),C.typography.fontFamily).width}px`,[C]),f=n.useCallback(p=>{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()});Ha.get(u)||S.unshift({key:u,description:u});const h=[];for(let k=0;k<S.length;k++){const j=S[k].key===u;h.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 g=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:h})});return y.defaultCreatePopupPanel({...p,children:g})},[s,o?.state()]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...r},outlined:!0,disabled:s,parentFloat:d,createPopupPanel:f,createTooltip:({children:p},b)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:b,children:p}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:p=>`${Math.round(p.typography.fontSize)}px`,fontFamily:p=>p.typography.fontFamily,color:p=>p.palette.text.secondary,width:x},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:u})}),...c})})),$a=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=w.useCommands(o,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),l=n.useMemo(()=>{for(let u=0;u<m.length;u++)if(m[u]?.state())return m[u];return m[0]},[m]),c=n.useCallback((u,C)=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:C.getCommand("formatStrikeThroughToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatSuperscriptToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatSubscriptToggle")})]});return y.defaultCreatePopupPanel({...u,children:f})},[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})})),Va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=w.useCommands(o,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),l=n.useMemo(()=>{for(let u=0;u<m.length;u++)if(m[u]?.state())return m[u];return m[0]},[m]),c=n.useCallback((u,C)=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:C.getCommand("formatUnderlinedToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatUnderlinedDoubleToggle")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatUnderlinedAccountingToggle"),commandHook:t}),e.jsx(y.CommandButton,{...x,command:C.getCommand("formatUnderlinedAccountingDoubleToggle")})]});return y.defaultCreatePopupPanel({...u,children:f})},[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})})),Vo=n.memo(n.forwardRef((a,i)=>{const{command:o,commands:t,commandHook:r,scope:s,includePasteAllInPopup:d=!0,disabled:m=!1,...l}=a,c=w.useCallbackRef((u,C)=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:r,scope:"paste",disabled:m},f=[];return d&&(f.push(n.createElement(y.CommandButton,{...x,command:C.getCommand("paste"),key:"paste"})),f.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),f.push(n.createElement(y.CommandButton,{...x,command:C.getCommand("pasteValues"),key:"pasteValues"})),f.push(n.createElement(y.CommandButton,{...x,command:C.getCommand("pasteFormats"),key:"pasteFormats"})),f.push(n.createElement(y.CommandButton,{...x,command:C.getCommand("pasteFormulas"),key:"pasteFormulas"})),f.push(n.createElement(y.CommandButton,{...x,command:C.getCommand("pasteTranspose"),key:"pasteTranspose"})),f.push(n.createElement(y.CommandButton,{...x,command:C.getCommand("pasteLinks"),key:"pasteLinks"})),y.defaultCreatePopupPanel({...u,children:f})},[m,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",icon:"paste",...l})})),_a=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...m}=a,l=w.useCommands(o,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),c=n.useCallback((u,C)=>{const x={variant:w.CommandButtonType.Menuitem,parentFloat:u.floatReference,commandHook:t,scope:r,disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:C.getCommand("sheetViewToggleShowHeadings")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:C.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(y.CommandButton,{...x,command:C.getCommand("sheetViewToggleShowHeadingRows")})]});return y.defaultCreatePopupPanel({...u,children:f})},[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"}),...m})})),Ka=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="view",disabled:s=!1,...d}=a,m=n.useCallback(l=>{const c={variant:w.CommandButtonType.Menuitem,parentFloat:l.floatReference,commandHook:t,scope:r,disabled:s},u=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:u})},[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:m,icon:e.jsx(y.LabelIcon,{icon:null,label:"Workbook View"}),...d})})),Ua=n.memo(n.forwardRef((a,i)=>{const{value:o,cellStyle:t,styles:r,createTemporaryCell:s,bodyStyle:d,sx:m,borderProps:l,disabled:c,...u}=a,C=n.useMemo(()=>s({value:o,style:t}),[o,t,s]),x=n.useMemo(()=>C.getStyle(),[C,d]),f=n.useMemo(()=>x.getFill().toCSS(d?.darkMode??!1),[x]),p=x.getInsets(),b=x.getFont(),S=n.useCallback(()=>x.getBorder(),[x]);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",...f},"& .text":{flex:"1 1 100%",...b.toCSS(d?.darkMode??!1,1),boxSizing:"border-box",padding:`${p.top}px ${p.right}px ${p.bottom}px ${p.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"},...m},...u,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})})})})})),Hi=n.memo(a=>{const{styles:i,namedStyle:o,selectedNamed:t,hasContextMenu:r=!0,bodyStyle:s,onSelectNamed:d,createTemporaryCell:m,parentFloat:l,commands:c,disabled:u,commandHook:C,...x}=a,f=n.useCallback(S=>{const h={variant:w.CommandButtonType.Menuitem,commandHook:C,context:"cellStyle"},g=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...h,style:{fontWeight:550},command:c.getCommand("formatCellStyle"),commandState:o,disabled:u}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:c.getCommand("modifyCellStyle"),commandState:{named:o}}),e.jsx(y.CommandButton,{...h,command:c.getCommand("deleteCellStyle"),commandState:o,disabled:u||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:g})});return y.defaultCreatePopupPanel({...S,children:k})},[]),p=o?.getName()===t?.getName();let b=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:S=>`solid ${p?S.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName(),placement:"bottom-start"},disabled:u,icon:null,onClick:()=>{d?.(o)},...x,children:e.jsx(Ua,{value:o.getName(),cellStyle:{named:o.getName()},styles:i,createTemporaryCell:m,bodyStyle:s})},o.getName());return r&&(b=e.jsx(y.ContextMenu,{label:o.getName(),parentFloat:l,createPopupPanel:f,children:b})),b}),qa=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedNamed:s,onSelectNamed:d,disabled:m=!1,bodyStyle:l,usePreviewIcon:c=!0,...u}=a;w.useCommand(t);const C=t?.context(),x=C?.styles,f=s??C?.named(),p=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:x(),parentFloat:j.floatReference},M=x().getCustomNamed(),R=new Map,D=[];for(let O=0;O<M.length;O++)R.set(M[O].getName(),M[O]),x().getNamed(M[O].getName()).getBuiltInID()===null&&D.push(M[O].getName());const F=O=>{let W=R.get(O);return W||(W=x().getNamed(O)),!W||W.isHidden()?null:e.jsx(Hi,{namedStyle:W,selectedNamed:f,bodyStyle:C.bodyStyle(),createTemporaryCell:C.createTemporaryCell,commands:o,commandHook:r,...T},O)},E=(O,W,ee=!0)=>{const X=[];for(let ae=0;ae<W.length;ae++){const $=F(W[ae]);$&&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:O},O+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:X},O+"-presets")]},O)},P=(O,W)=>{const ee=[];for(let X=0;X<W.length;X++){const ae=F(W[X]);ae&&ee.push(ae)}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},O+"-presets")},I=[];I.push(E("Custom",D,!1)),I.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)),I.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])),I.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 N,H;return z.push(P("Accent 1",[A.IStyle.BuiltInName.Accent1_20,A.IStyle.BuiltInName.Accent1_40,A.IStyle.BuiltInName.Accent1_60,A.IStyle.BuiltInName.Accent1])),z.push(P("Accent 2",[A.IStyle.BuiltInName.Accent2_20,A.IStyle.BuiltInName.Accent2_40,A.IStyle.BuiltInName.Accent2_60,A.IStyle.BuiltInName.Accent2])),z.push(P("Accent 3",[A.IStyle.BuiltInName.Accent3_20,A.IStyle.BuiltInName.Accent3_40,A.IStyle.BuiltInName.Accent3_60,A.IStyle.BuiltInName.Accent3])),z.push(P("Accent 4",[A.IStyle.BuiltInName.Accent4_20,A.IStyle.BuiltInName.Accent4_40,A.IStyle.BuiltInName.Accent4_60,A.IStyle.BuiltInName.Accent4])),z.push(P("Accent 5",[A.IStyle.BuiltInName.Accent5_20,A.IStyle.BuiltInName.Accent5_40,A.IStyle.BuiltInName.Accent5_60,A.IStyle.BuiltInName.Accent5])),z.push(P("Accent 6",[A.IStyle.BuiltInName.Accent6_20,A.IStyle.BuiltInName.Accent6_40,A.IStyle.BuiltInName.Accent6_60,A.IStyle.BuiltInName.Accent6])),I.push((N="Themed Cell Styles",H=z,e.jsxs(B.Box,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.ExhibitMenuHeader,{children:N},N+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:H},N+"-presets")]},N))),I.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:O=>`${O.shape.borderRadius}px`,paddingBottom:O=>`${O.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",paddingTop:"6px",paddingBottom:"0px",paddingLeft:"16px",paddingRight:"16px"},children:I}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:f,command:v.getCommand("newCellStyle"),context:"styles",commandHook:r,disabled:m})]})},[f,x?.().getTheme(),p]),h=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]),g=m||!t||t.disabled(),k=n.useMemo(()=>C&&c?e.jsx(Ua,{value:f?.getName()??"Custom",cellStyle:f?{named:f.getName()}:void 0,styles:C.styles(),createTemporaryCell:h,bodyStyle:C.bodyStyle(),className:"outline-hover",disabled:g,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(),[f,p,g,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:g,label:t?.label(),icon:k,...u})})),Ga="_sheetxl-reset_11z3j_1",Wi=10,_o=n.memo(n.forwardRef((a,i)=>{const{styles:o,table:t,tableStyle:r=t?.getStyle()??o.getDefaultTableStyle(),bodyStyle:s,sx:d,disabled:m,className:l,forceThinBorder:c,cellHeight:u=Wi,isLive:C=!1,...x}=a,f=Math.ceil(1.3*u),[p,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})},[p,t,r,o]),h=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]),g=n.useMemo(()=>{const j=(T,M,R)=>{let D=R.getFill().toCSS(s?.darkMode??!1);const F=f-(M<4?1:0),E=u-(T<4?1:0),P=R.getFont().getFill().toCSS(s?.darkMode??!1);return D={...D,position:"absolute",boxSizing:"border-box",left:M*(f-1),top:T*(u-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 ${P}`}})},`${T}-${M}`)},v=[];for(let T=0;T<5;T++){const M=[];for(let R=0;R<5;R++){const D=h[5*T+R];M.push(j(T,R,D))}v.push(e.jsx("tr",{children:M},T))}return v},[S,r,s]),k=n.useCallback((j,v)=>h[v].getBorder()??null,[h]);return e.jsx(B.Box,{ref:i,className:"table-format-preview",sx:{background:s?.fill,filter:m?"grayscale(0.4) opacity(0.8);":"none","& .styled-element":{position:"absolute"},...d},...x,children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:k,rowCount:5,columnCount:5,forceThinBorder:c,width:5*(f-1)+1,height:5*(u-1)+1,darkMode:s?.darkMode??!1,style:{pointerEvents:"none"},children:e.jsx("table",{className:ie(l,"sheetxl-table-preview",Ga),style:{borderCollapse:"collapse",width:5*(f-1)+1,height:5*(u-1)+1},children:e.jsx("tbody",{children:g})})})})})),St=(a,i,o,t,r)=>{a.beginPath(),a.moveTo(i+.5,o+.5),a.lineTo(t+.5,r+.5),a.stroke()},Xa=n.memo(n.forwardRef((a,i)=>{const{table:o,tableStyle:t,styles:r,bodyStyle:s,disabled:d,style:m,className:l,canvas:c,...u}=a,C=n.useMemo(()=>{const p=o.toJSON(),b={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return p.styleOptions={...p.styleOptions,name:t.getName()},p.ref=b,new A.Table({initialAnchor:b,json:p,styles:r})},[o,t,r]),x=n.useMemo(()=>{const p=[];for(let b=0;b<5;b++)for(let S=0;S<5;S++){const h=C.getStyleAt({colIndex:S,rowIndex:b});p.push(h)}return p},[C]),f=n.useMemo(()=>{let p=c;if(c||(p=document.createElement("canvas")),!p)return null;p.width!==61&&(p.width=61),p.height!==46&&(p.height=46);const b=p.getContext("2d",{alpha:!1});if(!b)return null;const S=12,h=s?.darkMode??!1;for(let g=0;g<5;g++)for(let k=0;k<5;k++){const j=x[5*g+k].getFill();let v=s?.fill;j.getType()===A.IFill.Type.Solid?v=j.getColor().toCSS(h,!1):j.getType()===A.IFill.Type.Gradient?v=j.getStops[0]?.color.toCSS(h,!1):j.getType()===A.IFill.Type.Pattern&&(v=j.getForeground().toCSS(h,!1)),b.fillStyle=v;const T=k*S,M=9*g;b.fillRect(T,M,13,10)}b.lineWidth=1;for(let g=0;g<5;g++)for(let k=0;k<5;k++){const j=x[5*g+k],v=k*S,T=9*g,M=j.getBorder();if(!M.isEmpty()){const F=M.getLeft();F.isNone()||(b.strokeStyle=F.getColor().toCSS(h,!1),St(b,v,T,v,T+9));const E=M.getTop();E.isNone()||(b.strokeStyle=E.getColor().toCSS(h,!1),St(b,v,T,v+S,9*g));const P=M.getRight();P.isNone()||(b.strokeStyle=P.getColor().toCSS(h,!1),St(b,v+S,T,v+S,T+9));const I=M.getBottom();I.isNone()||(b.strokeStyle=I.getColor().toCSS(h,!1),St(b,v,T+9,v+S,T+9))}b.strokeStyle=j.getFont().getFill().toCSS(h,!1);const R=4,D=2.5;St(b,k*S+D,9*g+R,k*S+D+7,9*g+R)}return`url(${p.toDataURL()})`},[c,C,t,s]);return e.jsx("div",{ref:i,className:ie("table-style-preview",l),style:{backgroundImage:f,width:61,height:46,...m},...u})})),$i="_table-style-options-container_1kfn2_1",Vi="_table-style-options_1kfn2_1",Ya=n.memo(n.forwardRef((a,i)=>{const{styleOptions:o,onStyleOptionsChange:t,showHeaderRow:r,onShowHeaderRowChange:s,showTotalRow:d,onShowTotalRowChange:m,showFilterButton:l,onShowFilterButtonChange:c,sx:u,className:C,disabled:x,...f}=a;return e.jsx("div",{className:$i,children:e.jsxs(B.Box,{sx:{pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:p=>`${p.spacing(2)}`,marginRight:p=>`${p.spacing(2)}`},"& .MuiCheckbox-root":{padding:p=>`${p.spacing(.5)}`},...u},...f,ref:i,className:ie(C,Vi),children:[s&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:r??!1,indeterminate:r==null,onChange:()=>s(!r),disabled:x||r==null}),label:"Header Row",labelPlacement:"end"}),m&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:d??!1,indeterminate:d==null,onChange:()=>m(!d),disabled:x||d==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showRowStripes??!1,indeterminate:!o,disabled:x||!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:x||!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:x||!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:x||!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:x||!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)}},_i=function(){},Za=typeof window<"u",dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ki=Za?n.useLayoutEffect:n.useEffect,Pn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const $e=Za&&window.ResizeObserver!==void 0?function(){var a=n.useState(null),i=a[0],o=a[1],t=n.useState(Pn),r=t[0],s=t[1],d=n.useMemo(function(){return new window.ResizeObserver(function(m){if(m[0]){var l=m[0].contentRect,c=l.x,u=l.y,C=l.width,x=l.height,f=l.top,p=l.left,b=l.bottom,S=l.right;s({x:c,y:u,width:C,height:x,top:f,left:p,bottom:b,right:S})}})},[]);return Ki(function(){if(i)return d.observe(i),function(){d.disconnect()}},[i]),[o,r]}:function(){return[_i,Pn]},Ui="_range-row_akhf4_1",qi="_action-row_akhf4_15",Qa=n.createContext(null);Qa.displayName="HookFormContext";const Ja=()=>n.useContext(Qa);typeof window<"u"?n.useLayoutEffect:n.useEffect;const Ko=n.memo(n.forwardRef((a,i)=>{const{disabled:o,style:t,className:r,sx:s,defaultInput:d,value:m,formName:l,formOptions:c,onChangeInput:u,onValidate:C,onKeyDown:x,...f}=a,p=Ja(),b=l&&p?p.register(l,c):null,[S,h]=n.useState(""),[g,k]=n.useState(""),[j,v]=n.useState(m);n.useEffect(()=>{v(m),k("")},[m]);const T=w.useCallbackRef(E=>{let P="";try{v(E),C?.(E),u?.(E)}catch(I){P=I.message??"Invalid Name"}l&&p&&(P?p.setError(l,{message:P}):p.clearErrors(l)),k(P)},[m,C,u]),M=w.useCallbackRef(async E=>{E.keyCode===w.KeyCodes.Escape&&S!==m&&(T(S),p?.setValue(l,S),p?.clearErrors(l),E.stopPropagation()),x?.(E)},[x,S,m,p]),R=w.useCallbackRef(E=>{h(E.target.value??"")},[]),D=w.useCallbackRef(E=>{h(""),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),...f,children:e.jsx(B.TextField,{label:"Name",placeholder:d,onFocus:R,onBlur:D,inputRef:b?.ref,disabled:o,error:!!g,helperText:g||" ",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()}})})}));Ko.displayName="NamedInput";const Wt=a=>a===null?"":a.toString(),Uo=n.memo(n.forwardRef((a,i)=>{const{formName:o,formOptions:t,disabled:r,style:s,className:d,sx:m,onKeyDown:l,value:c,onChangeInput:u,resolvedAddress:C,...x}=a,f=Ja(),p=o&&f?f.register(o,t):null,[b,S]=n.useState(""),[h,g]=n.useState(!1),[k,j]=n.useState(()=>Wt(c));n.useEffect(()=>{j(Wt(c)),S(""),o&&f&&f.clearErrors(o),g(!1)},[c]);const v=w.useCallbackRef(P=>{let I="";try{j(P);const z=Wt(c),N=C(P);N.toString()!==z&&u?.(N)}catch{I="Invalid Range"}o&&f&&(I?f.setError(o,{message:I}):f.clearErrors(o)),S(I),g(!0)},[k,u,o,f]),T=w.useCallbackRef(async P=>{if(h&&P.keyCode===w.KeyCodes.Escape){const I=Wt(c);j(I),S(""),g(!1),P.stopPropagation()}l?.(P)},[c,u,l,h]),M=w.useCallbackRef(P=>{p?.onBlur(P)},[p]),R=n.useCallback(P=>{v(P.target.value),p?.onChange(P)},[p]),[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:P=>{F(P)},label:"Select Range",icon:e.jsx(w.DynamicIcon,{iconKey:"SelectRangeMode"})})}),[D]);return e.jsx(B.FormControl,{sx:{paddingTop:P=>P.spacing(1.5),minWidth:135,width:"100%",...m},size:"small",ref:i,className:ie("range-input",d),...x,children:e.jsx(B.TextField,{label:"Range",placeholder:"Enter Range",onBlur:M,disabled:r,error:!!b,inputRef:p?.ref,helperText:b||" ",sx:{"& .MuiFormHelperText-root":{marginTop:P=>P.spacing(.5)}},slotProps:{input:{endAdornment:E},inputLabel:{shrink:!0},htmlInput:{spellCheck:!1,autoComplete:"off",readOnly:r,name:o,sx:{paddingTop:P=>P.spacing(1.25),paddingBottom:P=>P.spacing(.75)}}},value:k??"",onChange:R,onKeyDownCapture:T,onContextMenu:P=>{P.stopPropagation()}})})}));Uo.displayName="RangeInput";const Ee=[];Ee.push(Pe("Primary Background","bg1")),Ee.push(Pe("Primary Text","tx1")),Ee.push(Pe("Secondary Background","bg2")),Ee.push(Pe("Secondary Text","tx2")),Ee.push(Pe("Accent 1","accent1")),Ee.push(Pe("Accent 2","accent2")),Ee.push(Pe("Accent 3","accent3")),Ee.push(Pe("Accent 4","accent4")),Ee.push(Pe("Accent 5","accent5")),Ee.push(Pe("Accent 6","accent6"));const er=a=>{const{docTheme:i,onSelectTheme:o,darkMode:t,isSelected:r,outlined:s,sx:d,...m}=a,l=q.useTheme(),c=n.useMemo(()=>{let u=[];for(let C=0;C<Ee.length;C++){const x=Ee[C];u.push(e.jsx(io,{schemeColorLookup:i.schemeLookup(),colorDef:x,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:u})})},[i,l]);return e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:u=>`solid ${r?u.palette.text.primary:"transparent"} 1px`,"&:hover:not([disabled])":{border:u=>`solid ${u.palette.text.primary} 1px !important`}},icon:null,...m,children:e.jsxs(B.Box,{sx:{border:u=>`solid ${u.palette.divider} 1px`,minWidth:"200px",borderRadius:"2px",padding:"4px 4px",textAlign:"left",display:"flex",gap:"4px",flexDirection:"column",alignItems:"stretch",color:u=>r?u.palette.text.primary:void 0,"&:hover:not([disabled])":{color:u=>u.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()})})})]})]})})},tr=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,sx:s,disabled:d=!1,darkMode:m,...l}=a,c=n.useMemo(()=>{const u=o?.getItems({selected:t})??[],C=[];if(u.length===0)return e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"6px",paddingBottom:"6px"},children:"No themes"});const x=u.length;for(let f=0;f<x;f++){const p=u[f],b=t&&p?.getName()===t.getName(),S=u[f+1];S&&S.isCustom()!==p.isCustom()&&C.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${f}`)),C.push(e.jsx(er,{docTheme:p,onSelectTheme:()=>r(p),isSelected:b,disabled:d,darkMode:m,onMouseDown:h=>{h.button===0&&h.preventDefault()},onMouseUp:h=>{h.button===0&&r(p)},onKeyDown:h=>{h.keyCode!==w.KeyCodes.Enter&&h.keyCode!==w.KeyCodes.Space||r(p)}},p.getName()))}return C},[t,r,m]);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})]})})})),or=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,icon:s,tooltip:d,label:m,variant:l=y.PopupButtonType.Toolbar,darkMode:c,panelProps:u,...C}=a,x=s||e.jsx(w.DynamicIcon,{iconKey:"Theme2"}),f=n.useCallback(b=>{const{closeFloatAll:S}=b;return e.jsx(tr,{...u,themes:o,selectedTheme:t,onSelectTheme:r,darkMode:c,onKeyDown:h=>{h.which===w.KeyCodes.Enter&&S()}})},[o,t,r,u,c]),p={createPopupPanel:f,tooltip:d||m||"Theme",label:m,icon:x,...C};return l===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...p}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...p})})),qo=n.memo(n.forwardRef((a,i)=>{const{sheet:o,className:t,debounceDelay:r=220,sx:s,...d}=a,[m,l]=n.useState(()=>o.getView().getZoomScale()),[c,u]=n.useState(null),C=n.useRef(0);oe.useModelListener(o,{onViewChange:()=>{u(!0),C.current===0&&l(o.getView().getZoomScale())}}),n.useEffect(()=>{C.current=0,u(!1),l(o.getView().getZoomScale())},[o]),n.useEffect(()=>{C.current!==0&&A.CommonUtils.debounce(()=>{m===C.current&&(C.current=0,o.getView().update({zoomScale:m}))},r)()},[m,r]);const x=w.useCallbackRef(M=>{let R=M;M<100?R=Math.round(M/(10/9)+10):M>100&&(R=Math.round(3*M-200)),C.current=R,u(!0),l(R)},[o]),f=M=>{let R=M;return M<100?R=10/9*(M-10):M>100&&(R=(M+200)/3),R},p=f(m),[b,S]=n.useState(null),h=n.useRef(null),g=n.useCallback(()=>{const M=b;M&&requestAnimationFrame(()=>{h.current?.contains(document.activeElement)&&M.focus()})},[]),k=w.useMouseDownAndHoldListener(()=>{x(f(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10)))}),j=w.useMouseDownAndHoldListener(()=>x(f(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&&!h?.current?.contains(M.relatedTarget)&&S(null)},onMouseDown:M=>{M.button===0&&M.preventDefault()},onMouseUp:M=>{M.button===0&&g()},...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:h,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:p,max:200,marks:[{value:100}],onAnimationEnd:()=>u(!1),onWheel:M=>{x(f(A.CommonUtils.findNextStep(o.getView().getZoomScale(),M.deltaY<0,10)))},onKeyDown:M=>{M.which===w.KeyCodes.Down||M.which===w.KeyCodes.Right?(x(f(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10))),M.preventDefault()):M.which===w.KeyCodes.Up||M.which===w.KeyCodes.Left?(x(f(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10))),M.preventDefault()):M.which!==w.KeyCodes.Enter&&M.which!==w.KeyCodes.Escape||g()},onChange:(M,R)=>{Math.abs(R-100)<3?x(100):x(R)},valueLabelFormat:(M,R)=>`Zoom: ${Math.round(m)}%`}),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:()=>{x(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(m)+"%"})})]})]})}));qo.displayName="SheetZoomScale";const Go=n.memo(n.forwardRef((a,i)=>{const{sx:o,sheet:t,gridStyle:r,children:s,childrenEnd:d,...m}=a;n.useImperativeHandle(i,()=>({}));const l=n.useRef(null);n.useEffect(()=>{const f=p=>p.preventDefault();return l.current?.addEventListener("wheel",f,{passive:!1}),()=>{l.current?.removeEventListener("wheel",f)}},[]);const c=w.useEditMode(),u=n.useMemo(()=>{const f=c.getMode();return f?.description?f.description:"Ready"},[c]),[C,x]=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:()=>x(!0),onMouseLeave:()=>x(!1),...m,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:f=>f.palette.text.secondary},variant:"caption",children:u})}),d?e.jsx(B.Box,{sx:{display:"flex",alignItems:"center"},children:d}):null,e.jsx(y.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(qo,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));Go.displayName="StatusBar";var Mn,Dn,yo,Fn,In,$t={exports:{}},wt={},kt={exports:{}},Nn={},On={exports:{}};function Gi(){return Dn?Mn:(Dn=1,Mn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function Xi(){if(Fn)return yo;Fn=1;var a=Gi();function i(){}function o(){}return o.resetWarningCache=i,yo=function(){function t(d,m,l,c,u,C){if(C!==a){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}}function 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 Nt(){return In||(In=1,On.exports=Xi()()),On.exports}var An,Vt={exports:{}},Ln,xe={},ze={};function lo(){return Ln||(Ln=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 zn,Hn,He={};function Xo(){if(Hn)return xe;Hn=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.addClassName=d,xe.addEvent=function(l,c,u,C){if(!l)return;const x={capture:!0,...C};l.addEventListener?l.addEventListener(c,u,x):l.attachEvent?l.attachEvent("on"+c,u):l["on"+c]=u},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
- `,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 u=r(l,c,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:u}},xe.createSVGTransform=function(l,c){return r(l,c,"")},xe.getTouch=function(l,c){return l.targetTouches&&(0,a.findInArray)(l.targetTouches,u=>c===u.identifier)||l.changedTouches&&(0,a.findInArray)(l.changedTouches,u=>c===u.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 u=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(u.paddingTop),c-=(0,a.int)(u.paddingBottom),c},xe.innerWidth=function(l){let c=l.clientWidth;const u=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(u.paddingLeft),c-=(0,a.int)(u.paddingRight),c},xe.matchesSelector=t,xe.matchesSelectorAndParentsTo=function(l,c,u){let C=l;do{if(t(C,c))return!0;if(C===u)return!1;C=C.parentNode}while(C);return!1},xe.offsetXYFromParent=function(l,c,u){const C=c===c.ownerDocument.body?{left:0,top:0}:c.getBoundingClientRect(),x=(l.clientX+c.scrollLeft-C.left)/u,f=(l.clientY+c.scrollTop-C.top)/u;return{x,y:f}},xe.outerHeight=function(l){let c=l.clientHeight;const u=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(u.borderTopWidth),c+=(0,a.int)(u.borderBottomWidth),c},xe.outerWidth=function(l){let c=l.clientWidth;const u=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(u.borderLeftWidth),c+=(0,a.int)(u.borderRightWidth),c},xe.removeClassName=m,xe.removeEvent=function(l,c,u,C){if(!l)return;const x={capture:!0,...C};l.removeEventListener?l.removeEventListener(c,u,x):l.detachEvent?l.detachEvent("on"+c,u):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 u=new WeakMap,C=new WeakMap;return(function(x,f){if(!f&&x&&x.__esModule)return x;var p,b,S={__proto__:null,default:x};if(x===null||typeof x!="object"&&typeof x!="function")return S;if(p=f?C:u){if(p.has(x))return p.get(x);p.set(x,S)}for(const h in x)h!=="default"&&{}.hasOwnProperty.call(x,h)&&((b=(p=Object.defineProperty)&&Object.getOwnPropertyDescriptor(x,h))&&(b.get||b.set)?p(S,h,b):S[h]=x[h]);return S})(l,c)})((function(){if(zn)return He;zn=1,Object.defineProperty(He,"__esModule",{value:!0}),He.browserPrefixToKey=u,He.browserPrefixToStyle=function(C,x){return x?`-${x.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 x=window.document?.documentElement?.style;if(!x||C in x)return"";for(let f=0;f<l.length;f++)if(u(C,l[f])in x)return l[f];return""}function u(C,x){return x?`${x}${(function(f){let p="",b=!0;for(let S=0;S<f.length;S++)b?(p+=f[S].toUpperCase(),b=!1):f[S]==="-"?b=!0:p+=f[S];return p})(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(u){return(0,a.isFunction)(l[u])})),!!(0,a.isFunction)(l[o])&&l[o](c)}function r(l,c,u){let{x:C,y:x}=l,f=`translate(${C}${u},${x}${u})`;return c&&(f=`translate(${`${typeof c.x=="string"?c.x:c.x+u}`}, ${`${typeof c.y=="string"?c.y:c.y+u}`})`+f),f}function s(l){if(l)try{if(l.body&&m(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 m(l,c){l.classList?l.classList.remove(c):l.className=l.className.replace(new RegExp(`(?:^|\\s)${c}(?!\\S)`,"g"),"")}return xe}var Wn,De={};function nr(){if(Wn)return De;Wn=1,Object.defineProperty(De,"__esModule",{value:!0}),De.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},De.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},De.createCoreData=function(t,r,s){const d=!(0,a.isNum)(t.lastX),m=o(t);return d?{node:m,deltaX:0,deltaY:0,lastX:r,lastY:s,x:r,y:s}:{node:m,deltaX:r-t.lastX,deltaY:s-t.lastY,lastX:t.lastX,lastY:t.lastY,x:r,y:s}},De.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}},De.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 m=o(t);if(typeof d=="string"){const{ownerDocument:l}=m,c=l.defaultView;let u;if(d==="parent"?u=m.parentNode:u=m.getRootNode().querySelector(d),!(u instanceof c.HTMLElement))throw new Error('Bounds selector "'+d+'" could not find an element.');const C=u,x=c.getComputedStyle(m),f=c.getComputedStyle(C);d={left:-m.offsetLeft+(0,a.int)(f.paddingLeft)+(0,a.int)(x.marginLeft),top:-m.offsetTop+(0,a.int)(f.paddingTop)+(0,a.int)(x.marginTop),right:(0,i.innerWidth)(C)-(0,i.outerWidth)(m)-m.offsetLeft+(0,a.int)(f.paddingRight)-(0,a.int)(x.marginRight),bottom:(0,i.innerHeight)(C)-(0,i.outerHeight)(m)-m.offsetTop+(0,a.int)(f.paddingBottom)-(0,a.int)(x.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]},De.getControlPosition=function(t,r,s){const d=typeof r=="number"?(0,i.getTouch)(t,r):null;if(typeof r=="number"&&!d)return null;const m=o(s),l=s.props.offsetParent||m.offsetParent||m.ownerDocument.body;return(0,i.offsetXYFromParent)(d||t,l,s.props.scale)},De.snapToGrid=function(t,r,s){const d=Math.round(r/t[0])*t[0],m=Math.round(s/t[1])*t[1];return[d,m]};var a=lo(),i=Xo();function o(t){const r=t.findDOMNode();if(!r)throw new Error("<DraggableCore>: Unmounted during event!");return r}return De}var $n,Vn,_n,Kn,vt={},_t={};function ar(){return $n||($n=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.default=function(){}),_t}function Yi(){if(Vn)return vt;Vn=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var a=(function(f,p){if(typeof WeakMap=="function")var b=new WeakMap,S=new WeakMap;return(function(h,g){if(!g&&h&&h.__esModule)return h;var k,j,v={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return v;if(k=g?S:b){if(k.has(h))return k.get(h);k.set(h,v)}for(const T in h)T!=="default"&&{}.hasOwnProperty.call(h,T)&&((j=(k=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,T))&&(j.get||j.set)?k(v,T,j):v[T]=h[T]);return v})(f,p)})(n),i=m(Nt()),o=m(Je),t=Xo(),r=nr(),s=lo(),d=m(ar());function m(f){return f&&f.__esModule?f:{default:f}}function l(f,p,b){return(p=(function(S){var h=(function(g,k){if(typeof g!="object"||!g)return g;var j=g[Symbol.toPrimitive];if(j!==void 0){var v=j.call(g,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(g)})(S,"string");return typeof h=="symbol"?h:h+""})(p))in f?Object.defineProperty(f,p,{value:b,enumerable:!0,configurable:!0,writable:!0}):f[p]=b,f}const c={start:"touchstart",move:"touchmove",stop:"touchend"},u={start:"mousedown",move:"mousemove",stop:"mouseup"};let C=u,x=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",f=>{if(this.props.onMouseDown(f),!this.props.allowAnyClick&&typeof f.button=="number"&&f.button!==0)return!1;const p=this.findDOMNode();if(!p||!p.ownerDocument||!p.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:b}=p;if(this.props.disabled||!(f.target instanceof b.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(f.target,this.props.handle,p)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(f.target,this.props.cancel,p))return;f.type!=="touchstart"||this.props.allowMobileScroll||f.preventDefault();const S=(0,t.getTouchIdentifier)(f);this.touchIdentifier=S;const h=(0,r.getControlPosition)(f,S,this);if(h==null)return;const{x:g,y:k}=h,j=(0,r.createCoreData)(this,g,k);(0,d.default)("DraggableCore: handleDragStart: %j",j),(0,d.default)("calling",this.props.onStart),this.props.onStart(f,j)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(b),this.dragging=!0,this.lastX=g,this.lastY=k,(0,t.addEvent)(b,C.move,this.handleDrag),(0,t.addEvent)(b,C.stop,this.handleDragStop))}),l(this,"handleDrag",f=>{const p=(0,r.getControlPosition)(f,this.touchIdentifier,this);if(p==null)return;let{x:b,y:S}=p;if(Array.isArray(this.props.grid)){let g=b-this.lastX,k=S-this.lastY;if([g,k]=(0,r.snapToGrid)(this.props.grid,g,k),!g&&!k)return;b=this.lastX+g,S=this.lastY+k}const h=(0,r.createCoreData)(this,b,S);if((0,d.default)("DraggableCore: handleDrag: %j",h),this.props.onDrag(f,h)!==!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",f=>{if(!this.dragging)return;const p=(0,r.getControlPosition)(f,this.touchIdentifier,this);if(p==null)return;let{x:b,y:S}=p;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 h=(0,r.createCoreData)(this,b,S);if(this.props.onStop(f,h)===!1||this.mounted===!1)return!1;const g=this.findDOMNode();g&&this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(g.ownerDocument),(0,d.default)("DraggableCore: handleDragStop: %j",h),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,g&&((0,d.default)("DraggableCore: Removing handlers"),(0,t.removeEvent)(g.ownerDocument,C.move,this.handleDrag),(0,t.removeEvent)(g.ownerDocument,C.stop,this.handleDragStop))}),l(this,"onMouseDown",f=>(C=u,this.handleDragStart(f))),l(this,"onMouseUp",f=>(C=u,this.handleDragStop(f))),l(this,"onTouchStart",f=>(C=c,this.handleDragStart(f))),l(this,"onTouchEnd",f=>(C=c,this.handleDragStop(f)))}componentDidMount(){this.mounted=!0;const f=this.findDOMNode();f&&(0,t.addEvent)(f,c.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const f=this.findDOMNode();if(f){const{ownerDocument:p}=f;(0,t.removeEvent)(p,u.move,this.handleDrag),(0,t.removeEvent)(p,c.move,this.handleDrag),(0,t.removeEvent)(p,u.stop,this.handleDragStop),(0,t.removeEvent)(p,c.stop,this.handleDragStop),(0,t.removeEvent)(f,c.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(p)}}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=x,l(x,"displayName","DraggableCore"),l(x,"propTypes",{allowAnyClick:i.default.bool,allowMobileScroll:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:function(f,p){if(f[p]&&f[p].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(x,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),vt}function Zi(){return _n||(_n=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(p,b){if(typeof WeakMap=="function")var S=new WeakMap,h=new WeakMap;return(function(g,k){if(!k&&g&&g.__esModule)return g;var j,v,T={__proto__:null,default:g};if(g===null||typeof g!="object"&&typeof g!="function")return T;if(j=k?h:S){if(j.has(g))return j.get(g);j.set(g,T)}for(const M in g)M!=="default"&&{}.hasOwnProperty.call(g,M)&&((v=(j=Object.defineProperty)&&Object.getOwnPropertyDescriptor(g,M))&&(v.get||v.set)?j(T,M,v):T[M]=g[M]);return T})(p,b)})(n),o=u(Nt()),t=u(Je),r=(function(){if(An)return Vt.exports;function p(S){var h,g,k="";if(typeof S=="string"||typeof S=="number")k+=S;else if(typeof S=="object")if(Array.isArray(S)){var j=S.length;for(h=0;h<j;h++)S[h]&&(g=p(S[h]))&&(k&&(k+=" "),k+=g)}else for(g in S)S[g]&&(k&&(k+=" "),k+=g);return k}function b(){for(var S,h,g=0,k="",j=arguments.length;g<j;g++)(S=arguments[g])&&(h=p(S))&&(k&&(k+=" "),k+=h);return k}return An=1,Vt.exports=b,Vt.exports.clsx=b,Vt.exports})(),s=Xo(),d=nr(),m=lo(),l=u(Yi()),c=u(ar());function u(p){return p&&p.__esModule?p:{default:p}}function C(){return C=Object.assign?Object.assign.bind():function(p){for(var b=1;b<arguments.length;b++){var S=arguments[b];for(var h in S)({}).hasOwnProperty.call(S,h)&&(p[h]=S[h])}return p},C.apply(null,arguments)}function x(p,b,S){return(b=(function(h){var g=(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)})(h,"string");return typeof g=="symbol"?g:g+""})(b))in p?Object.defineProperty(p,b,{value:S,enumerable:!0,configurable:!0,writable:!0}):p[b]=S,p}class f extends i.Component{static getDerivedStateFromProps(b,S){let{position:h}=b,{prevPropsPosition:g}=S;return!h||g&&h.x===g.x&&h.y===g.y?null:((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:h,prevPropsPosition:g}),{x:h.x,y:h.y,prevPropsPosition:{...h}})}constructor(b){super(b),x(this,"onDragStart",(S,h)=>{if((0,c.default)("Draggable: onDragStart: %j",h),this.props.onStart(S,(0,d.createDraggableData)(this,h))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),x(this,"onDrag",(S,h)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",h);const g=(0,d.createDraggableData)(this,h),k={x:g.x,y:g.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),g.x=k.x,g.y=k.y,g.deltaX=k.x-this.state.x,g.deltaY=k.y-this.state.y}if(this.props.onDrag(S,g)===!1)return!1;this.setState(k)}),x(this,"onDragStop",(S,h)=>{if(!this.state.dragging||this.props.onStop(S,(0,d.createDraggableData)(this,h))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",h);const g={dragging:!1,slackX:0,slackY:0};if(this.props.position){const{x:k,y:j}=this.props.position;g.x=k,g.y=j}this.setState(g)}),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:h,defaultPosition:g,defaultClassName:k,defaultClassNameDragging:j,defaultClassNameDragged:v,position:T,positionOffset:M,scale:R,...D}=this.props;let F={},E=null;const P=!T||this.state.dragging,I=T||g,z={x:(0,d.canDragX)(this)&&P?this.state.x:I.x,y:(0,d.canDragY)(this)&&P?this.state.y:I.y};this.state.isElementSVG?E=(0,s.createSVGTransform)(z,M):F=(0,s.createCSSTransform)(z,M);const N=(0,r.clsx)(h.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(h),{className:N,style:{...h.props.style,...F},transform:E}))}}a.default=f,x(f,"displayName","Draggable"),x(f,"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:m.dontSetMe,style:m.dontSetMe,transform:m.dontSetMe}),x(f,"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})})(Nn)),Nn}function rr(){if(Kn)return kt.exports;Kn=1;const{default:a,DraggableCore:i}=Zi();return kt.exports=a,kt.exports.default=a,kt.exports.DraggableCore=i,kt.exports}var Un,Kt={};function Qi(){if(Un)return Kt;Un=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 m=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);d&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),m.push.apply(m,l)}return m}function t(s){for(var d=1;d<arguments.length;d++){var m=arguments[d]!=null?arguments[d]:{};d%2?o(Object(m),!0).forEach(function(l){r(s,l,m[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(m)):o(Object(m)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(m,l))})}return s}function r(s,d,m){return(d=(function(l){var c=(function(u,C){if(typeof u!="object"||u===null)return u;var x=u[Symbol.toPrimitive];if(x!==void 0){var f=x.call(u,C);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(u)})(l,"string");return typeof c=="symbol"?c:String(c)})(d))in s?Object.defineProperty(s,d,{value:m,enumerable:!0,configurable:!0,writable:!0}):s[d]=m,s}return Kt}var qn,Gn,jt={};function ir(){if(qn)return jt;qn=1,jt.__esModule=!0,jt.resizableProps=void 0;var a,i=(a=Nt())&&a.__esModule?a:{default:a};rr();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,m=r[0];return m.axis==="both"||m.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,m=r[0];return m.axis==="both"||m.axis==="x"?(d=i.default.number).isRequired.apply(d,r):i.default.number.apply(i.default,r)}};return jt.resizableProps=o,jt}function lr(){if(Gn)return wt;Gn=1,wt.__esModule=!0,wt.default=void 0;var a=(function(x,f){if(x&&x.__esModule)return x;if(x===null||typeof x!="object"&&typeof x!="function")return{default:x};var p=s(f);if(p&&p.has(x))return p.get(x);var b={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in x)if(h!=="default"&&Object.prototype.hasOwnProperty.call(x,h)){var g=S?Object.getOwnPropertyDescriptor(x,h):null;g&&(g.get||g.set)?Object.defineProperty(b,h,g):b[h]=x[h]}return b.default=x,p&&p.set(x,b),b})(n),i=rr(),o=Qi(),t=ir(),r=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(x){if(typeof WeakMap!="function")return null;var f=new WeakMap,p=new WeakMap;return(s=function(b){return b?p:f})(x)}function d(){return d=Object.assign?Object.assign.bind():function(x){for(var f=1;f<arguments.length;f++){var p=arguments[f];for(var b in p)Object.prototype.hasOwnProperty.call(p,b)&&(x[b]=p[b])}return x},d.apply(this,arguments)}function m(x,f){var p=Object.keys(x);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(x);f&&(b=b.filter(function(S){return Object.getOwnPropertyDescriptor(x,S).enumerable})),p.push.apply(p,b)}return p}function l(x){for(var f=1;f<arguments.length;f++){var p=arguments[f]!=null?arguments[f]:{};f%2?m(Object(p),!0).forEach(function(b){c(x,b,p[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(p)):m(Object(p)).forEach(function(b){Object.defineProperty(x,b,Object.getOwnPropertyDescriptor(p,b))})}return x}function c(x,f,p){return(f=(function(b){var S=(function(h,g){if(typeof h!="object"||h===null)return h;var k=h[Symbol.toPrimitive];if(k!==void 0){var j=k.call(h,g);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(g==="string"?String:Number)(h)})(b,"string");return typeof S=="symbol"?S:String(S)})(f))in x?Object.defineProperty(x,f,{value:p,enumerable:!0,configurable:!0,writable:!0}):x[f]=p,x}function u(x,f){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(p,b){return p.__proto__=b,p},u(x,f)}var C=(function(x){var f,p;function b(){for(var h,g=arguments.length,k=new Array(g),j=0;j<g;j++)k[j]=arguments[j];return(h=x.call.apply(x,[this].concat(k))||this).handleRefs={},h.lastHandleRect=null,h.slack=null,h}p=x,(f=b).prototype=Object.create(p.prototype),f.prototype.constructor=f,u(f,p);var S=b.prototype;return S.componentWillUnmount=function(){this.resetData()},S.resetData=function(){this.lastHandleRect=this.slack=null},S.runConstraints=function(h,g){var k=this.props,j=k.minConstraints,v=k.maxConstraints,T=k.lockAspectRatio;if(!j&&!v&&!T)return[h,g];if(T){var M=this.props.width/this.props.height,R=h-this.props.width,D=g-this.props.height;Math.abs(R)>Math.abs(D*M)?g=h/M:h=g*M}var F=h,E=g,P=this.slack||[0,0],I=P[0],z=P[1];return h+=I,g+=z,j&&(h=Math.max(j[0],h),g=Math.max(j[1],g)),v&&(h=Math.min(v[0],h),g=Math.min(v[1],g)),this.slack=[I+(F-h),z+(E-g)],[h,g]},S.resizeHandler=function(h,g){var k=this;return function(j,v){var T=v.node,M=v.deltaX,R=v.deltaY;h==="onResizeStart"&&k.resetData();var D=(k.props.axis==="both"||k.props.axis==="x")&&g!=="n"&&g!=="s",F=(k.props.axis==="both"||k.props.axis==="y")&&g!=="e"&&g!=="w";if(D||F){var E=g[0],P=g[g.length-1],I=T.getBoundingClientRect();k.lastHandleRect!=null&&(P==="w"&&(M+=I.left-k.lastHandleRect.left),E==="n"&&(R+=I.top-k.lastHandleRect.top)),k.lastHandleRect=I,P==="w"&&(M=-M),E==="n"&&(R=-R);var z=k.props.width+(D?M/k.props.transformScale:0),N=k.props.height+(F?R/k.props.transformScale:0),H=k.runConstraints(z,N);z=H[0],N=H[1];var O=z!==k.props.width||N!==k.props.height,W=typeof k.props[h]=="function"?k.props[h]:null;W&&!(h==="onResize"&&!O)&&(j.persist==null||j.persist(),W(j,{node:T,size:{width:z,height:N},handle:g})),h==="onResizeStop"&&k.resetData()}}},S.renderResizeHandle=function(h,g){var k=this.props.handle;if(!k)return a.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+h,ref:g});if(typeof k=="function")return k(h,g);var j=l({ref:g},typeof k.type=="string"?{}:{handleAxis:h});return a.cloneElement(k,j)},S.render=function(){var h=this,g=this.props,k=g.children,j=g.className,v=g.draggableOpts;g.width,g.height,g.handle,g.handleSize,g.lockAspectRatio,g.axis,g.minConstraints,g.maxConstraints,g.onResize,g.onResizeStop,g.onResizeStart;var T=g.resizeHandles;g.transformScale;var M=(function(R,D){if(R==null)return{};var F,E,P={},I=Object.keys(R);for(E=0;E<I.length;E++)F=I[E],D.indexOf(F)>=0||(P[F]=R[F]);return P})(g,r);return(0,o.cloneElement)(k,l(l({},M),{},{className:(j?j+" ":"")+"react-resizable",children:[].concat(k.props.children,T.map(function(R){var D,F=(D=h.handleRefs[R])!=null?D:h.handleRefs[R]=a.createRef();return a.createElement(i.DraggableCore,d({},v,{nodeRef:F,key:"resizableHandle-"+R,onStop:h.resizeHandler("onResizeStop",R),onStart:h.resizeHandler("onResizeStart",R),onDrag:h.resizeHandler("onResize",R)}),h.renderResizeHandle(R,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 Xn,Yn,Tt={};function Ji(){if(Xn)return Tt;Xn=1,Tt.__esModule=!0,Tt.default=void 0;var a=(function(f,p){if(f&&f.__esModule)return f;if(f===null||typeof f!="object"&&typeof f!="function")return{default:f};var b=d(p);if(b&&b.has(f))return b.get(f);var S={},h=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in f)if(g!=="default"&&Object.prototype.hasOwnProperty.call(f,g)){var k=h?Object.getOwnPropertyDescriptor(f,g):null;k&&(k.get||k.set)?Object.defineProperty(S,g,k):S[g]=f[g]}return S.default=f,b&&b.set(f,S),S})(n),i=s(Nt()),o=s(lr()),t=ir(),r=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function s(f){return f&&f.__esModule?f:{default:f}}function d(f){if(typeof WeakMap!="function")return null;var p=new WeakMap,b=new WeakMap;return(d=function(S){return S?b:p})(f)}function m(){return m=Object.assign?Object.assign.bind():function(f){for(var p=1;p<arguments.length;p++){var b=arguments[p];for(var S in b)Object.prototype.hasOwnProperty.call(b,S)&&(f[S]=b[S])}return f},m.apply(this,arguments)}function l(f,p){var b=Object.keys(f);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(f);p&&(S=S.filter(function(h){return Object.getOwnPropertyDescriptor(f,h).enumerable})),b.push.apply(b,S)}return b}function c(f){for(var p=1;p<arguments.length;p++){var b=arguments[p]!=null?arguments[p]:{};p%2?l(Object(b),!0).forEach(function(S){u(f,S,b[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(b)):l(Object(b)).forEach(function(S){Object.defineProperty(f,S,Object.getOwnPropertyDescriptor(b,S))})}return f}function u(f,p,b){return(p=(function(S){var h=(function(g,k){if(typeof g!="object"||g===null)return g;var j=g[Symbol.toPrimitive];if(j!==void 0){var v=j.call(g,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(g)})(S,"string");return typeof h=="symbol"?h:String(h)})(p))in f?Object.defineProperty(f,p,{value:b,enumerable:!0,configurable:!0,writable:!0}):f[p]=b,f}function C(f,p){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,S){return b.__proto__=S,b},C(f,p)}var x=(function(f){var p,b;function S(){for(var h,g=arguments.length,k=new Array(g),j=0;j<g;j++)k[j]=arguments[j];return(h=f.call.apply(f,[this].concat(k))||this).state={width:h.props.width,height:h.props.height,propsWidth:h.props.width,propsHeight:h.props.height},h.onResize=function(v,T){var M=T.size;h.props.onResize?(v.persist==null||v.persist(),h.setState(M,function(){return h.props.onResize&&h.props.onResize(v,T)})):h.setState(M)},h}return b=f,(p=S).prototype=Object.create(b.prototype),p.prototype.constructor=p,C(p,b),S.getDerivedStateFromProps=function(h,g){return g.propsWidth!==h.width||g.propsHeight!==h.height?{width:h.width,height:h.height,propsWidth:h.width,propsHeight:h.height}:null},S.prototype.render=function(){var h=this.props,g=h.handle,k=h.handleSize;h.onResize;var j=h.onResizeStart,v=h.onResizeStop,T=h.draggableOpts,M=h.minConstraints,R=h.maxConstraints,D=h.lockAspectRatio,F=h.axis;h.width,h.height;var E=h.resizeHandles,P=h.style,I=h.transformScale,z=(function(N,H){if(N==null)return{};var O,W,ee={},X=Object.keys(N);for(W=0;W<X.length;W++)O=X[W],H.indexOf(O)>=0||(ee[O]=N[O]);return ee})(h,r);return a.createElement(o.default,{axis:F,draggableOpts:T,handle:g,handleSize:k,height:this.state.height,lockAspectRatio:D,maxConstraints:R,minConstraints:M,onResizeStart:j,onResize:this.onResize,onResizeStop:v,resizeHandles:E,transformScale:I,width:this.state.width},a.createElement("div",m({},z,{style:c(c({},P),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},S})(a.Component);return Tt.default=x,x.propTypes=c(c({},t.resizableProps),{},{children:i.default.element}),Tt}var el=(Yn||(Yn=1,$t.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},$t.exports.Resizable=lr().default,$t.exports.ResizableBox=Ji().default),$t.exports);const Yo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,names:t,workbook:r,restoreFocus:s,readonly:d=!1,disabled:m=!1,commandPopupButtonProps:l,sx:c,...u}=a,C=w.useNotifier(),[x,f]=n.useState(null),[p,b]=n.useState(()=>r.getSelectedRanges().getCoords()),[S,h]=n.useState(!1),{reference:g}=y.useFloatStack({parentFloat:l?.parentFloat}),[k,j]=n.useState(()=>d||!r.getProtection().isStructureAllowed()),v=()=>x?.text??"",[T,M]=n.useState(v),R=w.useCallbackRef(()=>{if(g?.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)),_&&f({text:_.getName()})}catch(_){M(v()),C.showMessage?.(_.message,{type:w.NotifierType.Error})}return null},[T,t,g,k,C]),D=w.useCallbackRef(()=>{if(r.isClosed())return;const $=[];for(let _=0;_<p.length;_++){const L=p[_];$.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(),f({text:Y})},[r,p]),[F,E]=n.useState(()=>t?.getItems()??null);oe.useModelListener(t,{onCollectionChange($){E(t.getItems()),D()},onClose($){E([])}}),n.useEffect(()=>{M(v())},[x,p]);const[P,I]=n.useState(r?.getSelectedSheet());oe.useModelListener(r,{onProtectionChange:$=>{j(d||!$.getProtection().isStructureAllowed())},onSheetsChange:$=>{I($?.getSelectedSheet())},onViewChange($){I($?.getSelectedSheet())}});const[z,N]=n.useState(null),H=w.useCallbackRef(A.CommonUtils.debounce(D,z?320:0),[]);oe.useModelListener(P.getSelection(),{onChange:()=>{b($=>{const U=r.getSelectedRanges().getCoords();return A.CoordUtils.isEqualRangesArrays(U,$)?$:U})},onAdjustingChange:$=>{N($.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 f({text:_,fontStyle:"italic",justifyContent:"center"})}f({text:r.getSelectedSheet().getSelectedRange().toString()}),H()},[p,r,z]);const O=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:O},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:x?.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=R()),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,x]),ee=w.useCallbackRef(async $=>{try{g?.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(()=>{h(!0)},0);const U={variant:w.CommandButtonType.Menuitem,parentFloat:$.floatReference,commandHook:{...l?.commandHook,beforeExecute:(re,pe)=>(g?.closeAll(),l?.commandHook?.beforeExecute?.(re,pe))},scope:l?.scope,commands:l?.commands};let Y=t.getItems({scope:r?.getSelectedSheet().getName()});Y=Y.sort((re,pe)=>re.getType()===pe.getType()?re.getName().localeCompare(pe.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 pe=Y[re],Ce=pe.getRanges();if(!Ce||pe.isHidden())continue;const be=pe.getType();be!==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:pe.getType()==="reference"?"Ranges":"Tables"},`type-header-${G.length}`))),be==="reference"?G.push(n.createElement(y.SimpleCommandPopupButton,{...U,key:"named-"+G.length,popupCommandKeys:_,popupScope:"namedItem",scope:"namedItem",commandState:pe,commands:l?.commands,label:pe.getName(),quickCommand:"selectNamed",disabled:!pe.getRanges()||m,icon:"NamedRange"})):be==="table"&&G.push(n.createElement(y.SimpleCommandPopupButton,{...U,key:"namedItem-"+G.length,popupCommandKeys:L,popupScope:"namedItem",scope:"namedItem",commands:l?.commands,commandState:pe,label:pe.getName(),quickCommand:"selectNamed",disabled:!Ce||m,icon:"InsertTable"}))}const he=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...u,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:he})},[r,F,t,x,k]),ae=w.useImperativeElement(i,()=>({focus($){O.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([ae,i]),...u,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:g,createPopupPanel:X,onPopupOpen:()=>h(!0),onPopupClose:()=>h(!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})})}));Yo.displayName="NamedCollectionEditor";const tl=(a,i)=>e.jsx(Yo,{ref:i,...a}),Zo=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,sheetElement:r,gridStyle:s,showNamedCollectionEditor:d=!0,NamedCollectionEditorProps:m,renderNamedCollectionEditor:l=tl,disabled:c,commands:u,...C}=a,[x,f]=n.useState(t?.getSelectedSheet());oe.useModelListener(t,{onSheetsChange:L=>{f(L?.getSelectedSheet())},onViewChange(L){f(L?.getSelectedSheet())}});const[p,b]=n.useState(x.getSelection().getCoords().cell),S=x.getRange(p).getCell(),h=c||!S.isEditAllowed(),g=n.useRef(null),k=n.useMemo(()=>({fontSize:11}),[]);oe.useModelListener(x.getSelection(),{onChange:()=>{b(x.getSelection().getCoords().cell)}}),oe.useModelListener(x,{onProtectionChange(){b(x.getSelection().getCoords().cell)}});const j=g.current?.getLineHeight()??20,[v,T]=n.useState(j),[M,R]=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&&R(Q)},[j]),P=w.useCallbackRef((L,{size:G})=>{const Q=Math.floor(G.height/j);F(Q)},[j]),I=w.useEditMode(),z=I.getMode();let N=null;z?.key==="edit"&&(N=z.args?.stateAndCoords);const H=n.useMemo(()=>{let L=N?.editState;return L||(L=oe.createCellEditStateFromCell(()=>x.getRange(p).getCell())),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(oe.SheetCellEditor,{ref:g,activeCoords:p,sheet:x,onFocus:()=>{r?.startEdit({autoFocus:!1,editMode:!0,cell:p})},defaultTextStyle:k,useRichStyling:!1,disabled:h,onChangeEdit:G=>{if(G.dirty!==void 0){const Q={sheet:x,coords:p,editState:G};I.setMode(he=>({...he,args:{...he?.args,stateAndCoords:Q}}))}},editState:L,commands:u,onCancelEdit:()=>{r?.cancelEdit(),r?.focus()},onSubmitEdit:()=>{r?.submitEdit(),r?.focus()},linesVisible:D})})},[x,N,p,D,r]),O=n.useRef(null),W=n.useMemo(()=>d?l({names:t.getNames(),workbook:t,...m},O):null,[l,m,d,x,t,h]),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 ${h?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:h||N===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:h||N===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()}})]}),[h,N]),X=q.useTheme(),[ae,$]=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 ${h?L.palette.action.disabled:q.alpha(L.palette.divider,.2)} 1px`,"& textarea":{color:L=>h?`${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:"-1px",paddingLeft:L=>L.spacing(1),paddingRight:L=>L.spacing(1)},children:e.jsx(el.ResizableBox,{height:v,draggableOpts:{grid:[j,j]},minConstraints:[j,j],maxConstraints:[15*j,15*j],onResize:P,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:ae?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:L=>L.palette.primary.main,borderRadius:L=>`${L.shape.borderRadius}px`}})]})]}),[ee,H,ae,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:()=>O.current}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:L=>L.spacing(.5),...o},ref:_,...C,children:Y})}));Zo.displayName="FormulaBar";const Qo=n.memo(n.forwardRef((a,i)=>{const{filter:o,commands:t,disabled:r,sx:s,floatReference:d,...m}=a,l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(x,f)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),u=n.useMemo(()=>({...l,...c,variant:w.CommandButtonType.Menuitem}),[l,c]),C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:t.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...u,command:t.getCommand("sortDescending")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:t.getCommand("autoFilterClear")}),[]]});return e.jsx(B.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...s},...m,children:C})}));Qo.displayName="FilterColumnMenu";const sr=n.memo(n.forwardRef((a,i)=>{const{children:o,className:t,disabled:r,style:s,filter:d,...m}=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},...m,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"})]})})}));sr.displayName="Filters";const Jo=n.memo(n.forwardRef((a,i)=>{const{children:o,sheet:t,style:r,className:s,value:d,index:m,editing:l,editable:c,disabled:u,selectedIndex:C,dragging:x,borderColor:f,borderWidth:p,activeColor:b,background:S="white",tabRadius:h=4,gridTheme:g,...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 R=q.useTheme(),D=C===m;let F=null,E=null;if(T||x){let z=S;T?(E=T.toBlackOrWhite().toCSS(),z=T?.toCSS()):D||(z=R.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:N=>D?`${S} solid 1px`:`${N.palette.divider} solid 1px`,background:D&&T?`linear-gradient(0deg, ${z} 0%, transparent)`:z}})}let P=null;typeof f=="string"?P=f:f?.toCSS&&(P=f.toCSS());const I=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?g??R:R,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:x?"grabbing":void 0},...k,children:e.jsx(w.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:h,strokeColor:D?P:"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:x?"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:u,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,I]}),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+":"+m)})})})}));Jo.displayName="SheetTab";const en=n.memo(n.forwardRef((a,i)=>{const{workbook:o,index:t,commands:r,scope:s="sheet",disabled:d,floatReference:m,sx:l,className:c,tabStripRef:u,...C}=a,[x,f]=n.useState(o?.getProtection());oe.useModelListener(o,{onProtectionChange:g=>{f(g?.getProtection())}});const p=n.useMemo(()=>({}),[]),b=n.useMemo(()=>({commandHook:{beforeExecute:(g,k)=>m.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:s,commandState:t,disabled:d||t===void 0,parentFloat:m}),[d,m]),S=n.useMemo(()=>({...p,...b}),[p,b]),h=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:g=>{g.button===0&&g.preventDefault()},onMouseUp:()=>{Promise.resolve(m.closeAll()).then(()=>{u?.startEdit(t)})},disabled:d||!x.isStructureAllowed(),parentFloat:m,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:m}),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:h})}));en.displayName="SheetTabMenu";const tn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,gridStyle:t,floatReference:r,closeFloatAll:s,className:d,...m}=a,[l,c]=n.useState(o?.getSheets().getItems()),[u,C]=n.useState(o?.getProtection());oe.useModelListener(o,{onSheetsChange:f=>{c(f.getSheets().getItems())},onProtectionChange:f=>{C(f?.getProtection())}});const x=n.useMemo(()=>{const f=[],p=o.getSheets().getItems({visibility:A.ISheet.Visibility.Hidden}),b=o.getSelectedSheet();for(let S=0;S<p.length;S++){const h=p[S],g=h.getVisibility();if(g===A.ISheet.Visibility.VeryHidden)continue;const k=b===h,j=h.getProtection().isLocked(),v=h.getTabColor(),T=t?.body.fill??"transparent";let M=null,R=null,D=T;v&&(D=v.toCSS(),k||(R=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||g===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"})),g!==A.ISheet.Visibility.Visible&&(F=e.jsx(w.DynamicIcon,{iconKey:"VisibilityOff",style:{opacity:u.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})),f.push(e.jsx(y.ExhibitMenuItem,{disabled:!u.isStructureAllowed()&&g===A.ISheet.Visibility.Hidden,sx:{color:E=>{let P=k?E.palette.primary.main:E.palette.text.secondary;return R&&(P=R),g===A.ISheet.Visibility.Hidden&&(P=Be.alpha(P,E.palette.action.disabledOpacity)),P},borderLeft:E=>`${k?E.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"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{h.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:[h.getName(),e.jsx(B.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:h.getName()})]}),F]})]})},""+S))}return f},[o,u,l,r,t]);return e.jsx(B.Box,{ref:i,className:ie("menu",d),...m,children:x})}));tn.displayName="SheetsAllMenu";let Ut=!1,cr=!1,Ge=null;const Zn=async a=>{const i=await A.LicenseManager.getDetails();if(cr||i.isEval()){try{const o=top??window;o.SheetXL||(o.SheetXL=Object.freeze({getSelectedWorkbook:()=>Ge?.getWorkbook(),getSelectedSheet:()=>Ge?.getWorkbook().getSelectedSheet(),getSelectedRange:()=>Ge?.getWorkbook().getSelectedRange(),getRange:t=>Ge?.getWorkbook().getRange(t),getSelectedWorkbookElement:()=>Ge,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(Ge!==a&&(Ge=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
- Try
11
- %c>%c SheetXL.getRange('b2:c3').setValues([[42, 'Hello Word'], [new Date(), true]]) %c
12
- >%c SheetXL.moreExamples()`,"color:#ffa726;","font-family:monospace;color:#1976d2;font-size:12px;","font-family:monospace;","font-family:monospace;color:#1976d2;font-size:12px;","font-family:monospace;"),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 on(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 dr(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,no(a,i)}function Qn(a,i){return a.replace(new RegExp("(^|\\s)"+i+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const Jn=!1,ur=n.createContext(null);var mr=function(a){return a.scrollTop},Dt="unmounted",Xe="exited",Ye="entering",lt="entered",Do="exiting",Ae=(function(a){function i(t,r){var s;s=a.call(this,t,r)||this;var d,m=r&&!r.isMounting?t.enter:t.appear;return s.appearStatus=null,t.in?m?(d=Xe,s.appearStatus=Ye):d=lt:d=t.unmountOnExit||t.mountOnEnter?Dt:Xe,s.state={status:d},s.nextCallback=null,s}dr(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Dt?{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&&mr(s)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Xe&&this.setState({status:Dt})},o.performEnter=function(t){var r=this,s=this.props.enter,d=this.context?this.context.isMounting:t,m=this.props.nodeRef?[d]:[Je.findDOMNode(this),d],l=m[0],c=m[1],u=this.getTimeouts(),C=d?u.appear:u.enter;!t&&!s||Jn?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&&!Jn?(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 m=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],l=m[0],c=m[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===Dt)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=on(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return n.createElement(ur.Provider,{value:null},typeof s=="function"?s(t,d):n.cloneElement(n.Children.only(s),d))},i})(n.Component);function nt(){}Ae.contextType=ur,Ae.propTypes={},Ae.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},Ae.UNMOUNTED=Dt,Ae.EXITED=Xe,Ae.ENTERING=Ye,Ae.ENTERED=lt,Ae.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=Qn(t.className,r):t.setAttribute("class",Qn(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(m,l){var c=t.resolveArguments(m,l),u=c[0],C=c[1];t.removeClasses(u,"exit"),t.addClass(u,C?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(m,l)},t.onEntering=function(m,l){var c=t.resolveArguments(m,l),u=c[0],C=c[1]?"appear":"enter";t.addClass(u,C,"active"),t.props.onEntering&&t.props.onEntering(m,l)},t.onEntered=function(m,l){var c=t.resolveArguments(m,l),u=c[0],C=c[1]?"appear":"enter";t.removeClasses(u,C),t.addClass(u,C,"done"),t.props.onEntered&&t.props.onEntered(m,l)},t.onExit=function(m){var l=t.resolveArguments(m)[0];t.removeClasses(l,"appear"),t.removeClasses(l,"enter"),t.addClass(l,"exit","base"),t.props.onExit&&t.props.onExit(m)},t.onExiting=function(m){var l=t.resolveArguments(m)[0];t.addClass(l,"exit","active"),t.props.onExiting&&t.props.onExiting(m)},t.onExited=function(m){var l=t.resolveArguments(m)[0];t.removeClasses(l,"exit"),t.addClass(l,"exit","done"),t.props.onExited&&t.props.onExited(m)},t.resolveArguments=function(m,l){return t.props.nodeRef?[t.props.nodeRef.current,m]:[m,l]},t.getClassNames=function(m){var l=t.props.classNames,c=typeof l=="string",u=c?(c&&l?l+"-":"")+m:l[m];return{baseClassName:u,activeClassName:c?u+"-active":l[m+"Active"],doneClassName:c?u+"-done":l[m+"Done"]}},t}dr(i,a);var o=i.prototype;return o.addClass=function(t,r,s){var d=this.getClassNames(r)[s+"ClassName"],m=this.getClassNames("enter").doneClassName;r==="appear"&&s==="done"&&m&&(d+=" "+m),s==="active"&&t&&mr(t),d&&(this.appliedClasses[r][s]=d,(function(l,c){l&&c&&c.split(" ").forEach(function(u){return x=u,void((C=l).classList?C.classList.add(x):(function(f,p){return f.classList?!!p&&f.classList.contains(p):(" "+(f.className.baseVal||f.className)+" ").indexOf(" "+p+" ")!==-1})(C,x)||(typeof C.className=="string"?C.className=C.className+" "+x:C.setAttribute("class",(C.className&&C.className.baseVal||"")+" "+x)));var C,x})})(t,d))},o.removeClasses=function(t,r){var s=this.appliedClasses[r],d=s.base,m=s.active,l=s.done;this.appliedClasses[r]={},d&&Co(t,d),m&&Co(t,m),l&&Co(t,l)},o.render=function(){var t=this.props;t.classNames;var r=on(t,["classNames"]);return n.createElement(Ae,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:Be.alpha(s,.2),text:{...o.header.text,fill:a.palette.primary.main},dividerStrokeFill:Be.alpha(s,.7)},o.headerSelectAll={...o.headerSelect,fill:Be.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?Be.alpha(a.palette?.primary?.main,.1):void 0,strokeFill:a.palette?.primary?.main},o.headerSelectionInactive={...o.headerSelection,fill:a.palette?.divider?Be.alpha(a.palette?.divider,.05):void 0,strokeFill:"transparent"};const d=i??a,m=d.palette.mode==="dark";return o.selection={fill:d.palette?.primary?.main?Be.alpha(d.palette?.primary?.main,.1):void 0,strokeFill:d.palette?.primary?.main},o.selectionInactive={...o.selection,fill:d.palette?.divider?Be.alpha(d.palette?.divider,.05):void 0,strokeFill:"transparent"},o.selectionRemove={...o.selection,fill:Be.alpha(d.palette.warning.light,.05),strokeFill:d.palette.warning.dark},i&&(o.body=t(i)),o.colorShadow=Be.alpha(d.palette.action.active,.5),o.colorGrey=d.palette.action.active,o.filterDarkInvert=m?"hue-rotate(180deg) invert(1) brightness(95%)":"none",o},It=n.memo(n.forwardRef((a,i)=>{const{children:o,sx:t,parentFloat:r,...s}=a,d=w.useImperativeElement(i,()=>({}),[]),[m,l]=$e(),c=n.useRef(null),u=n.useRef(null),[C,x]=n.useReducer(v=>v+1,0),[f,p]=n.useState(null),[b,S]=n.useState(null),[h,g]=n.useState(null),{reference:k}=y.useFloatStack({parentFloat:r,label:"overflow"});n.useLayoutEffect(()=>{u.current={refs:[]};const v=[],T=n.Children.toArray(o);let M=0;T.forEach((R,D)=>{v.push(e.jsx(B.Box,{sx:{display:"flex"},ref:F=>{M++,M===T.length&&x();const E={current:null};E.current=F,u.current.refs[D]=E},children:R},D))}),p(v)},[o,l]),n.useLayoutEffect(()=>{if(!f)return;const v=u.current.refs,T=v?v.length:0;if(!d.current||T===0)return S(null),void g(null);const M=d.current?.getBoundingClientRect(),R=[],D=[];let F=0,E=!1;for(let I=0;!E&&I<T;I++){const z=v[I];if(!z)continue;if(!z.current){E=!0;continue}const N=z.current.getBoundingClientRect();F+=N?.width,F>M.width&&(E=!0)}if(!E)return S(null),void g([]);const P=c.current?.getBoundingClientRect();F=0;for(let I=0;I<T;I++){const z=v[I];let N=!1;if(z.current){const H=z.current.getBoundingClientRect();F+=H?.width,F<M.width-P.width&&(N=!0)}N?R.push(f[I]):D.push(f[I])}S(R.length>0?R:null),g(D.length>0?D:null)},[o,f,l,k,C]);const j=w.useCallbackRef(v=>{const T=[],M=h.length;for(let D=0;D<M;D++){const F=n.Children.toArray(h[D])[0];n.Children.toArray(F.props.children?.props?.children??F.props.children).forEach((E,P)=>{const I=E,z={...I.props,key:`overflow-${D}-${P}${I.key??""}`};z.parentFloat&&v&&(z.parentFloat=v.floatReference);const N=n.cloneElement(I,z);T.push(N)})}const R=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:R})},[h]);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,m,i]),...s,children:[e.jsx(B.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%",alignItems:"center"},children:b??f}),e.jsx(B.Box,{className:"overflow-palette-popup-button",sx:{display:h!==null&&h.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"})})})]})})),pr="https://unpkg.com/@sheetxl/scripting-templates/dist",ol=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(" "))},fr=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 m=ct.IOUtils.relativePath(a,d.path),l=await fetch(m);if(!l.ok)throw new Error(`Failed to fetch file at '${d.path}': ${l.statusText}`);const c=await l.text();let u=d.metadata;return u?.title||(u={title:ol(d),...u}),{path:d.path,content:c,metadata:u}}catch(m){console.error(m.message)}return null});return(await Promise.all(s)).filter(d=>d!==null)},wo={marginRight:"4px"},ko="1em",nl=n.memo(a=>{const{disabled:i,snippet:o,description:t,handleInsert:r,sx:s,...d}=a;let m;const l=o.metadata?.icon;return m=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:m,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=>Be.alpha(c.palette.text.secondary??c.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:o.metadata?.summary})]})})}),al=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,scriptPath:d=pr,...m}=a,[l,c]=n.useState([]),[u,C]=n.useState(!0),x=w.useCommands(o,["executeSelectedScript"]),f=x[0]?.context?.();n.useEffect(()=>{(async()=>{try{const b=await fr(d);c(b)}catch{}finally{C(!1)}})()},[d]);const p=n.useCallback((b,S)=>{if(u)return e.jsx("div",{children:"Loading..."});const h={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:s},g=v=>{f.getEditor()?.insertSnippet(v.content),b.closeFloat()},k=[];for(let v=0;v<l.length;v++){const T=l[v];T&&k.push(e.jsx(nl,{handleInsert:g,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,{...h,key:"help",command:o.getCommand("help")})]});return y.defaultCreatePopupPanel({...b,children:j})},[s,t,r,u,f]);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:p,icon:"ScriptNew",...m})})),hr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(m=>{const{commandButtonProps:l,commandPopupProps:c}=m;return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flex:"1 1 100%"},children:[e.jsx("div",{children:e.jsx(It,{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(It,{parentFloat:t,style:{},children:e.jsx(al,{...l,commands:o})})})]})})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));hr.displayName="ScriptEditorToolbar";const gr=n.memo(n.forwardRef((a,i)=>{const{scriptPath:o=pr,onScriptSelect:t,sx:r=w.ReactUtils.EmptyCssProperties,className:s,buttonMinWidth:d=210,buttonMinHeight:m=80,gap:l=12,...c}=a,[u,C]=n.useState([]),[x,f]=n.useState(!0),[p,b]=n.useState(null);if(n.useEffect(()=>{(async()=>{const g=[{path:null,metadata:{title:"Blank Template...",summary:"Start with an empty script."},content:""}];try{f(!0),b(null);const k=await fr(o);for(let j=0;j<k.length;j++){const v=k[j];v&&g.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(g),f(!1)}})()},[o]),x)return e.jsx(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:ie(s,"script-select"),sx:{background:g=>g.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;p&&(S=e.jsxs(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:ie(s,"script-select","error-results"),sx:{background:g=>g.palette.error.light,flex:"0",zIndex:1e3,flexDirection:"column",padding:g=>g.spacing(1),border:g=>`1px solid ${g.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:p})]}));const h=g=>{const k=g.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:g=>g.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:u.map((g,k)=>e.jsxs(B.Button,{variant:"outlined",sx:{minWidth:d,minHeight:m,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?.(g),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:g.metadata?.title||g.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),h(g)]}),g.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:g.metadata.summary})]},`${g.path}-${k}`))})]}),S]})}));gr.displayName="TemplateSelectPanel";const xr=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,editorProps:r,commands:s,readOnly:d=!1,frame:m,autoFocusSel:l,autoFocus:c=!0,scripts:u,...C}=a,x=q.useTheme(),[f,p]=n.useState(!1),b=n.useRef(!1),[S,h]=n.useState({message:"Loading",cursor:"",dirty:!1}),[g,k]=n.useState(null);n.useEffect(()=>{let H=!1;return k(null),(async function(){if(u&&(await u.start(),!H)){const O=u.getModules().getItems()[0]?.getSource();k({source:O||null})}})(),()=>{H=!0}},[u]);const j=n.useCallback(H=>{h(O=>({...O,...H}))},[]),v=n.useRef(null),[T,M]=n.useState(null),R=n.useRef(null),D=w.useCallbackRef(H=>{if(T)return T.focus(H),!0;if(l){const O=v.current?.querySelectorAll?.(l);if(O&&O.length>0)return O[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(hr,{commands:s})}),[x,s]),P=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 ${x.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]),I=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:m,autoFocus:c,commands:s,onStatusChange:j,darkMode:x.palette.mode==="dark",...r})}),P]}),[x,s,E,P,f,F,d,r,c,l,m,j]),z=n.useMemo(()=>{let H;return g===null?null:(g.source===null&&(H=e.jsx(gr,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:O=>{v.current?.getEditor()?.insertSnippet(O.content),k({source:O.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:O=>{O.isDefaultPrevented()||v.current?.focus()},children:e.jsxs(B.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[I,H]})}))},[E,I,o,g]),N=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:N,...C,onFocus:H=>{p(!0),b.current=!0,N.current?.contains(H.target)&&H.target!==N.current&&M(H.target),H.relatedTarget&&!R.current&&(R.current=H.relatedTarget),C?.onFocus?.(H)},onBlur:H=>{N?.current?.contains(H.relatedTarget)||N?.current===H.relatedTarget||(R.current=null,b.current=!1,p(!1)),C?.onBlur?.(H)},children:z})}));xr.displayName="ScriptWorkspace";const rl=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...d}=a;return e.jsx(xr,{ref:i,readOnly:!1,commands:t,frame:s,scripts:o?.getScripts(),...d})},br=n.memo(n.forwardRef((a,i)=>{const{commands:o,...t}=a,r=w.useCommands(o,["executeScript","showScriptEditor"]),[s,d]=n.useState([]),[m,l]=n.useState(!1),c=r[0]?.context?.();n.useEffect(()=>{const p=c?.getScripts();p&&(async()=>{l(!0);const b=await p.searchFunctions({type:"macro"});d(b),l(!1)})()},[]);const u={variant:w.CommandButtonType.Menuitem,parentFloat:a.floatReference,scope:"scripts",shortcut:null},C=[],x=s.length;for(let p=0;p<x;p++){const b=s[p];C.push(e.jsx(y.CommandButton,{...u,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()}-${p}`))}const f=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,{...u,key:"show-editor",command:o.getCommand("showScriptEditor")})]});return y.defaultCreatePopupPanel({...t,children:f})}));br.displayName="RunScriptPopupPanel";const yr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m="showScriptEditor",l=w.useCommands(o,["executeScript","showScriptEditor"])[0].context(),c=n.useCallback((u,C)=>{const x=e.jsx(br,{...u,commands:C});return y.defaultCreatePopupPanel({...u,children:x})},[s,l,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:c,selected:o.getCommand(m).state(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:m,...d})})),il=a=>e.jsx(y.CommandButton,{...a}),Cr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,[d,m]=n.useState(!1),l=w.useCommands(o,["executeScript","showScriptEditor"]),c=l[0]?.context?.();n.useEffect(()=>{const x=c?.getScripts();if(!x)return;const f=l[1],p=async()=>{if(!f)return;let h=!1;if(!f.state()){const g=await x.searchFunctions({type:"macro"}),k=g?.length??0;for(let j=0;g&&!h&&j<k;j++)h=!0}m(h||!!f.state())};p();const b=f.addPropertyListener(()=>{p()}),S=x.addListeners({onChange:()=>{p()}});return()=>{S(),b()}},[c]);const u=oe.useTaskPaneArea(),C=n.useCallback(x=>{const{commandButtonProps:f,commandPopupProps:p}=x,b=oe.DefaultTaskPaneRegistry.findContributions("ribbon/home");let S;const h=b.length;if(h>0){S=[];for(let M=0;M<h;M++){const R=b[M],D=R.createCommand?.(u);if(!D)continue;const F={command:D,...p},E=(R.createCommandButton??il)(F);S.push(E)}}const g=e.jsx(ft,{...p,command:o.getCommand("formatFontColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"text.colored"}),isSplit:!0,panelProps:{disableAlpha:!0}}),k=e.jsx(ft,{...p,command:o.getCommand("formatFillColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"fill.colored"}),isSplit:!0,panelProps:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:mt.End}}),j=o.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx($o,{...p,quickCommand:"undo"})}):null,v=o.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Na,{...p})}):null;let T=null;return d&&(T=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{}),e.jsx(yr,{...p})]})),e.jsxs(It,{parentFloat:t,children:[j,null,j?e.jsx(y.ExhibitDivider,{}):null,e.jsx(Vo,{...p,command:o.getCommand("paste")}),e.jsx(y.CommandButton,{...f,command:o.getCommand("formatPainterToggle")}),e.jsx(so,{...f,command:o.getCommand("copy")}),e.jsx(y.ExhibitDivider,{}),e.jsx(Wa,{...p,command:o.getCommand("formatFontFamily")}),e.jsx(Oa,{...p,command:o.getCommand("formatFontSize")}),e.jsx(y.CommandButton,{...f,command:o.getCommand("formatBoldToggle")}),e.jsx(y.CommandButton,{...f,command:o.getCommand("formatItalicToggle")}),e.jsx(Va,{...p}),e.jsx($a,{...p}),e.jsx(Da,{...p}),k,g,e.jsx(y.ExhibitDivider,{}),e.jsx(ka,{...p}),e.jsx(va,{...p}),e.jsx(Ta,{...p}),e.jsx(ja,{...p}),e.jsx(Fa,{...p}),e.jsx(y.ExhibitDivider,{}),e.jsx(Aa,{...p}),e.jsx(qa,{command:o.getCommand("formatCellStyle"),...p}),e.jsx(cn,{command:o.getCommand("formatTableStyle"),...p}),e.jsx(y.ExhibitDivider,{}),e.jsx(zo,{...p}),e.jsx(Ho,{...p}),e.jsx(y.ExhibitDivider,{}),e.jsx(dn,{...p}),e.jsx(La,{...p}),e.jsx(Lo,{...p}),e.jsx(Wo,{...p}),v,T,S]})},[o,l,d,u]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:C,...s})}));Cr.displayName="HomeToolbar";const nn=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,preferSingleMenu:d=!0,showQuickButton:m=!0,variant:l=w.CommandButtonType.Toolbar,...c}=a,u=w.useCommands(o,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:C,allDisabled:x}=n.useMemo(()=>{let p=null,b=0;for(let S=0;S<u.length;S++)u[S]&&!u[S]?.disabled()&&(d&&l===w.CommandButtonType.Menuitem&&(p=b===0?u[S]:null),b++);return{singleMenuCommand:p,allDisabled:b===0}},[u]),f=n.useCallback((p,b)=>{const S={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:s},h=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({...p,children:h})},[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||x,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:f,icon:"InsertImage",...c})})),Sr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(m=>{const{commandButtonProps:l,commandPopupProps:c}=m;return e.jsxs(It,{parentFloat:t,children:[e.jsx(y.CommandButton,{...l,command:o.getCommand("insertTable")}),e.jsx(nn,{...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})}));Sr.displayName="InsertToolbar";const wr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=w.useCallbackRef(m=>{const{commandButtonProps:l,commandPopupProps:c}=m;return e.jsxs(It,{parentFloat:t,children:[e.jsx(Ia,{...c}),e.jsx(y.CommandButton,{...l,command:o.getCommand("protectionSheetToggle")}),e.jsx(y.ExhibitDivider,{}),e.jsx(za,{...c}),e.jsx(_a,{...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(Ka,{...c}),e.jsx(Br,{command:o.getCommand("selectTheme"),...c}),e.jsx(y.ExhibitDivider,{}),e.jsx(yr,{...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})}));wr.displayName="ViewToolbar";const kr=a=>e.jsx(vr,{...a}),ll=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"}})]})}),sl=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,sx:r,...s}=a,d=n.useMemo(()=>{const m=[];for(let l=0;l<i.length;l++)m.push(e.jsx(ll,{label:i[l].label},i[l].label));return m},[i]);return e.jsx(B.Tabs,{value:o,onChange:(m,l)=>{t?.(l)},variant:"scrollable",scrollButtons:!1,sx:{paddingLeft:m=>m.spacing(1.5),paddingRight:m=>m.spacing(1.5),paddingTop:m=>m.spacing(0),paddingBottom:m=>m.spacing(0),minHeight:"26px",alignItems:"center","& .MuiTabs-indicator":{display:"flex",justifyContent:"center",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{width:"90%",borderRadius:"4px",minWidth:"4px",backgroundColor:m=>m.palette.primary.main},"& .MuiTab-root":{marginRight:"0px"},...r},slotProps:{indicator:{children:e.jsx("span",{className:"MuiTabs-indicatorSpan"})}},...s,children:d})}),cl=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,selectProps:r,...s}=a,d=n.useCallback(l=>{t?.(l.target.value)},[t]),m=n.useMemo(()=>{const l=[];for(let c=0;c<i.length;c++){const u=i[c].label;l.push(e.jsx(B.MenuItem,{value:c,sx:{color:C=>{if(o===c)return C.palette.primary.main}},children:u},u))}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:m})})}),vr=n.memo(n.forwardRef((a,i)=>{const{commands:o,selectWrapper:t,selectProps:r={},renderCompact:s=!1,paletteWrapper:d,toolbarsProps:m,paletteProps:l={},workbook:c,sx:u,...C}=a,x=n.useMemo(()=>{const v=[],{ref:T,...M}=m?.Home||{};v.push({label:"Home",component:e.jsx(Cr,{commands:o,...M})});const{ref:R,...D}=m?.Insert||{};v.push({label:"Insert",component:e.jsx(Sr,{commands:o,...D})});const{ref:F,...E}=m?.View||{};return v.push({label:"View",component:e.jsx(wr,{commands:o,...E})}),v},[o,c]),f=n.useMemo(()=>{const v=[];for(let T=0;T<x.length;T++)v.push(n.cloneElement(x[T].component,{...x[T].component.props,key:x[T].key??x[T].label}));return v},[x]),[p,b]=n.useState(0),S=v=>{b(v)},h=n.useMemo(()=>s?e.jsx(cl,{toolbars:x,value:p,onToolbarChange:S,sx:r}):e.jsx(sl,{toolbars:x,value:p,onToolbarChange:S,sx:r}),[x,p,r,s]),{sx:g,...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),...g},...k,children:f[p]});return e.jsxs(B.Box,{ref:i,className:"toolbarWrappers",sx:{display:"flex",flexDirection:"column",paddingTop:v=>v.spacing(.5),"*":{userSelect:"none"},...u},...C,children:[t?t(h):h,d?d(j):j]})}));var ea,ta;vr.displayName="WorkbookToolbars",(function(){if(ta)return ea;ta=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,m=s||d||Function("return this")(),l=Object.prototype.toString,c=Math.max,u=Math.min,C=function(){return m.Date.now()};function x(p){var b=typeof p;return!!p&&(b=="object"||b=="function")}function f(p){if(typeof p=="number")return p;if((function(h){return typeof h=="symbol"||(function(g){return!!g&&typeof g=="object"})(h)&&l.call(h)=="[object Symbol]"})(p))return NaN;if(x(p)){var b=typeof p.valueOf=="function"?p.valueOf():p;p=x(b)?b+"":b}if(typeof p!="string")return p===0?p:+p;p=p.replace(a,"");var S=o.test(p);return S||t.test(p)?r(p.slice(2),S?2:8):i.test(p)?NaN:+p}ea=function(p,b,S){var h,g,k,j,v,T,M=0,R=!1,D=!1,F=!0;if(typeof p!="function")throw new TypeError("Expected a function");function E(H){var O=h,W=g;return h=g=void 0,M=H,j=p.apply(W,O)}function P(H){var O=H-T;return T===void 0||O>=b||O<0||D&&H-M>=k}function I(){var H=C();if(P(H))return z(H);v=setTimeout(I,(function(O){var W=b-(O-T);return D?u(W,k-(O-M)):W})(H))}function z(H){return v=void 0,F&&h?E(H):(h=g=void 0,j)}function N(){var H=C(),O=P(H);if(h=arguments,g=this,T=H,O){if(v===void 0)return(function(W){return M=W,v=setTimeout(I,b),R?E(W):j})(T);if(D)return v=setTimeout(I,b),E(T)}return v===void 0&&(v=setTimeout(I,b)),j}return b=f(b)||0,x(S)&&(R=!!S.leading,k=(D="maxWait"in S)?c(f(S.maxWait)||0,b):k,F="trailing"in S?!!S.trailing:F),N.cancel=function(){v!==void 0&&clearTimeout(v),M=0,h=T=g=v=void 0},N.flush=function(){return v===void 0?j:z(C())},N}})();var oa,na,aa={exports:{}},vo={};na||(na=1,aa.exports=(function(){if(oa)return vo;oa=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 u=c();return!i(l,u)}catch{return!0}}var m=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,c){return c()}:function(l,c){var u=c(),C=o({inst:{value:u,getSnapshot:c}}),x=C[0].inst,f=C[1];return r(function(){x.value=u,x.getSnapshot=c,d(x)&&f({inst:x})},[l,u,c]),t(function(){return d(x)&&f({inst:x}),l(function(){d(x)&&f({inst:x})})},[l]),s(u),u};return vo.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:m,vo})()),aa.exports;var ra,ia,Et={exports:{}},st={exports:{}},dl=st.exports;(function(){if(ia)return Et.exports;ia=1;for(var a=(ra||(ra=1,function(){var C,x,f,p,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},x=process.hrtime,p=(C=function(){var h;return 1e9*(h=x())[0]+h[1]})(),S=1e9*process.uptime(),b=p-S):Date.now?(st.exports=function(){return Date.now()-f},f=Date.now()):(st.exports=function(){return new Date().getTime()-f},f=new Date().getTime())}.call(dl)),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 m=0,l=0,c=[],u=1e3/60;r=function(C){if(c.length===0){var x=a(),f=Math.max(0,u-(x-m));m=f+x,setTimeout(function(){var p=c.slice(0);c.length=0;for(var b=0;b<p.length;b++)if(!p[b].cancelled)try{p[b].callback(m)}catch(S){setTimeout(function(){throw S},0)}},Math.round(f))}return c.push({handle:++l,callback:C,cancelled:!1}),l},s=function(C){for(var x=0;x<c.length;x++)c[x].handle===C&&(c[x].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 Fe={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 jr=a=>{const{workbook:i,workbookElement:o,target:t,commands:r,darkMode:s,onNewWorkbook:d=Tr}=a,m=w.useNotifier(),[l,c]=n.useState(i?.getSelectedSheet()),[u,C]=n.useState(i?.getSheets().getItems()),x=w.useCallbackRef(d,[d]),f=oe.useTaskPaneArea(),p=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:"NamedRangeInsert"}),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:"NamedRangeRemove"}),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
-
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(p,!0),E},[r,p]),S=w.useEditMode(),h=n.useRef(null),g=w.useCallbackRef(()=>{let E,P=null;const I=b.getCommand("executeScript");if(I.update({disabled:!1,context:{getScripts:()=>i.getScripts()}}),!I)return;const z=b.getCommand("showScriptEditor");z.updateCallback(function(O=!0){P?P.close():f.activateTaskPane("scriptEditor",{})});const N=b.getCommand("executeSelectedScript");if(!N)return;const H={saveSource:async O=>{let W=null,ee=null;const X=i.getScripts();try{O&&(ee=await m.showBusy("Saving Scripts..."),W=await X.createModule({source:O})),X.addModule("scripts",W,{replace:!0}),ee?.()}catch(ae){ee?.(),console.warn("Unable to compile",ae),m.showError(ae)}return W},addContainerListener:O=>(k.current=O,()=>{k.current=null}),setSelectedFunction:O=>{E=O??h.current??null,Promise.resolve(E).then(W=>{N.update({disabled:W===null})})},quickInsertFunction:O=>{const W=`=${O.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:O=>{P=O??null,z.update({state:P!==null})},getEditor:()=>P,getRanges:O=>{try{return i.getRanges(O)}catch{}return null},getScripts:()=>i.getScripts()};N.update({context:H})},[b,i,o,m]),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 P={disabled:!E.getProtection().isStructureAllowed()};b.getCommand("hideSheet").update(P),b.getCommand("deleteSheet").update(P),b.getCommand("addSheet").update(P),b.getCommand("duplicateSheet").update(P),b.getCommand("selectTheme").update(P),b.getCommand("addNamedReference").update(P),b.getCommand("editNamedReference").update(P),b.getCommand("deleteNamedReference").update(P)},onScriptsChange:E=>{g()}});const{isFullscreenAvailable:j,isFullscreenEnabled:v,toggleFullscreen:T}=(function(E={}){const{target:P,onChange:I,onError:z,requestFullScreenOptions:N}=E,[H,O]=n.useState(!1),[W,ee]=n.useState(null),[X,ae]=n.useState(!1),$=n.useCallback(()=>Fe.requestFullscreen(P?.current||null,N),[P,N]),U=n.useCallback(()=>Fe.exitFullscreen(),[]),Y=n.useCallback(()=>Fe.fullscreenElement?U():$(),[$,U]),_=n.useCallback(G=>{const Q=Fe.fullscreenElement;ee(Q),ae(!!Q),I?.(G)},[I]),L=n.useCallback(G=>{const Q=Fe.fullscreenElement;ee(Q),ae(!!Q),z?.(G)},[z]);return n.useEffect(()=>{O(Fe.fullscreenEnabled)},[]),n.useEffect(()=>(Fe.on("change",_),Fe.on("error",L),()=>{Fe.off("change",_),Fe.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 R=w.useCallbackRef(async function(E,P){let I=null;const z=i.getScripts();if(E?.declaration||E?.functionName){const N=E.declaration?E.declaration.getName():E.functionName;(await z.searchFunctions({name:N})).length>0&&(I=N)}if(I)try{await z.executeMacro(I),h.current=Promise.resolve({source:null,name:I})}catch(N){return void m.showError(N)}},[i,m]);n.useEffect(()=>{b.getCommand("newCellStyle").updateCallback(E=>{m.showInputOptions({initialValue:(()=>{let P=0;for(;;){P++;const I=`Style ${P}`;try{return i.getStyles().validateStyleName(I,!0),I}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",onValidateInputOption:async(P,I)=>{let z=null;try{i.getStyles().validateStyleName(P,!1)}catch(O){z=O.message}let N=i.getStyles().getNamed(P),H=z;return!H&&N&&(H=`Update style '${N.getName()}'.`),{valid:z===null,message:H}}}).then(({input:P,option:I})=>{const z=i.getSelectedSheet().getSelectedRange();if(I!=="Ok")return;const N=i.getStyles().setNamed({name:P,style:z.getCell().getStyle()});z.getStyle().update({named:N.getName()})})}),b.getCommand("deleteCellStyle").updateCallback(E=>{E.delete()}),b.getCommand("modifyCellStyle").updateCallback(({named:E})=>{const P=i.getSelectedSheet().getSelectedRange();i.getStyles().setNamed({name:E.getName(),style:P.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 m.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(()=>{x?.()}),b.getCommand("executeScript").updateCallback(R),b.getCommand("executeSelectedScript").updateCallback(R)},[i,m]);const D=w.useCallbackRef(async E=>{let P=0,I=null,z="Find & Replace";E?.replace&&!E?.replaceOptions?.maxCount&&(z="Replace All");const N=await m.showBusy(z);try{const H=E?.scope??"sheet";let O=null;const W=i.getSelectedSheet(),ee={from:W.getSelectedCell(),...E.findOptions};if(O=H==="sheet"?i.getSelectedSheet().find(ee):i.find(ee),E.replace){const X=i.replace(O,E.replaceText,E.replaceOptions);P=X.count,E.replaceOptions.maxCount&&(I=X.last)}else{let X=O.next();X.done||(P++,I=X.value)}I?.select({autoFocus:!1}),N?.(),!E.replaceOptions.maxCount&&P>1&&m.showMessage(`We replaced ${P} cells.`)}catch(H){N?.(),m.showError(H)}return P},[i,o]),F=w.useCallbackRef(E=>{const P={value:E,context:{selection:()=>{const I=i.getSelectedRanges(),z=[];for(let N=0;N<I.getCount();N++){const H=I.at(N).getFixed(!0).getCoords();z.push(H)}return i.getRanges(z)},getNames:()=>i.getNames()},onUpdate:async I=>{try{await I.select()}catch(z){m.showMessage(z.message,{type:w.NotifierType.Error})}}};return m.showWindow("namedDetails",P)},[m,i,o]);return n.useEffect(()=>{const E=(P=!1)=>{const I=i.getSelectedCell(),z={onFindOrReplace:D,onKeyDown:N=>{b.findCommandByEvent(N)!==b.getCommand("find")&&b.findCommandByEvent(N)!==b.getCommand("findReplace")||N.preventDefault()},findOptions:{text:""},findText:I.toTextUnformatted(!0)};z.replace=P,m.showWindow?.("find",z,{disableAutoDestroy:!0})};b.getCommand("find")?.update({disabled:!m.showWindow}).updateCallback(()=>{E()}),b.getCommand("findReplace")?.update({disabled:!m.showWindow}).updateCallback(()=>{E(!0)}),b.getCommand("activateTask")?.update({disabled:!m}).updateCallback(()=>{const P={onInputOption:async I=>{try{f.activateTaskPane(I)}catch(z){m.showError(z.message)}},title:b.getCommand("activateTask")?.label(),inputLabel:"Task Name",options:["Activate"]};m.showInputOptions(P)}),b.getCommand("goto")?.update({disabled:!m}).updateCallback(()=>{const P={onInputOption:async I=>{try{await i.getRanges(I).select()}catch(z){m.showMessage(z.message,{type:w.NotifierType.Error})}},onKeyDown:I=>{b.findCommandByEvent(I)===b.getCommand("goto")&&I.preventDefault()},title:b.getCommand("goto")?.label(),inputLabel:"Location",options:["Go To"]};m.showInputOptions(P)}),b.getCommand("selectNamed")?.update({disabled:!m}).updateCallback(async P=>{if(P)try{await P.select()}catch(I){m.showError(I)}}),b.getCommand("addNamedReference")?.updateCallback(async function(P){F(null)}),b.getCommand("editNamedReference")?.updateCallback(async function(P){F(P)}),b.getCommand("deleteNamedReference")?.updateCallback(async function(P){P?.delete?.()}),b.getCommand("activeNameBox")?.updateCallback(async function(){o?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus()})},[o,i,m]),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:u.length<=1||!E}),b.getCommand("deleteSheet").update({disabled:u.length<=1||!E})},[u,l]),b},Tr=()=>{window.open(window.origin.toString(),"sheetxl-"+A.CommonUtils.uuidV4(),"popup=true")},ul="_sheetxl-theme_4opcr_2",ml="_sheetxl-workbook_g5t6x_5",pl=a=>e.jsx(en,{...a}),fl=a=>e.jsx(tn,{...a}),hl=a=>e.jsx(Jo,{...a}),an=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,onBeforeUserChange:r,onUserChange:s,disabled:d=!1,readOnly:m=!1,contextMenuProps:l,renderContextMenu:c=pl,sheetsAllProps:u,renderSheetsAll:C=fl,sheetTabProps:x,renderSheetTab:f,background:p="transparent",className:b,sx:S,borderWidth:h,borderColor:g,gridTheme:k,gridStyle:j,...v}=a,[T,M]=n.useState(o?.getSelectedSheetIndex()),[R,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 P=m||!F.isStructureAllowed(),I=n.useMemo(()=>{const J=[];for(let K=0;K<R.length;K++)J.push(R[K].getName());return J},[R]),z=n.useCallback(J=>{r?.(J)!==!1&&(o.getSheetAt(J).select(),s?.(J))},[o,r,s]),N=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]),O=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,ae]=n.useState(!1),$=n.useCallback(J=>{const{closeFloatAll:K,floatReference:te}=J;return C({workbook:o,gridStyle:j,floatReference:te,closeFloatAll:K,...u})},[C,u,d,o,j]),{reference:U,component:Y}=y.useFloatStack({label:"allSheet",popperProps:W,anchor:ee.current,onOpen:()=>ae(!0),onClose:()=>ae(!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:he,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?he.open(0):he.close(0)},[L]);const pe=n.useCallback((J,K)=>{J.preventDefault(),G({left:J.clientX-2,top:J.clientY-4,index:K})},[]),Ce=w.useCallbackRef(J=>{let K;try{K=o?.getSheetAt(J.index)}catch{}return K?(f??hl)({sheet:K,gridTheme:k,onContextMenu:te=>{z(J.index),pe(te,J.index)},...J,...x}):null},[f,x,o,k]),be=n.useMemo(()=>P?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:()=>O(),children:e.jsx(w.DynamicIcon,{iconKey:"AddCircle"})})}),[d,P,O]);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:I,onSelectedTabIndexChange:z,onTabNameChange:N,onTabMove:H,background:p,borderColor:g,borderWidth:h,activeColor:null,disabled:d,disableDrag:P,createScrollStartButton:y.createScrollStartButton,createScrollEndButton:y.createScrollEndButton,createScrollEdgeButton:y.createScrollEdgeButton,createTabButton:Ce,createTabDivider:J=>{const{key:K,...te}=J;return e.jsx(y.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:ue=>q.alpha(ue.palette.divider,.25)},...te},K)},editLabelProps:{readOnly:P,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 ${g} ${h}px`,minWidth:"4px"}}),e.jsx("div",{style:{borderTop:`solid ${g} ${h}px`,flex:"none",display:"flex",alignItems:"center"},children:be}),e.jsx("div",{style:{borderTop:`solid ${g} ${h}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:m,...l}=a,[c,u]=n.useReducer(P=>P+1,0),[C,x]=n.useState(o.getSelectedSheet()),[f,p]=n.useState(C.getSelectedRanges()),[b,S]=n.useState(C.getSelectedCell());oe.useModelListener(o,{onSheetsChange(){x(o.getSelectedSheet())}}),oe.useModelListener(C.getSelection(),{onChange(){p(C.getSelectedRanges()),S(C.getSelectedCell())}}),w.useCommands(t,[],{onChange:()=>{u()}});const h=n.useMemo(()=>({}),[]),g=n.useMemo(()=>({commandHook:{beforeExecute:(P,I)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,scope:"contextMenu",parentFloat:d}),[r,d]),k=n.useMemo(()=>({...h,...g,variant:w.CommandButtonType.Menuitem}),[h,g]),j=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:d,...g}),[t,g,d]),v=[];let T=f.isEntireRows(),M=f.isEntireColumns();f&&(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})),M&&v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitRows"),...k,key:"context:"+v.length})));const R=[],D=t.getCommand("formatTableStyle"),F=D?.context()?.table();if(w.useCommand(D),!T&&!M){if(R.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+R.length)),b?.getHyperlink())R.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+R.length,quickCommand:"openHyperlink"}));else{const P=t.getCommand("updateHyperlink");R.push(n.createElement(y.CommandButton,{command:P,...k,key:"contextBefore:"+R.length}))}if(b?.getComments())R.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+R.length,quickCommand:"updateComments"}));else{const P=t.getCommand("updateComments");R.push(n.createElement(y.CommandButton,{command:P,...k,key:"contextBefore:"+R.length}))}F?R.push(n.createElement(y.SimpleCommandPopupButton,{...j,variant:w.CommandButtonType.Menuitem,key:"contextBefore:"+R.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:F,quickCommand:"editTable"})):R.push(n.createElement(y.CommandButton,{command:t.getCommand("insertTable"),...k,key:"context:"+v.length})),R.push(n.createElement(nn,{...j,key:"contextBefore:"+R.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(Vo,{command:t.getCommand("paste"),...j,includePasteAllInPopup:!1}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(Wo,{...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}),R,v]});return e.jsx(B.Box,{ref:i,className:ie("menu",m),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),[m,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:m}}),...t})})),Er=n.memo(n.forwardRef((a,i)=>{const{movable:o,commands:t,disabled:r,sx:s,floatReference:d,...m}=a;oe.useModelListener(o,{onAnyChange(f){}});const l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(f,p)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),u=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]),x=e.jsxs(e.Fragment,{children:[e.jsx(so,{command:t.getCommand("copy"),...u,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,{...u,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},...m,children:x})}));Er.displayName="MovableContextMenu";const gl=a=>e.jsx(Er,{...a}),xl=a=>e.jsx(rn,{...a}),bl=a=>e.jsx(Qo,{...a}),yl=(a,i)=>e.jsx(Zo,{ref:i,...a}),Cl=a=>e.jsx(y.LoadingPanel,{...a}),Sl=(a,i)=>e.jsx(oe.SheetElement,{ref:i,...a}),wl=a=>e.jsx(Go,{...a}),kl=a=>e.jsx(an,{...a}),vl={fireOnModelChange:!1},la={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:m,style:l,className:c,onFocus:u,onBlur:C,onKeyDown:x,onRepeatCommandChange:f,commands:p,showFormulaBar:b,formulaBarProps:S,renderFormulaBar:h=yl,showTabs:g,tabsProps:k,renderTabs:j=kl,showStatusBar:v,statusBarProps:T,renderStatusBar:M=wl,toolbarProps:R,renderToolbar:D=kr,contextMenuSx:F,renderContextMenu:E=xl,renderFilterMenu:P=bl,renderMovableMenu:I=gl,renderLoadingPanel:z=Cl,loadingPanelProps:N,sheetProps:H,renderSheet:O=Sl,mainWrapper:W,showHorizontalScrollbar:ee,showVerticalScrollbar:X,gridTheme:ae,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),[he,re]=n.useState(!1),pe=n.useRef(null),Ce=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:pe}),[]),[be,J]=n.useState(!1),[K,te]=n.useState(!1),ue=n.useCallback(()=>{J(!0)},[]),ve=n.useRef(null),ce=w.useImperativeElement(i,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>G,getSheetElement:()=>Q.current,getViewportElement:()=>pe.current,getFormulaBarElement:()=>ve.current,focus(){Q&&Q.current&&Q.current.focus()}}),[G]),Me=n.useRef(null);n.useLayoutEffect(()=>{!be||!ce.current||(async()=>(Me.current!==s&&(await s?.({source:ce.current}),Me.current=s),te(!0)))()},[be,ce.current]),Zn(ce.current);const Te=n.useCallback(V=>(Q.current?.submitEdit(),!0),[]),Ie=n.useCallback(()=>{requestAnimationFrame(()=>{Q?.current?.focus()})},[]),[me,Z]=n.useState(G?.getSelectedSheet()),[le,_e]=n.useState(G?.getProtection());oe.useModelListener(G,{onSheetsChange:V=>{Z(V?.getSelectedSheet())},onViewChange(V){Z(V?.getSelectedSheet())},onProtectionChange:V=>{_e(V?.getProtection())}}),oe.useModelListener(G,{onRequestSelect:async(V,ne)=>new Promise(se=>{Q.current.getSheet()!==ne?Q.current.getGridElement()?.onViewChangeOnce(()=>{Q.current.getSheet()!==ne&&se(!1),se(!0)}):se(!0)})},vl);const[Jr,ht]=n.useReducer(V=>V+1,0),tt=G?.getView();oe.useModelListener(tt,{onViewChange:V=>{ht()}});const gt=ae??_,Se=n.useMemo(()=>Io(_,gt),[_,gt]),fn=$??_,ei=n.useMemo(()=>Io(_,fn),[_,fn]),[hn,ti]=n.useState(null);n.useCallback(()=>{Q.current.focus()},[]);const fe=jr({workbook:G,workbookElement:ce.current,target:()=>Q.current,commands:p,darkMode:Se.body.darkMode,onNewWorkbook:r}),xt=n.useRef(null),[uo,gn]=n.useState(!1),[xn,bn]=n.useState(null),[yn,oi]=n.useState(w.ToolTipPlacement.Top),[bt,ni]=n.useState(A.TypesUtils.EmptyBounds),mo=n.useCallback(()=>{gn(!1),bn(null)},[]),yt=n.useCallback((V,ne,se=w.ToolTipPlacement.Top)=>{ni(V),oi(se),bn(ne),xt.current!==null&&setTimeout(()=>{xt.current!==null&&xt.current.update()},160),gn(!0)},[]),[ds,Cn]=n.useState("sheet"),Ke=g??tt?.isShowTabs(),Ue=ee??tt?.isShowHorizontalScrollbar(),ai=b??tt?.isShowFormulaBar(),Lt=v??tt?.isShowStatusBar(),Sn=X??tt?.isShowVerticalScrollbar(),ot=Se?.header?.edgeStrokeFill||"rgb(171,171,171)",ri=n.useMemo(()=>Lt?M({sheet:me,gridStyle:Se,...T}):null,[M,T,Lt,Se,me]),ii=n.useMemo(()=>D({commands:fe,workbook:ce.current,...R}),[fe,D,R,_]),[li,{width:po}]=$e(),Le=po===0||po>560,fo=n.useMemo(()=>{if(!Ke)return null;let V=j({background:Se.body.fill,borderWidth:1,borderColor:ot,gridTheme:gt,gridStyle:Se,onBeforeUserChange:Te,onUserChange:Ie,workbook:G,commands:fe,sheetTabProps:{},...k});return Le||(V=e.jsx("div",{style:{flex:"none",display:"flex"},children:V})),V},[j,k,_,G,gt,Le,fe,Ke]),wn=n.useCallback(V=>{const ne=A.CommonUtils.getOS()===A.CommonUtils.OSType.Firefox;let se=null,ke=null,we=null;if(Ue&&(ke=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${ot} 1px`,maxWidth:"100%"},children:e.jsx(oe.SheetScrollbar,{style:{alignItems:"center",borderTop:(ne?6:3)+"px solid transparent",borderBottom:(Le?6:3)+"px solid transparent",borderLeft:(ne?3:0)+"px solid transparent",borderRight:(ne?3:0)+"px solid transparent"},...V,endGap:700,sheet:me,showCustomScrollButtons:!ne,onShowTooltip:ye=>{yt({x:ye.anchor.x,y:ye.anchor.y,width:0,height:0},ye.display,ye.placement)},onCloseTooltip:()=>mo()})})),Ke&&Le&&(we=fo),Ke&&Le&&!Ue&&(we=e.jsxs(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[we,e.jsx(B.Box,{sx:{borderTop:`solid ${ot} 1px`,flex:"1"}})]})),we&&Ue)se=e.jsx(w.SplitPane,{position:G.getView().getTabRatio()/10+"%",onPositionChange:({percent:ye})=>{G.getView().setTabRatio(Math.round(10*ye))},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:we,elementAfter:ke});else if(Ue)se=ke;else{if(!we)return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:Lt?null:`solid ${ot} 1px`}});se=we}return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:se})},[me,Te,G,Se,gt,fe,Ke,Ue,Lt,Le]),[Re,Ct]=n.useState(null),si=n.useMemo(()=>({placement:"right-start",...Re?.popperProps}),[Re?.popperProps]),{reference:kn,component:ci}=y.useFloatStack({label:"contextMenu",popperProps:si,anchor:Re?.anchor??{getBoundingClientRect:()=>new DOMRect(Re?.clientX||0,Re?.clientY||0)},onClose:()=>Ct(null),createPopupPanel:Re?.createPopupPanel});n.useEffect(()=>{Re?kn.open(0):kn.close(0)},[Re]);const di=w.useCallbackRef((V,ne)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Re&&Re.anchor===V.currentTarget?Ct(null):Ct({anchor:V.currentTarget,popperProps:{offsets:[-4,2]},createPopupPanel:se=>{const{floatReference:ke}=se;return P({filter:ne,commands:fe,floatReference:ke,sx:{...F}})}})},[P,F,fe,G,Re]),vn=w.useCallbackRef(V=>{if(V.originalEvent?.isDefaultPrevented())return!0;V.originalEvent?.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:ne=>{const{floatReference:se}=ne;return E({commands:fe,workbook:G,floatReference:se,sx:{...F}})}})},[E,F,fe,G]),ui=w.useCallbackRef((V,ne)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:se=>{const{floatReference:ke}=se;return I({movable:ne,commands:fe,floatReference:ke,sx:{...F}})}})},[I,F,fe]);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"}]})];fe.addCommands(V,!0)},[fe]),n.useEffect(()=>{fe.getCommand("openContextMenu").updateCallback(()=>{const V=me.getSelection().getCoords().cell;Q.current?.getGridElement()?.scrollCellCoordsIntoView(V).then(ne=>{requestAnimationFrame(()=>{const se=me.getView().getZoomScale()/100,ke=me.getColumnHeaders().findOffset(V.colIndex+1)*se,we=me.getRowHeaders().findOffset(V.rowIndex+1)*se,ye=Q.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};vn({clientX:ke-ye.x-ne.left+6,clientY:we-ye.y-ne.top+6})})})})},[me]);const mi=w.useCallbackRef(V=>{fe?.dispatchToFocusedCommand(V)},[fe]),pi=w.useCallbackRef(()=>{Zn(ce.current)},[G,ce.current]),fi=n.useCallback(()=>{Cn("sheet")},[]),hi=n.useCallback(()=>{Cn("formulaBar")},[]),gi=w.useCallbackRef(V=>{const ne=A.CommonUtils.getOS()===A.CommonUtils.OSType.Firefox;return e.jsx(oe.SheetScrollbar,{style:{borderLeft:"3px solid transparent",borderRight:"0px solid transparent",borderTop:(ne?3:0)+"px solid transparent",borderBottom:(ne?3:0)+"px solid transparent",width:ne?"13px":void 0},...V,sheet:me,endGap:700,showCustomScrollButtons:!ne,onShowTooltip:se=>{yt(se.anchor,se.display,w.ToolTipPlacement.Left)},onCloseTooltip:()=>mo()})},[me]);n.useEffect(()=>{d&&Q&&Q.current&&Q.current.focus()},[]);const[zt,ho]=n.useState(null),go=n.useCallback(V=>{fe?.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())},[fe]),xi=w.useCallbackRef(V=>{if(fe?.getCommand("openWorkbook")&&(V.preventDefault(),V.stopPropagation(),ho(null),V.dataTransfer.files&&V.dataTransfer.files.length>0)){const ne=V.dataTransfer.files[0];if(!ne)return;if(ne?.type?.startsWith("image/")){const se=Q.current?.getGridElement().getViewFromClient(V.clientX,V.clientY);if(!se)return;const ke=se.getRelativePointFromClient(V.clientX,V.clientY),we=se.toAbsoluteBounds({...ke,width:0,height:0}),ye=se.getCellCoordsFromClient(V.clientX,V.clientY);if(!ye)return;fe?.getCommand("insertImageFromFile")?.execute({file:ne,options:{bounds:{x:we.x,y:we.y}},goto:{range:{...ye}}})}else fe?.getCommand("openWorkbook")?.execute(ne)}},[fe,zt]),bi=n.useMemo(()=>zt?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:zt})}):null,[zt]),jn=n.useRef(null),yi=n.useMemo(()=>e.jsx(Fo,{in:!K,nodeRef:jn,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":m?.pointerEvents,position:"absolute",boxSizing:"border-box"},children:z({ref:jn,transitionDelay:"0",transparentBackground:!1,sx:{opacity:K?0:m?.opacity,pointerEvents:K?"none":m?.pointerEvents,position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%",...N}})})}),[K,z,N]),Ci=n.useMemo(()=>h({sx:{marginTop:V=>V.spacing(.25),marginLeft:V=>V.spacing(1),marginRight:V=>V.spacing(1)},workbook:G,sheetElement:Q.current,gridStyle:Se,onFocus:hi,...S,NamedCollectionEditorProps:{restoreFocus:V=>Q.current.focus(V),...S?.NamedCollectionEditorProps,commandPopupButtonProps:{commands:fe,...S?.NamedCollectionEditorProps?.commandPopupButtonProps}}},ve),[h,S,G,Se,fe,K]),Si=n.useCallback(V=>{const{movable:ne,...se}=V,ke={movable:ne,onContextMenuCapture:qe=>{ui(qe,ne)},...se},we=ne.getContent().getType();let ye=null;if(we==="picture")return e.jsx(oe.PictureEditor,{loadingPanel:e.jsx(y.LoadingPanel,{transitionDelay:"100",style:{position:"absolute"},sx:{border:qe=>`solid 1px ${qe.palette.action.active}`}}),picture:ne.getContent(),description:ne.getDescription()??ne?.getName(),...ke});if(we==="chart"){const qe={...ke,chart:ne.getContent()};return e.jsx(oe.ChartEditor,{...qe})}if(ye=`Float of type '${we}'.`,typeof ye=="string"){const qe={...ke,description:ye};ye=e.jsx(oe.EmptyFrame,{...qe})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:ye},ne.getUUID())},[]),Tn=n.useMemo(()=>O({style:la,onFocus:fi,gridStyle:Se,headersStyle:ei,sheet:me,commands:fe,onSheetContextMenu:vn,onViewportChange:V=>{ti(V)},showScrollbars:!1,viewportComponent:Ce,onRepeatCommandChange:f,onElementLoad:ue,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:Si,...H,cellRenderProps:{onFilterButtonMouseDown:(V,ne)=>{H?.cellRenderProps?.onFilterButtonMouseDown(V,ne),di(V,ne)},...H?.cellRenderProps}},Q),[fe,H,me,Se,f]),wi=n.useMemo(()=>{let V=e.jsx(w.ScrollPane,{ref:li,style:la,viewport:hn,touchElement:Q.current?.getGridElement()?.stage,onScrollViewport:ne=>{Q.current?.getGridElement()?.scrollTo(ne)},showHorizontalScrollbar:Ue||Ke,showVerticalScrollbar:Sn,createHorizontalScrollbar:wn,createVerticalScrollbar:gi,children:Tn});return Le||po===0||(V=e.jsxs(e.Fragment,{children:[V,fo]})),W?W(V):V},[Ue,Ke,wn,Sn,hn,Le,Tn,fo,_,W]),ki=n.useMemo(()=>e.jsx(y.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:uo,title:e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:xn}),placement:yn,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,xn,yn,bt,xt]),vi=n.useMemo(()=>({boxSizing:"border-box",background:V=>V.palette.mode!=="dark"?Se.header.fill:V.palette.background.paper,"& *":{...y.scrollbarTheming(_),fontWeight:400},"&.Mui-focusVisible":{},"& .viewport-overlay":{borderRight:`solid ${ot} 1px`},...m}),[m,Se]),ji=n.useMemo(()=>e.jsx(B.Box,{sx:{marginBottom:V=>V.spacing(.75)}}),[]),Ti=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":Se.body.darkMode&&U?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":Se.body.darkMode?`linear-gradient(${q.alpha("#fff",q.getOverlayAlpha(5))}, ${q.alpha("#fff",q.getOverlayAlpha(5))})`:void 0}),[Se,_,K]),Ei=n.useMemo(()=>ie(Ga),[]);return e.jsxs(B.Paper,{className:ie("sheetxl-workbook",ml,{"Mui-focusVisible":he},ul,c),sx:vi,style:l,square:!1,...Y,ref:ce,onFocus:V=>{re(!0),pi(),u?.(V)},onBlur:V=>{re(!1),C?.(V)},onKeyDown:V=>{mi(V),x?.(V)},onDragStart:V=>{if(V.target.src){const ne=new Image;ne.src=V.target.src,V.dataTransfer.setDragImage(ne,1,1)}},onDragEnter:go,onDragLeave:go,onDragOver:go,onDrop:xi,children:[e.jsxs("div",{className:Ei,style:Ti,children:[ii,ai?Ci:null,ji,wi,ri,ki,ci,bi]}),yi]})}));ln.displayName="WorkbookElement";const jl=(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:m=!1,hidden:l,...c}=a,[u,C]=n.useState(!1),[x,f]=n.useState(!1),[p,b]=n.useState(r??""),[S,h]=n.useState(""),[g,{width:k}]=$e(),[j,{width:v}]=$e(),[T,M]=n.useState(!1),R=n.useRef(null),D=n.useRef(null),F=w.useImperativeElement(i,()=>({requestWorkbookTitle:(E=null,P)=>{D.current={onAccept:E,requestReason:P?.requestReason},P?.selectAll&&R.current?.select(),R.current?.focus(P)},focus:E=>{R.current?.focus(E)}}),[]);return n.useLayoutEffect(()=>{M(r!==p),h(r),b(r)},[r]),n.useEffect(()=>{T&&k!==0&&je.CommonUtils.debounce(()=>{M(!1)},300)()},[T,k]),n.useEffect(()=>{f(p&&!ct.IOUtils.isValidWindowsFilename(p))},[p]),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":u}),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",...jl(!0,m),...o},children:[m?e.jsx(B.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:p!==S?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:E=>x?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=>x?E.palette.error.dark:void 0,fontStyle:p!==S?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:m,spellCheck:!1,placeholder:s,onFocus:E=>{C(!0),E.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:R},onBlur:()=>{C(!1),x?b(S):(p!==S&&(d?.(p),p&&D.current?.onAccept?.(p,"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?(x?b(S):(d?.(p),p&&(D.current?.onAccept?.(p,"keydown"),D.current=null)),E.stopPropagation(),E.preventDefault(),t?.focus()):E.which===w.KeyCodes.Escape&&(p===S?t?.focus():(b(S),setTimeout(()=>{E.target?.select()},0)),D.current=null,E.stopPropagation(),E.preventDefault())},value:p}),e.jsx(B.Box,{ref:g,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:p!==S?"italic":void 0,fontFamily:E=>E.typography.fontFamily,letterSpacing:"0.00938em"},children:p||s})]})})})}));sn.displayName="WorkbookTitle";const Tl=n.memo(n.forwardRef((a,i)=>{const{title:o,commands:t,className:r,...s}=a,d=w.useNotifier(),[m,l]=n.useState(!1),[c,u]=n.useState(!1),C=n.useRef(null),[x,f]=n.useReducer(R=>R+1,0),[p,{width:b}]=$e(),S=w.useCommands(t,["editTable"])[0].context(),h=S.table(),[g,k]=n.useState(()=>h?S.getNames().getRanges(h.getRange()):null),j=n.useMemo(()=>h?.getName()??"",[h]);oe.useModelListener(S.table(),{onAnchorCoordsChange(R){k(S.getNames().getRanges(R.getRange()))},onProtectedChange(R){f()}});const v=w.useCallbackRef(R=>{S?.table().setName(R)},[S]),T=w.useCallbackRef(R=>{S?.table().resize(R.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:R=>{C?.current?.contains(R.relatedTarget)||l(!1)},ref:et([C,p,i]),sx:{display:"flex",flexDirection:"column",flex:"1 1 auto",width:"100%",height:"100%",overflow:"auto",paddingLeft:R=>R.spacing(1.5),paddingRight:R=>R.spacing(1.5),paddingTop:R=>R.spacing(1.5),paddingBottom:R=>R.spacing(1.5),boxSizing:"border-box"},className:ie("sxl-table-details-panel",r,{"sxl-has-focus":m}),...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:R=>R.spacing(2),paddingLeft:R=>R.spacing(2),paddingRight:R=>R.spacing(2)},children:e.jsxs(B.Box,{className:Ui,children:[e.jsx(Ko,{formName:"name",defaultInput:j,value:h?.getName()??"No table",onChangeInput:v,onValidate:R=>{h&&h.getName().toLowerCase()===R.toLowerCase()||S?.getNames().validateName(R)},disabled:h?.isProtected()??!0,onFocus:R=>{c||R.target?.select(),u(!0)}}),e.jsx(Uo,{formName:"range",value:g,onChangeInput:T,resolvedAddress:S.getNames().getRanges.bind(S.getNames()),disabled:h?.isProtected()??!0,onFocus:R=>{c||R.target?.select(),u(!0)}})]})}),e.jsxs(B.Box,{sx:{minHeight:"10px",flex:"1 1 100%",display:"flex",flexDirection:"column",containerType:"inline-size",gap:R=>R.spacing(.5),marginTop:R=>R.spacing(1)},children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:R=>R.spacing(1.5),marginBottom:R=>R.spacing(.75)}}),e.jsx(Ya,{disabled:h?.isProtected(),styleOptions:h?.getStyleOptions()??null,onStyleOptionsChange:R=>{h.updateStyleOptions(R)},showHeaderRow:h?.getShowHeaders(),onShowHeaderRowChange:R=>{try{h.setShowHeaders(R)}catch(D){d.showError(D)}},showTotalRow:h?.getShowTotals(),onShowTotalRowChange:R=>{try{h.setShowTotals(R)}catch(D){d.showError(D)}},showFilterButton:h?.getFilter()?h.getShowFilterButton():null,onShowFilterButtonChange:R=>{try{h.setShowFilterButton(R)}catch(D){d.showError(D)}}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:R=>R.spacing(1.5),marginBottom:R=>R.spacing(.75)}}),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",justifyContent:"start",flexDirection:"column",marginTop:R=>R.spacing(2),marginBottom:R=>R.spacing(1)},children:e.jsxs("div",{style:{display:"flex",alignItems:"start",gap:"2px"},children:[e.jsx(_o,{table:h,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"}),e.jsxs(B.Box,{className:qi,children:[e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,command:t.getCommand("convertTableToRange"),commandState:h}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:h,command:t.getCommand("deleteTable")})]})]})]})})})),El=n.memo(a=>{const{table:i,tableStyle:o,selectedTableStyleName:t,onSelectTableStyleName:r,styles:s,hasContextMenu:d=!0,bodyStyle:m,parentFloat:l,commands:c,disabled:u,commandHook:C,useCanvasPreview:x=!0,canvas:f,...p}=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:u}),e.jsx(y.CommandButton,{...j,style:{fontWeight:550},command:c.getCommand("formatTableStyle"),commandState:{name:o.getName()},disabled:u}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:c.getCommand("setDefaultTableStyle"),commandState:o.getName(),disabled:u}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:c.getCommand("deleteTableStyle"),commandState:o?.getName(),disabled:u||!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,h=n.useMemo(()=>{const k={table:i,tableStyle:o,styles:s,bodyStyle:m};return x?e.jsx(Xa,{canvas:f,...k}):e.jsx(_o,{...k})},[i,o,s,m]);let g=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:u,icon:null,onClick:()=>{r?.(o?.getName())},...p,children:h},o.getName());return d&&(g=e.jsx(y.ContextMenu,{label:i.getStyleOptions().name,parentFloat:l,createPopupPanel:b,children:g})),g}),cn=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedTable:s,onSelectTableStyleName:d,disabled:m=!1,bodyStyle:l,disabledQuickKey:c=!1,usePreviewIcon:u=!1,...C}=a;w.useCommand(t);const x=t?.context(),f=x?.styles,p=s??x?.table?.();let b="insertTable";p&&(b="editTable");const S=n.useMemo(()=>((F,E)=>{const P={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new A.Table({initialAnchor:P,styles:E,json:{name:"PreviewTable",ref:P,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:F}})})(p?.getStyleOptions(),f?.()),[f?.().getDefaultTableStyle(),p?.getStyleOptions()]),h=p??S,[g,k]=n.useState(h);n.useEffect(()=>{k(h)},[h]);const j=l??x?.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 P={onSelectTableStyleName:v,styles:f(),parentFloat:F.floatReference};T.current||(T.current=document.createElement("canvas"));const I=$=>{const U=f().getTableStyle($);return U?e.jsx(El,{table:g,tableStyle:U,selectedTableStyleName:g.getStyleOptions().name,bodyStyle:x.bodyStyle(),commands:E,commandHook:r,canvas:T.current,...P},$):null},z=($,U,Y=!0)=>{const _=[];for(let L=0;L<U.length;L++){const G=I(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")]},$)},N=[],H=f().getCustomTableStyles(),O=[];if(H.length>0){for(let $=0;$<H.length;$++)H[$].isShownInTableStyles()&&O.push(H[$].getName());N.push(z("Custom",O,!1))}const W=[];p&&!p.getStyleOptions().name&&W.push(null);for(let $=0;$<21;$++)W.push("TableStyleLight"+($+1));N.push(z("Light",W,O.length>0));const ee=[];for(let $=0;$<28;$++)ee.push("TableStyleMedium"+($+1));N.push(z("Medium",ee));const X=[];for(let $=0;$<11;$++)X.push("TableStyleDark"+($+1));N.push(z("Dark",X));let ae=null;return p&&(ae=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:m})]})),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:N}),ae]})},[f,f?.().getTheme(),j,g]),R=m||!t||t.disabled(),D=n.useMemo(()=>{if(!x||!u)return t?.icon()},[g,j,R,t]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:c?void 0:b,createPopupPanel:M,commands:o,label:t?.label(),commandState:p,commandHook:r,selected:p!==null,createTooltip:({children:F},E)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:E,children:F}),disabled:R,icon:D,...C})})),Br=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,selectedTheme:r,onSelectTheme:s,disabled:d=!1,darkMode:m,label:l,icon:c,variant:u,...C}=a;w.useCommand(o);const x=o?.context()?.themes,f=r||o?.context()?.theme,p=m??o?.context()?.darkMode,b=d||o?.disabled(),S=w.useCallbackRef(g=>{s?.(g),o?.execute(g,t)},[s,t]),h=n.useCallback((g,k)=>{const{children:j,title:v,...T}=g;let M=g.children;return(b||k)&&(M=e.jsx("div",{children:M})),e.jsx(y.CommandTooltip,{command:o,placement:u===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:b||k,...T,children:M})},[o,b]);return e.jsx(or,{ref:i,themes:x,selectedTheme:f,onSelectTheme:S,variant:u===w.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:h,disabled:b,darkMode:p,...C})})),Rr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,m=w.useCommands(o,["themeMode"])[0],l=w.useCallbackRef((f,p)=>{const b={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:s},S=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...b,command:m}),e.jsx(y.CommandButton,{...b,command:p.getCommand("defaultThemeMode")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...b,command:p.getCommand("enableDarkGrid")}),e.jsx(y.CommandButton,{...b,command:p.getCommand("enableDarkImages")})]});return y.defaultCreatePopupPanel({...f,children:S})},[s,m,t,r]),c=m?.state(),u=B.useMediaQuery("(prefers-color-scheme: dark)"),C=c==="dark"||c===null&&u,x=m?.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:()=>{m?.execute(C?"light":"dark",t)},selected:x,...d})})),Pr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,sx:d,...m}=a,l=n.useCallback((c,u)=>{const C={variant:w.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(f,p)=>t?.beforeExecute?.(f,p)!==!1&&c.floatReference.closeAll()},disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...C,command:u.getCommand("showKeyboardShortcuts")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...C,command:u.getCommand("gotoUrlGithub")}),e.jsx(y.CommandButton,{...C,command:u.getCommand("gotoUrlDiscord")}),e.jsx(y.CommandButton,{...C,command:u.getCommand("gotoUrlDocumentation")}),e.jsx(y.CommandButton,{...C,command:u.getCommand("gotoUrlIssue")})]});return y.defaultCreatePopupPanel({...c,children:x})},[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)"}}),...m})})),dn=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."})}));dn.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])),Bl=n.memo(a=>{const{command:i,formulaFunction:o,commandHook:t,disabled:r=!1,parentFloat:s,handleInsert:d,icon:m,label:l,sx:c,...u}=a,C=new Promise(x=>{o.getDescriptor().then(f=>{x(f.getSummary())})});return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...c},disabled:r,tooltipProps:{label:C,maxWidth:1e3},onMouseDown:x=>{x.button===0&&x.preventDefault()},onMouseUp:x=>{x.button===0&&d(o)},onKeyDown:x=>{x.keyCode===w.KeyCodes.Enter||(x.keyCode,w.KeyCodes.Space)},...u,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()})})})}),Mr=n.memo(n.forwardRef((a,i)=>{const{category:o,commands:t,commandHook:r,scope:s,sx:d,disabled:m=!1,parentFloat:l,...c}=a,u=w.useCommands(t,["insertFunction"])[0],C=n.useCallback((f,p)=>{const b=jo.get(o);if(!b)return console.warn("invalidate category",o),null;const S={commandHook:r,...f},h=e.jsx(Rl,{category:b.label,...S,commands:p});return y.defaultCreatePopupPanel({...f,children:h})},[o,u,r,s]),x=jo.get(o);return e.jsx(y.CommandPopupButton,{ref:i,commands:t,commandHook:r,createPopupPanel:C,label:x.label,tooltip:"Insert Function",icon:jo.get(o)?.icon??"FormulaGroup",...c})}));Mr.displayName="InsertFunctionCommandPopupButton";const Rl=n.memo(n.forwardRef((a,i)=>{const{commands:o,category:t,commandHook:r,...s}=a,d=w.useCommands(o,["insertFunction"]),[m,l]=n.useState([]),[c,u]=n.useState(!1);n.useEffect(()=>{(async()=>{u(!0);const S=d[0]?.context(),h=await S.searchByCategory(t);l(h),u(!1)})()},[]);const C=m.length,x=new Array(C),f=o.getCommand("insertFunction"),p=S=>{r?.beforeExecute?.(f,f?.state()),f.execute(S),r?.onExecute?.(f,f?.state())};for(let S=0;S<C;S++){const h=m[S];x[S]=e.jsx(Bl,{command:f,formulaFunction:h,handleInsert:p},`formula-${h.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:x})}):null});return y.defaultCreatePopupPanel({...s,children:b})})),Dr=n.memo(n.forwardRef((a,i)=>{const{sx:o,style:t,className:r,licenseKey:s,renderLoadingPanel:d,...m}=a;s&&A.LicenseManager.setLicenseKey(s);const l=n.useMemo(()=>{const u={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?.(u)??e.jsx(y.LoadingPanel,{...u})})},[o,t,d]),c=n.useMemo(()=>n.lazy(async()=>await Promise.resolve().then(()=>cs)),[]);return e.jsx(e.Fragment,{children:e.jsx(n.Suspense,{fallback:l,children:e.jsx(c,{...m,className:r,renderLoadingPanel:d,sx:o,style:t,ref:i})})})}));function Fr(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=Fr(a[i]))&&(t&&(t+=" "),t+=o);else for(i in a)a[i]&&(t&&(t+=" "),t+=i);return t}function Ve(){for(var a,i,o=0,t="";o<arguments.length;)(a=arguments[o++])&&(i=Fr(a))&&(t&&(t+=" "),t+=i);return t}Dr.displayName="Studio";let Pl={data:""},Ml=a=>typeof window=="object"?((a?a.querySelector("#_goober"):window._goober)||Object.assign((a||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:a||Pl,Dl=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Fl=/\/\*[^]*?\*\/| +/g,sa=/\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,m=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,m):m?m+" "+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},Ne={},Ir=a=>{if(typeof a=="object"){let i="";for(let o in a)i+=o+Ir(a[o]);return i}return a},Il=(a,i,o,t,r)=>{let s=Ir(a),d=Ne[s]||(Ne[s]=(l=>{let c=0,u=11;for(;c<l.length;)u=101*u+l.charCodeAt(c++)>>>0;return"go"+u})(s));if(!Ne[d]){let l=s!==a?a:(c=>{let u,C,x=[{}];for(;u=Dl.exec(c.replace(Fl,""));)u[4]?x.shift():u[3]?(C=u[3].replace(sa," ").trim(),x.unshift(x[0][C]=x[0][C]||{})):x[0][u[1]]=u[2].replace(sa," ").trim();return x[0]})(a);Ne[d]=Qe(r?{["@keyframes "+d]:l}:l,o?"":"."+d)}let m=o&&Ne.g?Ne.g:null;return o&&(Ne.g=Ne[d]),((l,c,u,C)=>{C?c.data=c.data.replace(C,l):c.data.indexOf(l)===-1&&(c.data=u?l+c.data:c.data+l)})(Ne[d],i,t,m),d};function No(a){let i=this||{},o=a.call?a(i.p):a;return Il(o.unshift?o.raw?((t,r,s)=>t.reduce((d,m,l)=>{let c=r[l];if(c&&c.call){let u=c(s),C=u&&u.props&&u.props.className||/^go/.test(u)&&u;c=C?"."+C:u&&typeof u=="object"?u.props?"":Qe(u,""):u===!1?"":u}return d+m+(c??"")},""))(o,[].slice.call(arguments,1),i.p):o.reduce((t,r)=>Object.assign(t,r&&r.call?r(i.p):r),{}):o,Ml(i.target),i.g,i.o,i.k)}function Nr(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 de(){return de=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},de.apply(this,arguments)}function Or(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,a.__proto__=i}function Ot(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 ca(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 da=function(){return""},Ar=n.createContext({enqueueSnackbar:da,closeSnackbar:da}),To="@media (max-width:599.95px)",to="@media (min-width:600px)",ua=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},un=function(a){return""+ua(a.vertical)+ua(a.horizontal)},qt=function(a){return!!a||a===0},Gt="unmounted",at="exited",rt="entering",Bt="entered",ma="exiting",mn=(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}Or(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=ma)}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,m=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(m.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:ma},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,Ot(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Nr(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 pa(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){pa(a,o),pa(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}}mn.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 Nl="cubic-bezier(0.4, 0, 0.2, 1)",Ol="cubic-bezier(0.0, 0, 0.2, 1)",Al="cubic-bezier(0.4, 0, 0.6, 1)",Lr=function(a){a.scrollTop=a.scrollTop},fa=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?Nl:s,m=o.delay,l=m===void 0?0:m;return(Array.isArray(a)?a:[a]).map(function(c){var u=typeof r=="string"?r:fa(r),C=typeof l=="string"?l:fa(l);return c+" "+u+" "+d+" "+C}).join(",")}function zr(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(),m=zr(r);if(r.fakeTransform)s=r.fakeTransform;else{var l=m.getComputedStyle(r);s=l.getPropertyValue("-webkit-transform")||l.getPropertyValue("transform")}var c=0,u=0;if(s&&s!=="none"&&typeof s=="string"){var C=s.split("(")[1].split(")")[0].split(",");c=parseInt(C[4],10),u=parseInt(C[5],10)}switch(t){case"left":return"translateX("+(m.innerWidth+c-d.left)+"px)";case"right":return"translateX(-"+(d.left+d.width-c)+"px)";case"up":return"translateY("+(m.innerHeight+u-d.top)+"px)";default:return"translateY(-"+(d.top+d.height-u)+"px)"}})(a,i);o&&(i.style.webkitTransform=o,i.style.transform=o)}}var Hr=n.forwardRef(function(a,i){var o=a.children,t=a.direction,r=t===void 0?"down":t,s=a.in,d=a.style,m=a.timeout,l=m===void 0?0:m,c=a.onEnter,u=a.onEntered,C=a.onExit,x=a.onExited,f=Ot(a,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),p=n.useRef(null),b=Oo(o.ref,p),S=Oo(b,i),h=n.useCallback(function(){p.current&&Xt(r,p.current)},[r]);return n.useEffect(function(){if(!s&&r!=="down"&&r!=="right"){var g=(function(j,v){var T;function M(){for(var R=this,D=arguments.length,F=new Array(D),E=0;E<D;E++)F[E]=arguments[E];clearTimeout(T),T=setTimeout(function(){j.apply(R,F)},v)}return v===void 0&&(v=166),M.clear=function(){clearTimeout(T)},M})(function(){p.current&&Xt(r,p.current)}),k=zr(p.current);return k.addEventListener("resize",g),function(){g.clear(),k.removeEventListener("resize",g)}}},[r,s]),n.useEffect(function(){s||h()},[s,h]),n.createElement(mn,Object.assign({appear:!0,nodeRef:p,onEnter:function(g,k){Xt(r,g),Lr(g),c&&c(g,k)},onEntered:u,onEntering:function(g){var k=d?.transitionTimingFunction||Ol,j=ao({timeout:l,mode:"enter",style:de({},d,{transitionTimingFunction:k})});g.style.webkitTransition=ut("-webkit-transform",j),g.style.transition=ut("transform",j),g.style.webkitTransform="none",g.style.transform="none"},onExit:function(g){var k=d?.transitionTimingFunction||Al,j=ao({timeout:l,mode:"exit",style:de({},d,{transitionTimingFunction:k})});g.style.webkitTransition=ut("-webkit-transform",j),g.style.transition=ut("transform",j),Xt(r,g),C&&C(g)},onExited:function(g){g.style.webkitTransition="",g.style.transition="",x&&x(g)},in:s,timeout:l},f),function(g,k){return n.cloneElement(o,de({ref:S,style:de({visibility:g!=="exited"||s?void 0:"hidden"},d,{},o.props.style)},k))})});Hr.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))},Ll=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
- 10.59L10 14.17L17.59 6.58L19 8L10 17Z`}))},zl=function(){return n.createElement(co,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Hl=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
- 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,
17
- 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z`}))},Wl=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(Ll,null),warning:n.createElement(zl,null),error:n.createElement(Hl,null),info:n.createElement(Wl,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:Hr,transitionDuration:{enter:225,exit:195}},$l=function(a,i){return function(o,t){return t===void 0&&(t=!1),t?de({},Ze[o],{},i[o],{},a[o]):o==="autoHideDuration"?(r=a.autoHideDuration,s=i.autoHideDuration,(d=function(m){return typeof m=="number"||m===null})(r)?r:d(s)?s:Ze.autoHideDuration):o==="transitionDuration"?(function(m,l){var c=function(u,C){return C.some(function(x){return typeof u===x})};return c(m,["string","number"])?m:c(m,["object"])?de({},Ze.transitionDuration,{},c(l,["object"])&&l,{},m):c(l,["string","number"])?l:c(l,["object"])?de({},Ze.transitionDuration,{},l):Ze.transitionDuration})(a.transitionDuration,i.transitionDuration):a[o]||i[o]||Ze[o];var r,s,d}};function At(a){return Object.entries(a).reduce(function(i,o){var t,r=o[0],s=o[1];return de({},i,((t={})[r]=No(s),t))},{})}var Vl="notistack-SnackbarContainer",_l="notistack-Snackbar",Wr="notistack-CollapseWrapper",Kl="notistack-MuiContent",Ul=function(a){return"notistack-MuiContent-"+a},ha=At({root:{height:0},entered:{height:"auto"}}),Eo="0px",$r=n.forwardRef(function(a,i){var o=a.children,t=a.in,r=a.onExited,s=n.useRef(null),d=n.useRef(null),m=Oo(i,d),l=function(){return s.current?s.current.clientHeight:0};return n.createElement(mn,{in:t,unmountOnExit:!0,onEnter:function(c){c.style.height=Eo},onEntered:function(c){c.style.height="auto"},onEntering:function(c){var u=l(),C=ao({timeout:175,mode:"enter"}),x=C.duration,f=C.easing;c.style.transitionDuration=typeof x=="string"?x:x+"ms",c.style.height=u+"px",c.style.transitionTimingFunction=f||""},onExit:function(c){c.style.height=l()+"px"},onExited:r,onExiting:function(c){Lr(c);var u=ao({timeout:175,mode:"exit"}),C=u.duration,x=u.easing;c.style.transitionDuration=typeof C=="string"?C:C+"ms",c.style.height=Eo,c.style.transitionTimingFunction=x||""},nodeRef:d,timeout:175},function(c,u){return n.createElement("div",Object.assign({ref:m,className:Ve(ha.root,c==="entered"&&ha.entered),style:de({pointerEvents:"all",overflow:"hidden",minHeight:Eo,transition:ut("height")},c==="entered"&&{overflow:"visible"},{},c==="exited"&&!t&&{visibility:"hidden"})},u),n.createElement("div",{ref:s,className:Wr,style:{display:"flex",width:"100%"}},o))})});$r.displayName="Collapse";var ga={right:"left",left:"right",bottom:"up",top:"down"},ql=function(a){return"anchorOrigin"+un(a)},Gl=function(){};function Ft(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 m=[].concat(s);i&&m.indexOf(i)===-1&&m.push(i),o.apply(this,m),t.apply(this,m)}},Gl)}var Xl=typeof window<"u"?n.useLayoutEffect:n.useEffect;function xa(a){var i=n.useRef(a);return Xl(function(){i.current=a}),n.useCallback(function(){return i.current.apply(void 0,arguments)},[])}var Bo,Vr=n.forwardRef(function(a,i){var o=a.children,t=a.className,r=a.autoHideDuration,s=a.disableWindowBlurListener,d=s!==void 0&&s,m=a.onClose,l=a.id,c=a.open,u=a.SnackbarProps,C=u===void 0?{}:u,x=n.useRef(),f=xa(function(){m&&m.apply(void 0,arguments)}),p=xa(function(h){m&&h!=null&&(x.current&&clearTimeout(x.current),x.current=setTimeout(function(){f(null,"timeout",l)},h))});n.useEffect(function(){return c&&p(r),function(){x.current&&clearTimeout(x.current)}},[c,r,p]);var b=function(){x.current&&clearTimeout(x.current)},S=n.useCallback(function(){r!=null&&p(.5*r)},[r,p]);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:Ve(_l,t),onMouseEnter:function(h){C.onMouseEnter&&C.onMouseEnter(h),b()},onMouseLeave:function(h){C.onMouseLeave&&C.onMouseLeave(h),S()}}),o)});Vr.displayName="Snackbar";var Yl=At({root:(Bo={display:"flex",flexWrap:"wrap",flexGrow:1},Bo[to]={flexGrow:"initial",minWidth:"288px"},Bo)}),pn=n.forwardRef(function(a,i){var o=a.className,t=Ot(a,["className"]);return n.createElement("div",Object.assign({ref:i,className:Ve(Yl.root,o)},t))});pn.displayName="SnackbarContent";var Rt=At({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"}}),ba="notistack-snackbar",_r=n.forwardRef(function(a,i){var o=a.id,t=a.message,r=a.action,s=a.iconVariant,d=a.variant,m=a.hideIconVariant,l=a.style,c=a.className,u=s[d],C=r;return typeof C=="function"&&(C=C(o)),n.createElement(pn,{ref:i,role:"alert","aria-describedby":ba,style:l,className:Ve(Kl,Ul(d),Rt.root,Rt[d],c,!m&&u&&Rt.lessPadding)},n.createElement("div",{id:ba,className:Rt.message},m?null:u,t),C&&n.createElement("div",{className:Rt.action},C))});_r.displayName="MaterialDesignContent";var Pt,Ro,Yt,Zt,Po,Zl=n.memo(_r),Ql=At({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Jl=function(a){var i=n.useRef(),o=n.useState(!0),t=o[0],r=o[1],s=Ft([a.snack.onClose,a.onClose]),d=n.useCallback(function(){i.current=setTimeout(function(){r(function(R){return!R})},125)},[]);n.useEffect(function(){return function(){i.current&&clearTimeout(i.current)}},[]);var m,l=a.snack,c=a.classes,u=a.Component,C=u===void 0?Zl:u,x=n.useMemo(function(){return(function(R){R===void 0&&(R={});var D={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(R).filter(function(F){return!D[F]}).reduce(function(F,E){var P;return de({},F,((P={})[E]=R[E],P))},{})})(c)},[c]),f=l.open,p=l.SnackbarProps,b=l.TransitionComponent,S=l.TransitionProps,h=l.transitionDuration,g=l.disableWindowBlurListener,k=l.content,j=Ot(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),v=de({direction:(m=j.anchorOrigin,m.horizontal!=="center"?ga[m.horizontal]:ga[m.vertical]),timeout:h},S),T=k;typeof T=="function"&&(T=T(j.id,j.message));var M=["onEnter","onEntered","onExit","onExited"].reduce(function(R,D){var F;return de({},R,((F={})[D]=Ft([a.snack[D],a[D]],j.id),F))},{});return n.createElement($r,{in:t,onExited:M.onExited},n.createElement(Vr,{open:f,id:j.id,disableWindowBlurListener:g,autoHideDuration:j.autoHideDuration,className:Ve(Ql.wrappedRoot,x.root,x[ql(j.anchorOrigin)]),SnackbarProps:p,onClose:s},n.createElement(b,Object.assign({},v,{appear:!0,in:f,onExit:M.onExit,onExited:d,onEnter:M.onEnter,onEntered:Ft([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},ya="."+Wr,Jt=At({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[ya]={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[ya]={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)}),es=function(a){var i=a.classes,o=i===void 0?{}:i,t=a.anchorOrigin,r=a.dense,s=a.children,d=Ve(Vl,Jt[t.vertical],Jt[t.horizontal],Jt.root,o.containerRoot,o["containerAnchorOrigin"+un(t)],r&&Jt.rootDense);return n.createElement("div",{className:d},s)},ts=n.memo(es),Ca=function(a){return!(typeof a=="string"||n.isValidElement(a))},os=(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=Ca(r)?r:s,m=Ca(r)?r.message:r,l=d.key,c=d.preventDuplicate,u=Ot(d,["key","preventDuplicate"]),C=qt(l),x=C?l:new Date().getTime()+Math.random(),f=$l(u,t.props),p=de({id:x},u,{message:m,open:!0,entered:!1,requestClose:!1,persist:f("persist"),action:f("action"),content:f("content"),variant:f("variant"),anchorOrigin:f("anchorOrigin"),disableWindowBlurListener:f("disableWindowBlurListener"),autoHideDuration:f("autoHideDuration"),hideIconVariant:f("hideIconVariant"),TransitionComponent:f("TransitionComponent"),transitionDuration:f("transitionDuration"),TransitionProps:f("TransitionProps",!0),iconVariant:f("iconVariant",!0),style:f("style",!0),SnackbarProps:f("SnackbarProps",!0),className:Ve(t.props.className,u.className)});return p.persist&&(p.autoHideDuration=void 0),t.setState(function(b){if(c===void 0&&t.props.preventDuplicate||c){var S=function(k){return C?k.id===x:k.message===m},h=b.queue.findIndex(S)>-1,g=b.snacks.findIndex(S)>-1;if(h||g)return b}return t.handleDisplaySnack(de({},b,{queue:[].concat(b.queue,[p])}))}),x},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?de({},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 m=r.snacks.map(function(l){return s||l.persist&&!d?de({},l):(s=!0,l.entered?(l.onClose&&l.onClose(null,"maxsnack",l.id),t.props.onClose&&t.props.onClose(null,"maxsnack",l.id),de({},l,{open:!1})):de({},l,{requestClose:!0}))});return de({},r,{snacks:m})},t.handleEnteredSnack=function(r,s,d){if(!qt(d))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState(function(m){return{snacks:m.snacks.map(function(l){return l.id===d?de({},l,{entered:!0}):de({},l)})}})},t.handleCloseSnack=function(r,s,d){t.props.onClose&&t.props.onClose(r,s,d);var m=d===void 0;t.setState(function(l){var c=l.snacks,u=l.queue;return{snacks:c.map(function(C){return m||C.id===d?C.entered?de({},C,{open:!1}):de({},C,{requestClose:!0}):de({},C)}),queue:u.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 m=t.processQueue(de({},d,{snacks:d.snacks.filter(function(l){return l.id!==s})}));return m.queue.length===0?m:t.handleDismissOldest(m)})},t.enqueueSnackbar,t.closeSnackbar,t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar.bind(ca(t)),closeSnackbar:t.closeSnackbar.bind(ca(t))}},t}return Or(i,a),i.prototype.render=function(){var o=this,t=this.state.contextValue,r=this.props,s=r.domRoot,d=r.children,m=r.dense,l=m!==void 0&&m,c=r.Components,u=c===void 0?{}:c,C=r.classes,x=this.state.snacks.reduce(function(p,b){var S,h=un(b.anchorOrigin),g=p[h]||[];return de({},p,((S={})[h]=[].concat(g,[b]),S))},{}),f=Object.keys(x).map(function(p){var b=x[p],S=b[0];return n.createElement(ts,{key:p,dense:l,anchorOrigin:S.anchorOrigin,classes:C},b.map(function(h){return n.createElement(Jl,{key:h.id,snack:h,classes:C,Component:u[h.variant],onClose:o.handleCloseSnack,onEnter:o.props.onEnter,onExit:o.props.onExit,onExited:Ft([o.handleExitedSnack,o.props.onExited],h.id),onEntered:Ft([o.handleEnteredSnack,o.props.onEntered],h.id)})}))});return n.createElement(Ar.Provider,{value:t},d,s?Je.createPortal(f,s):f)},Nr(i,[{key:"maxSnack",get:function(){return this.props.maxSnack||Ze.maxSnack}}]),i})(n.Component),Kr=function(){return n.useContext(Ar)};const ns=[{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}],as=[{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 Ur{constructor(i=ns,o=as){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 We=new Ur,Oe={card:"_card_1a398_7",actionRoot:"_actionRoot_1a398_11",icons:"_icons_1a398_16",expand:"_expand_1a398_22",expandOpen:"_expandOpen_1a398_29",stackTraceContainer:"_stackTraceContainer_1a398_33"},qr=n.memo(n.forwardRef((a,i)=>{const{id:o,message:t,iconVariant:r,error:s,hideIconVariant:d,...m}=a,{closeSnackbar:l}=Kr(),c=q.useTheme(),[u,C]=n.useState(!1),x=je.ErrorUtils.collectErrorChain(s,!0)?.[0]?.error,f=x&&!(x instanceof je.ExpectedError),p=n.useCallback(()=>{C(h=>!h)},[]),b=n.useCallback(()=>{l(o)},[o,l]);let S=x?.message;return!S&&n.isValidElement(t)&&(S=t),S||typeof t!="string"||(S=t),S||(S=`Unknown Error: ${t}`),e.jsx(pn,{ref:i,className:ie(Oe.root,"error-snackbar"),children:e.jsxs(B.Card,{className:Oe.card,style:{backgroundColor:c.palette.error.dark,border:`1px solid ${c.palette.error.dark}`},children:[e.jsxs(B.CardActions,{className:Oe.actionRoot,children:[d?null:r?.error,e.jsx(B.Typography,{variant:"body2",component:"div",className:Oe.typography,children:S}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Oe.icons,children:[f?e.jsx(B.IconButton,{"aria-label":"Show more",size:"small",className:ie(Oe.expand,{[Oe.expandOpen]:u}),onClick:p,children:e.jsx(w.DynamicIcon,{iconKey:"ExpandMore"})}):null,e.jsx(B.IconButton,{size:"small",className:Oe.expand,onClick:b,children:e.jsx(w.DynamicIcon,{iconKey:"Close",style:{transform:"scale(0.8)"}})})]})]}),f?e.jsx(B.Collapse,{in:u,timeout:"auto",children:e.jsx("div",{className:Oe.stackTraceContainer,style:{backgroundColor:c.palette.error.light,borderTop:`1px solid ${c.palette.error.main}`},children:e.jsx(y.StackTrace,{error:s,hideLineNumbers:!0})})}):null]})})}));qr.displayName="ToastError";const Gr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="workbook",disabled:s=!1,...d}=a,m=w.useCallbackRef(c=>{const u={variant:w.CommandButtonType.Menuitem,parentFloat:c.floatReference,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:o.getCommand("newWorkbook")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:o.getCommand("openWorkbook")}),e.jsx(y.CommandPopupButton,{...u,commands:o,quickCommand:"saveWorkbook",createPopupPanel:x=>{const f={...u,parentFloat:x.floatReference,scope:"saveWorkbook"},p=[];return We.getWriteFormats().forEach(b=>{if(b.isDefault)return;const S=b.key,h=o.getCommand(`saveWorkbookAs${S}`);h?p.push(n.createElement(y.CommandButton,{...f,key:S,command:h})):console.warn(`Unable to resolve command: 'saveWorkbookAs${S}'`)}),y.defaultCreatePopupPanel({...x,children:p,onClick:()=>{x.closeFloatAll()}})}})]});return y.defaultCreatePopupPanel({...c,children:C,onClick:x=>{x.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:m,icon:e.jsx(y.LabelIcon,{className:"label",icon:null,label:l})})}));Gr.displayName="StandaloneFileCommandButton";const rs=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"}})})}),Xr=n.memo(n.forwardRef((a,i)=>{const{commands:o,workbook:t,logo:r=rs,mainElement:s,showFileMenu:d=!0,showAppearanceMenu:m=!0,...l}=a,{reference:c}=y.useFloatStack(),[u,{width:C}]=$e(),x=C<530,f=d?e.jsx(Gr,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(h,g,k){}}}):null,p=m?e.jsx(Rr,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(h,g,k){}}}):null,b=n.useMemo(()=>({paddingLeft:h=>h.spacing(1),paddingRight:h=>h.spacing(1)}),[]),S=n.useRef(null);return e.jsx(B.Box,{ref:et([S,u,i]),...l,children:kr({commands:o,renderCompact:x,workbook:t,selectWrapper:h=>e.jsxs(B.Box,{sx:{display:"flex",flex:"1",flexDirection:"row",alignItems:"stretch",gap:g=>g.spacing(1),paddingLeft:g=>g.spacing(1),paddingRight:g=>g.spacing(1)},children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:g=>g.spacing(.5)},children:[r,e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:g=>g.spacing(.25)},children:[f,h]})]}),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:x&&!p?"0 0 auto":"1 1 100%"},children:p})]}),selectProps:b,toolbarsProps:{Home:{sx:{}}}})})}));Xr.displayName="StudioToolbar";const Yr=n.memo(a=>{const{workbook:i,setWorkbook:o,refWorkbookTitle:t,titleWorkbook:r,setWorkbookTitle:s,titlePlaceHolder:d,children:m,undoManager:l,commands:c,importExportDisabled:u,themeOptions:C}=a,x=(b=>{const{workbook:S,setWorkbook:h,importExportDisabled:g,workbookTitle:k="export",setWorkbookTitle:j,requestWorkbookTitle:v,themeOptions:T,undoManager:M,commands:R,onExecute:D}=b,F=w.useNotifier(),E=w.useCallbackRef(T?.onModeChange,[T?.onModeChange]),P=w.useCallbackRef(T?.onEnabledDarkGridChange,[T?.onEnabledDarkGridChange]),I=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??We.getAllReadFormatTypeAsString().join(",")),!_)return null;const Q={source:_,createWorkbookOptions:U,onWarning:re=>{Y.push(re)}},he=await We.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
- `+Y.join(`
20
- `))),he},[D,F,S]),N=w.useCallbackRef(async($,U,Y)=>{if(!U&&v){const _=await v("Enter Workbook name to "+(Y.isDefault?"Save.":`Export as ${Y.description}.`));return _!==null&&We.writeFile(_,$,{formatType:Y.key})}return We.writeFile(U,$,{formatType:Y.key})},[F,S,v]),H=n.useCallback(()=>({contains:$=>!0,focus(){}}),[]),O=n.useMemo(()=>{const $=[];g||(We.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."},()=>{N(S,null,Y).catch(he=>{F.showError(he)})})));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,he=>{N(S,he??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,he=Q.getSelectedSheet();if(L.formatType.mimeType==="text/csv"){const re=S.findValidSheetName(G);await S.doBatch(async()=>{const pe={colStart:0,rowStart:0,colEnd:0,rowEnd:0};let Ce=he.getUsedRange();if(!Ce)return void F.showMessage("The file appears to be blank.");Ce=Ce.getUnion(pe),await S.getSheets().add({name:re,autoSelect:!0}).getRange(pe).copyFrom(Ce)},`Import CSV '${G}'`)}else S?.close(),j?.(G),h(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.showInputOptions({title:"Open Workbook from the Web",description:"Enter the web address for the workbook to open.",inputLabel:"Address",initialValue:"https://www.sheetxl.com/examples/features-checklist.xlsx",inputProps:{style:{minWidth:"440px"}},options:["Open"]});if(_.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,g,T,R,M]),W=n.useMemo(()=>{let $=null;return $=R?R.createChildGroup(H,"standaloneWorkbook",!1):new w.CommandGroup(H,"standaloneWorkbook"),$.addCommands(O,!0),$},[R,O]);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(()=>{P(!T.enableDarkGrid)}),W.getCommand("enableDarkImages").update({state:T.enableDarkImages}).updateCallback(()=>{I(!T.enableDarkImages)})},[X,T,O]);const{showModal:ae}=y.useModal();return n.useEffect(()=>{const $=()=>new Promise((U,Y)=>{const _=n.lazy(()=>Promise.resolve().then(()=>require("./UoOVKSpyeYQ3Z04Y.cjs"))),L=ae(_,{title:"Shortcut Keys Reference",commands:W,onDone:()=>{L.hide()},slotProps:{transition:{onExited:()=>{U(!0)}}}})});W.getCommand("showKeyboardShortcuts").updateCallback(()=>$()),W.getCommand("help").updateCallback(()=>$())},[O,W]),W})({workbook:i,setWorkbook:o,importExportDisabled:u,workbookTitle:r,setWorkbookTitle:s,commands:c,requestWorkbookTitle:b=>new Promise(S=>{t.current?t.current.requestWorkbookTitle((h,g)=>{S(h)},{selectAll:!0,requestReason:b}):S(d)}),themeOptions:C,undoManager:l,onExecute:n.useCallback(()=>{},[])}),f=n.useMemo(()=>e.jsx(Pr,{commands:x,disableHover:!0,sx:{padding:"0"},buttonProps:{sx:{maxHeight:"22px"}}}),[x]),p={commands:x};return i&&(p.statusBarProps={childrenEnd:f}),m?n.cloneElement(m,p):null});Yr.displayName="CommandsWrapper";const Zr=n.memo(a=>{const{children:i}=a,o=Kr(),t=o?o.enqueueSnackbar:()=>{},r=o?o.closeSnackbar:()=>{},[s,d]=n.useState({isMounted:!1,label:null,starting:new Map,running:new Map}),m=n.useCallback(()=>{d(h=>({...h,isMounted:!0}))},[]),l=n.useCallback(()=>{d(h=>({...h,isMounted:!1}))},[]),c={},u=y.useLazyWindow(c),C=y.useOptionsDialog(c),x=y.useInputDialog(c),f=n.useRef(new Set),p=n.useMemo(()=>{const h=(j,v)=>{if(v?.onceKey){if(f.current.has(v.onceKey))return;const M=new Set(f.current);M.add(v.onceKey),f.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)},g={showMessage:h,showBusy:(j,v)=>{let T=null;const M=new Promise(R=>{T=R});return d(R=>{const D=new Map(R.starting);return D.set(M,T),{...R,label:j,starting:D}}),M},showWindow:(j,v,T)=>{const M={...v,onKeyDown:R=>{R.isDefaultPrevented()||R.isPropagationStopped()||v?.onKeyDown?.(R)}};return u(j,{sort:()=>Promise.resolve().then(()=>require("./Q234HX63V75h22HJ.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./CJW4-NCdaLzNEwgK.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./DPenF_1mYgI8WaQf.cjs")),comments:()=>Promise.resolve().then(()=>require("./WN5FOSGC22Jy3dxz.cjs")),find:()=>Promise.resolve().then(()=>require("./rrppjlxhsrfwBStx.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./D36j1nR6-lEwM7Ht.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./DQ1bXdi-D0uVKGFA.cjs"))}[j],M,T)},showOptions:C,showInputOptions:x,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),h(M,{type:T,enqueueProps:{error:v}})}},k=new w.DefaultReactNotifier;return k.setOverrides(g),k},[]);n.useEffect(()=>{s.starting.size<=0||!s.isMounted||d(h=>{const g=new Map(h.running);return h.starting.forEach((k,j)=>{const v=()=>{d(T=>{const M=new Map(T.running);return M.delete(j),{...T,running:M}})};g.set(j,v),k(v)}),{...h,starting:new Map,running:g}})},[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:m,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:p,children:[b,i]})});Zr.displayName="SnackbarWrapper";const is=n.memo(n.forwardRef((a,i)=>{const{children:o,title:t,taskPanes:r,onSelect:s,selected:d,registry:m=oe.DefaultTaskPaneRegistry,style:l,iconsOnly:c,className:u,...C}=a,x=n.useMemo(()=>r.map(b=>{const S=m.getRegisteredTaskPane(b);if(!S)return null;let h=S.getIcon?.();h&&(typeof h=="string"&&(h=e.jsx(w.DynamicIcon,{iconKey:h})),h=e.jsx("span",{style:{display:"inline-block",transform:"rotate(90deg)",transformOrigin:"center"},children:h}));const g=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:[h&&e.jsx(B.Box,{sx:{display:"inline-block",transformOrigin:"center",color:k=>k.palette.text.secondary},children:h}),c&&h?null:e.jsx(B.Typography,{component:"div",textTransform:"none",sx:{padding:"4px 0px",color:k=>g?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":g}),onClick:()=>a.onSelect(b)},b)}),[r,d,s,m]),f=w.useImperativeElement(i,()=>({isTaskPaneStrip:()=>!0}),[]),p=n.useMemo(()=>ie("taskpane-strip",u),[u]);return e.jsx(B.Box,{ref:f,className:p,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:x})})})),ls=(a,i)=>e.jsx(is,{ref:i,...a}),ss=n.forwardRef((a,i)=>{const{commands:o,model:t,...r}=a,s=q.useTheme(),d=`solid ${q.alpha(s.palette.divider,.2)} 1px`,m=`${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:m,marginBottom:l}},alwaysShowStrip:!0,renderTaskPanelTitle:(u,C)=>{const{title:x,icon:f,onClose:p,readOnly:b,focused:S,...h}=u;return e.jsx(B.DialogTitle,{className:ie({"Mui-selected":S}),sx:{display:"flex",flex:"1 1 %0",color:g=>g.palette.text.secondary,boxSizing:"border-box",padding:"0 0",transitionProperty:"opacity",transitionDuration:g=>`${g.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:g=>g.transitions.duration.shortest/2+"ms"},backgroundColor:g=>q.alpha(g.palette.action.hover,.03),borderBottom:g=>`solid ${q.alpha(g.palette.divider,.2)} 1px`},...h,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 10%",flexDirection:"row",alignItems:"center",marginTop:g=>g.spacing(.25),marginBottom:g=>g.spacing(.25),marginLeft:g=>g.spacing(1),marginRight:g=>g.spacing(1)},children:[e.jsx(B.Box,{sx:{flex:"1 1 100%",paddingLeft:g=>g.spacing(1)},children:x}),e.jsx(y.ExhibitTooltip,{label:"Close",children:e.jsx(B.IconButton,{"aria-label":"close",sx:{color:g=>g.palette.text.icon??g.palette.action.active},touchRippleRef:c,onPointerDown:g=>{c.current?.start(g,{center:!1}),g.stopPropagation(),g.preventDefault()},onPointerUp:()=>{p()},children:e.jsx(w.DynamicIcon,{iconKey:"Close"})})})]})})},renderTaskPaneStrip:ls,...a,onOpen:()=>{a?.onOpen?.()},onClose:()=>{a?.onClose?.()},commands:o,...r})}),Sa={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},Qr=n.memo(n.forwardRef((a,i)=>{const{mainElement:o,sidebarElement:t,className:r,style:s,...d}=a,m=q.useTheme(),[l,{width:c}]=$e(),u=c>530||c===0,C=n.useRef(null);let x=null,f=4,p=13;return u?x="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":(x="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",f=13,p=4),e.jsx(w.SplitPane,{ref:et([C,l,i]),className:r,style:s?{...Sa,...s}:Sa,...d,fixedPane:"after",position:"40%",minAfter:u?"280px":"120px",splitDirection:u?"row":"column",resizerProps:{className:"styled-resizer",style:{minWidth:u?"6px":void 0,minHeight:u?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${f}' height='${p}' viewBox='0 0 ${f} ${p}' version='1.1' fill='${m.palette.text.icon??m.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${x}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:u?"left center":"top center"}},elementBefore:o,paneBeforeProps:{style:{flexDirection:"column",marginRight:t?void 0:"6px"}},elementAfter:t,paneAfterProps:{style:{marginLeft:u?"0px":"4px",marginRight:u?"8px":"4px"}}})}));Qr.displayName="StudioSplitPane";w.DefaultDynamicIconService.register("plugin-scripts",{icons:{}}),oe.DefaultTaskPaneRegistry.registerTaskPane({key:"scriptEditor",getTitle:()=>"Script (Typescript)",getIcon:()=>"ScriptRun",renderTaskPane:rl},!0);const ro=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,style:r,onElementLoad:s,onError:d,undoManager:m,errorPanel:l=y.ErrorPanel,onKeyDown:c,workbook:u,createWorkbookOptions:C,onWorkbookChange:x,logo:f,importExportDisabled:p=!1,themeOptions:b,autoFocus:S=!1,commands:h,title:g,onTitleChange:k,titleProps:j,renderLoadingPanel:v,...T}=a,M=n.useRef(null),R=w.useCallbackRef(x,[x]),D=w.useCallbackRef(k??j?.onTitleChange,[k??j?.onTitleChange]),F=j?.placeHolder??"Untitled",E=b?.mode,{themeMode:P,source:I}=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]),N=P===y.ThemeMode.Dark,[H,O]=n.useState(null);n.useEffect(()=>{O(m??new je.UndoManager)},[m]);const[W,ee]=n.useState(null),[X,ae]=n.useState(null),$=oe.useDocThemes();n.useLayoutEffect(()=>{if(!u||Object.keys(u).length===0&&!je.CommonUtils.isPromiseLike(u)){const Z={theme:$.getDefaultTheme(),...C};ae(new A.Workbook(Z))}else ae(u)},[u]),n.useLayoutEffect(()=>{if(X){if(X instanceof A.Workbook)return ee({workbook:X}),void(u!==X&&R?.(X));(async()=>{try{let Z,le=await Promise.resolve(X);le&&le.source&&(le=await We.read(le)),le.workbook?(G(le.title),Z=le.workbook):Z=le,R?.(Z),ee({workbook:Z})}catch(Z){R?.(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(g??j?.title??"");n.useEffect(()=>{G(g??j?.title??"")},[g??j?.title]),n.useEffect(()=>{D?.(L)},[L]);const[Q,he]=n.useState(null),re=n.useMemo(()=>{const Z=()=>({contains:le=>!0,focus(){}});return h?h.createChildGroup(Z,"application",!1):new w.CommandGroup(Z,"application")},[h]),pe=w.useCallbackRef(async Z=>{he(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 Ce=n.useRef(null),be=n.useCallback(Z=>{let le=null;return j?.hidden||(le=e.jsx(sn,{...j,style:{maxWidth:"100%",...j?.style},workbook:M.current,ref:Ce,title:L,placeHolder:F,onTitleChange:_e=>{G(_e)}})),e.jsx(Xr,{...Z,logo:f,mainElement:le,showFileMenu:!p,showAppearanceMenu:!!(z?.onEnabledDarkGridChange||z?.onEnabledDarkImagesChange||z?.onModeChange)})},[f,L,j,z,p,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]),[ue,ve]=n.useState(null),ce=n.useCallback((Z,le)=>e.jsx(ss,{ref:le,model:X,commands:re,...Z}),[re,X]),Me=n.useCallback(Z=>e.jsx(Qr,{mainElement:Z,sidebarElement:ue}),[ue]),Te=et([M,i]),Ie=n.useMemo(()=>{if(!W)return J;if(W.error||!W.workbook)return K({error:W.error});let Z=null,le=null,_e=!1;return z&&(Z=N?z.dark:z.light,le=N&&z.enableDarkGrid?z.dark:z.light,_e=z.enableDarkImages),e.jsx(ln,{sx:te,style:r,tabIndex:0,autoFocus:!0,workbook:W.workbook,ref:Te,renderToolbar:be,onElementLoad:pe,onRepeatCommandChange:_,onKeyDown:ht=>{c?.(ht)},renderLoadingPanel:v,gridTheme:le,headersTheme:Z,enableDarkImages:_e,mainWrapper:Me,className:ie(o),onContextMenu:ht=>ht.preventDefault(),...T},"WorkbookElement")},[W,L,H,J,v,z,T,be,te,Me]);let me=e.jsx(os,{maxSnack:3,domRoot:Q,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(Z,le,_e)=>{M.current?.focus()},Components:{error:qr},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:ce,onUpdateArea:Z=>{ve(Z)},children:e.jsx(y.ModalProvider,{children:e.jsx(Zr,{children:e.jsx(w.UncaughtErrorBoundary,{children:e.jsx(w.ReactErrorBoundary,{children:e.jsx(Yr,{workbook:W?.workbook,setWorkbook:ae,importExportDisabled:p,titlePlaceHolder:F,titleWorkbook:L,setWorkbookTitle:G,refWorkbookTitle:Ce,commands:re,undoManager:H,themeOptions:z,children:Ie})})})})})})});return z&&(me=e.jsxs(q.ThemeProvider,{theme:N?z.dark:z.light,children:[z.cssBaseline?e.jsx(B.CssBaseline,{}):null,me]})),me}));ro.displayName="EagerStudio";const cs=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:ro,default:ro},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=Rr,exports.AutoColorPosition=mt,exports.BorderCommandButton=Da,exports.BorderPopupButton=Ma,exports.BorderStyleButton=Pa,exports.Checkboard=Ba,exports.ClearCommandButton=Lo,exports.ColorButton=io,exports.ColorCommandButton=ft,exports.ColorPanel=Ra,exports.ColorPanelType=Ea,exports.ColorPopupButton=Ao,exports.DeleteCellsCommandButton=Ho,exports.DocThemeCommandButton=Br,exports.EagerStudio=ro,exports.FillCommandButton=La,exports.FilterColumnMenu=Qo,exports.FilterCommandButton=zi,exports.Filters=sr,exports.FindCommandButton=Na,exports.FontFamilyCommandButton=Wa,exports.FontSizeCommandButton=Oa,exports.FormulaBar=Zo,exports.FreezeCommandButton=Ia,exports.HelpCommandButton=Pr,exports.HorizontalAlignCommandButton=ka,exports.InsertCellsCommandButton=zo,exports.InsertFunctionCommandPopupButton=Mr,exports.InsertFunctionSumCommandPopupButton=dn,exports.InsertImageCommandButton=nn,exports.MergeCommandButton=Fa,exports.NamedCollectionEditor=Yo,exports.NamedInput=Ko,exports.NumberFormatCommandButton=Aa,exports.PasteCommandButton=Vo,exports.PresetCellStylesCommandButton=qa,exports.PresetTableStylesCommandButton=cn,exports.RangeInput=Uo,exports.SheetTab=Jo,exports.SheetTabMenu=en,exports.SheetZoomScale=qo,exports.SheetsAllMenu=tn,exports.SortFilterCommandButton=Wo,exports.StatusBar=Go,exports.Studio=Dr,exports.StyledStrokeIcon=Mo,exports.TableDetailsPanel=Tl,exports.TableStyleCanvasPreview=Xa,exports.TableStyleOptionsPanel=Ya,exports.TableStylePreview=_o,exports.TextEffectsCommandButton=$a,exports.TextOverflowCommandButton=ja,exports.TextRotateCommandButton=Ta,exports.ThemeSelectButton=er,exports.ThemeSelectPanel=tr,exports.ThemeSelectPopupButton=or,exports.UnderlineCommandButton=Va,exports.UndoRedoCommandButton=$o,exports.VerticalAlignCommandButton=va,exports.ViewGridLinesCommandButton=za,exports.ViewHeadingsCommandButton=_a,exports.WalkingCopyCommandButton=so,exports.WorkbookContextMenu=rn,exports.WorkbookElement=ln,exports.WorkbookIO=We,exports.WorkbookStrip=an,exports.WorkbookTitle=sn,exports.WorkbookViewCommandButton=Ka,exports._WorkbookIO=Ur,exports._extends=oo,exports._objectWithoutPropertiesLoose=on,exports._setPrototypeOf=no,exports.clsx=Ve,exports.clsx$1=ie,exports.commonjsGlobal=dt,exports.createGridStyleFromMUITheme=Io,exports.defaultNewWorkbook=Tr,exports.getDefaultExportFromCjs=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},exports.requirePropTypes=Nt,exports.setPrintExamplesOnLoad=a=>{cr=a},exports.useMeasure=$e,exports.useWorkbookCommands=jr;