@sheetxl/studio-mui 0.7.19 → 0.7.21
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.
- package/browser/cjs/{DQDHzkk3uE69oOf1.cjs → 7uRpnSJkNHg_E-KO.cjs} +2 -2
- package/browser/cjs/B-O26BvbKDImp7pm.cjs +20 -0
- package/browser/cjs/{bHc9WXWuOLgCy20D.cjs → B4j_sdzJNzq1ZPbT.cjs} +1 -1
- package/browser/cjs/{BGM5Egsh-nk8JoMR.cjs → BWS4gFWp8lDPvR9C.cjs} +1 -1
- package/browser/cjs/{CDa5R5H06f0QGbLy.cjs → CmSwD6NZAHhOcRi3.cjs} +2 -2
- package/browser/cjs/{DLI8Ew9QZfYFQggZ.cjs → DHwhTAQeNs4slttB.cjs} +2 -2
- package/browser/cjs/{Bewd3fxKZsnU-nNE.cjs → DMOT_ixtKqRvPULq.cjs} +1 -1
- package/browser/cjs/{CnqcFtkhyr8c_vIx.cjs → DX5ji_lT0Qlqznv7.cjs} +6 -6
- package/browser/cjs/{DdfZbPGZ8PPPUM_a.cjs → DbqHWelIXc-F2a9N.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/{CRfQidmKBQ4Osnbw.cjs → muTJOFrCXh156rjc.cjs} +1 -1
- package/browser/cjs/{DeVzYeQ2NQw772Pw.cjs → rIy1Cx7HX-8zaQjY.cjs} +3 -3
- package/browser/cjs/{O0u5_8LdiNZxf7nW.cjs → saPH3d5fE-ugXp6m.cjs} +1 -1
- package/browser/esm/{B_99zP5rSV8EjlLY.mjs → 0D8VtNalLeBTB51a.mjs} +1 -1
- package/browser/esm/{C4TtshZ7KhuiUGbn.mjs → BMo7K5LaD7zuDVg9.mjs} +3 -3
- package/browser/esm/{CW4BTiGS1PKWCRBT.mjs → BNmwaUWz2DJqWumP.mjs} +2 -2
- package/browser/esm/{DDfXhHCLfmybPYNh.mjs → Btt4G85L5v01eySb.mjs} +2 -2
- package/browser/esm/{DUKRC4tS-eJTCx_v.mjs → C7jHdVMf6Yr4eH_B.mjs} +1 -1
- package/browser/esm/{CxSd30g44XJ8mnmj.mjs → CROTe62QHFVo8YMt.mjs} +2 -2
- package/browser/esm/{jCtxuLpDj7wzHB8p.mjs → D5XNYGaC4Yw6vCRL.mjs} +1 -1
- package/browser/esm/{Epfu4gRj2jHk_aDB.mjs → DUzVAMWTrS0u37LX.mjs} +524 -525
- package/browser/esm/{CQRjYFZa4QbRTGg_.mjs → DltuoFr9A-WJccbV.mjs} +1 -1
- package/browser/esm/{Cmnwt2GoquorcXj3.mjs → DtifaYF85GrfJ9_1.mjs} +1 -1
- package/browser/esm/{BdkP5a6d0ML7Y0b2.mjs → aUkJls9HzxnrZSof.mjs} +1 -1
- package/browser/esm/index.mjs +18 -19
- package/browser/esm/mqkuG-TcLS4nn4x0.mjs +4531 -0
- package/node/esm/{DiTrdBQV2uxN3GKM.mjs → BYjJIMFsheqJcsEI.mjs} +1 -1
- package/node/esm/{eZ7cx2YnaEfXyfU8.mjs → CACqTiBtxYlo1mu7.mjs} +1 -1
- package/node/esm/{D3_AGbvzQKHFYZxn.mjs → CJU8jJhxtR3PEj2I.mjs} +1 -1
- package/node/esm/{BEnfb2SK8bA4gTFW.mjs → CS0OWM24rZpAGRKU.mjs} +1 -1
- package/node/esm/{B8fe0e-2ZKPkjmUL.mjs → CdUceTAldsMTIFnD.mjs} +1 -1
- package/node/esm/{DNlKlusE8DeOTRuC.mjs → D6B7z_d11sd-U1fU.mjs} +1 -1
- package/node/esm/{BNP3QSlZuis44plx.mjs → DCngEQG4um0yTeoj.mjs} +1 -1
- package/node/esm/{CkTwDMf16gYei7o2.mjs → DQnCFz2zJgMwLou_.mjs} +2 -3
- package/node/esm/{Id0KR5kK1ADVhWhD.mjs → Do7ts-uMkQANfvhq.mjs} +1 -1
- package/node/esm/index.mjs +1194 -1177
- package/node/esm/{BZDELNZUW344wqXt.mjs → oYh6joioOWhFd_R3.mjs} +1 -1
- package/package.json +8 -8
- package/types/index.d.ts +165 -207
- package/browser/cjs/BZwSUqHASXkJlWax.cjs +0 -20
- package/browser/esm/D0Qe0M3MAH6Ya8_q.mjs +0 -4513
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";var Mi=Object.create;var Bn=Object.defineProperty;var Di=Object.getOwnPropertyDescriptor;var Fi=Object.getOwnPropertyNames;var Ii=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var Oi=(a,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Fi(i))!Ni.call(a,r)&&r!==o&&Bn(a,r,{get:()=>i[r],enumerable:!(t=Di(i,r))||t.enumerable});return a};var Ai=(a,i,o)=>(o=a!=null?Mi(Ii(a)):{},Oi(i||!a||!a.__esModule?Bn(o,"default",{value:a,enumerable:!0}):o,a));/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.19
|
|
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"),C=require("@sheetxl/utils-mui"),w=require("@sheetxl/utils-react"),X=require("@mui/material/styles"),Re=require("@mui/system"),et=require("react-dom"),je=require("@sheetxl/utils"),dt=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 se(){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:c,...f}=a,l=w.useCommands(o,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),d=n.useMemo(()=>{for(let p=0;p<l.length;p++)if(l[p]?.state())return l[p];return l[0]},[l]),g=n.useMemo(()=>{if(!t)return null;const p={...t};return delete p.beforeExecute,p},[t]),y=n.useCallback((p,u)=>{const m={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...m,command:u.getCommand("formatAlignLeftToggle")}),e.jsx(C.CommandButton,{...m,command:u.getCommand("formatAlignCenterToggle")}),e.jsx(C.CommandButton,{...m,command:u.getCommand("formatAlignRightToggle")}),e.jsx(C.CommandButton,{...m,command:u.getCommand("formatAlignJustifyToggle")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...m,command:u.getCommand("formatAlignCenterContinuousToggle")}),e.jsx(C.CommandButton,{...m,command:u.getCommand("formatAlignFillToggle")}),e.jsx(C.CommandButton,{...m,command:u.getCommand("formatAlignDistributedHorizontalToggle")})]}),S=e.jsxs(B.Box,{sx:{className:se("quick-buttons"),display:"flex",alignItems:"center",justifyContent:"center"},onClick:h=>h.stopPropagation(),children:[e.jsx(C.CommandButton,{command:u.getCommand("formatIndentDecrease"),commandHook:g,scope:r,disabled:s}),e.jsx(C.CommandButton,{command:u.getCommand("formatIndentIncrease"),commandHook:g,scope:r,disabled:s})]}),x=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...f,children:[S,e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:b})]});return C.defaultCreatePopupPanel({...p,children:x})},[s,t]);return e.jsx(C.CommandPopupButton,{ref:i,parentFloat:c,commands:o,commandHook:t,scope:r,createPopupPanel:y,label:"Horizontal Alignment",tooltip:"Configure how text is placed in the horizontal direction of the cell.",quickCommand:d?.key(),icon:d?.icon()??"FormatAlignLeft",...f})})),va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=w.useCommands(o,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),{activeCommand:l,allDisabled:d}=n.useMemo(()=>{const y=f.length;let p,u=0;for(let m=0;m<y;m++){const b=f[m];b&&!b.disabled()&&(!p&&b?.state()&&(p=b),u++)}return p=p??f[0],{activeCommand:p,allDisabled:u===0}},[f]),g=n.useCallback((y,p)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...u,command:p.getCommand("formatAlignTopToggle")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatAlignMiddleToggle")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatAlignBottomToggle")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatAlignJustifyVerticalToggle")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatAlignDistributedVerticalToggle")})]});return C.defaultCreatePopupPanel({...y,children:m})},[s,t]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:g,disabled:s||d,label:"Vertical Alignment",tooltip:"Configure how text is placed in the vertical direction of the cell.",icon:l?.icon()??"TextVerticalBottom",...c})})),ja=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=w.useCommands(o,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),{activeCommand:l,allDisabled:d}=n.useMemo(()=>{const y=f.length;let p,u=0;for(let m=0;m<y;m++){const b=f[m];b&&!b.disabled()&&(!p&&b?.state()&&(p=b),u++)}return p=p??f[0],{activeCommand:p,allDisabled:u===0}},[f]),g=w.useCallbackRef((y,p)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextOverflowVisibleToggle")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextOverflowWrapToggle")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextOverflowClipToggle")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextOverflowShrinkToggle")})]});return C.defaultCreatePopupPanel({...y,children:m})},[s,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,commandHook:t,disabled:s||d,scope:r,label:"Text Overflow",tooltip:"Configure how text behaves when it doesn't fit within a cell.",createPopupPanel:g,icon:l?.icon()??"TextHorizontalOverflow",...c})})),Ea=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=w.useCommands(o,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),l=n.useMemo(()=>{const y=f.length;for(let p=0;p<y;p++){const u=f[p];if(u?.state())return u}return f[1]},[f]),d=n.useCallback((y,p)=>{const u={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextRotate0")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextRotate315")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextRotate45")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextRotate90")}),e.jsx(C.CommandButton,{...u,command:p.getCommand("formatTextRotate270")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.InputCommandButton,{...u,command:p.getCommand("formatTextRotateCustom"),label:"Custom"})]});return C.defaultCreatePopupPanel({...y,children:m})},[s,t,r,o]),g=n.useMemo(()=>(o.getCommand("formatTextRotateCustom")?.state()??0)!==0,[f]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,selected:g,label:"Text Orientation",tooltip:"Rotate your text diagonally or vertically. This is a great way to label narrow columns.",createPopupPanel:d,quickCommand:g?"formatTextRotate0":"formatTextRotate315",icon:l?.icon()??"TextRotation315",...c})})),Ta={Preset:"preset",Custom:"custom"},pt={Start:"start",End:"end"},xo={},Li=(a,i,o,t)=>{const r=a+"-"+i+"-"+o+(t?"-server":"");if(xo[r])return xo[r];const s=((c,f,l,d)=>{if(typeof document>"u"&&!d)return null;const g=d?new d:document.createElement("canvas");g.width=2*l,g.height=2*l;const y=g.getContext("2d");return y?(y.fillStyle=c,y.fillRect(0,0,g.width,g.height),y.fillStyle=f,y.fillRect(0,0,l,l),y.translate(l,l),y.fillRect(0,0,l,l),g.toDataURL()):null})(a,i,o,t);return xo[r]=s,s},zi={},Ba=n.memo(a=>{const{className:i,style:o=w.ReactUtils.EmptyCssProperties,white:t="transparent",grey:r="grey",size:s=8,borderRadius:c,boxShadow:f,renderers:l=zi,children:d,...g}=a,y=d,p=n.useMemo(()=>Object.assign({borderRadius:c,boxShadow:f,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Li(t,r,s,l?.canvas)}) center left`},o),[t,r,s,l]);return n.isValidElement(d)?n.cloneElement(d,{...y.props}):e.jsx("div",{style:p,...g})}),Hi=n.memo(a=>{const{selectedColor:i,onSelectColor:o,onPreviewColor:t,onClick:r,onKeyDown:s,onMouseOver:c,onMouseLeave:f,onFocus:l,style:d=w.ReactUtils.EmptyCssProperties,children:g,alphaWhite:y,alphaGrey:p,darkMode:u,alphaCheckSize:m=7,...b}=a;if(!i)throw new Error("a selectedColor is required");const S=n.useCallback(T=>{r?.(T),T.isDefaultPrevented()||(T.ctrlKey?t?.(i.toRGBA()):o?.(i.toRGBA()))},[o,t,r,i]),x=n.useCallback(T=>{c?.(T),T.isDefaultPrevented()||t?.(i.toRGBA())},[t,c,i]),h=n.useCallback(T=>{f?.(T),T.isDefaultPrevented()},[t,f]),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:m,white:y,grey:p,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[y,p,i]);return e.jsxs("div",{style:{position:"absolute",height:"100%",width:"100%",top:"0px",left:"0px",cursor:"pointer",outline:"none",...d},tabIndex:0,...b,onClick:S,onKeyDown:j,onMouseOver:x,onMouseLeave:h,onFocus:k,children:[v,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:i.toCSS(u)},children:g})]})}),io=n.memo(a=>{const{schemeColorLookup:i,selectedColor:o,previewColor:t,colorDef:r,onSelectColorDef:s,onPreviewColorDef:c,swatchProps:f,defaultButtonSize:l=24,isLarge:d=!1,compareRGB:g=!1,darkMode:y=!1,...p}=a,u=new A.Color({val:r.definition.val,adjs:r.definition.adjs},v=>i(v)),m=g?u.toRGBA().toString():u.toString(),b=o&&(g?o.toRGBA().toString():o.toString())===m,S=t&&(g?t.toRGBA().toString():t.toString())===m,x=[];x.push({[A.IColor.AdjustmentType.Inv]:!0}),x.push({[A.IColor.AdjustmentType.Alpha]:100});const h=u.adjust(x),k=n.useCallback(()=>{s?.(r)},[s,r]),j=n.useCallback(v=>{c?.(v?r:null)},[c,r]);return e.jsx(C.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*(d?1.2:1)+"px",height:l*(d?1.2:1)+"px",position:"relative",boxSizing:"border-box",cursor:"pointer",outline:"none"},...p,children:e.jsxs(Hi,{selectedColor:u,title:null,onSelectColor:k,onPreviewColor:j,alphaCheckSize:d?9:void 0,darkMode:y,...f,children:[e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",top:"0px",left:"0px",pointerEvents:"none",borderColor:h.toRGBA(y).toString(),borderWidth:"2px",borderStyle:"solid",boxSizing:"border-box",opacity:b?"1":"0"}}),e.jsx("div",{style:{position:"absolute",width:.33*l*(d?1.2:1)+"px",height:.33*l*(d?1.2:1)+"px",left:"calc(50% - 0.5px)",top:"calc(50% - 0.5px)",transform:"translate(-50%,-50%)",pointerEvents:"none",background:h.toRGBA(y).toString(),borderRadius:"50%",opacity:S?"1":"0"}})]})})})}),Dt=n.memo(a=>{const{title:i,schemeColorLookup:o,colorDefs:t,selectedColor:r,previewColor:s,onSelectColorDef:c,onPreviewColorDef:f,style:l=w.ReactUtils.EmptyCssProperties,compareRGB:d=!1,darkMode:g,swatchProps:y,...p}=a;let u;if(Array.isArray(t[0]))u=t;else{u=[];for(let h=0;h<t.length;h++)u.push([t[h]])}const m=n.useCallback(h=>{c?.(h)},[c]),b=n.useCallback(h=>{f?.(h)},[f]),S=n.useMemo(()=>{let h=[];for(let k=0;k<u.length;k++){let j=[],v=u[k];for(let M=0;M<v.length;M++){let P=v[M];j.push(e.jsx(io,{schemeColorLookup:o,colorDef:P,selectedColor:r,previewColor:s,onSelectColorDef:m,onPreviewColorDef:b,swatchProps:y,compareRGB:d,darkMode:g},k+" "+M))}let T=e.jsx(B.Box,{className:"button-col",sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",boxShadow:M=>M.shadows[2],borderRadius:"2px",overflow:"hidden"},children:j},""+k);h.push(T)}return h},[u,r,s,m,b]),x=n.useMemo(()=>i?e.jsx(B.Typography,{noWrap:!0,component:"div",sx:{display:"flex",flexShrink:"0",paddingLeft:"6px",paddingBottom:"4px",paddingTop:"0px",userSelect:"none",color:h=>h.palette.text.secondary},children:i}):null,[i]);return e.jsxs(B.Box,{style:{...l},children:[x,e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...p,children:S})]})}),De=(a,i)=>({description:a,definition:{val:i,adjs:[]}}),xe=(a,i,o,t,r,s)=>{const c=De(a,i);t?.push(c);const f=new A.Color({val:c.definition.val,adjs:c.definition.adjs},o),l=f.toString();r?.set(l,f);const d=f.toRGBA().toString();s?.set(d,f)},Wi=n.lazy(()=>Promise.resolve().then(()=>require("./CnqcFtkhyr8c_vIx.cjs"))),Ra=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o=null,previewColor:t=a.selectedColor??null,recentColors:r,schemeLookup:s,disableAlpha:c=!1,previewDebounceTime:f=100,initialPanelType:l,defaultButtonSize:d=24,width:g,onElementLoad:y,onDone:p,onEyeDropStart:u,onEyeDropStop:m,onPreviewColor:b,onPreviewColorImmediate:S,onSelectColor:x,autoColor:h,autoColorLabel:k="Automatic",autoColorPosition:j=pt.Start,compareRGB:v=!1,darkMode:T=!1,...M}=a,P=t||o,I=w.useCallbackRef(b,[b]),D=w.useCallbackRef(S,[S]),E=w.useCallbackRef(x,[x]),R=w.useCallbackRef(u,[u]),N=w.useCallbackRef(m,[m]),[z,O]=n.useState(!1),L=X.useTheme(),F=n.useMemo(()=>s||A.Color.getDefaultSchemeLookup(),[s]),$=n.useMemo(()=>{const _=new Map,ee=new Map,me=[];xe("Primary Background","bg1",F,me,_,ee),xe("Primary Text","tx1",F,me,_,ee),xe("Secondary Background","bg2",F,me,_,ee),xe("Secondary Text","tx2",F,me,_,ee),xe("Accent 1","accent1",F,me,_,ee),xe("Accent 2","accent2",F,me,_,ee),xe("Accent 3","accent3",F,me,_,ee),xe("Accent 4","accent4",F,me,_,ee),xe("Accent 5","accent5",F,me,_,ee),xe("Accent 6","accent6",F,me,_,ee);const ve=A.ITheme.buildPalette(me,F,_,ee),de=[];if(xe("Dark Red","C00000",F,de,_,ee),xe("Red","FF0000",F,de,_,ee),xe("Orange","FFC000",F,de,_,ee),xe("Yellow","FFFF00",F,de,_,ee),xe("Light Green","92D050",F,de,_,ee),xe("Green","00B050",F,de,_,ee),xe("Light Blue","00B0F0",F,de,_,ee),xe("Blue","0070C0",F,de,_,ee),xe("Dark Blue","002060",F,de,_,ee),c?xe("Purple Is A Fruit","7030A0",F,de,_,ee):xe("Transparent","00000000",F,de,_,ee),h){const pe=h.toString();_.set(pe,h)}const Fe=new Map,Ee=typeof r=="function"?r():r,Oe=[];for(let pe=0;Ee&&pe<Ee.length;pe++){const J=Ee[pe].toString();Fe.set(J,Ee[pe]),Oe.push({description:"Recent "+(pe+1),definition:{val:Ee[pe].toString()}})}return{primaryColors:me,modifiedPresets:ve,standardColors:de,recentColorsLimited:Oe,mapAllPresets:_,mapAllPresetsRGB:ee,mapRecent:Fe}},[F,r,c,h]);n.useEffect(()=>{y?.()},[]);const[Q,Y]=n.useState(!1),te=n.useCallback(()=>{Y(_=>!_)},[]);n.useEffect(()=>{if(l)Y(l===Ta.Custom);else if(o){let _=o.toString(),ee=$.mapAllPresets.get(_);ee||(_=o.toRGBA().toString(),ee=$.mapAllPresetsRGB.get(_));const me=$.mapRecent.get(_);Y(!ee&&!me)}},[o,l]);const K=n.useCallback(A.CommonUtils.debounce(_=>{I?.(_)},f),[I,f]),[q,ne]=n.useState();n.useEffect(()=>{ne(t||o)},[t,o]);const W=w.useCallbackRef(_=>{D&&(D(_),K(_))},[D]),U=w.useCallbackRef(_=>{W(_?new A.Color({val:_.definition.val,adjs:_.definition.adjs},F):null)},[F]),H=n.useCallback(_=>{_.ctrlKey&&Y(!0)},[]),G=w.useCallbackRef(_=>{let ee=!1;if(_){const me=_.toString();ee=!$.mapAllPresets.has(me)}E?.(_,ee)},[E,$]),ie=w.useCallbackRef(_=>{const ee=_?new A.Color({val:_.definition.val,adjs:_.definition.adjs},F):null;Promise.resolve(p?.()).then(()=>{G(ee)})},[F,p]),re=w.useCallbackRef(_=>{W(_?new A.Color(_,F):null)},[F]),le=n.useMemo(()=>window.EyeDropper===void 0?e.jsx(e.Fragment,{}):e.jsx(B.IconButton,{"aria-label":"eye dropper",size:"small",sx:{color:_=>_.palette.text.icon??_.palette.action.active},onClick:async()=>{O(!0),R?.(),await new EyeDropper().open().then(_=>{O(!1),N?.();let ee=new A.Color(_.sRGBHex),me=ee.toString(),ve=$.mapAllPresets.get(me);if(ve||(me=ee.toRGBA().toString(),ve=$.mapAllPresetsRGB.get(me)),!ve){const de=ee.toRGBA(),Fe=3;let Ee=255;$.mapAllPresetsRGB.forEach((Oe,pe)=>{const J=Oe.toRGBA(),ce=Math.abs(J.red-de.red)+Math.abs(J.blue-de.blue)+Math.abs(J.green-de.green);ce<Fe&&ce<Ee&&(ve=Oe)})}Y(!ve),W(ve||ee)}).catch(_=>{O(!1),_?.name!=="AbortError"&&console.error(_)})},children:e.jsx(w.DynamicIcon,{iconKey:"Colorize"})}),[$,T]),Se=n.useMemo(()=>{if(!Q)return;const _={opacity:Q?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:_,children:e.jsx(C.LoadingPanel,{})}),children:e.jsx(Wi,{style:_,selectedColor:P?P.toRGBA().toString():"transparent",onColorChange:re,disableAlpha:c})})},[Q,P]),ge=n.useMemo(()=>({onClick:H,alphaGrey:L.palette.text.icon??L.palette.action.active}),[H,L]),Z=n.useMemo(()=>{if(!h)return null;const _={description:k,definition:{val:h.getVal(),adjs:h.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(B.MenuItem,{sx:{display:"flex",color:ee=>ee.palette.text.secondary},onMouseOver:()=>{U(null)},onClick:()=>{ie(null)},children:[e.jsx(B.Box,{sx:{flex:"none",boxShadow:ee=>ee.shadows[2],borderRadius:ee=>ee.spacing(.5),overflow:"hidden"},children:e.jsx(io,{schemeColorLookup:F,colorDef:_,selectedColor:o===null?h:o,previewColor:t===null?h:t,defaultButtonSize:d,isLarge:!0,darkMode:T,compareRGB:v,swatchProps:ge})}),e.jsx(B.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:k})]})})},[h,k,F,o,t]);return e.jsxs(B.Box,{ref:i,sx:{width:g,outline:"none",padding:"10px 10px",overflow:"hidden",boxSizing:"content-box"},...M,children:[e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("div",{style:{opacity:Q?"0":1},children:[Z&&j===pt.Start?e.jsxs(e.Fragment,{children:[Z,e.jsx(B.Divider,{light:!0,style:{marginTop:"2px",marginBottom:"10px"}})]}):null,e.jsx(Dt,{title:"Theme Colors",schemeColorLookup:F,colorDefs:$.primaryColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:ge,onPreviewColorDef:U,onSelectColorDef:ie,compareRGB:v,darkMode:T}),e.jsx(Dt,{schemeColorLookup:F,colorDefs:$.modifiedPresets,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:ge,onPreviewColorDef:U,onSelectColorDef:ie,compareRGB:v,darkMode:T}),e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Standard Colors",schemeColorLookup:F,colorDefs:$.standardColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:ge,onPreviewColorDef:U,onSelectColorDef:ie,compareRGB:v,darkMode:T}),e.jsxs("div",{style:{opacity:$.recentColorsLimited.length===0?"0":void 0,display:$.recentColorsLimited.length===0?"none":void 0},children:[e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Recent Colors",schemeColorLookup:F,colorDefs:$.recentColorsLimited,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:ge,onPreviewColorDef:U,onSelectColorDef:ie,compareRGB:v,darkMode:T})]}),Z&&j===pt.End?e.jsxs(e.Fragment,{children:[e.jsx(B.Divider,{light:!0,sx:{marginTop:"2px",marginBottom:"2px"}}),Z,e.jsx("div",{style:{marginBottom:"2px"}})]}):null]}),Se]}),e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-around",gap:"8px",paddingLeft:"2px",paddingRight:"2px"},children:[le,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:()=>{te()},children:Q?e.jsx("div",{children:"Preset"}):e.jsx("div",{children:"Custom"})}),e.jsx(B.Button,{variant:"contained",size:"small",style:{minWidth:"75px"},onClick:()=>{Promise.resolve(p?.()).then(()=>{G(q)})},children:"Done"})]})]})})),$i=e.jsx(w.DynamicIcon,{iconKey:"circle.colored"}),Ao=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o,quickColor:t,icon:r=$i,tooltip:s,label:c,onPreviewColor:f,onPreviewColorImmediate:l,onSelectColor:d,variant:g=C.PopupButtonType.Toolbar,panelProps:y,shouldCloseFloatAll:p=!0,compareRGB:u=!1,darkMode:m=!1,...b}=a,S=w.useCallbackRef(f,[f]),x=w.useCallbackRef(l,[l]),h=w.useCallbackRef(d,[d]),[k,j]=n.useState(()=>{}),v=t||k||o||y?.autoColor,T=n.useRef(!1),M=n.useCallback(()=>{},[]),P=w.useCallbackRef(()=>{j(o)},[o]),I=w.useCallbackRef($=>{T.current||(j($),S?.($))},[S]),D=w.useCallbackRef($=>{T.current||(j($),x?.($))},[x]),E=w.useCallbackRef(($,Q)=>{T.current||(j(void 0),h?.($,Q))},[h]),R=n.useMemo(()=>e.jsx(B.Box,{className:"color-wrapper",sx:{lineHeight:"0",color:"inherit","--sxl-color-active":`${v?.toCSS(m)??"transparent"}`,"& .activeColor":{fill:`${v?.toCSS(m)??"transparent"}`},"& .style_grey":{fill:$=>$.palette.text.icon??$.palette.action.active}},children:typeof r=="function"?r():r}),[v,r,m]),N=w.useCallbackRef($=>{h?.(t,!1)},[h,t]),[z,O]=n.useState(!1),L=n.useCallback($=>{const{closeFloat:Q,closeFloatAll:Y}=$;return e.jsx(Ra,{...y,selectedColor:o,previewColor:k,onDone:p?Y:Q,onKeyDown:te=>{te.which===w.KeyCodes.Enter&&(p?Y():Q())},onPreviewColorImmediate:D,onPreviewColor:I,onSelectColor:E,onEyeDropStart:()=>O(!0),onEyeDropStop:()=>O(!1),compareRGB:u,darkMode:m})},[o,k,p,v,y?.autoColor,m]),F={onQuickClick:t?N:void 0,createPopupPanel:L,popupProps:{popperProps:{resizeOnOverflow:!1}},onPopupOpen:P,onPopupClose:M,tooltip:s||c||"Color",label:c,icon:R,...b};return g===C.PopupButtonType.Toolbar?e.jsx(C.ExhibitPopupIconButton,{ref:i,...F}):e.jsx(C.ExhibitPopupMenuItem,{ref:i,...F})})),eo=82,Mo=a=>{const{styleColor:i,length:o=eo,width:t=1,dashArray:r=null,sx:s,isDouble:c=!1,isAngled:f=!1,darkMode:l=!1,...d}=a;return e.jsx(B.SvgIcon,{sx:{width:`${o}px`,height:`${t}px`,color:"inherit",overflow:"visible","& .activeColor":{stroke:g=>`${i?i.toRGBA(l).toString():g.palette.text.icon??g.palette.action.active}`},"& .style_grey":{stroke:g=>g.palette.text.icon??g.palette.action.active},...s},height:t,width:o,viewBox:`0 0 ${o} ${t}`,...d,children:e.jsx(oe.StyledStrokePath,{length:o,width:t,dashArray:r,isDouble:c,isAngled:f,className:"activeColor"})})},Pa=n.memo(n.forwardRef((a,i)=>{const{variant:o,showLabels:t=!1,disabled:r=!1,createPopupPanel:s,styleColor:c,selectedStyle:f,onSelectStyle:l,showNone:d=!0,darkMode:g,sx:y,...p}=a,u=w.useCallbackRef(l,[]),m=n.useCallback(h=>{const{popupContainer:k,floatReference:j,closeFloat:v,...T}=h,M=[],P=A.IBorder.BuiltInDefinitionsArray;for(let I=0;I<P.length;I++){const D=P[I];if(D.description==="None"&&!d)continue;const E=e.jsx(Mo,{styleColor:c,length:eo,width:D.width,darkMode:g,dashArray:D.pattern,isDouble:D.description.toLowerCase().includes("double"),isAngled:D.description.toLowerCase().includes("slant")});let R=null;R=t?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{marginRight:"6px"},children:D.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]})]}):D.description==="None"?"None":E,M.push(e.jsx(C.ExhibitMenuItem,{className:"border-stroke",tabIndex:0,sx:{height:"28px","& svg path.activeColor":{filter:C.createStrokeShadowFilter(4)},paddingLeft:"16px",background:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`},tooltipProps:{description:t?"":D.description},icon:null,disabled:r,onMouseDown:N=>N.preventDefault(),onMouseUp:()=>{v(),u(D.style)},onKeyDown:N=>{N.which===w.KeyCodes.Enter&&v()},selected:D.style===f,parentFloat:j,children:R},I))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:M})},[r,d,c,f,g]),b=n.useMemo(()=>{const h=A.IBorder.BuiltInDefinitions.get(f);let k;return k=h.description==="None"?e.jsx(B.Box,{sx:{minWidth:`${eo}px`},children:"None"}):e.jsx(Mo,{styleColor:c,length:eo,width:h.width,dashArray:h.pattern,darkMode:g,isDouble:h.description.toLowerCase().includes("double"),isAngled:h.description.toLowerCase().includes("slant")}),e.jsx(B.Box,{className:"border-stroke",sx:{paddingLeft:"12px",marginLeft:"4px",marginRight:"4px",height:"24px",display:"flex",alignItems:"center","& svg path.activeColor":{filter:C.createStrokeShadowFilter()}},children:k})},[f,c]),S=n.useMemo(()=>A.IBorder.BuiltInDefinitions.get(f),[f]),x={disabled:r,icon:b,tooltip:"Border Style: "+S.description,sx:{background:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`,...y},createPopupPanel:m,...p};return o===C.PopupButtonType.Toolbar?e.jsx(C.ExhibitPopupIconButton,{...x}):e.jsx(C.ExhibitPopupMenuItem,{...x})})),Ma=n.memo(n.forwardRef((a,i)=>{const{autoColor:o=null,schemeLookup:t,autoStrokeStyle:r=A.IBorder.StrokeStyle.Thin,disabled:s=!1,darkMode:c=!1,showStylingBefore:f=!0,onSelectBorder:l,onPreviewBorder:d,selectedBorder:g,createTemporaryBorder:y,...p}=a,u=w.useCallbackRef(l,[l]),m=w.useCallbackRef(d,[d]),[b,S]=n.useState(),[x,h]=n.useState(),k=b??r,j=x??o,v=g||{bottom:{style:r,color:o?.toString()}},T=w.useCallbackRef(R=>{const N={},z=R?Object.keys(R):[];let O=!1;const L=z.length;for(let ne=0;ne<L;ne++){const W=z[ne];R[W]?.style&&(N[W]={style:R[W].style,color:R[W].color},O||N[W].style===A.IBorder.StrokeStyle.None||(O=!0))}z.length<6&&(O=!0);const F=O?N.left:null,$=O?N.top:null,Q=O?N.right:null,Y=O?N.bottom:null,te=O?N.vertical:null,K=O?N.horizontal:null;let q="";return $||F||(q+="M 3,5 H 5 V 3 H 3 "),$||(q+="M 7,5 H 9 V 3 H 7 "),$||te||(q+="M 11,5 h 2 V 3 h -2 "),$||(q+="M 15,5 h 2 V 3 h -2 "),$||Q||(q+="M 19,5 h 2 V 3 h -2 "),F||(q+="M 3,9 H 5 V 7 H 3 "),te||(q+="M 11,9 h 2 V 7 h -2 "),Q||(q+="M 19,9 h 2 V 7 h -2 "),K||F||(q+="M 3,13 H 5 V 11 H 3 "),K||(q+="M 7,13 H 9 V 11 H 7 "),K||te||(q+="M 11,13 h 2 v -2 h -2 "),K||Q||(q+="M 19,13 h 2 v -2 h -2 "),K||(q+="M 15,13 h 2 v -2 h -2 "),F||(q+="M 3,17 H 5 V 15 H 3 "),te||(q+="M 11,17 h 2 v -2 h -2 "),Q||(q+="M 19,17 h 2 v -2 h -2 "),Y||F||(q+="M 3,21 H 5 V 19 H 3 "),Y||(q+="M 7,21 H 9 V 19 H 7 "),Y||te||(q+="M 11,21 h 2 v -2 h -2 "),Y||(q+="M 15,21 h 2 v -2 h -2 "),Y||Q||(q+="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:q})}),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:C.strokeShadowFilter}},children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:(ne,W)=>{if(!y||z.length===0)return null;const U=ne.rowIndex,H=ne.colIndex,G={};return U===0?(G.top=N.top,G.bottom=N.horizontal):(G.top=N.horizontal,G.bottom=N.bottom),H===0?(G.left=N.left,G.right=N.vertical):(G.left=N.vertical,G.right=N.right),y?.(G)},darkMode:c,style:{top:"2px",left:"2px",width:"calc(100% - 5px)",height:"calc(100% - 5px)",position:"absolute"}})})]})]})},[j,k,c]),M=n.useCallback((R,N,z)=>{let O=null;if(R&&R.length>0){let L=null;(N||z)&&(L={style:z,color:N?.toString()??null}),O={};const F=R.length;for(let $=0;$<F;$++)O[R[$]]=L}return O},[]),P=n.useCallback(R=>{u?.(R)},[]),I=n.useCallback(R=>{m?.(R)},[]),D=n.useCallback(R=>{const{closeFloatAll:N,floatReference:z}=R,O=($,Q,Y="bottom",te=!1)=>{const K=M($,j??null,te?A.IBorder.StrokeStyle.None:k??null),q=te?M([],j??null,k??null):K;return e.jsx(C.ExhibitIconButton,{icon:T(q),sx:{background:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`},tooltipProps:{label:Q,simple:!0,placement:Y},onClick:()=>{N(),I(K),P(K)}})},L=e.jsxs(e.Fragment,{children:[e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"All Borders","top"),O([A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"Inner Borders","top"),O([A.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),O([A.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom],"Outside Borders","top")]}),e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left],"Left Borders"),O([A.IBorder.Edge.Top],"Top Borders"),O([A.IBorder.Edge.Right],"Right Borders"),O([A.IBorder.Edge.Bottom],"Bottom Borders"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical,A.IBorder.Edge.DiagonalUp,A.IBorder.Edge.DiagonalDown],"No Borders","bottom",!0)]})]}),F=e.jsx(e.Fragment,{children:e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",flexDirection:"row",gap:"6px"},children:[e.jsx(Ao,{variant:C.PopupButtonType.Toolbar,icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),selectedColor:k===A.IBorder.StrokeStyle.None?new A.Color("transparent"):j,onPreviewColor:$=>{h($)},onSelectColor:($,Q)=>{h($)},darkMode:c,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:c,variant:C.PopupButtonType.Toolbar,parentFloat:z})]})});return e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},onClick:$=>$.stopPropagation(),children:[f?F:L,e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),f?L:F]})},[k,j,o,t,c]),E=n.useMemo(()=>T(v),[v,c]);return e.jsx(C.ExhibitPopupIconButton,{ref:i,createPopupPanel:D,popupProps:{popperProps:{resizeOnOverflow:!1}},createTooltip:({children:R},N)=>e.jsx(C.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:N,children:R}),onQuickClick:()=>{u?.(v)},quickButtonProps:{sx:{}},disabled:s,icon:E,...p})})),Da=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,variant:s=w.CommandButtonType.Toolbar,disabled:c=!1,autoColor:f,autoStrokeStyle:l,schemeLookup:d,createTemporaryBorder:g,selectedBorder:y,onSelectBorder:p,darkMode:u,icon:m,label:b,...S}=a,x=w.useCommands(o,["formatBorder"]),h=t??x[0],k=h?.context()??null,j=k?.autoColor??f,v=k?.autoStyle??l,T=y??k?.quickBorder,M=u??k?.darkMode,P=g??k?.createTemporaryBorder,I=d??k?.schemeLookup,D=w.useCallbackRef(R=>{k?.onBorderSelect&&k.onBorderSelect(R),p?.(R),h?.execute(R,r)},[h,p,r]),E=n.useCallback((R,N)=>{const{children:z,title:O,...L}=R;let F=R.children;return(h?.disabled()||c)&&(F=e.jsx("div",{children:F})),e.jsx(C.CommandTooltip,{command:h,placement:s===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:N,...L,children:F})},[h,c]);return e.jsx(Ma,{ref:i,autoColor:j,darkMode:M,autoStrokeStyle:v,createTemporaryBorder:P,schemeLookup:I,selectedBorder:T,onSelectBorder:D,createTooltip:E,disabled:c||!h||h.disabled(),...S})})),Fa=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=n.useCallback((l,d)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},y=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...g,command:d.getCommand("mergeToggle")}),e.jsx(C.CommandButton,{...g,command:d.getCommand("mergeHorizontal")}),e.jsx(C.CommandButton,{...g,command:d.getCommand("mergeVertical")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...g,command:d.getCommand("unmerge")})]});return C.defaultCreatePopupPanel({...l,children:y})},[s,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,quickCommand:"mergeToggle",commandHook:t,scope:r,tooltip:"Combine or split cells.",createPopupPanel:f,icon:"MergeAll",...c})})),Ia=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=n.useCallback((l,d)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},y=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...g,command:d.getCommand("freezeToggle")}),e.jsx(C.CommandButton,{...g,command:d.getCommand("freezeToggleHorizontal")}),e.jsx(C.CommandButton,{...g,command:d.getCommand("freezeToggleVertical")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...g,command:d.getCommand("unfreeze")})]});return C.defaultCreatePopupPanel({...l,children:y})},[s,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:f,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",...c})})),Na=n.memo(n.forwardRef((a,i)=>e.jsx(C.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["find","findReplace","goto"],scope:"find",label:"Find & Select",tooltip:"Find and replace cells or go to a specific location.",quickCommand:"find",icon:"Find"}))),Oa=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,showQuickButtons:r=!!a.commands,commands:s,fontSizes:c=A.FontUtils.DefaultFontSizes,disabled:f=!1,parentFloat:l,icon:d,label:g,sx:y,...p}=a;w.useCommand(o);const u=()=>o?.state()?.toString()||"11",[m,b]=n.useState(u),S=w.useCallbackRef(()=>{const P=parseFloat(m);isNaN(P)?b(u()):parseFloat(u())!==P&&o.execute(P,t)},[u,o,m,t]);n.useEffect(()=>{b(u())},[o?.state()]);const x=n.useMemo(()=>{if(!t)return null;const P={...t};return delete P.beforeExecute,P},[t]),h=w.useCommands(s,["formatFontSizeIncrease","formatFontSizeDecrease"]),k=n.useMemo(()=>h?e.jsxs(B.Box,{className:se("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:P=>P.stopPropagation(),children:[e.jsx(C.CommandButton,{command:h[0],commandHook:x}),e.jsx(C.CommandButton,{command:h[1],commandHook:x})]}):null,[h]),j=X.useTheme(),v=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("12.3",Math.round(j.typography.fontSize),j.typography.fontFamily).width}px`,[j]),T=n.useCallback(P=>{const{onMouseDown:I,onMouseUp:D,...E}=P;return e.jsx(B.IconButton,{component:"div",...E,disableRipple:!0,children:e.jsx(B.Input,{inputMode:"numeric",disabled:f||!o||o.disabled(),inputProps:{name:"font-input",autoComplete:"off",tabIndex:0,type:"number",maxLength:4,max:409,min:2},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:R=>`1px solid ${R.palette.text.icon??R.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:R=>`1px solid ${R.palette.error.main}`},"::after":{borderBottom:R=>`1px solid ${R.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:R=>`${Math.round(R.typography.fontSize)}px`,width:v,color:R=>R.palette.text.secondary,input:{padding:"0 0",textAlign:"center",height:"1rem",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:R=>R.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:R=>R.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"}},value:m,onFocus:R=>{R.target?.select()},onKeyDown:R=>{if(R.which===w.KeyCodes.Enter)u()!==m&&(R.stopPropagation(),R.preventDefault(),S());else if(R.which===w.KeyCodes.Escape)u()!==m&&(b(u()),setTimeout(()=>{R.target?.select()},0),R.stopPropagation(),R.preventDefault());else{if(R.key.match("[-]")||R.key.match("[0-9.]")&&(m+R.key).length>4)return R.stopPropagation(),void R.preventDefault();if(R.which===w.KeyCodes.Space)return void R.preventDefault()}},onBlur:()=>{S()},onChange:R=>{if(R.target.value.length>4)return R.stopPropagation(),void R.preventDefault();b(R.target.value)}})})},[m,f,o]),M=n.useCallback(P=>{const I=N=>{o?.execute(N,t)},D=o?.state(),E=[];for(let N=0;N<c.length;N++){const z=c[N]===D;E.push(e.jsx(C.ExhibitMenuItem,{selected:z,icon:z?e.jsx(C.SelectedIcon,{}):void 0,disabled:f||!o||o.disabled(),onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&I(c[N])},onKeyDown:O=>{O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||I(c[N])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:c[N]})},"fontSize-"+N))}const R=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...p,children:[k,e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:E})]});return C.defaultCreatePopupPanel({...P,children:R})},[f,o?.state(),t]);return e.jsx(C.ExhibitPopupIconButton,{ref:i,sx:{...y},tabIndex:-1,outlined:!0,disabled:f,parentFloat:l,createPopupPanel:M,createTooltip:({children:P},I)=>e.jsx(C.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:I||o?.disabled(),children:P}),createQuickButton:T,...p})})),Rn=n.memo(a=>{const{selected:i,disabled:o,formattedValue:t,handleSetFormat:r,format:s,sx:c,...f}=a;return e.jsx(C.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...c},disabled:o,selected:i,icon:i?e.jsx(C.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)},...f,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(B.Typography,{component:"div",children:[s.formatType,s.formatType===A.NumberFormat.Type.Custom?"…":""]}),e.jsx(B.Typography,{variant:"caption",component:"div",sx:{color:l=>Re.alpha(l.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),Aa=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,sx:s,disabled:c=!1,parentFloat:f,...l}=a,d=w.useCommands(o,["formatNumberFormat"])[0],g=d?.state()?A.NumberFormat.Styles.lookupStyle(d?.state()).formatType:A.NumberFormat.Type.General,y=n.useMemo(()=>{if(!t)return null;const b={...t};return delete b.beforeExecute,b},[t]),p=n.useCallback((b,S)=>{const x=D=>{t?.beforeExecute?.(d,d?.state()),d.execute(D,t),t?.onExecute?.(d,d?.state())},h=d?.context()(),k=A.NumberFormat.Styles.lookupPrimary(),j=[];for(let D=0;D<k.length;D++){let E="";if(h&&!h.isEmpty())try{E=h.getNumberFormat(k[D].numberFormat).displayText}catch(N){console.warn(N)}E===""&&k[D].formatType===A.NumberFormat.Type.General&&(E="No specific format");const R=k[D].formatType===g;j.push(e.jsx(Rn,{selected:R,disabled:c||!d||d.disabled(),formattedValue:E,handleSetFormat:x,format:k[D]},k[D].formatType))}const v={numberFormat:"",formatType:A.NumberFormat.Type.Custom},T=g===A.NumberFormat.Type.Custom,M=e.jsx(Rn,{selected:T,disabled:c||!d||d.disabled(),formattedValue:T?h.getNumberFormat().displayText:"",handleSetFormat:()=>{t?.beforeExecute?.(d,d?.state()),S.getCommand("formatNumberDialog")?.execute(d?.state()),t?.onExecute?.(d,d?.state())},format:v,sx:{flex:"0",width:"100%"}},A.NumberFormat.Type.Custom),P=e.jsxs(B.Box,{className:"quick-buttons",sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:D=>D.stopPropagation(),children:[e.jsx(C.CommandButton,{command:S.getCommand("formatNumberFormatAccountingStyle"),commandHook:y,scope:r}),e.jsx(C.CommandButton,{command:S.getCommand("formatNumberFormatPercentStyle"),commandHook:y,scope:r}),e.jsx(C.CommandButton,{command:S.getCommand("formatNumberFormatCommaStyle"),commandHook:y,scope:r}),e.jsx(C.CommandButton,{command:S.getCommand("formatNumberFormatIncreaseDecimal"),commandHook:y,scope:r}),e.jsx(C.CommandButton,{command:S.getCommand("formatNumberFormatDecreaseDecimal"),commandHook:y,scope:r})]}),I=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...l,children:[P,e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:j}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),M]});return C.defaultCreatePopupPanel({...b,children:I})},[d?.context(),d?.state(),t,r]),u=X.useTheme(),m=n.useMemo(()=>{const b=A.NumberFormat.Type.MediumTime;return`${A.IFont.getSharedMeasurer()(b,Math.round(u.typography.fontSize),u.typography.fontFamily).width}px`},[u]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,sx:s,outlined:!0,disabled:c,parentFloat:f,createPopupPanel:p,createTooltip:({children:b},S)=>e.jsx(C.ExhibitTooltip,{label:d?.label(),description:d?.description(),disabled:S,children:b}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:b=>`${Math.round(b.typography.fontSize)}px`,color:b=>b.palette.text.secondary,fontFamily:b=>b.typography.fontFamily,width:m},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...l})})),Lo=n.memo(n.forwardRef((a,i)=>e.jsx(C.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["clearAll","clearFormats","clearContents","clearComments","clearHyperlinks"],scope:"clear",label:"Clear",tooltip:"Clear everything in the cell, or remove just the formatting or contents.",icon:"ClearAll"}))),La=n.memo(n.forwardRef((a,i)=>e.jsx(C.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["fillDown","fillRight","fillUp","fillLeft"],scope:"fill",label:"Fill",tooltip:"Fill the selected cells with the value from one of the corners.",icon:"FillDown"}))),zo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:c=!1,preferSingleMenu:f=!0,showQuickButton:l=!0,variant:d=w.CommandButtonType.Toolbar,...g}=a,y=["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns","addSheet"];c||y.push("addSheet");const p=w.useCommands(o,y),{singleCommand:u,allDisabled:m}=n.useMemo(()=>{let S=null,x=0;const h=p.length;for(let k=0;k<h;k++){const j=p[k];j&&!j.disabled()&&(f&&d===w.CommandButtonType.Menuitem&&(S=x===0?j:null),x++)}return{singleCommand:S,allDisabled:x===0}},[p]),b=n.useCallback((S,x)=>{let h=null;const k={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertCells",disabled:s};c||(h=e.jsxs(e.Fragment,{children:[e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...k,command:x.getCommand("addSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...k,command:p[0]}),e.jsx(C.CommandButton,{...k,command:p[1]}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...k,command:p[2]}),e.jsx(C.CommandButton,{...k,command:p[3]}),h]});return C.defaultCreatePopupPanel({...S,children:j})},[s,p,t,r]);return u?e.jsx(C.CommandButton,{ref:i,variant:d,commandHook:t,disabled:s,command:u,...g}):e.jsx(C.CommandPopupButton,{ref:i,variant:d,quickCommand:"insertCells",commands:o,commandHook:t,scope:r,disabled:s||m,tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Insert new cells, rows or columns to your workbook."}),e.jsx("br",{}),e.jsx("span",{children:"To insert multiple rows or columns at a time, select multiple rows or columns in the sheet and click Insert."})]}),createPopupPanel:b,...g})})),Ho=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:c=!1,preferSingleMenu:f=!0,showQuickButton:l=!0,variant:d=w.CommandButtonType.Toolbar,...g}=a,y=["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"];c||y.push("deleteSheet");const p=w.useCommands(o,y),{singleCommand:u,allDisabled:m}=n.useMemo(()=>{let S=null,x=0;const h=p.length;for(let k=0;k<h;k++){const j=p[k];j&&!j.disabled()&&(f&&d===w.CommandButtonType.Menuitem&&(S=x===0?j:null),x++)}return{singleCommand:S,allDisabled:x===0}},[p]),b=n.useCallback((S,x)=>{const h={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:s};let k=null;c||(k=e.jsxs(e.Fragment,{children:[e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...h,command:x.getCommand("deleteSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...h,command:x.getCommand("deleteCellsShiftUp")}),e.jsx(C.CommandButton,{...h,command:x.getCommand("deleteCellsShiftLeft")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...h,command:x.getCommand("deleteRows")}),e.jsx(C.CommandButton,{...h,command:x.getCommand("deleteColumns")}),k]});return C.defaultCreatePopupPanel({...S,children:j})},[s,t,r]);return u?e.jsx(C.CommandButton,{ref:i,variant:d,commandHook:t,disabled:s,command:u,...g}):e.jsx(C.CommandPopupButton,{ref:i,variant:d,quickCommand:"deleteCells",commands:o,commandHook:t,scope:r,disabled:s||m,tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Delete cells, rows, columns or sheets from your workbook."}),e.jsx("br",{}),e.jsx("span",{children:"To delete multiple rows or columns at a time, select multiple rows or columns in the sheet and click Delete."})]}),createPopupPanel:b,...g})})),Wo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=w.useCommands(o,["resizeRows","autoFitRows","resizeColumns","autoFitColumns","hideColumns","hideRows","unhideColumns","unhideRows"]),{allDisabled:l}=n.useMemo(()=>{let g=0;const y=f.length;for(let p=0;p<y;p++){const u=f[p];u&&!u.disabled()&&g++}return{allDisabled:g===0}},[f]),d=n.useCallback((g,y)=>{const p={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"formatCells"},u={commands:y,parentFloat:g.floatReference,...p},m=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...p,command:y.getCommand("resizeRows")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("autoFitRows")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...p,command:y.getCommand("resizeColumns")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("autoFitColumns")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.SimpleCommandPopupButton,{ref:i,...u,popupCommandKeys:["hideColumns","hideRows",null,"unhideColumns","unhideRows"],popupScope:"hideUnhide",label:"Hide & Unhide"})]});return C.defaultCreatePopupPanel({...g,children:m})},[t,r]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,createPopupPanel:d,disabled:s||l,icon:"CellsFormat",label:"Format Cells",tooltip:"Change row and column sizes or visibility.",...c})}));Wo.displayName="CellsFormatCommandButton";const ht=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,onSelectColor:r,disabled:s=!1,variant:c=w.CommandButtonType.Toolbar,quickColor:f,panelProps:l,isSplit:d=!1,darkMode:g,icon:y,...p}=a,{autoColor:u,schemeLookup:m,recentColors:b,...S}=l;if(p.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");w.useCommand(o);const x=o?.context();let h=f??x?.quickColor;d&&!h&&(h=new A.Color("transparent"));const k=u??x?.autoColor,j=m??x?.schemeLookup,v=b??x?.recentColors,T=g??x?.darkMode,M=n.useMemo(()=>({autoColor:k,schemeLookup:j,recentColors:v,darkMode:T,...S}),[k,j,v,T]),P=w.useCallbackRef((D,E)=>{D&&E&&x?.addRecentColor&&x.addRecentColor(D),x?.onColorSelect&&x.onColorSelect(D),r?.(D,E),o?.execute(D,t)},[o,r,t,x]),I=n.useCallback((D,E)=>{const{children:R,title:N,...z}=D;let O=D.children;return(o?.disabled()||s)&&(O=e.jsx("div",{children:O})),e.jsx(C.CommandTooltip,{command:o,placement:c===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:E,...z,children:O})},[o,s]);return e.jsx(Ao,{ref:i,panelProps:M,icon:y??o?.icon(x),quickColor:h,selectedColor:o?.state(),onSelectColor:P,variant:c===w.CommandButtonType.Menuitem?C.PopupButtonType.Menuitem:C.PopupButtonType.Toolbar,createTooltip:I,label:o?.label(),disabled:s||!o||o.disabled(),compareRGB:!0,darkMode:T,...p})}));ht.displayName="ColorCommandButton";const za=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...f}=a,l=w.useCommands(o,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),d=n.useCallback((g,y)=>{const p={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...p,command:y.getCommand("gridlinesToggle")}),e.jsx(ht,{...p,command:y.getCommand("sheetViewFormatGridlinesColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0}}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...p,command:y.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("sheetViewToggleGridlinesRows")})]});return C.defaultCreatePopupPanel({...g,children:u})},[s,t]);return e.jsx(C.CommandPopupButton,{ref:i,parentFloat:c,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:d,label:"Gridlines",tooltip:"Configure how the lines between rows and columns in the sheet are displayed.",icon:e.jsx(C.LabelIcon,{command:l[0],scope:"view"}),...f})})),$o=n.memo(n.forwardRef((a,i)=>e.jsx(C.SimpleCommandPopupButton,{ref:i,...a,popupCommandKeys:["sortAscending","sortDescending","sortCustom",null,"autoFilterToggle","autoFilterClear","autoFilterReapply"],scope:"sortFilter",label:"Sort & 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."})]}),icon:"SortFilter"}))),Vi=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=n.useCallback((l,d)=>{const g={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},y=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...g,scope:"filter",command:d.getCommand("autoFilterToggle")}),e.jsx(C.CommandButton,{...g,scope:"filter",command:d.getCommand("autoFilterClear")}),e.jsx(C.CommandButton,{...g,scope:"filter",command:d.getCommand("autoFilterReapply")})]});return C.defaultCreatePopupPanel({...l,children:y})},[s,t,r]);return e.jsx(C.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:f,icon:"FilterToggle",...c})})),Vo=n.memo(n.forwardRef((a,i)=>{const{quickCommand:o,icon:t,isRedo:r=!1,nestRedo:s=!0,undoManager:c,scope:f,sx:l,disabled:d,commands:g,...y}=a,p=[o];!r&&s&&p.push("redo");const u=w.useCommands(g,p),m=u[0],b=u[1],S=c??m?.context?.()?.undoManager;let x=d;d||(x=!m||m.disabled(),b&&!b.disabled()&&(x=!1));const[h,k]=n.useState(0),j=n.useCallback((v,T)=>{let M=h===0?"Cancel":`${m.label()} ${h} Action${h===1?"":"s"}`,P=!1;S||(P=!0),P||(P=s?!S.hasRedo()&&!S.hasUndo():!S.hasRedo());const I=O=>{m.execute(O)},D=e.jsx(C.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:P?void 0:"0 0",minWidth:"180px"},icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(0)},onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&I(h)},onKeyDown:O=>{O.isDefaultPrevented()||O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||I(h)},children:e.jsx(B.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:M})});if(P)return D;const E=r?S?.getRedoDescriptions():S?.getUndoDescriptions(),R=[];for(let O=0;O<E.length;O++){const L=E[O];R.push(e.jsx(C.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},disabled:x,selected:O<h,icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(O+1)},onMouseDown:F=>{F.button===0&&F.preventDefault()},onMouseUp:F=>{F.button===0&&I(O+1)},onKeyDown:F=>{F.isDefaultPrevented()||F.keyCode!==w.KeyCodes.Enter&&F.keyCode!==w.KeyCodes.Space||I(O+1)},children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",alignItems:"center",overflow:"hidden"},children:[e.jsx(B.Typography,{component:"div",children:L}),e.jsx(w.DynamicIcon,{})]})},`action:${O}`))}let N=null;if(!r&&s){const O={scope:"undo",commands:T,variant:w.CommandButtonType.Menuitem,parentFloat:v.floatReference};N=[],N.push(e.jsx(Vo,{...O,quickCommand:"redo",isRedo:!0},"nested:redo")),S.hasRedo()&&S.hasUndo()&&N.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal"},"action:redo-div"))}const z=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},onClick:()=>{v.closeFloatAll()},onMouseLeave:()=>{k(0)},children:[N,e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:R}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),D]});return C.defaultCreatePopupPanel({...v,children:z})},[m?.context(),m?.state(),f,S,h,x]);return e.jsx(C.CommandPopupButton,{ref:i,commands:g,quickCommand:o,scope:f,disabled:x,label:m?.label()??(r?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${m?.label()??"No"} last actions.`})}),createPopupPanel:j,icon:t??(r?"Redo":"Undo"),selected:!1,...y})})),ft=A.IFontCollection.getFontList(),Ha=new Map;for(let a=0;a<ft.length;a++)Ha.set(ft[a].fontRef.getFamily(),ft[a]);const Wa=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,sx:r,disabled:s=!1,parentFloat:c,icon:f,label:l,...d}=a;w.useCommand(o);const g=o?.state(),y=X.useTheme(),p=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("Times New Roman",Math.round(y.typography.fontSize),y.typography.fontFamily).width}px`,[y]),u=n.useCallback(m=>{const b=k=>{o?.execute(k,t)},S=[];for(let k=0;k<ft.length;k++)S.push({key:ft[k].fontRef.getFamily(),description:ft[k].fontRef.getFamily()});Ha.get(g)||S.unshift({key:g,description:g});const x=[];for(let k=0;k<S.length;k++){const j=S[k].key===g;x.push(e.jsx(C.ExhibitMenuItem,{sx:{display:"flex",paddingTop:"4px",paddingBottom:"4px"},selected:j,disabled:s||!o||o.disabled(),icon:j?e.jsx(C.SelectedIcon,{}):void 0,onMouseUp:v=>{v.button===0&&b(S[k].key)},onMouseDown:v=>{v.button===0&&v.preventDefault()},onKeyDown:v=>{v.keyCode!==w.KeyCodes.Enter&&v.keyCode!==w.KeyCodes.Space||b(S[k].key)},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:()=>S[k]?.key},children:S[k].description})})},k+""+S[k].key))}const h=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},...d,children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:x})});return C.defaultCreatePopupPanel({...m,children:h})},[s,o?.state()]);return e.jsx(C.ExhibitPopupIconButton,{ref:i,sx:{...r},outlined:!0,disabled:s,parentFloat:c,createPopupPanel:u,createTooltip:({children:m},b)=>e.jsx(C.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:b,children:m}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:m=>`${Math.round(m.typography.fontSize)}px`,fontFamily:m=>m.typography.fontFamily,color:m=>m.palette.text.secondary,width:p},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...d})})),$a=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=w.useCommands(o,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),l=n.useMemo(()=>{const g=f.length;for(let y=0;y<g;y++){const p=f[y];if(p?.state())return p}return f[0]},[f]),d=n.useCallback((g,y)=>{const p={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...p,command:y.getCommand("formatStrikeThroughToggle")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("formatSuperscriptToggle")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("formatSubscriptToggle")})]});return C.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,createPopupPanel:d,label:"Text Effects",tooltip:"Style your text to differentiate it.",icon:l?.icon()??"TextStrike",...c})})),Va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=w.useCommands(o,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),l=n.useMemo(()=>{const g=f.length;for(let y=0;y<g;y++)if(f[y]?.state())return f[y];return f[0]},[f]),d=n.useCallback((g,y)=>{const p={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...p,command:y.getCommand("formatUnderlinedToggle")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("formatUnderlinedDoubleToggle")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("formatUnderlinedAccountingToggle"),commandHook:t}),e.jsx(C.CommandButton,{...p,command:y.getCommand("formatUnderlinedAccountingDoubleToggle")})]});return C.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,label:"Underline",tooltip:"All underline stylings.",createPopupPanel:d,icon:l?.icon()??"TextUnderline",...c})})),_o=n.memo(n.forwardRef((a,i)=>{const{command:o,commands:t,commandHook:r,scope:s,includePasteAllInPopup:c=!0,disabled:f=!1,...l}=a,d=w.useCallbackRef((g,y)=>{const p={variant:w.CommandButtonType.Menuitem,commandHook:r,scope:"paste",disabled:f},u=[];return c&&(u.push(n.createElement(C.CommandButton,{...p,command:y.getCommand("paste"),key:"paste"})),u.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),u.push(n.createElement(C.CommandButton,{...p,command:y.getCommand("pasteValues"),key:"pasteValues"})),u.push(n.createElement(C.CommandButton,{...p,command:y.getCommand("pasteFormats"),key:"pasteFormats"})),u.push(n.createElement(C.CommandButton,{...p,command:y.getCommand("pasteFormulas"),key:"pasteFormulas"})),u.push(n.createElement(C.CommandButton,{...p,command:y.getCommand("pasteTranspose"),key:"pasteTranspose"})),u.push(n.createElement(C.CommandButton,{...p,command:y.getCommand("pasteLinks"),key:"pasteLinks"})),C.defaultCreatePopupPanel({...g,children:u})},[f,r,s,c]);return e.jsx(C.CommandPopupButton,{ref:i,commands:t,commandHook:r,scope:s,createPopupPanel:d,label:"Paste",tooltip:"Add content to the clipboard to your document.",quickCommand:"paste",...l})})),_a=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...f}=a,l=w.useCommands(o,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),d=n.useCallback((g,y)=>{const p={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...p,command:y.getCommand("sheetViewToggleShowHeadings")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...p,command:y.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(C.CommandButton,{...p,command:y.getCommand("sheetViewToggleShowHeadingRows")})]});return C.defaultCreatePopupPanel({...g,children:u})},[s,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,parentFloat:c,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:d,label:"Headings",tooltip:"Configure how the column and rows headings in the sheet are displayed.",icon:e.jsx(C.LabelIcon,{command:l[0],scope:"view"}),...f})})),Ka=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="view",disabled:s=!1,...c}=a,f=n.useCallback(l=>{const d={variant:w.CommandButtonType.Menuitem,parentFloat:l.floatReference,commandHook:t,scope:r,disabled:s},g=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...d,command:o.getCommand("workbookViewToggleShowFormulaBar")}),e.jsx(C.CommandButton,{...d,command:o.getCommand("workbookViewToggleShowTabs")}),e.jsx(C.CommandButton,{...d,command:o.getCommand("workbookViewToggleShowStatusBar")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...d,command:o.getCommand("workbookViewToggleShowHorizontalScrollBar")}),e.jsx(C.CommandButton,{...d,command:o.getCommand("workbookViewToggleShowVerticalScrollBar")})]});return C.defaultCreatePopupPanel({...l,children:g})},[s,o,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Workbook View",tooltip:"Options to configure how the workbook is displayed.",createPopupPanel:f,icon:e.jsx(C.LabelIcon,{icon:null,label:"Workbook View"}),...c})})),Ua=n.memo(n.forwardRef((a,i)=>{const{value:o,cellStyle:t,styles:r,createTemporaryCell:s,bodyStyle:c,sx:f,borderProps:l,disabled:d,...g}=a,y=n.useMemo(()=>s({value:o,style:t}),[o,t,s]),p=n.useMemo(()=>y.getStyle(),[y,c]),u=n.useMemo(()=>p.getFill().toCSS(c?.darkMode??!1),[p]),m=p.getInsets(),b=p.getFont(),S=n.useCallback(()=>p.getBorder(),[p]);return e.jsx(B.Box,{ref:i,sx:{width:"100px",height:"100%",textOverflow:"ellipsis",display:"flex",alignItems:"stretch",background:c?.fill,filter:d?"grayscale(0.4) opacity(0.8);":"none","& .fill":{flex:"1 1 100%",overflow:"hidden",...u},"& .text":{flex:"1 1 100%",...b.toCSS(c?.darkMode??!1,1),boxSizing:"border-box",padding:`${m.top}px ${m.right}px ${m.bottom}px ${m.left}px`,margin:"0px",outline:"none",resize:"none",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"baseline",textDecoration:b.toCSS().textDecoration,textAlign:A.ITextFrame.toCSSHorizontalTextAlign(y.getRenderHorizontalAlignment()),background:"transparent",maxHeight:"100%",whiteSpace:"pre",wordWrap:"break-word"},...f},...g,children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:S,darkMode:c?.darkMode??!1,rowCount:1,columnCount:1,style:{height:"100%",width:"100%",...l?.style},...l,children:e.jsx(B.Box,{className:"fill",sx:{paddingLeft:"4px",paddingRight:"4px",marginLeft:"-1px",marginTop:"-1px",marginRight:"-2px",marginBottom:"-2px",display:"flex",alignItems:"center"},children:e.jsx(B.Box,{className:"text",children:o})})})})})),_i=n.memo(a=>{const{styles:i,namedStyle:o,selectedNamed:t,hasContextMenu:r=!0,bodyStyle:s,onSelectNamed:c,createTemporaryCell:f,parentFloat:l,commands:d,disabled:g,commandHook:y,...p}=a,u=n.useCallback(S=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:y,context:"cellStyle"},h=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...x,style:{fontWeight:550},command:d.getCommand("formatCellStyle"),commandState:o,disabled:g}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...x,command:d.getCommand("modifyCellStyle"),commandState:{named:o}}),e.jsx(C.CommandButton,{...x,command:d.getCommand("deleteCellStyle"),commandState:o,disabled:g||o?.getName()===A.IStyle.BuiltInName.Normal})]}),k=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:h})});return C.defaultCreatePopupPanel({...S,children:k})},[]),m=o?.getName()===t?.getName();let b=e.jsx(C.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:S=>`solid ${m?S.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName(),placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{c?.(o)},...p,children:e.jsx(Ua,{value:o.getName(),cellStyle:{named:o.getName()},styles:i,createTemporaryCell:f,bodyStyle:s})},o.getName());return r&&(b=e.jsx(C.ContextMenu,{label:o.getName(),parentFloat:l,createPopupPanel:u,children:b})),b}),qa=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedNamed:s,onSelectNamed:c,disabled:f=!1,bodyStyle:l,usePreviewIcon:d=!0,...g}=a;w.useCommand(t);const y=t?.context(),p=y?.styles,u=s??y?.named(),m=l??y?.bodyStyle(),b=w.useCallbackRef(j=>{c?.(j),t?.execute(j,r)},[t,c,r]),S=n.useCallback((j,v)=>{const T={onSelectNamed:b,styles:p(),parentFloat:j.floatReference},M=p().getCustomNamed(),P=new Map,I=[];for(let F=0;F<M.length;F++)P.set(M[F].getName(),M[F]),p().getNamed(M[F].getName()).getBuiltInID()===null&&I.push(M[F].getName());const D=F=>{let $=P.get(F);return $||($=p().getNamed(F)),!$||$.isHidden()?null:e.jsx(_i,{namedStyle:$,selectedNamed:u,bodyStyle:y.bodyStyle(),createTemporaryCell:y.createTemporaryCell,commands:o,commandHook:r,...T},F)},E=(F,$,Q=!0)=>{const Y=[];for(let te=0;te<$.length;te++){const K=D($[te]);K&&Y.push(K)}return Y.length===0?null:e.jsxs(B.Box,{children:[Q?e.jsx(C.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(C.ExhibitMenuHeader,{children:F},F+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:Y},F+"-presets")]},F)},R=(F,$)=>{const Q=[];for(let Y=0;Y<$.length;Y++){const te=D($[Y]);te&&Q.push(te)}return Q.length===0?null:e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",flexDirection:"column",flex:"0 0 0%"},children:Q},F+"-presets")},N=[];N.push(E("Custom",I,!1)),N.push(E("Good, Bad and Neutral",[A.IStyle.BuiltInName.Normal,A.IStyle.BuiltInName.Bad,A.IStyle.BuiltInName.Good,A.IStyle.BuiltInName.Neutral],I.length>0)),N.push(E("Data and Model",[A.IStyle.BuiltInName.Calculation,A.IStyle.BuiltInName.CheckCell,A.IStyle.BuiltInName.ExplanatoryText,A.IStyle.BuiltInName.FollowedHyperlink,A.IStyle.BuiltInName.Hyperlink,A.IStyle.BuiltInName.Input,A.IStyle.BuiltInName.LinkedCell,A.IStyle.BuiltInName.Note,A.IStyle.BuiltInName.Output,A.IStyle.BuiltInName.WarningText])),N.push(E("Titles and Headings",[A.IStyle.BuiltInName.Heading1,A.IStyle.BuiltInName.Heading2,A.IStyle.BuiltInName.Heading3,A.IStyle.BuiltInName.Heading4,A.IStyle.BuiltInName.Title,A.IStyle.BuiltInName.Total]));let z=[];var O,L;return z.push(R("Accent 1",[A.IStyle.BuiltInName.Accent1_20,A.IStyle.BuiltInName.Accent1_40,A.IStyle.BuiltInName.Accent1_60,A.IStyle.BuiltInName.Accent1])),z.push(R("Accent 2",[A.IStyle.BuiltInName.Accent2_20,A.IStyle.BuiltInName.Accent2_40,A.IStyle.BuiltInName.Accent2_60,A.IStyle.BuiltInName.Accent2])),z.push(R("Accent 3",[A.IStyle.BuiltInName.Accent3_20,A.IStyle.BuiltInName.Accent3_40,A.IStyle.BuiltInName.Accent3_60,A.IStyle.BuiltInName.Accent3])),z.push(R("Accent 4",[A.IStyle.BuiltInName.Accent4_20,A.IStyle.BuiltInName.Accent4_40,A.IStyle.BuiltInName.Accent4_60,A.IStyle.BuiltInName.Accent4])),z.push(R("Accent 5",[A.IStyle.BuiltInName.Accent5_20,A.IStyle.BuiltInName.Accent5_40,A.IStyle.BuiltInName.Accent5_60,A.IStyle.BuiltInName.Accent5])),z.push(R("Accent 6",[A.IStyle.BuiltInName.Accent6_20,A.IStyle.BuiltInName.Accent6_40,A.IStyle.BuiltInName.Accent6_60,A.IStyle.BuiltInName.Accent6])),N.push((O="Themed Cell Styles",L=z,e.jsxs(B.Box,{children:[e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.ExhibitMenuHeader,{children:O},O+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:L},O+"-presets")]},O))),N.push(E("Number Format",[A.IStyle.BuiltInName.Comma,A.IStyle.BuiltInName.Comma0,A.IStyle.BuiltInName.Currency,A.IStyle.BuiltInName.Currency0,A.IStyle.BuiltInName.Percent])),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:F=>`${F.shape.borderRadius}px`,paddingBottom:F=>`${F.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",paddingTop:"6px",paddingBottom:"0px",paddingLeft:"16px",paddingRight:"16px"},children:N}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:u,command:v.getCommand("newCellStyle"),context:"styles",commandHook:r,disabled:f})]})},[u,p?.().getTheme(),m]),x=w.useCallbackRef(j=>{const v=18/A.IFont.getDeviceScale(),T=y?.createTemporaryCell(j);return T.getStyle().getFont().getSize()<=v?T:T.createTemporaryCell({style:{font:{size:v}}})},[y?.createTemporaryCell]),h=f||!t||t.disabled(),k=n.useMemo(()=>y&&d?e.jsx(Ua,{value:u?.getName()??"Custom",cellStyle:u?{named:u.getName()}:void 0,styles:y.styles(),createTemporaryCell:x,bodyStyle:y.bodyStyle(),className:"outline-hover",disabled:h,sx:{marginRight:"4px",borderRadius:"2px",minHeight:"calc(100% - 2px)",overflow:"hidden",outline:j=>`1px solid ${j.palette.action.hover}`},borderProps:{style:{height:"calc(100% - 2px)",width:"calc(100% - 1px)"}}}):t?.icon(),[u,m,h,t]);return e.jsx(C.CommandPopupButton,{ref:i,createPopupPanel:S,outlined:d,commands:o,createTooltip:({children:j},v)=>e.jsx(C.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:v,children:j}),selected:!1,disabled:h,label:t?.label(),icon:k,...g})})),Ga="_sheetxl-reset_11z3j_1",Ki=10,Ko=n.memo(n.forwardRef((a,i)=>{const{styles:o,table:t,tableStyle:r=t?.getStyle()??o.getDefaultTableStyle(),bodyStyle:s,sx:c,disabled:f,className:l,forceThinBorder:d,cellHeight:g=Ki,isLive:y=!1,...p}=a,u=Math.ceil(1.3*g),[m,b]=n.useReducer(j=>j+1,0);n.useEffect(()=>{if(y&&t)return t.addListeners({onAnyChange:()=>{b()}})},[t,y]);const S=n.useMemo(()=>{let j=t?.toJSON()??{};const v={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return j&&(j.styleOptions={...j.styleOptions,name:r.getName()}),j.ref=v,new A.Table({initialAnchor:v,json:j,styles:o})},[m,t,r,o]),x=n.useMemo(()=>{const j=[];for(let v=0;v<5;v++)for(let T=0;T<5;T++){const M=S.getStyleAt({colIndex:T,rowIndex:v});j.push(M)}return j},[S]),h=n.useMemo(()=>{const j=(T,M,P)=>{let I=P.getFill().toCSS(s?.darkMode??!1);const D=u-(M<4?1:0),E=g-(T<4?1:0),R=P.getFont().getFill().toCSS(s?.darkMode??!1);return I={...I,position:"absolute",boxSizing:"border-box",left:M*(u-1),top:T*(g-1),width:D,height:E},e.jsx("td",{className:`table-style-fill ${T}-${M}`,style:I,children:e.jsx("div",{className:`table-style-text ${T}-${M}`,style:{position:"absolute",boxSizing:"border-box",width:"6px",left:(D-6)/2,top:(E-1)/2,borderTop:`1px solid ${R}`}})},`${T}-${M}`)},v=[];for(let T=0;T<5;T++){const M=[];for(let P=0;P<5;P++){const I=x[5*T+P];M.push(j(T,P,I))}v.push(e.jsx("tr",{children:M},T))}return v},[S,r,s]),k=n.useCallback((j,v)=>x[v].getBorder()??null,[x]);return e.jsx(B.Box,{ref:i,className:"table-format-preview",sx:{background:s?.fill,filter:f?"grayscale(0.4) opacity(0.8);":"none","& .styled-element":{position:"absolute"},...c},...p,children:e.jsx(oe.StaticBorderRenderer,{getBorderAt:k,rowCount:5,columnCount:5,forceThinBorder:d,width:5*(u-1)+1,height:5*(g-1)+1,darkMode:s?.darkMode??!1,style:{pointerEvents:"none"},children:e.jsx("table",{className:se(l,"sheetxl-table-preview",Ga),style:{borderCollapse:"collapse",width:5*(u-1)+1,height:5*(g-1)+1},children:e.jsx("tbody",{children:h})})})})})),St=(a,i,o,t,r)=>{a.beginPath(),a.moveTo(i+.5,o+.5),a.lineTo(t+.5,r+.5),a.stroke()},Xa=n.memo(n.forwardRef((a,i)=>{const{table:o,tableStyle:t,styles:r,bodyStyle:s,disabled:c,style:f,className:l,canvas:d,...g}=a,y=n.useMemo(()=>{const m=o.toJSON(),b={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return m.styleOptions={...m.styleOptions,name:t.getName()},m.ref=b,new A.Table({initialAnchor:b,json:m,styles:r})},[o,t,r]),p=n.useMemo(()=>{const m=[];for(let b=0;b<5;b++)for(let S=0;S<5;S++){const x=y.getStyleAt({colIndex:S,rowIndex:b});m.push(x)}return m},[y]),u=n.useMemo(()=>{let m=d;if(d||(m=document.createElement("canvas")),!m)return null;m.width!==61&&(m.width=61),m.height!==46&&(m.height=46);const b=m.getContext("2d",{alpha:!1});if(!b)return null;const S=12,x=s?.darkMode??!1;for(let h=0;h<5;h++)for(let k=0;k<5;k++){const j=p[5*h+k].getFill();let v=s?.fill;j.getType()===A.IFill.Type.Solid?v=j.getColor().toCSS(x,!1):j.getType()===A.IFill.Type.Gradient?v=j.getStops[0]?.color.toCSS(x,!1):j.getType()===A.IFill.Type.Pattern&&(v=j.getForeground().toCSS(x,!1)),b.fillStyle=v;const T=k*S,M=9*h;b.fillRect(T,M,13,10)}b.lineWidth=1;for(let h=0;h<5;h++)for(let k=0;k<5;k++){const j=p[5*h+k],v=k*S,T=9*h,M=j.getBorder();if(!M.isEmpty()){const D=M.getLeft();D.isNone()||(b.strokeStyle=D.getColor().toCSS(x,!1),St(b,v,T,v,T+9));const E=M.getTop();E.isNone()||(b.strokeStyle=E.getColor().toCSS(x,!1),St(b,v,T,v+S,9*h));const R=M.getRight();R.isNone()||(b.strokeStyle=R.getColor().toCSS(x,!1),St(b,v+S,T,v+S,T+9));const N=M.getBottom();N.isNone()||(b.strokeStyle=N.getColor().toCSS(x,!1),St(b,v,T+9,v+S,T+9))}b.strokeStyle=j.getFont().getFill().toCSS(x,!1);const P=4,I=2.5;St(b,k*S+I,9*h+P,k*S+I+7,9*h+P)}return`url(${m.toDataURL()})`},[d,y,t,s]);return e.jsx("div",{ref:i,className:se("table-style-preview",l),style:{backgroundImage:u,width:61,height:46,...f},...g})})),Ui="_table-style-options-container_1kfn2_1",qi="_table-style-options_1kfn2_1",Ya=n.memo(n.forwardRef((a,i)=>{const{styleOptions:o,onStyleOptionsChange:t,showHeaderRow:r,onShowHeaderRowChange:s,showTotalRow:c,onShowTotalRowChange:f,showFilterButton:l,onShowFilterButtonChange:d,sx:g,className:y,disabled:p,...u}=a;return e.jsx("div",{className:Ui,children:e.jsxs(B.Box,{sx:{pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:m=>`${m.spacing(2)}`,marginRight:m=>`${m.spacing(2)}`},"& .MuiCheckbox-root":{padding:m=>`${m.spacing(.5)}`},...g},...u,ref:i,className:se(y,qi),children:[s&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:r??!1,indeterminate:r==null,onChange:()=>s(!r),disabled:p||r==null}),label:"Header Row",labelPlacement:"end"}),f&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:c??!1,indeterminate:c==null,onChange:()=>f(!c),disabled:p||c==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showRowStripes??!1,indeterminate:!o,disabled:p||!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:p||!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:p||!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:p||!o,onChange:()=>{t?.({...o,showColumnStripes:!o?.showColumnStripes})}}),label:"Banded Columns",labelPlacement:"end"}),d&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:l??!1,indeterminate:l==null,disabled:p||!o||l==null,onChange:()=>d(!l)}),label:"Filter Button",labelPlacement:"end"})]})})}));function bo(a,i){if(typeof a=="function")return a(i);a&&(a.current=i)}var tt=parseInt(n.version.split(".")[0],10)>=19?function(a){return i=>{const o=[];for(const t of a){const r=bo(t,i),s=typeof r=="function";o.push(s?r:()=>bo(t,null))}return()=>{for(const t of o)t()}}}:function(a){return i=>{for(const o of a)bo(o,i)}},Gi=function(){},Za=typeof window<"u",ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Xi=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],c=n.useMemo(function(){return new window.ResizeObserver(function(f){if(f[0]){var l=f[0].contentRect,d=l.x,g=l.y,y=l.width,p=l.height,u=l.top,m=l.left,b=l.bottom,S=l.right;s({x:d,y:g,width:y,height:p,top:u,left:m,bottom:b,right:S})}})},[]);return Xi(function(){if(i)return c.observe(i),function(){c.disconnect()}},[i]),[o,r]}:function(){return[Gi,Pn]},Yi="_range-row_akhf4_1",Zi="_action-row_akhf4_15",Qa=n.createContext(null);Qa.displayName="HookFormContext";const Ja=()=>n.useContext(Qa);typeof window<"u"?n.useLayoutEffect:n.useEffect;const Uo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,style:t,className:r,sx:s,defaultInput:c,value:f,formName:l,formOptions:d,onChangeInput:g,onValidate:y,onKeyDown:p,...u}=a,m=Ja(),b=l&&m?m.register(l,d):null,[S,x]=n.useState(""),[h,k]=n.useState(""),[j,v]=n.useState(f);n.useEffect(()=>{v(f),k("")},[f]);const T=w.useCallbackRef(E=>{let R="";try{v(E),y?.(E),g?.(E)}catch(N){R=N.message??"Invalid Name"}l&&m&&(R?m.setError(l,{message:R}):m.clearErrors(l)),k(R)},[f,y,g]),M=w.useCallbackRef(async E=>{E.keyCode===w.KeyCodes.Escape&&S!==f&&(T(S),m?.setValue(l,S),m?.clearErrors(l),E.stopPropagation()),p?.(E)},[p,S,f,m]),P=w.useCallbackRef(E=>{x(E.target.value??"")},[]),I=w.useCallbackRef(E=>{x(""),b?.onBlur(E)},[]),D=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:se("named-input",r),...u,children:e.jsx(B.TextField,{label:"Name",placeholder:c,onFocus:P,onBlur:I,inputRef:b?.ref,disabled:o,error:!!h,helperText:h||" ",sx:{"& .MuiFormHelperText-root":{marginTop:E=>E.spacing(.5)}},slotProps:{inputLabel:{shrink:!0},htmlInput:{className:"autoFocus",name:l,spellCheck:!1,autoComplete:"off",readOnly:o,sx:{paddingTop:E=>E.spacing(1.25),paddingBottom:E=>E.spacing(.75),backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`}}},value:j??"",onChange:D,onKeyDownCapture:M,onContextMenu:E=>{E.stopPropagation()}})})}));Uo.displayName="NamedInput";const Wt=a=>a===null?"":a.toString(),qo=n.memo(n.forwardRef((a,i)=>{const{formName:o,formOptions:t,disabled:r,style:s,className:c,sx:f,onKeyDown:l,value:d,onChangeInput:g,resolvedAddress:y,...p}=a,u=Ja(),m=o&&u?u.register(o,t):null,[b,S]=n.useState(""),[x,h]=n.useState(!1),[k,j]=n.useState(()=>Wt(d));n.useEffect(()=>{j(Wt(d)),S(""),o&&u&&u.clearErrors(o),h(!1)},[d]);const v=w.useCallbackRef(R=>{let N="";try{j(R);const z=Wt(d),O=y(R);O.toString()!==z&&g?.(O)}catch{N="Invalid Range"}o&&u&&(N?u.setError(o,{message:N}):u.clearErrors(o)),S(N),h(!0)},[k,g,o,u]),T=w.useCallbackRef(async R=>{if(x&&R.keyCode===w.KeyCodes.Escape){const N=Wt(d);j(N),S(""),h(!1),R.stopPropagation()}l?.(R)},[d,g,l,x]),M=w.useCallbackRef(R=>{m?.onBlur(R)},[m]),P=n.useCallback(R=>{v(R.target.value),m?.onChange(R)},[m]),[I,D]=n.useState(!1),E=n.useMemo(()=>e.jsx(B.InputAdornment,{tabIndex:-1,sx:{display:"flex",position:"relative",flex:"0"},position:"end",children:e.jsx(C.ExhibitOptionButton,{disabled:!0,selected:I,onSelectToggle:R=>{D(R)},label:"Select Range",icon:e.jsx(w.DynamicIcon,{iconKey:"SelectRangeMode"})})}),[I]);return e.jsx(B.FormControl,{sx:{paddingTop:R=>R.spacing(1.5),minWidth:135,width:"100%",...f},size:"small",ref:i,className:se("range-input",c),...p,children:e.jsx(B.TextField,{label:"Range",placeholder:"Enter Range",onBlur:M,disabled:r,error:!!b,inputRef:m?.ref,helperText:b||" ",sx:{"& .MuiFormHelperText-root":{marginTop:R=>R.spacing(.5)}},slotProps:{input:{endAdornment:E},inputLabel:{shrink:!0},htmlInput:{spellCheck:!1,autoComplete:"off",readOnly:r,name:o,sx:{paddingTop:R=>R.spacing(1.25),paddingBottom:R=>R.spacing(.75)}}},value:k??"",onChange:P,onKeyDownCapture:T,onContextMenu:R=>{R.stopPropagation()}})})}));qo.displayName="RangeInput";const Be=[];Be.push(De("Primary Background","bg1")),Be.push(De("Primary Text","tx1")),Be.push(De("Secondary Background","bg2")),Be.push(De("Secondary Text","tx2")),Be.push(De("Accent 1","accent1")),Be.push(De("Accent 2","accent2")),Be.push(De("Accent 3","accent3")),Be.push(De("Accent 4","accent4")),Be.push(De("Accent 5","accent5")),Be.push(De("Accent 6","accent6"));const er=a=>{const{docTheme:i,onSelectTheme:o,darkMode:t,isSelected:r,outlined:s,sx:c,...f}=a,l=X.useTheme(),d=n.useMemo(()=>{let g=[];for(let y=0;y<Be.length;y++){const p=Be[y];g.push(e.jsx(io,{schemeColorLookup:i.schemeLookup(),colorDef:p,darkMode:t,selectedColor:null},y+"-colorDef"))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"none"},children:e.jsx(B.Box,{sx:{display:"flex",boxShadow:y=>y.shadows[2]},children:g})})},[i,l]);return e.jsx(C.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:g=>`solid ${r?g.palette.text.primary:"transparent"} 1px`,"&:hover:not([disabled])":{border:g=>`solid ${g.palette.text.primary} 1px !important`}},icon:null,...f,children:e.jsxs(B.Box,{sx:{border:g=>`solid ${g.palette.divider} 1px`,minWidth:"200px",borderRadius:"2px",padding:"4px 4px",textAlign:"left",display:"flex",gap:"4px",flexDirection:"column",alignItems:"stretch",color:g=>r?g.palette.text.primary:void 0,"&:hover:not([disabled])":{color:g=>g.palette.text.primary}},children:[e.jsx(B.Box,{sx:{},children:i.getName()}),e.jsxs(B.Box,{sx:{paddingTop:"6px",paddingLeft:"12px",paddingRight:"12px",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[d,e.jsx(B.Box,{sx:{flex:"1 1 100%",textOverflow:"ellipsis",overflow:"hidden",marginTop:"2px",whiteSpace:"pre",fontFamily:()=>i.getFontScheme().getMajorFont()},children:e.jsx(C.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:c=!1,darkMode:f,...l}=a,d=n.useMemo(()=>{const g=o?.getItems({selected:t})??[],y=[];if(g.length===0)return e.jsx(C.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"6px",paddingBottom:"6px"},children:"No themes"});const p=g.length;for(let u=0;u<p;u++){const m=g[u],b=t&&m?.getName()===t.getName(),S=g[u+1];S&&S.isCustom()!==m.isCustom()&&y.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${u}`)),y.push(e.jsx(er,{docTheme:m,onSelectTheme:()=>r(m),isSelected:b,disabled:c,darkMode:f,onMouseDown:x=>{x.button===0&&x.preventDefault()},onMouseUp:x=>{x.button===0&&r(m)},onKeyDown:x=>{x.keyCode!==w.KeyCodes.Enter&&x.keyCode!==w.KeyCodes.Space||r(m)}},m.getName()))}return y},[t,r,f]);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(C.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"2px"},children:"Themes"}),e.jsx(C.ExhibitDivider,{}),e.jsx(B.Box,{sx:{flex:"1 1 100%",overflow:"auto",padding:"6px 16px"},children:d})]})})})),or=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,icon:s,tooltip:c,label:f,variant:l=C.PopupButtonType.Toolbar,darkMode:d,panelProps:g,...y}=a,p=s||e.jsx(w.DynamicIcon,{iconKey:"Theme2"}),u=n.useCallback(b=>{const{closeFloatAll:S}=b;return e.jsx(tr,{...g,themes:o,selectedTheme:t,onSelectTheme:r,darkMode:d,onKeyDown:x=>{x.which===w.KeyCodes.Enter&&S()}})},[o,t,r,g,d]),m={createPopupPanel:u,tooltip:c||f||"Theme",label:f,icon:p,...y};return l===C.PopupButtonType.Toolbar?e.jsx(C.ExhibitPopupIconButton,{ref:i,...m}):e.jsx(C.ExhibitPopupMenuItem,{ref:i,...m})})),Go=n.memo(n.forwardRef((a,i)=>{const{sheet:o,className:t,debounceDelay:r=220,sx:s,...c}=a,[f,l]=n.useState(()=>o.getView().getZoomScale()),[d,g]=n.useState(null),y=n.useRef(0);oe.useModelListener(o,{onViewChange:()=>{g(!0),y.current===0&&l(o.getView().getZoomScale())}}),n.useEffect(()=>{y.current=0,g(!1),l(o.getView().getZoomScale())},[o]),n.useEffect(()=>{y.current!==0&&A.CommonUtils.debounce(()=>{f===y.current&&(y.current=0,o.getView().update({zoomScale:f}))},r)()},[f,r]);const p=w.useCallbackRef(M=>{let P=M;M<100?P=Math.round(M/(10/9)+10):M>100&&(P=Math.round(3*M-200)),y.current=P,g(!0),l(P)},[o]),u=M=>{let P=M;return M<100?P=10/9*(M-10):M>100&&(P=(M+200)/3),P},m=u(f),[b,S]=n.useState(null),x=n.useRef(null),h=n.useCallback(()=>{const M=b;M&&requestAnimationFrame(()=>{x.current?.contains(document.activeElement)&&M.focus()})},[]),k=w.useMouseDownAndHoldListener(()=>{p(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10)))}),j=w.useMouseDownAndHoldListener(()=>p(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10)))),v=X.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:se(t),sx:{padding:"0px 0px",display:"flex",alignItems:"center",color:M=>M.palette.text.secondary,...s},onFocus:M=>{M.relatedTarget&&!b&&S(M.relatedTarget)},onBlur:M=>{b&&!x?.current?.contains(M.relatedTarget)&&S(null)},onMouseDown:M=>{M.button===0&&M.preventDefault()},onMouseUp:M=>{M.button===0&&h()},...c,children:[e.jsx(C.SimpleTooltip,{disableInteractive:!0,title:"Zoom Out",children:e.jsx(B.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:M=>M.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:M=>{M.button!==0?M.preventDefault():k(M)},children:e.jsx(w.DynamicIcon,{iconKey:"Remove"})})}),e.jsx(B.Slider,{ref:x,sx:{flex:"1 1 100%",padding:"6px 0px !important",marginRight:"2px",marginLeft:"2px","& .MuiSlider-thumb":{height:14,width:6,borderRadius:.75,"&.Mui-focusVisible":{boxShadow:M=>`0px 0px 0px 3px ${C.hexToRGB(M.palette.primary.main,.16)}`},"&:focus, &:hover, &.Mui-active":{boxShadow:M=>`0px 0px 0px 2px ${C.hexToRGB(M.palette.primary.main,.16)}`}},"& .MuiSlider-mark":{width:"1px",height:"8px"},"& .MuiSlider-markActive":{backgroundColor:"currentColor"},"& .MuiSlider-thumb:not(.MuiSlider-active)":{transition:d?"left 260ms ease-in":"none"}},valueLabelDisplay:"auto",size:"small",track:!1,min:0,step:1,value:m,max:200,marks:[{value:100}],onAnimationEnd:()=>g(!1),onWheel:M=>{p(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),M.deltaY<0,10)))},onKeyDown:M=>{M.which===w.KeyCodes.Down||M.which===w.KeyCodes.Right?(p(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10))),M.preventDefault()):M.which===w.KeyCodes.Up||M.which===w.KeyCodes.Left?(p(u(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10))),M.preventDefault()):M.which!==w.KeyCodes.Enter&&M.which!==w.KeyCodes.Escape||h()},onChange:(M,P)=>{Math.abs(P-100)<3?p(100):p(P)},valueLabelFormat:(M,P)=>`Zoom: ${Math.round(f)}%`}),e.jsx(C.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:()=>{p(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(f)+"%"})})]})]})}));Go.displayName="SheetZoomScale";const Xo=n.memo(n.forwardRef((a,i)=>{const{sx:o,sheet:t,gridStyle:r,children:s,childrenEnd:c,...f}=a;n.useImperativeHandle(i,()=>({}));const l=n.useRef(null);n.useEffect(()=>{const u=m=>m.preventDefault();return l.current?.addEventListener("wheel",u,{passive:!1}),()=>{l.current?.removeEventListener("wheel",u)}},[]);const d=w.useEditMode(),g=n.useMemo(()=>{const u=d.getMode();return u?.description?u.description:"Ready"},[d]),[y,p]=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:y?"visible":"hidden",boxShadow:`0px -1px 0px ${r.header.edgeStrokeFill}`,...o},onMouseOver:()=>p(!0),onMouseLeave:()=>p(!1),...f,children:[s,e.jsx("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"end",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",color:u=>u.palette.text.secondary},variant:"caption",children:g})}),c?e.jsx(B.Box,{sx:{display:"flex",alignItems:"center"},children:c}):null,e.jsx(C.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(Go,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));Xo.displayName="StatusBar";var Mn,Dn,yo,Fn,In,$t={exports:{}},wt={},kt={exports:{}},Nn={},On={exports:{}};function Qi(){return Dn?Mn:(Dn=1,Mn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function Ji(){if(Fn)return yo;Fn=1;var a=Qi();function i(){}function o(){}return o.resetWarningCache=i,yo=function(){function t(c,f,l,d,g,y){if(y!==a){var p=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 p.name="Invariant Violation",p}}function r(){return t}t.isRequired=t;var s={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:r,element:t,elementType:t,instanceOf:r,node:t,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:o,resetWarningCache:i};return s.PropTypes=s,s},yo}function Ot(){return In||(In=1,On.exports=Ji()()),On.exports}var An,Vt={exports:{}},Ln,be={},He={};function lo(){return Ln||(Ln=1,Object.defineProperty(He,"__esModule",{value:!0}),He.dontSetMe=function(a,i,o){if(a[i])return new Error(`Invalid prop ${i} passed to ${o} - do not set this, set it on the child.`)},He.findInArray=function(a,i){for(let o=0,t=a.length;o<t;o++)if(i.apply(i,[a[o],o,a]))return a[o]},He.int=function(a){return parseInt(a,10)},He.isFunction=function(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Function]"},He.isNum=function(a){return typeof a=="number"&&!isNaN(a)}),He}var zn,Hn,We={};function Yo(){if(Hn)return be;Hn=1,Object.defineProperty(be,"__esModule",{value:!0}),be.addClassName=c,be.addEvent=function(l,d,g,y){if(!l)return;const p={capture:!0,...y};l.addEventListener?l.addEventListener(d,g,p):l.attachEvent?l.attachEvent("on"+d,g):l["on"+d]=g},be.addUserSelectStyles=function(l){if(!l)return;let d=l.getElementById("react-draggable-style-el");d||(d=l.createElement("style"),d.type="text/css",d.id="react-draggable-style-el",d.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
8
|
-
`,d.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
9
|
-
`,l.getElementsByTagName("head")[0].appendChild(d)),l.body&&c(l.body,"react-draggable-transparent-selection")},be.createCSSTransform=function(l,d){const g=r(l,d,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:g}},be.createSVGTransform=function(l,d){return r(l,d,"")},be.getTouch=function(l,d){return l.targetTouches&&(0,a.findInArray)(l.targetTouches,g=>d===g.identifier)||l.changedTouches&&(0,a.findInArray)(l.changedTouches,g=>d===g.identifier)},be.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},be.getTranslation=r,be.innerHeight=function(l){let d=l.clientHeight;const g=l.ownerDocument.defaultView.getComputedStyle(l);return d-=(0,a.int)(g.paddingTop),d-=(0,a.int)(g.paddingBottom),d},be.innerWidth=function(l){let d=l.clientWidth;const g=l.ownerDocument.defaultView.getComputedStyle(l);return d-=(0,a.int)(g.paddingLeft),d-=(0,a.int)(g.paddingRight),d},be.matchesSelector=t,be.matchesSelectorAndParentsTo=function(l,d,g){let y=l;do{if(t(y,d))return!0;if(y===g)return!1;y=y.parentNode}while(y);return!1},be.offsetXYFromParent=function(l,d,g){const y=d===d.ownerDocument.body?{left:0,top:0}:d.getBoundingClientRect(),p=(l.clientX+d.scrollLeft-y.left)/g,u=(l.clientY+d.scrollTop-y.top)/g;return{x:p,y:u}},be.outerHeight=function(l){let d=l.clientHeight;const g=l.ownerDocument.defaultView.getComputedStyle(l);return d+=(0,a.int)(g.borderTopWidth),d+=(0,a.int)(g.borderBottomWidth),d},be.outerWidth=function(l){let d=l.clientWidth;const g=l.ownerDocument.defaultView.getComputedStyle(l);return d+=(0,a.int)(g.borderLeftWidth),d+=(0,a.int)(g.borderRightWidth),d},be.removeClassName=f,be.removeEvent=function(l,d,g,y){if(!l)return;const p={capture:!0,...y};l.removeEventListener?l.removeEventListener(d,g,p):l.detachEvent?l.detachEvent("on"+d,g):l["on"+d]=null},be.scheduleRemoveUserSelectStyles=function(l){window.requestAnimationFrame?window.requestAnimationFrame(()=>{s(l)}):s(l)};var a=lo(),i=(function(l,d){if(typeof WeakMap=="function")var g=new WeakMap,y=new WeakMap;return(function(p,u){if(!u&&p&&p.__esModule)return p;var m,b,S={__proto__:null,default:p};if(p===null||typeof p!="object"&&typeof p!="function")return S;if(m=u?y:g){if(m.has(p))return m.get(p);m.set(p,S)}for(const x in p)x!=="default"&&{}.hasOwnProperty.call(p,x)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(p,x))&&(b.get||b.set)?m(S,x,b):S[x]=p[x]);return S})(l,d)})((function(){if(zn)return We;zn=1,Object.defineProperty(We,"__esModule",{value:!0}),We.browserPrefixToKey=g,We.browserPrefixToStyle=function(y,p){return p?`-${p.toLowerCase()}-${y}`:y},We.default=void 0,We.getPrefix=d;const l=["Moz","Webkit","O","ms"];function d(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const p=window.document?.documentElement?.style;if(!p||y in p)return"";for(let u=0;u<l.length;u++)if(g(y,l[u])in p)return l[u];return""}function g(y,p){return p?`${p}${(function(u){let m="",b=!0;for(let S=0;S<u.length;S++)b?(m+=u[S].toUpperCase(),b=!1):u[S]==="-"?b=!0:m+=u[S];return m})(y)}`:y}return We.default=d(),We})());let o="";function t(l,d){return o||(o=(0,a.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(g){return(0,a.isFunction)(l[g])})),!!(0,a.isFunction)(l[o])&&l[o](d)}function r(l,d,g){let{x:y,y:p}=l,u=`translate(${y}${g},${p}${g})`;return d&&(u=`translate(${`${typeof d.x=="string"?d.x:d.x+g}`}, ${`${typeof d.y=="string"?d.y:d.y+g}`})`+u),u}function s(l){if(l)try{if(l.body&&f(l.body,"react-draggable-transparent-selection"),l.selection)l.selection.empty();else{const d=(l.defaultView||window).getSelection();d&&d.type!=="Caret"&&d.removeAllRanges()}}catch{}}function c(l,d){l.classList?l.classList.add(d):l.className.match(new RegExp(`(?:^|\\s)${d}(?!\\S)`))||(l.className+=` ${d}`)}function f(l,d){l.classList?l.classList.remove(d):l.className=l.className.replace(new RegExp(`(?:^|\\s)${d}(?!\\S)`,"g"),"")}return be}var Wn,Ie={};function nr(){if(Wn)return Ie;Wn=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},Ie.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},Ie.createCoreData=function(t,r,s){const c=!(0,a.isNum)(t.lastX),f=o(t);return c?{node:f,deltaX:0,deltaY:0,lastX:r,lastY:s,x:r,y:s}:{node:f,deltaX:r-t.lastX,deltaY:s-t.lastY,lastX:t.lastX,lastY:t.lastY,x:r,y:s}},Ie.createDraggableData=function(t,r){const s=t.props.scale;return{node:r.node,x:t.state.x+r.deltaX/s,y:t.state.y+r.deltaY/s,deltaX:r.deltaX/s,deltaY:r.deltaY/s,lastX:t.state.x,lastY:t.state.y}},Ie.getBoundPosition=function(t,r,s){if(!t.props.bounds)return[r,s];let{bounds:c}=t.props;c=typeof c=="string"?c:(function(l){return{left:l.left,top:l.top,right:l.right,bottom:l.bottom}})(c);const f=o(t);if(typeof c=="string"){const{ownerDocument:l}=f,d=l.defaultView;let g;if(c==="parent"?g=f.parentNode:g=f.getRootNode().querySelector(c),!(g instanceof d.HTMLElement))throw new Error('Bounds selector "'+c+'" could not find an element.');const y=g,p=d.getComputedStyle(f),u=d.getComputedStyle(y);c={left:-f.offsetLeft+(0,a.int)(u.paddingLeft)+(0,a.int)(p.marginLeft),top:-f.offsetTop+(0,a.int)(u.paddingTop)+(0,a.int)(p.marginTop),right:(0,i.innerWidth)(y)-(0,i.outerWidth)(f)-f.offsetLeft+(0,a.int)(u.paddingRight)-(0,a.int)(p.marginRight),bottom:(0,i.innerHeight)(y)-(0,i.outerHeight)(f)-f.offsetTop+(0,a.int)(u.paddingBottom)-(0,a.int)(p.marginBottom)}}return(0,a.isNum)(c.right)&&(r=Math.min(r,c.right)),(0,a.isNum)(c.bottom)&&(s=Math.min(s,c.bottom)),(0,a.isNum)(c.left)&&(r=Math.max(r,c.left)),(0,a.isNum)(c.top)&&(s=Math.max(s,c.top)),[r,s]},Ie.getControlPosition=function(t,r,s){const c=typeof r=="number"?(0,i.getTouch)(t,r):null;if(typeof r=="number"&&!c)return null;const f=o(s),l=s.props.offsetParent||f.offsetParent||f.ownerDocument.body;return(0,i.offsetXYFromParent)(c||t,l,s.props.scale)},Ie.snapToGrid=function(t,r,s){const c=Math.round(r/t[0])*t[0],f=Math.round(s/t[1])*t[1];return[c,f]};var a=lo(),i=Yo();function o(t){const r=t.findDOMNode();if(!r)throw new Error("<DraggableCore>: Unmounted during event!");return r}return Ie}var $n,Vn,_n,Kn,vt={},_t={};function ar(){return $n||($n=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.default=function(){}),_t}function el(){if(Vn)return vt;Vn=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var a=(function(u,m){if(typeof WeakMap=="function")var b=new WeakMap,S=new WeakMap;return(function(x,h){if(!h&&x&&x.__esModule)return x;var k,j,v={__proto__:null,default:x};if(x===null||typeof x!="object"&&typeof x!="function")return v;if(k=h?S:b){if(k.has(x))return k.get(x);k.set(x,v)}for(const T in x)T!=="default"&&{}.hasOwnProperty.call(x,T)&&((j=(k=Object.defineProperty)&&Object.getOwnPropertyDescriptor(x,T))&&(j.get||j.set)?k(v,T,j):v[T]=x[T]);return v})(u,m)})(n),i=f(Ot()),o=f(et),t=Yo(),r=nr(),s=lo(),c=f(ar());function f(u){return u&&u.__esModule?u:{default:u}}function l(u,m,b){return(m=(function(S){var x=(function(h,k){if(typeof h!="object"||!h)return h;var j=h[Symbol.toPrimitive];if(j!==void 0){var v=j.call(h,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(h)})(S,"string");return typeof x=="symbol"?x:x+""})(m))in u?Object.defineProperty(u,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):u[m]=b,u}const d={start:"touchstart",move:"touchmove",stop:"touchend"},g={start:"mousedown",move:"mousemove",stop:"mouseup"};let y=g,p=class extends a.Component{constructor(){super(...arguments),l(this,"dragging",!1),l(this,"lastX",NaN),l(this,"lastY",NaN),l(this,"touchIdentifier",null),l(this,"mounted",!1),l(this,"handleDragStart",u=>{if(this.props.onMouseDown(u),!this.props.allowAnyClick&&typeof u.button=="number"&&u.button!==0)return!1;const m=this.findDOMNode();if(!m||!m.ownerDocument||!m.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:b}=m;if(this.props.disabled||!(u.target instanceof b.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(u.target,this.props.handle,m)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(u.target,this.props.cancel,m))return;u.type!=="touchstart"||this.props.allowMobileScroll||u.preventDefault();const S=(0,t.getTouchIdentifier)(u);this.touchIdentifier=S;const x=(0,r.getControlPosition)(u,S,this);if(x==null)return;const{x:h,y:k}=x,j=(0,r.createCoreData)(this,h,k);(0,c.default)("DraggableCore: handleDragStart: %j",j),(0,c.default)("calling",this.props.onStart),this.props.onStart(u,j)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(b),this.dragging=!0,this.lastX=h,this.lastY=k,(0,t.addEvent)(b,y.move,this.handleDrag),(0,t.addEvent)(b,y.stop,this.handleDragStop))}),l(this,"handleDrag",u=>{const m=(0,r.getControlPosition)(u,this.touchIdentifier,this);if(m==null)return;let{x:b,y:S}=m;if(Array.isArray(this.props.grid)){let h=b-this.lastX,k=S-this.lastY;if([h,k]=(0,r.snapToGrid)(this.props.grid,h,k),!h&&!k)return;b=this.lastX+h,S=this.lastY+k}const x=(0,r.createCoreData)(this,b,S);if((0,c.default)("DraggableCore: handleDrag: %j",x),this.props.onDrag(u,x)!==!1&&this.mounted!==!1)this.lastX=b,this.lastY=S;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const k=document.createEvent("MouseEvents");k.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(k)}}),l(this,"handleDragStop",u=>{if(!this.dragging)return;const m=(0,r.getControlPosition)(u,this.touchIdentifier,this);if(m==null)return;let{x:b,y:S}=m;if(Array.isArray(this.props.grid)){let k=b-this.lastX||0,j=S-this.lastY||0;[k,j]=(0,r.snapToGrid)(this.props.grid,k,j),b=this.lastX+k,S=this.lastY+j}const x=(0,r.createCoreData)(this,b,S);if(this.props.onStop(u,x)===!1||this.mounted===!1)return!1;const h=this.findDOMNode();h&&this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(h.ownerDocument),(0,c.default)("DraggableCore: handleDragStop: %j",x),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,h&&((0,c.default)("DraggableCore: Removing handlers"),(0,t.removeEvent)(h.ownerDocument,y.move,this.handleDrag),(0,t.removeEvent)(h.ownerDocument,y.stop,this.handleDragStop))}),l(this,"onMouseDown",u=>(y=g,this.handleDragStart(u))),l(this,"onMouseUp",u=>(y=g,this.handleDragStop(u))),l(this,"onTouchStart",u=>(y=d,this.handleDragStart(u))),l(this,"onTouchEnd",u=>(y=d,this.handleDragStop(u)))}componentDidMount(){this.mounted=!0;const u=this.findDOMNode();u&&(0,t.addEvent)(u,d.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const u=this.findDOMNode();if(u){const{ownerDocument:m}=u;(0,t.removeEvent)(m,g.move,this.handleDrag),(0,t.removeEvent)(m,d.move,this.handleDrag),(0,t.removeEvent)(m,g.stop,this.handleDragStop),(0,t.removeEvent)(m,d.stop,this.handleDragStop),(0,t.removeEvent)(u,d.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(m)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:o.default.findDOMNode(this)}render(){return a.cloneElement(a.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return vt.default=p,l(p,"displayName","DraggableCore"),l(p,"propTypes",{allowAnyClick:i.default.bool,allowMobileScroll:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:function(u,m){if(u[m]&&u[m].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:i.default.arrayOf(i.default.number),handle:i.default.string,cancel:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number,className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),l(p,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),vt}function tl(){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(m,b){if(typeof WeakMap=="function")var S=new WeakMap,x=new WeakMap;return(function(h,k){if(!k&&h&&h.__esModule)return h;var j,v,T={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return T;if(j=k?x:S){if(j.has(h))return j.get(h);j.set(h,T)}for(const M in h)M!=="default"&&{}.hasOwnProperty.call(h,M)&&((v=(j=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,M))&&(v.get||v.set)?j(T,M,v):T[M]=h[M]);return T})(m,b)})(n),o=g(Ot()),t=g(et),r=(function(){if(An)return Vt.exports;function m(S){var x,h,k="";if(typeof S=="string"||typeof S=="number")k+=S;else if(typeof S=="object")if(Array.isArray(S)){var j=S.length;for(x=0;x<j;x++)S[x]&&(h=m(S[x]))&&(k&&(k+=" "),k+=h)}else for(h in S)S[h]&&(k&&(k+=" "),k+=h);return k}function b(){for(var S,x,h=0,k="",j=arguments.length;h<j;h++)(S=arguments[h])&&(x=m(S))&&(k&&(k+=" "),k+=x);return k}return An=1,Vt.exports=b,Vt.exports.clsx=b,Vt.exports})(),s=Yo(),c=nr(),f=lo(),l=g(el()),d=g(ar());function g(m){return m&&m.__esModule?m:{default:m}}function y(){return y=Object.assign?Object.assign.bind():function(m){for(var b=1;b<arguments.length;b++){var S=arguments[b];for(var x in S)({}).hasOwnProperty.call(S,x)&&(m[x]=S[x])}return m},y.apply(null,arguments)}function p(m,b,S){return(b=(function(x){var h=(function(k,j){if(typeof k!="object"||!k)return k;var v=k[Symbol.toPrimitive];if(v!==void 0){var T=v.call(k,j);if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(k)})(x,"string");return typeof h=="symbol"?h:h+""})(b))in m?Object.defineProperty(m,b,{value:S,enumerable:!0,configurable:!0,writable:!0}):m[b]=S,m}class u extends i.Component{static getDerivedStateFromProps(b,S){let{position:x}=b,{prevPropsPosition:h}=S;return!x||h&&x.x===h.x&&x.y===h.y?null:((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:x,prevPropsPosition:h}),{x:x.x,y:x.y,prevPropsPosition:{...x}})}constructor(b){super(b),p(this,"onDragStart",(S,x)=>{if((0,d.default)("Draggable: onDragStart: %j",x),this.props.onStart(S,(0,c.createDraggableData)(this,x))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(S,x)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",x);const h=(0,c.createDraggableData)(this,x),k={x:h.x,y:h.y,slackX:0,slackY:0};if(this.props.bounds){const{x:j,y:v}=k;k.x+=this.state.slackX,k.y+=this.state.slackY;const[T,M]=(0,c.getBoundPosition)(this,k.x,k.y);k.x=T,k.y=M,k.slackX=this.state.slackX+(j-k.x),k.slackY=this.state.slackY+(v-k.y),h.x=k.x,h.y=k.y,h.deltaX=k.x-this.state.x,h.deltaY=k.y-this.state.y}if(this.props.onDrag(S,h)===!1)return!1;this.setState(k)}),p(this,"onDragStop",(S,x)=>{if(!this.state.dragging||this.props.onStop(S,(0,c.createDraggableData)(this,x))===!1)return!1;(0,d.default)("Draggable: onDragStop: %j",x);const h={dragging:!1,slackX:0,slackY:0};if(this.props.position){const{x:k,y:j}=this.props.position;h.x=k,h.y=j}this.setState(h)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},!b.position||b.onDrag||b.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??t.default.findDOMNode(this)}render(){const{axis:b,bounds:S,children:x,defaultPosition:h,defaultClassName:k,defaultClassNameDragging:j,defaultClassNameDragged:v,position:T,positionOffset:M,scale:P,...I}=this.props;let D={},E=null;const R=!T||this.state.dragging,N=T||h,z={x:(0,c.canDragX)(this)&&R?this.state.x:N.x,y:(0,c.canDragY)(this)&&R?this.state.y:N.y};this.state.isElementSVG?E=(0,s.createSVGTransform)(z,M):D=(0,s.createCSSTransform)(z,M);const O=(0,r.clsx)(x.props.className||"",k,{[j]:this.state.dragging,[v]:this.state.dragged});return i.createElement(l.default,y({},I,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),i.cloneElement(i.Children.only(x),{className:O,style:{...x.props.style,...D},transform:E}))}}a.default=u,p(u,"displayName","Draggable"),p(u,"propTypes",{...l.default.propTypes,axis:o.default.oneOf(["both","x","y","none"]),bounds:o.default.oneOfType([o.default.shape({left:o.default.number,right:o.default.number,top:o.default.number,bottom:o.default.number}),o.default.string,o.default.oneOf([!1])]),defaultClassName:o.default.string,defaultClassNameDragging:o.default.string,defaultClassNameDragged:o.default.string,defaultPosition:o.default.shape({x:o.default.number,y:o.default.number}),positionOffset:o.default.shape({x:o.default.oneOfType([o.default.number,o.default.string]),y:o.default.oneOfType([o.default.number,o.default.string])}),position:o.default.shape({x:o.default.number,y:o.default.number}),className:f.dontSetMe,style:f.dontSetMe,transform:f.dontSetMe}),p(u,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Nn)),Nn}function rr(){if(Kn)return kt.exports;Kn=1;const{default:a,DraggableCore:i}=tl();return kt.exports=a,kt.exports.default=a,kt.exports.DraggableCore=i,kt.exports}var Un,Kt={};function ol(){if(Un)return Kt;Un=1,Kt.__esModule=!0,Kt.cloneElement=function(s,c){return c.style&&s.props.style&&(c.style=t(t({},s.props.style),c.style)),c.className&&s.props.className&&(c.className=s.props.className+" "+c.className),i.default.cloneElement(s,c)};var a,i=(a=n)&&a.__esModule?a:{default:a};function o(s,c){var f=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);c&&(l=l.filter(function(d){return Object.getOwnPropertyDescriptor(s,d).enumerable})),f.push.apply(f,l)}return f}function t(s){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?o(Object(f),!0).forEach(function(l){r(s,l,f[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(f)):o(Object(f)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(f,l))})}return s}function r(s,c,f){return(c=(function(l){var d=(function(g,y){if(typeof g!="object"||g===null)return g;var p=g[Symbol.toPrimitive];if(p!==void 0){var u=p.call(g,y);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(g)})(l,"string");return typeof d=="symbol"?d:String(d)})(c))in s?Object.defineProperty(s,c,{value:f,enumerable:!0,configurable:!0,writable:!0}):s[c]=f,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=Ot())&&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 c,f=r[0];return f.axis==="both"||f.axis==="y"?(c=i.default.number).isRequired.apply(c,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 c,f=r[0];return f.axis==="both"||f.axis==="x"?(c=i.default.number).isRequired.apply(c,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(p,u){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var m=s(u);if(m&&m.has(p))return m.get(p);var b={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in p)if(x!=="default"&&Object.prototype.hasOwnProperty.call(p,x)){var h=S?Object.getOwnPropertyDescriptor(p,x):null;h&&(h.get||h.set)?Object.defineProperty(b,x,h):b[x]=p[x]}return b.default=p,m&&m.set(p,b),b})(n),i=rr(),o=ol(),t=ir(),r=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(p){if(typeof WeakMap!="function")return null;var u=new WeakMap,m=new WeakMap;return(s=function(b){return b?m:u})(p)}function c(){return c=Object.assign?Object.assign.bind():function(p){for(var u=1;u<arguments.length;u++){var m=arguments[u];for(var b in m)Object.prototype.hasOwnProperty.call(m,b)&&(p[b]=m[b])}return p},c.apply(this,arguments)}function f(p,u){var m=Object.keys(p);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(p);u&&(b=b.filter(function(S){return Object.getOwnPropertyDescriptor(p,S).enumerable})),m.push.apply(m,b)}return m}function l(p){for(var u=1;u<arguments.length;u++){var m=arguments[u]!=null?arguments[u]:{};u%2?f(Object(m),!0).forEach(function(b){d(p,b,m[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(m)):f(Object(m)).forEach(function(b){Object.defineProperty(p,b,Object.getOwnPropertyDescriptor(m,b))})}return p}function d(p,u,m){return(u=(function(b){var S=(function(x,h){if(typeof x!="object"||x===null)return x;var k=x[Symbol.toPrimitive];if(k!==void 0){var j=k.call(x,h);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(x)})(b,"string");return typeof S=="symbol"?S:String(S)})(u))in p?Object.defineProperty(p,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):p[u]=m,p}function g(p,u){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,b){return m.__proto__=b,m},g(p,u)}var y=(function(p){var u,m;function b(){for(var x,h=arguments.length,k=new Array(h),j=0;j<h;j++)k[j]=arguments[j];return(x=p.call.apply(p,[this].concat(k))||this).handleRefs={},x.lastHandleRect=null,x.slack=null,x}m=p,(u=b).prototype=Object.create(m.prototype),u.prototype.constructor=u,g(u,m);var S=b.prototype;return S.componentWillUnmount=function(){this.resetData()},S.resetData=function(){this.lastHandleRect=this.slack=null},S.runConstraints=function(x,h){var k=this.props,j=k.minConstraints,v=k.maxConstraints,T=k.lockAspectRatio;if(!j&&!v&&!T)return[x,h];if(T){var M=this.props.width/this.props.height,P=x-this.props.width,I=h-this.props.height;Math.abs(P)>Math.abs(I*M)?h=x/M:x=h*M}var D=x,E=h,R=this.slack||[0,0],N=R[0],z=R[1];return x+=N,h+=z,j&&(x=Math.max(j[0],x),h=Math.max(j[1],h)),v&&(x=Math.min(v[0],x),h=Math.min(v[1],h)),this.slack=[N+(D-x),z+(E-h)],[x,h]},S.resizeHandler=function(x,h){var k=this;return function(j,v){var T=v.node,M=v.deltaX,P=v.deltaY;x==="onResizeStart"&&k.resetData();var I=(k.props.axis==="both"||k.props.axis==="x")&&h!=="n"&&h!=="s",D=(k.props.axis==="both"||k.props.axis==="y")&&h!=="e"&&h!=="w";if(I||D){var E=h[0],R=h[h.length-1],N=T.getBoundingClientRect();k.lastHandleRect!=null&&(R==="w"&&(M+=N.left-k.lastHandleRect.left),E==="n"&&(P+=N.top-k.lastHandleRect.top)),k.lastHandleRect=N,R==="w"&&(M=-M),E==="n"&&(P=-P);var z=k.props.width+(I?M/k.props.transformScale:0),O=k.props.height+(D?P/k.props.transformScale:0),L=k.runConstraints(z,O);z=L[0],O=L[1];var F=z!==k.props.width||O!==k.props.height,$=typeof k.props[x]=="function"?k.props[x]:null;$&&!(x==="onResize"&&!F)&&(j.persist==null||j.persist(),$(j,{node:T,size:{width:z,height:O},handle:h})),x==="onResizeStop"&&k.resetData()}}},S.renderResizeHandle=function(x,h){var k=this.props.handle;if(!k)return a.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+x,ref:h});if(typeof k=="function")return k(x,h);var j=l({ref:h},typeof k.type=="string"?{}:{handleAxis:x});return a.cloneElement(k,j)},S.render=function(){var x=this,h=this.props,k=h.children,j=h.className,v=h.draggableOpts;h.width,h.height,h.handle,h.handleSize,h.lockAspectRatio,h.axis,h.minConstraints,h.maxConstraints,h.onResize,h.onResizeStop,h.onResizeStart;var T=h.resizeHandles;h.transformScale;var M=(function(P,I){if(P==null)return{};var D,E,R={},N=Object.keys(P);for(E=0;E<N.length;E++)D=N[E],I.indexOf(D)>=0||(R[D]=P[D]);return R})(h,r);return(0,o.cloneElement)(k,l(l({},M),{},{className:(j?j+" ":"")+"react-resizable",children:[].concat(k.props.children,T.map(function(P){var I,D=(I=x.handleRefs[P])!=null?I:x.handleRefs[P]=a.createRef();return a.createElement(i.DraggableCore,c({},v,{nodeRef:D,key:"resizableHandle-"+P,onStop:x.resizeHandler("onResizeStop",P),onStart:x.resizeHandler("onResizeStart",P),onDrag:x.resizeHandler("onResize",P)}),x.renderResizeHandle(P,D))}))}))},b})(a.Component);return wt.default=y,y.propTypes=t.resizableProps,y.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},wt}var Xn,Yn,Et={};function nl(){if(Xn)return Et;Xn=1,Et.__esModule=!0,Et.default=void 0;var a=(function(u,m){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var b=c(m);if(b&&b.has(u))return b.get(u);var S={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in u)if(h!=="default"&&Object.prototype.hasOwnProperty.call(u,h)){var k=x?Object.getOwnPropertyDescriptor(u,h):null;k&&(k.get||k.set)?Object.defineProperty(S,h,k):S[h]=u[h]}return S.default=u,b&&b.set(u,S),S})(n),i=s(Ot()),o=s(lr()),t=ir(),r=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function s(u){return u&&u.__esModule?u:{default:u}}function c(u){if(typeof WeakMap!="function")return null;var m=new WeakMap,b=new WeakMap;return(c=function(S){return S?b:m})(u)}function f(){return f=Object.assign?Object.assign.bind():function(u){for(var m=1;m<arguments.length;m++){var b=arguments[m];for(var S in b)Object.prototype.hasOwnProperty.call(b,S)&&(u[S]=b[S])}return u},f.apply(this,arguments)}function l(u,m){var b=Object.keys(u);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(u);m&&(S=S.filter(function(x){return Object.getOwnPropertyDescriptor(u,x).enumerable})),b.push.apply(b,S)}return b}function d(u){for(var m=1;m<arguments.length;m++){var b=arguments[m]!=null?arguments[m]:{};m%2?l(Object(b),!0).forEach(function(S){g(u,S,b[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(b)):l(Object(b)).forEach(function(S){Object.defineProperty(u,S,Object.getOwnPropertyDescriptor(b,S))})}return u}function g(u,m,b){return(m=(function(S){var x=(function(h,k){if(typeof h!="object"||h===null)return h;var j=h[Symbol.toPrimitive];if(j!==void 0){var v=j.call(h,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(h)})(S,"string");return typeof x=="symbol"?x:String(x)})(m))in u?Object.defineProperty(u,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):u[m]=b,u}function y(u,m){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,S){return b.__proto__=S,b},y(u,m)}var p=(function(u){var m,b;function S(){for(var x,h=arguments.length,k=new Array(h),j=0;j<h;j++)k[j]=arguments[j];return(x=u.call.apply(u,[this].concat(k))||this).state={width:x.props.width,height:x.props.height,propsWidth:x.props.width,propsHeight:x.props.height},x.onResize=function(v,T){var M=T.size;x.props.onResize?(v.persist==null||v.persist(),x.setState(M,function(){return x.props.onResize&&x.props.onResize(v,T)})):x.setState(M)},x}return b=u,(m=S).prototype=Object.create(b.prototype),m.prototype.constructor=m,y(m,b),S.getDerivedStateFromProps=function(x,h){return h.propsWidth!==x.width||h.propsHeight!==x.height?{width:x.width,height:x.height,propsWidth:x.width,propsHeight:x.height}:null},S.prototype.render=function(){var x=this.props,h=x.handle,k=x.handleSize;x.onResize;var j=x.onResizeStart,v=x.onResizeStop,T=x.draggableOpts,M=x.minConstraints,P=x.maxConstraints,I=x.lockAspectRatio,D=x.axis;x.width,x.height;var E=x.resizeHandles,R=x.style,N=x.transformScale,z=(function(O,L){if(O==null)return{};var F,$,Q={},Y=Object.keys(O);for($=0;$<Y.length;$++)F=Y[$],L.indexOf(F)>=0||(Q[F]=O[F]);return Q})(x,r);return a.createElement(o.default,{axis:D,draggableOpts:T,handle:h,handleSize:k,height:this.state.height,lockAspectRatio:I,maxConstraints:P,minConstraints:M,onResizeStart:j,onResize:this.onResize,onResizeStop:v,resizeHandles:E,transformScale:N,width:this.state.width},a.createElement("div",f({},z,{style:d(d({},R),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},S})(a.Component);return Et.default=p,p.propTypes=d(d({},t.resizableProps),{},{children:i.default.element}),Et}var al=(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=nl().default),$t.exports);const Zo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,names:t,workbook:r,restoreFocus:s,readonly:c=!1,disabled:f=!1,commandPopupButtonProps:l,sx:d,...g}=a,y=w.useNotifier(),[p,u]=n.useState(null),[m,b]=n.useState(()=>r.getSelectedRanges().getCoords()),[S,x]=n.useState(!1),{reference:h}=C.useFloatStack({parentFloat:l?.parentFloat}),[k,j]=n.useState(()=>c||!r.getProtection().isStructureAllowed()),v=()=>p?.text??"",[T,M]=n.useState(v),P=w.useCallbackRef(()=>{if(h?.closeAll(),!T){const W=v();return M(v()),W}if(v()===T)return T;const K=T.trim().toLowerCase();if(K==="r"||K==="c")return T;try{const W=r.getRanges(T);if(W)return W.toString()}catch{}const q=t.getByName(T);if(q&&q.getRanges())return T;let ne=null;try{const W=r.getRanges(T),U=W.getCoords().map(H=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...H}));ne=r.getRanges(U)}catch{}if(!ne){const W=r.getSelectedRanges().getCoords().map(U=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...U}));ne=r.getRanges(W)}try{let W=t.getByName(T);k||W||(W=t.addReference(T,ne)),W&&u({text:W.getName()})}catch(W){M(v()),y.showMessage?.(W.message,{type:w.NotifierType.Error})}return null},[T,t,h,k,y]),I=w.useCallbackRef(()=>{if(r.isClosed())return;const K=[];for(let W=0;W<m.length;W++){const U=m[W];K.push({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...U})}let q=null;try{q=t.lookupByRanges(K)}catch{}let ne=null;ne=q?.length>0?q[0].getName():r.getSelectedSheet().getSelectedRange().toString(),u({text:ne})},[r,m]),[D,E]=n.useState(()=>t?.getItems()??null);oe.useModelListener(t,{onCollectionChange(K){E(t.getItems()),I()},onClose(K){E([])}}),n.useEffect(()=>{M(v())},[p,m]);const[R,N]=n.useState(r?.getSelectedSheet());oe.useModelListener(r,{onProtectionChange:K=>{j(c||!K.getProtection().isStructureAllowed())},onSheetsChange:K=>{N(K?.getSelectedSheet())},onViewChange(K){N(K?.getSelectedSheet())}});const[z,O]=n.useState(null),L=w.useCallbackRef(A.CommonUtils.debounce(I,z?320:0),[]);oe.useModelListener(R.getSelection(),{onChange:()=>{b(K=>{const q=r.getSelectedRanges().getCoords();return A.CoordUtils.isEqualRangesArrays(q,K)?K:q})},onAdjustingChange:K=>{O(K.getAdjusting())}}),n.useEffect(()=>{if(z){const K=r.getSelectedRange(),q=K.getRowCount(),ne=K.getColumnCount();let W=`${q}R x ${ne}C`;if(W.length>17&&(W=`${q}x${ne}`),q>1||ne>1)return void u({text:W,fontStyle:"italic",justifyContent:"center"})}u({text:r.getSelectedSheet().getSelectedRange().toString()}),L()},[m,r,z]);const F=n.useRef(null),$=n.useCallback(K=>{const{onMouseDown:q,onMouseUp:ne,...W}=K;return e.jsx(B.IconButton,{...W,sx:{...W?.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:F},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:U=>`1px solid ${U.palette.text.icon??U.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:U=>`1px solid ${U.palette.primary.main}`},"::after":{borderBottom:U=>`1px solid ${U.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",height:"1rem",fontSize:11*A.IFont.getDeviceScale(),fontStyle:p?.fontStyle,paddingLeft:U=>U.spacing(.75),paddingRight:U=>U.spacing(.75),boxShadow:"none",flex:"1",color:U=>U.palette.text.secondary,input:{padding:"0",height:"1rem",textAlign:"left","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:U=>U.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:U=>U.palette.text.primary}}},value:T,onFocus:U=>{U.target?.select()},onKeyDown:U=>{if(U.which===w.KeyCodes.Enter||U.which===w.KeyCodes.Tab){let H=T;v()!==T&&(U.stopPropagation(),U.preventDefault(),H=P()),H?Q(H):s?.()}else if(U.which===w.KeyCodes.Escape)v()!==T?(M(v()),setTimeout(()=>{U.target?.select()},0),U.stopPropagation(),U.preventDefault()):s?.();else if(U.which===w.KeyCodes.Space)return void U.stopPropagation()},onBlur:()=>{M(v())},onChange:U=>{M(U.target.value)}})})},[T,p]),Q=w.useCallbackRef(async K=>{try{h?.closeAll();const q=t.lookupByRanges(K)?.[0];q&&await q?.select(),await r.getRanges(K)?.select()}catch(q){y.showMessage?.(q.message,{type:w.NotifierType.Error})}},[t,y,r]),Y=n.useCallback(K=>{setTimeout(()=>{x(!0)},0);const q={variant:w.CommandButtonType.Menuitem,parentFloat:K.floatReference,commandHook:{...l?.commandHook,beforeExecute:(re,le)=>(h?.closeAll(),l?.commandHook?.beforeExecute?.(re,le))},scope:l?.scope,commands:l?.commands};let ne=t.getItems({scope:r?.getSelectedSheet().getName()});ne=ne.sort((re,le)=>re.getType()===le.getType()?re.getName().localeCompare(le.getName()):re.getType()==="range"?-1:1);const W=k?null:["editNamedReference","deleteNamedReference"],U=k?null:["editTable",null,"convertTableToRange","deleteTable"],H=[],G=ne.length;for(let re=0;re<G;re++){const le=ne[re],Se=le.getRanges();if(!Se||le.isHidden())continue;const ge=le.getType();ge!==ne[re-1]?.getType()&&(re>0&&H.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal"},`type-divider-${H.length}`)),H.push(e.jsx(C.ExhibitMenuHeader,{variant:"subtitle2",sx:{paddingLeft:"16px"},children:le.getType()==="reference"?"Ranges":"Tables"},`type-header-${H.length}`))),ge==="reference"?H.push(n.createElement(C.SimpleCommandPopupButton,{...q,key:"named-"+H.length,popupCommandKeys:W,popupScope:"namedItem",scope:"namedItem",commandState:le,commands:l?.commands,label:le.getName(),quickCommand:"selectNamed",disabled:!le.getRanges()||f,icon:"NamedRange"})):ge==="table"&&H.push(n.createElement(C.SimpleCommandPopupButton,{...q,key:"namedItem-"+H.length,popupCommandKeys:U,popupScope:"namedItem",scope:"namedItem",commands:l?.commands,commandState:le,label:le.getName(),quickCommand:"selectNamed",disabled:!Se||f,icon:"InsertTable"}))}const ie=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...g,children:[k?null:e.jsx(C.CommandButton,{...q,scope:"namedItem",command:l?.commands.getCommand("addNamedReference")}),H&&H.length>0?e.jsxs(e.Fragment,{children:[k?null:e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:H})]}):null]});return C.defaultCreatePopupPanel({...K,children:ie})},[r,D,t,p,k]),te=w.useImperativeElement(i,()=>({focus(K){F.current?.focus(K)}}),[]);return e.jsx(B.Box,{className:"outer",sx:{minWidth:120,flex:"1 1 100%",display:"flex",alignItems:"center",justifyContent:"start",...d},ref:tt([te,i]),...g,children:e.jsx(C.ExhibitPopupIconButton,{className:"outer-button",sx:{display:"flex",flex:"1 1 100%","& .tooltip-wrapper":{display:"flex",flex:"1 1 100%",width:"100%"},...d},buttonProps:{sx:{backgroundColor:K=>K.palette.background.paper,backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`}},tabIndex:-1,outlined:{color:K=>o?K.palette.action.disabled:X.alpha(K.palette.divider,.2)},parentFloat:h,createPopupPanel:Y,onPopupOpen:()=>x(!0),onPopupClose:()=>x(!1),createTooltip:({children:K},q)=>e.jsx(C.ExhibitTooltip,{title:q||S?"":"Name Box",disabled:q,leaveDelay:0,sx:{opacity:q||S?0:1},children:K}),createQuickButton:$})})}));Zo.displayName="NamedCollectionEditor";const rl=(a,i)=>e.jsx(Zo,{ref:i,...a}),Qo=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,sheetElement:r,gridStyle:s,showNamedCollectionEditor:c=!0,NamedCollectionEditorProps:f,renderNamedCollectionEditor:l=rl,disabled:d,commands:g,...y}=a,[p,u]=n.useState(t?.getSelectedSheet()),[m,b]=n.useState(p.getSelectedCell().getCoords()),[S,x]=n.useState(!1),h=d||S;oe.useModelListener(t,{onSheetsChange:H=>{const G=H?.getSelectedSheet();b(G.getSelectedCell().getCoords()),u(G)},onViewChange(H){const G=H?.getSelectedSheet();b(G.getSelectedCell().getCoords()),u(G)}});const k=n.useRef(null),j=n.useMemo(()=>({fontSize:11}),[]);oe.useModelListener(p.getSelection(),{onChange:()=>{const H=p.getSelectedCell();x(!H.isEditAllowed()),b(H.getCoords())}}),oe.useModelListener(p,{onProtectionChange(){x(!p.getSelectedCell().isEditAllowed())}});const v=k.current?.getLineHeight()??20,[T,M]=n.useState(v),[P,I]=n.useState(5),[D,E]=n.useState(1),R=w.useCallbackRef((H,{size:G})=>{H.preventDefault(),H.stopPropagation();const ie=Math.floor(G.height/v);M(ie*v+1),ie>1&&I(ie)},[v]),N=w.useCallbackRef((H,{size:G})=>{const ie=Math.floor(G.height/v);E(ie)},[v]),z=w.useEditMode(),O=z.getMode();let L=null;O?.key==="edit"&&(L=O.args?.stateAndCoords);const F=n.useMemo(()=>{let H=L?.editState;return H||(H=oe.createCellEditStateFromCell(()=>p.getRange(m).getCell())),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(oe.SheetCellEditor,{ref:k,activeCoords:m,sheet:p,onFocus:()=>{r?.startEdit({autoFocus:!1,editMode:!0,cell:m})},defaultTextStyle:j,useRichStyling:!1,disabled:h,onChangeEdit:G=>{if(G.dirty!==void 0){const ie={sheet:p,coords:m,editState:G};z.setMode(re=>({...re,args:{...re?.args,stateAndCoords:ie}}))}},editState:H,commands:g,onCancelEdit:()=>{r?.cancelEdit(),r?.focus()},onSubmitEdit:()=>{r?.submitEdit(),r?.focus()},linesVisible:D})})},[p,L,m,D,r]),$=n.useRef(null),Q=n.useMemo(()=>c?l({names:t.getNames(),workbook:t,...f},$):null,[l,f,c,p,t,h]),Y=n.useMemo(()=>e.jsxs(B.Paper,{elevation:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:0,backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`,border:H=>`solid ${h?H.palette.action.disabled:X.alpha(H.palette.divider,.2)} 1px`},children:[e.jsx(C.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||L===null,onMouseDown:H=>{H.button===0&&H.preventDefault()},onClick:()=>{r.cancelEdit()}}),e.jsx(C.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||L===null,onMouseDown:H=>{H.button===0&&H.preventDefault()},onClick:()=>{r.submitEdit()}}),e.jsx(C.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:H=>{H.button===0&&H.preventDefault()}})]}),[h,L]),te=X.useTheme(),[K,q]=n.useState(!1),ne=n.useMemo(()=>e.jsxs(B.Box,{className:"formula-bar",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",gap:H=>H.spacing(.5),alignItems:"start"},children:[Y,e.jsxs(B.Paper,{elevation:0,sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",fontFamily:H=>H.typography.fontFamily,fontSize:11*A.IFont.getDeviceScale(),alignItems:"stretch",paddingTop:"2px",paddingBottom:"2px",boxShadow:"none",borderRadius:H=>`${H.shape.borderRadius}px`,backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`,border:H=>`solid ${h?H.palette.action.disabled:X.alpha(H.palette.divider,.2)} 1px`,"& textarea":{color:H=>h?`${H.palette.text.disabled} !important`:H.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:()=>q(!0),onBlur:()=>q(!1),onMouseDown:H=>{H.target?.classList.contains("react-resizable-handle")&&H.preventDefault()},children:[e.jsx(B.Box,{className:"formula-editor",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",alignItems:"center",marginTop:"0px",paddingLeft:H=>H.spacing(1),paddingRight:H=>H.spacing(1)},children:e.jsx(al.ResizableBox,{height:T,draggableOpts:{grid:[v,v]},minConstraints:[v,v],maxConstraints:[15*v,15*v],onResize:N,onResizeStop:R,resizeHandles:["s"],axis:"y",style:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:F})}),e.jsx(C.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:H=>{H.button===0&&H.preventDefault()},onClick:()=>{const H=D>1?1:P;M(H*v+1),E(H)}}),e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"2px",bottom:"0",willChange:"opacity",transition:"opacity 60ms ease-in",opacity:K?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:H=>H.palette.primary.main,borderRadius:H=>`${H.shape.borderRadius}px`}})]})]}),[Y,F,K,D,v]),W=n.useMemo(()=>Q||ne?!Q&&ne?ne:Q&&!ne?Q: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='${te.palette.text.icon??te.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='m 4.5961932,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.88365,0 -1.60005,-0.71626 -1.60005,-1.59991 0,-0.88365 0.7164,-1.6000508 1.60005,-1.6000508 0.88364,0 1.59991,0.7164008 1.59991,1.6000508 m 0,-4.881294 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 -0.88365,0 -1.60005,-0.7164 -1.60005,-1.60004 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-4.881226 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 -0.88365,0 -1.60005,-0.7164 -1.60005,-1.60005 0,-0.88365 0.7164,-1.59991 1.60005,-1.59991 0.88364,0 1.59991,0.71626 1.59991,1.59991' /%3E%3C/svg%3E%0A")`,backgroundRepeat:"no-repeat",backgroundPosition:"center calc(((var(--icon-size, 24) - 13px + 5px) / 2))",minWidth:"18px",marginRight:"1px"}},elementBefore:Q,elementAfter:ne})}):null,[Q,ne]),U=w.useImperativeElement(i,()=>({isFormulaBarElement:()=>!0,getNamedCollectionEditorElement:()=>$.current}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:H=>H.spacing(.5),...o},ref:U,...y,children:W})}));Qo.displayName="FormulaBar";const Jo=n.memo(n.forwardRef((a,i)=>{const{filter:o,commands:t,disabled:r,sx:s,floatReference:c,...f}=a,l=n.useMemo(()=>({}),[]),d=n.useMemo(()=>({commandHook:{beforeExecute:(p,u)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:c}),[r,c]),g=n.useMemo(()=>({...l,...d,variant:w.CommandButtonType.Menuitem}),[l,d]),y=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...g,command:t.getCommand("sortAscending")}),e.jsx(C.CommandButton,{...g,command:t.getCommand("sortDescending")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...g,command:t.getCommand("autoFilterClear")}),[]]});return e.jsx(B.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...s},...f,children:y})}));Jo.displayName="FilterColumnMenu";const sr=n.memo(n.forwardRef((a,i)=>{const{children:o,className:t,disabled:r,style:s,filter:c,...f}=a,l=w.useImperativeElement(i,()=>({isFilters:()=>!0}),[]);return e.jsx("div",{ref:l,className:se("filters",t),style:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",...s},...f,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:c.getName()}),e.jsx("div",{children:"Filter Widget"})]})})}));sr.displayName="Filters";const en=n.memo(n.forwardRef((a,i)=>{const{children:o,sheet:t,style:r,className:s,value:c,index:f,editing:l,editable:d,disabled:g,selectedIndex:y,dragging:p,borderColor:u,borderWidth:m,activeColor:b,background:S="white",tabRadius:x=4,gridTheme:h,...k}=a,[j,v]=n.useState(()=>!!t&&t.getProtection().isLocked()),[T,M]=n.useState(()=>t?t.getTabColor():null);oe.useModelListener(t,{onProtectionChange:()=>{v(t.getProtection().isLocked())},onTabColorChange:()=>{M(t.getTabColor())},onStyleChange:()=>{M(t.getTabColor())}});const P=X.useTheme(),I=y===f;let D=null,E=null;if(T||p){let z=S;T?(E=T.toBlackOrWhite().toCSS(),z=T?.toCSS()):I||(z=P.palette.background.paper),D=e.jsx(B.Box,{sx:{position:"absolute",boxSizing:"border-box",top:"3px",left:"4px",right:"4.5px",bottom:"1.5px",opacity:I?"50%":"100%",borderRadius:"4px",border:O=>I?`${S} solid 1px`:`${O.palette.divider} solid 1px`,background:I&&T?`linear-gradient(0deg, ${z} 0%, transparent)`:z}})}let R=null;typeof u=="string"?R=u:u?.toCSS&&(R=u.toCSS());const N=I?e.jsx(B.Box,{sx:{width:"100%",borderRadius:"4px",minWidth:"4px",height:"2px",backgroundColor:z=>z.palette.primary.main}}):null;return e.jsx(X.ThemeProvider,{theme:I?h??P:P,children:e.jsx(B.Box,{ref:i,className:se(s),sx:{...r,display:"flex",flexDirection:"column",minHeight:"0px",fontWeight:I?"700":"400",fontSize:"0.85rem",letterSpacing:"0",lineHeight:"1",textTransform:"none",minWidth:"unset",cursor:p?"grabbing":void 0},...k,children:e.jsx(w.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:x,strokeColor:I?R:"transparent",children:e.jsx(B.Button,{sx:{textTransform:"none",borderRadius:"0px",minHeight:"0px",paddingLeft:"11px",paddingRight:"12px",paddingTop:"3px",flex:"1 1 100%",paddingBottom:"3px",fontWeight:I?"700":"400",fontSize:"0.85rem",letterSpacing:"0",transition:"none",cursor:p?"grabbing":void 0,color:I?"primary":E||"text.secondary",backgroundColor:I?S:"transparent","&:hover:not([disabled])":{backgroundColor:I?S:"transparent"},"& input":{color:z=>`${z.palette.text.primary}`,textAlign:"center",fontWeight:"500"},marginTop:"0px",minWidth:"unset"},disabled:g,disableRipple:l,component:"div",children:e.jsxs(e.Fragment,{children:[D,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:I?void 0:"1px"},children:[o,N]}),j?e.jsx(w.DynamicIcon,{iconKey:"Lock",style:{scale:"0.80",marginLeft:"2px",width:"22px",height:"22px"},color:"secondary"}):e.jsx(B.Box,{sx:{minHeight:"22px"}})]})]})},c+":"+f)})})})}));en.displayName="SheetTab";const tn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,index:t,commands:r,scope:s="sheet",disabled:c,floatReference:f,sx:l,className:d,tabStripRef:g,...y}=a,[p,u]=n.useState(o?.getProtection());oe.useModelListener(o,{onProtectionChange:h=>{u(h?.getProtection())}});const m=n.useMemo(()=>({}),[]),b=n.useMemo(()=>({commandHook:{beforeExecute:(h,k)=>f.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:s,commandState:t,disabled:c||t===void 0,parentFloat:f}),[c,f]),S=n.useMemo(()=>({...m,...b}),[m,b]),x=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{command:r.getCommand("addSheet"),commandState:t,...S,variant:w.CommandButtonType.Menuitem}),e.jsx(C.CommandButton,{command:r.getCommand("deleteSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsxs(C.ExhibitMenuItem,{onMouseDown:h=>{h.button===0&&h.preventDefault()},onMouseUp:()=>{Promise.resolve(f.closeAll()).then(()=>{g?.startEdit(t)})},disabled:c||!p.isStructureAllowed(),parentFloat:f,children:["Rename",s!=="sheet"?" Sheet":""]}),e.jsx(C.CommandButton,{command:r.getCommand("duplicateSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(C.CommandButton,{command:r?.getCommand("protectionSheetToggle"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(ht,{variant:w.CommandButtonType.Menuitem,command:r.getCommand("formatSheetTabColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0,autoColorLabel:"No Tab Color",autoColorPosition:pt.End},parentFloat:f}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{command:r.getCommand("hideSheet"),...S,variant:w.CommandButtonType.Menuitem})]});return e.jsx(B.Box,{ref:i,className:se("menu",d),sx:{...l},...y,children:x})}));tn.displayName="SheetTabMenu";const on=n.memo(n.forwardRef((a,i)=>{const{workbook:o,gridStyle:t,floatReference:r,closeFloatAll:s,className:c,...f}=a,[l,d]=n.useState(o?.getSheets().getItems()),[g,y]=n.useState(o?.getProtection());oe.useModelListener(o,{onSheetsChange:u=>{d(u.getSheets().getItems())},onProtectionChange:u=>{y(u?.getProtection())}});const p=n.useMemo(()=>{const u=[],m=o.getSheets().getItems({visibility:A.ISheet.Visibility.Hidden}),b=o.getSelectedSheet();for(let S=0;S<m.length;S++){const x=m[S],h=x.getVisibility();if(h===A.ISheet.Visibility.VeryHidden)continue;const k=b===x,j=x.getProtection().isLocked(),v=x.getTabColor(),T=t?.body.fill??"transparent";let M=null,P=null,I=T;v&&(I=v.toCSS(),k||(P=v.toBlackOrWhite().toCSS()),M=e.jsx(B.Box,{sx:{position:"absolute",display:"flex",flexDirection:"column",top:"4px",left:"40px",right:"8px",bottom:"4px",background:k?I:"transparent",borderRadius:"4px",border:`solid 1px ${t.header.edgeStrokeFill}`},children:e.jsx(B.Box,{sx:{flex:"1 1 100%",boxSizing:"content-box",opacity:k||h===A.ISheet.Visibility.Hidden?"50%":"100%",border:E=>k?`${T} solid 1.5px`:`${E.palette.divider} solid 1px`,background:k&&v?`linear-gradient(0deg, ${I} 0%, ${T})`:I,borderRadius:"4px"}})}));let D=null;j&&(D=e.jsx(w.DynamicIcon,{iconKey:"Lock"})),h!==A.ISheet.Visibility.Visible&&(D=e.jsx(w.DynamicIcon,{iconKey:"VisibilityOff",style:{opacity:g.isStructureAllowed()?1:.7},color:"secondary"})),D&&(D=e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",ml:"16px","& *":{lineHeight:"1em",fontSize:"1.3em"}},children:D})),u.push(e.jsx(C.ExhibitMenuItem,{disabled:!g.isStructureAllowed()&&h===A.ISheet.Visibility.Hidden,sx:{color:E=>{let R=k?E.palette.primary.main:E.palette.text.secondary;return P&&(R=P),h===A.ISheet.Visibility.Hidden&&(R=Re.alpha(R,E.palette.action.disabledOpacity)),R},borderLeft:E=>`${k?E.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"4px",paddingTop:"4px",paddingBottom:"4px",fontWeight:k?"700":"400","&:hover":{fontWeight:"700"}},icon:k?e.jsx(C.SelectedIcon,{}):void 0,onMouseDown:E=>E.preventDefault(),onMouseUp:()=>{Promise.resolve(r.closeAll()).then(()=>{try{x.select()}catch(E){console.error(E)}})},children:e.jsxs(e.Fragment,{children:[M,e.jsxs(B.Box,{sx:{paddingRight:"0px",paddingLeft:"4px",display:"flex",flexDirection:"row",flex:"1 1 100%",overflow:"hidden",alignItems:"center",zIndex:2},children:[e.jsxs(B.Box,{className:"sheet-name",sx:{display:"flex",flexDirection:"column",paddingLeft:"8px",paddingRight:"8px",alignItems:"center"},children:[x.getName(),e.jsx(B.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:x.getName()})]}),D]})]})},""+S))}return u},[o,g,l,r,t]);return e.jsx(B.Box,{ref:i,className:se("menu",c),...f,children:p})}));on.displayName="SheetsAllMenu";let Ut=!1,cr=!1,$e=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:()=>$e?.getWorkbook(),getSelectedSheet:()=>$e?.getWorkbook().getSelectedSheet(),getSelectedRange:()=>$e?.getWorkbook().getSelectedRange(),getSelectedRanges:()=>$e?.getWorkbook().getSelectedRanges(),getRange:t=>$e?.getWorkbook().getRange(t),getSelectedWorkbookElement:()=>$e,getLicenseManager:()=>A.LicenseManager,moreExamples:()=>{console.table({"SheetXL.getRange('Sheet1!e5:f6').setValues([[110, 220], [210, 220]])":{Summary:"Set an array of values."},"SheetXL.getRange('a1:e5').setValue(100)":{Summary:"Set a single repeating value to a range."},"SheetXL.getRange('Sheet1!e5:f6').getValues()":{Summary:"Get the values as a 2d array (see forEach)."},"SheetXL.getSelectedRange().setValue(new Date())":{Summary:"Set current date/time using Javascript Date."},"SheetXL.getSelectedRange().setValue('10/23/95')":{Summary:"Set current date/time using string."},"SheetXL.getSelectedSheet().getUsedRange().getValues()":{Summary:"Get all of the values in a sheet."},"SheetXL.getSelectedRange().getStyle().update({ fill: 'accent4' })":{Summary:"Set fill to theme color 4."},"SheetXL.getRange('E:L').getStyle().update({ fill: 'accent1 lumMod 90 lumOff 40' })":{Summary:"Set some columns to a modified theme color."},"SheetXL.getRange('e5:f10').getStyle().update({ style: { border: 'double blue' }})":{Summary:"Set border."},"SheetXL.getCell().getStyle().fill.toCSS()":{Summary:"Get the fill style as css for the selected cell."},"SheetXL.getRange('a1:a3').autoFill('a1:a7')":{Summary:"Autofill down."},"SheetXL.getRange('e7:i9').merge({ orientation: 'rows' })":{Summary:"Merge cells horizontally."},"SheetXL.getSelectedRange().sort({ ascending: false, hasHeader: false })":{Summary:"Sort selected cells ascending with a header."},"SheetXL.getSelectedRange().clear('all')":{Summary:"Clear the current range a different way."},"SheetXL.getSelectedSheet().getTables().add('b2:e9')":{Summary:"Create a 4x8 table at b2 for current sheet."},"SheetXL.getRange('a1:c3').copyFrom('e1:g3')":{Summary:"Copy cells."},"SheetXL.getRange('c:t').getColumnHeaders().setSize(30)":{Summary:"Set the size of columns to 30 pixels."},"SheetXL.getRange('2:3').delete()":{Summary:"Remove rows 2 and 3 and shift up."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg')":{Summary:"Add an image."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg', { bounds: { height: 100 } })":{Summary:"Add an image of height 100."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue(1.50).getStyle().update({ numberFormat: '0%' }).autoFit(); }, 'Enter 150%')":{Summary:"Set value to 100 and numberformat to 0% as a single."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue('Remind Me Later').getStyle().update({ namedStyle: 'Note'}).autoFit(); }, 'Set Reminder')":{Summary:"Set a value and style to Note style and autofit text."},"SheetXL.getSelectedWorkbook().getNames().addReference('Small_Range', 'A2:E5');":{Summary:"Add a named range."},"SheetXL.getSelectedWorkbook().getRange('a1:e5').addListener((e) => { console.log('got an update for:', e.getSource().toString()) })":{Summary:"Listen for updates at a range."}})}}))}catch(o){o instanceof DOMException||console.error(o),Ut=!0}if($e!==a&&($e=a,!Ut))try{Ut=!0,(top??window).SheetXL&&(await A.LicenseManager._validate(!0),A.LicenseManager.wasPrinted()&&(()=>{je.CommonUtils.consoleWithNoSource(`%cTip: You can access the API directly in the console.
|
|
10
|
-
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 nn(a,i){if(a==null)return{};var o={};for(var t in a)if({}.hasOwnProperty.call(a,t)){if(i.indexOf(t)!==-1)continue;o[t]=a[t]}return o}function no(a,i){return no=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,t){return o.__proto__=t,o},no(a,i)}function 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},Ft="unmounted",Ye="exited",Ze="entering",st="entered",Do="exiting",ze=(function(a){function i(t,r){var s;s=a.call(this,t,r)||this;var c,f=r&&!r.isMounting?t.enter:t.appear;return s.appearStatus=null,t.in?f?(c=Ye,s.appearStatus=Ze):c=st:c=t.unmountOnExit||t.mountOnEnter?Ft:Ye,s.state={status:c},s.nextCallback=null,s}dr(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Ft?{status:Ye}:null};var o=i.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==Ze&&s!==st&&(r=Ze):s!==Ze&&s!==st||(r=Do)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t,r,s,c=this.props.timeout;return t=r=s=c,c!=null&&typeof c!="number"&&(t=c.exit,r=c.enter,s=c.appear!==void 0?c.appear:r),{exit:t,enter:r,appear:s}},o.updateStatus=function(t,r){if(t===void 0&&(t=!1),r!==null)if(this.cancelNextCallback(),r===Ze){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:et.findDOMNode(this);s&&mr(s)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ye&&this.setState({status:Ft})},o.performEnter=function(t){var r=this,s=this.props.enter,c=this.context?this.context.isMounting:t,f=this.props.nodeRef?[c]:[et.findDOMNode(this),c],l=f[0],d=f[1],g=this.getTimeouts(),y=c?g.appear:g.enter;!t&&!s||Jn?this.safeSetState({status:st},function(){r.props.onEntered(l)}):(this.props.onEnter(l,d),this.safeSetState({status:Ze},function(){r.props.onEntering(l,d),r.onTransitionEnd(y,function(){r.safeSetState({status:st},function(){r.props.onEntered(l,d)})})}))},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts(),c=this.props.nodeRef?void 0:et.findDOMNode(this);r&&!Jn?(this.props.onExit(c),this.safeSetState({status:Do},function(){t.props.onExiting(c),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:Ye},function(){t.props.onExited(c)})})})):this.safeSetState({status:Ye},function(){t.props.onExited(c)})},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(c){s&&(s=!1,r.nextCallback=null,t(c))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=this.props.nodeRef?this.props.nodeRef.current:et.findDOMNode(this),c=t==null&&!this.props.addEndListener;if(s&&!c){if(this.props.addEndListener){var f=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],l=f[0],d=f[1];this.props.addEndListener(l,d)}t!=null&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Ft)return null;var r=this.props,s=r.children;r.in,r.mountOnEnter,r.unmountOnExit,r.appear,r.enter,r.exit,r.timeout,r.addEndListener,r.onEnter,r.onEntering,r.onEntered,r.onExit,r.onExiting,r.onExited,r.nodeRef;var c=nn(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,c):n.cloneElement(n.Children.only(s),c))},i})(n.Component);function at(){}ze.contextType=ur,ze.propTypes={},ze.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:at,onEntering:at,onEntered:at,onExit:at,onExiting:at,onExited:at},ze.UNMOUNTED=Ft,ze.EXITED=Ye,ze.ENTERING=Ze,ze.ENTERED=st,ze.EXITING=Do;var Co=function(a,i){return a&&i&&i.split(" ").forEach(function(o){return r=o,void((t=a).classList?t.classList.remove(r):typeof t.className=="string"?t.className=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),c=0;c<r;c++)s[c]=arguments[c];return(t=a.call.apply(a,[this].concat(s))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(f,l){var d=t.resolveArguments(f,l),g=d[0],y=d[1];t.removeClasses(g,"exit"),t.addClass(g,y?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(f,l)},t.onEntering=function(f,l){var d=t.resolveArguments(f,l),g=d[0],y=d[1]?"appear":"enter";t.addClass(g,y,"active"),t.props.onEntering&&t.props.onEntering(f,l)},t.onEntered=function(f,l){var d=t.resolveArguments(f,l),g=d[0],y=d[1]?"appear":"enter";t.removeClasses(g,y),t.addClass(g,y,"done"),t.props.onEntered&&t.props.onEntered(f,l)},t.onExit=function(f){var l=t.resolveArguments(f)[0];t.removeClasses(l,"appear"),t.removeClasses(l,"enter"),t.addClass(l,"exit","base"),t.props.onExit&&t.props.onExit(f)},t.onExiting=function(f){var l=t.resolveArguments(f)[0];t.addClass(l,"exit","active"),t.props.onExiting&&t.props.onExiting(f)},t.onExited=function(f){var l=t.resolveArguments(f)[0];t.removeClasses(l,"exit"),t.addClass(l,"exit","done"),t.props.onExited&&t.props.onExited(f)},t.resolveArguments=function(f,l){return t.props.nodeRef?[t.props.nodeRef.current,f]:[f,l]},t.getClassNames=function(f){var l=t.props.classNames,d=typeof l=="string",g=d?(d&&l?l+"-":"")+f:l[f];return{baseClassName:g,activeClassName:d?g+"-active":l[f+"Active"],doneClassName:d?g+"-done":l[f+"Done"]}},t}dr(i,a);var o=i.prototype;return o.addClass=function(t,r,s){var c=this.getClassNames(r)[s+"ClassName"],f=this.getClassNames("enter").doneClassName;r==="appear"&&s==="done"&&f&&(c+=" "+f),s==="active"&&t&&mr(t),c&&(this.appliedClasses[r][s]=c,(function(l,d){l&&d&&d.split(" ").forEach(function(g){return p=g,void((y=l).classList?y.classList.add(p):(function(u,m){return u.classList?!!m&&u.classList.contains(m):(" "+(u.className.baseVal||u.className)+" ").indexOf(" "+m+" ")!==-1})(y,p)||(typeof y.className=="string"?y.className=y.className+" "+p:y.setAttribute("class",(y.className&&y.className.baseVal||"")+" "+p)));var y,p})})(t,c))},o.removeClasses=function(t,r){var s=this.appliedClasses[r],c=s.base,f=s.active,l=s.done;this.appliedClasses[r]={},c&&Co(t,c),f&&Co(t,f),l&&Co(t,l)},o.render=function(){var t=this.props;t.classNames;var r=nn(t,["classNames"]);return n.createElement(ze,oo({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},i})(n.Component);Fo.defaultProps={classNames:""},Fo.propTypes={};const So=.12,Io=(a,i)=>{const o={},t=l=>{const d=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:d,strokeFill:C.elevateColor(d,So,l.palette?.mode),darkMode:l.palette.mode==="dark"}},r=t(i);o.body=t(a),o.header={...o.body,strokeFill:C.elevateColor(o.body.fill,So,a.palette?.mode),fill:i&&a.palette.mode==="dark"&&i.palette.mode!==a.palette.mode?o.body.fill:C.elevateColor(o.body.fill,.055,a.palette?.mode),edgeStrokeFill:a.palette.mode==="dark"?o.body.strokeFill:C.elevateColor(o.body.fill,.328,a.palette?.mode)},o.headerHover=l=>({...o.header,strokeFill:C.elevateColor(l?.fill??o.body.fill,.22,a.palette?.mode),fill:C.elevateColor(l?.fill??o.header.fill,.065,a.palette?.mode),text:{...l?.text,fontWeight:a.typography?.fontWeightBold}});const s=C.elevateColor(a.palette.mode!=="dark"?a.palette.primary.light:a.palette.primary.main,.055,a.palette?.mode);o.headerSelect={...o.header,strokeFill:a.palette.primary.main,fill:Re.alpha(s,.2),text:{...o.header.text,fill:a.palette.primary.main},dividerStrokeFill:Re.alpha(s,.7)},o.headerSelectAll={...o.headerSelect,fill:Re.alpha(s,.9),text:{...o.headerSelect.text,fill:a.palette.primary.contrastText},edgeStrokeFill:o.headerSelect.strokeFill},o.buttonSurface={...r,strokeFill:C.elevateColor(r.fill,So,i.palette?.mode),fill:i&&i.palette.mode==="dark"&&i.palette.mode!==a.palette.mode?r.fill:C.elevateColor(r.fill,.055,i.palette?.mode),edgeStrokeFill:i.palette.mode==="dark"?r.strokeFill:C.elevateColor(r.fill,.328,i.palette?.mode)},o.headerSelection={fill:a.palette?.primary?.main?Re.alpha(a.palette?.primary?.main,.1):void 0,strokeFill:a.palette?.primary?.main},o.headerSelectionInactive={...o.headerSelection,fill:a.palette?.divider?Re.alpha(a.palette?.divider,.05):void 0,strokeFill:"transparent"};const c=i??a,f=c.palette.mode==="dark";return o.selection={fill:c.palette?.primary?.main?Re.alpha(c.palette?.primary?.main,.1):void 0,strokeFill:c.palette?.primary?.main},o.selectionInactive={...o.selection,fill:c.palette?.divider?Re.alpha(c.palette?.divider,.05):void 0,strokeFill:"transparent"},o.selectionRemove={...o.selection,fill:Re.alpha(c.palette.warning.light,.05),strokeFill:c.palette.warning.dark},i&&(o.body=t(i)),o.colorShadow=Re.alpha(c.palette.action.active,.5),o.colorGrey=c.palette.action.active,o.filterDarkInvert=f?"hue-rotate(180deg) invert(1) brightness(95%)":"none",o},Nt=n.memo(n.forwardRef((a,i)=>{const{children:o,sx:t,parentFloat:r,...s}=a,c=w.useImperativeElement(i,()=>({}),[]),[f,l]=_e(),d=n.useRef(null),g=n.useRef(null),[y,p]=n.useReducer(v=>v+1,0),[u,m]=n.useState(null),[b,S]=n.useState(null),[x,h]=n.useState(null),{reference:k}=C.useFloatStack({parentFloat:r,label:"overflow"});n.useLayoutEffect(()=>{g.current={refs:[]};const v=[],T=n.Children.toArray(o);let M=0;T.forEach((P,I)=>{v.push(e.jsx(B.Box,{sx:{display:"flex"},ref:D=>{M++,M===T.length&&p();const E={current:null};E.current=D,g.current.refs[I]=E},children:P},I))}),m(v)},[o,l]),n.useLayoutEffect(()=>{if(!u)return;const v=g.current.refs,T=v?v.length:0;if(!c.current||T===0)return S(null),void h(null);const M=c.current?.getBoundingClientRect(),P=[],I=[];let D=0,E=!1;for(let N=0;!E&&N<T;N++){const z=v[N];if(!z)continue;if(!z.current){E=!0;continue}const O=z.current.getBoundingClientRect();D+=O?.width,D>M.width&&(E=!0)}if(!E)return S(null),void h([]);const R=d.current?.getBoundingClientRect();D=0;for(let N=0;N<T;N++){const z=v[N];let O=!1;if(z.current){const L=z.current.getBoundingClientRect();D+=L?.width,D<M.width-R.width&&(O=!0)}O?P.push(u[N]):I.push(u[N])}S(P.length>0?P:null),h(I.length>0?I:null)},[o,u,l,k,y]);const j=w.useCallbackRef(v=>{const T=[],M=x.length;for(let I=0;I<M;I++){const D=n.Children.toArray(x[I])[0];n.Children.toArray(D.props.children?.props?.children??D.props.children).forEach((E,R)=>{const N=E,z={...N.props,key:`overflow-${I}-${R}${N.key??""}`};z.parentFloat&&v&&(z.parentFloat=v.floatReference);const O=n.cloneElement(N,z);T.push(O)})}const P=e.jsx(B.Box,{className:"overflow-palette-popup-panel",sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:I=>I.spacing(.25),paddingTop:I=>I.spacing(.5),paddingBottom:I=>I.spacing(.5),paddingLeft:I=>I.spacing(1),paddingRight:I=>I.spacing(1),overflow:"hidden"},children:T});return C.defaultCreatePopupPanel({...v,children:P})},[x]);return e.jsxs(B.Box,{className:"overflow-palette",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",width:"100%",maxWidth:"100%",...t},ref:tt([c,f,i]),...s,children:[e.jsx(B.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%",alignItems:"center"},children:b??u}),e.jsx(B.Box,{className:"overflow-palette-popup-button",sx:{display:x!==null&&x.length===0?"none":"flex",flex:"1 1 0"},children:e.jsx(C.ExhibitPopupIconButton,{createPopupPanel:j,ref:d,parentFloat:k,createTooltip:({children:v},T)=>e.jsx(C.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",il=a=>{if(a.metadata?.name)return a.metadata.name;let i=(a.path.split("/").pop()||"").replace(/\.[^/.]+$/,"");return a.metadata?.icon==="formula"?i.toUpperCase():(i=i.replace(/([a-z])([A-Z])/g,"$1 $2"),i.replace(/[-_]/g," ").trim().split(/\s+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "))},fr=async a=>{const i=dt.IOUtils.relativePath(a,"./manifest.json"),o=await fetch(i);if(!o.ok)throw new je.ChainedError(`Failed to retrieve directory at '${a}': ${o.statusText}`);const t=await o.text();if(t.trim().toLowerCase().startsWith("<!doctype html")||t.trim().toLowerCase().startsWith("<html"))throw new je.ChainedError(`Failed to retrieve directory at '${a}'`);let r;try{r=JSON.parse(t)}catch(c){throw new Error(`Failed to parse directory: ${c.message}. Ensure the file is valid JSON.`)}const s=r.map(async c=>{try{const f=dt.IOUtils.relativePath(a,c.path),l=await fetch(f);if(!l.ok)throw new Error(`Failed to fetch file at '${c.path}': ${l.statusText}`);const d=await l.text();let g=c.metadata;return g?.title||(g={title:il(c),...g}),{path:c.path,content:d,metadata:g}}catch(f){console.error(f.message)}return null});return(await Promise.all(s)).filter(c=>c!==null)},wo={marginRight:"4px"},ko="1em",ll=n.memo(a=>{const{disabled:i,snippet:o,description:t,handleInsert:r,sx:s,...c}=a;let f;const l=o.metadata?.icon;return f=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(C.ExhibitMenuItem,{sx:{maxWidth:"460px",display:"flex","*":{lineHeight:"1.2"},...s},disabled:i,icon:f,onMouseDown:d=>{d.button===0&&d.preventDefault()},onMouseUp:d=>{d.button===0&&r(o)},onKeyDown:d=>{d.keyCode!==w.KeyCodes.Enter&&d.keyCode!==w.KeyCodes.Space||r(o)},...c,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:d=>Re.alpha(d.palette.text.secondary??d.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:o.metadata?.summary})]})})}),sl=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,scriptPath:c=pr,...f}=a,[l,d]=n.useState([]),[g,y]=n.useState(!0),p=w.useCommands(o,["executeSelectedScript"]),u=p[0]?.context?.();n.useEffect(()=>{(async()=>{try{const b=await fr(c);d(b)}catch{}finally{y(!1)}})()},[c]);const m=n.useCallback((b,S)=>{if(g)return e.jsx("div",{children:"Loading..."});const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:s},h=v=>{u.getEditor()?.insertSnippet(v.content),b.closeFloat()},k=[];for(let v=0;v<l.length;v++){const T=l[v];T&&k.push(e.jsx(ll,{handleInsert:h,snippet:T},T.path))}const j=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[k.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:k}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(C.CommandButton,{...x,key:"help",command:o.getCommand("help")})]});return C.defaultCreatePopupPanel({...b,children:j})},[s,t,r,g,u]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Insert Script",tooltip:"Inserts a script from a set of templates.",createPopupPanel:m,icon:"ScriptInsert",...f})})),hr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,c=w.useCallbackRef(f=>{const{commandButtonProps:l,commandPopupProps:d}=f;return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flex:"1 1 100%"},children:[e.jsx("div",{children:e.jsx(Nt,{parentFloat:t,style:{},children:e.jsx(C.CommandButton,{...l,command:o?.getCommand("saveScripts")})})}),e.jsx("div",{style:{flex:"1 1 100%"}}),e.jsx("div",{children:e.jsx(Nt,{parentFloat:t,style:{},children:e.jsx(sl,{...l,commands:o})})})]})})},[o]);return e.jsx(C.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:c,...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:c=210,buttonMinHeight:f=80,gap:l=12,...d}=a,[g,y]=n.useState([]),[p,u]=n.useState(!0),[m,b]=n.useState(null);if(n.useEffect(()=>{(async()=>{const h=[{path:null,metadata:{title:"Blank Template...",summary:"Start with an empty script."},content:""}];try{u(!0),b(null);const k=await fr(o);for(let j=0;j<k.length;j++){const v=k[j];v&&h.push(v)}}catch(k){b(k instanceof Error?k.message:"Failed to load scripts"),k instanceof je.ChainedError||console.error("Error loading scripts:",k)}finally{y(h),u(!1)}})()},[o]),p)return e.jsx(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:se(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`,...r},...d,children:e.jsx(B.CircularProgress,{})});let S=null;m&&(S=e.jsxs(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:se(s,"script-select","error-results"),sx:{background:h=>h.palette.error.light,flex:"0",zIndex:1e3,flexDirection:"column",padding:h=>h.spacing(1),border:h=>`1px solid ${h.palette.error.main}`,borderBottomLeftRadius:1,borderBottomRightRadius:1,backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`},...d,children:[e.jsx(B.Typography,{color:"error",variant:"h6",component:"div",gutterBottom:!0,children:"Error loading Templates"}),e.jsx(B.Typography,{color:"error",component:"div",children:m})]}));const x=h=>{const k=h.metadata?.icon;return k==="macro"?e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro",size:"1em"}):k==="formula"?e.jsx(w.DynamicIcon,{iconKey:"ScriptFormula",size:"1em"}):k==="autostart"?e.jsx(w.DynamicIcon,{iconKey:"ScriptAutoStart",size:"1em"}):null};return e.jsxs(B.Box,{ref:i,className:se(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`,...r},...d,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(${c}px, 1fr))`,gap:`${l}px`,padding:2,paddingLeft:"0px",paddingRight:"0px"},children:g.map((h,k)=>e.jsxs(B.Button,{variant:"outlined",sx:{minWidth:c,minHeight:f,display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",textAlign:"left",padding:2,textTransform:"none",overflow:"hidden",...k===0&&{borderStyle:"dashed",marginBottom:"8px"},...k===1&&{gridColumn:"1"}},onClick:()=>t?.(h),children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:.5},children:[e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:h.metadata?.title||h.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),x(h)]}),h.metadata?.summary&&e.jsx(B.Typography,{variant:"body2",component:"div",color:"text.secondary",sx:{overflow:"hidden",display:"flex",flexDirection:"column",textOverflow:"ellipsis",alignItems:"flex-start"},children:h.metadata.summary})]},`${h.path}-${k}`))})]}),S]})}));gr.displayName="TemplateSelectPanel";const xr=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,editorProps:r,commands:s,readOnly:c=!1,frame:f,autoFocusSel:l,autoFocus:d=!0,scripts:g,...y}=a,p=X.useTheme(),[u,m]=n.useState(!1),b=n.useRef(!1),[S,x]=n.useState({message:"Loading",cursor:"",dirty:!1}),[h,k]=n.useState(null);n.useEffect(()=>{let L=!1;return k(null),(async function(){if(g&&(await g.start(),!L)){const F=g.getModules().getItems()[0]?.getSource();k({source:F||null})}})(),()=>{L=!0}},[g]);const j=n.useCallback(L=>{x(F=>({...F,...L}))},[]),v=n.useRef(null),[T,M]=n.useState(null),P=n.useRef(null),I=w.useCallbackRef(L=>{if(T)return T.focus(L),!0;if(l){const F=v.current?.querySelectorAll?.(l);if(F&&F.length>0)return F[0]?.focus?.(L),!0}return v.current?.focus?.(L),!1},[T,l,d]),D=n.useMemo(()=>e.jsx(C.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:L=>L.spacing(.5),marginRight:L=>L.spacing(.5),marginTop:L=>L.spacing(1),marginBottom:L=>L.spacing(1)},children:e.jsx(hr,{commands:s})}),[p,s]),R=n.useMemo(()=>e.jsx(B.Box,{className:se("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 ${p.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:L=>L.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:L=>L.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:L=>L.palette.text.secondary},variant:"caption",children:S.cursor})]})}),[S]),N=n.useMemo(()=>e.jsxs(B.Box,{className:se("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:D,readOnly:c,frame:f,autoFocus:d,commands:s,onStatusChange:j,darkMode:p.palette.mode==="dark",...r})}),R]}),[p,s,E,R,u,D,c,r,d,l,f,j]),z=n.useMemo(()=>{let L;return h===null?null:(h.source===null&&(L=e.jsx(gr,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:F=>{v.current?.getEditor()?.insertSnippet(F.content),k({source:F.content??""})}})),e.jsx(B.Box,{tabIndex:0,className:se("script-workspace",o),sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",alignItems:"stretch",userSelect:"none",flexGrow:0,outline:"none"},onPointerDown:F=>{F.isDefaultPrevented()||v.current?.focus()},children:e.jsxs(B.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[N,L]})}))},[E,N,o,h]),O=w.useImperativeElement(i,()=>({isScriptWorkspaceElement:()=>!0,focus:L=>{I(L)}}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",...t},ref:O,...y,onFocus:L=>{m(!0),b.current=!0,O.current?.contains(L.target)&&L.target!==O.current&&M(L.target),L.relatedTarget&&!P.current&&(P.current=L.relatedTarget),y?.onFocus?.(L)},onBlur:L=>{O?.current?.contains(L.relatedTarget)||O?.current===L.relatedTarget||(P.current=null,b.current=!1,m(!1)),y?.onBlur?.(L)},children:z})}));xr.displayName="ScriptWorkspace";const cl=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...c}=a;return e.jsx(xr,{ref:i,readOnly:!1,commands:t,frame:s,scripts:o?.getScripts(),...c})},br=n.memo(n.forwardRef((a,i)=>{const{commands:o,...t}=a,r=w.useCommands(o,["executeScript","showScriptEditor"]),[s,c]=n.useState([]),[f,l]=n.useState(!1),d=r[0]?.context?.();n.useEffect(()=>{const m=d?.getScripts();m&&(async()=>{l(!0);const b=await m.searchFunctions({type:"macro"});c(b),l(!1)})()},[]);const g={variant:w.CommandButtonType.Menuitem,parentFloat:a.floatReference,scope:"scripts",shortcut:null},y=[],p=s.length;for(let m=0;m<p;m++){const b=s[m];y.push(e.jsx(C.CommandButton,{...g,command:o.getCommand("executeScript"),commandState:{declaration:b},tooltipProps:{description:`Execute ${b.getName()??"macro"}`},icon:e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro"}),label:b.getName()??`Script '${b.getName()}'`},`macro-${b.getName()}-${m}`))}const u=e.jsxs(B.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[y.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:y}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(C.CommandButton,{...g,key:"show-editor",command:o.getCommand("showScriptEditor")})]});return C.defaultCreatePopupPanel({...t,children:u})}));br.displayName="RunScriptPopupPanel";const yr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f="showScriptEditor",l=w.useCommands(o,["executeScript","showScriptEditor"])[0].context(),d=n.useCallback((g,y)=>{const p=e.jsx(br,{...g,commands:y});return C.defaultCreatePopupPanel({...g,children:p})},[s,l,t,r]);return e.jsx(C.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:d,selected:o.getCommand(f).state(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:f,...c})})),dl=a=>e.jsx(C.CommandButton,{...a}),Cr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,[c,f]=n.useState(!1),l=w.useCommands(o,["executeScript","showScriptEditor"]),d=l[0]?.context?.();n.useEffect(()=>{const p=d?.getScripts();if(!p)return;const u=l[1],m=async()=>{if(!u)return;let x=!1;if(!u.state()){const h=await p.searchFunctions({type:"macro"}),k=h?.length??0;for(let j=0;h&&!x&&j<k;j++)x=!0}f(x||!!u.state())};m();const b=u.addPropertyListener(()=>{m()}),S=p.addListeners({onChange:()=>{m()}});return()=>{S(),b()}},[d]);const g=oe.useTaskPaneArea(),y=n.useCallback(p=>{const{commandButtonProps:u,commandPopupProps:m}=p,b=oe.DefaultTaskPaneRegistry.findContributions("ribbon/home");let S;const x=b.length;if(x>0){S=[];for(let M=0;M<x;M++){const P=b[M],I=P.createCommand?.(g);if(!I)continue;const D={command:I,...m},E=(P.createCommandButton??dl)(D);S.push(E)}}const h=e.jsx(ht,{...m,command:o.getCommand("formatFontColor"),isSplit:!0,panelProps:{disableAlpha:!0}}),k=e.jsx(ht,{...m,command:o.getCommand("formatFillColor"),isSplit:!0,panelProps:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:pt.End}}),j=o.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx(Vo,{...m,quickCommand:"undo"})}):null,v=o.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Na,{...m})}):null;let T=null;return c&&(T=e.jsxs(e.Fragment,{children:[e.jsx(C.ExhibitDivider,{}),e.jsx(yr,{...m})]})),e.jsxs(Nt,{parentFloat:t,children:[j,null,j?e.jsx(C.ExhibitDivider,{}):null,e.jsx(_o,{...m,command:o.getCommand("paste")}),e.jsx(C.CommandButton,{...u,command:o.getCommand("formatPainterToggle")}),e.jsx(so,{...u,command:o.getCommand("copy")}),e.jsx(C.ExhibitDivider,{}),e.jsx(Wa,{...m,command:o.getCommand("formatFontFamily")}),e.jsx(Oa,{...m,command:o.getCommand("formatFontSize")}),e.jsx(C.CommandButton,{...u,command:o.getCommand("formatBoldToggle")}),e.jsx(C.CommandButton,{...u,command:o.getCommand("formatItalicToggle")}),e.jsx(Va,{...m}),e.jsx($a,{...m}),e.jsx(Da,{...m}),k,h,e.jsx(C.ExhibitDivider,{}),e.jsx(ka,{...m}),e.jsx(va,{...m}),e.jsx(Ea,{...m}),e.jsx(ja,{...m}),e.jsx(Fa,{...m}),e.jsx(C.ExhibitDivider,{}),e.jsx(Aa,{...m}),e.jsx(C.ExhibitDivider,{}),e.jsx(qa,{command:o.getCommand("formatCellStyle"),...m}),e.jsx(cn,{command:o.getCommand("formatTableStyle"),...m}),e.jsx(C.ExhibitDivider,{}),e.jsx(zo,{...m}),e.jsx(Ho,{...m}),e.jsx(Wo,{...m}),e.jsx(C.ExhibitDivider,{}),e.jsx(un,{...m}),e.jsx(La,{...m}),e.jsx(Lo,{...m}),e.jsx($o,{...m}),v,T,S]})},[o,l,c,g]);return e.jsx(C.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:y,...s})}));Cr.displayName="HomeToolbar";const Sr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,c=w.useCallbackRef(f=>{const{commandButtonProps:l,commandPopupProps:d}=f;return e.jsxs(Nt,{parentFloat:t,children:[e.jsx(C.CommandButton,{...l,command:o.getCommand("insertTable")}),e.jsx(dn,{...d}),null,e.jsx(C.CommandButton,{...l,command:o.getCommand("updateHyperlink")}),e.jsx(C.CommandButton,{...l,command:o.getCommand("updateComments")})]})},[o]);return e.jsx(C.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:c,...s})}));Sr.displayName="InsertToolbar";const wr=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,c=w.useCallbackRef(f=>{const{commandButtonProps:l,commandPopupProps:d}=f;return e.jsxs(Nt,{parentFloat:t,children:[e.jsx(Ia,{...d}),e.jsx(C.CommandButton,{...l,command:o.getCommand("protectionSheetToggle")}),e.jsx(C.ExhibitDivider,{}),e.jsx(za,{...d}),e.jsx(_a,{...d}),e.jsx(C.ExhibitDivider,{}),e.jsx(C.CommandButton,{...l,command:o.getCommand("sheetViewToggleFormulaView"),scope:"view"}),e.jsx(C.CommandButton,{...l,command:o.getCommand("sheetViewToggleShowZeros"),scope:"view"}),e.jsx(C.ExhibitDivider,{}),e.jsx(Ka,{...d}),e.jsx(Mr,{command:o.getCommand("selectTheme"),...d}),e.jsx(C.ExhibitDivider,{}),e.jsx(yr,{...d,scope:"view"}),e.jsx(C.ExhibitDivider,{}),e.jsx(C.CommandButton,{...l,command:o.getCommand("fullScreenToggle"),scope:"view"})]})},[o]);return e.jsx(C.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:c,...s})}));wr.displayName="ViewToolbar";const kr=a=>e.jsx(vr,{...a}),ul=n.memo(a=>{const{sx:i,...o}=a;return e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",position:"relative","&:hover:not([disabled]) .indicator":{borderBottom:t=>`${X.alpha(t.palette.primary.main,.35)} solid 2px`}},children:[e.jsx(B.Tab,{disableRipple:!0,onMouseDown:t=>{t.button===0&&t.preventDefault()},sx:{textTransform:"none",flex:"1 1 100%",fontWeight:t=>t.typography.fontWeightRegular,padding:"2px 6px",minHeight:"0px",minWidth:"0px",marginRight:t=>t.spacing(.5),"&.Mui-selected":{},"&.Mui-focusVisible":{},...i},...o}),e.jsx(B.Box,{className:"indicator",sx:{width:"90%",borderRadius:"4px",minWidth:"4px",position:"absolute",bottom:"0",alignSelf:"center",display:"flex"}})]})}),ml=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,sx:r,...s}=a,c=n.useMemo(()=>{const f=[];for(let l=0;l<i.length;l++)f.push(e.jsx(ul,{label:i[l].label},i[l].label));return f},[i]);return e.jsx(B.Tabs,{value:o,onChange:(f,l)=>{t?.(l)},variant:"scrollable",scrollButtons:!1,sx:{paddingLeft:f=>f.spacing(1.5),paddingRight:f=>f.spacing(1.5),paddingTop:f=>f.spacing(0),paddingBottom:f=>f.spacing(0),minHeight:"26px",alignItems:"center","& .MuiTabs-indicator":{display:"flex",justifyContent:"center",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{width:"90%",borderRadius:"4px",minWidth:"4px",backgroundColor:f=>f.palette.primary.main},"& .MuiTab-root":{marginRight:"0px"},...r},slotProps:{indicator:{children:e.jsx("span",{className:"MuiTabs-indicatorSpan"})}},...s,children:c})}),pl=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,selectProps:r,...s}=a,c=n.useCallback(l=>{t?.(l.target.value)},[t]),f=n.useMemo(()=>{const l=[];for(let d=0;d<i.length;d++){const g=i[d].label;l.push(e.jsx(B.MenuItem,{value:d,sx:{color:y=>{if(o===d)return y.palette.primary.main}},children:g},g))}return l},[i,o]);return e.jsx(B.FormControl,{sx:{minWidth:"125px",maxWidth:"125px","& .MuiInputBase-root":{paddingLeft:"0px",paddingRight:"0px"},"& .MuiSelect-select":{paddingTop:l=>l.spacing(.5),paddingBottom:l=>l.spacing(.5),paddingLeft:l=>l.spacing(2),color:l=>l.palette.primary.main},"& .MuiSelect-icon":{fill:l=>l.palette.text.icon??l.palette.action.active,"&:hover:not(.Mui-disabled)":{color:l=>l.palette.text.icon??l.palette.action.active}},...r},size:"small",children:e.jsx(B.Select,{value:o,onChange:c,variant:"outlined",sx:{backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`},...s,children:f})})}),vr=n.memo(n.forwardRef((a,i)=>{const{commands:o,selectWrapper:t,selectProps:r={},renderCompact:s=!1,paletteWrapper:c,toolbarsProps:f,paletteProps:l={},workbook:d,sx:g,...y}=a,p=n.useMemo(()=>{const v=[],{ref:T,...M}=f?.Home||{};v.push({label:"Home",component:e.jsx(Cr,{commands:o,...M})});const{ref:P,...I}=f?.Insert||{};v.push({label:"Insert",component:e.jsx(Sr,{commands:o,...I})});const{ref:D,...E}=f?.View||{};return v.push({label:"View",component:e.jsx(wr,{commands:o,...E})}),v},[o,d]),u=n.useMemo(()=>{const v=[];for(let T=0;T<p.length;T++)v.push(n.cloneElement(p[T].component,{...p[T].component.props,key:p[T].key??p[T].label}));return v},[p]),[m,b]=n.useState(0),S=v=>{b(v)},x=n.useMemo(()=>s?e.jsx(pl,{toolbars:p,value:m,onToolbarChange:S,sx:r}):e.jsx(ml,{toolbars:p,value:m,onToolbarChange:S,sx:r}),[p,m,r,s]),{sx:h,...k}=l,j=e.jsx(B.Paper,{elevation:2,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,borderRadius:"8px",backgroundImage:`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`,marginLeft:v=>v.spacing(1),marginRight:v=>v.spacing(1),marginTop:v=>v.spacing(.5),marginBottom:v=>v.spacing(.5),...h},...k,children:u[m]});return e.jsxs(B.Box,{ref:i,className:"toolbarWrappers",sx:{display:"flex",flexDirection:"column",paddingTop:v=>v.spacing(.5),"*":{userSelect:"none"},...g},...y,children:[t?t(x):x,c?c(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 ut=="object"&&ut&&ut.Object===Object&&ut,c=typeof self=="object"&&self&&self.Object===Object&&self,f=s||c||Function("return this")(),l=Object.prototype.toString,d=Math.max,g=Math.min,y=function(){return f.Date.now()};function p(m){var b=typeof m;return!!m&&(b=="object"||b=="function")}function u(m){if(typeof m=="number")return m;if((function(x){return typeof x=="symbol"||(function(h){return!!h&&typeof h=="object"})(x)&&l.call(x)=="[object Symbol]"})(m))return NaN;if(p(m)){var b=typeof m.valueOf=="function"?m.valueOf():m;m=p(b)?b+"":b}if(typeof m!="string")return m===0?m:+m;m=m.replace(a,"");var S=o.test(m);return S||t.test(m)?r(m.slice(2),S?2:8):i.test(m)?NaN:+m}ea=function(m,b,S){var x,h,k,j,v,T,M=0,P=!1,I=!1,D=!0;if(typeof m!="function")throw new TypeError("Expected a function");function E(L){var F=x,$=h;return x=h=void 0,M=L,j=m.apply($,F)}function R(L){var F=L-T;return T===void 0||F>=b||F<0||I&&L-M>=k}function N(){var L=y();if(R(L))return z(L);v=setTimeout(N,(function(F){var $=b-(F-T);return I?g($,k-(F-M)):$})(L))}function z(L){return v=void 0,D&&x?E(L):(x=h=void 0,j)}function O(){var L=y(),F=R(L);if(x=arguments,h=this,T=L,F){if(v===void 0)return(function($){return M=$,v=setTimeout(N,b),P?E($):j})(T);if(I)return v=setTimeout(N,b),E(T)}return v===void 0&&(v=setTimeout(N,b)),j}return b=u(b)||0,p(S)&&(P=!!S.leading,k=(I="maxWait"in S)?d(u(S.maxWait)||0,b):k,D="trailing"in S?!!S.trailing:D),O.cancel=function(){v!==void 0&&clearTimeout(v),M=0,x=T=h=v=void 0},O.flush=function(){return v===void 0?j:z(y())},O}})();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,d){return l===d&&(l!==0||1/l==1/d)||l!=l&&d!=d},o=a.useState,t=a.useEffect,r=a.useLayoutEffect,s=a.useDebugValue;function c(l){var d=l.getSnapshot;l=l.value;try{var g=d();return!i(l,g)}catch{return!0}}var f=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,d){return d()}:function(l,d){var g=d(),y=o({inst:{value:g,getSnapshot:d}}),p=y[0].inst,u=y[1];return r(function(){p.value=g,p.getSnapshot=d,c(p)&&u({inst:p})},[l,g,d]),t(function(){return c(p)&&u({inst:p}),l(function(){c(p)&&u({inst:p})})},[l]),s(g),g};return vo.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:f,vo})()),aa.exports;var ra,ia,Tt={exports:{}},ct={exports:{}},fl=ct.exports;(function(){if(ia)return Tt.exports;ia=1;for(var a=(ra||(ra=1,function(){var y,p,u,m,b,S;typeof performance<"u"&&performance!==null&&performance.now?ct.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(ct.exports=function(){return(y()-b)/1e6},p=process.hrtime,m=(y=function(){var x;return 1e9*(x=p())[0]+x[1]})(),S=1e9*process.uptime(),b=m-S):Date.now?(ct.exports=function(){return Date.now()-u},u=Date.now()):(ct.exports=function(){return new Date().getTime()-u},u=new Date().getTime())}.call(fl)),ct.exports),i=typeof window>"u"?ut:window,o=["moz","webkit"],t="AnimationFrame",r=i["request"+t],s=i["cancel"+t]||i["cancelRequest"+t],c=0;!r&&c<o.length;c++)r=i[o[c]+"Request"+t],s=i[o[c]+"Cancel"+t]||i[o[c]+"CancelRequest"+t];if(!r||!s){var f=0,l=0,d=[],g=1e3/60;r=function(y){if(d.length===0){var p=a(),u=Math.max(0,g-(p-f));f=u+p,setTimeout(function(){var m=d.slice(0);d.length=0;for(var b=0;b<m.length;b++)if(!m[b].cancelled)try{m[b].callback(f)}catch(S){setTimeout(function(){throw S},0)}},Math.round(u))}return d.push({handle:++l,callback:y,cancelled:!1}),l},s=function(y){for(var p=0;p<d.length;p++)d[p].handle===y&&(d[p].cancelled=!0)}}Tt.exports=function(y){return r.call(i,y)},Tt.exports.cancel=function(){s.apply(i,arguments)},Tt.exports.polyfill=function(y){y||(y=i),y.requestAnimationFrame=r,y.cancelAnimationFrame=s},Tt.exports})();var Ne={DOM_UNAVAILABLE_ERROR:"DOM is unavailable server-side. Please use this method client-side only.",FULLSCREEN_UNSUPPORTED_ERROR:"Your browser does not support Fullscreen API.",getEventsNames(){if(typeof document>"u")return null;const a=document;return"exitFullscreen"in a?["fullscreenchange","fullscreenerror"]:"webkitExitFullscreen"in a||"webkitCancelFullScreen"in a?["webkitfullscreenchange","webkitfullscreenerror"]:"mozCancelFullScreen"in a?["mozfullscreenchange","mozfullscreenerror"]:"msExitFullscreen"in a?["MSFullscreenChange","MSFullscreenError"]:null},getEventName(a){const i=this.getEventsNames();return i?a==="change"?i[0]:i[1]:null},get fullscreenEnabled(){if(typeof document>"u")return!1;const a=document;return a.fullscreenEnabled||a.webkitFullscreenEnabled||!!a.webkitCancelFullScreen||a.mozFullScreenEnabled||a.msFullscreenEnabled||!1},get fullscreenElement(){if(typeof document>"u")return null;const a=document;return a.fullscreenElement||a.webkitFullscreenElement||a.webkitCurrentFullScreenElement||a.mozFullScreenElement||a.msFullscreenElement||null},requestFullscreen(a,i){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const o=a??document.documentElement,t=o.requestFullscreen||o.webkitRequestFullscreen||o.webkitRequestFullScreen||o.mozRequestFullScreen||o.msRequestFullscreen;if(!t)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return t.call(o,i)},exitFullscreen(){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const a=document,i=a.exitFullscreen||a.webkitExitFullscreen||a.webkitCancelFullScreen||a.mozCancelFullScreen||a.msExitFullscreen;if(!i)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return i.call(a)},on(a,i){const o=this.getEventName(a);o&&document.addEventListener(o,i)},off(a,i){const o=this.getEventName(a);o&&document.removeEventListener(o,i)}};const jr=a=>{const{workbook:i,workbookElement:o,target:t,commands:r,darkMode:s,onNewWorkbook:c=Er}=a,f=w.useNotifier(),[l,d]=n.useState(i?.getSelectedSheet()),[g,y]=n.useState(i?.getSheets().getItems()),p=w.useCallbackRef(c,[c]),u=oe.useTaskPaneArea(),m=n.useMemo(()=>[new w.SimpleCommand("activateTask",t,{label:"Activate Task",description:"Activate Task Pane.",shortcut:{key:"F6"}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("showFormat",t,{label:"Show Format",description:"Open the format pane.",shortcut:{key:"F",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.Command("newCellStyle",t,{label:"New Cell Style…",scopedLabels:{cellStyle:"New Cell Style"},description:"Create a new named style can can be quickly used later.",icon:"NewPresetStyles"}),new w.Command("deleteCellStyle",t,{label:"Delete Cell Style",scopedLabels:{cellStyle:"Delete"},description:"Remove a named style that is no longer needed."}),new w.Command("modifyCellStyle",t,{label:"Modify Cell Style",scopedLabels:{cellStyle:"Modify"},description:"Update a style with the currently style."}),new w.SimpleCommand("find",t,{label:"Find",description:"Open the Find window.",icon:"Find",shortcut:[{key:"F",modifiers:[w.KeyModifiers.Ctrl]},{key:"F5",modifiers:[w.KeyModifiers.Shift]}]}),new w.SimpleCommand("findReplace",t,{label:"Find & Replace",description:"Open the Find & Replace window.",icon:"FindReplace",shortcut:[{key:"H",modifiers:[w.KeyModifiers.Ctrl]},{key:"H",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Alt]}]}),new w.SimpleCommand("goto",t,{label:"Go To",description:"Open the 'Go To' window.",icon:"GoTo",shortcut:[{key:"G",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.SimpleCommand("workbookViewToggleExpandFormulaBar",t,{label:"Toggle Expand Formula bar",description:"Expand or collapse the formula bar.",shortcut:{key:"U",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookViewToggleShowFormulaBar",t,{label:"View Formula bar",scopedLabels:{view:"Formula Bar"},description:"Show or hide the formula bar."}),new w.SimpleCommand("workbookViewToggleShowTabs",t,{label:"View Sheet Tabs",description:"Show or hide the sheet tabs.",scopedLabels:{view:"Sheet Tabs"}}),new w.SimpleCommand("workbookViewToggleShowStatusBar",t,{label:"View Status Bar",description:"Show or hide the status bar.",scopedLabels:{view:"Status Bar"}}),new w.SimpleCommand("workbookViewToggleShowHorizontalScrollBar",t,{label:"View Horizontal Scrollbar",description:"Show or hide the horizontal scrollbar.",scopedLabels:{view:"Horizontal Scrollbar"}}),new w.SimpleCommand("workbookViewToggleShowVerticalScrollBar",t,{label:"View Vertical Scrollbar",description:"Show or hide the vertical scrollbar.",scopedLabels:{view:"Vertical Scrollbar"}}),new w.Command("hideSheet",t,{label:"Hide Sheet",scopedLabels:{sheet:"Hide"},description:"Hide the sheet from appearing in the tabs. This keeps the data but de-clutters the tabs.",icon:"VisibilityOff"}),new w.Command("deleteSheet",t,{label:"Delete Sheet",scopedLabels:{sheet:"Delete"},description:"Delete the sheet and all the data."}),new w.Command("addSheet",t,{label:"Insert Sheet",scopedLabels:{sheet:"Insert"},description:"Insert sheet before the current sheet.",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Shift]},{key:"F1",modifiers:[w.KeyModifiers.Alt,w.KeyModifiers.Shift]}]}),new w.Command("duplicateSheet",t,{label:"Duplicate Sheet",description:"Duplicate the current sheet.",scopedLabels:{sheet:"Duplicate"}}),new w.Command("nextSheet",t,{label:"Next Sheet",scopedLabels:{sheet:"Next"},description:"Activate the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("previousSheet",t,{label:"Previous Sheet",scopedLabels:{sheet:"Previous"},description:"Activate the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("selectNextSheet",t,{label:"Select Next Sheet",scopedLabels:{sheet:"Select Next"},description:"Select the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectPreviousSheet",t,{label:"Select Previous Sheet",scopedLabels:{sheet:"Select Previous"},description:"Select the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectTheme",t,{label:"Theme",description:"Select a theme that coveys a style suitable for your data."}),new w.Command("selectNamed",t,{label:E=>E?.getName()??"Select Named Item",scopedLabels:{namedItem:E=>E?.getName()??"Select"},description:"Select the item."}),new w.Command("addNamedReference",t,{label:"Define Named Reference",scopedLabels:{namedItem:"Define Name…"},description:"Add a new named reference. Names can be used as a substitute for cell references.",icon:"InsertNamedRange"}),new w.Command("editNamedReference",t,{label:"Edit Named Reference…",scopedLabels:{namedItem:"Edit…"},description:"Add a new named reference. Names can be used as a substitute for cell references.",icon:"NamedRangeEdit"}),new w.Command("deleteNamedReference",t,{label:"Delete Named Reference",scopedLabels:{namedItem:"Delete"},description:"Remove the named reference.",icon:"DeleteNamedRange"}),new w.SimpleCommand("activeNameBox",t,{label:"Activate Name Box",description:"Move the focus to the name box.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Alt]}}),new w.SimpleCommand("createNamedReferenceFromSelection",t,{label:"Create from Selection",description:"Automatically generate names from the selected cells.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("activeNameManager",t,{label:"Activate Name Manager",description:`Create, edit, delete, and find all the names used in the workbook.
|
|
13
|
-
|
|
14
|
-
Names can be used as a substitute for cell references.`,shortcut:{key:"F3",modifiers:[w.KeyModifiers.Ctrl]}}),new w.Command("fullScreenToggle",t,{label:"FullScreen",description:"Toggle showing the workbook using the full screen.",shortcut:{key:"F11"},icon:"FullScreen"}),new w.Command("showScriptEditor",t,{label:"Scripts",scopedLabels:{scripts:"Script Editor…"},description:"Show the script editor.",icon:"ScriptRun",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Alt]}]}),new w.Command("executeScript",t,{label:"Run Script",description:"Run the selected or last executed script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("executeSelectedScript",t,{label:"Run Script",description:"Run the selected script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("saveScripts",t,{label:"Save Script",description:"Save the current scripts.",icon:"ScriptSave"}),new w.Command("maximumWorkbookToggle",t,{label:"Maximize",description:"Toggle showing the workbook maximized.",shortcut:{key:"F10",modifiers:[w.KeyModifiers.Ctrl]}}),new w.Command("spellCheck",t,{label:"Spell Check",description:"Check the workbook for spelling mistakes.",shortcut:{key:"F7"}}),new w.Command("calculateAll",t,{label:"Calculate Now",description:"Recalculate all formulas.",icon:"Calculate",shortcut:{key:"F9"}}),new w.SimpleCommand("closeWorkbook",t,{label:"Close Workbook",description:"Close the workbook.",shortcut:{key:"W",modifiers:[w.KeyModifiers.Ctrl]}}),new w.SimpleCommand("newWorkbook",t,{label:"New Workbook",description:"Create a new workbook in another tab.",icon:"FileNew"})],[]),b=n.useMemo(()=>{let E=null;return E=r?r.createChildGroup(t,"workbook",!1):new w.CommandGroup(t,"workbook"),E.addCommands(m,!0),E},[r,m]),S=w.useEditMode(),x=n.useRef(null),h=w.useCallbackRef(()=>{let E,R=null;const N=b.getCommand("executeScript");if(N.update({disabled:!1,context:{getScripts:()=>i.getScripts()}}),!N)return;const z=b.getCommand("showScriptEditor");z.updateCallback(function(F=!0){R?R.close():u.activateTaskPane("scriptEditor",{})});const O=b.getCommand("executeSelectedScript");if(!O)return;const L={saveSource:async F=>{let $=null,Q=null;const Y=i.getScripts();try{F&&(Q=await f.showBusy("Saving Scripts..."),$=await Y.createModule({source:F})),Y.addModule("scripts",$,{replace:!0}),Q?.()}catch(te){Q?.(),console.warn("Unable to compile",te),f.showError(te)}return $},addContainerListener:F=>(k.current=F,()=>{k.current=null}),setSelectedFunction:F=>{E=F??x.current??null,Promise.resolve(E).then($=>{O.update({disabled:$===null})})},quickInsertFunction:F=>{const $=`=${F.toUpperCase()}(`,Q={text:$+")",editMode:!0,initialSelection:{start:$.length,end:$.length+0}};S.setMode(Y=>Y?.key==="edit"?{...Y,args:{...Y.args}}:{key:"edit",args:{stateAndCoords:null,start:Q}})},getSelectedFunction:()=>E,setEditor:F=>{R=F??null,z.update({state:R!==null})},getEditor:()=>R,getRanges:F=>{try{return i.getRanges(F)}catch{}return null},getScripts:()=>i.getScripts()};O.update({context:L})},[b,i,o,f]),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=>{y(E.getSheets().getItems())},onViewChange(E){d(E?.getSelectedSheet())},onProtectionChange:E=>{const R={disabled:!E.getProtection().isStructureAllowed()};b.getCommand("hideSheet").update(R),b.getCommand("deleteSheet").update(R),b.getCommand("addSheet").update(R),b.getCommand("duplicateSheet").update(R),b.getCommand("selectTheme").update(R),b.getCommand("addNamedReference").update(R),b.getCommand("editNamedReference").update(R),b.getCommand("deleteNamedReference").update(R)},onScriptsChange:E=>{h()}});const{isFullscreenAvailable:j,isFullscreenEnabled:v,toggleFullscreen:T}=(function(E={}){const{target:R,onChange:N,onError:z,requestFullScreenOptions:O}=E,[L,F]=n.useState(!1),[$,Q]=n.useState(null),[Y,te]=n.useState(!1),K=n.useCallback(()=>Ne.requestFullscreen(R?.current||null,O),[R,O]),q=n.useCallback(()=>Ne.exitFullscreen(),[]),ne=n.useCallback(()=>Ne.fullscreenElement?q():K(),[K,q]),W=n.useCallback(H=>{const G=Ne.fullscreenElement;Q(G),te(!!G),N?.(H)},[N]),U=n.useCallback(H=>{const G=Ne.fullscreenElement;Q(G),te(!!G),z?.(H)},[z]);return n.useEffect(()=>{F(Ne.fullscreenEnabled)},[]),n.useEffect(()=>(Ne.on("change",W),Ne.on("error",U),()=>{Ne.off("change",W),Ne.off("error",U)}),[W,U]),{isFullscreenAvailable:L,fullscreenElement:$,isFullscreenEnabled:Y,enableFullscreen:K,disableFullscreen:q,toggleFullscreen:ne}})({target:{current:o??document.body}}),M=oe.useDocThemes();n.useEffect(()=>{b.getCommand("selectTheme").update({state:()=>i.getTheme(),context:()=>({theme:i.getTheme(),themes:M,darkMode:s})})},[i?.getTheme(),s]);const P=w.useCallbackRef(async function(E,R){let N=null;const z=i.getScripts();if(E?.declaration||E?.functionName){const O=E.declaration?E.declaration.getName():E.functionName;(await z.searchFunctions({name:O})).length>0&&(N=O)}if(N)try{await z.executeMacro(N),x.current=Promise.resolve({source:null,name:N})}catch(O){return void f.showError(O)}},[i,f]);n.useEffect(()=>{b.getCommand("newCellStyle").updateCallback(E=>{f.showInput({initialValue:(()=>{let R=0;for(;;){R++;const N=`Style ${R}`;try{return i.getStyles().validateStyleName(N,!0),N}catch{}}})(),title:b.getCommand("newCellStyle")?.label("cellStyle"),description:"Enter a name for the new cell style.",inputLabel:"Style Name",inputProps:{style:{minWidth:"300px"}},options:["Ok","Cancel"],defaultOption:"Ok",onValidateInput:async(R,N)=>{let z=null;try{i.getStyles().validateStyleName(R,!1)}catch(F){z=F.message}let O=i.getStyles().getNamed(R),L=z;return!L&&O&&(L=`Update style '${O.getName()}'.`),{valid:z===null,message:L}}}).then(({input:R,option:N})=>{const z=i.getSelectedSheet().getSelectedRange();if(N!=="Ok")return;const O=i.getStyles().setNamed({name:R,style:z.getCell().getStyle()});z.getStyle().update({named:O.getName()})})}),b.getCommand("deleteCellStyle").updateCallback(E=>{E.delete()}),b.getCommand("modifyCellStyle").updateCallback(({named:E})=>{const R=i.getSelectedSheet().getSelectedRange();i.getStyles().setNamed({name:E.getName(),style:R.getCell().getStyle()})}),b.getCommand("hideSheet").updateCallback(E=>{i.getSheetAt(E).setVisibility(A.ISheet.Visibility.Hidden)}),b.getCommand("deleteSheet").updateCallback(async E=>{i.getSheetAt(E??i.getSelectedSheetIndex())?.delete()}),b.getCommand("addSheet").updateCallback(E=>{i.getSheets().add({index:E,autoSelect:!0})}),b.getCommand("duplicateSheet").updateCallback(async E=>{(await i.getSheetAt(E??i.getSelectedSheetIndex())?.duplicate())?.select()}),b.getCommand("nextSheet").updateCallback(E=>{i.getNextSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("previousSheet").updateCallback(E=>{i.getPreviousSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectNextSheet").updateCallback(E=>{i.getNextSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectPreviousSheet").updateCallback(E=>{i.getPreviousSheet(E??i.getSelectedSheetIndex()).select()}),b.getCommand("selectTheme").updateCallback(E=>{i.setTheme(E)}),b.getCommand("calculateAll").updateCallback(()=>{i.getSelectedSheet().getEntireRange().calculate(!0)}),b.getCommand("closeWorkbook").updateCallback(async()=>{await f.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(()=>{p?.()}),b.getCommand("executeScript").updateCallback(P),b.getCommand("executeSelectedScript").updateCallback(P)},[i,f]);const I=w.useCallbackRef(async E=>{let R=0,N=null,z="Find & Replace";E?.replace&&!E?.replaceOptions?.maxCount&&(z="Replace All");const O=await f.showBusy(z);try{const L=E?.scope??"sheet";let F=null;const $=i.getSelectedSheet(),Q={from:$.getSelectedCell(),...E.findOptions};if(F=L==="sheet"?i.getSelectedSheet().find(Q):i.find(Q),E.replace){const Y=i.replace(F,E.replaceText,E.replaceOptions);R=Y.count,E.replaceOptions.maxCount&&(N=Y.last)}else{let Y=F.next();Y.done||(R++,N=Y.value)}N?.select({autoFocus:!1}),O?.(),!E.replaceOptions.maxCount&&R>1&&f.showMessage(`We replaced ${R} cells.`)}catch(L){O?.(),f.showError(L)}return R},[i,o]),D=w.useCallbackRef(E=>{const R={selection:()=>{const z=i.getSelectedRanges(),O=z.getCount(),L=new Array(O);for(let F=0;F<O;F++){const $=z.at(F).getFixed(!0).getCoords();L[F]=$}return i.getRanges(L)},getNames:()=>i.getNames()},N={initialValue:E,context:()=>R,onInput:async z=>{try{await z.select()}catch(O){f.showMessage(O.message,{type:w.NotifierType.Error})}}};return f.showWindow("namedDetails",N)},[f,i,o]);return n.useEffect(()=>{const E=(R=!1)=>{const N={initialValue:{findOptions:{text:i.getSelectedCell().toTextUnformatted(!0)},replace:R},context:()=>I,onKeyDown:z=>{b.findCommandByEvent(z)!==b.getCommand("find")&&b.findCommandByEvent(z)!==b.getCommand("findReplace")||z.preventDefault()},autoFocus:!0,disableAutoDestroy:!0};f.showWindow("find",N)};b.getCommand("find")?.update({disabled:!f.showWindow}).updateCallback(()=>{E()}),b.getCommand("findReplace")?.update({disabled:!f.showWindow}).updateCallback(()=>{E(!0)}),b.getCommand("activateTask")?.update({disabled:!f}).updateCallback(()=>{const R={onInput:async N=>{try{u.activateTaskPane(N)}catch(z){f.showError(z.message)}},title:b.getCommand("activateTask")?.label(),inputLabel:"Task Name",options:["Activate"]};f.showInput(R)}),b.getCommand("goto")?.update({disabled:!f}).updateCallback(()=>{const R={onInput:async N=>{try{await i.getRanges(N).select()}catch(z){f.showMessage(z.message,{type:w.NotifierType.Error})}},title:b.getCommand("goto")?.label(),inputLabel:"Location",options:["Go To"]};f.showInput(R)}),b.getCommand("selectNamed")?.update({disabled:!f}).updateCallback(async R=>{if(R)try{await R.select()}catch(N){f.showError(N)}}),b.getCommand("addNamedReference")?.updateCallback(async function(R){D(null)}),b.getCommand("editNamedReference")?.updateCallback(async function(R){D(R)}),b.getCommand("deleteNamedReference")?.updateCallback(async function(R){R?.delete?.()}),b.getCommand("activeNameBox")?.updateCallback(async function(){o?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus()})},[o,i,f]),oe.useModelListener(i?.getView(),{onViewChange:E=>{b.getCommand("workbookViewToggleShowFormulaBar").update({state:E.isShowFormulaBar()}).updateCallback(()=>{E.setShowFormulaBar(!E.isShowFormulaBar())}),b.getCommand("workbookViewToggleShowTabs").update({state:E.isShowTabs()}).updateCallback(()=>{E.setShowTabs(!E.isShowTabs())}),b.getCommand("workbookViewToggleShowStatusBar").update({state:E.isShowStatusBar()}).updateCallback(()=>{E.setShowStatusBar(!E.isShowStatusBar())}),b.getCommand("workbookViewToggleShowHorizontalScrollBar").update({state:E.isShowHorizontalScrollbar()}).updateCallback(()=>{E.setShowHorizontalScrollbar(!E.isShowHorizontalScrollbar())}),b.getCommand("workbookViewToggleShowVerticalScrollBar").update({state:E.isShowVerticalScrollbar()}).updateCallback(()=>{E.setShowVerticalScrollbar(!E.isShowVerticalScrollbar())})}}),n.useEffect(()=>{b.getCommand("fullScreenToggle").update({state:v,disabled:!j,icon:v?"FullScreenOff":"FullScreen"}).updateCallback(()=>{T()})},[v,j]),n.useEffect(()=>{const E=i.getProtection().isStructureAllowed();b.getCommand("hideSheet").update({disabled:g.length<=1||!E}),b.getCommand("deleteSheet").update({disabled:g.length<=1||!E})},[g,l]),b},Er=()=>{window.open(window.origin.toString(),"sheetxl-"+A.CommonUtils.uuidV4(),"popup=true")},hl="_sheetxl-theme_4opcr_2",gl="_sheetxl-workbook_g5t6x_5",xl=a=>e.jsx(tn,{...a}),bl=a=>e.jsx(on,{...a}),yl=a=>e.jsx(en,{...a}),an=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,onBeforeUserChange:r,onUserChange:s,disabled:c=!1,readOnly:f=!1,contextMenuProps:l,renderContextMenu:d=xl,sheetsAllProps:g,renderSheetsAll:y=bl,sheetTabProps:p,renderSheetTab:u,background:m="transparent",className:b,sx:S,borderWidth:x,borderColor:h,gridTheme:k,gridStyle:j,...v}=a,[T,M]=n.useState(o?.getSelectedSheetIndex()),[P,I]=n.useState(o?.getSheets().getItems()),[D,E]=n.useState(o?.getProtection());oe.useModelListener(o,{onViewChange(Z){M(Z?.getSelectedSheetIndex())},onSheetsChange:Z=>{I(Z.getSheets().getItems())},onProtectionChange:Z=>{E(Z?.getProtection())}});const R=f||!D.isStructureAllowed(),N=n.useMemo(()=>{const Z=[];for(let _=0;_<P.length;_++)Z.push(P[_].getName());return Z},[P]),z=n.useCallback(Z=>{r?.(Z)!==!1&&(o.getSheetAt(Z).select(),s?.(Z))},[o,r,s]),O=n.useCallback((Z,_)=>{o.getSheetAt(Z).setName(_),s?.(Z)},[o,s]),L=n.useCallback((Z,_)=>{o.getSheetAt(Z).setPosition(_),s?.(_)},[o,s]),F=w.useCallbackRef(()=>{if(r?.(T)===!1)return;const Z=T+1;o.getSheets().add({name:void 0,autoSelect:!0}),s?.(Z)},[o,r,s,T]),$=n.useMemo(()=>({placement:"top-start"}),[]),Q=n.useRef(null),[Y,te]=n.useState(!1),K=n.useCallback(Z=>{const{closeFloatAll:_,floatReference:ee}=Z;return y({workbook:o,gridStyle:j,floatReference:ee,closeFloatAll:_,...g})},[y,g,c,o,j]),{reference:q,component:ne}=C.useFloatStack({label:"allSheet",popperProps:$,anchor:Q.current,onOpen:()=>te(!0),onClose:()=>te(!1),createPopupPanel:K}),W=n.useRef(null),[U,H]=n.useState(null),G=n.useCallback(Z=>{const{floatReference:_}=Z;return d?.({workbook:o,index:U?.index,tabStripRef:W.current,commands:t,disabled:c,floatReference:_,...l})},[d,l,c,o,t,U]),{reference:ie,component:re}=C.useFloatStack({label:"sheetTab",popperProps:$,anchor:{getBoundingClientRect:()=>new DOMRect(U?.left||0,U?.top||0,0,0)},onClose:()=>H(null),createPopupPanel:G});n.useEffect(()=>{U?ie.open(0):ie.close(0)},[U]);const le=n.useCallback((Z,_)=>{Z.preventDefault(),H({left:Z.clientX-2,top:Z.clientY-4,index:_})},[]),Se=w.useCallbackRef(Z=>{let _;try{_=o?.getSheetAt(Z.index)}catch{}return _?(u??yl)({sheet:_,gridTheme:k,onContextMenu:ee=>{z(Z.index),le(ee,Z.index)},...Z,...p}):null},[u,p,o,k]),ge=n.useMemo(()=>R?null:e.jsx(C.SimpleTooltip,{disableInteractive:!0,title:"New sheet",children:e.jsx(B.IconButton,{disabled:c,component:"div",sx:{padding:"0","&:hover:not([disabled])":{color:Z=>Z.palette.primary.main},color:Z=>Z.palette.text.icon??Z.palette.action.active,"& svg":{width:"18px",height:"18px"}},"aria-label":"addTab",size:"small",onMouseDown:Z=>{Z.button===0&&Z.preventDefault()},onClick:()=>F(),children:e.jsx(w.DynamicIcon,{iconKey:"AddCircle"})})}),[c,R,F]);return e.jsxs(B.Box,{ref:i,className:se(b),sx:{position:"relative",display:"flex",alignItems:"stretch",flex:"1 1 100%",maxWidth:"100%",...S},...v,children:[e.jsx(oe.TabStrip,{ref:W,selectedTabIndex:T,tabNames:N,onSelectedTabIndexChange:z,onTabNameChange:O,onTabMove:L,background:m,borderColor:h,borderWidth:x,activeColor:null,disabled:c,disableDrag:R,createScrollStartButton:C.createScrollStartButton,createScrollEndButton:C.createScrollEndButton,createScrollEdgeButton:C.createScrollEdgeButton,createTabButton:Se,createTabDivider:Z=>{const{key:_,...ee}=Z;return e.jsx(C.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:me=>X.alpha(me.palette.divider,.25)},...ee},_)},editLabelProps:{readOnly:R,maxLength:31,styleHover:{fontWeight:"700"},onKeyPress:Z=>{o.isValidSheetNameCharacter(Z.key)||Z.preventDefault()},onCancel:()=>{s?.(T)}},children:e.jsx(C.SimpleTooltip,{disableInteractive:!0,title:Y?"":"List all sheets",children:e.jsx(C.ExhibitIconButton,{sx:{padding:"0px",ml:.5,mr:0,mt:0,mb:0,"& svg":{transform:"scale(0.8, 1)"},color:Z=>Z.palette.text.icon??Z.palette.action.active},ref:Q,dense:!0,outlined:!1,selected:Y,color:"primary","aria-label":"menu",onMouseDown:Z=>{Z.button===0&&Z.preventDefault()},onClick:()=>{Y?q.close(0):q.open(0)},icon:e.jsx(w.DynamicIcon,{iconKey:"Menu"})})})}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,minWidth:"4px"}}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,flex:"none",display:"flex",alignItems:"center"},children:ge}),e.jsx("div",{style:{borderTop:`solid ${h} ${x}px`,flex:1,minWidth:"24px"}}),re,ne]})}));an.displayName="WorkbookStrip";const rn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,disabled:r,sx:s,floatReference:c,className:f,...l}=a,[d,g]=n.useReducer(R=>R+1,0),[y,p]=n.useState(o.getSelectedSheet()),[u,m]=n.useState(y.getSelectedRanges()),[b,S]=n.useState(y.getSelectedCell());oe.useModelListener(o,{onSheetsChange(){p(o.getSelectedSheet())}}),oe.useModelListener(y.getSelection(),{onChange(){m(y.getSelectedRanges()),S(y.getSelectedCell())}}),w.useCommands(t,[],{onChange:()=>{g()}});const x=n.useMemo(()=>({}),[]),h=n.useMemo(()=>({commandHook:{beforeExecute:(R,N)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,scope:"contextMenu",parentFloat:c}),[r,c]),k=n.useMemo(()=>({...x,...h,variant:w.CommandButtonType.Menuitem}),[x,h]),j=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:c,...h}),[t,h,c]),v=[];let T=u.isEntireRows(),M=u.isEntireColumns();u&&(T&&(v.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(C.CommandButton,{command:t.getCommand("hideColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(C.CommandButton,{command:t.getCommand("unhideColumns"),...k,key:"context:"+v.length}))),M&&(v.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(C.CommandButton,{command:t.getCommand("hideRows"),...k,key:"context:"+v.length})),v.push(n.createElement(C.CommandButton,{command:t.getCommand("unhideRows"),...k,key:"context:"+v.length}))),(T||M)&&v.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),T&&(v.push(n.createElement(C.CommandButton,{command:t.getCommand("autoFitColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(C.CommandButton,{...k,command:t.getCommand("resizeColumns"),key:"context:"+v.length}))),M&&(v.push(n.createElement(C.CommandButton,{command:t.getCommand("autoFitRows"),...k,key:"context:"+v.length})),v.push(n.createElement(C.CommandButton,{...k,command:t.getCommand("resizeRows"),key:"context:"+v.length}))));const P=[],I=t.getCommand("formatTableStyle"),D=I?.context()?.table();if(w.useCommand(I),!T&&!M){if(P.push(e.jsx(C.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+P.length)),b?.getHyperlink())P.push(n.createElement(C.SimpleCommandPopupButton,{...j,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+P.length,quickCommand:"openHyperlink"}));else{const R=t.getCommand("updateHyperlink");P.push(n.createElement(C.CommandButton,{command:R,...k,key:"contextBefore:"+P.length}))}if(b?.getComments())P.push(n.createElement(C.SimpleCommandPopupButton,{...j,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+P.length,quickCommand:"updateComments"}));else{const R=t.getCommand("updateComments");P.push(n.createElement(C.CommandButton,{command:R,...k,key:"contextBefore:"+P.length}))}D?P.push(n.createElement(C.SimpleCommandPopupButton,{...j,variant:w.CommandButtonType.Menuitem,key:"contextBefore:"+P.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:D,quickCommand:"editTable"})):P.push(n.createElement(C.CommandButton,{command:t.getCommand("insertTable"),...k,key:"context:"+v.length})),P.push(n.createElement(dn,{...j,key:"contextBefore:"+P.length}))}const E=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{command:t.getCommand("cut"),...k}),e.jsx(so,{command:t.getCommand("copy"),...k}),e.jsx(_o,{command:t.getCommand("paste"),...j,includePasteAllInPopup:!1}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx($o,{...j}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(zo,{commands:t,...j,disableSheet:!0}),e.jsx(Ho,{commands:t,...j,disableSheet:!0}),e.jsx(Lo,{...j}),P,v]});return e.jsx(B.Box,{ref:i,className:se("menu",f),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,c]=n.useState(!1),[f,l]=n.useState("info");return n.useEffect(()=>{const d=r.getMode();c(d?.key==="copy"||d?.key==="cut"),l(d?.key==="cut"?"warn":"accent")},[r]),e.jsx(C.CommandButton,{ref:i,command:o,icon:e.jsx(w.DynamicIcon,{iconKey:"copy.walking",sourceProps:{isWalking:s,themedType:f}}),...t})})),Tr=n.memo(n.forwardRef((a,i)=>{const{movable:o,commands:t,disabled:r,sx:s,floatReference:c,...f}=a;oe.useModelListener(o,{onAnyChange(u){}});const l=n.useMemo(()=>({}),[]),d=n.useMemo(()=>({commandHook:{beforeExecute:(u,m)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:c}),[r,c]),g=n.useMemo(()=>({variant:w.CommandButtonType.Menuitem,...l,...d}),[l,d]),y=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:c,...d}),[t,d,c]),p=e.jsxs(e.Fragment,{children:[e.jsx(so,{command:t.getCommand("copy"),...g,variant:w.CommandButtonType.Menuitem}),[],e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.SimpleCommandPopupButton,{...y,popupCommandKeys:["moveToFront","moveForward"],quickCommand:"moveToFront"}),e.jsx(C.SimpleCommandPopupButton,{...y,popupCommandKeys:["moveToBack","moveBackward"],quickCommand:"moveToBack"}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...g,command:t.getCommand("toggleLockAspectRatio")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.SimpleCommandPopupButton,{...y,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(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.SimpleCommandPopupButton,{...y,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},...f,children:p})}));Tr.displayName="MovableContextMenu";const Cl=a=>e.jsx(Tr,{...a}),Sl=a=>e.jsx(rn,{...a}),wl=a=>e.jsx(Jo,{...a}),kl=(a,i)=>e.jsx(Qo,{ref:i,...a}),vl=a=>e.jsx(C.LoadingPanel,{...a}),jl=(a,i)=>e.jsx(oe.SheetElement,{ref:i,...a}),El=a=>e.jsx(Xo,{...a}),Tl=a=>e.jsx(an,{...a}),Bl={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:c=!1,sx:f,style:l,className:d,onFocus:g,onBlur:y,onKeyDown:p,onRepeatCommandChange:u,commands:m,showFormulaBar:b,formulaBarProps:S,renderFormulaBar:x=kl,showTabs:h,tabsProps:k,renderTabs:j=Tl,showStatusBar:v,statusBarProps:T,renderStatusBar:M=El,toolbarProps:P,renderToolbar:I=kr,contextMenuSx:D,renderContextMenu:E=Sl,renderFilterMenu:R=wl,renderMovableMenu:N=Cl,renderLoadingPanel:z=vl,loadingPanelProps:O,sheetProps:L,renderSheet:F=jl,mainWrapper:$,showHorizontalScrollbar:Q,showVerticalScrollbar:Y,gridTheme:te,headersTheme:K,enableDarkImages:q,...ne}=a,W=X.useTheme(),U=oe.useDocThemes(),H=n.useMemo(()=>{const V={theme:U.getDefaultTheme(),...t};return o??new A.Workbook(V)},[o]),G=n.useRef(null),[ie,re]=n.useState(!1),le=n.useRef(null),Se=n.useMemo(()=>e.jsx(B.Box,{className:"sheetxl-viewport",sx:{width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",pointerEvents:"none !important","& > :first-of-type":{position:"relative"}},ref:le}),[]),[ge,Z]=n.useState(!1),[_,ee]=n.useState(!1),me=n.useCallback(()=>{Z(!0)},[]),ve=n.useRef(null),de=w.useImperativeElement(i,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>H,getSheetElement:()=>G.current,getViewportElement:()=>le.current,getFormulaBarElement:()=>ve.current,focus(){G&&G.current&&G.current.focus()}}),[H]),Fe=n.useRef(null);n.useLayoutEffect(()=>{!ge||!de.current||(async()=>(Fe.current!==s&&(await s?.({source:de.current}),Fe.current=s),ee(!0)))()},[ge,de.current]),Zn(de.current);const Ee=n.useCallback(V=>(G.current?.submitEdit(),!0),[]),Oe=n.useCallback(()=>{requestAnimationFrame(()=>{G?.current?.focus()})},[]),[pe,J]=n.useState(H?.getSelectedSheet()),[ce,Ue]=n.useState(H?.getProtection());oe.useModelListener(H,{onSheetsChange:V=>{J(V?.getSelectedSheet())},onViewChange(V){J(V?.getSelectedSheet())},onProtectionChange:V=>{Ue(V?.getProtection())}}),oe.useModelListener(H,{onRequestSelect:async(V,ae)=>new Promise(he=>{G.current.getSheet()!==ae?G.current.getGridElement()?.onViewChangeOnce(()=>{G.current.getSheet()!==ae&&he(!1),he(!0)}):he(!0)})},Bl);const[oi,gt]=n.useReducer(V=>V+1,0),ot=H?.getView();oe.useModelListener(ot,{onViewChange:V=>{gt()}});const Pe=te??W,we=n.useMemo(()=>Io(W,Pe),[W,Pe]),hn=K??W,ni=n.useMemo(()=>Io(W,hn),[W,hn]),[gn,ai]=n.useState(null);n.useCallback(()=>{G.current.focus()},[]);const fe=jr({workbook:H,workbookElement:de.current,target:()=>G.current,commands:m,darkMode:we.body.darkMode,onNewWorkbook:r}),xt=n.useRef(null),[uo,xn]=n.useState(!1),[bn,yn]=n.useState(null),[Cn,ri]=n.useState(w.ToolTipPlacement.Top),[bt,ii]=n.useState(A.TypesUtils.EmptyBounds),mo=n.useCallback(()=>{xn(!1),yn(null)},[]),yt=n.useCallback((V,ae,he=w.ToolTipPlacement.Top)=>{ii(V),ri(he),yn(ae),xt.current!==null&&setTimeout(()=>{xt.current!==null&&xt.current.update()},160),xn(!0)},[]),[us,Sn]=n.useState("sheet"),qe=h??ot?.isShowTabs(),Ge=Q??ot?.isShowHorizontalScrollbar(),li=b??ot?.isShowFormulaBar(),zt=v??ot?.isShowStatusBar(),wn=Y??ot?.isShowVerticalScrollbar(),nt=we?.header?.edgeStrokeFill||"rgb(171,171,171)",si=n.useMemo(()=>zt?M({sheet:pe,gridStyle:we,...T}):null,[M,T,zt,we,pe]),ci=n.useMemo(()=>I({commands:fe,workbook:de.current,...P}),[fe,I,P,W]),[di,{width:po}]=_e(),Xe=po===0||po>560,fo=n.useMemo(()=>{if(!qe)return null;let V=j({background:we.body.fill,borderWidth:1,borderColor:nt,gridTheme:Pe,gridStyle:we,onBeforeUserChange:Ee,onUserChange:Oe,workbook:H,commands:fe,sheetTabProps:{},...k});return Xe||(V=e.jsx("div",{style:{flex:"none",display:"flex"},children:V})),V},[j,k,W,H,Pe,Xe,fe,qe]),kn=n.useCallback(V=>{const{style:ae,...he}=V;let ye=null,Te=null,Ce=null;if(Ge&&(Te=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${nt} 1px`,flexDirection:"column",justifyContent:"center"},children:e.jsx(oe.SheetScrollbar,{...he,style:{paddingLeft:"4px",paddingRight:"4px",...ae},touchThumbProps:{backgroundColor:Pe.palette.background.paper,borderColor:Pe.palette.primary.main,fillColor:"grey"},endGap:700,sheet:pe,onShowTooltip:ke=>{yt({x:ke.anchor.x,y:ke.anchor.y,width:0,height:0},ke.display,ke.placement)},onCloseTooltip:()=>mo()})})),qe&&Xe&&(Ce=fo),qe&&Xe&&!Ge&&(Ce=e.jsxs(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[Ce,e.jsx(B.Box,{sx:{borderTop:`solid ${nt} 1px`,flex:"1"}})]})),Ce&&Ge)ye=e.jsx(w.SplitPane,{position:H.getView().getTabRatio()/10+"%",onPositionChange:({percent:ke})=>{H.getView().setTabRatio(Math.round(10*ke))},minBefore:"200px",minAfter:"180px",resizerProps:{style:{minWidth:"11px",backgroundImage:`url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${W.palette.text.icon??W.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`,backgroundRepeat:"no-repeat",backgroundPosition:"center",borderTop:`solid ${nt} 1px`,borderBottom:"solid 3px transparent"}},elementBefore:Ce,elementAfter:Te});else if(Ge)ye=Te;else{if(!Ce)return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:zt?null:`solid ${nt} 1px`}});ye=Ce}return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:ye})},[pe,Ee,H,we,Pe,fe,qe,Ge,zt,Xe]),[Me,Ct]=n.useState(null),ui=n.useMemo(()=>({placement:"right-start",...Me?.popperProps}),[Me?.popperProps]),{reference:vn,component:mi}=C.useFloatStack({label:"contextMenu",popperProps:ui,anchor:Me?.anchor??{getBoundingClientRect:()=>new DOMRect(Me?.clientX||0,Me?.clientY||0)},onClose:()=>Ct(null),createPopupPanel:Me?.createPopupPanel});n.useEffect(()=>{Me?vn.open(0):vn.close(0)},[Me]);const pi=w.useCallbackRef((V,ae)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Me&&Me.anchor===V.currentTarget?Ct(null):Ct({anchor:V.currentTarget,popperProps:{offsets:[-4,2]},createPopupPanel:he=>{const{floatReference:ye}=he;return R({filter:ae,commands:fe,floatReference:ye,sx:{...D}})}})},[R,D,fe,H,Me]),jn=w.useCallbackRef(V=>{if(V.originalEvent?.isDefaultPrevented())return!0;V.originalEvent?.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:ae=>{const{floatReference:he}=ae;return E({commands:fe,workbook:H,floatReference:he,sx:{...D}})}})},[E,D,fe,H]),fi=w.useCallbackRef((V,ae)=>{if(V?.isDefaultPrevented())return!0;V.preventDefault(),Ct({clientX:V.clientX,clientY:V.clientY,createPopupPanel:he=>{const{floatReference:ye}=he;return N({movable:ae,commands:fe,floatReference:ye,sx:{...D}})}})},[N,D,fe]);n.useMemo(()=>{const V=[new w.SimpleCommand("openContextMenu",()=>G.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=pe.getSelection().getCoords().cell;G.current?.getGridElement()?.scrollCellCoordsIntoView(V).then(ae=>{requestAnimationFrame(()=>{const he=pe.getView().getZoomScale()/100,ye=pe.getColumnHeaders().findOffset(V.colIndex+1)*he,Te=pe.getRowHeaders().findOffset(V.rowIndex+1)*he,Ce=G.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};jn({clientX:ye-Ce.x-ae.left+6,clientY:Te-Ce.y-ae.top+6})})})})},[pe]);const hi=w.useCallbackRef(V=>{fe?.dispatchToFocusedCommand(V)},[fe]),gi=w.useCallbackRef(()=>{Zn(de.current)},[H,de.current]),xi=n.useCallback(()=>{Sn("sheet")},[]),bi=n.useCallback(()=>{Sn("formulaBar")},[]),yi=n.useCallback(V=>{const{style:ae,...he}=V;return e.jsx(oe.SheetScrollbar,{...he,style:{...ae,paddingTop:"4px",paddingBottom:"4px"},touchThumbProps:{backgroundColor:Pe.palette.background.paper,borderColor:Pe.palette.primary.main,fillColor:"grey"},sheet:pe,endGap:700,onShowTooltip:ye=>{yt(ye.anchor,ye.display,w.ToolTipPlacement.Left)},onCloseTooltip:()=>mo()})},[pe,Pe]);n.useEffect(()=>{c&&G&&G.current&&G.current.focus()},[]);const[Ht,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]),Ci=w.useCallbackRef(V=>{if(fe?.getCommand("openWorkbook")&&(V.preventDefault(),V.stopPropagation(),ho(null),V.dataTransfer.files&&V.dataTransfer.files.length>0)){const ae=V.dataTransfer.files[0];if(!ae)return;if(ae?.type?.startsWith("image/")){const he=G.current?.getGridElement().getViewFromClient(V.clientX,V.clientY);if(!he)return;const ye=he.getRelativePointFromClient(V.clientX,V.clientY),Te=he.toAbsoluteBounds({...ye,width:0,height:0}),Ce=he.getCellCoordsFromClient(V.clientX,V.clientY);if(!Ce)return;fe?.getCommand("insertImageFromFile")?.execute({file:ae,options:{bounds:{x:Te.x,y:Te.y}},goto:{range:{...Ce}}})}else fe?.getCommand("openWorkbook")?.execute(ae)}},[fe,Ht]),Si=n.useMemo(()=>Ht?e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"100%",boxSizing:"border-box",pointerEvents:"none",display:"flex",justifyContent:"center",alignItems:"center",background:V=>V.palette.divider,color:V=>V.palette.primary.dark},children:e.jsx(B.Typography,{variant:"h4",children:Ht})}):null,[Ht]),En=n.useRef(null),wi=n.useMemo(()=>e.jsx(Fo,{in:!_,nodeRef:En,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:_?"none":f?.pointerEvents,position:"absolute",boxSizing:"border-box"},children:z({ref:En,transitionDelay:"0",transparentBackground:!1,sx:{opacity:_?0:f?.opacity,pointerEvents:_?"none":f?.pointerEvents,position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%",...O}})})}),[_,z,O]),ki=n.useMemo(()=>x({sx:{marginTop:V=>V.spacing(.25),marginLeft:V=>V.spacing(1),marginRight:V=>V.spacing(1)},workbook:H,sheetElement:G.current,gridStyle:we,onFocus:bi,...S,NamedCollectionEditorProps:{restoreFocus:V=>G.current.focus(V),...S?.NamedCollectionEditorProps,commandPopupButtonProps:{commands:fe,...S?.NamedCollectionEditorProps?.commandPopupButtonProps}}},ve),[x,S,H,we,fe,_]),vi=n.useCallback(V=>{const{movable:ae,...he}=V,ye={movable:ae,onContextMenuCapture:ke=>{fi(ke,ae)},...he},Te=ae.getContent().getType();let Ce=null;if(Te==="picture")return e.jsx(oe.PictureEditor,{loadingPanel:e.jsx(C.LoadingPanel,{transitionDelay:"100",style:{position:"absolute"},sx:{border:ke=>`solid 1px ${ke.palette.action.active}`}}),picture:ae.getContent(),description:ae.getDescription()??ae?.getName(),...ye});if(Te==="chart"){const ke={...ye,chart:ae.getContent()};return e.jsx(oe.ChartEditor,{...ke})}if(Ce=`Float of type '${Te}'.`,typeof Ce=="string"){const ke={...ye,description:Ce};Ce=e.jsx(oe.EmptyFrame,{...ke})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:Ce},ae.getUUID())},[]),Tn=n.useMemo(()=>F({style:la,onFocus:xi,gridStyle:we,headersStyle:ni,sheet:pe,commands:fe,onSheetContextMenu:jn,onViewportChange:V=>{ai(V)},showScrollbars:!1,viewportComponent:Se,onRepeatCommandChange:u,onElementLoad:me,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:vi,...L,cellRenderProps:{onFilterButtonMouseDown:(V,ae)=>{L?.cellRenderProps?.onFilterButtonMouseDown(V,ae),pi(V,ae)},...L?.cellRenderProps}},G),[fe,L,pe,we,u]),ji=n.useMemo(()=>{let V=e.jsx(w.ScrollPane,{ref:di,style:la,viewport:gn,touchElement:G.current?.getGridElement()?.stage,onScrollViewport:ae=>{G.current?.getGridElement()?.scrollTo(ae)},showHorizontalScrollbar:Ge||qe,showVerticalScrollbar:wn,createHorizontalScrollbar:kn,createVerticalScrollbar:yi,children:Tn});return Xe||po===0||(V=e.jsxs(e.Fragment,{children:[V,fo]})),$?$(V):V},[Ge,qe,kn,wn,gn,Xe,Tn,fo,W,$,Pe]),Ei=n.useMemo(()=>e.jsx(C.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:uo,title:e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:bn}),placement:Cn,slotProps:{transition:{timeout:{exit:0}},popper:{popperRef:xt,sx:{"& .MuiTooltip-tooltip":{padding:"2px 6px","& .MuiTooltip-arrow":{display:uo?"visible":"none"}}},anchorEl:{getBoundingClientRect:()=>new DOMRect(bt.x,bt.y,bt.width,bt.height)},modifiers:[{name:"offset",options:{offset:[0,0]}}]}},children:e.jsx(B.Box,{})}),[uo,bn,Cn,bt,xt]),Ti=n.useMemo(()=>({boxSizing:"border-box",background:V=>V.palette.mode!=="dark"?we.header.fill:V.palette.background.paper,"& *":{...C.scrollbarTheming(W),fontWeight:400},"&.Mui-focusVisible":{},"& .viewport-overlay":{borderRight:`solid ${nt} 1px`},...f}),[f,we]),Bi=n.useMemo(()=>e.jsx(B.Box,{sx:{marginBottom:V=>V.spacing(.75)}}),[]),Ri=n.useMemo(()=>({flex:"1 1 100%",width:"100%",display:"flex",flexDirection:"column",opacity:_?void 0:0,"--sxl-app-color-high-contrast":W.palette.primary.main,"--sxl-app-color-primary":W.palette.primary.main,"--sxl-app-color-primary-dark":W.palette.primary.dark,"--sxl-app-color-primary-light":W.palette.primary.light,"--sxl-app-color-info":W.palette.info.main,"--sxl-app-color-info-dark":W.palette.info.dark,"--sxl-app-color-info-light":W.palette.info.light,"--sxl-app-color-secondary":W.palette.secondary.main,"--sxl-app-color-secondary-dark":W.palette.secondary.dark,"--sxl-app-color-secondary-light":W.palette.secondary.light,"--sxl-app-color-success":W.palette.success.main,"--sxl-app-color-success-dark":W.palette.success.dark,"--sxl-app-color-success-light":W.palette.success.light,"--sxl-app-color-warning":W.palette.warning.main,"--sxl-app-color-warning-dark":W.palette.warning.dark,"--sxl-app-color-warning-light":W.palette.warning.light,"--sxl-app-color-error":W.palette.error.main,"--sxl-app-color-error-dark":W.palette.error.dark,"--sxl-app-color-error-light":W.palette.error.light,"--sxl-app-color-text":W.palette.text.primary,"--sxl-app-color-text-secondary":W.palette.text.secondary,"--sxl-app-color-text-disabled":W.palette.text.disabled,"--sxl-app-color-background":W.palette.background.paper,"--sxl-app-color-button-surface":W.palette.grey[600],"--sxl-app-color-shadow":W.palette.action.focus,"--sxl-app-color-grey":W.palette.grey[500],"--sxl-app-filter-dark-invert":we.body.darkMode&&q?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":we.body.darkMode?`linear-gradient(${X.alpha("#fff",X.getOverlayAlpha(5))}, ${X.alpha("#fff",X.getOverlayAlpha(5))})`:void 0}),[we,W,_]),Pi=n.useMemo(()=>se(Ga),[]);return e.jsxs(B.Paper,{className:se("sheetxl-workbook",gl,{"Mui-focusVisible":ie},hl,d),sx:Ti,style:l,square:!1,...ne,ref:de,onFocus:V=>{re(!0),gi(),g?.(V)},onBlur:V=>{re(!1),y?.(V)},onKeyDown:V=>{hi(V),p?.(V)},onDragStart:V=>{if(V.target.src){const ae=new Image;ae.src=V.target.src,V.dataTransfer.setDragImage(ae,1,1)}},onDragEnter:go,onDragLeave:go,onDragOver:go,onDrop:Ci,children:[e.jsxs("div",{className:Pi,style:Ri,children:[ci,li?ki:null,Bi,ji,si,Ei,mi,Si]}),wi]})}));ln.displayName="WorkbookElement";const Rl=(a=!1,i=!1)=>i?null:{"& input:not(:focus):not(:hover)":{color:o=>o.palette.text.secondary},backgroundColor:o=>X.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:c,readOnly:f=!1,hidden:l,...d}=a,[g,y]=n.useState(!1),[p,u]=n.useState(!1),[m,b]=n.useState(r??""),[S,x]=n.useState(""),[h,{width:k}]=_e(),[j,{width:v}]=_e(),[T,M]=n.useState(!1),P=n.useRef(null),I=n.useRef(null),D=w.useImperativeElement(i,()=>({requestWorkbookTitle:(E=null,R)=>{I.current={onAccept:E,requestReason:R?.requestReason},R?.selectAll&&P.current?.select(),P.current?.focus(R)},focus:E=>{P.current?.focus(E)}}),[]);return n.useLayoutEffect(()=>{M(r!==m),x(r),b(r)},[r]),n.useEffect(()=>{T&&k!==0&&je.CommonUtils.debounce(()=>{M(!1)},300)()},[T,k]),n.useEffect(()=>{u(m&&!dt.IOUtils.isValidWindowsFilename(m))},[m]),l?null:e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",opacity:T?"0":"1",transition:T?void 0:"opacity .25s ease-in","& .tooltip-wrapper":{maxWidth:"100%"}},ref:tt([D,j,i]),...d,children:e.jsx(C.ExhibitTooltip,{label:I.current?.requestReason??"Workbook Name",children:e.jsxs(B.Box,{className:se({"Mui-focusVisible":g}),sx:{visibility:k===0?"hidden":"visible",display:"block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:"12px",paddingRight:"12px",marginLeft:"2px",marginRight:"2px",paddingTop:"2px",paddingBottom:"1px",...Rl(!0,f),...o},children:[f?e.jsx(B.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:m!==S?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:E=>p?E.palette.error.dark:void 0},children:r??s}):e.jsx(B.Input,{sx:{width:`${Math.min(k+3,Math.max(v,D.current?.getBoundingClientRect()?.width))}px`,overflow:"hidden",whiteSpace:"nowrap",fontWeight:"600",maxWidth:"100%",border:"none",padding:"0px",margin:"0px",color:E=>p?E.palette.error.dark:void 0,fontStyle:m!==S?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:f,spellCheck:!1,placeholder:s,onFocus:E=>{y(!0),E.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:P},onBlur:()=>{y(!1),p?b(S):(m!==S&&(c?.(m),m&&I.current?.onAccept?.(m,"blur")),I.current=null)},onChange:E=>{if(E.target.value.length>dt.IOUtils.MAX_WORKBOOK_NAME_SIZE)return E.stopPropagation(),void E.preventDefault();b(E.target.value)},onKeyDown:E=>{(dt.IOUtils.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(E.key)||E.target?.value.length>dt.IOUtils.MAX_WORKBOOK_NAME_SIZE)&&E.preventDefault(),E.which===w.KeyCodes.Enter||E.which===w.KeyCodes.Tab?(p?b(S):(c?.(m),m&&(I.current?.onAccept?.(m,"keydown"),I.current=null)),E.stopPropagation(),E.preventDefault(),t?.focus()):E.which===w.KeyCodes.Escape&&(m===S?t?.focus():(b(S),setTimeout(()=>{E.target?.select()},0)),I.current=null,E.stopPropagation(),E.preventDefault())},value:m}),e.jsx(B.Box,{ref:h,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:m!==S?"italic":void 0,fontFamily:E=>E.typography.fontFamily,letterSpacing:"0.00938em"},children:m||s})]})})})}));sn.displayName="WorkbookTitle";const Br=n.memo(n.forwardRef((a,i)=>{const{title:o,commands:t,className:r,...s}=a,c=w.useNotifier(),[f,l]=n.useState(!1),[d,g]=n.useState(!1),y=n.useRef(null),[p,u]=n.useReducer(P=>P+1,0),[m,{width:b}]=_e(),S=w.useCommands(t,["editTable"])[0].context(),x=S.table(),[h,k]=n.useState(()=>x?S.getNames().getRanges(x.getRange()):null),j=n.useMemo(()=>x?.getName()??"",[x]);oe.useModelListener(S.table(),{onAnchorCoordsChange(P){k(S.getNames().getRanges(P.getRange()))},onProtectedChange(P){u()}});const v=w.useCallbackRef(P=>{S?.table().setName(P)},[S]),T=w.useCallbackRef(P=>{S?.table().resize(P.at(0))},[S]);let M=null;return S.table()||(M=e.jsx(B.Typography,{component:"div",style:{top:"0",left:"0",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyItems:"center",justifyContent:"center"},children:"No table selected"})),e.jsx(B.Paper,{square:!0,onFocus:()=>l(!0),onBlur:P=>{y?.current?.contains(P.relatedTarget)||l(!1)},ref:tt([y,m,i]),sx:{display:"flex",flexDirection:"column",flex:"1 1 auto",width:"100%",height:"100%",overflow:"auto",paddingLeft:P=>P.spacing(1.5),paddingRight:P=>P.spacing(1.5),paddingTop:P=>P.spacing(1.5),paddingBottom:P=>P.spacing(1.5),boxSizing:"border-box"},className:se("sxl-table-details-panel",r,{"sxl-has-focus":f}),...s,children:M||e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 auto",flexDirection:"column",transition:"opacity 60ms",opacity:S.table()?1:0},children:[e.jsx(B.Box,{sx:{containerType:"inline-size",display:"flex",flexDirection:"column",maxWidth:"100%",boxSizing:"border-box",paddingTop:P=>P.spacing(2),paddingLeft:P=>P.spacing(2),paddingRight:P=>P.spacing(2)},children:e.jsxs(B.Box,{className:Yi,children:[e.jsx(Uo,{formName:"name",defaultInput:j,value:x?.getName()??"No table",onChangeInput:v,onValidate:P=>{x&&x.getName().toLowerCase()===P.toLowerCase()||S?.getNames().validateName(P)},disabled:x?.isProtected()??!0,onFocus:P=>{d||P.target?.select(),g(!0)}}),e.jsx(qo,{formName:"range",value:h,onChangeInput:T,resolvedAddress:S.getNames().getRanges.bind(S.getNames()),disabled:x?.isProtected()??!0,onFocus:P=>{d||P.target?.select(),g(!0)}})]})}),e.jsxs(B.Box,{sx:{minHeight:"10px",flex:"1 1 100%",display:"flex",flexDirection:"column",containerType:"inline-size",gap:P=>P.spacing(.5),marginTop:P=>P.spacing(1)},children:[e.jsx(C.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:P=>P.spacing(1.5),marginBottom:P=>P.spacing(.75)}}),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",justifyContent:"start",flexDirection:"column",marginTop:P=>P.spacing(1),marginBottom:P=>P.spacing(1)},children:e.jsxs("div",{style:{display:"flex",alignItems:"start",gap:"2px"},children:[e.jsx(Ko,{table:x,styles:S.styles(),bodyStyle:S.bodyStyle(),cellHeight:30,isLive:!0}),e.jsx(cn,{command:t.getCommand("formatTableStyle"),commands:t,disabledQuickKey:!0})]})}),e.jsx(C.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:P=>P.spacing(1.5),marginBottom:P=>P.spacing(.75)}}),e.jsx(Ya,{disabled:x?.isProtected(),styleOptions:x?.getStyleOptions()??null,onStyleOptionsChange:P=>{x.updateStyleOptions(P)},showHeaderRow:x?.getShowHeaders(),onShowHeaderRowChange:P=>{try{x.setShowHeaders(P)}catch(I){c.showError(I)}},showTotalRow:x?.getShowTotals(),onShowTotalRowChange:P=>{try{x.setShowTotals(P)}catch(I){c.showError(I)}},showFilterButton:x?.getFilter()?x.getShowFilterButton():null,onShowFilterButtonChange:P=>{try{x.setShowFilterButton(P)}catch(I){c.showError(I)}}}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsxs(B.Box,{className:Zi,children:[e.jsx(C.CommandButton,{variant:w.CommandButtonType.Menuitem,command:t.getCommand("convertTableToRange"),commandState:x}),e.jsx(C.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:x,command:t.getCommand("deleteTable")})]})]})]})})})),Rr=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...c}=a;return e.jsx(Br,{ref:i,commands:t,...c})},Pr=()=>{w.DefaultDynamicIconService.register("plugin-table",{icons:{}}),oe.DefaultTaskPaneRegistry.registerTaskPane({key:"tableDetails",getTitle:()=>"Table Details",getIcon:()=>"Table",renderTaskPane:Rr},!0)},Pl=n.memo(a=>{const{table:i,tableStyle:o,selectedTableStyleName:t,onSelectTableStyleName:r,styles:s,hasContextMenu:c=!0,bodyStyle:f,parentFloat:l,commands:d,disabled:g,commandHook:y,useCanvasPreview:p=!0,canvas:u,...m}=a,b=n.useCallback(k=>{const j={variant:w.CommandButtonType.Menuitem,commandHook:y,context:"table"},v=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...j,command:d.getCommand("formatTableStyleClearCellStyles"),commandState:o,disabled:g}),e.jsx(C.CommandButton,{...j,style:{fontWeight:550},command:d.getCommand("formatTableStyle"),commandState:{name:o.getName()},disabled:g}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...j,command:d.getCommand("setDefaultTableStyle"),commandState:o.getName(),disabled:g}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...j,command:d.getCommand("deleteTableStyle"),commandState:o?.getName(),disabled:g||!o||o.isBuiltIn()})]}),T=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:v})});return C.defaultCreatePopupPanel({...k,children:T})},[d]),S=o?.getName()===t,x=n.useMemo(()=>{const k={table:i,tableStyle:o,styles:s,bodyStyle:f};return p?e.jsx(Xa,{canvas:u,...k}):e.jsx(Ko,{...k})},[i,o,s,f]);let h=e.jsx(C.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:k=>`solid ${S?k.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName()??"None",placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{r?.(o?.getName())},...m,children:x},o.getName());return c&&(h=e.jsx(C.ContextMenu,{label:i.getStyleOptions().name,parentFloat:l,createPopupPanel:b,children:h})),h}),cn=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedTable:s,onSelectTableStyleName:c,disabled:f=!1,bodyStyle:l,disabledQuickKey:d=!1,usePreviewIcon:g=!1,...y}=a;w.useCommand(t);const p=t?.context(),u=p?.styles,m=s??p?.table?.();let b="insertTable";m&&(b="editTable");const S=n.useMemo(()=>((D,E)=>{const R={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new A.Table({initialAnchor:R,styles:E,json:{name:"PreviewTable",ref:R,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:D}})})(m?.getStyleOptions(),u?.()),[u?.().getDefaultTableStyle(),m?.getStyleOptions()]),x=m??S,[h,k]=n.useState(x);n.useEffect(()=>{k(x)},[x]);const j=l??p?.bodyStyle(),v=w.useCallbackRef(D=>{c?.(D),t?.execute({name:D},r)},[t,c,r]),T=n.useRef(null),M=n.useCallback((D,E)=>{const R={onSelectTableStyleName:v,styles:u(),parentFloat:D.floatReference};T.current||(T.current=document.createElement("canvas"));const N=K=>{const q=u().getTableStyle(K);return q?e.jsx(Pl,{table:h,tableStyle:q,selectedTableStyleName:h.getStyleOptions().name,bodyStyle:p.bodyStyle(),commands:E,commandHook:r,canvas:T.current,...R},K):null},z=(K,q,ne=!0)=>{const W=[];for(let U=0;U<q.length;U++){const H=N(q[U]);H&&W.push(H)}return W.length===0?null:e.jsxs(B.Box,{children:[ne?e.jsx(C.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(C.ExhibitMenuHeader,{children:K},K+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"481px",maxWidth:"100%"},children:W},K+"-presets")]},K)},O=[],L=u().getCustomTableStyles(),F=[];if(L.length>0){for(let K=0;K<L.length;K++)L[K].isShownInTableStyles()&&F.push(L[K].getName());O.push(z("Custom",F,!1))}const $=[];m&&!m.getStyleOptions().name&&$.push(null);for(let K=0;K<21;K++)$.push("TableStyleLight"+(K+1));O.push(z("Light",$,F.length>0));const Q=[];for(let K=0;K<28;K++)Q.push("TableStyleMedium"+(K+1));O.push(z("Medium",Q));const Y=[];for(let K=0;K<11;K++)Y.push("TableStyleDark"+(K+1));O.push(z("Dark",Y));let te=null;return m&&(te=e.jsxs(e.Fragment,{children:[e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{variant:w.CommandButtonType.Menuitem,command:E.getCommand("formatTableStyleClearTableStyle"),commandHook:r,disabled:f})]})),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:K=>`${K.shape.borderRadius}px`,paddingBottom:K=>`${K.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",padding:"6px 16px"},children:O}),te]})},[u,u?.().getTheme(),j,h]),P=f||!t||t.disabled(),I=n.useMemo(()=>{if(!p||!g)return t?.icon()},[h,j,P,t]);return e.jsx(C.CommandPopupButton,{ref:i,quickCommand:d?void 0:b,createPopupPanel:M,commands:o,label:t?.label(),commandState:m,commandHook:r,selected:m!==null,createTooltip:({children:D},E)=>e.jsx(C.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:E,children:D}),disabled:P,icon:I,...y})})),Mr=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,selectedTheme:r,onSelectTheme:s,disabled:c=!1,darkMode:f,label:l,icon:d,variant:g,...y}=a;w.useCommand(o);const p=o?.context()?.themes,u=r||o?.context()?.theme,m=f??o?.context()?.darkMode,b=c||o?.disabled(),S=w.useCallbackRef(h=>{s?.(h),o?.execute(h,t)},[s,t]),x=n.useCallback((h,k)=>{const{children:j,title:v,...T}=h;let M=h.children;return(b||k)&&(M=e.jsx("div",{children:M})),e.jsx(C.CommandTooltip,{command:o,placement:g===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:b||k,...T,children:M})},[o,b]);return e.jsx(or,{ref:i,themes:p,selectedTheme:u,onSelectTheme:S,variant:g===w.CommandButtonType.Menuitem?C.PopupButtonType.Menuitem:C.PopupButtonType.Toolbar,createTooltip:x,disabled:b,darkMode:m,...y})})),Dr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,f=w.useCommands(o,["themeMode"])[0],l=w.useCallbackRef((u,m)=>{const b={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:s},S=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...b,command:f}),e.jsx(C.CommandButton,{...b,command:m.getCommand("defaultThemeMode")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...b,command:m.getCommand("enableDarkGrid")}),e.jsx(C.CommandButton,{...b,command:m.getCommand("enableDarkImages")})]});return C.defaultCreatePopupPanel({...u,children:S})},[s,f,t,r]),d=f?.state(),g=B.useMediaQuery("(prefers-color-scheme: dark)"),y=d==="dark"||d===null&&g,p=f?.state()!==null;return e.jsx(C.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:()=>{f?.execute(y?"light":"dark",t)},selected:p,...c})})),Fr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,sx:c,...f}=a,l=n.useCallback((d,g)=>{const y={variant:w.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(u,m)=>t?.beforeExecute?.(u,m)!==!1&&d.floatReference.closeAll()},disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...y,command:g.getCommand("showKeyboardShortcuts")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...y,command:g.getCommand("gotoUrlGithub")}),e.jsx(C.CommandButton,{...y,command:g.getCommand("gotoUrlDiscord")}),e.jsx(C.CommandButton,{...y,command:g.getCommand("gotoUrlDocumentation")}),e.jsx(C.CommandButton,{...y,command:g.getCommand("gotoUrlIssue")})]});return C.defaultCreatePopupPanel({...d,children:p})},[s,t]);return e.jsx(C.CommandPopupButton,{ref:i,sx:c,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)"}}),...f})})),dn=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,preferSingleMenu:c=!0,showQuickButton:f=!0,variant:l=w.CommandButtonType.Toolbar,...d}=a,g=w.useCommands(o,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:y,allDisabled:p}=n.useMemo(()=>{let m=null,b=0;for(let S=0;S<g.length;S++)g[S]&&!g[S]?.disabled()&&(c&&l===w.CommandButtonType.Menuitem&&(m=b===0?g[S]:null),b++);return{singleMenuCommand:m,allDisabled:b===0}},[g]),u=n.useCallback((m,b)=>{const S={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...S,command:b.getCommand("insertImageFromFile")}),e.jsx(C.CommandButton,{...S,command:b.getCommand("insertImageFromURL")})]});return C.defaultCreatePopupPanel({...m,children:x})},[s,t,r]);return y?e.jsx(C.CommandButton,{ref:i,variant:l,commandHook:t,disabled:s,command:y,...d}):e.jsx(C.CommandPopupButton,{ref:i,variant:l,quickCommand:"insertImageFromFile",commands:o,commandHook:t,scope:r,disabled:s||p,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:u,icon:"InsertImage",...d})})),un=n.memo(n.forwardRef((a,i)=>{const{...o}=a;return e.jsx(C.SimpleCommandPopupButton,{ref:i,...o,popupCommandKeys:["insertFunctionSum","insertFunctionAverage","insertFunctionCount","insertFunctionMax","insertFunctionMin",null,"insertFunction"],quickCommand:"insertFunctionSum",popupScope:"insertFunction",label:"Quick Function",tooltip:"More functions."})}));un.displayName="InsertFunctionSumCommandPopupButton";const jo=new Map([{key:"financial",label:"Financial",icon:"FormulaFinancial"},{key:"logical",label:"Logical",icon:"FormulaLogical"},{key:"text",label:"Text",icon:"FormulaText"},{key:"dateTime",label:"Date & Time",icon:"FormulaDateTime"},{key:"lookupReference",label:"Lookup & Reference",icon:"FormulaLookupReference"},{key:"mathTrig",label:"Math & Trig",icon:"FormulaMathTrig"},{key:"statDist",label:"Statistical",icon:"FormulaStatistical"},{key:"engineering",label:"Engineering",icon:"FormulaEngineering"},{key:"information",label:"Information",icon:"FormulaInformation"},{key:"cube",label:"Cube",icon:"FormulaCube"},{key:"database",label:"Database",icon:"FormulaDatabase"},{key:"web",label:"Web",icon:"FormulaWeb"},{key:"custom",label:"Custom",icon:"FormulaCustom"}].map(a=>[a.key,a])),Ml=n.memo(a=>{const{command:i,formulaFunction:o,commandHook:t,disabled:r=!1,parentFloat:s,handleInsert:c,icon:f,label:l,sx:d,...g}=a,y=new Promise(p=>{o.getDescriptor().then(u=>{p(u.getSummary())})});return e.jsx(C.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...d},disabled:r,tooltipProps:{label:y,maxWidth:1e3},onMouseDown:p=>{p.button===0&&p.preventDefault()},onMouseUp:p=>{p.button===0&&c(o)},onKeyDown:p=>{p.keyCode===w.KeyCodes.Enter||(p.keyCode,w.KeyCodes.Space)},...g,children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",children:o.getName()})})})}),Ir=n.memo(n.forwardRef((a,i)=>{const{category:o,commands:t,commandHook:r,scope:s,sx:c,disabled:f=!1,parentFloat:l,...d}=a,g=w.useCommands(t,["insertFunction"])[0],y=n.useCallback((u,m)=>{const b=jo.get(o);if(!b)return console.warn("invalidate category",o),null;const S={commandHook:r,...u},x=e.jsx(Dl,{category:b.label,...S,commands:m});return C.defaultCreatePopupPanel({...u,children:x})},[o,g,r,s]),p=jo.get(o);return e.jsx(C.CommandPopupButton,{ref:i,commands:t,commandHook:r,createPopupPanel:y,label:p.label,tooltip:"Insert Function",icon:jo.get(o)?.icon??"FormulaGroup",...d})}));Ir.displayName="InsertFunctionCommandPopupButton";const Dl=n.memo(n.forwardRef((a,i)=>{const{commands:o,category:t,commandHook:r,...s}=a,c=w.useCommands(o,["insertFunction"]),[f,l]=n.useState([]),[d,g]=n.useState(!1);n.useEffect(()=>{(async()=>{g(!0);const S=c[0]?.context(),x=await S.searchByCategory(t);l(x),g(!1)})()},[]);const y=f.length,p=new Array(y),u=o.getCommand("insertFunction"),m=S=>{r?.beforeExecute?.(u,u?.state()),u.execute(S),r?.onExecute?.(u,u?.state())};for(let S=0;S<y;S++){const x=f[S];p[S]=e.jsx(Ml,{command:u,formulaFunction:x,handleInsert:m},`formula-${x.getName()}-${S}`)}const b=e.jsx(B.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:y>0?e.jsx(e.Fragment,{children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:p})}):null});return C.defaultCreatePopupPanel({...s,children:b})})),Nr=n.memo(n.forwardRef((a,i)=>{const{sx:o,style:t,className:r,licenseKey:s,renderLoadingPanel:c,...f}=a;s&&A.LicenseManager.setLicenseKey(s);const l=n.useMemo(()=>{const g={transitionDelay:"160ms",transparentBackground:!0};return e.jsx(B.Box,{sx:o,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...t},children:c?.(g)??e.jsx(C.LoadingPanel,{...g})})},[o,t,c]),d=n.useMemo(()=>n.lazy(async()=>await Promise.resolve().then(()=>ds)),[]);return e.jsx(e.Fragment,{children:e.jsx(n.Suspense,{fallback:l,children:e.jsx(d,{...f,className:r,renderLoadingPanel:c,sx:o,style:t,ref:i})})})}));function Or(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=Or(a[i]))&&(t&&(t+=" "),t+=o);else for(i in a)a[i]&&(t&&(t+=" "),t+=i);return t}function Ke(){for(var a,i,o=0,t="";o<arguments.length;)(a=arguments[o++])&&(i=Or(a))&&(t&&(t+=" "),t+=i);return t}Nr.displayName="Studio";let Fl={data:""},Il=a=>{if(typeof window=="object"){let i=(a?a.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return i.nonce=window.__nonce__,i.parentNode||(a||document.head).appendChild(i),i.firstChild}return a||Fl},Nl=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ol=/\/\*[^]*?\*\/| +/g,sa=/\n+/g,Je=(a,i)=>{let o="",t="",r="";for(let s in a){let c=a[s];s[0]=="@"?s[1]=="i"?o=s+" "+c+";":t+=s[1]=="f"?Je(c,s):s+"{"+Je(c,s[1]=="k"?"":i)+"}":typeof c=="object"?t+=Je(c,i?i.replace(/([^,])+/g,f=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,f):f?f+" "+l:l)):s):c!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=Je.p?Je.p(s,c):s+":"+c+";")}return o+(i&&r?i+"{"+r+"}":r)+t},Ae={},Ar=a=>{if(typeof a=="object"){let i="";for(let o in a)i+=o+Ar(a[o]);return i}return a},Al=(a,i,o,t,r)=>{let s=Ar(a),c=Ae[s]||(Ae[s]=(l=>{let d=0,g=11;for(;d<l.length;)g=101*g+l.charCodeAt(d++)>>>0;return"go"+g})(s));if(!Ae[c]){let l=s!==a?a:(d=>{let g,y,p=[{}];for(;g=Nl.exec(d.replace(Ol,""));)g[4]?p.shift():g[3]?(y=g[3].replace(sa," ").trim(),p.unshift(p[0][y]=p[0][y]||{})):p[0][g[1]]=g[2].replace(sa," ").trim();return p[0]})(a);Ae[c]=Je(r?{["@keyframes "+c]:l}:l,o?"":"."+c)}let f=o&&Ae.g?Ae.g:null;return o&&(Ae.g=Ae[c]),((l,d,g,y)=>{y?d.data=d.data.replace(y,l):d.data.indexOf(l)===-1&&(d.data=g?l+d.data:d.data+l)})(Ae[c],i,t,f),c};function No(a){let i=this||{},o=a.call?a(i.p):a;return Al(o.unshift?o.raw?((t,r,s)=>t.reduce((c,f,l)=>{let d=r[l];if(d&&d.call){let g=d(s),y=g&&g.props&&g.props.className||/^go/.test(g)&&g;d=y?"."+y:g&&typeof g=="object"?g.props?"":Je(g,""):g===!1?"":g}return c+f+(d??"")},""))(o,[].slice.call(arguments,1),i.p):o.reduce((t,r)=>Object.assign(t,r&&r.call?r(i.p):r),{}):o,Il(i.target),i.g,i.o,i.k)}function Lr(a,i,o){return i&&(function(t,r){for(var s=0;s<r.length;s++){var c=r[s];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(t,c.key,c)}})(a.prototype,i),a}function ue(){return ue=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},ue.apply(this,arguments)}function zr(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,a.__proto__=i}function At(a,i){if(a==null)return{};var o,t,r={},s=Object.keys(a);for(t=0;t<s.length;t++)o=s[t],i.indexOf(o)>=0||(r[o]=a[o]);return r}function 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""},Hr=n.createContext({enqueueSnackbar:da,closeSnackbar:da}),Eo="@media (max-width:599.95px)",to="@media (min-width:600px)",ua=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},mn=function(a){return""+ua(a.vertical)+ua(a.horizontal)},qt=function(a){return!!a||a===0},Gt="unmounted",rt="exited",it="entering",Bt="entered",ma="exiting",pn=(function(a){function i(t){var r;r=a.call(this,t)||this;var s,c=t.appear;return r.appearStatus=null,t.in?c?(s=rt,r.appearStatus=it):s=Bt:s=t.unmountOnExit||t.mountOnEnter?Gt:rt,r.state={status:s},r.nextCallback=null,r}zr(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Gt?{status:rt}:null};var o=i.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==it&&s!==Bt&&(r=it):s!==it&&s!==Bt||(r=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===it?this.performEnter(t):this.performExit()):this.props.unmountOnExit&&this.state.status===rt&&this.setState({status:Gt})},o.performEnter=function(t){var r=this,s=this.props.enter,c=t,f=this.getTimeouts();t||s?(this.props.onEnter&&this.props.onEnter(this.node,c),this.safeSetState({status:it},function(){r.props.onEntering&&r.props.onEntering(r.node,c),r.onTransitionEnd(f.enter,function(){r.safeSetState({status:Bt},function(){r.props.onEntered&&r.props.onEntered(r.node,c)})})})):this.safeSetState({status:Bt},function(){r.props.onEntered&&r.props.onEntered(r.node,c)})},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:rt},function(){t.props.onExited&&t.props.onExited(t.node)})})})):this.safeSetState({status:rt},function(){t.props.onExited&&t.props.onExited(t.node)})},o.cancelNextCallback=function(){this.nextCallback!==null&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(){s&&(s=!1,r.nextCallback=null,t())},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=t==null&&!this.props.addEndListener;this.node&&!s?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),t!=null&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Gt)return null;var r=this.props;return(0,r.children)(t,At(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Lr(i,[{key:"node",get:function(){var t,r=(t=this.props.nodeRef)===null||t===void 0?void 0:t.current;if(!r)throw new Error("notistack - Custom snackbar is not refForwarding");return r}}]),i})(n.Component);function lt(){}function 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}}pn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:lt,onEntering:lt,onEntered:lt,onExit:lt,onExiting:lt,onExited:lt};var Ll="cubic-bezier(0.4, 0, 0.2, 1)",zl="cubic-bezier(0.0, 0, 0.2, 1)",Hl="cubic-bezier(0.4, 0, 0.6, 1)",Wr=function(a){a.scrollTop=a.scrollTop},fa=function(a){return Math.round(a)+"ms"};function mt(a,i){a===void 0&&(a=["all"]);var o=i||{},t=o.duration,r=t===void 0?300:t,s=o.easing,c=s===void 0?Ll:s,f=o.delay,l=f===void 0?0:f;return(Array.isArray(a)?a:[a]).map(function(d){var g=typeof r=="string"?r:fa(r),y=typeof l=="string"?l:fa(l);return d+" "+g+" "+c+" "+y}).join(",")}function $r(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,c=r.getBoundingClientRect(),f=$r(r);if(r.fakeTransform)s=r.fakeTransform;else{var l=f.getComputedStyle(r);s=l.getPropertyValue("-webkit-transform")||l.getPropertyValue("transform")}var d=0,g=0;if(s&&s!=="none"&&typeof s=="string"){var y=s.split("(")[1].split(")")[0].split(",");d=parseInt(y[4],10),g=parseInt(y[5],10)}switch(t){case"left":return"translateX("+(f.innerWidth+d-c.left)+"px)";case"right":return"translateX(-"+(c.left+c.width-d)+"px)";case"up":return"translateY("+(f.innerHeight+g-c.top)+"px)";default:return"translateY(-"+(c.top+c.height-g)+"px)"}})(a,i);o&&(i.style.webkitTransform=o,i.style.transform=o)}}var Vr=n.forwardRef(function(a,i){var o=a.children,t=a.direction,r=t===void 0?"down":t,s=a.in,c=a.style,f=a.timeout,l=f===void 0?0:f,d=a.onEnter,g=a.onEntered,y=a.onExit,p=a.onExited,u=At(a,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),m=n.useRef(null),b=Oo(o.ref,m),S=Oo(b,i),x=n.useCallback(function(){m.current&&Xt(r,m.current)},[r]);return n.useEffect(function(){if(!s&&r!=="down"&&r!=="right"){var h=(function(j,v){var T;function M(){for(var P=this,I=arguments.length,D=new Array(I),E=0;E<I;E++)D[E]=arguments[E];clearTimeout(T),T=setTimeout(function(){j.apply(P,D)},v)}return v===void 0&&(v=166),M.clear=function(){clearTimeout(T)},M})(function(){m.current&&Xt(r,m.current)}),k=$r(m.current);return k.addEventListener("resize",h),function(){h.clear(),k.removeEventListener("resize",h)}}},[r,s]),n.useEffect(function(){s||x()},[s,x]),n.createElement(pn,Object.assign({appear:!0,nodeRef:m,onEnter:function(h,k){Xt(r,h),Wr(h),d&&d(h,k)},onEntered:g,onEntering:function(h){var k=c?.transitionTimingFunction||zl,j=ao({timeout:l,mode:"enter",style:ue({},c,{transitionTimingFunction:k})});h.style.webkitTransition=mt("-webkit-transform",j),h.style.transition=mt("transform",j),h.style.webkitTransform="none",h.style.transform="none"},onExit:function(h){var k=c?.transitionTimingFunction||Hl,j=ao({timeout:l,mode:"exit",style:ue({},c,{transitionTimingFunction:k})});h.style.webkitTransition=mt("-webkit-transform",j),h.style.transition=mt("transform",j),Xt(r,h),y&&y(h)},onExited:function(h){h.style.webkitTransition="",h.style.transition="",p&&p(h)},in:s,timeout:l},u),function(h,k){return n.cloneElement(o,ue({ref:S,style:ue({visibility:h!=="exited"||s?void 0:"hidden"},c,{},o.props.style)},k))})});Vr.displayName="Slide";var co=function(a){return n.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},a))},Wl=function(){return n.createElement(co,null,n.createElement("path",{d:`M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41
|
|
15
|
-
10.59L10 14.17L17.59 6.58L19 8L10 17Z`}))},$l=function(){return n.createElement(co,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Vl=function(){return n.createElement(co,null,n.createElement("path",{d:`M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,
|
|
16
|
-
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`}))},_l=function(){return n.createElement(co,null,n.createElement("path",{d:`M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,
|
|
18
|
-
0 22,12A10,10 0 0,0 12,2Z`}))},Qe={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(Wl,null),warning:n.createElement($l,null),error:n.createElement(Vl,null),info:n.createElement(_l,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:Vr,transitionDuration:{enter:225,exit:195}},Kl=function(a,i){return function(o,t){return t===void 0&&(t=!1),t?ue({},Qe[o],{},i[o],{},a[o]):o==="autoHideDuration"?(r=a.autoHideDuration,s=i.autoHideDuration,(c=function(f){return typeof f=="number"||f===null})(r)?r:c(s)?s:Qe.autoHideDuration):o==="transitionDuration"?(function(f,l){var d=function(g,y){return y.some(function(p){return typeof g===p})};return d(f,["string","number"])?f:d(f,["object"])?ue({},Qe.transitionDuration,{},d(l,["object"])&&l,{},f):d(l,["string","number"])?l:d(l,["object"])?ue({},Qe.transitionDuration,{},l):Qe.transitionDuration})(a.transitionDuration,i.transitionDuration):a[o]||i[o]||Qe[o];var r,s,c}};function Lt(a){return Object.entries(a).reduce(function(i,o){var t,r=o[0],s=o[1];return ue({},i,((t={})[r]=No(s),t))},{})}var Ul="notistack-SnackbarContainer",ql="notistack-Snackbar",_r="notistack-CollapseWrapper",Gl="notistack-MuiContent",Xl=function(a){return"notistack-MuiContent-"+a},ha=Lt({root:{height:0},entered:{height:"auto"}}),To="0px",Kr=n.forwardRef(function(a,i){var o=a.children,t=a.in,r=a.onExited,s=n.useRef(null),c=n.useRef(null),f=Oo(i,c),l=function(){return s.current?s.current.clientHeight:0};return n.createElement(pn,{in:t,unmountOnExit:!0,onEnter:function(d){d.style.height=To},onEntered:function(d){d.style.height="auto"},onEntering:function(d){var g=l(),y=ao({timeout:175,mode:"enter"}),p=y.duration,u=y.easing;d.style.transitionDuration=typeof p=="string"?p:p+"ms",d.style.height=g+"px",d.style.transitionTimingFunction=u||""},onExit:function(d){d.style.height=l()+"px"},onExited:r,onExiting:function(d){Wr(d);var g=ao({timeout:175,mode:"exit"}),y=g.duration,p=g.easing;d.style.transitionDuration=typeof y=="string"?y:y+"ms",d.style.height=To,d.style.transitionTimingFunction=p||""},nodeRef:c,timeout:175},function(d,g){return n.createElement("div",Object.assign({ref:f,className:Ke(ha.root,d==="entered"&&ha.entered),style:ue({pointerEvents:"all",overflow:"hidden",minHeight:To,transition:mt("height")},d==="entered"&&{overflow:"visible"},{},d==="exited"&&!t&&{visibility:"hidden"})},g),n.createElement("div",{ref:s,className:_r,style:{display:"flex",width:"100%"}},o))})});Kr.displayName="Collapse";var ga={right:"left",left:"right",bottom:"up",top:"down"},Yl=function(a){return"anchorOrigin"+mn(a)},Zl=function(){};function It(a,i){return a.reduce(function(o,t){return t==null?o:function(){for(var r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];var f=[].concat(s);i&&f.indexOf(i)===-1&&f.push(i),o.apply(this,f),t.apply(this,f)}},Zl)}var Ql=typeof window<"u"?n.useLayoutEffect:n.useEffect;function xa(a){var i=n.useRef(a);return Ql(function(){i.current=a}),n.useCallback(function(){return i.current.apply(void 0,arguments)},[])}var Bo,Ur=n.forwardRef(function(a,i){var o=a.children,t=a.className,r=a.autoHideDuration,s=a.disableWindowBlurListener,c=s!==void 0&&s,f=a.onClose,l=a.id,d=a.open,g=a.SnackbarProps,y=g===void 0?{}:g,p=n.useRef(),u=xa(function(){f&&f.apply(void 0,arguments)}),m=xa(function(x){f&&x!=null&&(p.current&&clearTimeout(p.current),p.current=setTimeout(function(){u(null,"timeout",l)},x))});n.useEffect(function(){return d&&m(r),function(){p.current&&clearTimeout(p.current)}},[d,r,m]);var b=function(){p.current&&clearTimeout(p.current)},S=n.useCallback(function(){r!=null&&m(.5*r)},[r,m]);return n.useEffect(function(){if(!c&&d)return window.addEventListener("focus",S),window.addEventListener("blur",b),function(){window.removeEventListener("focus",S),window.removeEventListener("blur",b)}},[c,S,d]),n.createElement("div",Object.assign({ref:i},y,{className:Ke(ql,t),onMouseEnter:function(x){y.onMouseEnter&&y.onMouseEnter(x),b()},onMouseLeave:function(x){y.onMouseLeave&&y.onMouseLeave(x),S()}}),o)});Ur.displayName="Snackbar";var Jl=Lt({root:(Bo={display:"flex",flexWrap:"wrap",flexGrow:1},Bo[to]={flexGrow:"initial",minWidth:"288px"},Bo)}),fn=n.forwardRef(function(a,i){var o=a.className,t=At(a,["className"]);return n.createElement("div",Object.assign({ref:i,className:Ke(Jl.root,o)},t))});fn.displayName="SnackbarContent";var Rt=Lt({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),ba="notistack-snackbar",qr=n.forwardRef(function(a,i){var o=a.id,t=a.message,r=a.action,s=a.iconVariant,c=a.variant,f=a.hideIconVariant,l=a.style,d=a.className,g=s[c],y=r;return typeof y=="function"&&(y=y(o)),n.createElement(fn,{ref:i,role:"alert","aria-describedby":ba,style:l,className:Ke(Gl,Xl(c),Rt.root,Rt[c],d,!f&&g&&Rt.lessPadding)},n.createElement("div",{id:ba,className:Rt.message},f?null:g,t),y&&n.createElement("div",{className:Rt.action},y))});qr.displayName="MaterialDesignContent";var Pt,Ro,Yt,Zt,Po,es=n.memo(qr),ts=Lt({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),os=function(a){var i=n.useRef(),o=n.useState(!0),t=o[0],r=o[1],s=It([a.snack.onClose,a.onClose]),c=n.useCallback(function(){i.current=setTimeout(function(){r(function(P){return!P})},125)},[]);n.useEffect(function(){return function(){i.current&&clearTimeout(i.current)}},[]);var f,l=a.snack,d=a.classes,g=a.Component,y=g===void 0?es:g,p=n.useMemo(function(){return(function(P){P===void 0&&(P={});var I={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(P).filter(function(D){return!I[D]}).reduce(function(D,E){var R;return ue({},D,((R={})[E]=P[E],R))},{})})(d)},[d]),u=l.open,m=l.SnackbarProps,b=l.TransitionComponent,S=l.TransitionProps,x=l.transitionDuration,h=l.disableWindowBlurListener,k=l.content,j=At(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),v=ue({direction:(f=j.anchorOrigin,f.horizontal!=="center"?ga[f.horizontal]:ga[f.vertical]),timeout:x},S),T=k;typeof T=="function"&&(T=T(j.id,j.message));var M=["onEnter","onEntered","onExit","onExited"].reduce(function(P,I){var D;return ue({},P,((D={})[I]=It([a.snack[I],a[I]],j.id),D))},{});return n.createElement(Kr,{in:t,onExited:M.onExited},n.createElement(Ur,{open:u,id:j.id,disableWindowBlurListener:h,autoHideDuration:j.autoHideDuration,className:Ke(ts.wrappedRoot,p.root,p[Yl(j.anchorOrigin)]),SnackbarProps:m,onClose:s},n.createElement(b,Object.assign({},v,{appear:!0,in:u,onExit:M.onExit,onExited:c,onEnter:M.onEnter,onEntered:It([M.onEntered,function(){a.snack.requestClose&&s(null,"instructed",a.snack.id)}],j.id)}),T||n.createElement(y,Object.assign({},j)))))},Mt={default:20},Qt={default:6,dense:2},ya="."+_r,Jt=Lt({root:(Pt={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:mt(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Pt[ya]={padding:Qt.default+"px 0px",transition:"padding 300ms ease 0ms"},Pt.maxWidth="calc(100% - "+2*Mt.default+"px)",Pt[Eo]={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[Eo]={left:"16px"},Yt),right:(Zt={right:Mt.default+"px"},Zt[to]={alignItems:"flex-end"},Zt[Eo]={right:"16px"},Zt),center:(Po={left:"50%",transform:"translateX(-50%)"},Po[to]={alignItems:"center"},Po)}),ns=function(a){var i=a.classes,o=i===void 0?{}:i,t=a.anchorOrigin,r=a.dense,s=a.children,c=Ke(Ul,Jt[t.vertical],Jt[t.horizontal],Jt.root,o.containerRoot,o["containerAnchorOrigin"+mn(t)],r&&Jt.rootDense);return n.createElement("div",{className:c},s)},as=n.memo(ns),Ca=function(a){return!(typeof a=="string"||n.isValidElement(a))},rs=(function(a){function i(o){var t;return(t=a.call(this,o)||this).enqueueSnackbar=function(r,s){if(s===void 0&&(s={}),r==null)throw new Error("enqueueSnackbar called with invalid argument");var c=Ca(r)?r:s,f=Ca(r)?r.message:r,l=c.key,d=c.preventDuplicate,g=At(c,["key","preventDuplicate"]),y=qt(l),p=y?l:new Date().getTime()+Math.random(),u=Kl(g,t.props),m=ue({id:p},g,{message:f,open:!0,entered:!1,requestClose:!1,persist:u("persist"),action:u("action"),content:u("content"),variant:u("variant"),anchorOrigin:u("anchorOrigin"),disableWindowBlurListener:u("disableWindowBlurListener"),autoHideDuration:u("autoHideDuration"),hideIconVariant:u("hideIconVariant"),TransitionComponent:u("TransitionComponent"),transitionDuration:u("transitionDuration"),TransitionProps:u("TransitionProps",!0),iconVariant:u("iconVariant",!0),style:u("style",!0),SnackbarProps:u("SnackbarProps",!0),className:Ke(t.props.className,g.className)});return m.persist&&(m.autoHideDuration=void 0),t.setState(function(b){if(d===void 0&&t.props.preventDuplicate||d){var S=function(k){return y?k.id===p:k.message===f},x=b.queue.findIndex(S)>-1,h=b.snacks.findIndex(S)>-1;if(x||h)return b}return t.handleDisplaySnack(ue({},b,{queue:[].concat(b.queue,[m])}))}),p},t.handleDisplaySnack=function(r){return r.snacks.length>=t.maxSnack?t.handleDismissOldest(r):t.processQueue(r)},t.processQueue=function(r){var s=r.queue,c=r.snacks;return s.length>0?ue({},r,{snacks:[].concat(c,[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,c=!1;r.snacks.reduce(function(l,d){return l+(d.open&&d.persist?1:0)},0)===t.maxSnack&&(c=!0);var f=r.snacks.map(function(l){return s||l.persist&&!c?ue({},l):(s=!0,l.entered?(l.onClose&&l.onClose(null,"maxsnack",l.id),t.props.onClose&&t.props.onClose(null,"maxsnack",l.id),ue({},l,{open:!1})):ue({},l,{requestClose:!0}))});return ue({},r,{snacks:f})},t.handleEnteredSnack=function(r,s,c){if(!qt(c))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState(function(f){return{snacks:f.snacks.map(function(l){return l.id===c?ue({},l,{entered:!0}):ue({},l)})}})},t.handleCloseSnack=function(r,s,c){t.props.onClose&&t.props.onClose(r,s,c);var f=c===void 0;t.setState(function(l){var d=l.snacks,g=l.queue;return{snacks:d.map(function(y){return f||y.id===c?y.entered?ue({},y,{open:!1}):ue({},y,{requestClose:!0}):ue({},y)}),queue:g.filter(function(y){return y.id!==c})}})},t.closeSnackbar=function(r){var s=t.state.snacks.find(function(c){return c.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(c){var f=t.processQueue(ue({},c,{snacks:c.snacks.filter(function(l){return l.id!==s})}));return f.queue.length===0?f:t.handleDismissOldest(f)})},t.enqueueSnackbar,t.closeSnackbar,t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar.bind(ca(t)),closeSnackbar:t.closeSnackbar.bind(ca(t))}},t}return zr(i,a),i.prototype.render=function(){var o=this,t=this.state.contextValue,r=this.props,s=r.domRoot,c=r.children,f=r.dense,l=f!==void 0&&f,d=r.Components,g=d===void 0?{}:d,y=r.classes,p=this.state.snacks.reduce(function(m,b){var S,x=mn(b.anchorOrigin),h=m[x]||[];return ue({},m,((S={})[x]=[].concat(h,[b]),S))},{}),u=Object.keys(p).map(function(m){var b=p[m],S=b[0];return n.createElement(as,{key:m,dense:l,anchorOrigin:S.anchorOrigin,classes:y},b.map(function(x){return n.createElement(os,{key:x.id,snack:x,classes:y,Component:g[x.variant],onClose:o.handleCloseSnack,onEnter:o.props.onEnter,onExit:o.props.onExit,onExited:It([o.handleExitedSnack,o.props.onExited],x.id),onEntered:It([o.handleEnteredSnack,o.props.onEntered],x.id)})}))});return n.createElement(Hr.Provider,{value:t},c,s?et.createPortal(u,s):u)},Lr(i,[{key:"maxSnack",get:function(){return this.props.maxSnack||Qe.maxSnack}}]),i})(n.Component),Gr=function(){return n.useContext(Hr)};class Xr{constructor(){this._loadedIO=null}async _loadIO(){let i=this._loadedIO;if(i)return i;try{i=(await import("@sheetxl/io")).WorkbookIO,this._loadedIO=i}catch(o){throw o}return i}async getReadFormats(i){return(await this._loadIO()).getReadFormats(i)}async getWriteFormats(i){return(await this._loadIO()).getWriteFormats(i)}async writeArrayBuffer(i,o){return(await this._loadIO()).writeArrayBuffer(i,o)}async read(i,o){let t,r;try{r=await o?.showBusy?.(`Opening${i.name?` ${i.name}`:""}...`);const s=await this._loadIO(),c=await s.read({...i,progress:{async onStart(f){await i?.progress?.onStart?.(f),t=await o?.showBusy?.(`Opening '${f}'...`)}}});return r?.(),t?.(),c}catch(s){throw r?.(),t?.(),s}}async writeFile(i,o,t){return(await this._loadIO()).writeFile(i,o,t)}async registerReadFormat(i){return(await this._loadIO()).registerReadFormat(i)}async registerWriteFormat(i){return(await this._loadIO()).registerWriteFormat(i)}async getAllReadFormatsAsString(){const i=await this._loadIO(),o=await i.getReadFormats(),t=[],r=o.length;for(let s=0;s<r;s++){const c=o[s].exts,f=c.length;for(let l=0;l<f;l++)t.push("."+c[l])}return t.join(", ")}}const Ve=new Xr,Le={card:"_card_1a398_7",actionRoot:"_actionRoot_1a398_11",icons:"_icons_1a398_16",expand:"_expand_1a398_22",expandOpen:"_expandOpen_1a398_29",stackTraceContainer:"_stackTraceContainer_1a398_33"},Yr=n.memo(n.forwardRef((a,i)=>{const{id:o,message:t,iconVariant:r,error:s,hideIconVariant:c,...f}=a,{closeSnackbar:l}=Gr(),d=X.useTheme(),[g,y]=n.useState(!1),p=je.ErrorUtils.collectErrorChain(s,!0)?.[0]?.error,u=p&&!(p instanceof je.ExpectedError),m=n.useCallback(()=>{y(x=>!x)},[]),b=n.useCallback(()=>{l(o)},[o,l]);let S=p?.message;return!S&&n.isValidElement(t)&&(S=t),S||typeof t!="string"||(S=t),S||(S=`Unknown Error: ${t}`),e.jsx(fn,{ref:i,className:se(Le.root,"error-snackbar"),children:e.jsxs(B.Card,{className:Le.card,style:{backgroundColor:d.palette.error.dark,border:`1px solid ${d.palette.error.dark}`},children:[e.jsxs(B.CardActions,{className:Le.actionRoot,children:[c?null:r?.error,e.jsx(B.Typography,{variant:"body2",component:"div",className:Le.typography,children:S}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Le.icons,children:[u?e.jsx(B.IconButton,{"aria-label":"Show more",size:"small",className:se(Le.expand,{[Le.expandOpen]:g}),onClick:m,children:e.jsx(w.DynamicIcon,{iconKey:"ExpandMore"})}):null,e.jsx(B.IconButton,{size:"small",className:Le.expand,onClick:b,children:e.jsx(w.DynamicIcon,{iconKey:"Close",style:{transform:"scale(0.8)"}})})]})]}),u?e.jsx(B.Collapse,{in:g,timeout:"auto",children:e.jsx("div",{className:Le.stackTraceContainer,style:{backgroundColor:d.palette.error.light,borderTop:`1px solid ${d.palette.error.main}`},children:e.jsx(C.StackTrace,{error:s,hideLineNumbers:!0})})}):null]})})}));Yr.displayName="ToastError";const Zr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="workbook",disabled:s=!1,...c}=a,[f,l]=n.useState([]);n.useEffect(()=>{let y=!0;return Ve.getWriteFormats().then(p=>{y&&l(p)}),()=>{y=!1}},[]);const d=w.useCallbackRef(y=>{const p={variant:w.CommandButtonType.Menuitem,parentFloat:y.floatReference,commandHook:t,scope:r,disabled:s},u=e.jsxs(e.Fragment,{children:[e.jsx(C.CommandButton,{...p,command:o.getCommand("newWorkbook")}),e.jsx(C.ExhibitDivider,{orientation:"horizontal"}),e.jsx(C.CommandButton,{...p,command:o.getCommand("openWorkbook")}),e.jsx(C.CommandPopupButton,{...p,commands:o,quickCommand:"saveWorkbook",createPopupPanel:m=>{const b={...p,parentFloat:m.floatReference,scope:"saveWorkbook"},S=[];return f.forEach(x=>{if(x.isDefault)return;const h=x.key,k=o.getCommand(`saveWorkbookAs${h}`);k?S.push(n.createElement(C.CommandButton,{...b,key:h,command:k})):console.warn(`Unable to resolve command: 'saveWorkbookAs${h}'`)}),C.defaultCreatePopupPanel({...m,children:S,onClick:()=>{m.closeFloatAll()}})}})]});return C.defaultCreatePopupPanel({...y,children:u,onClick:m=>{m.isDefaultPrevented||y.closeFloatAll()}})},[s,o,t,r,f]),g="File";return e.jsx(C.CommandPopupButton,{commands:o,disabled:s,commandHook:t,scope:r,label:g,tooltip:"Options for saving and loading the workbook.",sx:{paddingBottom:"0px","& button":{paddingTop:"0px",paddingBottom:"0px",height:y=>`calc(1.25rem + ${y.spacing(2)}px)`}},...c,createPopupPanel:d,icon:e.jsx(C.LabelIcon,{className:"label",icon:null,label:g})})}));Zr.displayName="StandaloneFileCommandButton";const is=e.jsx(C.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"}})})}),Qr=n.memo(n.forwardRef((a,i)=>{const{commands:o,workbook:t,logo:r=is,mainElement:s,showFileMenu:c=!0,showAppearanceMenu:f=!0,...l}=a,{reference:d}=C.useFloatStack(),[g,{width:y}]=_e(),p=y<530,u=c?e.jsx(Zr,{commands:o,commandHook:{beforeExecute(){d?.closeAll()},onError(x,h,k){}}}):null,m=f?e.jsx(Dr,{commands:o,commandHook:{beforeExecute(){d?.closeAll()},onError(x,h,k){}}}):null,b=n.useMemo(()=>({paddingLeft:x=>x.spacing(1),paddingRight:x=>x.spacing(1)}),[]),S=n.useRef(null);return e.jsx(B.Box,{ref:tt([S,g,i]),...l,children:kr({commands:o,renderCompact:p,workbook:t,selectWrapper:x=>e.jsxs(B.Box,{sx:{display:"flex",flex:"1",flexDirection:"row",alignItems:"stretch",gap:h=>h.spacing(1),paddingLeft:h=>h.spacing(1),paddingRight:h=>h.spacing(1)},children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:h=>h.spacing(.5)},children:[r,e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:h=>h.spacing(.25)},children:[u,x]})]}),e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 300%",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:s}),e.jsx(B.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"end",flex:p&&!m?"0 0 auto":"1 1 100%"},children:m})]}),selectProps:b,toolbarsProps:{Home:{sx:{}}}})})}));Qr.displayName="StudioToolbar";const Jr=n.memo(a=>{const{workbook:i,setWorkbook:o,refWorkbookTitle:t,titleWorkbook:r,setWorkbookTitle:s,titlePlaceHolder:c,children:f,undoManager:l,commands:d,importExportDisabled:g,themeOptions:y}=a,p=(b=>{const{workbook:S,setWorkbook:x,importExportDisabled:h,workbookTitle:k="export",setWorkbookTitle:j,requestWorkbookTitle:v,themeOptions:T,undoManager:M,commands:P,onExecute:I}=b,D=w.useNotifier(),E=w.useCallbackRef(T?.onModeChange,[T?.onModeChange]),R=w.useCallbackRef(T?.onEnabledDarkGridChange,[T?.onEnabledDarkGridChange]),N=w.useCallbackRef(T?.onEnabledDarkImagesChange,[T?.onEnabledDarkImagesChange]),z=w.useCallbackRef(async(W=null,U=null)=>{const H=[];let G,ie=null,re=null;if(typeof W=="string"?re=W:ie=W,G=ie?W:await je.CommonUtils.openFileDialog(re??await Ve.getAllReadFormatsAsString()),!G)return null;const le={source:G,createWorkbookOptions:U,onWarning:ge=>{H.push(ge)}},Se=await Ve.read(le,D);return H.length>0&&(D.showMessage("Some elements were not able to be imported. See console for details."),console.warn(`Import warnings:
|
|
19
|
-
`+H.join(`
|
|
20
|
-
`))),Se},[I,D,S]),O=w.useCallbackRef(async(W,U,H)=>{if(!U&&v){const G=await v("Enter Workbook name to "+(H?.isDefault?"Save.":`Export as ${H?.description}.`));return G!==null&&Ve.writeFile(G,W,{format:H.key})}return Ve.writeFile(U,W,{format:H.key})},[D,S,v]),L=n.useCallback(()=>({contains:W=>!0,focus(){}}),[]),[F,$]=n.useState([]);n.useEffect(()=>{h?$([]):(async()=>{const W=[];(await Ve.getWriteFormats()).forEach(U=>{const H=U.isDefault,G={label:H?"Save Workbook":`Save Workbook as ${U.description}`,scopedLabels:{workbook:"Save",saveWorkbook:`as ${U.description}`},tags:U.tags,description:`Save the workbook to the desktop${H?"":` as ${U.description}`}.`,icon:"FileDownloadAsSheet"};H&&(G.shortcut={key:"S",modifiers:[w.KeyModifiers.Ctrl]},W.push(new w.Command("saveWorkbookAs",L,{label:"Save Workbook As…",scopedLabels:{workbook:"Save as…",saveWorkbook:"as…"},shortcut:[{key:"S",modifiers:[w.KeyModifiers.Shift,w.KeyModifiers.Ctrl]},{key:"F12"}],description:"Save the workbook to the desktop with the provided name."},()=>{O(S,null,U).catch(le=>{D.showError(le)})})));const ie=U.key,re=H?"saveWorkbook":`saveWorkbookAs${ie}`;ie==="CSV"?G.icon="FileDownloadAsCSV":ie==="Excel"&&(G.icon="FileDownloadAsExcel"),W.push(new w.Command(re,L,G,le=>{O(S,le??k,U).catch(Se=>{D.showError(Se)})}))}),W.push(new w.Command("openWorkbook",L,{label:"Open Workbook…",scopedLabels:{workbook:"Open…"},description:"Open a workbook from the desktop.",icon:"FileOpen",shortcut:{key:"O",modifiers:[w.KeyModifiers.Ctrl]}},async(U=null)=>{const H={date1904:S.isDate1904(),...S.options};try{const G=await z(U,H);if(!G)return;const ie=G.title,re=G.workbook,le=re.getSelectedSheet();if(G.format.mimeType==="text/csv"){const Se=S.findValidSheetName(ie);await S.doBatch(async()=>{const ge={colStart:0,rowStart:0,colEnd:0,rowEnd:0};let Z=le.getUsedRange();if(!Z)return void D.showMessage("The file appears to be blank.");Z=Z.getUnion(ge),await S.getSheets().add({name:Se,autoSelect:!0}).getRange(ge).copyFrom(Z)},`Import CSV '${ie}'`)}else S?.close(),j?.(ie),x(re)}catch(G){D.showError(G)}})),W.push(new w.Command("openWorkbookFromUrl",L,{label:"Open Workbook From Web",scopedLabels:{insert:"From Web",workbook:"From Web…"},description:"Open a workbook from the web."},async function(U){if(!U){const H=await D.showInput({title:"Open Workbook from the Web",description:"Enter the web address for the workbook to open.",inputLabel:"Address",initialValue:"https://www.sheetxl.com/examples/features-checklist.xlsx",inputProps:{style:{minWidth:"440px"}},options:["Open"]});if(H.option!=="Open")return;U=H.input}U&&console.log("openWorkbookFromUrl",U)})),$(W)})()},[h,D,S,k]);const Q=n.useMemo(()=>{let W=[];return T&&(W=[new w.Command("themeMode",L,{label:"Light/Dark Mode",scopedLabels:{appearance:"Light/Dark Mode"},description:"Toggle the application styling between light and dark mode."}),new w.Command("defaultThemeMode",L,{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",L,{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",L,{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."})]),[...W,new w.SimpleCommand("help",L,{label:"Show Help",description:"Provide Help.",icon:"Documentation",shortcut:{key:"F1"}},()=>{}),new w.SimpleCommand("showKeyboardShortcuts",L,{label:"Keyboard Shortcuts",description:"Show keyboard shortcuts.",icon:"Keyboard",shortcut:{key:"/",modifiers:[w.KeyModifiers.Ctrl]}},()=>{}),new w.Command("gotoUrlGithub",L,{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",L,{label:"Discord",description:"Join our community on discord.",icon:"Discord"},()=>{window?.open("https://discord.gg/NTKdwUgK9p")}),new w.Command("gotoUrlDocumentation",L,{label:"Documentation",description:"Read the documentation.",icon:"Documentation"},()=>{window?.open("https://www.sheetxl.com/docs")}),new w.Command("gotoUrlIssue",L,{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,D,h,T]),Y=n.useMemo(()=>[...Q,...F],[Q,F]),te=n.useMemo(()=>{let W=null;return W=P?P.createChildGroup(L,"standaloneWorkbook",!1):new w.CommandGroup(L,"standaloneWorkbook"),W.addCommands(Y,!0),W},[P,Q,F]);w.useUndoManager({manager:M,commands:te});const K=B.useMediaQuery("(prefers-color-scheme: dark)"),{themeMode:q}=C.useResolvedThemeMode();n.useEffect(()=>{if(!T||!te)return;const W=T.mode==="dark"||!T.mode&&q==="dark";te.getCommand("themeMode").update({state:T.mode??null,label:W?"Dark Mode":"Light Mode",scopedLabels:{appearance:W?"Dark Mode":"Light Mode"},icon:W?"DarkMode":"LightMode"}).updateCallback(()=>{E(W?C.ThemeMode.Light:C.ThemeMode.Dark)}),te.getCommand("defaultThemeMode").update({state:!T.mode,icon:K?"SystemDefaultDarkMode":"SystemDefaultLightMode"}).updateCallback(()=>{E(null)}),te.getCommand("enableDarkGrid").update({state:T.enableDarkGrid}).updateCallback(()=>{R(!T.enableDarkGrid)}),te.getCommand("enableDarkImages").update({state:T.enableDarkImages}).updateCallback(()=>{N(!T.enableDarkImages)})},[q,T,Y]);const{showModal:ne}=C.useModal();return n.useEffect(()=>{const W=()=>new Promise((U,H)=>{const G=n.lazy(()=>Promise.resolve().then(()=>require("./DeVzYeQ2NQw772Pw.cjs"))),ie=ne(G,{title:"Shortcut Keys Reference",commands:te,onDone:()=>{ie.hide()},slotProps:{transition:{onExited:()=>{U(!0)}}}})});te.getCommand("showKeyboardShortcuts").updateCallback(()=>W()),te.getCommand("help").updateCallback(()=>W())},[Y,te]),te})({workbook:i,setWorkbook:o,importExportDisabled:g,workbookTitle:r,setWorkbookTitle:s,commands:d,requestWorkbookTitle:b=>new Promise(S=>{t.current?t.current.requestWorkbookTitle((x,h)=>{S(x)},{selectAll:!0,requestReason:b}):S(c)}),themeOptions:y,undoManager:l,onExecute:n.useCallback(()=>{},[])}),u=n.useMemo(()=>e.jsx(Fr,{commands:p,disableHover:!0,sx:{padding:"0"},buttonProps:{sx:{maxHeight:"22px"}}}),[p]),m={commands:p};return i&&(m.statusBarProps={childrenEnd:u}),f?n.cloneElement(f,m):null});Jr.displayName="CommandsWrapper";const ei=n.memo(a=>{const{children:i}=a,o=Gr(),t=o?o.enqueueSnackbar:()=>{},r=o?o.closeSnackbar:()=>{},[s,c]=n.useState({isMounted:!1,label:null,starting:new Map,running:new Map}),f=n.useCallback(()=>{c(x=>({...x,isMounted:!0}))},[]),l=n.useCallback(()=>{c(x=>({...x,isMounted:!1}))},[]),d={},g=C.useLazyWindow(d),y=C.useOptionsDialog(d),p=C.useInputDialog(d),u=n.useRef(new Set),m=n.useMemo(()=>{const x=(j,v)=>{if(v?.onceKey){if(u.current.has(v.onceKey))return;const M=new Set(u.current);M.add(v.onceKey),u.current=M}const T={variant:v?.type??w.NotifierType.Info,anchorOrigin:{vertical:"top",horizontal:"center"},preventDuplicate:v?.preventDuplicate,persist:v?.persist??v?.type===w.NotifierType.Error,action:M=>e.jsx(B.IconButton,{onClick:()=>r(M),children:e.jsx(w.DynamicIcon,{iconKey:"Cancel"})})};v?.enqueueProps&&Object.assign(T,v.enqueueProps),j||console.log("message is 'null'",v),t(j??"Alert",T)},h={showMessage:x,showBusy:(j,v)=>{let T=null;const M=new Promise(P=>{T=P});return c(P=>{const I=new Map(P.starting);return I.set(M,T),{...P,label:j,starting:I}}),M},showWindow:(j,v)=>{const T=v;return v={...v,onKeyDown:M=>{M.isDefaultPrevented()||M.isPropagationStopped()||T?.onKeyDown?.(M)}},g(j,{sort:()=>Promise.resolve().then(()=>require("./DdfZbPGZ8PPPUM_a.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./BGM5Egsh-nk8JoMR.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./bHc9WXWuOLgCy20D.cjs")),comments:()=>Promise.resolve().then(()=>require("./O0u5_8LdiNZxf7nW.cjs")),find:()=>Promise.resolve().then(()=>require("./CDa5R5H06f0QGbLy.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./DQDHzkk3uE69oOf1.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./DLI8Ew9QZfYFQggZ.cjs")),resizeHeader:()=>Promise.resolve().then(()=>require("./CRfQidmKBQ4Osnbw.cjs"))}[j],v)},showOptions:y,showInput:p,showError:j=>{let v,T=w.NotifierType.Error,M="Unknown Error";typeof j=="string"?M=j:j instanceof Error&&(v=j,j.message&&(M=j.message)),j instanceof je.PartialError&&(T=w.NotifierType.Info),x(M,{type:T,enqueueProps:{error:v}})}},k=new w.DefaultReactNotifier;return k.setOverrides(h),k},[]);n.useEffect(()=>{s.starting.size<=0||!s.isMounted||c(x=>{const h=new Map(x.running);return x.starting.forEach((k,j)=>{const v=()=>{c(T=>{const M=new Map(T.running);return M.delete(j),{...T,running:M}})};h.set(j,v),k(v)}),{...x,starting:new Map,running:h}})},[s]);const[b,S]=n.useState(null);return n.useEffect(()=>{s.starting.size!==0||s.running.size!==0?S(e.jsx(C.LoadingPanel,{icon:e.jsx(C.AnimatedTraversingEllipsisIcon,{sx:{transform:"scale(0.7)",marginLeft:"-6px"}}),panel:!0,label:s.label,onMount:f,onUnmount:l,sx:{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",zIndex:"9999"}})):S(null)},[s.starting,s.running]),e.jsxs(w.NotifierProvider,{notifier:m,children:[b,i]})});ei.displayName="SnackbarWrapper";const ls=n.memo(n.forwardRef((a,i)=>{const{children:o,title:t,taskPanes:r,onSelect:s,selected:c,registry:f=oe.DefaultTaskPaneRegistry,style:l,iconsOnly:d,className:g,...y}=a,p=n.useMemo(()=>r.map(b=>{const S=f.getRegisteredTaskPane(b);if(!S)return null;let x=S.getIcon?.();x&&(typeof x=="string"&&(x=e.jsx(w.DynamicIcon,{iconKey:x})),x=e.jsx("span",{style:{display:"inline-block",transform:"rotate(90deg)",transformOrigin:"center"},children:x}));const h=b===c;return e.jsx(B.Tab,{value:b,label:e.jsx(C.SimpleTooltip,{disableInteractive:!0,title:S.getTitle()??"",placement:"left-start",children:e.jsxs(B.Box,{sx:{padding:"0px 0px",writingMode:"vertical-rl",textOrientation:"mixed",display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:"0px",color:k=>k.palette.text.secondary},children:[x&&e.jsx(B.Box,{sx:{display:"inline-block",transformOrigin:"center",color:k=>k.palette.text.secondary},children:x}),d&&x?null:e.jsx(B.Typography,{component:"div",textTransform:"none",sx:{padding:"4px 0px",color:k=>h?k.palette.primary.main:k.palette.text.secondary},children:S.getTitle()})]})}),sx:{padding:"4px 4px",minWidth:"0px",minHeight:"0px",borderRadius:"4px"},className:se("taskpane-strip-item",{"Mui-selected":h}),onClick:()=>a.onSelect(b)},b)}),[r,c,s,f]),u=w.useImperativeElement(i,()=>({isTaskPaneStrip:()=>!0}),[]),m=n.useMemo(()=>se("taskpane-strip",g),[g]);return e.jsx(B.Box,{ref:u,className:m,sx:{paddingLeft:"2px",paddingTop:"4px",...l},...y,children:e.jsx(B.Tabs,{orientation:"vertical",variant:"scrollable",value:c,onChange:(b,S)=>{s(S)},slotProps:{list:{sx:{gap:"2px"}},indicator:{sx:{left:"0px",right:"unset"}}},children:p})})})),ss=(a,i)=>e.jsx(ls,{ref:i,...a}),cs=n.forwardRef((a,i)=>{const{commands:o,model:t,...r}=a,s=X.useTheme(),c=`solid ${X.alpha(s.palette.divider,.2)} 1px`,f=`${s.shape.borderRadius??4}px`,l=`${s.spacing?.(.5)??4}px`,d=n.useRef(null);return e.jsx(oe.TaskPaneArea,{model:t,ref:i,frameProps:{style:{border:c,borderRadius:f,marginBottom:l}},alwaysShowStrip:!0,renderTaskPanelTitle:(g,y)=>{const{title:p,icon:u,onClose:m,readOnly:b,focused:S,...x}=g;return e.jsx(B.DialogTitle,{className:se({"Mui-selected":S}),sx:{display:"flex",flex:"1 1 %0",color:h=>h.palette.text.secondary,boxSizing:"border-box",padding:"0 0",transitionProperty:"opacity",transitionDuration:h=>`${h.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:h=>h.transitions.duration.shortest/2+"ms"},backgroundColor:h=>X.alpha(h.palette.action.hover,.03),borderBottom:h=>`solid ${X.alpha(h.palette.divider,.2)} 1px`},...x,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 10%",flexDirection:"row",alignItems:"center",marginTop:h=>h.spacing(.25),marginBottom:h=>h.spacing(.25),marginLeft:h=>h.spacing(1),marginRight:h=>h.spacing(1)},children:[e.jsx(B.Box,{sx:{flex:"1 1 100%",paddingLeft:h=>h.spacing(1)},children:p}),e.jsx(C.ExhibitTooltip,{label:"Close",children:e.jsx(B.IconButton,{"aria-label":"close",sx:{color:h=>h.palette.text.icon??h.palette.action.active},touchRippleRef:d,onPointerDown:h=>{d.current?.start(h,{center:!1}),h.stopPropagation(),h.preventDefault()},onPointerUp:()=>{m()},children:e.jsx(w.DynamicIcon,{iconKey:"Close"})})})]})})},renderTaskPaneStrip:ss,...a,onOpen:()=>{a?.onOpen?.()},onClose:()=>{a?.onClose?.()},commands:o,...r})}),Sa={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},ti=n.memo(n.forwardRef((a,i)=>{const{mainElement:o,sidebarElement:t,className:r,style:s,...c}=a,f=X.useTheme(),[l,{width:d}]=_e(),g=d>530||d===0,y=n.useRef(null);let p=null,u=4,m=13;return g?p="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":(p="M 1.59991,3.62619 C 0.71626,3.62619 0,2.90992 0,2.02628 0,1.1426301 0.71626,0.42623015 1.59991,0.42623015 c 0.88365,0 1.6000508,0.71639995 1.6000508,1.60004985 0,0.88364 -0.7164008,1.59991 -1.6000508,1.59991 m 4.881294,0 c -0.88364,0 -1.60004,-0.71627 -1.60004,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60004,-1.60004985 0.88365,0 1.60005,0.71639995 1.60005,1.60004985 0,0.88364 -0.7164,1.59991 -1.60005,1.59991 m 4.881226,0 c -0.88365,0 -1.60005,-0.71627 -1.60005,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60005,-1.60004985 0.88365,0 1.59991,0.71639995 1.59991,1.60004985 0,0.88364 -0.71626,1.59991 -1.59991,1.59991",u=13,m=4),e.jsx(w.SplitPane,{ref:tt([y,l,i]),className:r,style:s?{...Sa,...s}:Sa,...c,fixedPane:"after",position:"40%",minAfter:g?"280px":"120px",splitDirection:g?"row":"column",resizerProps:{className:"styled-resizer",style:{minWidth:g?"6px":void 0,minHeight:g?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${u}' height='${m}' viewBox='0 0 ${u} ${m}' version='1.1' fill='${f.palette.text.icon??f.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${p}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:g?"left center":"top center"}},elementBefore:o,paneBeforeProps:{style:{flexDirection:"column",marginRight:t?void 0:"6px"}},elementAfter:t,paneAfterProps:{style:{marginLeft:g?"0px":"4px",marginRight:g?"8px":"4px"}}})}));ti.displayName="StudioSplitPane",Pr(),w.DefaultDynamicIconService.register("plugin-scripts",{icons:{}}),oe.DefaultTaskPaneRegistry.registerTaskPane({key:"scriptEditor",getTitle:()=>"Script (Typescript)",getIcon:()=>"ScriptRun",renderTaskPane:cl},!0);const ro=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,style:r,onElementLoad:s,onError:c,undoManager:f,errorPanel:l=C.ErrorPanel,onKeyDown:d,workbook:g,createWorkbookOptions:y,onWorkbookChange:p,logo:u,importExportDisabled:m=!1,themeOptions:b,autoFocus:S=!1,commands:x,title:h,onTitleChange:k,titleProps:j,renderLoadingPanel:v,...T}=a,M=n.useRef(null),P=w.useCallbackRef(p,[p]),I=w.useCallbackRef(k??j?.onTitleChange,[k??j?.onTitleChange]),D=j?.placeHolder??"Untitled",E=b?.mode,{themeMode:R,source:N}=C.useResolvedThemeMode({mode:E}),z=n.useMemo(()=>({...b,light:C.createExhibitTheme(!1,je.CommonUtils.deepMerge(b?.theme??{},b?.light??{})),dark:C.createExhibitTheme(!0,je.CommonUtils.deepMerge(b?.theme??{},b?.dark??{}))}),[b]),O=R===C.ThemeMode.Dark,[L,F]=n.useState(null);n.useEffect(()=>{F(f??new je.UndoManager)},[f]);const[$,Q]=n.useState(null),[Y,te]=n.useState(null),K=oe.useDocThemes();n.useLayoutEffect(()=>{if(!g||Object.keys(g).length===0&&!je.CommonUtils.isPromiseLike(g)){const J={theme:K.getDefaultTheme(),...y};te(new A.Workbook(J))}else te(g)},[g]),n.useLayoutEffect(()=>{if(Y){if(Y instanceof A.Workbook)return Q({workbook:Y}),void(g!==Y&&P?.(Y));(async()=>{try{let J,ce=await Promise.resolve(Y);ce&&ce.source&&(ce=await Ve.read(ce)),ce.workbook?(H(ce.title),J=ce.workbook):J=ce,P?.(J),Q({workbook:J})}catch(J){P?.(null),Q({error:J})}})()}},[Y]);const[q,ne]=n.useState(null);n.useEffect(()=>{if(!L||!$)return;L.clear();const J=$?.workbook?.getTransactions();if(J)return J.addListener({onCommitEnd:ce=>{ce.getDescription()?L.addUndoOperation({description:ce.getDescription(),undo:()=>(J.revert(ce.getId()),q.source?.focus(),()=>{J.restore(ce.getId()),q.source?.focus()})}):console.warn("commit has no description",ce)}})},[L,$,q]);const W=w.useCallbackRef(J=>{J?L.setRepeatableOperation({description:J.label(),repeat:async()=>J.execute()}):L.setRepeatableOperation(null)},[L]),[U,H]=n.useState(h??j?.title??"");n.useEffect(()=>{H(h??j?.title??"")},[h??j?.title]),n.useEffect(()=>{I?.(U)},[U]);const[G,ie]=n.useState(null),re=n.useMemo(()=>{const J=()=>({contains:ce=>!0,focus(){}});return x?x.createChildGroup(J,"application",!1):new w.CommandGroup(J,"application")},[x]),le=w.useCallbackRef(async J=>{ie(J.source.getViewportElement()),ne(J),re.activate("sheet"),await w.DefaultDynamicIconService.prefetch(),s?.(J)},[re]);n.useEffect(()=>{q&&S&&q.source?.focus(typeof S=="object"?S:void 0)},[q]);const Se=n.useRef(null),ge=n.useCallback(J=>{let ce=null;return j?.hidden||(ce=e.jsx(sn,{...j,style:{maxWidth:"100%",...j?.style},workbook:M.current,ref:Se,title:U,placeHolder:D,onTitleChange:Ue=>{H(Ue)}})),e.jsx(Qr,{...J,logo:u,mainElement:ce,showFileMenu:!m,showAppearanceMenu:!!(z?.onEnabledDarkGridChange||z?.onEnabledDarkImagesChange||z?.onModeChange)})},[u,U,j,z,m,re]);n.useEffect(()=>{const J=ce=>ce.preventDefault();return M.current?.addEventListener("wheel",J,{passive:!1}),()=>{M.current?.removeEventListener("wheel",J)}},[]);const Z=n.useMemo(()=>{const J={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?.(J)??e.jsx(C.LoadingPanel,{...J})})},[t,r,v]),_=n.useCallback(({error:J})=>(c?.(J),e.jsx(l,{sx:t,style:r,error:J??"Unable to display empty workbook."})),[t,r,c]),ee=n.useMemo(()=>({...t,"& .SnackbarContainer-root":{position:"absolute !important"},"& .notistack-SnackbarContainer > div":{maxWidth:"100%"},"& .notistack-Snackbar":{minWidth:"unset"},"& .notistack-Snackbar > .error-snackbar .MuiTypography-root":{color:J=>J.palette.getContrastText(J.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiCardActions-root":{color:J=>J.palette.getContrastText(J.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root":{color:J=>J.palette.getContrastText(J.palette.error.main)},"& .notistack-MuiContent *":{fontFamily:J=>J.typography.fontFamily},"& #notistack-snackbar":{maxWidth:"560px",whiteSpace:"pre-wrap"},"*":{userSelect:"none"}}),[t]),[me,ve]=n.useState(null),de=n.useCallback((J,ce)=>e.jsx(cs,{ref:ce,model:Y,commands:re,...J}),[re,Y]),Fe=n.useCallback(J=>e.jsx(ti,{mainElement:J,sidebarElement:me}),[me]),Ee=tt([M,i]),Oe=n.useMemo(()=>{if(!$)return Z;if($.error||!$.workbook)return _({error:$.error});let J=null,ce=null,Ue=!1;return z&&(J=O?z.dark:z.light,ce=O&&z.enableDarkGrid?z.dark:z.light,Ue=z.enableDarkImages),e.jsx(ln,{sx:ee,style:r,tabIndex:0,autoFocus:!0,workbook:$.workbook,ref:Ee,renderToolbar:ge,onElementLoad:le,onRepeatCommandChange:W,onKeyDown:gt=>{d?.(gt)},renderLoadingPanel:v,gridTheme:ce,headersTheme:J,enableDarkImages:Ue,mainWrapper:Fe,className:se(o),onContextMenu:gt=>gt.preventDefault(),...T},"WorkbookElement")},[$,U,L,Z,v,z,T,ge,ee,Fe]);let pe=e.jsx(rs,{maxSnack:3,domRoot:G,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(J,ce,Ue)=>{M.current?.focus()},Components:{error:Yr},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:de,onUpdateArea:J=>{ve(J)},children:e.jsx(C.ModalProvider,{children:e.jsx(ei,{children:e.jsx(w.UncaughtErrorBoundary,{children:e.jsx(w.ReactErrorBoundary,{children:e.jsx(Jr,{workbook:$?.workbook,setWorkbook:te,importExportDisabled:m,titlePlaceHolder:D,titleWorkbook:U,setWorkbookTitle:H,refWorkbookTitle:Se,commands:re,undoManager:L,themeOptions:z,children:Oe})})})})})})});return z&&(pe=e.jsxs(X.ThemeProvider,{theme:O?z.dark:z.light,children:[z.cssBaseline?e.jsx(B.CssBaseline,{}):null,pe]})),pe}));ro.displayName="EagerStudio";const ds=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:ro,default:ro},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=Dr,exports.AutoColorPosition=pt,exports.BorderCommandButton=Da,exports.BorderPopupButton=Ma,exports.BorderStylePopupButton=Pa,exports.CellsDeleteCommandButton=Ho,exports.CellsFormatCommandButton=Wo,exports.CellsInsertCommandButton=zo,exports.Checkboard=Ba,exports.ClearCommandButton=Lo,exports.ColorButton=io,exports.ColorButtonList=Dt,exports.ColorCommandButton=ht,exports.ColorPanel=Ra,exports.ColorPanelType=Ta,exports.ColorPopupButton=Ao,exports.DocThemeCommandButton=Mr,exports.EagerStudio=ro,exports.FillCommandButton=La,exports.FilterColumnMenu=Jo,exports.FilterCommandButton=Vi,exports.Filters=sr,exports.FindCommandButton=Na,exports.FontFamilyCommandButton=Wa,exports.FontSizeCommandButton=Oa,exports.FormulaBar=Qo,exports.FreezeCommandButton=Ia,exports.HelpCommandButton=Fr,exports.HorizontalAlignCommandButton=ka,exports.InsertFunctionCommandPopupButton=Ir,exports.InsertFunctionSumCommandPopupButton=un,exports.InsertImageCommandButton=dn,exports.MergeCommandButton=Fa,exports.NamedCollectionEditor=Zo,exports.NamedInput=Uo,exports.NumberFormatCommandButton=Aa,exports.PasteCommandButton=_o,exports.PresetCellStylesCommandButton=qa,exports.PresetTableStylesCommandButton=cn,exports.RangeInput=qo,exports.SheetTab=en,exports.SheetTabMenu=tn,exports.SheetZoomScale=Go,exports.SheetsAllMenu=on,exports.SortFilterCommandButton=$o,exports.StatusBar=Xo,exports.Studio=Nr,exports.StyledStrokeIcon=Mo,exports.TableDetailsPanel=Br,exports.TableDetailsTaskPane=Rr,exports.TablePlugin=Pr,exports.TableStyleCanvasPreview=Xa,exports.TableStyleOptionsPanel=Ya,exports.TableStylePreview=Ko,exports.TextEffectsCommandButton=$a,exports.TextOverflowCommandButton=ja,exports.TextRotateCommandButton=Ea,exports.ThemeSelectButton=er,exports.ThemeSelectPanel=tr,exports.ThemeSelectPopupButton=or,exports.UnderlineCommandButton=Va,exports.UndoRedoCommandButton=Vo,exports.VerticalAlignCommandButton=va,exports.ViewGridLinesCommandButton=za,exports.ViewHeadingsCommandButton=_a,exports.WalkingCopyCommandButton=so,exports.WorkbookContextMenu=rn,exports.WorkbookElement=ln,exports.WorkbookIO=Ve,exports.WorkbookStrip=an,exports.WorkbookTitle=sn,exports.WorkbookViewCommandButton=Ka,exports._WorkbookIO=Xr,exports._extends=oo,exports._objectWithoutPropertiesLoose=nn,exports._setPrototypeOf=no,exports.clsx=Ke,exports.clsx$1=se,exports.commonjsGlobal=ut,exports.createGridStyleFromMUITheme=Io,exports.defaultNewWorkbook=Er,exports.getDefaultExportFromCjs=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},exports.requirePropTypes=Ot,exports.setPrintExamplesOnLoad=a=>{cr=a},exports.useMeasure=_e,exports.useWorkbookCommands=jr;
|