@sheetxl/utils-react 0.7.4 → 0.7.5

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/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # React Utilities
2
2
 
3
- ![SheetXL](https://www.sheetxl.com/logo-text.svg)
3
+ <p align="center">
4
+ <a href="https://www.sheetxl.com" target="_blank">
5
+ <img src="https://www.sheetxl.com/logo-text.svg" alt="SheetXL Logo" width="180" />
6
+ </a>
7
+ </p>
4
8
 
5
9
  Collection of React components available for all [SheetXL](https://www.sheetxl.com) projects.
6
10
 
@@ -10,12 +14,12 @@ This package will generally not be used by itself but rather as a dependency of
10
14
 
11
15
  Whether you're ready to build, need help, or just want to see more examples, here's where to go next.
12
16
 
17
+ * 💬 **[Join our Discord Community](https://discord.gg/NTKdwUgK9p)** - Get help and connect with the team.
18
+ * ⭐ **[Star us on GitHub](https://github.com/sheetxl/sheetxl)** - If you like SheetXL give us a star ⭐ and help others find us!
13
19
  * 📘 **[Developer Docs](https://www.sheetxl.com/docs)** - Guides and tutorials.
14
20
  * 🔌 **[API Reference](https://api.sheetxl.com)** - Detailed documentation for all packages.
15
- * 🌐 **[Live Demo Gallery](https://www.sheetxl.com/demos)** - A showcase of interactive examples.
16
- * ✨ **[Storybook](https://storybook.sheetxl.com)** - Explore and test individual UI components.
17
- * 💬 **[Join our Discord Community](https://discord.gg/NTKdwUgK9p)** - Get help and connect with the team.
18
- * ⭐ **[Star us on GitHub](https://github.com/sheetxl)** - If you find SheetXL useful, we'd appreciate a star!
21
+ * 👀 **[Live Demo Gallery](https://www.sheetxl.com/demos)** - A showcase of interactive examples.
22
+ * 🖼️ **[Storybook](https://storybook.sheetxl.com)** - Explore and test individual UI components.
19
23
  * 🌐 **[Website](https://www.sheetxl.com)** - Our Website.
20
24
 
21
25
  ---
@@ -1,7 +1,7 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  "use strict";/**
3
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.4
3
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.5
4
4
  *
5
5
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
6
6
  * License: The license can be found at https://www.sheetxl.com/license.
7
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),l=require("react"),k=require("@sheetxl/utils"),Gt=require("react-dom/client"),Jt=require("react-dom"),W={Shift:"shift",Alt:"alt",Ctrl:"ctrl",Meta:"meta"},ee={Horizontal:"horizontal",Vertical:"vertical"};function mt(i){var e,t,o="";if(typeof i=="string"||typeof i=="number")o+=i;else if(typeof i=="object")if(Array.isArray(i)){var n=i.length;for(e=0;e<n;e++)i[e]&&(t=mt(i[e]))&&(o&&(o+=" "),o+=t)}else for(t in i)i[t]&&(o&&(o+=" "),o+=t);return o}function _e(){for(var i,e,t=0,o="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=mt(i))&&(o&&(o+=" "),o+=e);return o}var Qt=function(){},gt=typeof window<"u",eo=gt?l.useLayoutEffect:l.useEffect,it={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const he=gt&&window.ResizeObserver!==void 0?function(){var i=l.useState(null),e=i[0],t=i[1],o=l.useState(it),n=o[0],r=o[1],s=l.useMemo(function(){return new window.ResizeObserver(function(a){if(a[0]){var c=a[0].contentRect,u=c.x,h=c.y,d=c.width,p=c.height,w=c.top,C=c.left,S=c.bottom,E=c.right;r({x:u,y:h,width:d,height:p,top:w,left:C,bottom:S,right:E})}})},[]);return eo(function(){if(e)return s.observe(e),function(){s.disconnect()}},[e]),[t,n]}:function(){return[Qt,it]},L=(i,e)=>{const t=l.useCallback((...r)=>i?.(...r),e),o=l.useRef(null);o.current=t;const n=l.useCallback((...r)=>o.current?.(...r),[]);if(o.current)return n},yt=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z":"m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z";return v.jsx("div",{style:{paddingBottom:"0px",paddingRight:"0px",paddingLeft:n?"0px":"3px",paddingTop:n?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...e},...o,children:v.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${n?"vertical":"horizontal"} single-button start`,children:v.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:v.jsx("path",{d:r})})})})},vt=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z":"m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z";return v.jsx("div",{style:{paddingLeft:"0px",paddingTop:"0px",paddingRight:n?"0px":"3px",paddingBottom:n?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...e},...o,children:v.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${n?"vertical":"horizontal"} single-button end`,children:v.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:v.jsx("path",{d:r})})})})},$e=(i,e,t,o,n=0)=>{for(let r=0;r<t.length;r++){const s=t[r].getBoundingClientRect();let a=s.left-e,c=a+s.width;if(o){if(a<i&&c>=i)return a}else if(Math.ceil(c)>Math.ceil(i)+2)return c}return n},to=Object.freeze(Object.defineProperty({__proto__:null,getScrollTo:$e},Symbol.toStringTag,{value:"Module"})),oo="_sheetxl-scrollbar_eblx4_6",ze=l.memo(l.forwardRef((i,e)=>{const{offset:t=0,totalSize:o=0,viewportSize:n=0,style:r,className:s,orientation:a=ee.Vertical,onScrollOffset:c,onScroll:u,showCustomScrollButtons:h=!1,scrollButtonIncrement:d=200,scrollButtonInitialRepeatDelay:p=260,scrollButtonAdditionalRepeatDelay:w=120,createScrollStartButton:C=yt,createScrollEndButton:S=vt,...E}=i,z=L(u,[u]),_=l.useRef(null),[x,{width:g,height:A}]=he(),[R,{width:O,height:N}]=he(),y=a===ee.Vertical,b=y?"top":"left",B=y?"scrollTop":"scrollLeft",f=y?A:g,M=y?N:O,[m,T]=l.useState(null);l.useEffect(()=>{m!==null&&_.current&&_.current.scrollTo({behavior:"smooth",[b]:m})},[m,y]);const P=l.useCallback(($,oe=!1)=>{if(!_.current)return 0;const te=_.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=oe?0:$e($,ce[b],ne,!0,Math.max(0,$-d));return T(re),Math.max(0,re)},[]),X=l.useCallback(($,oe=!1)=>{if(!_.current)return 0;const te=_.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=Math.ceil(M-f),ye=oe?re:$e($,ce[b],ne,!1,Math.max(0,$+d));return T(ye),Math.min(re,ye)},[M,f]),V=l.useRef(null),I=l.useCallback($=>{V.current=t;const oe=$.target[B];c(oe,n,o),z?.($)},[c,n,o,t]);l.useEffect(()=>{const $=V.current;V.current=null,t!==$&&(_.current[B]=t)},[t,B]);const F=l.useRef(null),j=l.useRef(null),H=l.useCallback(()=>{F.current&&(clearTimeout(F.current),F.current=null,j.current=null)},[]),U=l.useCallback(($,oe,te,ce=p)=>{j.current=$,F.current=setTimeout(()=>{const ne=te?P(j.current||$):X(j.current||$);ne!==j.current?U(ne,!1,te,w):H()},oe?0:ce)},[P,X,H]);l.useEffect(()=>()=>H(),[H]);const J=t,de=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(J)<=0||Math.floor(M-f)===0,onMouseUp:H,onMouseLeave:H,onMouseDown:()=>U(J,!0,!0)};return C?.($)},[h,a,J,m,M,f]),pe=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(M-f)<=Math.ceil(J),onMouseUp:H,onMouseLeave:H,onMouseDown:()=>U(J,!0,!1)};return S?.($)},[h,a,J,m,M,f]);return v.jsxs("div",{ref:e,style:{display:"flex",flex:"1",flexDirection:y?"column":"row",padding:"0",...r},className:_e(oo,s),...E,children:[de,v.jsx("div",{className:"pseudo-scrollbar",style:{flex:"1 1 100%",display:"flex",boxSizing:"content-box",flexDirection:y?"column":"row",justifyContent:"center",alignItems:"center"},ref:x,children:v.jsx("div",{tabIndex:-1,style:{flex:"1 1 100%",overflowY:y?"scroll":"hidden",overflowX:y?"hidden":"scroll",position:"relative",willChange:"transform"},onScroll:I,ref:_,children:v.jsx("div",{ref:R,style:{position:"absolute",height:y?o-n+(A??0):1,width:y?1:o-n+(g??0)},className:"scrollbar-viewport"})})}),pe]})}));ze.displayName="Scrollbar";let rt=Date.now,st=1e3,ae={},no=1;const ve=i=>{let e=ae[i]!==null;return e&&(ae[i]=null),e},lt=(i,e,t,o=0,n)=>{let r=rt(),s=r,a=0,c=0,u=0,h=no++;if(h%20==0){const p={};for(let w in ae)p[w]=!0;ae=p}const d=function(p){let w=p!==!0,C=rt(),S=!0;try{S=(!e||e(h))??!0}catch{S=!1}if(!ae[h]||!S)return ae[h]=null,void t?.(60-c/((C-r)/st),h,!1);if(w){u=Math.round((C-s)/16.666666666666668)-1;for(let _=0;_<Math.min(u,4);_++)d(!0),c++}o&&(a=(C-r)/o,a>1&&(a=1));let E=n?n(a):a,z=!1;try{z=i(E,C,w)}catch{z=!1}z!==!1&&a!==1||!w?w&&(s=C,requestAnimationFrame(d)):(ae[h]=null,t?.(60-c/((C-r)/st),h,a===1||o==null))};return ae[h]=!0,requestAnimationFrame(d),h},io=function(i){return Math.pow(i-1,3)+1},ro=function(i){return(i/=.5)<1?.5*Math.pow(i,3):.5*(Math.pow(i-2,3)+2)};class so{constructor(e,t){this.__isSingleTouch=!1,this.__isTracking=!1,this.__didDecelerationComplete=!1,this.__isGesturing=!1,this.__isDragging=!1,this.__isDecelerating=0,this.__isAnimating=0,this.__interruptedAnimation=!1,this.__lastScale=1,this.__enableScrollX=!0,this.__enableScrollY=!0,this.__clientLeft=0,this.__clientTop=0,this.__clientWidth=0,this.__clientHeight=0,this.__contentWidth=0,this.__contentHeight=0,this.__snapWidth=100,this.__snapHeight=100,this.__zoomLevel=1,this.__scrollLeft=0,this.__scrollTop=0,this.__maxScrollLeft=0,this.__maxScrollTop=0,this.__scheduledLeft=0,this.__scheduledTop=0,this.__scheduledZoom=0,this.__lastTouchLeft=0,this.__lastTouchTop=0,this.__lastTouchMove=0,this.__positions=[],this.__initialTouchLeft=0,this.__initialTouchTop=0,this.__zoomLevelStart=1,this.__minDecelerationScrollLeft=null,this.__minDecelerationScrollTop=null,this.__maxDecelerationScrollLeft=null,this.__maxDecelerationScrollTop=null,this.__decelerationVelocityX=null,this.__decelerationVelocityY=0,this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:void 0,penetrationDeceleration:.03,penetrationAcceleration:.08,...t}}setDimensions(e,t,o,n){e!==null&&(this.__clientWidth=e),t!==null&&(this.__clientHeight=t),o!==null&&(this.__contentWidth=o),n!==null&&(this.__contentHeight=n),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)}setPosition(e,t){this.__clientLeft=e||0,this.__clientTop=t||0}setSnapSize(e,t){this.__snapWidth=e,this.__snapHeight=t}getValues(){return{left:this.__scrollLeft,top:this.__scrollTop,right:this.__scrollLeft+this.__clientWidth/this.__zoomLevel,bottom:this.__scrollTop+this.__clientHeight/this.__zoomLevel,zoom:this.__zoomLevel}}getPoint(e,t){const o=this.getValues();return{left:e/o.zoom,top:t/o.zoom}}getScrollMax(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}}zoomTo(e,t=!1,o,n,r){if(!this.options.zooming)throw new Error("Zooming is not enabled!");r&&(this.__zoomComplete=r),this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0);const s=this.__zoomLevel;o===void 0&&(o=this.__clientWidth/2),n===void 0&&(n=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);const a=e/s;let c=a*(this.__scrollLeft+o)-o,u=a*(this.__scrollTop+n)-n;c>this.__maxScrollLeft?c=this.__maxScrollLeft:c<0&&(c=0),u>this.__maxScrollTop?u=this.__maxScrollTop:u<0&&(u=0),this.__publish(c,u,e,t)}zoomBy(e,t=!1,o=0,n=0,r){this.zoomTo(this.__zoomLevel*e,t,o,n,r)}scrollTo(e,t,o=!1,n=1){if(this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0),n!==void 0&&n!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=n,t*=n,this.__computeScrollMax(n)}else n=this.__zoomLevel;this.options.scrollingX?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(o=!1),this.__publish(e,t,n,o)}scrollBy(e=0,t=0,o=!1){const n=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,r=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(n+(e||0),r+(t||0),o)}doMouseZoom(e,t,o,n){const r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,o-this.__clientLeft,n-this.__clientTop)}doTouchStart(e,t){if(e.length===void 0)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),typeof t!="number")throw new Error("Invalid timestamp value: "+t);let o,n;this.__interruptedAnimation=!0,this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0,this.__interruptedAnimation=!0),this.__isAnimating&&(ve(this.__isAnimating),this.__isAnimating=0,this.__interruptedAnimation=!0);let r=e.length===1;r?(o=e[0].pageX,n=e[0].pageY):(o=Math.abs(e[0].pageX+e[1].pageX)/2,n=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=o,this.__initialTouchTop=n,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=o,this.__lastTouchTop=n,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!r&&this.options.scrollingX,this.__enableScrollY=!r&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!r,this.__isSingleTouch=r,this.__positions=[]}doTouchMove(e,t,o=1){if(e.length===void 0)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),typeof t!="number")throw new Error("Invalid timestamp value: "+t);if(!this.__isTracking)return;let n,r;e.length===2?(n=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(n=e[0].pageX,r=e[0].pageY);let s=this.__positions;if(this.__isDragging){let a=n-this.__lastTouchLeft,c=r-this.__lastTouchTop,u=this.__scrollLeft,h=this.__scrollTop,d=this.__zoomLevel;if(o!==void 0&&this.options.zooming){let p=d;if(d=d/this.__lastScale*o,d=Math.max(Math.min(d,this.options.maxZoom),this.options.minZoom),p!==d){let w=n-this.__clientLeft,C=r-this.__clientTop;u=(w+u)*d/p-w,h=(C+h)*d/p-C,this.__computeScrollMax(d)}}if(this.__enableScrollX){u-=a*this.options.speedMultiplier;let p=this.__maxScrollLeft;(u>p||u<0)&&(this.options.bouncing?u+=a/2*this.options.speedMultiplier:u=u>p?p:0)}if(this.__enableScrollY){h-=c*this.options.speedMultiplier;const p=this.__maxScrollTop;(h>p||h<0)&&(this.options.bouncing?h+=c/2*this.options.speedMultiplier:h=h>p?p:0)}s.length>60&&s.splice(0,30),s.push(u,h,t),this.__publish(u,h,d)}else{let a=this.options.locking?3:0,c=5,u=Math.abs(n-this.__initialTouchLeft),h=Math.abs(r-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&u>=a,this.__enableScrollY=this.options.scrollingY&&h>=a,s.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(u>=c||h>=c),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=n,this.__lastTouchTop=r,this.__lastTouchMove=t,this.__lastScale=o}doTouchEnd(e){if(e instanceof Date&&(e=e.valueOf()),typeof e!="number")throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){let t=this.__positions,o=t.length-1,n=o;for(let r=o;r>0&&t[r]>this.__lastTouchMove-100;r-=3)n=r;if(n!==o){const r=t[o]-t[n],s=this.__scrollLeft-t[n-2],a=this.__scrollTop-t[n-1];this.__decelerationVelocityX=s/r*(1e3/60),this.__decelerationVelocityY=a/r*(1e3/60);const c=this.options.paging||this.options.snapping?4:1;(Math.abs(this.__decelerationVelocityX)>c||Math.abs(this.__decelerationVelocityY)>c)&&this.__startDeceleration(e)}else this.options.scrollingComplete?.()}else e-this.__lastTouchMove>100&&this.options.scrollingComplete?.();this.__isDecelerating||((this.__interruptedAnimation||this.__isDragging)&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel)),this.__positions.length=0}}__publish(e,t,o,n=!1){const r=this.__isAnimating;if(r&&(ve(r),this.__isAnimating=0),n&&this.options.animating){this.__scheduledLeft=e,this.__scheduledTop=t,this.__scheduledZoom=o;const s=this.__scrollLeft,a=this.__scrollTop,c=this.__zoomLevel,u=e-s,h=t-a,d=o-c,p=function(S,E,z){z&&(this.__scrollLeft=s+u*S,this.__scrollTop=a+h*S,this.__zoomLevel=c+d*S,this.__callback&&this.__callback(this.__scrollLeft,this.__scrollTop,this.__zoomLevel))}.bind(this),w=function(S){return this.__isAnimating===S}.bind(this),C=function(S,E,z){E===this.__isAnimating&&(this.__isAnimating=!1),(this.__didDecelerationComplete||z)&&this.options.scrollingComplete?.(),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}.bind(this);this.__isAnimating=lt(p,w,C,this.options.animationDuration,r?io:ro)}else this.__scheduledLeft=this.__scrollLeft=e,this.__scheduledTop=this.__scrollTop=t,this.__scheduledZoom=this.__zoomLevel=o,this.__callback&&this.__callback(e,t,o),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}__computeScrollMax(e=this.__zoomLevel){this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)}__startDeceleration(e){if(this.options.paging){const s=Math.max(Math.min(this.__scrollLeft,this.__maxScrollLeft),0),a=Math.max(Math.min(this.__scrollTop,this.__maxScrollTop),0),c=this.__clientWidth,u=this.__clientHeight;this.__minDecelerationScrollLeft=Math.floor(s/c)*c,this.__minDecelerationScrollTop=Math.floor(a/u)*u,this.__maxDecelerationScrollLeft=Math.ceil(s/c)*c,this.__maxDecelerationScrollTop=Math.ceil(a/u)*u}else this.__minDecelerationScrollLeft=0,this.__minDecelerationScrollTop=0,this.__maxDecelerationScrollLeft=this.__maxScrollLeft,this.__maxDecelerationScrollTop=this.__maxScrollTop;const t=function(s,a,c){this.__stepThroughDeceleration(c)}.bind(this),o=this.options.snapping?4:.1,n=function(){const s=Math.abs(this.__decelerationVelocityX)>=o||Math.abs(this.__decelerationVelocityY)>=o;return s||(this.__didDecelerationComplete=!0),s}.bind(this),r=function(s,a,c){this.__isDecelerating=0,this.__didDecelerationComplete&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,this.options.snapping)}.bind(this);this.__isDecelerating=lt(t,n,r)}__stepThroughDeceleration(e){let t=this.__scrollLeft+this.__decelerationVelocityX,o=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){const n=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);n!==t&&(t=n,this.__decelerationVelocityX=0);const r=Math.max(Math.min(this.__maxDecelerationScrollTop,o),this.__minDecelerationScrollTop);r!==o&&(o=r,this.__decelerationVelocityY=0)}if(e?this.__publish(t,o,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=o),!this.options.paging&&(this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95),this.options.bouncing){let n=0,r=0,s=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;t<this.__minDecelerationScrollLeft?n=this.__minDecelerationScrollLeft-t:t>this.__maxDecelerationScrollLeft&&(n=this.__maxDecelerationScrollLeft-t),o<this.__minDecelerationScrollTop?r=this.__minDecelerationScrollTop-o:o>this.__maxDecelerationScrollTop&&(r=this.__maxDecelerationScrollTop-o),n!==0&&(n*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=n*s:this.__decelerationVelocityX=n*a),r!==0&&(r*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=r*s:this.__decelerationVelocityY=r*a)}}}var Z=typeof window<"u"?window:{screen:{},navigator:{}},ge=(Z.matchMedia||function(){return{matches:!1}}).bind(Z),xt=!1,lo={get passive(){return xt=!0}},at=function(){};Z.addEventListener&&Z.addEventListener("p",at,lo),Z.removeEventListener&&Z.removeEventListener("p",at,!1);var ao=xt,co="PointerEvent"in Z,Ue="ontouchstart"in Z,bt=Ue||"TouchEvent"in Z&&ge("(any-pointer: coarse)").matches,ct=(Z.navigator.maxTouchPoints||0)>0||bt,wt=Z.navigator.userAgent||"",uo=ge("(pointer: coarse)").matches&&/iPad|Macintosh/.test(wt)&&Math.min(Z.screen.width||0,Z.screen.height||0)>=768,St=(ge("(pointer: coarse)").matches||!ge("(pointer: fine)").matches&&Ue)&&!/Windows.*Firefox/.test(wt),ho=ge("(any-pointer: fine)").matches||ge("(any-hover: hover)").matches||uo||!Ue,Ke=!ct||!ho&&St?ct?"touchOnly":"mouseOnly":"hybrid",po=Ke==="mouseOnly"?"mouse":Ke==="touchOnly"||St?"touch":"mouse";const fo=Object.freeze(Object.defineProperty({__proto__:null,deviceType:Ke,primaryInput:po,supportsPassiveEvents:ao,supportsPointerEvents:co,supportsTouchEvents:bt},Symbol.toStringTag,{value:"Module"})),_o=new Set(["INPUT","TEXTAREA","SELECT"]),Ct={};function Ne(){return fo}const Et=i=>i==="BracketLeft"?"[":i==="BracketRight"?"]":k.CommonUtils.camelToPrettyCase(i),mo=Object.freeze(Object.defineProperty({__proto__:null,EmptyCssProperties:Ct,boundPixel:function(i,e=!1,t=0){return i},createSyntheticEvent:i=>{let e=!1,t=!1;return{nativeEvent:i,currentTarget:i.currentTarget,target:i.target,bubbles:i.bubbles,cancelable:i.cancelable,defaultPrevented:i.defaultPrevented,eventPhase:i.eventPhase,isTrusted:i.isTrusted,preventDefault:()=>{e=!0,i.preventDefault()},isDefaultPrevented:()=>e,stopPropagation:()=>{t=!0,i.stopPropagation()},isPropagationStopped:()=>t,persist:()=>{},timeStamp:i.timeStamp,type:i.type}},detectIt:Ne,focusableNodeNames:_o,toPrettyKeyCode:Et},Symbol.toStringTag,{value:"Module"})),go=[];function Ye(i,e,t=go){const o=l.useRef(null);return l.useImperativeHandle(i,()=>{if(!o.current)return;const n=o.current,r=e?.();if(!r||typeof r!="object")throw new Error("attributes must return a plain object of values");const s=Object.keys(r),a=s.length;for(let c=0;c<a;c++){const u=s[c],h=r[u];Object.defineProperty(n,u,{value:h,writable:!0,configurable:!0,enumerable:!0})}return n},t),o}const He=i=>v.jsx(ze,{...i}),Lt=({width:i,height:e})=>v.jsx("div",{className:"corner",style:{minWidth:`${i}px`,width:`${i}px`,minHeight:`${e}px`,height:`${e}px`}}),Mt=l.memo(l.forwardRef((i,e)=>{const{children:t,viewport:o,onScrollViewport:n,showHorizontalScrollbar:r=!0,showVerticalScrollbar:s=!0,createScrollCorner:a=Lt,createHorizontalScrollbar:c=He,createVerticalScrollbar:u=He,style:h,touchElement:d,disableTouch:p,...w}=i,C=L(n,[n]),S=Ye(e,()=>({isScrollPane:()=>!0}),[]),E=l.useRef(null);l.useEffect(()=>{E.current&&(E.current.__scrollTop===o?.top&&E.current.__scrollLeft===o?.left||E.current.__isDecelerating||E.current?.scrollTo(o?.left,o?.top,!1))},[o?.left,o?.top,d]);const z=l.useCallback((f,M)=>{C?.({left:f,top:M})},[]),_=l.useCallback(f=>{E.current?.doTouchStart(f.touches,f.timeStamp)},[]),x=l.useCallback(f=>{f.preventDefault(),E.current?.doTouchMove(f.touches,f.timeStamp)},[]),g=l.useCallback(f=>{E.current?.doTouchEnd(f.timeStamp)},[]),A=l.useCallback(({containerWidth:f,containerHeight:M,totalWidth:m,totalHeight:T})=>{E.current.setDimensions(f,M,m,T)},[]);l.useEffect(()=>{const f=d??S.current;if(!p&&Ne().supportsTouchEvents&&f&&o){if(!E.current){const M={scrollingX:!0,scrollingY:!0,decelerationRate:.95,penetrationAcceleration:.08};E.current=new so(z,M)}Ne().supportsTouchEvents&&(f.addEventListener("touchstart",_),f.addEventListener("touchend",g),f.addEventListener("touchmove",x)),A({containerWidth:o?.width,containerHeight:o?.height,totalWidth:o?.totalWidth,totalHeight:o?.totalHeight})}return()=>{f?.removeEventListener("touchstart",_),f?.removeEventListener("touchend",g),f?.removeEventListener("touchmove",x)}},[o?.width,o?.height,o?.totalWidth,o?.totalHeight,p,d]);const[R,{width:O}]=he(),[N,{height:y}]=he(),b=l.useMemo(()=>{const f=u({orientation:ee.Vertical,offset:o?.top,viewportSize:o?.height,totalSize:o?.totalHeight,onScrollOffset:M=>{C?.({top:M})}});return v.jsx("div",{style:{display:"flex",flex:"0"},ref:R,children:f})},[u,o?.top,o?.height,o?.totalHeight]),B=l.useMemo(()=>{const f=c({orientation:ee.Horizontal,offset:o?.left,viewportSize:o?.width,totalSize:o?.totalWidth,onScrollOffset:M=>C?.({left:M})});return v.jsxs("div",{style:{display:"flex",flex:"none",flexDirection:"row",alignItems:"stretch",justifyContent:"center"},children:[v.jsx("div",{style:{display:"flex",flex:"1 1 100%",flexDirection:"column",width:`calc(100% - ${O}px)`},children:v.jsx("div",{ref:N,className:"sizer",children:f})}),s?a({width:O,height:y}):v.jsx(v.Fragment,{})]})},[c,o?.left,o?.width,o?.totalWidth,s,a,O,y]);return v.jsx("div",{style:{position:"relative",display:"flex",minWidth:s?`${O}px`:void 0,minHeight:r?`${y}px`:void 0,...h},...w,ref:S,children:v.jsxs("div",{style:{position:"relative",width:"100%",flex:"1 1 100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:[v.jsxs("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:[v.jsx("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:t}),s?b:v.jsx(v.Fragment,{})]}),r?B:v.jsx(v.Fragment,{})]})})}));Mt.displayName="ScrollPane";let Se=0;const yo=100,vo=100,xo=1e6,bo=100,wo=50,Tt=l.memo(l.forwardRef((i,e)=>{const{offset:t=0,viewportSize:o=0,totalSize:n=0,minSize:r=0,endGap:s=yo,endScrollIncrement:a=vo,style:c=Ct,onMouseDown:u,onScrollOffset:h,onScroll:d,scaleLimit:p=xo,scaleFactor:w=bo,precisionFactor:C=wo,...S}=i;d&&console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");const E=L(u,[u]),z=()=>({offset:t,totalSize:p===0?n:Math.min(n??0,Math.max(r??0,(t??0)+(o??0))+(s??0))}),[_,x]=l.useState(z),g=p!==0&&_.totalSize>p?w:1,A=g/C,R=Math.ceil(_.totalSize/g),O=Math.ceil(_.offset/g),N=Math.ceil(o/g),y=l.useCallback(P=>{},[]),[b,B]=l.useState(!1),f=l.useRef(null);l.useLayoutEffect(()=>{if(!b){f.current={propTotalSize:n,propViewportSize:o,propOffset:t};const P=z();x(P)}},[n,o,t,b,r,s,a]);const M=L((P,X,V)=>{const I=f.current;f.current=null,I&&I.propTotalSize===n&&I.propViewportSize===o&&I.propOffset===t||(Math.abs(P-O)<A&&(P=O),h?.(P*g,O,N))},[h,g,A,O,N]),m=l.useCallback(P=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",m),B(!1)},[]),T=l.useCallback(P=>{E?.(P),B(!0),document.addEventListener("mousemove",y,{passive:!0}),document.addEventListener("mouseup",m,{passive:!0})},[y,m]);return v.jsx(ze,{ref:e,style:{...c},...S,offset:O,totalSize:R,viewportSize:N,onMouseDown:T,onScrollOffset:M})}));Tt.displayName="VirtualScrollbar";function Ae(i,e){if(typeof i=="function")return i(e);i&&(i.current=e)}var Pe=parseInt(l.version.split(".")[0],10)>=19?function(i){return e=>{const t=[];for(const o of i){const n=Ae(o,e),r=typeof n=="function";t.push(r?n:()=>Ae(o,null))}return()=>{for(const o of t)o()}}}:function(i){return e=>{for(const t of i)Ae(t,e)}};const So=l.memo(l.forwardRef((i,e)=>{const{refFocusStart:t,...o}=i,n=l.useRef(null),r=l.useCallback(()=>{if(t)return void t?.current?.focus();const s=n.current.parentElement.children;let a=[];for(let c=0;c<s.length&&s[c]!==n.current;c++){const u=s[c].getAttribute("tabindex");if(u==null||u==="-1"||s[c].getAttribute("disabled")==="true")continue;const h=s[c];h.focus&&a.push({tabindex:parseInt(u),child:h})}a.length!==0&&(a.sort(function(c,u){return c.tabindex-u.tabindex}),a[0].child.focus())},[t]);return v.jsx("div",{tabIndex:0,ref:Pe([n,e]),onFocus:r,...o})})),Co=l.memo(l.forwardRef((i,e)=>{const{className:t,style:o,children:n,radius:r=4,strokeWidth:s=1,strokeColor:a="grey",...c}=i,[u,{width:h,height:d}]=he(),p=l.useRef(null),w=(z,_=0)=>{const x=z/2,g=d-x+_;return(function(A,R,O=!1){if(R===0)return A;function N(m,T,P){let X=T.x-m.x,V=T.y-m.y,I=Math.sqrt(X*X+V*V);return y(m,T,Math.min(1,P/I))}function y(m,T,P){return{x:m.x+(T.x-m.x)*P,y:m.y+(T.y-m.y)*P}}function b(m,T){m.length>2&&(m[m.length-2]=T.x,m[m.length-1]=T.y)}function B(m){return{x:parseFloat(m[m.length-2]),y:parseFloat(m[m.length-1])}}let f=A.split(/[,\s]/).reduce(function(m,T){let P=T.match("([a-zA-Z])(.+)");return P?(m.push(P[1]),m.push(P[2])):m.push(T),m},[]).reduce(function(m,T){return parseFloat(T)==T&&m.length?m[m.length-1].push(T):m.push([T]),m},[]),M=[];if(f.length>1){let m=B(f[0]),T=null;f[f.length-1][0]==="Z"&&f[0].length>2&&(T=["L",m.x,m.y],f[f.length-1]=T),M.push(f[0]);for(let P=1;P<f.length;P++){let X=M[M.length-1],V=f[P],I=V===T?f[1]:f[P+1];if(I&&X&&X.length>2&&V[0]==="L"&&I.length>2&&I[0]==="L"){let F,j,H=B(X),U=B(V),J=B(I);O?(F=y(U,X.origPoint||H,R),j=y(U,I.origPoint||J,R)):(F=N(U,H,R),j=N(U,J,R)),b(V,F),V.origPoint=U,M.push(V);let de=y(F,U,.5),pe=y(U,j,.5),$=["C",de.x,de.y,pe.x,pe.y,j.x,j.y];$.origPoint=U,M.push($)}else M.push(V)}if(T){let P=B(M[M.length-1]);M.push(["Z"]),b(M[0],P)}}else M=f;return M.reduce(function(m,T){return m+T.join(" ")+" "},"")})(`${`M 0 ${x} L ${r-.5} ${x} L ${r-.5} ${g} L ${2*r} ${g}`} ${`L ${h-2*r} ${g}`} ${`M ${h-2*r} ${g} L ${h-r} ${g} L ${h-r} ${x} L ${h} ${x}`}`,r)},C=l.useMemo(()=>w(s),[h,d,r,s]),S=l.useMemo(()=>{if(r===0)return;const z=r/2;return w(r)+`L ${h} 0 L 0 0 L 0 ${z}`},[C,r,s]),E=l.useMemo(()=>({style:{clipPath:`path('${S}')`}}),[S]);return v.jsxs("div",{className:t,style:{display:"flex",flexDirection:"row",...o},...c,ref:Pe([p,u,e]),children:[l.isValidElement(n)?l.cloneElement(n,E):v.jsx(v.Fragment,{}),v.jsx("svg",{style:{position:"absolute",top:0,left:0,pointerEvents:"none"},width:h,height:d,viewBox:`0 0 ${h} ${d}`,children:v.jsx("path",{d:C,stroke:a,fill:"none",vectorEffect:"non-scaling-stroke",strokeWidth:s})})]})})),Eo={},Dt=i=>{const{onPointerDown:e,style:t,splitDirection:o,paddingBefore:n=0,paddingAfter:r=0,disabled:s,key:a,hitAreaProps:c=Eo,...u}=i,h=o==="row",{style:d,className:p,...w}=c;return v.jsx("div",{style:{...t,position:"relative"},...u,children:v.jsx("div",{className:_e("hit-box",p),style:{left:(h?-n:0)+"px",width:`calc(100% + ${h?n+r:0}px)`,top:(h?0:-n)+"px",height:`calc(100% + ${h?0:n+r}px)`,position:"absolute",...d},onPointerDown:s?void 0:e,...w})},a)},Ce={},ue=(i,e,t=!0)=>i===null?null:i.pixels!==null?t?i.pixels:e-i.pixels:(t?i.percent:100-i.percent)/100*e,Ee=(i,e=!0)=>i?.percent?`${e?i.percent:100-i.percent}%`:i?.pixels?`${i.pixels}px`:void 0,le=(i,e)=>{if(i==null)return null;const t={percent:null,pixels:null};let o=e;return typeof i=="string"&&((i=i.trim().toLowerCase()).endsWith("px")?(i=i.substring(0,i.length-2),o=!1):i.endsWith("%")&&(i=i.substring(0,i.length-1),o=!0),i=parseFloat(i)),o?t.percent=i:t.pixels=i,Object.freeze(t)},Lo=l.memo(l.forwardRef((i,e)=>{const{elementBefore:t,elementAfter:o,splitDirection:n="row",fixedPane:r=null,position:s,onPositionChange:a,minBefore:c,maxBefore:u,minAfter:h,maxAfter:d,children:p,className:w,style:C,disabled:S=!1,onDragStart:E,onDragResize:z,onDragFinish:_,resizerProps:x=Ce,paneProps:g=Ce,paneBeforeProps:A=Ce,paneAfterProps:R=Ce,createResizer:O=Dt}=i;if(p)throw new Error("Use elementBefore and elementAfter instead of children.");const N=l.useMemo(()=>l.isValidElement(o)&&l.isValidElement(t),[o,t]),y=l.useMemo(()=>{let D=null;r&&(r==="before"?D=0:r==="after"&&(D=1));const K=D===null;return{fixedPaneOffset:D,isPercent:K,minBefore:le(c,K),maxBefore:le(u,K),minAfter:le(h,K),maxAfter:le(d,K)}},[c,u,h,d]),b=L(a,[a]),[B,f]=l.useState(()=>le(s,r===null));l.useEffect(()=>{f(le(s,r===null))},[s,r]);const[M,{width:m,height:T}]=he(),[P,{width:X,height:V}]=he(),I=n==="row"?X:V,F=n==="row"?m:T,j=l.useMemo(()=>((D,K,q,Y)=>{const ie=[null,null],Q=[null,null];if(D||(D={percent:Y.fixedPaneOffset===null?50:null,pixels:Y.fixedPaneOffset===null?null:0}),K===0)return D?.pixels!=null?Y.fixedPaneOffset!==1?(ie[0]=D?.pixels,Q[1]=100):(ie[1]=D?.pixels-q,Q[0]=100):D?.percent!=null&&(Y.fixedPaneOffset!==1?(Q[0]=D?.percent,Q[1]=100-D?.percent):(Q[1]=D?.percent,Q[0]=100-D?.percent)),{percents:Q,pixels:ie,minBefore:Ee(Y.minBefore,!0),maxBefore:Ee(Y.maxBefore,!0),minAfter:Ee(Y.minAfter),maxAfter:Ee(Y.maxAfter)};let se=ue(D,K,Y.fixedPaneOffset!==1),G=K-q,tt=ue(Y.minBefore,G,!0)??0,qt=ue(Y.maxBefore,G,!0)??G,we=0,Re=0,ot=0,nt=G;we=(ue(Y.maxAfter,K,!1)??q)-q,Re=ue(Y.minAfter,K,!1)??K,ot=Math.max(tt,we),nt=Math.min(qt,Re),se=Math.max(ot,Math.min(se,nt)),Re=Math.min(G-se,ue(Y.maxAfter,G-se,!0)??G),we=Math.min(G-se,ue(Y.minAfter,G-se,!0)??G),ie[0]=se,ie[1]=G-ie[0];const Zt=Math.max(0,Math.min(100,se/G*100));return Q[0]=Zt,Q[1]=100-Q[0],{percents:Q,pixels:ie,minBefore:`${tt}px`,minAfter:`${we}px`,maxBefore:`${ie[0]}px`,maxAfter:`${ie[1]}px`}})(B,F,I,y),[y,B,F,I,n]),[H,U]=l.useState(!1),J=L(E,[E]),de=L(z,[z]),pe=L(_,[_]),$=l.useRef(null),oe=l.useRef(null),te=l.useRef(null),{style:ce,className:ne,...re}=g,ye={minWidth:0,minHeight:0,maxWidth:"100%",maxHeight:"100%",display:"flex",overflow:"hidden",...ce},{className:Bt,style:jt,...Ot}=A,{className:$t,style:Kt,...Nt}=R,Ht={flex:"1 1 100%",width:"100%",...C,flexDirection:n,display:"flex"},{className:qe,style:Ze,onPointerDown:Ge,...Je}=x,Vt=L(D=>{const K=le(D,r===null);f(K)},[r]),xe=L(D=>{if(S||!H)return;const K=et.current?.getBoundingClientRect();let q=0;q=n==="row"?(D.clientX??D.touches?.[0]?.clientX)-K.x:(D.clientY??D.touches?.[0]?.clientY)-K.y,q=Math.max(0,Math.min(F,q)),y.fixedPaneOffset===1&&(q=F-q),s&&B.pixels===q||f({pixels:q,percent:null}),de?.(q),D.stopPropagation(),D.preventDefault()},[y,n,S,H,B,F]),Qe=L(D=>{if(document.removeEventListener("pointermove",xe),document.removeEventListener("touchmove",xe),document.removeEventListener("pointerup",Qe),!!H&&(U(!1),!!B)){if(pe(B.pixels),!le(s,r===null)||B.pixels!==s){const K={...B};K.percent===null&&(K.percent=K.pixels/F*100),b(K)}D.stopPropagation(),D.preventDefault()}},[B,H,s,r,F]),It=L(D=>{Ge?.(D),D.defaultPrevented||S||H||(U(!0),J(),document.addEventListener("pointermove",xe,{passive:!1}),document.addEventListener("touchmove",xe,{passive:!1}),document.addEventListener("pointerup",Qe,{passive:!1}))},[Ge]),et=Ye(e,()=>({setPosition:Vt,isSplitPane:()=>!0}),[]),Ft=l.useMemo(()=>N?O?.({key:"resizer",ref:Pe([P,oe]),className:_e("resizer",qe),onPointerDownCapture:It,style:{cursor:S?void 0:n==="row"?"ew-resize":"ns-resize",minWidth:n==="row"?"2px":void 0,minHeight:n!=="row"?"2px":void 0,boxSizing:"border-box",pointerEvents:"all",zIndex:1,...Ze},splitDirection:n,disabled:S,...Je}):null,[N,qe,Je,n,Ze,S]),be=n==="row"?"Width":"Height",Wt={...ye,...jt,flex:y.fixedPaneOffset===0&&j?.pixels[0]!==null?`0 0 ${Math.round(j?.pixels[0])}px`:`1 1 ${Math.round(j?.percents[0]??100)}%`,[`min${be}`]:j?.minBefore,[`max${be}`]:o?j?.maxBefore:"100%"},Ut={...ye,...Kt,flex:y.fixedPaneOffset===1&&j?.pixels[1]!==null?`0 0 ${Math.round(j?.pixels[1])}px`:`1 1 ${Math.round(j?.percents[1]??100)}%`,[`min${be}`]:j?.minAfter,[`max${be}`]:t?j?.maxAfter:"100%"},Yt=l.useMemo(()=>t?v.jsx("div",{ref:$,className:_e("before",ne,Bt),style:Wt,...re,...Ot,children:t},"before"):null,[t,g,A,y,j]),Xt=l.useMemo(()=>o?v.jsx("div",{ref:te,className:_e("after",ne,$t),style:Ut,...re,...Nt,children:o},"after"):null,[o,g,R,y,j]);return v.jsxs("div",{ref:Pe([M,et]),className:_e("splitPane",n==="row"?"vertical":"horizontal",{dragging:H},w),style:Ht,children:[Yt,Ft,Xt]})})),Ve={Default:"default",Error:"error",Success:"success",Warning:"warning",Info:"info"};class Pt extends k.DelegatingNotifier{setDelegate(e){super.setDelegate(e)}getDelegate(){return this._delegate}showMessage(e,t){const o=this.getDelegate();if(o?.showMessage)return o.showMessage(e,t);t?.type!==Ve.Warning?t?.type!==Ve.Error?k.Notifier.log(e):k.Notifier.error(e):k.Notifier.warn(e)}showBusy(e,t){const o=this.getDelegate();return o?.showBusy?o.showBusy(e,t):new Promise(n=>{n(()=>{})})}showWindow(e,t,o){const n=this.getDelegate();if(n?.showWindow)return n.showWindow(e,t,o)}showError(e){const t=this.getDelegate();t?.showError?t.showError(e):k.Notifier.error(e)}showOptions(e){const t=this.getDelegate();return t?.showOptions?t.showOptions(e):Promise.resolve("")}showInputOptions(e){const t=this.getDelegate();return t?.showInputOptions?t.showInputOptions(e):Promise.resolve({input:"",option:""})}}const Mo=new Pt,kt=l.createContext(Mo),Be=()=>l.useContext(kt);function ut(i){if(!i)throw new Error("must have a PointerHandlerOptions");const{onPointerDown:e,onPointerUp:t,onPointerMoveOrWait:o,processTouch:n=!1,consumeTouch:r=!0}=i,s=L(e,[e]),a=L(t,[t]),c=L(o,[o]),u=l.useRef(!1),h=i?.timerInitial??230,d=i?.timerContinuous??h/2,p=l.useRef(null),w=l.useRef(null),C=l.useRef(null),S=l.useRef(null),E=l.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null)},[]),z=l.useCallback(b=>{S.current=setTimeout(()=>{window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)}),z(d)},b??h)},[]);l.useEffect(()=>()=>E(),[]);const _=n?"pointer":"mouse",x=l.useCallback(b=>{b.stopPropagation(),b.stopImmediatePropagation(),b.preventDefault()},[]),g=L(b=>{document.removeEventListener(`${_}move`,O),document.removeEventListener(`${_}up`,g),document.removeEventListener("keydown",N),document.removeEventListener("keyup",y),document.removeEventListener("touchstart",x,{capture:!0}),document.removeEventListener("touchmove",x,{capture:!0}),window.removeEventListener("blur",A),E(),window.requestAnimationFrame(()=>{u.current!==!1&&(u.current=!1,a?.(b,C.current,p.current),C.current=null)})},[]),A=l.useCallback(()=>{u.current!==!1&&(u.current=!1,g(w.current))},[]),R=L(()=>{E(),z(d),window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)})},[d]),O=L(b=>{w.current=b,R()},[]),N=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},R()},[]),y=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},R()},[d]);return L(b=>{b.isDefaultPrevented()||(C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},s(b,C.current)!==!1&&(p.current=b,w.current=b.nativeEvent,document.addEventListener(`${_}up`,g,{passive:!1}),document.addEventListener(`${_}move`,O,{passive:!1}),document.addEventListener("keydown",N,{passive:!1}),document.addEventListener("keyup",y,{passive:!1}),window.addEventListener("blur",A,{passive:!0}),n&&r&&(document.addEventListener("touchstart",x,{passive:!1,capture:!0}),document.addEventListener("touchmove",x,{passive:!1,capture:!0})),u.current=!0,z(h)))},[h,n])}const To=({initValue:i,useHookBody:e,applyStateChange:t})=>{const o=l.useRef(i);if(typeof e!="function")throw new Error("function expected as hook body parameter. got "+typeof e);const n=e();return l.useLayoutEffect(()=>{o.current!==n&&(o.current=n,t(n))},[t,n]),null},Ie=i=>{console&&console.warn&&console.warn(i)},je=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||void 0;let Do=1,Fe=!1,zt=!1;const Te=[],me=[],ke=()=>{me.forEach(i=>i())},Po=({automaticContainerInternalUseOnly:i})=>{const[e,t]=l.useState([]),o=l.useRef([]);return o.current=e,i||Fe!==!1||(zt=!0),l.useEffect(()=>{let n=!0;function r(){if(n)return me[0]!==r?(i||Fe!==!0||Ie("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."),void t(s=>[])):void t([...Te])}return me.push(r),ke(),()=>{n=!1,o.current?.length>0&&Ie("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"),me.splice(me.indexOf(r),1),ke()}},[i]),v.jsx(v.Fragment,{children:e.map(({hook:n,key:r})=>l.createElement(To,{...n,key:r}))})},ko=i=>{const e=Do++;return Te.push({hook:i,key:e}),me.length===0&&zt===!1&&(Fe=!0,(t=>{if(je.document&&je.document.createElement){const o=je.document.createElement("div");Gt.createRoot(o).render(v.jsx(t,{automaticContainerInternalUseOnly:!0}))}else Ie("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.")})(Po)),ke(),()=>{Te.splice(Te.findIndex(t=>t.key===e),1),ke()}};let We=null;We||(We=(i,e,t={})=>{let o,n,r=!1,s=!1,a=[],{unmountIfNoConsumers:c=!1}=t;const u=d=>{var p;n=d,p=()=>a.forEach(w=>w(d)),Jt.unstable_batchedUpdates(p)},h=()=>(s||(n=typeof i=="function"?i():i,s=!0),n);return()=>{const[d,p]=l.useState(h);return l.useEffect(()=>(r||(r=!0,o=ko({initValue:i,useHookBody:e,applyStateChange:u})),a.push(p),n!==d&&p(n),()=>{a.splice(a.indexOf(p),1),a.length===0&&c&&(o(),r=!1)}),[]),d}});const Rt=We;let At=()=>{console.warn("You must call useEditMode before setting its state.")};const zo=Rt(null,()=>{const[i,e]=l.useState(null);return At=e,i});class De{constructor(e,t,o,n){this._listenersProperties=new Set,this._listenersExecute=new Set,this._key=e,this._target=t,this._applyProps(o||{}),this._callback=n,n===void 0&&(this._callback=()=>{console.log(`implement: ${this.label()} : ${this.description()}`)})}key(){return this._key}_resolve(e,t){if(typeof e=="function"){const o=t??this._context;return e(typeof o=="function"?o():o)}return e}target(){return typeof this._target=="function"?this._target():this._target}label(e,t){const o=this._scopedLabels?.[e]||this._label;let n=null;if(typeof o=="function"){const r=t??this._context;n=o(typeof r=="function"?r():r)}else n=o;return n}description(e){return this._resolve(this._description,e)}tags(e){return this._resolve(this._tags,e)}icon(e){return this._resolve(this._icon,e)}shortcut(){return this._resolve(this._shortcut)}disabled(){return this._resolve(this._disabled)||!this._callback}state(){return this._resolve(this._state)}context(){return typeof this._context=="function"?this._context():this._context}async execute(e,t){if(!this.disabled()&&this._callback){try{let o=!0;if(t?.beforeExecute&&(o=t?.beforeExecute(this,e)),await Promise.resolve(o)===!1)return!1;const n=this._callback.bind(this)(e,this);if(await Promise.resolve(n)===!1)return!1;t?.onExecute?.(this,e),this._notifyExecute(e)}catch(o){return console.warn(o),t?.onError(this,o,e),this._notifyError(e,o),!1}return!0}}addPropertyListener(e,t=!1){if(!e)throw new Error("listener must be specified");const o=this._listenersProperties;return o.add(e),t&&e({},this),()=>{o.delete(e)}}addExecuteListener(e){if(!e)throw new Error("listener must be specified");const t=this._listenersExecute;return t.add(e),function(){t.delete(e)}}_notifyExecute(e){const t=this;this._listenersExecute.forEach(o=>{o.onExecute(t,e)})}_notifyError(e,t){const o=this;this._listenersExecute.forEach(n=>{n.onError?.(o,e,t)})}updateCallback(e){return this._callback=e||null,this}update(e){if(!e)return;const t=this._applyProps(e);return Object.keys(t).length>0&&this._notifyPropertyChange(t),this}_notifyPropertyChange(e){const t=this;this._listenersProperties.forEach(o=>{o(e,t)})}_applyProps(e){let t={},o=this;return Object.keys(e).forEach(n=>{let r=e[n];o["_"+n]!==r&&(o["_"+n]=t[n]=r)}),t}}class Le extends De{}class Xe{constructor(e,t){this._target=null,this._groupKey=null,this._root=null,this._parent=null,this._uuid=k.CommonUtils.uuidV4(),this._target=e,this._groupKey=t??null,this._root=this,this._nodes=new Map,this._nodes.set(t,this),this._children=new Map,this._listeners=new Set,this._commandsByKey=new Map,this._commandsByShortcut=new Map;const o=this;this._unListenersByCommand=new Map,this._listenersByKey=new Map,this._commandsPropertyListener=(n,r)=>{const s=o._root._listenersByKey,a=r.key(),c=s.get(a);c&&o._notifyCommands(c,"onCommandChange",r)}}_getCommand(e){return this._commandsByKey.get(e)||(this._parent?._getCommand(e)??null)}getCommand(e,t=!1){const o=this._root._focused;let n=o,r=o===this;for(;!r&&n;)n===this&&(r=!0),n=n._parent;return(r?o:this)._getCommand(e)}createChildGroup(e,t,o){let n;if(!o){let a=this;for(;a&&!n;){let c=a._nodes.get(t);c&&(n=c),a=a._parent}}n||(n=new Xe(e,t),n._parent=this,n._root=this._root,n._unListenersByCommand=null,n._listenersByKey=null,n._commandsPropertyListener=null);const r=(a,c)=>{!a.has(t)||o?a.set(t,c):o===void 0&&console.warn("commandGroup already registered",t)};r(this._root._nodes,n);let s=this._parent;for(;s;)r(this._nodes,n),s=s._parent;return this._children.set(t,n),this._notify("onGroupChange"),n}getKey(){return this._groupKey}getGroup(e){return this._nodes.get(e)}_addCommands(e,t=void 0){const o=this._commandsByKey,n=this._commandsByShortcut,r=this._root._commandsPropertyListener,s=this._root._unListenersByCommand;for(let a=0;a<e.length;a++){const c=e[a],u=c.key();if(o.has(u)&&!t){t===void 0&&console.warn("command already registered",u);continue}o.set(u,c);let h=s.get(c);h&&(h(),s.delete(c));const d=c.addPropertyListener(r);s.set(c,d);const p=c.shortcut();if(!p)continue;const w=Array.isArray(p)?p:[p];for(let C=0;C<w.length;C++){const S=fe(w[C]),E=n.get(S);E&&!t&&t===void 0&&console.warn(`Shortcut already registered: ${S}, ${u}, ${E}.`),n.set(S,u)}}}removeFromParent(){if(!this._parent)return;let e=this._parent,t=[];const o=this._groupKey;for(;e;)t.push(e._nodes),e._nodes.delete(o),e=e._parent;e=this._parent;const n=r=>{r._children.forEach(s=>{for(let a=0;a<t.length;a++)s._nodes.delete(t[a]);n(s)})};n(this),this._parent=null,this._notify("onGroupChange")}addCommands(e,t){this._addCommands(e,t),this._notify("onGroupChange")}getActive(){return this._root._focused??this._root}activate(e){let t=this;if(e&&(t=this._nodes.get(e),!t))return void console.warn("group not found",e);let o=this._root._focused??this._root;for(;o;)o=o._parent;this._root._focused!==t&&(this._root._focused=t,this._notify("onGroupChange"),this._notify("onActiveChange"))}findCommandByEvent(e){const t=[];e.altKey&&t.push(W.Alt),e.shiftKey&&t.push(W.Shift),e.ctrlKey&&t.push(W.Ctrl),e.metaKey&&t.push(W.Meta);let o=fe({key:e.code,modifiers:t});const n=this._commandsByShortcut;let r=n.get(o);r||(o=fe({key:e.key,modifiers:t}),r=n.get(o)),!r&&e.code.startsWith("Digit")&&(o=fe({key:e.code.substring(5,e.code.length),modifiers:t}),r=this._commandsByShortcut.get(o)),!r&&e.code.startsWith("Key")&&(r=fe({key:e.code.substring(3,e.code.length),modifiers:t}),r=n.get(o));let s=null;return r&&(s=this._commandsByKey.get(r),s&&s.disabled()&&(s=null),!s||s.target()&&s.target().contains(e.target)||(s=null)),s||(this._parent?.findCommandByEvent(e)??null)}dispatchToFocusedCommand(e){const t=this.getActive();if(!t||e.isDefaultPrevented())return!1;const o=t.findCommandByEvent?.(e);return!!o&&(o.execute(),e.preventDefault(),!0)}getRoot(){return this._parent?this._parent.getRoot():this}getParent(){return this._parent}addListener(e,t){const o=this._listeners,n=t?.keys,r=this._root._listenersByKey;if(n&&!e.onCommandChange)throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");let s=null;if(n)for(let a=0;a<n.length;a++){const c=n[a];if(!c)continue;let u=r.get(c);u||(u=new Set,r.set(c,u)),s||(s=[]),s.push(u),u.add(e)}return o.add(e),()=>{if(s)for(let a=0;a<s.length;a++)s[a].delete(e);o.delete(e)}}_notifyCommands(e,t,o){const n=this;setTimeout(()=>{e.forEach(r=>{r[t]?.(n,o)})},0)}_notify(e,t){const o=this;setTimeout(()=>{o._listeners.forEach(n=>{n[e]?.(o,t)}),o._parent&&o._parent._notify(e,t)},0)}getAllCommands(){const e=[],t=this._groupKey;return this._commandsByKey.forEach(o=>{e.push({command:o,groupKey:t})}),this._children.forEach(o=>{e.push(...o.getAllCommands())}),e}}const Ro=k.CommonUtils.getOS()===k.CommonUtils.OSType.MacOS||k.CommonUtils.getOS()===k.CommonUtils.OSType.IOS?"Cmd":"Ctrl",Ao=k.CommonUtils.getOS()===k.CommonUtils.OSType.MacOS||k.CommonUtils.getOS()===k.CommonUtils.OSType.IOS?"⌘":"^",fe=(i,e=!1)=>{const t={};for(let n=0;i.modifiers&&n<i.modifiers.length;n++)t[i.modifiers[n]]=!0;let o="";return(t?.[W.Ctrl]||t?.[W.Meta])&&(o+=(o.length>0?"+":"")+(e?Ao:Ro)),t?.[W.Alt]&&(o+=e?"⌥":"Alt"),t?.[W.Shift]&&(o+=(o.length>0?"+":"")+(e?"⇧":"Shift")),o+=(o.length>0?"+":"")+Et(i.key),o},Me=(i,e)=>{const t=[];if(e)for(let o=0;o<e.length;o++){const n=e[o],r=n?i?.getCommand(n):null;t.push(r)}return t},ht=Rt({setClipboard:i=>{throw new Error("This is only available via the useClipboard.")},getClipboard:()=>k.InternalClipboard.Global,refNativeCopy:{current:null},refNativeLastKey:{current:null}},()=>{const[i,e]=l.useState(k.InternalClipboard.Global);return{setClipboard:t=>e(t),getClipboard:()=>i,refNativeCopy:l.useRef(null),refNativeLastKey:l.useRef(null)}});let Oe=!1,Bo=0;var jo=typeof document<"u"?l.useLayoutEffect:l.useEffect;const dt=()=>"sheetxl-ui-"+Bo++,pt=l.useId,Oo=pt??function(){const[i,e]=l.useState(()=>Oe?dt():void 0);return jo(()=>{i==null&&e(dt())},[]),l.useEffect(()=>{Oe||(Oe=!0)},[]),i},ft="Undo the last action.",_t="Repeat the last action or undo the redo.",$o=i=>`Redo ${i}`;exports.Command=De,exports.CommandButtonType={Toolbar:"toolbar",Menuitem:"menuitem"},exports.CommandGroup=Xe,exports.DelegatingReactNotifier=Pt,exports.FocusKeyNavigation=So,exports.HorizontalAlignment={General:"general",Left:"left",Right:"right",Center:"center",Justify:"justify",Fill:"fill",Distributed:"distributed",CenterContinuous:"centerContinuous"},exports.KeyCodes={BackSpace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Insert:45,Delete:46,Digit_8:56,Y:89,Z:90,Meta:91,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NumLock:144,ScrollLock:145,BackSlash:220,Slash:191,BracketRight:221,BracketLeft:219},exports.KeyModifiers=W,exports.MouseButtonCodes={Left:1,Middle:2,Right:3},exports.NotifierProvider=({children:i,notifier:e})=>(l.useEffect(()=>{const t=k.Notifier.getDelegate();return k.Notifier.setDelegate(e),()=>{k.Notifier.setDelegate(t)}},[e]),l.createElement(kt.Provider,{value:e},i)),exports.NotifierType=Ve,exports.ReactUtils=mo,exports.RoundedTab=Co,exports.ScrollPane=Mt,exports.ScrollUtils=to,exports.Scrollbar=ze,exports.ScrollbarOrientation=ee,exports.SimpleCommand=Le,exports.SplitPane=Lo,exports.SplitPaneResizer=Dt,exports.ToolTipPlacement={BottomEnd:"bottom-end",BottomStart:"bottom-start",Bottom:"bottom",LeftEnd:"left-end",LeftStart:"left-start",Left:"left",RightEnd:"right-end",RightStart:"right-start",Right:"right",TopEnd:"top-end",TopStart:"top-start",Top:"top"},exports.VirtualScrollbar=Tt,exports.defaultCreateScrollCorner=Lt,exports.defaultCreateScrollEdgeButton=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"rotate(90) ":"";return v.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"end",transition:"fill-opacity 1s",zIndex:1,width:"24px",height:"24px",...e},className:`scrollbar-button ${n?"vertical":"horizontal"} edge`,...o,children:v.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",transform:r,children:v.jsx("path",{style:{transition:"opacity 240ms ease 0s",opacity:i.disabled?0:1},d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})})})},exports.defaultCreateScrollEndButton=vt,exports.defaultCreateScrollStartButton=yt,exports.defaultCreateScrollbar=He,exports.getDevicePixelRatio=function(i){if(typeof window>"u")return 1;const{defaultDpr:e=1,maxDpr:t=3,round:o=!0}=i||{},n=typeof window<"u"&&typeof window.devicePixelRatio=="number"?window.devicePixelRatio:e;return Math.min(Math.max(1,o?Math.floor(n):n),t)},exports.toShortcutString=fe,exports.useCallbackRef=L,exports.useCommand=function(i,e=null){const t=l.useRef(e);t.current=e;const[o,n]=l.useReducer(s=>s+1,0),r=l.useMemo(()=>Array.isArray(i)?i:[i],[i]);return l.useEffect(()=>{if(!r||r.length===0)return;const s=(u,h)=>{t.current?.onChange?.(h),n()};let a=null;e&&(a={onExecute(u,h){t.current?.onExecute?.(u,h)},onError(u,h,d){t.current?.onError?.(u,h,d)}});const c=new Set;for(let u=0;u<r.length;u++)c.add(r[u]?.addPropertyListener(k.CommonUtils.debounce(s,0),!0)),e&&c.add(r[u]?.addExecuteListener(a));return()=>{c.forEach(u=>{u?.()})}},[i]),o},exports.useCommands=function(i,e=null,t=null,o){const n=l.useRef(t);n.current=t,e&&!Array.isArray(e)&&(e=[e]);const[r,s]=l.useState(Me(i,e)),a=o?[...o,i]:[i];return l.useEffect(()=>{const c={onGroupChange:()=>{const p=Me(i,e);s(p),n.current?.onChange?.(this)}};let u;e&&e.length>0&&(u={keys:e},c.onCommandChange=(p,w)=>{n.current?.onChange?.(i),s(Me(i,e))});const h=i?.addListener(c,u),d=Me(i,e);return s(d),n.current?.onChange&&n.current?.onChange(i),()=>{h?.()}},a),r},exports.useCopyPaste=i=>{const{source:e,target:t,onPaste:o,onClipboardUpdate:n,commands:r}=i,s=Be(),a=L(n,[n]),c=L(o,[o]),{getClipboard:u,refNativeCopy:h}=ht(),d=u();l.useMemo(()=>{const _=e?.element,x=t?.element??e?.element;if(!r)return;const g=[new Le("cut",_,{label:"Cut",description:"Remove the selection and put it on the clipboard so you can paste it somewhere else.",shortcut:{key:"X",modifiers:[W.Ctrl]}}),new Le("copy",_,{label:"Copy",description:"Put a copy of the selection on the clipboard so you can paste it somewhere else.",shortcut:{key:"C",modifiers:[W.Ctrl]}}),new Le("paste",x,{label:"Paste",description:"Add content on the clipboard to your document.",shortcut:[{key:"V",modifiers:[W.Ctrl]},{key:"F8",modifiers:[W.Ctrl]}]})];r?.addCommands(g,!0)},[r]);const p=L(async _=>{if(!e?.element)return;let x=null;try{x=e.doCopy?.(_),typeof x=="string"?await d.writeText(x):await d.writeReference(x)}catch(g){throw g}},[e,s]),w=L(async _=>{const x=e?.element?.();if(x){h.current={sourceElement:x,args:_};try{await p(_)}catch(g){s.showError?.(g)}}},[e?.element,s]),C=l.useCallback(()=>{w({isCut:!0})},[]),S=L(async(_,x,g)=>{try{if(await _.doPaste(x,g)===!1)return;c?.(x,g)}catch(A){s.showError?.(A)}},[c]),E=L(async(_,x,g)=>{const A=t?.element?.();if(A&&await k.CommonUtils.whenFocus(A),!_&&!x)return;const R=await s.showBusy?.("Pasting...");if(x)try{return await S(t,x,g),void R?.()}catch(y){R?.(),s.showError?.(y)}let O,N=t.importFromExternal;N||(N=(y,b)=>({getItemType:()=>"text",toText:()=>_.text,isClipboardItem:!0}));try{O=await N(_,{isCut:!1})}catch(y){R?.(),s.showError?.(y)}if(O)try{const y=await Promise.resolve(O);await S(t,y,g),R?.()}catch(y){R?.(),s.showError?.(y)}else R?.()},[S,t,s]),z=L(async _=>{if(t?.element)try{const x=await d.readReference();if(x)return void await E(null,x,_);const g=[];g[0]=await k.ClipboardUtils.readStringFromClipboard(d,k.MimeType.plain),g[1]=await k.ClipboardUtils.readHTMLFromClipboard(d,k.MimeType.html),g[2]=await k.ClipboardUtils.readBlobFromClipboard(d,k.MimeType.png);const A={text:g[0]??null,html:g[1]??null,image:g[2]??null};await E(A,null,_)}catch(x){if(x?.message==="Document is not focused.")return;s.showError?.(x)}},[E,t?.element,s]);return L(async _=>{},[e?.element]),L(async _=>{},[t?.element,E,s]),l.useEffect(()=>{if(!d)return;const _=async A=>{const R=await d.readReference();a?.(R)},x=A=>{s.showMessage?.(k.InternalClipboard.ErrorMessages.PermsRead,{onceKey:"clipboard.features"})},g=A=>{s.showMessage?.(k.InternalClipboard.ErrorMessages.PermsWrite,{onceKey:"clipboard.features"})};return d.addEventListener("clipboardchange",_),d.addEventListener("clipboarderrorread",x),d.addEventListener("clipboarderrorwrite",g),()=>{d.removeEventListener("clipboardchange",_),d.removeEventListener("clipboarderrorread",x),d.removeEventListener("clipboarderrorwrite",g)}},[d,s]),l.useEffect(()=>{},[p,E,e,t]),l.useEffect(()=>{r?.getCommand("cut")?.updateCallback(C).update({disabled:!e||!t}),r?.getCommand("copy")?.updateCallback(w).update({disabled:!e}),r?.getCommand("paste")?.updateCallback(z).update({disabled:!t})},[e,t,r]),{paste:z,copy:w,clipboard:d}},exports.useDevicePixelRatio=function(i){const[e,t]=l.useState(typeof window<"u"?window.devicePixelRatio:1),o=l.useRef(null);return l.useEffect(()=>{if(!(typeof window<"u"&&"matchMedia"in window))return;const n=()=>{const r=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);r.addEventListener("change",n,{once:!0,passive:!0}),t(window.devicePixelRatio),o.current={mediaMatcher:r,listener:n}};return n(),()=>{o.current&&o.current.mediaMatcher.removeEventListener("change",o.current.listener)}},[i]),e},exports.useEditMode=()=>{const i=zo();return l.useMemo(()=>({setMode:e=>{At(t=>(typeof e=="function"&&(e=e(t)),e?.onModeChange?.(e??null),e))},getMode:()=>i}),[i])},exports.useFullscreenPortal=function(){const[i,e]=l.useState(!!document.fullscreenElement),t=l.useCallback(()=>{const o=document.fullscreenElement;return o?o.querySelector(".fullscreen-portal-root")||o:document.body},[]);return l.useEffect(()=>{function o(){const n=document.fullscreenElement;if(e(!!n),!n)return;let r=n.querySelector(".fullscreen-portal-root");r||(r=document.createElement("div"),r.className="fullscreen-portal-root _fullscreen-portal-root_1mjsr_4",n.appendChild(r))}return Se++,o(),document.addEventListener("fullscreenchange",o),()=>{document.removeEventListener("fullscreenchange",o),Se--,Se<=0&&(document.querySelectorAll(".fullscreen-portal-root").forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),Se=0)}},[]),{getPortalContainer:t,isFullscreen:i}},exports.useGlobalClipboard=ht,exports.useId=Oo,exports.useImperativeElement=Ye,exports.useMouseDownAndHoldListener=function(i,e){return ut({onPointerDown:i,onPointerMoveOrWait:(t,o,n)=>{i?.(n)},...e})},exports.useNotifier=Be,exports.useOnClickOrFocusAway=function(i,e,t){const o=L(e,[e]);l.useEffect(()=>{const n=r=>{i.current&&!i.current.contains(r.target)&&o(r)};return t&&t.mouseEvents===!1||(document.addEventListener("mousedown",n),document.addEventListener("touchstart",n)),t&&t.focusEvents===!1||document.addEventListener("focus",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n),document.removeEventListener("focus",n)}},[i])},exports.useSynchronizedPointerHandler=ut,exports.useTraceUpdate=function(i,e=!0){const t=l.useRef(i);l.useEffect(()=>{if(e){const o=Object.entries(i).reduce((n,[r,s])=>(t.current[r]!==s&&(n[r]=[t.current[r],s]),n),{});Object.keys(o).length>0&&console.log("Changed props:",o)}t.current=i})},exports.useUndoManager=({manager:i,commands:e,disabled:t})=>{const o=Be(),n=L(s=>{try{i?.undo(s)}catch(a){o.error(a)}},[i]),r=L(s=>{try{i?.redo(s)}catch(a){o.error(a)}},[i]);return l.useMemo(()=>{if(!e)return;const s={contains:c=>!0,focus(){}},a=[new De("undo",s,{label:"Undo",description:ft,shortcut:{key:"z",modifiers:[W.Ctrl]},disabled:!0},n),new De("redo",s,{label:"Redo",description:_t,shortcut:[{key:"y",modifiers:[W.Ctrl]},{key:"F4"},{key:"Enter",modifiers:[W.Alt]}],disabled:!0},r)];e?.addCommands(a,!0)},[e]),l.useEffect(()=>{if(!e)return;const s=()=>{const c=i?.getTopUndoDescription(),u={};var h;e.getCommand("undo").update({disabled:t||!i||!i.hasUndo(),description:c?(h=c,`Undo ${h}`):ft,state:u,context:{undoManager:i}});const d=i?.getTopRedoDescription();e.getCommand("redo").update({disabled:t||!i||!i.hasRedo(),description:d?$o(d):_t,state:u,context:{undoManager:i}})};if(s(),!i)return;const a=i.addListener({onStackChange(){s()}});return()=>a?.()},[i,e,t]),{undo:n,redo:r}};
7
+ */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),l=require("react"),k=require("@sheetxl/utils"),Gt=require("react-dom/client"),Jt=require("react-dom"),W={Shift:"shift",Alt:"alt",Ctrl:"ctrl",Meta:"meta"},ee={Horizontal:"horizontal",Vertical:"vertical"};function mt(i){var e,t,o="";if(typeof i=="string"||typeof i=="number")o+=i;else if(typeof i=="object")if(Array.isArray(i)){var n=i.length;for(e=0;e<n;e++)i[e]&&(t=mt(i[e]))&&(o&&(o+=" "),o+=t)}else for(t in i)i[t]&&(o&&(o+=" "),o+=t);return o}function _e(){for(var i,e,t=0,o="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=mt(i))&&(o&&(o+=" "),o+=e);return o}var Qt=function(){},gt=typeof window<"u",eo=gt?l.useLayoutEffect:l.useEffect,it={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const he=gt&&window.ResizeObserver!==void 0?function(){var i=l.useState(null),e=i[0],t=i[1],o=l.useState(it),n=o[0],r=o[1],s=l.useMemo(function(){return new window.ResizeObserver(function(a){if(a[0]){var c=a[0].contentRect,u=c.x,h=c.y,d=c.width,p=c.height,w=c.top,C=c.left,S=c.bottom,E=c.right;r({x:u,y:h,width:d,height:p,top:w,left:C,bottom:S,right:E})}})},[]);return eo(function(){if(e)return s.observe(e),function(){s.disconnect()}},[e]),[t,n]}:function(){return[Qt,it]},L=(i,e)=>{const t=l.useCallback((...r)=>i?.(...r),e),o=l.useRef(null);o.current=t;const n=l.useCallback((...r)=>o.current?.(...r),[]);if(o.current)return n},yt=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z":"m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z";return v.jsx("div",{style:{paddingBottom:"0px",paddingRight:"0px",paddingLeft:n?"0px":"3px",paddingTop:n?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...e},...o,children:v.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${n?"vertical":"horizontal"} single-button start`,children:v.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:v.jsx("path",{d:r})})})})},vt=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z":"m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z";return v.jsx("div",{style:{paddingLeft:"0px",paddingTop:"0px",paddingRight:n?"0px":"3px",paddingBottom:n?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...e},...o,children:v.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${n?"vertical":"horizontal"} single-button end`,children:v.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:v.jsx("path",{d:r})})})})},$e=(i,e,t,o,n=0)=>{for(let r=0;r<t.length;r++){const s=t[r].getBoundingClientRect();let a=s.left-e,c=a+s.width;if(o){if(a<i&&c>=i)return a}else if(Math.ceil(c)>Math.ceil(i)+2)return c}return n},to=Object.freeze(Object.defineProperty({__proto__:null,getScrollTo:$e},Symbol.toStringTag,{value:"Module"})),oo="_sheetxl-scrollbar_eblx4_6",ze=l.memo(l.forwardRef((i,e)=>{const{offset:t=0,totalSize:o=0,viewportSize:n=0,style:r,className:s,orientation:a=ee.Vertical,onScrollOffset:c,onScroll:u,showCustomScrollButtons:h=!1,scrollButtonIncrement:d=200,scrollButtonInitialRepeatDelay:p=260,scrollButtonAdditionalRepeatDelay:w=120,createScrollStartButton:C=yt,createScrollEndButton:S=vt,...E}=i,z=L(u,[u]),_=l.useRef(null),[x,{width:g,height:A}]=he(),[R,{width:j,height:N}]=he(),y=a===ee.Vertical,b=y?"top":"left",B=y?"scrollTop":"scrollLeft",f=y?A:g,M=y?N:j,[m,T]=l.useState(null);l.useEffect(()=>{m!==null&&_.current&&_.current.scrollTo({behavior:"smooth",[b]:m})},[m,y]);const P=l.useCallback(($,oe=!1)=>{if(!_.current)return 0;const te=_.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=oe?0:$e($,ce[b],ne,!0,Math.max(0,$-d));return T(re),Math.max(0,re)},[]),X=l.useCallback(($,oe=!1)=>{if(!_.current)return 0;const te=_.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=Math.ceil(M-f),ye=oe?re:$e($,ce[b],ne,!1,Math.max(0,$+d));return T(ye),Math.min(re,ye)},[M,f]),V=l.useRef(null),I=l.useCallback($=>{V.current=t;const oe=$.target[B];c(oe,n,o),z?.($)},[c,n,o,t]);l.useEffect(()=>{const $=V.current;V.current=null,t!==$&&(_.current[B]=t)},[t,B]);const F=l.useRef(null),O=l.useRef(null),H=l.useCallback(()=>{F.current&&(clearTimeout(F.current),F.current=null,O.current=null)},[]),U=l.useCallback(($,oe,te,ce=p)=>{O.current=$,F.current=setTimeout(()=>{const ne=te?P(O.current||$):X(O.current||$);ne!==O.current?U(ne,!1,te,w):H()},oe?0:ce)},[P,X,H]);l.useEffect(()=>()=>H(),[H]);const J=t,de=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(J)<=0||Math.floor(M-f)===0,onMouseUp:H,onMouseLeave:H,onMouseDown:()=>U(J,!0,!0)};return C?.($)},[h,a,J,m,M,f]),pe=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(M-f)<=Math.ceil(J),onMouseUp:H,onMouseLeave:H,onMouseDown:()=>U(J,!0,!1)};return S?.($)},[h,a,J,m,M,f]);return v.jsxs("div",{ref:e,style:{display:"flex",flex:"1",flexDirection:y?"column":"row",padding:"0",...r},className:_e(oo,s),...E,children:[de,v.jsx("div",{className:"pseudo-scrollbar",style:{flex:"1 1 100%",display:"flex",boxSizing:"content-box",flexDirection:y?"column":"row",justifyContent:"center",alignItems:"center"},ref:x,children:v.jsx("div",{tabIndex:-1,style:{flex:"1 1 100%",overflowY:y?"scroll":"hidden",overflowX:y?"hidden":"scroll",position:"relative",willChange:"transform"},onScroll:I,ref:_,children:v.jsx("div",{ref:R,style:{position:"absolute",height:y?o-n+(A??0):1,width:y?1:o-n+(g??0)},className:"scrollbar-viewport"})})}),pe]})}));ze.displayName="Scrollbar";let rt=Date.now,st=1e3,ae={},no=1;const ve=i=>{let e=ae[i]!==null;return e&&(ae[i]=null),e},lt=(i,e,t,o=0,n)=>{let r=rt(),s=r,a=0,c=0,u=0,h=no++;if(h%20==0){const p={};for(let w in ae)p[w]=!0;ae=p}const d=function(p){let w=p!==!0,C=rt(),S=!0;try{S=(!e||e(h))??!0}catch{S=!1}if(!ae[h]||!S)return ae[h]=null,void t?.(60-c/((C-r)/st),h,!1);if(w){u=Math.round((C-s)/16.666666666666668)-1;for(let _=0;_<Math.min(u,4);_++)d(!0),c++}o&&(a=(C-r)/o,a>1&&(a=1));let E=n?n(a):a,z=!1;try{z=i(E,C,w)}catch{z=!1}z!==!1&&a!==1||!w?w&&(s=C,requestAnimationFrame(d)):(ae[h]=null,t?.(60-c/((C-r)/st),h,a===1||o==null))};return ae[h]=!0,requestAnimationFrame(d),h},io=function(i){return Math.pow(i-1,3)+1},ro=function(i){return(i/=.5)<1?.5*Math.pow(i,3):.5*(Math.pow(i-2,3)+2)};class so{constructor(e,t){this.__isSingleTouch=!1,this.__isTracking=!1,this.__didDecelerationComplete=!1,this.__isGesturing=!1,this.__isDragging=!1,this.__isDecelerating=0,this.__isAnimating=0,this.__interruptedAnimation=!1,this.__lastScale=1,this.__enableScrollX=!0,this.__enableScrollY=!0,this.__clientLeft=0,this.__clientTop=0,this.__clientWidth=0,this.__clientHeight=0,this.__contentWidth=0,this.__contentHeight=0,this.__snapWidth=100,this.__snapHeight=100,this.__zoomLevel=1,this.__scrollLeft=0,this.__scrollTop=0,this.__maxScrollLeft=0,this.__maxScrollTop=0,this.__scheduledLeft=0,this.__scheduledTop=0,this.__scheduledZoom=0,this.__lastTouchLeft=0,this.__lastTouchTop=0,this.__lastTouchMove=0,this.__positions=[],this.__initialTouchLeft=0,this.__initialTouchTop=0,this.__zoomLevelStart=1,this.__minDecelerationScrollLeft=null,this.__minDecelerationScrollTop=null,this.__maxDecelerationScrollLeft=null,this.__maxDecelerationScrollTop=null,this.__decelerationVelocityX=null,this.__decelerationVelocityY=0,this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:void 0,penetrationDeceleration:.03,penetrationAcceleration:.08,...t}}setDimensions(e,t,o,n){e!==null&&(this.__clientWidth=e),t!==null&&(this.__clientHeight=t),o!==null&&(this.__contentWidth=o),n!==null&&(this.__contentHeight=n),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)}setPosition(e,t){this.__clientLeft=e||0,this.__clientTop=t||0}setSnapSize(e,t){this.__snapWidth=e,this.__snapHeight=t}getValues(){return{left:this.__scrollLeft,top:this.__scrollTop,right:this.__scrollLeft+this.__clientWidth/this.__zoomLevel,bottom:this.__scrollTop+this.__clientHeight/this.__zoomLevel,zoom:this.__zoomLevel}}getPoint(e,t){const o=this.getValues();return{left:e/o.zoom,top:t/o.zoom}}getScrollMax(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}}zoomTo(e,t=!1,o,n,r){if(!this.options.zooming)throw new Error("Zooming is not enabled!");r&&(this.__zoomComplete=r),this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0);const s=this.__zoomLevel;o===void 0&&(o=this.__clientWidth/2),n===void 0&&(n=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);const a=e/s;let c=a*(this.__scrollLeft+o)-o,u=a*(this.__scrollTop+n)-n;c>this.__maxScrollLeft?c=this.__maxScrollLeft:c<0&&(c=0),u>this.__maxScrollTop?u=this.__maxScrollTop:u<0&&(u=0),this.__publish(c,u,e,t)}zoomBy(e,t=!1,o=0,n=0,r){this.zoomTo(this.__zoomLevel*e,t,o,n,r)}scrollTo(e,t,o=!1,n=1){if(this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0),n!==void 0&&n!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=n,t*=n,this.__computeScrollMax(n)}else n=this.__zoomLevel;this.options.scrollingX?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(o=!1),this.__publish(e,t,n,o)}scrollBy(e=0,t=0,o=!1){const n=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,r=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(n+(e||0),r+(t||0),o)}doMouseZoom(e,t,o,n){const r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,o-this.__clientLeft,n-this.__clientTop)}doTouchStart(e,t){if(e.length===void 0)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),typeof t!="number")throw new Error("Invalid timestamp value: "+t);let o,n;this.__interruptedAnimation=!0,this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0,this.__interruptedAnimation=!0),this.__isAnimating&&(ve(this.__isAnimating),this.__isAnimating=0,this.__interruptedAnimation=!0);let r=e.length===1;r?(o=e[0].pageX,n=e[0].pageY):(o=Math.abs(e[0].pageX+e[1].pageX)/2,n=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=o,this.__initialTouchTop=n,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=o,this.__lastTouchTop=n,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!r&&this.options.scrollingX,this.__enableScrollY=!r&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!r,this.__isSingleTouch=r,this.__positions=[]}doTouchMove(e,t,o=1){if(e.length===void 0)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),typeof t!="number")throw new Error("Invalid timestamp value: "+t);if(!this.__isTracking)return;let n,r;e.length===2?(n=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(n=e[0].pageX,r=e[0].pageY);let s=this.__positions;if(this.__isDragging){let a=n-this.__lastTouchLeft,c=r-this.__lastTouchTop,u=this.__scrollLeft,h=this.__scrollTop,d=this.__zoomLevel;if(o!==void 0&&this.options.zooming){let p=d;if(d=d/this.__lastScale*o,d=Math.max(Math.min(d,this.options.maxZoom),this.options.minZoom),p!==d){let w=n-this.__clientLeft,C=r-this.__clientTop;u=(w+u)*d/p-w,h=(C+h)*d/p-C,this.__computeScrollMax(d)}}if(this.__enableScrollX){u-=a*this.options.speedMultiplier;let p=this.__maxScrollLeft;(u>p||u<0)&&(this.options.bouncing?u+=a/2*this.options.speedMultiplier:u=u>p?p:0)}if(this.__enableScrollY){h-=c*this.options.speedMultiplier;const p=this.__maxScrollTop;(h>p||h<0)&&(this.options.bouncing?h+=c/2*this.options.speedMultiplier:h=h>p?p:0)}s.length>60&&s.splice(0,30),s.push(u,h,t),this.__publish(u,h,d)}else{let a=this.options.locking?3:0,c=5,u=Math.abs(n-this.__initialTouchLeft),h=Math.abs(r-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&u>=a,this.__enableScrollY=this.options.scrollingY&&h>=a,s.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(u>=c||h>=c),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=n,this.__lastTouchTop=r,this.__lastTouchMove=t,this.__lastScale=o}doTouchEnd(e){if(e instanceof Date&&(e=e.valueOf()),typeof e!="number")throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){let t=this.__positions,o=t.length-1,n=o;for(let r=o;r>0&&t[r]>this.__lastTouchMove-100;r-=3)n=r;if(n!==o){const r=t[o]-t[n],s=this.__scrollLeft-t[n-2],a=this.__scrollTop-t[n-1];this.__decelerationVelocityX=s/r*(1e3/60),this.__decelerationVelocityY=a/r*(1e3/60);const c=this.options.paging||this.options.snapping?4:1;(Math.abs(this.__decelerationVelocityX)>c||Math.abs(this.__decelerationVelocityY)>c)&&this.__startDeceleration(e)}else this.options.scrollingComplete?.()}else e-this.__lastTouchMove>100&&this.options.scrollingComplete?.();this.__isDecelerating||((this.__interruptedAnimation||this.__isDragging)&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel)),this.__positions.length=0}}__publish(e,t,o,n=!1){const r=this.__isAnimating;if(r&&(ve(r),this.__isAnimating=0),n&&this.options.animating){this.__scheduledLeft=e,this.__scheduledTop=t,this.__scheduledZoom=o;const s=this.__scrollLeft,a=this.__scrollTop,c=this.__zoomLevel,u=e-s,h=t-a,d=o-c,p=function(S,E,z){z&&(this.__scrollLeft=s+u*S,this.__scrollTop=a+h*S,this.__zoomLevel=c+d*S,this.__callback&&this.__callback(this.__scrollLeft,this.__scrollTop,this.__zoomLevel))}.bind(this),w=function(S){return this.__isAnimating===S}.bind(this),C=function(S,E,z){E===this.__isAnimating&&(this.__isAnimating=!1),(this.__didDecelerationComplete||z)&&this.options.scrollingComplete?.(),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}.bind(this);this.__isAnimating=lt(p,w,C,this.options.animationDuration,r?io:ro)}else this.__scheduledLeft=this.__scrollLeft=e,this.__scheduledTop=this.__scrollTop=t,this.__scheduledZoom=this.__zoomLevel=o,this.__callback&&this.__callback(e,t,o),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}__computeScrollMax(e=this.__zoomLevel){this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)}__startDeceleration(e){if(this.options.paging){const s=Math.max(Math.min(this.__scrollLeft,this.__maxScrollLeft),0),a=Math.max(Math.min(this.__scrollTop,this.__maxScrollTop),0),c=this.__clientWidth,u=this.__clientHeight;this.__minDecelerationScrollLeft=Math.floor(s/c)*c,this.__minDecelerationScrollTop=Math.floor(a/u)*u,this.__maxDecelerationScrollLeft=Math.ceil(s/c)*c,this.__maxDecelerationScrollTop=Math.ceil(a/u)*u}else this.__minDecelerationScrollLeft=0,this.__minDecelerationScrollTop=0,this.__maxDecelerationScrollLeft=this.__maxScrollLeft,this.__maxDecelerationScrollTop=this.__maxScrollTop;const t=function(s,a,c){this.__stepThroughDeceleration(c)}.bind(this),o=this.options.snapping?4:.1,n=function(){const s=Math.abs(this.__decelerationVelocityX)>=o||Math.abs(this.__decelerationVelocityY)>=o;return s||(this.__didDecelerationComplete=!0),s}.bind(this),r=function(s,a,c){this.__isDecelerating=0,this.__didDecelerationComplete&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,this.options.snapping)}.bind(this);this.__isDecelerating=lt(t,n,r)}__stepThroughDeceleration(e){let t=this.__scrollLeft+this.__decelerationVelocityX,o=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){const n=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);n!==t&&(t=n,this.__decelerationVelocityX=0);const r=Math.max(Math.min(this.__maxDecelerationScrollTop,o),this.__minDecelerationScrollTop);r!==o&&(o=r,this.__decelerationVelocityY=0)}if(e?this.__publish(t,o,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=o),!this.options.paging&&(this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95),this.options.bouncing){let n=0,r=0,s=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;t<this.__minDecelerationScrollLeft?n=this.__minDecelerationScrollLeft-t:t>this.__maxDecelerationScrollLeft&&(n=this.__maxDecelerationScrollLeft-t),o<this.__minDecelerationScrollTop?r=this.__minDecelerationScrollTop-o:o>this.__maxDecelerationScrollTop&&(r=this.__maxDecelerationScrollTop-o),n!==0&&(n*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=n*s:this.__decelerationVelocityX=n*a),r!==0&&(r*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=r*s:this.__decelerationVelocityY=r*a)}}}var Z=typeof window<"u"?window:{screen:{},navigator:{}},ge=(Z.matchMedia||function(){return{matches:!1}}).bind(Z),xt=!1,lo={get passive(){return xt=!0}},at=function(){};Z.addEventListener&&Z.addEventListener("p",at,lo),Z.removeEventListener&&Z.removeEventListener("p",at,!1);var ao=xt,co="PointerEvent"in Z,Ue="ontouchstart"in Z,bt=Ue||"TouchEvent"in Z&&ge("(any-pointer: coarse)").matches,ct=(Z.navigator.maxTouchPoints||0)>0||bt,wt=Z.navigator.userAgent||"",uo=ge("(pointer: coarse)").matches&&/iPad|Macintosh/.test(wt)&&Math.min(Z.screen.width||0,Z.screen.height||0)>=768,St=(ge("(pointer: coarse)").matches||!ge("(pointer: fine)").matches&&Ue)&&!/Windows.*Firefox/.test(wt),ho=ge("(any-pointer: fine)").matches||ge("(any-hover: hover)").matches||uo||!Ue,Ke=!ct||!ho&&St?ct?"touchOnly":"mouseOnly":"hybrid",po=Ke==="mouseOnly"?"mouse":Ke==="touchOnly"||St?"touch":"mouse";const fo=Object.freeze(Object.defineProperty({__proto__:null,deviceType:Ke,primaryInput:po,supportsPassiveEvents:ao,supportsPointerEvents:co,supportsTouchEvents:bt},Symbol.toStringTag,{value:"Module"})),_o=new Set(["INPUT","TEXTAREA","SELECT"]),Ct={};function Ne(){return fo}const Et=i=>i==="BracketLeft"?"[":i==="BracketRight"?"]":k.CommonUtils.camelToPrettyCase(i),mo=Object.freeze(Object.defineProperty({__proto__:null,EmptyCssProperties:Ct,boundPixel:function(i,e=!1,t=0){return i},createSyntheticEvent:i=>{let e=!1,t=!1;return{nativeEvent:i,currentTarget:i.currentTarget,target:i.target,bubbles:i.bubbles,cancelable:i.cancelable,defaultPrevented:i.defaultPrevented,eventPhase:i.eventPhase,isTrusted:i.isTrusted,preventDefault:()=>{e=!0,i.preventDefault()},isDefaultPrevented:()=>e,stopPropagation:()=>{t=!0,i.stopPropagation()},isPropagationStopped:()=>t,persist:()=>{},timeStamp:i.timeStamp,type:i.type}},detectIt:Ne,focusableNodeNames:_o,toPrettyKeyCode:Et},Symbol.toStringTag,{value:"Module"})),go=[];function Ye(i,e,t=go){const o=l.useRef(null);return l.useImperativeHandle(i,()=>{if(!o.current)return;const n=o.current,r=e?.();if(!r||typeof r!="object")throw new Error("attributes must return a plain object of values");const s=Object.keys(r),a=s.length;for(let c=0;c<a;c++){const u=s[c],h=r[u];Object.defineProperty(n,u,{value:h,writable:!0,configurable:!0,enumerable:!0})}return n},t),o}const He=i=>v.jsx(ze,{...i}),Lt=({width:i,height:e})=>v.jsx("div",{className:"corner",style:{minWidth:`${i}px`,width:`${i}px`,minHeight:`${e}px`,height:`${e}px`}}),Mt=l.memo(l.forwardRef((i,e)=>{const{children:t,viewport:o,onScrollViewport:n,showHorizontalScrollbar:r=!0,showVerticalScrollbar:s=!0,createScrollCorner:a=Lt,createHorizontalScrollbar:c=He,createVerticalScrollbar:u=He,style:h,touchElement:d,disableTouch:p,...w}=i,C=L(n,[n]),S=Ye(e,()=>({isScrollPane:()=>!0}),[]),E=l.useRef(null);l.useEffect(()=>{E.current&&(E.current.__scrollTop===o?.top&&E.current.__scrollLeft===o?.left||E.current.__isDecelerating||E.current?.scrollTo(o?.left,o?.top,!1))},[o?.left,o?.top,d]);const z=l.useCallback((f,M)=>{C?.({left:f,top:M})},[]),_=l.useCallback(f=>{E.current?.doTouchStart(f.touches,f.timeStamp)},[]),x=l.useCallback(f=>{f.preventDefault(),E.current?.doTouchMove(f.touches,f.timeStamp)},[]),g=l.useCallback(f=>{E.current?.doTouchEnd(f.timeStamp)},[]),A=l.useCallback(({containerWidth:f,containerHeight:M,totalWidth:m,totalHeight:T})=>{E.current.setDimensions(f,M,m,T)},[]);l.useEffect(()=>{const f=d??S.current;if(!p&&Ne().supportsTouchEvents&&f&&o){if(!E.current){const M={scrollingX:!0,scrollingY:!0,decelerationRate:.95,penetrationAcceleration:.08};E.current=new so(z,M)}Ne().supportsTouchEvents&&(f.addEventListener("touchstart",_),f.addEventListener("touchend",g),f.addEventListener("touchmove",x)),A({containerWidth:o?.width,containerHeight:o?.height,totalWidth:o?.totalWidth,totalHeight:o?.totalHeight})}return()=>{f?.removeEventListener("touchstart",_),f?.removeEventListener("touchend",g),f?.removeEventListener("touchmove",x)}},[o?.width,o?.height,o?.totalWidth,o?.totalHeight,p,d]);const[R,{width:j}]=he(),[N,{height:y}]=he(),b=l.useMemo(()=>{const f=u({orientation:ee.Vertical,offset:o?.top,viewportSize:o?.height,totalSize:o?.totalHeight,onScrollOffset:M=>{C?.({top:M})}});return v.jsx("div",{style:{display:"flex",flex:"0"},ref:R,children:f})},[u,o?.top,o?.height,o?.totalHeight]),B=l.useMemo(()=>{const f=c({orientation:ee.Horizontal,offset:o?.left,viewportSize:o?.width,totalSize:o?.totalWidth,onScrollOffset:M=>C?.({left:M})});return v.jsxs("div",{style:{display:"flex",flex:"none",flexDirection:"row",alignItems:"stretch",justifyContent:"center"},children:[v.jsx("div",{style:{display:"flex",flex:"1 1 100%",flexDirection:"column",width:`calc(100% - ${j}px)`},children:v.jsx("div",{ref:N,className:"sizer",children:f})}),s?a({width:j,height:y}):v.jsx(v.Fragment,{})]})},[c,o?.left,o?.width,o?.totalWidth,s,a,j,y]);return v.jsx("div",{style:{position:"relative",display:"flex",minWidth:s?`${j}px`:void 0,minHeight:r?`${y}px`:void 0,...h},...w,ref:S,children:v.jsxs("div",{style:{position:"relative",width:"100%",flex:"1 1 100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:[v.jsxs("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:[v.jsx("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:t}),s?b:v.jsx(v.Fragment,{})]}),r?B:v.jsx(v.Fragment,{})]})})}));Mt.displayName="ScrollPane";let Se=0;const yo=100,vo=100,xo=1e6,bo=100,wo=50,Tt=l.memo(l.forwardRef((i,e)=>{const{offset:t=0,viewportSize:o=0,totalSize:n=0,minSize:r=0,endGap:s=yo,endScrollIncrement:a=vo,style:c=Ct,onMouseDown:u,onScrollOffset:h,onScroll:d,scaleLimit:p=xo,scaleFactor:w=bo,precisionFactor:C=wo,...S}=i;d&&console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");const E=L(u,[u]),z=()=>({offset:t,totalSize:p===0?n:Math.min(n??0,Math.max(r??0,(t??0)+(o??0))+(s??0))}),[_,x]=l.useState(z),g=p!==0&&_.totalSize>p?w:1,A=g/C,R=Math.ceil(_.totalSize/g),j=Math.ceil(_.offset/g),N=Math.ceil(o/g),y=l.useCallback(P=>{},[]),[b,B]=l.useState(!1),f=l.useRef(null);l.useLayoutEffect(()=>{if(!b){f.current={propTotalSize:n,propViewportSize:o,propOffset:t};const P=z();x(P)}},[n,o,t,b,r,s,a]);const M=L((P,X,V)=>{const I=f.current;f.current=null,I&&I.propTotalSize===n&&I.propViewportSize===o&&I.propOffset===t||(Math.abs(P-j)<A&&(P=j),h?.(P*g,j,N))},[h,g,A,j,N]),m=l.useCallback(P=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",m),B(!1)},[]),T=l.useCallback(P=>{E?.(P),B(!0),document.addEventListener("mousemove",y,{passive:!0}),document.addEventListener("mouseup",m,{passive:!0})},[y,m]);return v.jsx(ze,{ref:e,style:{...c},...S,offset:j,totalSize:R,viewportSize:N,onMouseDown:T,onScrollOffset:M})}));Tt.displayName="VirtualScrollbar";function Ae(i,e){if(typeof i=="function")return i(e);i&&(i.current=e)}var Pe=parseInt(l.version.split(".")[0],10)>=19?function(i){return e=>{const t=[];for(const o of i){const n=Ae(o,e),r=typeof n=="function";t.push(r?n:()=>Ae(o,null))}return()=>{for(const o of t)o()}}}:function(i){return e=>{for(const t of i)Ae(t,e)}};const So=l.memo(l.forwardRef((i,e)=>{const{refFocusStart:t,...o}=i,n=l.useRef(null),r=l.useCallback(()=>{if(t)return void t?.current?.focus();const s=n.current.parentElement.children;let a=[];for(let c=0;c<s.length&&s[c]!==n.current;c++){const u=s[c].getAttribute("tabindex");if(u==null||u==="-1"||s[c].getAttribute("disabled")==="true")continue;const h=s[c];h.focus&&a.push({tabindex:parseInt(u),child:h})}a.length!==0&&(a.sort(function(c,u){return c.tabindex-u.tabindex}),a[0].child.focus())},[t]);return v.jsx("div",{tabIndex:0,ref:Pe([n,e]),onFocus:r,...o})})),Co=l.memo(l.forwardRef((i,e)=>{const{className:t,style:o,children:n,radius:r=4,strokeWidth:s=1,strokeColor:a="grey",...c}=i,[u,{width:h,height:d}]=he(),p=l.useRef(null),w=(z,_=0)=>{const x=z/2,g=d-x+_;return(function(A,R,j=!1){if(R===0)return A;function N(m,T,P){let X=T.x-m.x,V=T.y-m.y,I=Math.sqrt(X*X+V*V);return y(m,T,Math.min(1,P/I))}function y(m,T,P){return{x:m.x+(T.x-m.x)*P,y:m.y+(T.y-m.y)*P}}function b(m,T){m.length>2&&(m[m.length-2]=T.x,m[m.length-1]=T.y)}function B(m){return{x:parseFloat(m[m.length-2]),y:parseFloat(m[m.length-1])}}let f=A.split(/[,\s]/).reduce(function(m,T){let P=T.match("([a-zA-Z])(.+)");return P?(m.push(P[1]),m.push(P[2])):m.push(T),m},[]).reduce(function(m,T){return parseFloat(T)==T&&m.length?m[m.length-1].push(T):m.push([T]),m},[]),M=[];if(f.length>1){let m=B(f[0]),T=null;f[f.length-1][0]==="Z"&&f[0].length>2&&(T=["L",m.x,m.y],f[f.length-1]=T),M.push(f[0]);for(let P=1;P<f.length;P++){let X=M[M.length-1],V=f[P],I=V===T?f[1]:f[P+1];if(I&&X&&X.length>2&&V[0]==="L"&&I.length>2&&I[0]==="L"){let F,O,H=B(X),U=B(V),J=B(I);j?(F=y(U,X.origPoint||H,R),O=y(U,I.origPoint||J,R)):(F=N(U,H,R),O=N(U,J,R)),b(V,F),V.origPoint=U,M.push(V);let de=y(F,U,.5),pe=y(U,O,.5),$=["C",de.x,de.y,pe.x,pe.y,O.x,O.y];$.origPoint=U,M.push($)}else M.push(V)}if(T){let P=B(M[M.length-1]);M.push(["Z"]),b(M[0],P)}}else M=f;return M.reduce(function(m,T){return m+T.join(" ")+" "},"")})(`${`M 0 ${x} L ${r-.5} ${x} L ${r-.5} ${g} L ${2*r} ${g}`} ${`L ${h-2*r} ${g}`} ${`M ${h-2*r} ${g} L ${h-r} ${g} L ${h-r} ${x} L ${h} ${x}`}`,r)},C=l.useMemo(()=>w(s),[h,d,r,s]),S=l.useMemo(()=>{if(r===0)return;const z=r/2;return w(r)+`L ${h} 0 L 0 0 L 0 ${z}`},[C,r,s]),E=l.useMemo(()=>({style:{clipPath:`path('${S}')`}}),[S]);return v.jsxs("div",{className:t,style:{display:"flex",flexDirection:"row",...o},...c,ref:Pe([p,u,e]),children:[l.isValidElement(n)?l.cloneElement(n,E):v.jsx(v.Fragment,{}),v.jsx("svg",{style:{position:"absolute",top:0,left:0,pointerEvents:"none"},width:h,height:d,viewBox:`0 0 ${h} ${d}`,children:v.jsx("path",{d:C,stroke:a,fill:"none",vectorEffect:"non-scaling-stroke",strokeWidth:s})})]})})),Eo={},Dt=i=>{const{onPointerDown:e,style:t,splitDirection:o,paddingBefore:n=0,paddingAfter:r=0,disabled:s,key:a,hitAreaProps:c=Eo,...u}=i,h=o==="row",{style:d,className:p,...w}=c;return v.jsx("div",{style:{...t,position:"relative"},...u,children:v.jsx("div",{className:_e("hit-box",p),style:{left:(h?-n:0)+"px",width:`calc(100% + ${h?n+r:0}px)`,top:(h?0:-n)+"px",height:`calc(100% + ${h?0:n+r}px)`,position:"absolute",...d},onPointerDown:s?void 0:e,...w})},a)},Ce={},ue=(i,e,t=!0)=>i===null?null:i.pixels!==null?t?i.pixels:e-i.pixels:(t?i.percent:100-i.percent)/100*e,Ee=(i,e=!0)=>i?.percent?`${e?i.percent:100-i.percent}%`:i?.pixels?`${i.pixels}px`:void 0,le=(i,e)=>{if(i==null)return null;const t={percent:null,pixels:null};let o=e;return typeof i=="string"&&((i=i.trim().toLowerCase()).endsWith("px")?(i=i.substring(0,i.length-2),o=!1):i.endsWith("%")&&(i=i.substring(0,i.length-1),o=!0),i=parseFloat(i)),o?t.percent=i:t.pixels=i,Object.freeze(t)},Lo=l.memo(l.forwardRef((i,e)=>{const{elementBefore:t,elementAfter:o,splitDirection:n="row",fixedPane:r=null,position:s,onPositionChange:a,minBefore:c,maxBefore:u,minAfter:h,maxAfter:d,children:p,className:w,style:C,disabled:S=!1,onDragStart:E,onDragResize:z,onDragFinish:_,resizerProps:x=Ce,paneProps:g=Ce,paneBeforeProps:A=Ce,paneAfterProps:R=Ce,createResizer:j=Dt}=i;if(p)throw new Error("Use elementBefore and elementAfter instead of children.");const N=l.useMemo(()=>l.isValidElement(o)&&l.isValidElement(t),[o,t]),y=l.useMemo(()=>{let D=null;r&&(r==="before"?D=0:r==="after"&&(D=1));const K=D===null;return{fixedPaneOffset:D,isPercent:K,minBefore:le(c,K),maxBefore:le(u,K),minAfter:le(h,K),maxAfter:le(d,K)}},[c,u,h,d]),b=L(a,[a]),[B,f]=l.useState(()=>le(s,r===null));l.useEffect(()=>{f(le(s,r===null))},[s,r]);const[M,{width:m,height:T}]=he(),[P,{width:X,height:V}]=he(),I=n==="row"?X:V,F=n==="row"?m:T,O=l.useMemo(()=>((D,K,q,Y)=>{const ie=[null,null],Q=[null,null];if(D||(D={percent:Y.fixedPaneOffset===null?50:null,pixels:Y.fixedPaneOffset===null?null:0}),K===0)return D?.pixels!=null?Y.fixedPaneOffset!==1?(ie[0]=D?.pixels,Q[1]=100):(ie[1]=D?.pixels-q,Q[0]=100):D?.percent!=null&&(Y.fixedPaneOffset!==1?(Q[0]=D?.percent,Q[1]=100-D?.percent):(Q[1]=D?.percent,Q[0]=100-D?.percent)),{percents:Q,pixels:ie,minBefore:Ee(Y.minBefore,!0),maxBefore:Ee(Y.maxBefore,!0),minAfter:Ee(Y.minAfter),maxAfter:Ee(Y.maxAfter)};let se=ue(D,K,Y.fixedPaneOffset!==1),G=K-q,tt=ue(Y.minBefore,G,!0)??0,qt=ue(Y.maxBefore,G,!0)??G,we=0,Re=0,ot=0,nt=G;we=(ue(Y.maxAfter,K,!1)??q)-q,Re=ue(Y.minAfter,K,!1)??K,ot=Math.max(tt,we),nt=Math.min(qt,Re),se=Math.max(ot,Math.min(se,nt)),Re=Math.min(G-se,ue(Y.maxAfter,G-se,!0)??G),we=Math.min(G-se,ue(Y.minAfter,G-se,!0)??G),ie[0]=se,ie[1]=G-ie[0];const Zt=Math.max(0,Math.min(100,se/G*100));return Q[0]=Zt,Q[1]=100-Q[0],{percents:Q,pixels:ie,minBefore:`${tt}px`,minAfter:`${we}px`,maxBefore:`${ie[0]}px`,maxAfter:`${ie[1]}px`}})(B,F,I,y),[y,B,F,I,n]),[H,U]=l.useState(!1),J=L(E,[E]),de=L(z,[z]),pe=L(_,[_]),$=l.useRef(null),oe=l.useRef(null),te=l.useRef(null),{style:ce,className:ne,...re}=g,ye={minWidth:0,minHeight:0,maxWidth:"100%",maxHeight:"100%",display:"flex",overflow:"hidden",...ce},{className:Bt,style:Ot,...jt}=A,{className:$t,style:Kt,...Nt}=R,Ht={flex:"1 1 100%",width:"100%",...C,flexDirection:n,display:"flex"},{className:qe,style:Ze,onPointerDown:Ge,...Je}=x,Vt=L(D=>{const K=le(D,r===null);f(K)},[r]),xe=L(D=>{if(S||!H)return;const K=et.current?.getBoundingClientRect();let q=0;q=n==="row"?(D.clientX??D.touches?.[0]?.clientX)-K.x:(D.clientY??D.touches?.[0]?.clientY)-K.y,q=Math.max(0,Math.min(F,q)),y.fixedPaneOffset===1&&(q=F-q),s&&B.pixels===q||f({pixels:q,percent:null}),de?.(q),D.stopPropagation(),D.preventDefault()},[y,n,S,H,B,F]),Qe=L(D=>{if(document.removeEventListener("pointermove",xe),document.removeEventListener("touchmove",xe),document.removeEventListener("pointerup",Qe),!!H&&(U(!1),!!B)){if(pe(B.pixels),!le(s,r===null)||B.pixels!==s){const K={...B};K.percent===null&&(K.percent=K.pixels/F*100),b(K)}D.stopPropagation(),D.preventDefault()}},[B,H,s,r,F]),It=L(D=>{Ge?.(D),D.defaultPrevented||S||H||(U(!0),J(),document.addEventListener("pointermove",xe,{passive:!1}),document.addEventListener("touchmove",xe,{passive:!1}),document.addEventListener("pointerup",Qe,{passive:!1}))},[Ge]),et=Ye(e,()=>({setPosition:Vt,isSplitPane:()=>!0}),[]),Ft=l.useMemo(()=>N?j?.({key:"resizer",ref:Pe([P,oe]),className:_e("resizer",qe),onPointerDownCapture:It,style:{cursor:S?void 0:n==="row"?"ew-resize":"ns-resize",minWidth:n==="row"?"2px":void 0,minHeight:n!=="row"?"2px":void 0,boxSizing:"border-box",pointerEvents:"all",zIndex:1,...Ze},splitDirection:n,disabled:S,...Je}):null,[N,qe,Je,n,Ze,S]),be=n==="row"?"Width":"Height",Wt={...ye,...Ot,flex:y.fixedPaneOffset===0&&O?.pixels[0]!==null?`0 0 ${Math.round(O?.pixels[0])}px`:`1 1 ${Math.round(O?.percents[0]??100)}%`,[`min${be}`]:O?.minBefore,[`max${be}`]:o?O?.maxBefore:"100%"},Ut={...ye,...Kt,flex:y.fixedPaneOffset===1&&O?.pixels[1]!==null?`0 0 ${Math.round(O?.pixels[1])}px`:`1 1 ${Math.round(O?.percents[1]??100)}%`,[`min${be}`]:O?.minAfter,[`max${be}`]:t?O?.maxAfter:"100%"},Yt=l.useMemo(()=>t?v.jsx("div",{ref:$,className:_e("before",ne,Bt),style:Wt,...re,...jt,children:t},"before"):null,[t,g,A,y,O]),Xt=l.useMemo(()=>o?v.jsx("div",{ref:te,className:_e("after",ne,$t),style:Ut,...re,...Nt,children:o},"after"):null,[o,g,R,y,O]);return v.jsxs("div",{ref:Pe([M,et]),className:_e("splitPane",n==="row"?"vertical":"horizontal",{dragging:H},w),style:Ht,children:[Yt,Ft,Xt]})})),Ve={Default:"default",Error:"error",Success:"success",Warning:"warning",Info:"info"};class Pt extends k.DefaultNotifier{setOverrides(e){super.setOverrides(e)}getDelegate(){return this._overrides}showMessage(e,t){const o=this.getDelegate();if(o?.showMessage)return o.showMessage(e,t);t?.type!==Ve.Warning?t?.type!==Ve.Error?k.Notifier.log(e):k.Notifier.error(e):k.Notifier.warn(e)}showBusy(e,t){const o=this.getDelegate();return o?.showBusy?o.showBusy(e,t):new Promise(n=>{n(()=>{})})}showWindow(e,t,o){const n=this.getDelegate();if(n?.showWindow)return n.showWindow(e,t,o)}showError(e){const t=this.getDelegate();t?.showError?t.showError(e):k.Notifier.error(e)}showOptions(e){const t=this.getDelegate();return t?.showOptions?t.showOptions(e):Promise.resolve("")}showInputOptions(e){const t=this.getDelegate();return t?.showInputOptions?t.showInputOptions(e):Promise.resolve({input:"",option:""})}}const Mo=new Pt,kt=l.createContext(Mo),Be=()=>l.useContext(kt);function ut(i){if(!i)throw new Error("must have a PointerHandlerOptions");const{onPointerDown:e,onPointerUp:t,onPointerMoveOrWait:o,processTouch:n=!1,consumeTouch:r=!0}=i,s=L(e,[e]),a=L(t,[t]),c=L(o,[o]),u=l.useRef(!1),h=i?.timerInitial??230,d=i?.timerContinuous??h/2,p=l.useRef(null),w=l.useRef(null),C=l.useRef(null),S=l.useRef(null),E=l.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null)},[]),z=l.useCallback(b=>{S.current=setTimeout(()=>{window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)}),z(d)},b??h)},[]);l.useEffect(()=>()=>E(),[]);const _=n?"pointer":"mouse",x=l.useCallback(b=>{b.stopPropagation(),b.stopImmediatePropagation(),b.preventDefault()},[]),g=L(b=>{document.removeEventListener(`${_}move`,j),document.removeEventListener(`${_}up`,g),document.removeEventListener("keydown",N),document.removeEventListener("keyup",y),document.removeEventListener("touchstart",x,{capture:!0}),document.removeEventListener("touchmove",x,{capture:!0}),window.removeEventListener("blur",A),E(),window.requestAnimationFrame(()=>{u.current!==!1&&(u.current=!1,a?.(b,C.current,p.current),C.current=null)})},[]),A=l.useCallback(()=>{u.current!==!1&&(u.current=!1,g(w.current))},[]),R=L(()=>{E(),z(d),window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)})},[d]),j=L(b=>{w.current=b,R()},[]),N=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},R()},[]),y=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},R()},[d]);return L(b=>{b.isDefaultPrevented()||(C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},s(b,C.current)!==!1&&(p.current=b,w.current=b.nativeEvent,document.addEventListener(`${_}up`,g,{passive:!1}),document.addEventListener(`${_}move`,j,{passive:!1}),document.addEventListener("keydown",N,{passive:!1}),document.addEventListener("keyup",y,{passive:!1}),window.addEventListener("blur",A,{passive:!0}),n&&r&&(document.addEventListener("touchstart",x,{passive:!1,capture:!0}),document.addEventListener("touchmove",x,{passive:!1,capture:!0})),u.current=!0,z(h)))},[h,n])}const To=({initValue:i,useHookBody:e,applyStateChange:t})=>{const o=l.useRef(i);if(typeof e!="function")throw new Error("function expected as hook body parameter. got "+typeof e);const n=e();return l.useLayoutEffect(()=>{o.current!==n&&(o.current=n,t(n))},[t,n]),null},Ie=i=>{console&&console.warn&&console.warn(i)},Oe=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||void 0;let Do=1,Fe=!1,zt=!1;const Te=[],me=[],ke=()=>{me.forEach(i=>i())},Po=({automaticContainerInternalUseOnly:i})=>{const[e,t]=l.useState([]),o=l.useRef([]);return o.current=e,i||Fe!==!1||(zt=!0),l.useEffect(()=>{let n=!0;function r(){if(n)return me[0]!==r?(i||Fe!==!0||Ie("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."),void t(s=>[])):void t([...Te])}return me.push(r),ke(),()=>{n=!1,o.current?.length>0&&Ie("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"),me.splice(me.indexOf(r),1),ke()}},[i]),v.jsx(v.Fragment,{children:e.map(({hook:n,key:r})=>l.createElement(To,{...n,key:r}))})},ko=i=>{const e=Do++;return Te.push({hook:i,key:e}),me.length===0&&zt===!1&&(Fe=!0,(t=>{if(Oe.document&&Oe.document.createElement){const o=Oe.document.createElement("div");Gt.createRoot(o).render(v.jsx(t,{automaticContainerInternalUseOnly:!0}))}else Ie("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.")})(Po)),ke(),()=>{Te.splice(Te.findIndex(t=>t.key===e),1),ke()}};let We=null;We||(We=(i,e,t={})=>{let o,n,r=!1,s=!1,a=[],{unmountIfNoConsumers:c=!1}=t;const u=d=>{var p;n=d,p=()=>a.forEach(w=>w(d)),Jt.unstable_batchedUpdates(p)},h=()=>(s||(n=typeof i=="function"?i():i,s=!0),n);return()=>{const[d,p]=l.useState(h);return l.useEffect(()=>(r||(r=!0,o=ko({initValue:i,useHookBody:e,applyStateChange:u})),a.push(p),n!==d&&p(n),()=>{a.splice(a.indexOf(p),1),a.length===0&&c&&(o(),r=!1)}),[]),d}});const Rt=We;let At=()=>{console.warn("You must call useEditMode before setting its state.")};const zo=Rt(null,()=>{const[i,e]=l.useState(null);return At=e,i});class De{constructor(e,t,o,n){this._listenersProperties=new Set,this._listenersExecute=new Set,this._key=e,this._target=t,this._applyProps(o||{}),this._callback=n,n===void 0&&(this._callback=()=>{console.log(`implement: ${this.label()} : ${this.description()}`)})}key(){return this._key}_resolve(e,t){if(typeof e=="function"){const o=t??this._context;return e(typeof o=="function"?o():o)}return e}target(){return typeof this._target=="function"?this._target():this._target}label(e,t){const o=this._scopedLabels?.[e]||this._label;let n=null;if(typeof o=="function"){const r=t??this._context;n=o(typeof r=="function"?r():r)}else n=o;return n}description(e){return this._resolve(this._description,e)}tags(e){return this._resolve(this._tags,e)}icon(e){return this._resolve(this._icon,e)}shortcut(){return this._resolve(this._shortcut)}disabled(){return this._resolve(this._disabled)||!this._callback}state(){return this._resolve(this._state)}context(){return typeof this._context=="function"?this._context():this._context}async execute(e,t){if(!this.disabled()&&this._callback){try{let o=!0;if(t?.beforeExecute&&(o=t?.beforeExecute(this,e)),await Promise.resolve(o)===!1)return!1;const n=this._callback.bind(this)(e,this);if(await Promise.resolve(n)===!1)return!1;t?.onExecute?.(this,e),this._notifyExecute(e)}catch(o){return console.warn(o),t?.onError(this,o,e),this._notifyError(e,o),!1}return!0}}addPropertyListener(e,t=!1){if(!e)throw new Error("listener must be specified");const o=this._listenersProperties;return o.add(e),t&&e({},this),()=>{o.delete(e)}}addExecuteListener(e){if(!e)throw new Error("listener must be specified");const t=this._listenersExecute;return t.add(e),function(){t.delete(e)}}_notifyExecute(e){const t=this;this._listenersExecute.forEach(o=>{o.onExecute(t,e)})}_notifyError(e,t){const o=this;this._listenersExecute.forEach(n=>{n.onError?.(o,e,t)})}updateCallback(e){return this._callback=e||null,this}update(e){if(!e)return;const t=this._applyProps(e);return Object.keys(t).length>0&&this._notifyPropertyChange(t),this}_notifyPropertyChange(e){const t=this;this._listenersProperties.forEach(o=>{o(e,t)})}_applyProps(e){let t={},o=this;return Object.keys(e).forEach(n=>{let r=e[n];o["_"+n]!==r&&(o["_"+n]=t[n]=r)}),t}}class Le extends De{}class Xe{constructor(e,t){this._target=null,this._groupKey=null,this._root=null,this._parent=null,this._uuid=k.CommonUtils.uuidV4(),this._target=e,this._groupKey=t??null,this._root=this,this._nodes=new Map,this._nodes.set(t,this),this._children=new Map,this._listeners=new Set,this._commandsByKey=new Map,this._commandsByShortcut=new Map;const o=this;this._unListenersByCommand=new Map,this._listenersByKey=new Map,this._commandsPropertyListener=(n,r)=>{const s=o._root._listenersByKey,a=r.key(),c=s.get(a);c&&o._notifyCommands(c,"onCommandChange",r)}}_getCommand(e){return this._commandsByKey.get(e)||(this._parent?._getCommand(e)??null)}getCommand(e,t=!1){const o=this._root._focused;let n=o,r=o===this;for(;!r&&n;)n===this&&(r=!0),n=n._parent;return(r?o:this)._getCommand(e)}createChildGroup(e,t,o){let n;if(!o){let a=this;for(;a&&!n;){let c=a._nodes.get(t);c&&(n=c),a=a._parent}}n||(n=new Xe(e,t),n._parent=this,n._root=this._root,n._unListenersByCommand=null,n._listenersByKey=null,n._commandsPropertyListener=null);const r=(a,c)=>{!a.has(t)||o?a.set(t,c):o===void 0&&console.warn("commandGroup already registered",t)};r(this._root._nodes,n);let s=this._parent;for(;s;)r(this._nodes,n),s=s._parent;return this._children.set(t,n),this._notify("onGroupChange"),n}getKey(){return this._groupKey}getGroup(e){return this._nodes.get(e)}_addCommands(e,t=void 0){const o=this._commandsByKey,n=this._commandsByShortcut,r=this._root._commandsPropertyListener,s=this._root._unListenersByCommand;for(let a=0;a<e.length;a++){const c=e[a],u=c.key();if(o.has(u)&&!t){t===void 0&&console.warn("command already registered",u);continue}o.set(u,c);let h=s.get(c);h&&(h(),s.delete(c));const d=c.addPropertyListener(r);s.set(c,d);const p=c.shortcut();if(!p)continue;const w=Array.isArray(p)?p:[p];for(let C=0;C<w.length;C++){const S=fe(w[C]),E=n.get(S);E&&!t&&t===void 0&&console.warn(`Shortcut already registered: ${S}, ${u}, ${E}.`),n.set(S,u)}}}removeFromParent(){if(!this._parent)return;let e=this._parent,t=[];const o=this._groupKey;for(;e;)t.push(e._nodes),e._nodes.delete(o),e=e._parent;e=this._parent;const n=r=>{r._children.forEach(s=>{for(let a=0;a<t.length;a++)s._nodes.delete(t[a]);n(s)})};n(this),this._parent=null,this._notify("onGroupChange")}addCommands(e,t){this._addCommands(e,t),this._notify("onGroupChange")}getActive(){return this._root._focused??this._root}activate(e){let t=this;if(e&&(t=this._nodes.get(e),!t))return void console.warn("group not found",e);let o=this._root._focused??this._root;for(;o;)o=o._parent;this._root._focused!==t&&(this._root._focused=t,this._notify("onGroupChange"),this._notify("onActiveChange"))}findCommandByEvent(e){const t=[];e.altKey&&t.push(W.Alt),e.shiftKey&&t.push(W.Shift),e.ctrlKey&&t.push(W.Ctrl),e.metaKey&&t.push(W.Meta);let o=fe({key:e.code,modifiers:t});const n=this._commandsByShortcut;let r=n.get(o);r||(o=fe({key:e.key,modifiers:t}),r=n.get(o)),!r&&e.code.startsWith("Digit")&&(o=fe({key:e.code.substring(5,e.code.length),modifiers:t}),r=this._commandsByShortcut.get(o)),!r&&e.code.startsWith("Key")&&(r=fe({key:e.code.substring(3,e.code.length),modifiers:t}),r=n.get(o));let s=null;return r&&(s=this._commandsByKey.get(r),s&&s.disabled()&&(s=null),!s||s.target()&&s.target().contains(e.target)||(s=null)),s||(this._parent?.findCommandByEvent(e)??null)}dispatchToFocusedCommand(e){const t=this.getActive();if(!t||e.isDefaultPrevented())return!1;const o=t.findCommandByEvent?.(e);return!!o&&(o.execute(),e.preventDefault(),!0)}getRoot(){return this._parent?this._parent.getRoot():this}getParent(){return this._parent}addListener(e,t){const o=this._listeners,n=t?.keys,r=this._root._listenersByKey;if(n&&!e.onCommandChange)throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");let s=null;if(n)for(let a=0;a<n.length;a++){const c=n[a];if(!c)continue;let u=r.get(c);u||(u=new Set,r.set(c,u)),s||(s=[]),s.push(u),u.add(e)}return o.add(e),()=>{if(s)for(let a=0;a<s.length;a++)s[a].delete(e);o.delete(e)}}_notifyCommands(e,t,o){const n=this;setTimeout(()=>{e.forEach(r=>{r[t]?.(n,o)})},0)}_notify(e,t){const o=this;setTimeout(()=>{o._listeners.forEach(n=>{n[e]?.(o,t)}),o._parent&&o._parent._notify(e,t)},0)}getAllCommands(){const e=[],t=this._groupKey;return this._commandsByKey.forEach(o=>{e.push({command:o,groupKey:t})}),this._children.forEach(o=>{e.push(...o.getAllCommands())}),e}}const Ro=k.CommonUtils.getOS()===k.CommonUtils.OSType.MacOS||k.CommonUtils.getOS()===k.CommonUtils.OSType.IOS?"Cmd":"Ctrl",Ao=k.CommonUtils.getOS()===k.CommonUtils.OSType.MacOS||k.CommonUtils.getOS()===k.CommonUtils.OSType.IOS?"⌘":"^",fe=(i,e=!1)=>{const t={};for(let n=0;i.modifiers&&n<i.modifiers.length;n++)t[i.modifiers[n]]=!0;let o="";return(t?.[W.Ctrl]||t?.[W.Meta])&&(o+=(o.length>0?"+":"")+(e?Ao:Ro)),t?.[W.Alt]&&(o+=e?"⌥":"Alt"),t?.[W.Shift]&&(o+=(o.length>0?"+":"")+(e?"⇧":"Shift")),o+=(o.length>0?"+":"")+Et(i.key),o},Me=(i,e)=>{const t=[];if(e)for(let o=0;o<e.length;o++){const n=e[o],r=n?i?.getCommand(n):null;t.push(r)}return t},ht=Rt({setClipboard:i=>{throw new Error("This is only available via the useClipboard.")},getClipboard:()=>k.InternalClipboard.Global,refNativeCopy:{current:null},refNativeLastKey:{current:null}},()=>{const[i,e]=l.useState(k.InternalClipboard.Global);return{setClipboard:t=>e(t),getClipboard:()=>i,refNativeCopy:l.useRef(null),refNativeLastKey:l.useRef(null)}});let je=!1,Bo=0;var Oo=typeof document<"u"?l.useLayoutEffect:l.useEffect;const dt=()=>"sheetxl-ui-"+Bo++,pt=l.useId,jo=pt??function(){const[i,e]=l.useState(()=>je?dt():void 0);return Oo(()=>{i==null&&e(dt())},[]),l.useEffect(()=>{je||(je=!0)},[]),i},ft="Undo the last action.",_t="Repeat the last action or undo the redo.",$o=i=>`Redo ${i}`;exports.Command=De,exports.CommandButtonType={Toolbar:"toolbar",Menuitem:"menuitem"},exports.CommandGroup=Xe,exports.DefaultReactNotifier=Pt,exports.FocusKeyNavigation=So,exports.HorizontalAlignment={General:"general",Left:"left",Right:"right",Center:"center",Justify:"justify",Fill:"fill",Distributed:"distributed",CenterContinuous:"centerContinuous"},exports.KeyCodes={BackSpace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Insert:45,Delete:46,Digit_8:56,Y:89,Z:90,Meta:91,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NumLock:144,ScrollLock:145,BackSlash:220,Slash:191,BracketRight:221,BracketLeft:219},exports.KeyModifiers=W,exports.MouseButtonCodes={Left:1,Middle:2,Right:3},exports.NotifierProvider=({children:i,notifier:e})=>(l.useEffect(()=>{const t=k.Notifier.getOverrides();return k.Notifier.setOverrides(e),()=>{k.Notifier.setOverrides(t)}},[e]),l.createElement(kt.Provider,{value:e},i)),exports.NotifierType=Ve,exports.ReactUtils=mo,exports.RoundedTab=Co,exports.ScrollPane=Mt,exports.ScrollUtils=to,exports.Scrollbar=ze,exports.ScrollbarOrientation=ee,exports.SimpleCommand=Le,exports.SplitPane=Lo,exports.SplitPaneResizer=Dt,exports.ToolTipPlacement={BottomEnd:"bottom-end",BottomStart:"bottom-start",Bottom:"bottom",LeftEnd:"left-end",LeftStart:"left-start",Left:"left",RightEnd:"right-end",RightStart:"right-start",Right:"right",TopEnd:"top-end",TopStart:"top-start",Top:"top"},exports.VirtualScrollbar=Tt,exports.defaultCreateScrollCorner=Lt,exports.defaultCreateScrollEdgeButton=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"rotate(90) ":"";return v.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"end",transition:"fill-opacity 1s",zIndex:1,width:"24px",height:"24px",...e},className:`scrollbar-button ${n?"vertical":"horizontal"} edge`,...o,children:v.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",transform:r,children:v.jsx("path",{style:{transition:"opacity 240ms ease 0s",opacity:i.disabled?0:1},d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})})})},exports.defaultCreateScrollEndButton=vt,exports.defaultCreateScrollStartButton=yt,exports.defaultCreateScrollbar=He,exports.getDevicePixelRatio=function(i){if(typeof window>"u")return 1;const{defaultDpr:e=1,maxDpr:t=3,round:o=!0}=i||{},n=typeof window<"u"&&typeof window.devicePixelRatio=="number"?window.devicePixelRatio:e;return Math.min(Math.max(1,o?Math.floor(n):n),t)},exports.toShortcutString=fe,exports.useCallbackRef=L,exports.useCommand=function(i,e=null){const t=l.useRef(e);t.current=e;const[o,n]=l.useReducer(s=>s+1,0),r=l.useMemo(()=>Array.isArray(i)?i:[i],[i]);return l.useEffect(()=>{if(!r||r.length===0)return;const s=(u,h)=>{t.current?.onChange?.(h),n()};let a=null;e&&(a={onExecute(u,h){t.current?.onExecute?.(u,h)},onError(u,h,d){t.current?.onError?.(u,h,d)}});const c=new Set;for(let u=0;u<r.length;u++)c.add(r[u]?.addPropertyListener(k.CommonUtils.debounce(s,0),!0)),e&&c.add(r[u]?.addExecuteListener(a));return()=>{c.forEach(u=>{u?.()})}},[i]),o},exports.useCommands=function(i,e=null,t=null,o){const n=l.useRef(t);n.current=t,e&&!Array.isArray(e)&&(e=[e]);const[r,s]=l.useState(Me(i,e)),a=o?[...o,i]:[i];return l.useEffect(()=>{const c={onGroupChange:()=>{const p=Me(i,e);s(p),n.current?.onChange?.(this)}};let u;e&&e.length>0&&(u={keys:e},c.onCommandChange=(p,w)=>{n.current?.onChange?.(i),s(Me(i,e))});const h=i?.addListener(c,u),d=Me(i,e);return s(d),n.current?.onChange&&n.current?.onChange(i),()=>{h?.()}},a),r},exports.useCopyPaste=i=>{const{source:e,target:t,onPaste:o,onClipboardUpdate:n,commands:r}=i,s=Be(),a=L(n,[n]),c=L(o,[o]),{getClipboard:u,refNativeCopy:h}=ht(),d=u();l.useMemo(()=>{const _=e?.element,x=t?.element??e?.element;if(!r)return;const g=[new Le("cut",_,{label:"Cut",description:"Remove the selection and put it on the clipboard so you can paste it somewhere else.",shortcut:{key:"X",modifiers:[W.Ctrl]}}),new Le("copy",_,{label:"Copy",description:"Put a copy of the selection on the clipboard so you can paste it somewhere else.",shortcut:{key:"C",modifiers:[W.Ctrl]}}),new Le("paste",x,{label:"Paste",description:"Add content on the clipboard to your document.",shortcut:[{key:"V",modifiers:[W.Ctrl]},{key:"F8",modifiers:[W.Ctrl]}]})];r?.addCommands(g,!0)},[r]);const p=L(async _=>{if(!e?.element)return;let x=null;try{x=e.doCopy?.(_),typeof x=="string"?await d.writeText(x):await d.writeReference(x)}catch(g){throw g}},[e,s]),w=L(async _=>{const x=e?.element?.();if(x){h.current={sourceElement:x,args:_};try{await p(_)}catch(g){s.showError?.(g)}}},[e?.element,s]),C=l.useCallback(()=>{w({isCut:!0})},[]),S=L(async(_,x,g)=>{try{if(await _.doPaste(x,g)===!1)return;c?.(x,g)}catch(A){s.showError?.(A)}},[c]),E=L(async(_,x,g)=>{const A=t?.element?.();if(A&&await k.CommonUtils.whenFocus(A),!_&&!x)return;const R=await s.showBusy?.("Pasting...");if(x)try{return await S(t,x,g),void R?.()}catch(y){R?.(),s.showError?.(y)}let j,N=t.importFromExternal;N||(N=(y,b)=>({getItemType:()=>"text",toText:()=>_.text,isClipboardItem:!0}));try{j=await N(_,{isCut:!1})}catch(y){R?.(),s.showError?.(y)}if(j)try{const y=await Promise.resolve(j);await S(t,y,g),R?.()}catch(y){R?.(),s.showError?.(y)}else R?.()},[S,t,s]),z=L(async _=>{if(t?.element)try{const x=await d.readReference();if(x)return void await E(null,x,_);const g=[];g[0]=await k.ClipboardUtils.readStringFromClipboard(d,k.MimeType.plain),g[1]=await k.ClipboardUtils.readHTMLFromClipboard(d,k.MimeType.html),g[2]=await k.ClipboardUtils.readBlobFromClipboard(d,k.MimeType.png);const A={text:g[0]??null,html:g[1]??null,image:g[2]??null};await E(A,null,_)}catch(x){if(x?.message==="Document is not focused.")return;s.showError?.(x)}},[E,t?.element,s]);return L(async _=>{},[e?.element]),L(async _=>{},[t?.element,E,s]),l.useEffect(()=>{if(!d)return;const _=async A=>{const R=await d.readReference();a?.(R)},x=A=>{s.showMessage?.(k.InternalClipboard.ErrorMessages.PermsRead,{onceKey:"clipboard.features"})},g=A=>{s.showMessage?.(k.InternalClipboard.ErrorMessages.PermsWrite,{onceKey:"clipboard.features"})};return d.addEventListener("clipboardchange",_),d.addEventListener("clipboarderrorread",x),d.addEventListener("clipboarderrorwrite",g),()=>{d.removeEventListener("clipboardchange",_),d.removeEventListener("clipboarderrorread",x),d.removeEventListener("clipboarderrorwrite",g)}},[d,s]),l.useEffect(()=>{},[p,E,e,t]),l.useEffect(()=>{r?.getCommand("cut")?.updateCallback(C).update({disabled:!e||!t}),r?.getCommand("copy")?.updateCallback(w).update({disabled:!e}),r?.getCommand("paste")?.updateCallback(z).update({disabled:!t})},[e,t,r]),{paste:z,copy:w,clipboard:d}},exports.useDevicePixelRatio=function(i){const[e,t]=l.useState(typeof window<"u"?window.devicePixelRatio:1),o=l.useRef(null);return l.useEffect(()=>{if(!(typeof window<"u"&&"matchMedia"in window))return;const n=()=>{const r=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);r.addEventListener("change",n,{once:!0,passive:!0}),t(window.devicePixelRatio),o.current={mediaMatcher:r,listener:n}};return n(),()=>{o.current&&o.current.mediaMatcher.removeEventListener("change",o.current.listener)}},[i]),e},exports.useEditMode=()=>{const i=zo();return l.useMemo(()=>({setMode:e=>{At(t=>(typeof e=="function"&&(e=e(t)),e?.onModeChange?.(e??null),e))},getMode:()=>i}),[i])},exports.useFullscreenPortal=function(){const[i,e]=l.useState(!!document.fullscreenElement),t=l.useCallback(()=>{const o=document.fullscreenElement;return o?o.querySelector(".fullscreen-portal-root")||o:document.body},[]);return l.useEffect(()=>{function o(){const n=document.fullscreenElement;if(e(!!n),!n)return;let r=n.querySelector(".fullscreen-portal-root");r||(r=document.createElement("div"),r.className="fullscreen-portal-root _fullscreen-portal-root_1mjsr_4",n.appendChild(r))}return Se++,o(),document.addEventListener("fullscreenchange",o),()=>{document.removeEventListener("fullscreenchange",o),Se--,Se<=0&&(document.querySelectorAll(".fullscreen-portal-root").forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),Se=0)}},[]),{getPortalContainer:t,isFullscreen:i}},exports.useGlobalClipboard=ht,exports.useId=jo,exports.useImperativeElement=Ye,exports.useMouseDownAndHoldListener=function(i,e){return ut({onPointerDown:i,onPointerMoveOrWait:(t,o,n)=>{i?.(n)},...e})},exports.useNotifier=Be,exports.useOnClickOrFocusAway=function(i,e,t){const o=L(e,[e]);l.useEffect(()=>{const n=r=>{i.current&&!i.current.contains(r.target)&&o(r)};return t&&t.mouseEvents===!1||(document.addEventListener("mousedown",n),document.addEventListener("touchstart",n)),t&&t.focusEvents===!1||document.addEventListener("focus",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n),document.removeEventListener("focus",n)}},[i])},exports.useSynchronizedPointerHandler=ut,exports.useTraceUpdate=function(i,e=!0){const t=l.useRef(i);l.useEffect(()=>{if(e){const o=Object.entries(i).reduce((n,[r,s])=>(t.current[r]!==s&&(n[r]=[t.current[r],s]),n),{});Object.keys(o).length>0&&console.log("Changed props:",o)}t.current=i})},exports.useUndoManager=({manager:i,commands:e,disabled:t})=>{const o=Be(),n=L(s=>{try{i?.undo(s)}catch(a){o.error(a)}},[i]),r=L(s=>{try{i?.redo(s)}catch(a){o.error(a)}},[i]);return l.useMemo(()=>{if(!e)return;const s={contains:c=>!0,focus(){}},a=[new De("undo",s,{label:"Undo",description:ft,shortcut:{key:"z",modifiers:[W.Ctrl]},disabled:!0},n),new De("redo",s,{label:"Redo",description:_t,shortcut:[{key:"y",modifiers:[W.Ctrl]},{key:"F4"},{key:"Enter",modifiers:[W.Alt]}],disabled:!0},r)];e?.addCommands(a,!0)},[e]),l.useEffect(()=>{if(!e)return;const s=()=>{const c=i?.getTopUndoDescription(),u={};var h;e.getCommand("undo").update({disabled:t||!i||!i.hasUndo(),description:c?(h=c,`Undo ${h}`):ft,state:u,context:{undoManager:i}});const d=i?.getTopRedoDescription();e.getCommand("redo").update({disabled:t||!i||!i.hasRedo(),description:d?$o(d):_t,state:u,context:{undoManager:i}})};if(s(),!i)return;const a=i.addListener({onStackChange(){s()}});return()=>a?.()},[i,e,t]),{undo:n,redo:r}};
@@ -1,11 +1,11 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  import { jsx as L, jsxs as be, Fragment as De } from "react/jsx-runtime";
3
3
  import ce, { useLayoutEffect as Ie, useEffect as V, useState as G, useMemo as W, useCallback as H, useRef as A, memo as Le, forwardRef as Ce, useImperativeHandle as nn, version as on, createContext as rn, useContext as sn, createElement as ln, useReducer as an } from "react";
4
- import { CommonUtils as te, DelegatingNotifier as cn, Notifier as fe, InternalClipboard as Re, ClipboardUtils as We, MimeType as Fe } from "@sheetxl/utils";
4
+ import { CommonUtils as te, DefaultNotifier as cn, Notifier as fe, InternalClipboard as Re, ClipboardUtils as We, MimeType as Fe } from "@sheetxl/utils";
5
5
  import { createRoot as hn } from "react-dom/client";
6
6
  import { unstable_batchedUpdates as un } from "react-dom";
7
7
  /**
8
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.4
8
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.5
9
9
  *
10
10
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
11
11
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -557,11 +557,11 @@ const po = Le(Ce((i, e) => {
557
557
  return be("div", { ref: He([C, ct]), className: xe("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: N }, b), style: Xt, children: [Jt, Zt, Qt] });
558
558
  })), xt = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" };
559
559
  class Vn extends cn {
560
- setDelegate(e) {
561
- super.setDelegate(e);
560
+ setOverrides(e) {
561
+ super.setOverrides(e);
562
562
  }
563
563
  getDelegate() {
564
- return this._delegate;
564
+ return this._overrides;
565
565
  }
566
566
  showMessage(e, t) {
567
567
  const n = this.getDelegate();
@@ -593,9 +593,9 @@ class Vn extends cn {
593
593
  }
594
594
  }
595
595
  const Bt = rn(new Vn()), fo = ({ children: i, notifier: e }) => (ce.useEffect(() => {
596
- const t = fe.getDelegate();
597
- return fe.setDelegate(e), () => {
598
- fe.setDelegate(t);
596
+ const t = fe.getOverrides();
597
+ return fe.setOverrides(e), () => {
598
+ fe.setOverrides(t);
599
599
  };
600
600
  }, [e]), ce.createElement(Bt.Provider, { value: e }, i)), Ot = () => sn(Bt);
601
601
  function go(i) {
@@ -1206,7 +1206,7 @@ export {
1206
1206
  tt as Command,
1207
1207
  Lo as CommandButtonType,
1208
1208
  Ht as CommandGroup,
1209
- Vn as DelegatingReactNotifier,
1209
+ Vn as DefaultReactNotifier,
1210
1210
  po as FocusKeyNavigation,
1211
1211
  io as HorizontalAlignment,
1212
1212
  ro as KeyCodes,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.4
2
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.5
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -8,7 +8,7 @@ import { jsx as e, jsxs as t, Fragment as n } from "react/jsx-runtime";
8
8
  import o, { useCallback as i, useRef as r, memo as s, forwardRef as l, useState as a, useEffect as c, useMemo as h, useImperativeHandle as u, useLayoutEffect as d, createContext as _, useContext as p, createElement as m, useReducer as f } from "react";
9
9
  import g from "clsx";
10
10
  import { useMeasure as y } from "react-use";
11
- import { CommonUtils as v, DelegatingNotifier as x, Notifier as w, InternalClipboard as b, ClipboardUtils as S, MimeType as L } from "@sheetxl/utils";
11
+ import { CommonUtils as v, DefaultNotifier as x, Notifier as w, InternalClipboard as b, ClipboardUtils as S, MimeType as L } from "@sheetxl/utils";
12
12
  import * as E from "detect-it";
13
13
  import { mergeRefs as C } from "react-merge-refs";
14
14
  import { createRoot as T } from "react-dom/client";
@@ -506,11 +506,11 @@ const ge = s(l((i2, s2) => {
506
506
  return t("div", { ref: C([W2, Me2]), className: g("splitPane", "row" === u2 ? "vertical" : "horizontal", { dragging: Z2 }, b2), style: pe2, children: [Ae2, De2, Be2] });
507
507
  })), Ee = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" };
508
508
  class Ce extends x {
509
- setDelegate(e2) {
510
- super.setDelegate(e2);
509
+ setOverrides(e2) {
510
+ super.setOverrides(e2);
511
511
  }
512
512
  getDelegate() {
513
- return this._delegate;
513
+ return this._overrides;
514
514
  }
515
515
  showMessage(e2, t2) {
516
516
  const n2 = this.getDelegate();
@@ -542,9 +542,9 @@ class Ce extends x {
542
542
  }
543
543
  }
544
544
  const Te = _(new Ce()), Me = ({ children: e2, notifier: t2 }) => (o.useEffect(() => {
545
- const e3 = w.getDelegate();
546
- return w.setDelegate(t2), () => {
547
- w.setDelegate(e3);
545
+ const e3 = w.getOverrides();
546
+ return w.setOverrides(t2), () => {
547
+ w.setOverrides(e3);
548
548
  };
549
549
  }, [t2]), o.createElement(Te.Provider, { value: t2 }, e2)), De = () => p(Te);
550
550
  function Pe(e2) {
@@ -1162,7 +1162,7 @@ export {
1162
1162
  qe as Command,
1163
1163
  st as CommandButtonType,
1164
1164
  Qe as CommandGroup,
1165
- Ce as DelegatingReactNotifier,
1165
+ Ce as DefaultReactNotifier,
1166
1166
  fe as FocusKeyNavigation,
1167
1167
  D as HorizontalAlignment,
1168
1168
  z as KeyCodes,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/utils-react",
3
3
  "description": "Utils React - Utilities for React capabilities needed for all SheetXL components.",
4
- "version": "0.7.4",
4
+ "version": "0.7.5",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -20,14 +20,27 @@
20
20
  "*.css",
21
21
  "**/*.css"
22
22
  ],
23
+ "homepage": "https://sheetxl.com",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/sheetxl/sheetxl.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/sheetxl/sheetxl/issues"
30
+ },
23
31
  "keywords": [
24
32
  "sheetxl",
25
33
  "spreadsheet",
34
+ "javascript",
35
+ "typescript",
36
+ "data grid",
37
+ "excel",
38
+ "xlsx",
26
39
  "utilities",
27
40
  "react"
28
41
  ],
29
42
  "dependencies": {
30
- "@sheetxl/utils": "^0.7.4",
43
+ "@sheetxl/utils": "^0.7.5",
31
44
  "clsx": "^2.1.1",
32
45
  "detect-it": "^4.0.1",
33
46
  "react-merge-refs": "^3.0.2",
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CellCoords } from '@sheetxl/utils';
2
2
  import { default as default_2 } from 'react';
3
- import { DelegatingNotifier } from '@sheetxl/utils';
3
+ import { DefaultNotifier } from '@sheetxl/utils';
4
4
  import { DependencyList } from 'react';
5
5
  import { Dimensions } from '@sheetxl/utils';
6
6
  import { Direction } from '@sheetxl/utils';
@@ -231,8 +231,10 @@ export declare const defaultCreateScrollEndButton: (props: ScrollButtonProps) =>
231
231
  */
232
232
  export declare const defaultCreateScrollStartButton: (props: ScrollButtonProps) => default_2.ReactElement;
233
233
 
234
- export declare class DelegatingReactNotifier extends DelegatingNotifier implements IReactNotifier {
235
- setDelegate(delegate: Partial<IReactNotifier> | null): void;
234
+ export declare class DefaultReactNotifier extends DefaultNotifier implements IReactNotifier {
235
+ /** @inheritdoc IReactNotifier.setOverrides */
236
+ setOverrides(overrides: Partial<IReactNotifier> | null): void;
237
+ /** @inheritdoc IReactNotifier.getDelegate */
236
238
  getDelegate(): Partial<IReactNotifier> | null;
237
239
  /** @inheritdoc IReactNotifier.showMessage */
238
240
  showMessage(message: string | default_2.ReactNode, options?: EnqueueNotifierOptions): void;