UNPKG

@sheetxl/utils-react

Version:

Utils React - Utilities for React capabilities needed for all SheetXL components.

7 lines 58.3 kB
(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)}})(); "use strict";/** * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.6.5 * * (C) 2025-present SheetXL Inc. & Michael T. Ford * License: The license can be found at https://www.sheetxl.com/license. */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),l=require("react"),K=require("@sheetxl/utils"),Zt=require("react-dom/client"),Gt=require("react-dom"),W={Shift:"shift",Alt:"alt",Ctrl:"ctrl",Meta:"meta"},ee={Horizontal:"horizontal",Vertical:"vertical"};function gt(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=gt(i[e]))&&(o&&(o+=" "),o+=t)}else for(t in i)i[t]&&(o&&(o+=" "),o+=t);return o}function fe(){for(var i,e,t=0,o="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=gt(i))&&(o&&(o+=" "),o+=e);return o}var Jt=function(){},yt=typeof window<"u",Qt=yt?l.useLayoutEffect:l.useEffect,it={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const he=yt&&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 Qt(function(){if(e)return s.observe(e),function(){s.disconnect()}},[e]),[t,n]}:function(){return[Jt,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},vt=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})})})})},xt=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})})})})},Oe=(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},eo=Object.freeze(Object.defineProperty({__proto__:null,getScrollTo:Oe},Symbol.toStringTag,{value:"Module"})),to="_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=vt,createScrollEndButton:S=xt,...E}=i,k=L(u,[u]),f=l.useRef(null),[x,{width:g,height:R}]=he(),[z,{width:j,height:H}]=he(),y=a===ee.Vertical,b=y?"top":"left",A=y?"scrollTop":"scrollLeft",_=y?R:g,M=y?H:j,[m,T]=l.useState(null);l.useEffect(()=>{m!==null&&f.current&&f.current.scrollTo({behavior:"smooth",[b]:m})},[m,y]);const P=l.useCallback(($,oe=!1)=>{if(!f.current)return 0;const te=f.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=oe?0:Oe($,ce[b],ne,!0,Math.max(0,$-d));return T(re),Math.max(0,re)},[]),X=l.useCallback(($,oe=!1)=>{if(!f.current)return 0;const te=f.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=Math.ceil(M-_),ye=oe?re:Oe($,ce[b],ne,!1,Math.max(0,$+d));return T(ye),Math.min(re,ye)},[M,_]),F=l.useRef(null),I=l.useCallback($=>{F.current=t;const oe=$.target[A];c(oe,n,o),k?.($)},[c,n,o,t]);l.useEffect(()=>{const $=F.current;F.current=null,t!==$&&(f.current[A]=t)},[t,A]);const N=l.useRef(null),B=l.useRef(null),V=l.useCallback(()=>{N.current&&(clearTimeout(N.current),N.current=null,B.current=null)},[]),U=l.useCallback(($,oe,te,ce=p)=>{B.current=$,N.current=setTimeout(()=>{const ne=te?P(B.current||$):X(B.current||$);ne!==B.current?U(ne,!1,te,w):V()},oe?0:ce)},[P,X,V]);l.useEffect(()=>()=>V(),[V]);const J=t,de=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(J)<=0||Math.floor(M-_)===0,onMouseUp:V,onMouseLeave:V,onMouseDown:()=>U(J,!0,!0)};return C?.($)},[h,a,J,m,M,_]),pe=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(M-_)<=Math.ceil(J),onMouseUp:V,onMouseLeave:V,onMouseDown:()=>U(J,!0,!1)};return S?.($)},[h,a,J,m,M,_]);return v.jsxs("div",{ref:e,style:{display:"flex",flex:"1",flexDirection:y?"column":"row",padding:"0",...r},className:fe(to,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:f,children:v.jsx("div",{ref:z,style:{position:"absolute",height:y?o-n+(R??0):1,width:y?1:o-n+(g??0)},className:"scrollbar-viewport"})})}),pe]})}));ze.displayName="Scrollbar";let rt=Date.now,st=1e3,ae={},oo=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=oo++;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 f=0;f<Math.min(u,4);f++)d(!0),c++}o&&(a=(C-r)/o,a>1&&(a=1));let E=n?n(a):a,k=!1;try{k=i(E,C,w)}catch{k=!1}k!==!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},no=function(i){return Math.pow(i-1,3)+1},io=function(i){return(i/=.5)<1?.5*Math.pow(i,3):.5*(Math.pow(i-2,3)+2)};class ro{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,k){k&&(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,k){E===this.__isAnimating&&(this.__isAnimating=!1),(this.__didDecelerationComplete||k)&&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?no:io)}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),bt=!1,so={get passive(){return bt=!0}},at=function(){};Z.addEventListener&&Z.addEventListener("p",at,so),Z.removeEventListener&&Z.removeEventListener("p",at,!1);var lo=bt,ao="PointerEvent"in Z,Ue="ontouchstart"in Z,wt=Ue||"TouchEvent"in Z&&ge("(any-pointer: coarse)").matches,ct=(Z.navigator.maxTouchPoints||0)>0||wt,St=Z.navigator.userAgent||"",co=ge("(pointer: coarse)").matches&&/iPad|Macintosh/.test(St)&&Math.min(Z.screen.width||0,Z.screen.height||0)>=768,Ct=(ge("(pointer: coarse)").matches||!ge("(pointer: fine)").matches&&Ue)&&!/Windows.*Firefox/.test(St),uo=ge("(any-pointer: fine)").matches||ge("(any-hover: hover)").matches||co||!Ue,Ke=!ct||!uo&&Ct?ct?"touchOnly":"mouseOnly":"hybrid",ho=Ke==="mouseOnly"?"mouse":Ke==="touchOnly"||Ct?"touch":"mouse";const po=Object.freeze(Object.defineProperty({__proto__:null,deviceType:Ke,primaryInput:ho,supportsPassiveEvents:lo,supportsPointerEvents:ao,supportsTouchEvents:wt},Symbol.toStringTag,{value:"Module"})),_o=new Set(["INPUT","TEXTAREA","SELECT"]),Et={};function He(){return po}const Lt=i=>i==="BracketLeft"?"[":i==="BracketRight"?"]":K.CommonUtils.camelToPrettyCase(i),fo=Object.freeze(Object.defineProperty({__proto__:null,EmptyCssProperties:Et,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:He,focusableNodeNames:_o,toPrettyKeyCode:Lt},Symbol.toStringTag,{value:"Module"})),mo=[];function Ye(i,e,t=mo){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 Ve=i=>v.jsx(ze,{...i}),Mt=({width:i,height:e})=>v.jsx("div",{className:"corner",style:{minWidth:`${i}px`,width:`${i}px`,minHeight:`${e}px`,height:`${e}px`}}),Tt=l.memo(l.forwardRef((i,e)=>{const{children:t,viewport:o,onScrollViewport:n,showHorizontalScrollbar:r=!0,showVerticalScrollbar:s=!0,createScrollCorner:a=Mt,createHorizontalScrollbar:c=Ve,createVerticalScrollbar:u=Ve,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 k=l.useCallback((_,M)=>{C?.({left:_,top:M})},[]),f=l.useCallback(_=>{E.current?.doTouchStart(_.touches,_.timeStamp)},[]),x=l.useCallback(_=>{_.preventDefault(),E.current?.doTouchMove(_.touches,_.timeStamp)},[]),g=l.useCallback(_=>{E.current?.doTouchEnd(_.timeStamp)},[]),R=l.useCallback(({containerWidth:_,containerHeight:M,totalWidth:m,totalHeight:T})=>{E.current.setDimensions(_,M,m,T)},[]);l.useEffect(()=>{const _=d??S.current;if(!p&&He().supportsTouchEvents&&_&&o){if(!E.current){const M={scrollingX:!0,scrollingY:!0,decelerationRate:.95,penetrationAcceleration:.08};E.current=new ro(k,M)}He().supportsTouchEvents&&(_.addEventListener("touchstart",f),_.addEventListener("touchend",g),_.addEventListener("touchmove",x)),R({containerWidth:o?.width,containerHeight:o?.height,totalWidth:o?.totalWidth,totalHeight:o?.totalHeight})}return()=>{_?.removeEventListener("touchstart",f),_?.removeEventListener("touchend",g),_?.removeEventListener("touchmove",x)}},[o?.width,o?.height,o?.totalWidth,o?.totalHeight,p,d]);const[z,{width:j}]=he(),[H,{height:y}]=he(),b=l.useMemo(()=>{const _=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:z,children:_})},[u,o?.top,o?.height,o?.totalHeight]),A=l.useMemo(()=>{const _=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:H,className:"sizer",children:_})}),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?A:v.jsx(v.Fragment,{})]})})}));Tt.displayName="ScrollPane";const Fe={Default:"default",Error:"error",Success:"success",Warning:"warning",Info:"info"},ut=new Set,Ae={showMessage:(i,e)=>{if(e?.onceKey){if(ut.has(e.onceKey))return;ut.add(e.onceKey)}let t=console.log;e?.type!==Fe.Warning&&e?.type!==Fe.Error||(t=console.warn),t(i)},showBusy:(i,e)=>new Promise(t=>{t(()=>{})}),showError:i=>{console.error(i)}};let Se=0;const go=100,yo=100,vo=1e6,xo=100,bo=50,Dt=l.memo(l.forwardRef((i,e)=>{const{offset:t=0,viewportSize:o=0,totalSize:n=0,minSize:r=0,endGap:s=go,endScrollIncrement:a=yo,style:c=Et,onMouseDown:u,onScrollOffset:h,onScroll:d,scaleLimit:p=vo,scaleFactor:w=xo,precisionFactor:C=bo,...S}=i;d&&console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");const E=L(u,[u]),k=()=>({offset:t,totalSize:p===0?n:Math.min(n??0,Math.max(r??0,(t??0)+(o??0))+(s??0))}),[f,x]=l.useState(k),g=p!==0&&f.totalSize>p?w:1,R=g/C,z=Math.ceil(f.totalSize/g),j=Math.ceil(f.offset/g),H=Math.ceil(o/g),y=l.useCallback(P=>{},[]),[b,A]=l.useState(!1),_=l.useRef(null);l.useLayoutEffect(()=>{if(!b){_.current={propTotalSize:n,propViewportSize:o,propOffset:t};const P=k();x(P)}},[n,o,t,b,r,s,a]);const M=L((P,X,F)=>{const I=_.current;_.current=null,I&&I.propTotalSize===n&&I.propViewportSize===o&&I.propOffset===t||(Math.abs(P-j)<R&&(P=j),h?.(P*g,j,H))},[h,g,R,j,H]),m=l.useCallback(P=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",m),A(!1)},[]),T=l.useCallback(P=>{E?.(P),A(!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:z,viewportSize:H,onMouseDown:T,onScrollOffset:M})}));Dt.displayName="VirtualScrollbar";function Be(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=Be(o,e),r=typeof n=="function";t.push(r?n:()=>Be(o,null))}return()=>{for(const o of t)o()}}}:function(i){return e=>{for(const t of i)Be(t,e)}};const wo=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})})),So=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=(k,f=0)=>{const x=k/2,g=d-x+f;return function(R,z,j=!1){if(z===0)return R;function H(m,T,P){let X=T.x-m.x,F=T.y-m.y,I=Math.sqrt(X*X+F*F);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 A(m){return{x:parseFloat(m[m.length-2]),y:parseFloat(m[m.length-1])}}let _=R.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(_.length>1){let m=A(_[0]),T=null;_[_.length-1][0]==="Z"&&_[0].length>2&&(T=["L",m.x,m.y],_[_.length-1]=T),M.push(_[0]);for(let P=1;P<_.length;P++){let X=M[M.length-1],F=_[P],I=F===T?_[1]:_[P+1];if(I&&X&&X.length>2&&F[0]==="L"&&I.length>2&&I[0]==="L"){let N,B,V=A(X),U=A(F),J=A(I);j?(N=y(U,X.origPoint||V,z),B=y(U,I.origPoint||J,z)):(N=H(U,V,z),B=H(U,J,z)),b(F,N),F.origPoint=U,M.push(F);let de=y(N,U,.5),pe=y(U,B,.5),$=["C",de.x,de.y,pe.x,pe.y,B.x,B.y];$.origPoint=U,M.push($)}else M.push(F)}if(T){let P=A(M[M.length-1]);M.push(["Z"]),b(M[0],P)}}else M=_;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 k=r/2;return w(r)+`L ${h} 0 L 0 0 L 0 ${k}`},[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})})]})})),Co={},Pt=i=>{const{onPointerDown:e,style:t,splitDirection:o,paddingBefore:n=0,paddingAfter:r=0,disabled:s,key:a,hitAreaProps:c=Co,...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:fe("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)},Eo=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:k,onDragFinish:f,resizerProps:x=Ce,paneProps:g=Ce,paneBeforeProps:R=Ce,paneAfterProps:z=Ce,createResizer:j=Pt}=i;if(p)throw new Error("Use elementBefore and elementAfter instead of children.");const H=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 O=D===null;return{fixedPaneOffset:D,isPercent:O,minBefore:le(c,O),maxBefore:le(u,O),minAfter:le(h,O),maxAfter:le(d,O)}},[c,u,h,d]),b=L(a,[a]),[A,_]=l.useState(()=>le(s,r===null));l.useEffect(()=>{_(le(s,r===null))},[s,r]);const[M,{width:m,height:T}]=he(),[P,{width:X,height:F}]=he(),I=n==="row"?X:F,N=n==="row"?m:T,B=l.useMemo(()=>((D,O,q,Y)=>{const ie=[null,null],Q=[null,null];if(D||(D={percent:Y.fixedPaneOffset===null?50:null,pixels:Y.fixedPaneOffset===null?null:0}),O===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,O,Y.fixedPaneOffset!==1),G=O-q,tt=ue(Y.minBefore,G,!0)??0,Xt=ue(Y.maxBefore,G,!0)??G,we=0,Re=0,ot=0,nt=G;we=(ue(Y.maxAfter,O,!1)??q)-q,Re=ue(Y.minAfter,O,!1)??O,ot=Math.max(tt,we),nt=Math.min(Xt,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 qt=Math.max(0,Math.min(100,se/G*100));return Q[0]=qt,Q[1]=100-Q[0],{percents:Q,pixels:ie,minBefore:`${tt}px`,minAfter:`${we}px`,maxBefore:`${ie[0]}px`,maxAfter:`${ie[1]}px`}})(A,N,I,y),[y,A,N,I,n]),[V,U]=l.useState(!1),J=L(E,[E]),de=L(k,[k]),pe=L(f,[f]),$=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:At,style:Bt,...jt}=R,{className:$t,style:Ot,...Kt}=z,Ht={flex:"1 1 100%",width:"100%",...C,flexDirection:n,display:"flex"},{className:qe,style:Ze,onPointerDown:Ge,...Je}=x,Vt=L(D=>{const O=le(D,r===null);_(O)},[r]),xe=L(D=>{if(S||!V)return;const O=et.current?.getBoundingClientRect();let q=0;q=n==="row"?(D.clientX??D.touches?.[0]?.clientX)-O.x:(D.clientY??D.touches?.[0]?.clientY)-O.y,q=Math.max(0,Math.min(N,q)),y.fixedPaneOffset===1&&(q=N-q),s&&A.pixels===q||_({pixels:q,percent:null}),de?.(q),D.stopPropagation(),D.preventDefault()},[y,n,S,V,A,N]),Qe=L(D=>{if(document.removeEventListener("pointermove",xe),document.removeEventListener("touchmove",xe),document.removeEventListener("pointerup",Qe),!!V&&(U(!1),!!A)){if(pe(A.pixels),!le(s,r===null)||A.pixels!==s){const O={...A};O.percent===null&&(O.percent=O.pixels/N*100),b(O)}D.stopPropagation(),D.preventDefault()}},[A,V,s,r,N]),Ft=L(D=>{Ge?.(D),D.defaultPrevented||S||V||(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}),[]),It=l.useMemo(()=>H?j?.({key:"resizer",ref:Pe([P,oe]),className:fe("resizer",qe),onPointerDownCapture:Ft,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,[H,qe,Je,n,Ze,S]),be=n==="row"?"Width":"Height",Nt={...ye,...Bt,flex:y.fixedPaneOffset===0&&B?.pixels[0]!==null?`0 0 ${Math.round(B?.pixels[0])}px`:`1 1 ${Math.round(B?.percents[0]??100)}%`,[`min${be}`]:B?.minBefore,[`max${be}`]:o?B?.maxBefore:"100%"},Wt={...ye,...Ot,flex:y.fixedPaneOffset===1&&B?.pixels[1]!==null?`0 0 ${Math.round(B?.pixels[1])}px`:`1 1 ${Math.round(B?.percents[1]??100)}%`,[`min${be}`]:B?.minAfter,[`max${be}`]:t?B?.maxAfter:"100%"},Ut=l.useMemo(()=>t?v.jsx("div",{ref:$,className:fe("before",ne,At),style:Nt,...re,...jt,children:t},"before"):null,[t,g,R,y,B]),Yt=l.useMemo(()=>o?v.jsx("div",{ref:te,className:fe("after",ne,$t),style:Wt,...re,...Kt,children:o},"after"):null,[o,g,z,y,B]);return v.jsxs("div",{ref:Pe([M,et]),className:fe("splitPane",n==="row"?"vertical":"horizontal",{dragging:V},w),style:Ht,children:[Ut,It,Yt]})}));function ht(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)},[]),k=l.useCallback(b=>{S.current=setTimeout(()=>{window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)}),k(d)},b??h)},[]);l.useEffect(()=>()=>E(),[]);const f=n?"pointer":"mouse",x=l.useCallback(b=>{b.stopPropagation(),b.stopImmediatePropagation(),b.preventDefault()},[]),g=L(b=>{document.removeEventListener(`${f}move`,j),document.removeEventListener(`${f}up`,g),document.removeEventListener("keydown",H),document.removeEventListener("keyup",y),document.removeEventListener("touchstart",x,{capture:!0}),document.removeEventListener("touchmove",x,{capture:!0}),window.removeEventListener("blur",R),E(),window.requestAnimationFrame(()=>{u.current!==!1&&(u.current=!1,a?.(b,C.current,p.current),C.current=null)})},[]),R=l.useCallback(()=>{u.current!==!1&&(u.current=!1,g(w.current))},[]),z=L(()=>{E(),k(d),window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)})},[d]),j=L(b=>{w.current=b,z()},[]),H=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},z()},[]),y=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},z()},[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(`${f}up`,g,{passive:!1}),document.addEventListener(`${f}move`,j,{passive:!1}),document.addEventListener("keydown",H,{passive:!1}),document.addEventListener("keyup",y,{passive:!1}),window.addEventListener("blur",R,{passive:!0}),n&&r&&(document.addEventListener("touchstart",x,{passive:!1,capture:!0}),document.addEventListener("touchmove",x,{passive:!1,capture:!0})),u.current=!0,k(h)))},[h,n])}const Lo=({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 Mo=1,Ne=!1,kt=!1;const Te=[],me=[],ke=()=>{me.forEach(i=>i())},To=({automaticContainerInternalUseOnly:i})=>{const[e,t]=l.useState([]),o=l.useRef([]);return o.current=e,i||Ne!==!1||(kt=!0),l.useEffect(()=>{let n=!0;function r(){if(n)return me[0]!==r?(i||Ne!==!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(Lo,{...n,key:r}))})},Do=i=>{const e=Mo++;return Te.push({hook:i,key:e}),me.length===0&&kt===!1&&(Ne=!0,(t=>{if(je.document&&je.document.createElement){const o=je.document.createElement("div");Zt.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.")})(To)),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)),Gt.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=Do({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 zt=We;let Rt=()=>{console.warn("You must call useEditMode before setting its state.")};const Po=zt(null,()=>{const[i,e]=l.useState(null);return Rt=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=_e(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=_e({key:e.code,modifiers:t});const n=this._commandsByShortcut;let r=n.get(o);r||(o=_e({key:e.key,modifiers:t}),r=n.get(o)),!r&&e.code.startsWith("Digit")&&(o=_e({key:e.code.substring(5,e.code.length),modifiers:t}),r=this._commandsByShortcut.get(o)),!r&&e.code.startsWith("Key")&&(r=_e({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 ko=K.CommonUtils.getOS()===K.CommonUtils.OSType.MacOS||K.CommonUtils.getOS()===K.CommonUtils.OSType.IOS?"Cmd":"Ctrl",zo=K.CommonUtils.getOS()===K.CommonUtils.OSType.MacOS||K.CommonUtils.getOS()===K.CommonUtils.OSType.IOS?"⌘":"^",_e=(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?zo:ko)),t?.[W.Alt]&&(o+=e?"⌥":"Alt"),t?.[W.Shift]&&(o+=(o.length>0?"+":"")+(e?"⇧":"Shift")),o+=(o.length>0?"+":"")+Lt(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},dt=zt({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 $e=!1,Ro=0;var Ao=typeof document<"u"?l.useLayoutEffect:l.useEffect;const pt=()=>"sheetxl-ui-"+Ro++,_t=l.useId,Bo=_t??function(){const[i,e]=l.useState(()=>$e?pt():void 0);return Ao(()=>{i==null&&e(pt())},[]),l.useEffect(()=>{$e||($e=!0)},[]),i},ft="Undo the last action.",mt="Repeat the last action or undo the redo.",jo=i=>`Redo ${i}`;exports.Command=De,exports.CommandButtonType={Toolbar:"toolbar",Menuitem:"menuitem"},exports.CommandGroup=Xe,exports.DefaultNotifier=Ae,exports.FocusKeyNavigation=wo,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.NotificationType=Fe,exports.ReactUtils=fo,exports.RoundedTab=So,exports.ScrollPane=Tt,exports.ScrollUtils=eo,exports.Scrollbar=ze,exports.ScrollbarOrientation=ee,exports.SimpleCommand=Le,exports.SplitPane=Eo,exports.SplitPaneResizer=Pt,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=Dt,exports.defaultCreateScrollCorner=Mt,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("s