@sheetxl/utils-react 0.4.13 → 0.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/index.cjs +4 -10
- package/browser/esm/index.mjs +1212 -8
- package/node/esm/index.mjs +1 -1
- package/package.json +2 -2
package/browser/esm/index.mjs
CHANGED
|
@@ -1,13 +1,1217 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
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
|
+
import { jsx as L, jsxs as be, Fragment as Me } from "react/jsx-runtime";
|
|
3
|
+
import me, { useLayoutEffect as Ve, useEffect as V, useState as Q, useMemo as N, useCallback as R, useRef as A, memo as Se, forwardRef as Le, useImperativeHandle as en, version as tn, createElement as nn, useReducer as on } from "react";
|
|
4
|
+
import { CommonUtils as te, ClipboardUtils as Ie, MimeType as Ne, InternalClipboard as Ke } from "@sheetxl/utils";
|
|
5
|
+
import { createRoot as rn } from "react-dom/client";
|
|
6
|
+
import { unstable_batchedUpdates as sn } from "react-dom";
|
|
7
7
|
/**
|
|
8
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.4.
|
|
8
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.4.15
|
|
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.
|
|
12
12
|
*/
|
|
13
|
-
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import o,{useLayoutEffect as i,useEffect as r,useState as s,useMemo as l,useCallback as a,useRef as c,memo as h,forwardRef as u,useImperativeHandle as d,version as _,createElement as p,useReducer as f}from"react";import{CommonUtils as m,ClipboardUtils as g,MimeType as y,InternalClipboard as v}from"@sheetxl/utils";import{createRoot as x}from"react-dom/client";import{unstable_batchedUpdates as b}from"react-dom";const w={General:"general",Left:"left",Right:"right",Center:"center",Justify:"justify",Fill:"fill",Distributed:"distributed",CenterContinuous:"centerContinuous"},S={Shift:"shift",Alt:"alt",Ctrl:"ctrl",Meta:"meta"},L={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},E={Left:1,Middle:2,Right:3},T={Horizontal:"horizontal",Vertical:"vertical"};function C(t){var e,n,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t)if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=C(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function M(){for(var t,e,n=0,o="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=C(t))&&(o&&(o+=" "),o+=e);return o}var D=function(){},P="undefined"!=typeof window,z=P?i:r,k={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const A=P&&void 0!==window.ResizeObserver?function(){var t=s(null),e=t[0],n=t[1],o=s(k),i=o[0],r=o[1],a=l(function(){return new window.ResizeObserver(function(t){if(t[0]){var e=t[0].contentRect,n=e.x,o=e.y,i=e.width,s=e.height,l=e.top,a=e.left,c=e.bottom,h=e.right;r({x:n,y:o,width:i,height:s,top:l,left:a,bottom:c,right:h})}})},[]);return z(function(){if(e)return a.observe(e),function(){a.disconnect()}},[e]),[n,i]}:function(){return[D,k]},B=(t,e)=>{const n=a((...e)=>t?.(...e),e),o=c(null);o.current=n;const i=a((...t)=>o.current?.(...t),[]);if(o.current)return i},$=e=>{const{style:n,orientation:o=T.Vertical,...i}=e,r=o===T.Vertical;return t("div",{style:{paddingBottom:"0px",paddingRight:"0px",paddingLeft:r?"0px":"3px",paddingTop:r?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...n},...i,children:t("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${r?"vertical":"horizontal"} single-button start`,children:t("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:t("path",{d:r?"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"})})})})},O=e=>{const{style:n,orientation:o=T.Vertical,...i}=e,r=o===T.Vertical;return t("div",{style:{paddingLeft:"0px",paddingTop:"0px",paddingRight:r?"0px":"3px",paddingBottom:r?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...n},...i,children:t("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${r?"vertical":"horizontal"} single-button end`,children:t("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:t("path",{d:r?"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"})})})})},K=e=>{const{style:n,orientation:o=T.Vertical,...i}=e,r=o===T.Vertical;return t("div",{style:{display:"flex",justifyContent:"center",alignItems:"end",transition:"fill-opacity 1s",zIndex:1,width:"24px",height:"24px",...n},className:`scrollbar-button ${r?"vertical":"horizontal"} edge`,...i,children:t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",transform:""+(r?"rotate(90) ":""),children:t("path",{style:{transition:"opacity 240ms ease 0s",opacity:e.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"})})})},V=(t,e,n,o,i=0)=>{for(let i=0;i<n.length;i++){const r=n[i].getBoundingClientRect();let s=r.left-e,l=s+r.width;if(o){if(s<t&&l>=t)return s}else if(Math.ceil(l)>Math.ceil(t)+2)return l}return i},H=Object.freeze(Object.defineProperty({__proto__:null,getScrollTo:V},Symbol.toStringTag,{value:"Module"})),W="_sheetxl-scrollbar_eblx4_6",R=h(u((n,o)=>{const{offset:i=0,totalSize:h=0,viewportSize:u=0,style:d,className:_,orientation:p=T.Vertical,onScrollOffset:f,onScroll:m,showCustomScrollButtons:g=!1,scrollButtonIncrement:y=200,scrollButtonInitialRepeatDelay:v=260,scrollButtonAdditionalRepeatDelay:x=120,createScrollStartButton:b=$,createScrollEndButton:w=O,...S}=n,L=B(m,[m]),E=c(null),[C,{width:D,height:P}]=A(),[z,{width:k,height:K}]=A(),H=p===T.Vertical,R=H?"top":"left",N=H?"scrollTop":"scrollLeft",F=H?P:D,I=H?K:k,[Y,X]=s(null);r(()=>{null!==Y&&E.current&&E.current.scrollTo({behavior:"smooth",[R]:Y})},[Y,H]);const j=a((t,e=!1)=>{if(!E.current)return 0;const n=E.current.querySelector(".scrollbar-viewport"),o=n.getBoundingClientRect(),i=n.children,r=e?0:V(t,o[R],i,!0,Math.max(0,t-y));return X(r),Math.max(0,r)},[]),U=a((t,e=!1)=>{if(!E.current)return 0;const n=E.current.querySelector(".scrollbar-viewport"),o=n.getBoundingClientRect(),i=n.children,r=Math.ceil(I-F),s=e?r:V(t,o[R],i,!1,Math.max(0,t+y));return X(s),Math.min(r,s)},[I,F]),Z=c(null),G=a(t=>{Z.current=i;const e=t.target[N];f(e,u,h),L?.(t)},[f,u,h,i]);r(()=>{const t=Z.current;Z.current=null,i!==t&&(E.current[N]=i)},[i,N]);const q=c(null),J=c(null),Q=a(()=>{q.current&&(clearTimeout(q.current),q.current=null,J.current=null)},[]),tt=a((t,e,n,o=v)=>{J.current=t,q.current=setTimeout(()=>{const e=n?j(J.current||t):U(J.current||t);e!==J.current?tt(e,!1,n,x):Q()},e?0:o)},[j,U,Q]);r(()=>()=>Q(),[Q]);const et=i,nt=l(()=>{if(!g)return null;const t={orientation:p,disabled:Math.floor(et)<=0||0===Math.floor(I-F),onMouseUp:Q,onMouseLeave:Q,onMouseDown:()=>tt(et,!0,!0)};return b?.(t)},[g,p,et,Y,I,F]),ot=l(()=>{if(!g)return null;const t={orientation:p,disabled:Math.floor(I-F)<=Math.ceil(et),onMouseUp:Q,onMouseLeave:Q,onMouseDown:()=>tt(et,!0,!1)};return w?.(t)},[g,p,et,Y,I,F]);return e("div",{ref:o,style:{display:"flex",flex:"1",flexDirection:H?"column":"row",padding:"0",...d},className:M(W,_),...S,children:[nt,t("div",{className:"pseudo-scrollbar",style:{flex:"1 1 100%",display:"flex",boxSizing:"content-box",flexDirection:H?"column":"row",justifyContent:"center",alignItems:"center"},ref:C,children:t("div",{tabIndex:-1,style:{flex:"1 1 100%",overflowY:H?"scroll":"hidden",overflowX:H?"hidden":"scroll",position:"relative",willChange:"transform"},onScroll:G,ref:E,children:t("div",{ref:z,style:{position:"absolute",height:H?h-u+(P??0):1,width:H?1:h-u+(D??0)},className:"scrollbar-viewport"})})}),ot]})}));R.displayName="Scrollbar";let N=Date.now,F=1e3,I={},Y=1;const X=t=>{let e=null!==I[t];return e&&(I[t]=null),e},j=(t,e,n,o=0,i)=>{let r=N(),s=r,l=0,a=0,c=0,h=Y++;if(h%20==0){const t={};for(let e in I)t[e]=!0;I=t}const u=function(d){let _=!0!==d,p=N(),f=!0;try{f=(!e||e(h))??!0}catch(t){f=!1}if(!I[h]||!f)return I[h]=null,void n?.(60-a/((p-r)/F),h,!1);if(_){c=Math.round((p-s)/16.666666666666668)-1;for(let t=0;t<Math.min(c,4);t++)u(!0),a++}o&&(l=(p-r)/o,l>1&&(l=1));let m=i?i(l):l,g=!1;try{g=t(m,p,_)}catch(t){g=!1}!1!==g&&1!==l||!_?_&&(s=p,requestAnimationFrame(u)):(I[h]=null,n?.(60-a/((p-r)/F),h,1===l||null==o))};return I[h]=!0,requestAnimationFrame(u),h},U=function(t){return Math.pow(t-1,3)+1},Z=function(t){return(t/=.5)<1?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)};class G{constructor(t,e){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=t,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,...e}}setDimensions(t,e,n,o){null!==t&&(this.__clientWidth=t),null!==e&&(this.__clientHeight=e),null!==n&&(this.__contentWidth=n),null!==o&&(this.__contentHeight=o),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)}setPosition(t,e){this.__clientLeft=t||0,this.__clientTop=e||0}setSnapSize(t,e){this.__snapWidth=t,this.__snapHeight=e}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(t,e){const n=this.getValues();return{left:t/n.zoom,top:e/n.zoom}}getScrollMax(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}}zoomTo(t,e=!1,n,o,i){if(!this.options.zooming)throw new Error("Zooming is not enabled!");i&&(this.__zoomComplete=i),this.__isDecelerating&&(X(this.__isDecelerating),this.__isDecelerating=0);const r=this.__zoomLevel;void 0===n&&(n=this.__clientWidth/2),void 0===o&&(o=this.__clientHeight/2),t=Math.max(Math.min(t,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(t);const s=t/r;let l=s*(this.__scrollLeft+n)-n,a=s*(this.__scrollTop+o)-o;l>this.__maxScrollLeft?l=this.__maxScrollLeft:l<0&&(l=0),a>this.__maxScrollTop?a=this.__maxScrollTop:a<0&&(a=0),this.__publish(l,a,t,e)}zoomBy(t,e=!1,n=0,o=0,i){this.zoomTo(this.__zoomLevel*t,e,n,o,i)}scrollTo(t,e,n=!1,o=1){if(this.__isDecelerating&&(X(this.__isDecelerating),this.__isDecelerating=0),void 0!==o&&o!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");t*=o,e*=o,this.__computeScrollMax(o)}else o=this.__zoomLevel;this.options.scrollingX?this.options.paging?t=Math.round(t/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(t=Math.round(t/this.__snapWidth)*this.__snapWidth):t=this.__scrollLeft,this.options.scrollingY?this.options.paging?e=Math.round(e/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(e=Math.round(e/this.__snapHeight)*this.__snapHeight):e=this.__scrollTop,t=Math.max(Math.min(this.__maxScrollLeft,t),0),e=Math.max(Math.min(this.__maxScrollTop,e),0),t===this.__scrollLeft&&e===this.__scrollTop&&(n=!1),this.__publish(t,e,o,n)}scrollBy(t=0,e=0,n=!1){const o=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,i=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(o+(t||0),i+(e||0),n)}doMouseZoom(t,e,n,o){const i=t>0?.97:1.03;return this.zoomTo(this.__zoomLevel*i,!1,n-this.__clientLeft,o-this.__clientTop)}doTouchStart(t,e){if(void 0===t.length)throw new Error("Invalid touch list: "+t);if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);let n,o;this.__interruptedAnimation=!0,this.__isDecelerating&&(X(this.__isDecelerating),this.__isDecelerating=0,this.__interruptedAnimation=!0),this.__isAnimating&&(X(this.__isAnimating),this.__isAnimating=0,this.__interruptedAnimation=!0);let i=1===t.length;i?(n=t[0].pageX,o=t[0].pageY):(n=Math.abs(t[0].pageX+t[1].pageX)/2,o=Math.abs(t[0].pageY+t[1].pageY)/2),this.__initialTouchLeft=n,this.__initialTouchTop=o,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=n,this.__lastTouchTop=o,this.__lastTouchMove=e,this.__lastScale=1,this.__enableScrollX=!i&&this.options.scrollingX,this.__enableScrollY=!i&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!i,this.__isSingleTouch=i,this.__positions=[]}doTouchMove(t,e,n=1){if(void 0===t.length)throw new Error("Invalid touch list: "+t);if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(!this.__isTracking)return;let o,i;2===t.length?(o=Math.abs(t[0].pageX+t[1].pageX)/2,i=Math.abs(t[0].pageY+t[1].pageY)/2):(o=t[0].pageX,i=t[0].pageY);let r=this.__positions;if(this.__isDragging){let t=o-this.__lastTouchLeft,s=i-this.__lastTouchTop,l=this.__scrollLeft,a=this.__scrollTop,c=this.__zoomLevel;if(void 0!==n&&this.options.zooming){let t=c;if(c=c/this.__lastScale*n,c=Math.max(Math.min(c,this.options.maxZoom),this.options.minZoom),t!==c){let e=o-this.__clientLeft,n=i-this.__clientTop;l=(e+l)*c/t-e,a=(n+a)*c/t-n,this.__computeScrollMax(c)}}if(this.__enableScrollX){l-=t*this.options.speedMultiplier;let e=this.__maxScrollLeft;(l>e||l<0)&&(this.options.bouncing?l+=t/2*this.options.speedMultiplier:l=l>e?e:0)}if(this.__enableScrollY){a-=s*this.options.speedMultiplier;const t=this.__maxScrollTop;(a>t||a<0)&&(this.options.bouncing?a+=s/2*this.options.speedMultiplier:a=a>t?t:0)}r.length>60&&r.splice(0,30),r.push(l,a,e),this.__publish(l,a,c)}else{let t=this.options.locking?3:0,n=5,s=Math.abs(o-this.__initialTouchLeft),l=Math.abs(i-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&s>=t,this.__enableScrollY=this.options.scrollingY&&l>=t,r.push(this.__scrollLeft,this.__scrollTop,e),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(s>=n||l>=n),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=o,this.__lastTouchTop=i,this.__lastTouchMove=e,this.__lastScale=n}doTouchEnd(t){if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&t-this.__lastTouchMove<=100){let e=this.__positions,n=e.length-1,o=n;for(let t=n;t>0&&e[t]>this.__lastTouchMove-100;t-=3)o=t;if(o!==n){const i=e[n]-e[o],r=this.__scrollLeft-e[o-2],s=this.__scrollTop-e[o-1];this.__decelerationVelocityX=r/i*(1e3/60),this.__decelerationVelocityY=s/i*(1e3/60);const l=this.options.paging||this.options.snapping?4:1;(Math.abs(this.__decelerationVelocityX)>l||Math.abs(this.__decelerationVelocityY)>l)&&this.__startDeceleration(t)}else this.options.scrollingComplete?.()}else t-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(t,e,n,o=!1){const i=this.__isAnimating;if(i&&(X(i),this.__isAnimating=0),o&&this.options.animating){this.__scheduledLeft=t,this.__scheduledTop=e,this.__scheduledZoom=n;const o=this.__scrollLeft,r=this.__scrollTop,s=this.__zoomLevel,l=t-o,a=e-r,c=n-s,h=function(t,e,n){n&&(this.__scrollLeft=o+l*t,this.__scrollTop=r+a*t,this.__zoomLevel=s+c*t,this.__callback&&this.__callback(this.__scrollLeft,this.__scrollTop,this.__zoomLevel))}.bind(this),u=function(t){return this.__isAnimating===t}.bind(this),d=function(t,e,n){e===this.__isAnimating&&(this.__isAnimating=!1),(this.__didDecelerationComplete||n)&&this.options.scrollingComplete?.(),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}.bind(this);this.__isAnimating=j(h,u,d,this.options.animationDuration,i?U:Z)}else this.__scheduledLeft=this.__scrollLeft=t,this.__scheduledTop=this.__scrollTop=e,this.__scheduledZoom=this.__zoomLevel=n,this.__callback&&this.__callback(t,e,n),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}__computeScrollMax(t=this.__zoomLevel){this.__maxScrollLeft=Math.max(this.__contentWidth*t-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*t-this.__clientHeight,0)}__startDeceleration(t){if(this.options.paging){const t=Math.max(Math.min(this.__scrollLeft,this.__maxScrollLeft),0),e=Math.max(Math.min(this.__scrollTop,this.__maxScrollTop),0),n=this.__clientWidth,o=this.__clientHeight;this.__minDecelerationScrollLeft=Math.floor(t/n)*n,this.__minDecelerationScrollTop=Math.floor(e/o)*o,this.__maxDecelerationScrollLeft=Math.ceil(t/n)*n,this.__maxDecelerationScrollTop=Math.ceil(e/o)*o}else this.__minDecelerationScrollLeft=0,this.__minDecelerationScrollTop=0,this.__maxDecelerationScrollLeft=this.__maxScrollLeft,this.__maxDecelerationScrollTop=this.__maxScrollTop;const e=function(t,e,n){this.__stepThroughDeceleration(n)}.bind(this),n=this.options.snapping?4:.1,o=function(){const t=Math.abs(this.__decelerationVelocityX)>=n||Math.abs(this.__decelerationVelocityY)>=n;return t||(this.__didDecelerationComplete=!0),t}.bind(this),i=function(t,e,n){this.__isDecelerating=0,this.__didDecelerationComplete&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,this.options.snapping)}.bind(this);this.__isDecelerating=j(e,o,i)}__stepThroughDeceleration(t){let e=this.__scrollLeft+this.__decelerationVelocityX,n=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){const t=Math.max(Math.min(this.__maxDecelerationScrollLeft,e),this.__minDecelerationScrollLeft);t!==e&&(e=t,this.__decelerationVelocityX=0);const o=Math.max(Math.min(this.__maxDecelerationScrollTop,n),this.__minDecelerationScrollTop);o!==n&&(n=o,this.__decelerationVelocityY=0)}if(t?this.__publish(e,n,this.__zoomLevel):(this.__scrollLeft=e,this.__scrollTop=n),!this.options.paging){const t=.95;this.__decelerationVelocityX*=t,this.__decelerationVelocityY*=t}if(this.options.bouncing){let t=0,o=0,i=this.options.penetrationDeceleration,r=this.options.penetrationAcceleration;e<this.__minDecelerationScrollLeft?t=this.__minDecelerationScrollLeft-e:e>this.__maxDecelerationScrollLeft&&(t=this.__maxDecelerationScrollLeft-e),n<this.__minDecelerationScrollTop?o=this.__minDecelerationScrollTop-n:n>this.__maxDecelerationScrollTop&&(o=this.__maxDecelerationScrollTop-n),0!==t&&(t*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=t*i:this.__decelerationVelocityX=t*r),0!==o&&(o*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=o*i:this.__decelerationVelocityY=o*r)}}}var q="undefined"!=typeof window?window:{screen:{},navigator:{}},J=(q.matchMedia||function(){return{matches:!1}}).bind(q),Q=!1,tt={get passive(){return Q=!0}},et=function(){};q.addEventListener&&q.addEventListener("p",et,tt),q.removeEventListener&&q.removeEventListener("p",et,!1);var nt=Q,ot="PointerEvent"in q,it="ontouchstart"in q,rt=it||"TouchEvent"in q&&J("(any-pointer: coarse)").matches,st=(q.navigator.maxTouchPoints||0)>0||rt,lt=q.navigator.userAgent||"",at=J("(pointer: coarse)").matches&&/iPad|Macintosh/.test(lt)&&Math.min(q.screen.width||0,q.screen.height||0)>=768,ct=(J("(pointer: coarse)").matches||!J("(pointer: fine)").matches&&it)&&!/Windows.*Firefox/.test(lt),ht=J("(any-pointer: fine)").matches||J("(any-hover: hover)").matches||at||!it,ut=!st||!ht&&ct?st?"touchOnly":"mouseOnly":"hybrid",dt="mouseOnly"===ut?"mouse":"touchOnly"===ut||ct?"touch":"mouse";const _t=Object.freeze(Object.defineProperty({__proto__:null,deviceType:ut,primaryInput:dt,supportsPassiveEvents:nt,supportsPointerEvents:ot,supportsTouchEvents:rt},Symbol.toStringTag,{value:"Module"})),pt=new Set(["INPUT","TEXTAREA","SELECT"]),ft={};function mt(){return _t}const gt=t=>"BracketLeft"===t?"[":"BracketRight"===t?"]":m.camelToPrettyCase(t),yt=Object.freeze(Object.defineProperty({__proto__:null,EmptyCssProperties:ft,boundPixel:function(t,e=!1,n=0){return t},createSyntheticEvent:t=>{let e=!1,n=!1;return{nativeEvent:t,currentTarget:t.currentTarget,target:t.target,bubbles:t.bubbles,cancelable:t.cancelable,defaultPrevented:t.defaultPrevented,eventPhase:t.eventPhase,isTrusted:t.isTrusted,preventDefault:()=>{e=!0,t.preventDefault()},isDefaultPrevented:()=>e,stopPropagation:()=>{n=!0,t.stopPropagation()},isPropagationStopped:()=>n,persist:()=>{},timeStamp:t.timeStamp,type:t.type}},detectIt:mt,focusableNodeNames:pt,toPrettyKeyCode:gt},Symbol.toStringTag,{value:"Module"})),vt=[];function xt(t,e,n=vt){const o=c(null);return d(t,()=>{if(!o.current)return;const t=o.current,n=e?.();if(!n||"object"!=typeof n)throw new Error("attributes must return a plain object of values");const i=Object.keys(n),r=i.length;for(let e=0;e<r;e++){const o=i[e],r=n[o];Object.defineProperty(t,o,{value:r,writable:!0,configurable:!0,enumerable:!0})}return t},n),o}const bt=e=>t(R,{...e}),wt=({width:e,height:n})=>t("div",{className:"corner",style:{minWidth:`${e}px`,width:`${e}px`,minHeight:`${n}px`,height:`${n}px`}}),St=h(u((o,i)=>{const{children:s,viewport:h,onScrollViewport:u,showHorizontalScrollbar:d=!0,showVerticalScrollbar:_=!0,createScrollCorner:p=wt,createHorizontalScrollbar:f=bt,createVerticalScrollbar:m=bt,style:g,touchElement:y,disableTouch:v,...x}=o,b=B(u,[u]),w=xt(i,()=>({isScrollPane:()=>!0}),[]),S=c(null);r(()=>{S.current&&(S.current.__scrollTop===h?.top&&S.current.__scrollLeft===h?.left||S.current.__isDecelerating||S.current?.scrollTo(h?.left,h?.top,!1))},[h?.left,h?.top,y]);const L=a((t,e)=>{b?.({left:t,top:e})},[]),E=a(t=>{S.current?.doTouchStart(t.touches,t.timeStamp)},[]),C=a(t=>{t.preventDefault(),S.current?.doTouchMove(t.touches,t.timeStamp)},[]),M=a(t=>{S.current?.doTouchEnd(t.timeStamp)},[]),D=a(({containerWidth:t,containerHeight:e,totalWidth:n,totalHeight:o})=>{S.current.setDimensions(t,e,n,o)},[]);r(()=>{const t=y??w.current;if(!v&&mt().supportsTouchEvents&&t&&h){if(!S.current){const t={scrollingX:!0,scrollingY:!0,decelerationRate:.95,penetrationAcceleration:.08};S.current=new G(L,t)}mt().supportsTouchEvents&&(t.addEventListener("touchstart",E),t.addEventListener("touchend",M),t.addEventListener("touchmove",C)),D({containerWidth:h?.width,containerHeight:h?.height,totalWidth:h?.totalWidth,totalHeight:h?.totalHeight})}return()=>{t?.removeEventListener("touchstart",E),t?.removeEventListener("touchend",M),t?.removeEventListener("touchmove",C)}},[h?.width,h?.height,h?.totalWidth,h?.totalHeight,v,y]);const[P,{width:z}]=A(),[k,{height:$}]=A(),O=l(()=>{const e=m({orientation:T.Vertical,offset:h?.top,viewportSize:h?.height,totalSize:h?.totalHeight,onScrollOffset:t=>{b?.({top:t})}});return t("div",{style:{display:"flex",flex:"0"},ref:P,children:e})},[m,h?.top,h?.height,h?.totalHeight]),K=l(()=>{const o=f({orientation:T.Horizontal,offset:h?.left,viewportSize:h?.width,totalSize:h?.totalWidth,onScrollOffset:t=>b?.({left:t})});return e("div",{style:{display:"flex",flex:"none",flexDirection:"row",alignItems:"stretch",justifyContent:"center"},children:[t("div",{style:{display:"flex",flex:"1 1 100%",flexDirection:"column",width:`calc(100% - ${z}px)`},children:t("div",{ref:k,className:"sizer",children:o})}),_?p({width:z,height:$}):t(n,{})]})},[f,h?.left,h?.width,h?.totalWidth,_,p,z,$]);return t("div",{style:{position:"relative",display:"flex",minWidth:_?`${z}px`:void 0,minHeight:d?`${$}px`:void 0,...g},...x,ref:w,children:e("div",{style:{position:"relative",width:"100%",flex:"1 1 100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:[e("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:[t("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:s}),_?O:t(n,{})]}),d?K:t(n,{})]})})}));St.displayName="ScrollPane";const Lt={Default:"default",Error:"error",Success:"success",Warning:"warning",Info:"info"},Et=new Set,Tt={showMessage:(t,e)=>{if(e?.onceKey){if(Et.has(e.onceKey))return;Et.add(e.onceKey)}let n=console.log;e?.type!==Lt.Warning&&e?.type!==Lt.Error||(n=console.warn),n(t)},showBusy:(t,e)=>new Promise(t=>{t(()=>{})}),showError:t=>{console.error(t)}},Ct=()=>{const t=document.fullscreenElement;return t?t.querySelector(".fullscreen-portal-root")||t:document.body};let Mt=0;function Dt(){return r(()=>{function t(){const t=document.fullscreenElement;if(!t)return;let e=t.querySelector(".fullscreen-portal-root");e||(e=document.createElement("div"),e.className="fullscreen-portal-root _fullscreen-portal-root_1mjsr_4",t.appendChild(e))}return Mt++,t(),document.addEventListener("fullscreenchange",t),()=>{document.removeEventListener("fullscreenchange",t),Mt--,Mt<=0&&(document.querySelectorAll(".fullscreen-portal-root").forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),Mt=0)}},[]),{getPortalContainer:Ct}}const Pt=100,zt=100,kt=1e6,At=100,Bt=50,$t=h(u((e,n)=>{const{offset:o=0,viewportSize:r=0,totalSize:l=0,minSize:h=0,endGap:u=Pt,endScrollIncrement:d=zt,style:_=ft,onMouseDown:p,onScrollOffset:f,onScroll:m,scaleLimit:g=kt,scaleFactor:y=At,precisionFactor:v=Bt,...x}=e;m&&console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");const b=B(p,[p]),w=()=>({offset:o,totalSize:0===g?l:Math.min(l??0,Math.max(h??0,(o??0)+(r??0))+(u??0))}),[S,L]=s(w),E=0!==g&&S.totalSize>g?y:1,T=E/v,C=Math.ceil(S.totalSize/E),M=Math.ceil(S.offset/E),D=Math.ceil(r/E),P=a(t=>{},[]),[z,k]=s(!1),A=c(null);i(()=>{if(!z){A.current={propTotalSize:l,propViewportSize:r,propOffset:o};const t=w();L(t)}},[l,r,o,z,h,u,d]);const $=B((t,e,n)=>{const i=A.current;A.current=null,i&&i.propTotalSize===l&&i.propViewportSize===r&&i.propOffset===o||(Math.abs(t-M)<T&&(t=M),f?.(t*E,M,D))},[f,E,T,M,D]),O=a(t=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",O),k(!1)},[]),K=a(t=>{b?.(t),k(!0),document.addEventListener("mousemove",P,{passive:!0}),document.addEventListener("mouseup",O,{passive:!0})},[P,O]);return t(R,{ref:n,style:{..._},...x,offset:M,totalSize:C,viewportSize:D,onMouseDown:K,onScrollOffset:$})}));$t.displayName="VirtualScrollbar";const Ot={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"};function Kt(t,e){if("function"==typeof t)return t(e);t&&(t.current=e)}var Vt=parseInt(_.split(".")[0],10)>=19?function(t){return e=>{const n=[];for(const o of t){const t=Kt(o,e),i="function"==typeof t;n.push(i?t:()=>Kt(o,null))}return()=>{for(const t of n)t()}}}:function(t){return e=>{for(const n of t)Kt(n,e)}};const Ht=h(u((e,n)=>{const{refFocusStart:o,...i}=e,r=c(null),s=a(()=>{if(o)return void o?.current?.focus();const t=r.current.parentElement.children;let e=[];for(let n=0;n<t.length&&t[n]!==r.current;n++){const o=t[n].getAttribute("tabindex");if(null==o||"-1"===o)continue;if("true"===t[n].getAttribute("disabled"))continue;const i=t[n];i.focus&&e.push({tabindex:parseInt(o),child:i})}0!==e.length&&(e.sort(function(t,e){return t.tabindex-e.tabindex}),e[0].child.focus())},[o]);return t("div",{tabIndex:0,ref:Vt([r,n]),onFocus:s,...i})}));const Wt=h(u((i,r)=>{const{className:s,style:a,children:h,radius:u=4,strokeWidth:d=1,strokeColor:_="grey",...p}=i,[f,{width:m,height:g}]=A(),y=c(null),v=(t,e=0)=>{const n=t/2,o=g-n+e;return function(t,e,n=!1){if(0===e)return t;function o(t,e,n){let o=e.x-t.x,r=e.y-t.y,s=Math.sqrt(o*o+r*r);return i(t,e,Math.min(1,n/s))}function i(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}}function r(t,e){t.length>2&&(t[t.length-2]=e.x,t[t.length-1]=e.y)}function s(t){return{x:parseFloat(t[t.length-2]),y:parseFloat(t[t.length-1])}}let l=t.split(/[,\s]/).reduce(function(t,e){let n=e.match("([a-zA-Z])(.+)");return n?(t.push(n[1]),t.push(n[2])):t.push(e),t},[]).reduce(function(t,e){return parseFloat(e)==e&&t.length?t[t.length-1].push(e):t.push([e]),t},[]),a=[];if(l.length>1){let t=s(l[0]),c=null;"Z"===l[l.length-1][0]&&l[0].length>2&&(c=["L",t.x,t.y],l[l.length-1]=c),a.push(l[0]);for(let t=1;t<l.length;t++){let h=a[a.length-1],u=l[t],d=u===c?l[1]:l[t+1];if(d&&h&&h.length>2&&"L"===u[0]&&d.length>2&&"L"===d[0]){let t,l,c=s(h),_=s(u),p=s(d);n?(t=i(_,h.origPoint||c,e),l=i(_,d.origPoint||p,e)):(t=o(_,c,e),l=o(_,p,e)),r(u,t),u.origPoint=_,a.push(u);let f=i(t,_,.5),m=i(_,l,.5),g=["C",f.x,f.y,m.x,m.y,l.x,l.y];g.origPoint=_,a.push(g)}else a.push(u)}if(c){let t=s(a[a.length-1]);a.push(["Z"]),r(a[0],t)}}else a=l;return a.reduce(function(t,e){return t+e.join(" ")+" "},"")}(`${`M 0 ${n} L ${u-.5} ${n} L ${u-.5} ${o} L ${2*u} ${o}`} ${`L ${m-2*u} ${o}`} ${`M ${m-2*u} ${o} L ${m-u} ${o} L ${m-u} ${n} L ${m} ${n}`}`,u)},x=l(()=>v(d),[m,g,u,d]),b=l(()=>{if(0===u)return;const t=u/2;return v(u)+`L ${m} 0 L 0 0 L 0 ${t}`},[x,u,d]),w=l(()=>({style:{clipPath:`path('${b}')`}}),[b]);return e("div",{className:s,style:{display:"flex",flexDirection:"row",...a},...p,ref:Vt([y,f,r]),children:[o.isValidElement(h)?o.cloneElement(h,w):t(n,{}),t("svg",{style:{position:"absolute",top:0,left:0,pointerEvents:"none"},width:m,height:g,viewBox:`0 0 ${m} ${g}`,children:t("path",{d:x,stroke:_,fill:"none",vectorEffect:"non-scaling-stroke",strokeWidth:d})})]})})),Rt={},Nt=e=>{const{onPointerDown:n,style:o,splitDirection:i,paddingBefore:r=0,paddingAfter:s=0,disabled:l,key:a,hitAreaProps:c=Rt,...h}=e,u="row"===i,{style:d,className:_,...p}=c;return t("div",{style:{...o,position:"relative"},...h,children:t("div",{className:M("hit-box",_),style:{left:(u?-r:0)+"px",width:`calc(100% + ${u?r+s:0}px)`,top:(u?0:-r)+"px",height:`calc(100% + ${u?0:r+s}px)`,position:"absolute",...d},onPointerDown:l?void 0:n,...p})},a)},Ft={},It=(t,e,n=!0)=>null===t?null:null!==t.pixels?n?t.pixels:e-t.pixels:(n?t.percent:100-t.percent)/100*e,Yt=(t,e=!0)=>t?.percent?`${e?t.percent:100-t.percent}%`:t?.pixels?`${t.pixels}px`:void 0,Xt=(t,e)=>{if(null==t)return null;const n={percent:null,pixels:null};let o=e;return"string"==typeof t&&((t=t.trim().toLowerCase()).endsWith("px")?(t=t.substring(0,t.length-2),o=!1):t.endsWith("%")&&(t=t.substring(0,t.length-1),o=!0),t=parseFloat(t)),o?n.percent=t:n.pixels=t,Object.freeze(n)},jt=h(u((n,i)=>{const{elementBefore:a,elementAfter:h,splitDirection:u="row",fixedPane:d=null,position:_,onPositionChange:p,minBefore:f,maxBefore:m,minAfter:g,maxAfter:y,children:v,className:x,style:b,disabled:w=!1,onDragStart:S,onDragResize:L,onDragFinish:E,resizerProps:T=Ft,paneProps:C=Ft,paneBeforeProps:D=Ft,paneAfterProps:P=Ft,createResizer:z=Nt}=n;if(v)throw new Error("Use elementBefore and elementAfter instead of children.");const k=l(()=>o.isValidElement(h)&&o.isValidElement(a),[h,a]),$=l(()=>{let t=null;d&&("before"===d?t=0:"after"===d&&(t=1));const e=null===t;return{fixedPaneOffset:t,isPercent:e,minBefore:Xt(f,e),maxBefore:Xt(m,e),minAfter:Xt(g,e),maxAfter:Xt(y,e)}},[f,m,g,y]),O=B(p,[p]),[K,V]=s(()=>Xt(_,null===d));r(()=>{V(Xt(_,null===d))},[_,d]);const[H,{width:W,height:R}]=A(),[N,{width:F,height:I}]=A(),Y="row"===u?F:I,X="row"===u?W:R,j=l(()=>((t,e,n,o)=>{const i=[null,null],r=[null,null];if(t||(t={percent:null===o.fixedPaneOffset?50:null,pixels:null===o.fixedPaneOffset?null:0}),0===e)return null!=t?.pixels?1!==o.fixedPaneOffset?(i[0]=t?.pixels,r[1]=100):(i[1]=t?.pixels-n,r[0]=100):null!=t?.percent&&(1!==o.fixedPaneOffset?(r[0]=t?.percent,r[1]=100-t?.percent):(r[1]=t?.percent,r[0]=100-t?.percent)),{percents:r,pixels:i,minBefore:Yt(o.minBefore,!0),maxBefore:Yt(o.maxBefore,!0),minAfter:Yt(o.minAfter),maxAfter:Yt(o.maxAfter)};let s=It(t,e,1!==o.fixedPaneOffset),l=e-n,a=It(o.minBefore,l,!0)??0,c=It(o.maxBefore,l,!0)??l,h=0,u=0,d=0,_=l;h=(It(o.maxAfter,e,!1)??n)-n,u=It(o.minAfter,e,!1)??e,d=Math.max(a,h),_=Math.min(c,u),s=Math.max(d,Math.min(s,_)),u=Math.min(l-s,It(o.maxAfter,l-s,!0)??l),h=Math.min(l-s,It(o.minAfter,l-s,!0)??l),i[0]=s,i[1]=l-i[0];const p=Math.max(0,Math.min(100,s/l*100));return r[0]=p,r[1]=100-r[0],{percents:r,pixels:i,minBefore:`${a}px`,minAfter:`${h}px`,maxBefore:`${i[0]}px`,maxAfter:`${i[1]}px`}})(K,X,Y,$),[$,K,X,Y,u]),[U,Z]=s(!1),G=B(S,[S]),q=B(L,[L]),J=B(E,[E]),Q=c(null),tt=c(null),et=c(null),{style:nt,className:ot,...it}=C,rt={minWidth:0,minHeight:0,maxWidth:"100%",maxHeight:"100%",display:"flex",overflow:"hidden",...nt},{className:st,style:lt,...at}=D,{className:ct,style:ht,...ut}=P,dt={flex:"1 1 100%",width:"100%",...b,flexDirection:u,display:"flex"},{className:_t,style:pt,onPointerDown:ft,...mt}=T,gt=B(t=>{const e=Xt(t,null===d);V(e)},[d]),yt=B(t=>{if(w||!U)return;const e=wt.current?.getBoundingClientRect();let n=0;n="row"===u?(t.clientX??t.touches?.[0]?.clientX)-e.x:(t.clientY??t.touches?.[0]?.clientY)-e.y,n=Math.max(0,Math.min(X,n)),1===$.fixedPaneOffset&&(n=X-n),_&&K.pixels===n||V({pixels:n,percent:null}),q?.(n),t.stopPropagation(),t.preventDefault()},[$,u,w,U,K,X]),vt=B(t=>{if(document.removeEventListener("pointermove",yt),document.removeEventListener("touchmove",yt),document.removeEventListener("pointerup",vt),!U)return;if(Z(!1),!K)return;J(K.pixels);if(!Xt(_,null===d)||K.pixels!==_){const t={...K};null===t.percent&&(t.percent=t.pixels/X*100),O(t)}t.stopPropagation(),t.preventDefault()},[K,U,_,d,X]),bt=B(t=>{ft?.(t),t.defaultPrevented||w||U||(Z(!0),G(),document.addEventListener("pointermove",yt,{passive:!1}),document.addEventListener("touchmove",yt,{passive:!1}),document.addEventListener("pointerup",vt,{passive:!1}))},[ft]),wt=xt(i,()=>({setPosition:gt,isSplitPane:()=>!0}),[]),St=l(()=>k?z?.({key:"resizer",ref:Vt([N,tt]),className:M("resizer",_t),onPointerDownCapture:bt,style:{cursor:w?void 0:"row"===u?"ew-resize":"ns-resize",minWidth:"row"===u?"2px":void 0,minHeight:"row"!==u?"2px":void 0,boxSizing:"border-box",pointerEvents:"all",zIndex:1,...pt},splitDirection:u,disabled:w,...mt}):null,[k,_t,mt,u,pt,w]),Lt="row"===u?"Width":"Height",Et={...rt,...lt,flex:0===$.fixedPaneOffset&&null!==j?.pixels[0]?`0 0 ${Math.round(j?.pixels[0])}px`:`1 1 ${Math.round(j?.percents[0]??100)}%`,[`min${Lt}`]:j?.minBefore,[`max${Lt}`]:h?j?.maxBefore:"100%"},Tt={...rt,...ht,flex:1===$.fixedPaneOffset&&null!==j?.pixels[1]?`0 0 ${Math.round(j?.pixels[1])}px`:`1 1 ${Math.round(j?.percents[1]??100)}%`,[`min${Lt}`]:j?.minAfter,[`max${Lt}`]:a?j?.maxAfter:"100%"},Ct=l(()=>a?t("div",{ref:Q,className:M("before",ot,st),style:Et,...it,...at,children:a},"before"):null,[a,C,D,$,j]),Mt=l(()=>h?t("div",{ref:et,className:M("after",ot,ct),style:Tt,...it,...ut,children:h},"after"):null,[h,C,P,$,j]);return e("div",{ref:Vt([H,wt]),className:M("splitPane","row"===u?"vertical":"horizontal",{dragging:U},x),style:dt,children:[Ct,St,Mt]})}));function Ut(t){const[e,n]=s("undefined"!=typeof window?window.devicePixelRatio:1),o=c(null);return r(()=>{if(!("undefined"!=typeof window&&"matchMedia"in window))return;const t=()=>{const e=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);e.addEventListener("change",t,{once:!0,passive:!0}),n(window.devicePixelRatio),o.current={mediaMatcher:e,listener:t}};return t(),()=>{o.current&&o.current.mediaMatcher.removeEventListener("change",o.current.listener)}},[t]),e}function Zt(t){if("undefined"==typeof window)return 1;const{defaultDpr:e=1,maxDpr:n=3,round:o=!0}=t||{},i="undefined"!=typeof window&&"number"==typeof window.devicePixelRatio?window.devicePixelRatio:e;return Math.min(Math.max(1,o?Math.floor(i):i),n)}function Gt(t,e,n){const o=B(e,[e]);r(()=>{const e=e=>{t.current&&!t.current.contains(e.target)&&o(e)};return n&&!1===n.mouseEvents||(document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)),n&&!1===n.focusEvents||document.addEventListener("focus",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focus",e)}},[t])}function qt(t){if(!t)throw new Error("must have a PointerHandlerOptions");const{onPointerDown:e,onPointerUp:n,onPointerMoveOrWait:o,processTouch:i=!1,consumeTouch:s=!0}=t,l=B(e,[e]),h=B(n,[n]),u=B(o,[o]),d=c(!1),_=t?.timerInitial??230,p=t?.timerContinuous??_/2,f=c(null),m=c(null),g=c(null),y=c(null),v=a(()=>{y.current&&(clearTimeout(y.current),y.current=null)},[]),x=a(t=>{y.current=setTimeout(()=>{window.requestAnimationFrame(()=>{!1!==d.current&&u?.(m.current,g.current,f.current)}),x(p)},t??_)},[]);r(()=>()=>v(),[]);const b=i?"pointer":"mouse",w=a(t=>{t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault()},[]),S=B(t=>{document.removeEventListener(`${b}move`,T),document.removeEventListener(`${b}up`,S),document.removeEventListener("keydown",C),document.removeEventListener("keyup",M),document.removeEventListener("touchstart",w,{capture:!0}),document.removeEventListener("touchmove",w,{capture:!0}),window.removeEventListener("blur",L),v(),window.requestAnimationFrame(()=>{!1!==d.current&&(d.current=!1,h?.(t,g.current,f.current),g.current=null)})},[]),L=a(()=>{!1!==d.current&&(d.current=!1,S(m.current))},[]),E=B(()=>{v(),x(p),window.requestAnimationFrame(()=>{!1!==d.current&&u?.(m.current,g.current,f.current)})},[p]),T=B(t=>{m.current=t,E()},[]),C=B(t=>{g.current={ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey},E()},[]),M=B(t=>{g.current={ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey},E()},[p]);return B(t=>{if(t.isDefaultPrevented())return;g.current={ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey};!1!==l(t,g.current)&&(f.current=t,m.current=t.nativeEvent,document.addEventListener(`${b}up`,S,{passive:!1}),document.addEventListener(`${b}move`,T,{passive:!1}),document.addEventListener("keydown",C,{passive:!1}),document.addEventListener("keyup",M,{passive:!1}),window.addEventListener("blur",L,{passive:!0}),i&&s&&(document.addEventListener("touchstart",w,{passive:!1,capture:!0}),document.addEventListener("touchmove",w,{passive:!1,capture:!0})),d.current=!0,x(_))},[_,i])}function Jt(t,e){return qt({onPointerDown:t,onPointerMoveOrWait:(e,n,o)=>{t?.(o)},...e})}const Qt=({initValue:t,useHookBody:e,applyStateChange:n})=>{const o=c(t);if("function"!=typeof e)throw new Error("function expected as hook body parameter. got "+typeof e);const r=e();return i(()=>{o.current!==r&&(o.current=r,n(r))},[n,r]),null},te=t=>{console&&console.warn&&console.warn(t)},ee="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0;let ne=1,oe=!1,ie=!1;const re=[],se=[],le=()=>{se.forEach(t=>t())},ae=({automaticContainerInternalUseOnly:e})=>{const[o,i]=s([]),l=c([]);return l.current=o,e||!1!==oe||(ie=!0),r(()=>{let t=!0;function n(){if(t)return se[0]!==n?(e||!0!==oe||te("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."),void i(t=>[])):void i([...re])}return se.push(n),le(),()=>{t=!1,l.current?.length>0&&te("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"),se.splice(se.indexOf(n),1),le()}},[e]),t(n,{children:o.map(({hook:t,key:e})=>p(Qt,{...t,key:e}))})},ce=e=>{const n=ne++;return re.push({hook:e,key:n}),0===se.length&&!1===ie&&(oe=!0,(e=>{if(ee.document&&ee.document.createElement){const n=ee.document.createElement("div");x(n).render(t(e,{automaticContainerInternalUseOnly:!0}))}else te("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.")})(ae)),le(),()=>{re.splice(re.findIndex(t=>t.key===n),1),le()}},he=(t,e,n={})=>{let o,i,l=!1,a=!1,c=[],{unmountIfNoConsumers:h=!1}=n;const u=t=>{i=t,b(()=>c.forEach(e=>e(t)))},d=()=>(a||(i="function"==typeof t?t():t,a=!0),i);return()=>{const[n,a]=s(d);return r(()=>(l||(l=!0,o=ce({initValue:t,useHookBody:e,applyStateChange:u})),c.push(a),i!==n&&a(i),()=>{c.splice(c.indexOf(a),1),0===c.length&&h&&(o(),l=!1)}),[]),n}};let ue=()=>{console.warn("You must call useEditMode before setting its state.")};const de=he(null,()=>{const[t,e]=s(null);return ue=e,t}),_e=()=>{const t=de();return l(()=>({setMode:t=>{ue(e=>("function"==typeof t&&(t=t(e)),t?.onModeChange?.(t??null),t))},getMode:()=>t}),[t])};class pe{constructor(t,e,n,o){this._listenersProperties=new Set,this._listenersExecute=new Set,this._key=t,this._target=e,this._applyProps(n||{}),this._callback=o,void 0===o&&(this._callback=()=>{console.log(`implement: ${this.label()} : ${this.description()}`)})}key(){return this._key}_resolve(t,e){if("function"==typeof t){const n=e??this._context;return t("function"==typeof n?n():n)}return t}target(){return"function"==typeof this._target?this._target():this._target}label(t,e){const n=this._scopedLabels?.[t]||this._label;let o=null;if("function"==typeof n){const t=e??this._context;o=n("function"==typeof t?t():t)}else o=n;return o}description(t){return this._resolve(this._description,t)}tags(t){return this._resolve(this._tags,t)}icon(t){return this._resolve(this._icon,t)}shortcut(){return this._resolve(this._shortcut)}disabled(){return this._resolve(this._disabled)||!this._callback}state(){return this._resolve(this._state)}context(){return"function"==typeof this._context?this._context():this._context}async execute(t,e){if(!this.disabled()&&this._callback){try{let n=!0;e?.beforeExecute&&(n=e?.beforeExecute(this,t));if(!1===await Promise.resolve(n))return!1;const o=this._callback.bind(this)(t,this);if(!1===await Promise.resolve(o))return!1;e?.onExecute?.(this,t),this._notifyExecute(t)}catch(n){return console.warn(n),e?.onError(this,n,t),this._notifyError(t,n),!1}return!0}}addPropertyListener(t,e=!1){if(!t)throw new Error("listener must be specified");const n=this._listenersProperties;return n.add(t),e&&t({},this),()=>{n.delete(t)}}addExecuteListener(t){if(!t)throw new Error("listener must be specified");const e=this._listenersExecute;return e.add(t),function(){e.delete(t)}}_notifyExecute(t){const e=this;this._listenersExecute.forEach(n=>{n.onExecute(e,t)})}_notifyError(t,e){const n=this;this._listenersExecute.forEach(o=>{o.onError?.(n,t,e)})}updateCallback(t){return this._callback=t||null,this}update(t){if(!t)return;const e=this._applyProps(t);return Object.keys(e).length>0&&this._notifyPropertyChange(e),this}_notifyPropertyChange(t){const e=this;this._listenersProperties.forEach(n=>{n(t,e)})}_applyProps(t){let e={},n=this;return Object.keys(t).forEach(o=>{let i=t[o];n["_"+o]!==i&&(n["_"+o]=e[o]=i)}),e}}class fe extends pe{}class me{constructor(t,e){this._target=null,this._groupKey=null,this._root=null,this._parent=null,this._uuid=m.uuidV4(),this._target=t,this._groupKey=e??null,this._root=this,this._nodes=new Map,this._nodes.set(e,this),this._children=new Map,this._listeners=new Set,this._commandsByKey=new Map,this._commandsByShortcut=new Map;const n=this;this._unListenersByCommand=new Map,this._listenersByKey=new Map,this._commandsPropertyListener=(t,e)=>{const o=n._root._listenersByKey,i=e.key(),r=o.get(i);r&&n._notifyCommands(r,"onCommandChange",e)}}_getCommand(t){const e=this._commandsByKey.get(t);return e||(this._parent?._getCommand(t)??null)}getCommand(t,e=!1){const n=this._root._focused;let o=n,i=n===this;for(;!i&&o;)o===this&&(i=!0),o=o._parent;return(i?n:this)._getCommand(t)}createChildGroup(t,e,n){let o;if(!n){let t=this;for(;t&&!o;){let n=t._nodes.get(e);n&&(o=n),t=t._parent}}o||(o=new me(t,e),o._parent=this,o._root=this._root,o._unListenersByCommand=null,o._listenersByKey=null,o._commandsPropertyListener=null);const i=(t,o)=>{!t.has(e)||n?t.set(e,o):void 0===n&&console.warn("commandGroup already registered",e)};i(this._root._nodes,o);let r=this._parent;for(;r;)i(this._nodes,o),r=r._parent;return this._children.set(e,o),this._notify("onGroupChange"),o}getKey(){return this._groupKey}getGroup(t){return this._nodes.get(t)}_addCommands(t,e=void 0){const n=this._commandsByKey,o=this._commandsByShortcut,i=this._root._commandsPropertyListener,r=this._root._unListenersByCommand;for(let s=0;s<t.length;s++){const l=t[s],a=l.key();if(n.has(a)&&!e){void 0===e&&console.warn("command already registered",a);continue}n.set(a,l);let c=r.get(l);c&&(c(),r.delete(l));const h=l.addPropertyListener(i);r.set(l,h);const u=l.shortcut();if(!u)continue;const d=Array.isArray(u)?u:[u];for(let t=0;t<d.length;t++){const n=ve(d[t]),i=o.get(n);i&&!e&&void 0===e&&console.warn(`Shortcut already registered: ${n}, ${a}, ${i}.`),o.set(n,a)}}}removeFromParent(){if(!this._parent)return;let t=this._parent,e=[];const n=this._groupKey;for(;t;)e.push(t._nodes),t._nodes.delete(n),t=t._parent;t=this._parent;const o=t=>{t._children.forEach(t=>{for(let n=0;n<e.length;n++)t._nodes.delete(e[n]);o(t)})};o(this),this._parent=null,this._notify("onGroupChange")}addCommands(t,e){this._addCommands(t,e),this._notify("onGroupChange")}getActive(){return this._root._focused??this._root}activate(t){let e=this;if(t&&(e=this._nodes.get(t),!e))return void console.warn("group not found",t);let n=this._root._focused??this._root;for(;n;)n=n._parent;this._root._focused!==e&&(this._root._focused=e,this._notify("onGroupChange"),this._notify("onActiveChange"))}findCommandByEvent(t){const e=[];t.altKey&&e.push(S.Alt),t.shiftKey&&e.push(S.Shift),t.ctrlKey&&e.push(S.Ctrl),t.metaKey&&e.push(S.Meta);let n=ve({key:t.code,modifiers:e});const o=this._commandsByShortcut;let i=o.get(n);i||(n=ve({key:t.key,modifiers:e}),i=o.get(n)),!i&&t.code.startsWith("Digit")&&(n=ve({key:t.code.substring(5,t.code.length),modifiers:e}),i=this._commandsByShortcut.get(n)),!i&&t.code.startsWith("Key")&&(i=ve({key:t.code.substring(3,t.code.length),modifiers:e}),i=o.get(n));let r=null;return i&&(r=this._commandsByKey.get(i),r&&r.disabled()&&(r=null),!r||r.target()&&r.target().contains(t.target)||(r=null)),r||(this._parent?.findCommandByEvent(t)??null)}dispatchToFocusedCommand(t){const e=this.getActive();if(!e)return!1;if(t.isDefaultPrevented())return!1;const n=e.findCommandByEvent?.(t);return!!n&&(n.execute(),t.preventDefault(),!0)}getRoot(){return this._parent?this._parent.getRoot():this}getParent(){return this._parent}addListener(t,e){const n=this._listeners,o=e?.keys,i=this._root._listenersByKey;if(o&&!t.onCommandChange)throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");let r=null;if(o)for(let e=0;e<o.length;e++){const n=o[e];if(!n)continue;let s=i.get(n);s||(s=new Set,i.set(n,s)),r||(r=[]),r.push(s),s.add(t)}return n.add(t),()=>{if(r)for(let e=0;e<r.length;e++){r[e].delete(t)}n.delete(t)}}_notifyCommands(t,e,n){const o=this;setTimeout(()=>{t.forEach(t=>{t[e]?.(o,n)})},0)}_notify(t,e){const n=this;setTimeout(()=>{n._listeners.forEach(o=>{o[t]?.(n,e)}),n._parent&&n._parent._notify(t,e)},0)}getAllCommands(){const t=[],e=this._groupKey;return this._commandsByKey.forEach(n=>{t.push({command:n,groupKey:e})}),this._children.forEach(e=>{t.push(...e.getAllCommands())}),t}}const ge=m.getOS()===m.OSType.MacOS||m.getOS()===m.OSType.IOS?"Cmd":"Ctrl",ye=m.getOS()===m.OSType.MacOS||m.getOS()===m.OSType.IOS?"⌘":"^",ve=(t,e=!1)=>{const n={};for(let e=0;t.modifiers&&e<t.modifiers.length;e++)n[t.modifiers[e]]=!0;let o="";return(n?.[S.Ctrl]||n?.[S.Meta])&&(o+=(o.length>0?"+":"")+(e?ye:ge)),n?.[S.Alt]&&(o+=e?"⌥":"Alt"),n?.[S.Shift]&&(o+=(o.length>0?"+":"")+(e?"⇧":"Shift")),o+=(o.length>0?"+":"")+gt(t.key),o};function xe(t,e=null){const n=c(e);n.current=e;const[o,i]=f(t=>t+1,0),s=l(()=>Array.isArray(t)?t:[t],[t]);return r(()=>{if(!s||0===s.length)return;const t=(t,e)=>{n.current?.onChange?.(e),i()};let o=null;e&&(o={onExecute(t,e){n.current?.onExecute?.(t,e)},onError(t,e,o){n.current?.onError?.(t,e,o)}});const r=new Set;for(let n=0;n<s.length;n++)r.add(s[n]?.addPropertyListener(m.debounce(t,0),!0)),e&&r.add(s[n]?.addExecuteListener(o));return()=>{r.forEach(t=>{t?.()})}},[t]),o}const be=(t,e)=>{const n=[];if(e)for(let o=0;o<e.length;o++){const i=e[o],r=i?t?.getCommand(i):null;n.push(r)}return n};function we(t,e=null,n=null,o){const i=c(n);i.current=n,e&&!Array.isArray(e)&&(e=[e]);const[l,a]=s(be(t,e)),h=o?[...o,t]:[t];return r(()=>{const n={onGroupChange:()=>{const n=be(t,e);a(n),i.current?.onChange?.(this)}};let o;e&&e.length>0&&(o={keys:e},n.onCommandChange=(n,o)=>{i.current?.onChange?.(t),a(be(t,e))});const r=t?.addListener(n,o),s=be(t,e);return a(s),i.current?.onChange&&i.current?.onChange(t),()=>{r?.()}},h),l}const Se={Toolbar:"toolbar",Menuitem:"menuitem"},Le=he({setClipboard:t=>{throw new Error("This is only available via the useClipboard.")},getClipboard:()=>v.Global,refNativeCopy:{current:null},refNativeLastKey:{current:null}},()=>{const[t,e]=s(v.Global);return{setClipboard:t=>e(t),getClipboard:()=>t,refNativeCopy:c(null),refNativeLastKey:c(null)}}),Ee=t=>{const{source:e,target:n,onPaste:o,onClipboardUpdate:i,notifier:s=Tt,commands:c}=t,h=B(i,[i]),u=B(o,[o]),{getClipboard:d,refNativeCopy:_}=Le(),p=d();l(()=>{const t=e?.element,o=n?.element??e?.element;if(!c)return;const i=[new fe("cut",t,{label:"Cut",description:"Remove the selection and put it on the clipboard so you can paste it somewhere else.",shortcut:{key:"X",modifiers:[S.Ctrl]}}),new fe("copy",t,{label:"Copy",description:"Put a copy of the selection on the clipboard so you can paste it somewhere else.",shortcut:{key:"C",modifiers:[S.Ctrl]}}),new fe("paste",o,{label:"Paste",description:"Add content on the clipboard to your document.",shortcut:[{key:"V",modifiers:[S.Ctrl]},{key:"F8",modifiers:[S.Ctrl]}]})];c?.addCommands(i,!0)},[c]);const f=B(async t=>{if(!e?.element)return;let n=null;try{n=e.doCopy?.(t),"string"==typeof n?await p.writeText(n):await p.writeReference(n)}catch(t){throw t}},[e,s]),x=B(async t=>{const n=e?.element?.();if(n){_.current={sourceElement:n,args:t};try{await f(t)}catch(t){s?.showError?.(t)}}},[e?.element,s]),b=a(()=>{x({isCut:!0})},[]),w=B(async(t,e,n)=>{try{if(!1===await t.doPaste(e,n))return;u?.(e,n)}catch(t){s?.showError?.(t)}},[u]),L=B(async(t,e,o)=>{const i=n?.element?.();if(i&&await m.whenFocus(i),!t&&!e)return;const r=await(s?.showBusy?.("Pasting..."));if(e)try{return await w(n,e,o),void r?.()}catch(t){r?.(),s?.showError?.(t)}let l,a=n.importFromExternal;a||(a=(e,n)=>({getItemType:()=>"text",toText:()=>t.text,isClipboardItem:!0}));try{l=await a(t,{isCut:!1})}catch(t){r?.(),s?.showError?.(t)}if(l)try{const t=await Promise.resolve(l);await w(n,t,o),r?.()}catch(t){r?.(),s?.showError?.(t)}else r?.()},[w,n,s]),E=B(async t=>{if(n?.element)try{const e=await p.readReference();if(e)return void await L(null,e,t);const n=[];n[0]=await g.readStringFromClipboard(p,y.plain),n[1]=await g.readHTMLFromClipboard(p,y.html),n[2]=await g.readBlobFromClipboard(p,y.png);const o={text:n[0]??null,html:n[1]??null,image:n[2]??null};await L(o,null,t)}catch(t){if("Document is not focused."===t?.message)return;s?.showError?.(t)}},[L,n?.element,s]);return B(async t=>{},[e?.element]),B(async t=>{},[n?.element,L,s]),r(()=>{if(!p)return;const t=async t=>{const e=await p.readReference();h?.(e)},e=t=>{s?.showMessage?.(v.ErrorMessages.PermsRead,{onceKey:"clipboard.features"})},n=t=>{s?.showMessage?.(v.ErrorMessages.PermsWrite,{onceKey:"clipboard.features"})};return p.addEventListener("clipboardchange",t),p.addEventListener("clipboarderrorread",e),p.addEventListener("clipboarderrorwrite",n),()=>{p.removeEventListener("clipboardchange",t),p.removeEventListener("clipboarderrorread",e),p.removeEventListener("clipboarderrorwrite",n)}},[p,s]),r(()=>{},[f,L,e,n]),r(()=>{c?.getCommand("cut")?.updateCallback(b).update({disabled:!e||!n}),c?.getCommand("copy")?.updateCallback(x).update({disabled:!e}),c?.getCommand("paste")?.updateCallback(E).update({disabled:!n})},[e,n,c]),{paste:E,copy:x,clipboard:p}};function Te(t,e=!0){const n=c(t);r(()=>{if(e){const e=Object.entries(t).reduce((t,[e,o])=>(n.current[e]!==o&&(t[e]=[n.current[e],o]),t),{});Object.keys(e).length>0&&console.log("Changed props:",e)}n.current=t})}let Ce=!1,Me=0;var De="undefined"!=typeof document?i:r;const Pe=()=>"sheetxl-ui-"+Me++;const ze=o["useId".toString()],ke=null!=ze?ze:function(){const[t,e]=o.useState(()=>Ce?Pe():void 0);return De(()=>{null==t&&e(Pe())},[]),o.useEffect(()=>{Ce||(Ce=!0)},[]),t},Ae="Undo the last action.",Be="Repeat the last action or undo the redo.",$e=t=>`Redo ${t}`,Oe=({manager:t,commands:e,disabled:n,notifier:o=Tt})=>{const i=B(e=>{try{t?.undo(e)}catch(t){o.showError?.(t)}},[t]),s=B(e=>{try{t?.redo(e)}catch(t){o.showError?.(t)}},[t]);return l(()=>{if(!e)return;const t={contains:t=>!0,focus(){}},n=[new pe("undo",t,{label:"Undo",description:Ae,shortcut:{key:"z",modifiers:[S.Ctrl]},disabled:!0},i),new pe("redo",t,{label:"Redo",description:Be,shortcut:[{key:"y",modifiers:[S.Ctrl]},{key:"F4"},{key:"Enter",modifiers:[S.Alt]}],disabled:!0},s)];e?.addCommands(n,!0)},[e]),r(()=>{if(!e)return;const o=()=>{const o=t?.getTopUndoDescription(),i={};var r;e.getCommand("undo").update({disabled:n||!t||!t.hasUndo(),description:o?(r=o,`Undo ${r}`):Ae,state:i,context:{undoManager:t}});const s=t?.getTopRedoDescription();e.getCommand("redo").update({disabled:n||!t||!t.hasRedo(),description:s?$e(s):Be,state:i,context:{undoManager:t}})};if(o(),!t)return;const i=t.addListener({onStackChange(){o()}});return()=>i?.()},[t,e,n]),{undo:i,redo:s}};export{pe as Command,Se as CommandButtonType,me as CommandGroup,Tt as DefaultNotifier,Ht as FocusKeyNavigation,w as HorizontalAlignment,L as KeyCodes,S as KeyModifiers,E as MouseButtonCodes,Lt as NotificationType,yt as ReactUtils,Wt as RoundedTab,St as ScrollPane,H as ScrollUtils,R as Scrollbar,T as ScrollbarOrientation,fe as SimpleCommand,jt as SplitPane,Nt as SplitPaneResizer,Ot as ToolTipPlacement,$t as VirtualScrollbar,wt as defaultCreateScrollCorner,K as defaultCreateScrollEdgeButton,O as defaultCreateScrollEndButton,$ as defaultCreateScrollStartButton,bt as defaultCreateScrollbar,Zt as getDevicePixelRatio,Ct as getPortalContainer,ve as toShortcutString,B as useCallbackRef,xe as useCommand,we as useCommands,Ee as useCopyPaste,Ut as useDevicePixelRatio,_e as useEditMode,Dt as useFullscreenPortal,Le as useGlobalClipboard,ke as useId,xt as useImperativeElement,Jt as useMouseDownAndHoldListener,Gt as useOnClickOrFocusAway,qt as useSynchronizedPointerHandler,Te as useTraceUpdate,Oe as useUndoManager};
|
|
13
|
+
const Qn = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, Z = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, eo = { 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 }, to = { Left: 1, Middle: 2, Right: 3 }, re = { Horizontal: "horizontal", Vertical: "vertical" };
|
|
14
|
+
function Lt(i) {
|
|
15
|
+
var e, t, n = "";
|
|
16
|
+
if (typeof i == "string" || typeof i == "number") n += i;
|
|
17
|
+
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
18
|
+
var o = i.length;
|
|
19
|
+
for (e = 0; e < o; e++) i[e] && (t = Lt(i[e])) && (n && (n += " "), n += t);
|
|
20
|
+
} else for (t in i) i[t] && (n && (n += " "), n += t);
|
|
21
|
+
return n;
|
|
22
|
+
}
|
|
23
|
+
function ve() {
|
|
24
|
+
for (var i, e, t = 0, n = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (e = Lt(i)) && (n && (n += " "), n += e);
|
|
25
|
+
return n;
|
|
26
|
+
}
|
|
27
|
+
var ln = function() {
|
|
28
|
+
}, Ct = typeof window < "u", an = Ct ? Ve : V, ut = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
29
|
+
const fe = Ct && window.ResizeObserver !== void 0 ? function() {
|
|
30
|
+
var i = Q(null), e = i[0], t = i[1], n = Q(ut), o = n[0], r = n[1], s = N(function() {
|
|
31
|
+
return new window.ResizeObserver(function(l) {
|
|
32
|
+
if (l[0]) {
|
|
33
|
+
var a = l[0].contentRect, c = a.x, h = a.y, u = a.width, d = a.height, w = a.top, b = a.left, x = a.bottom, S = a.right;
|
|
34
|
+
r({ x: c, y: h, width: u, height: d, top: w, left: b, bottom: x, right: S });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}, []);
|
|
38
|
+
return an(function() {
|
|
39
|
+
if (e) return s.observe(e), function() {
|
|
40
|
+
s.disconnect();
|
|
41
|
+
};
|
|
42
|
+
}, [e]), [t, o];
|
|
43
|
+
} : function() {
|
|
44
|
+
return [ln, ut];
|
|
45
|
+
}, T = (i, e) => {
|
|
46
|
+
const t = R((...r) => i?.(...r), e), n = A(null);
|
|
47
|
+
n.current = t;
|
|
48
|
+
const o = R((...r) => n.current?.(...r), []);
|
|
49
|
+
if (n.current) return o;
|
|
50
|
+
}, cn = (i) => {
|
|
51
|
+
const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
|
|
52
|
+
return L("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: o ? "0px" : "3px", paddingTop: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button start`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "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" }) }) }) });
|
|
53
|
+
}, hn = (i) => {
|
|
54
|
+
const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
|
|
55
|
+
return L("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: o ? "0px" : "3px", paddingBottom: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button end`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "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" }) }) }) });
|
|
56
|
+
}, no = (i) => {
|
|
57
|
+
const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
|
|
58
|
+
return L("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...e }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} edge`, ...n, children: L("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: o ? "rotate(90) " : "", children: L("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" }) }) });
|
|
59
|
+
}, Ue = (i, e, t, n, o = 0) => {
|
|
60
|
+
for (let r = 0; r < t.length; r++) {
|
|
61
|
+
const s = t[r].getBoundingClientRect();
|
|
62
|
+
let l = s.left - e, a = l + s.width;
|
|
63
|
+
if (n) {
|
|
64
|
+
if (l < i && a >= i) return l;
|
|
65
|
+
} else if (Math.ceil(a) > Math.ceil(i) + 2) return a;
|
|
66
|
+
}
|
|
67
|
+
return o;
|
|
68
|
+
}, oo = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Ue }, Symbol.toStringTag, { value: "Module" })), un = "_sheetxl-scrollbar_eblx4_6", et = Se(Le((i, e) => {
|
|
69
|
+
const { offset: t = 0, totalSize: n = 0, viewportSize: o = 0, style: r, className: s, orientation: l = re.Vertical, onScrollOffset: a, onScroll: c, showCustomScrollButtons: h = !1, scrollButtonIncrement: u = 200, scrollButtonInitialRepeatDelay: d = 260, scrollButtonAdditionalRepeatDelay: w = 120, createScrollStartButton: b = cn, createScrollEndButton: x = hn, ...S } = i, P = T(c, [c]), _ = A(null), [y, { width: f, height: k }] = fe(), [z, { width: O, height: F }] = fe(), g = l === re.Vertical, v = g ? "top" : "left", B = g ? "scrollTop" : "scrollLeft", p = g ? k : f, C = g ? F : O, [m, E] = Q(null);
|
|
70
|
+
V(() => {
|
|
71
|
+
m !== null && _.current && _.current.scrollTo({ behavior: "smooth", [v]: m });
|
|
72
|
+
}, [m, g]);
|
|
73
|
+
const D = R((K, se = !1) => {
|
|
74
|
+
if (!_.current) return 0;
|
|
75
|
+
const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = se ? 0 : Ue(K, pe[v], le, !0, Math.max(0, K - u));
|
|
76
|
+
return E(ce), Math.max(0, ce);
|
|
77
|
+
}, []), G = R((K, se = !1) => {
|
|
78
|
+
if (!_.current) return 0;
|
|
79
|
+
const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = Math.ceil(C - p), Ce = se ? ce : Ue(K, pe[v], le, !1, Math.max(0, K + u));
|
|
80
|
+
return E(Ce), Math.min(ce, Ce);
|
|
81
|
+
}, [C, p]), W = A(null), Y = R((K) => {
|
|
82
|
+
W.current = t;
|
|
83
|
+
const se = K.target[B];
|
|
84
|
+
a(se, o, n), P?.(K);
|
|
85
|
+
}, [a, o, n, t]);
|
|
86
|
+
V(() => {
|
|
87
|
+
const K = W.current;
|
|
88
|
+
W.current = null, t !== K && (_.current[B] = t);
|
|
89
|
+
}, [t, B]);
|
|
90
|
+
const X = A(null), $ = A(null), I = R(() => {
|
|
91
|
+
X.current && (clearTimeout(X.current), X.current = null, $.current = null);
|
|
92
|
+
}, []), j = R((K, se, ie, pe = d) => {
|
|
93
|
+
$.current = K, X.current = setTimeout(() => {
|
|
94
|
+
const le = ie ? D($.current || K) : G($.current || K);
|
|
95
|
+
le !== $.current ? j(le, !1, ie, w) : I();
|
|
96
|
+
}, se ? 0 : pe);
|
|
97
|
+
}, [D, G, I]);
|
|
98
|
+
V(() => () => I(), [I]);
|
|
99
|
+
const ne = t, ge = N(() => {
|
|
100
|
+
if (!h) return null;
|
|
101
|
+
const K = { orientation: l, disabled: Math.floor(ne) <= 0 || Math.floor(C - p) === 0, onMouseUp: I, onMouseLeave: I, onMouseDown: () => j(ne, !0, !0) };
|
|
102
|
+
return b?.(K);
|
|
103
|
+
}, [h, l, ne, m, C, p]), ye = N(() => {
|
|
104
|
+
if (!h) return null;
|
|
105
|
+
const K = { orientation: l, disabled: Math.floor(C - p) <= Math.ceil(ne), onMouseUp: I, onMouseLeave: I, onMouseDown: () => j(ne, !0, !1) };
|
|
106
|
+
return x?.(K);
|
|
107
|
+
}, [h, l, ne, m, C, p]);
|
|
108
|
+
return be("div", { ref: e, style: { display: "flex", flex: "1", flexDirection: g ? "column" : "row", padding: "0", ...r }, className: ve(un, s), ...S, children: [ge, L("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: g ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: y, children: L("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: g ? "scroll" : "hidden", overflowX: g ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: Y, ref: _, children: L("div", { ref: z, style: { position: "absolute", height: g ? n - o + (k ?? 0) : 1, width: g ? 1 : n - o + (f ?? 0) }, className: "scrollbar-viewport" }) }) }), ye] });
|
|
109
|
+
}));
|
|
110
|
+
et.displayName = "Scrollbar";
|
|
111
|
+
let dt = Date.now, pt = 1e3, de = {}, dn = 1;
|
|
112
|
+
const Ee = (i) => {
|
|
113
|
+
let e = de[i] !== null;
|
|
114
|
+
return e && (de[i] = null), e;
|
|
115
|
+
}, _t = (i, e, t, n = 0, o) => {
|
|
116
|
+
let r = dt(), s = r, l = 0, a = 0, c = 0, h = dn++;
|
|
117
|
+
if (h % 20 == 0) {
|
|
118
|
+
const d = {};
|
|
119
|
+
for (let w in de) d[w] = !0;
|
|
120
|
+
de = d;
|
|
121
|
+
}
|
|
122
|
+
const u = function(d) {
|
|
123
|
+
let w = d !== !0, b = dt(), x = !0;
|
|
124
|
+
try {
|
|
125
|
+
x = (!e || e(h)) ?? !0;
|
|
126
|
+
} catch {
|
|
127
|
+
x = !1;
|
|
128
|
+
}
|
|
129
|
+
if (!de[h] || !x) return de[h] = null, void t?.(60 - a / ((b - r) / pt), h, !1);
|
|
130
|
+
if (w) {
|
|
131
|
+
c = Math.round((b - s) / 16.666666666666668) - 1;
|
|
132
|
+
for (let _ = 0; _ < Math.min(c, 4); _++) u(!0), a++;
|
|
133
|
+
}
|
|
134
|
+
n && (l = (b - r) / n, l > 1 && (l = 1));
|
|
135
|
+
let S = o ? o(l) : l, P = !1;
|
|
136
|
+
try {
|
|
137
|
+
P = i(S, b, w);
|
|
138
|
+
} catch {
|
|
139
|
+
P = !1;
|
|
140
|
+
}
|
|
141
|
+
P !== !1 && l !== 1 || !w ? w && (s = b, requestAnimationFrame(u)) : (de[h] = null, t?.(60 - a / ((b - r) / pt), h, l === 1 || n == null));
|
|
142
|
+
};
|
|
143
|
+
return de[h] = !0, requestAnimationFrame(u), h;
|
|
144
|
+
}, pn = function(i) {
|
|
145
|
+
return Math.pow(i - 1, 3) + 1;
|
|
146
|
+
}, _n = function(i) {
|
|
147
|
+
return (i /= 0.5) < 1 ? 0.5 * Math.pow(i, 3) : 0.5 * (Math.pow(i - 2, 3) + 2);
|
|
148
|
+
};
|
|
149
|
+
class mn {
|
|
150
|
+
constructor(e, t) {
|
|
151
|
+
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: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...t };
|
|
152
|
+
}
|
|
153
|
+
setDimensions(e, t, n, o) {
|
|
154
|
+
e !== null && (this.__clientWidth = e), t !== null && (this.__clientHeight = t), n !== null && (this.__contentWidth = n), o !== null && (this.__contentHeight = o), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0);
|
|
155
|
+
}
|
|
156
|
+
setPosition(e, t) {
|
|
157
|
+
this.__clientLeft = e || 0, this.__clientTop = t || 0;
|
|
158
|
+
}
|
|
159
|
+
setSnapSize(e, t) {
|
|
160
|
+
this.__snapWidth = e, this.__snapHeight = t;
|
|
161
|
+
}
|
|
162
|
+
getValues() {
|
|
163
|
+
return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
|
|
164
|
+
}
|
|
165
|
+
getPoint(e, t) {
|
|
166
|
+
const n = this.getValues();
|
|
167
|
+
return { left: e / n.zoom, top: t / n.zoom };
|
|
168
|
+
}
|
|
169
|
+
getScrollMax() {
|
|
170
|
+
return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
|
|
171
|
+
}
|
|
172
|
+
zoomTo(e, t = !1, n, o, r) {
|
|
173
|
+
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
174
|
+
r && (this.__zoomComplete = r), this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0);
|
|
175
|
+
const s = this.__zoomLevel;
|
|
176
|
+
n === void 0 && (n = this.__clientWidth / 2), o === void 0 && (o = this.__clientHeight / 2), e = Math.max(Math.min(e, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(e);
|
|
177
|
+
const l = e / s;
|
|
178
|
+
let a = l * (this.__scrollLeft + n) - n, c = l * (this.__scrollTop + o) - o;
|
|
179
|
+
a > this.__maxScrollLeft ? a = this.__maxScrollLeft : a < 0 && (a = 0), c > this.__maxScrollTop ? c = this.__maxScrollTop : c < 0 && (c = 0), this.__publish(a, c, e, t);
|
|
180
|
+
}
|
|
181
|
+
zoomBy(e, t = !1, n = 0, o = 0, r) {
|
|
182
|
+
this.zoomTo(this.__zoomLevel * e, t, n, o, r);
|
|
183
|
+
}
|
|
184
|
+
scrollTo(e, t, n = !1, o = 1) {
|
|
185
|
+
if (this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0), o !== void 0 && o !== this.__zoomLevel) {
|
|
186
|
+
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
187
|
+
e *= o, t *= o, this.__computeScrollMax(o);
|
|
188
|
+
} else o = this.__zoomLevel;
|
|
189
|
+
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 && (n = !1), this.__publish(e, t, o, n);
|
|
190
|
+
}
|
|
191
|
+
scrollBy(e = 0, t = 0, n = !1) {
|
|
192
|
+
const o = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, r = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
|
|
193
|
+
this.scrollTo(o + (e || 0), r + (t || 0), n);
|
|
194
|
+
}
|
|
195
|
+
doMouseZoom(e, t, n, o) {
|
|
196
|
+
const r = e > 0 ? 0.97 : 1.03;
|
|
197
|
+
return this.zoomTo(this.__zoomLevel * r, !1, n - this.__clientLeft, o - this.__clientTop);
|
|
198
|
+
}
|
|
199
|
+
doTouchStart(e, t) {
|
|
200
|
+
if (e.length === void 0) throw new Error("Invalid touch list: " + e);
|
|
201
|
+
if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
|
|
202
|
+
let n, o;
|
|
203
|
+
this.__interruptedAnimation = !0, this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = !0), this.__isAnimating && (Ee(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = !0);
|
|
204
|
+
let r = e.length === 1;
|
|
205
|
+
r ? (n = e[0].pageX, o = e[0].pageY) : (n = Math.abs(e[0].pageX + e[1].pageX) / 2, o = Math.abs(e[0].pageY + e[1].pageY) / 2), this.__initialTouchLeft = n, this.__initialTouchTop = o, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n, this.__lastTouchTop = o, 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 = [];
|
|
206
|
+
}
|
|
207
|
+
doTouchMove(e, t, n = 1) {
|
|
208
|
+
if (e.length === void 0) throw new Error("Invalid touch list: " + e);
|
|
209
|
+
if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
|
|
210
|
+
if (!this.__isTracking) return;
|
|
211
|
+
let o, r;
|
|
212
|
+
e.length === 2 ? (o = Math.abs(e[0].pageX + e[1].pageX) / 2, r = Math.abs(e[0].pageY + e[1].pageY) / 2) : (o = e[0].pageX, r = e[0].pageY);
|
|
213
|
+
let s = this.__positions;
|
|
214
|
+
if (this.__isDragging) {
|
|
215
|
+
let l = o - this.__lastTouchLeft, a = r - this.__lastTouchTop, c = this.__scrollLeft, h = this.__scrollTop, u = this.__zoomLevel;
|
|
216
|
+
if (n !== void 0 && this.options.zooming) {
|
|
217
|
+
let d = u;
|
|
218
|
+
if (u = u / this.__lastScale * n, u = Math.max(Math.min(u, this.options.maxZoom), this.options.minZoom), d !== u) {
|
|
219
|
+
let w = o - this.__clientLeft, b = r - this.__clientTop;
|
|
220
|
+
c = (w + c) * u / d - w, h = (b + h) * u / d - b, this.__computeScrollMax(u);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (this.__enableScrollX) {
|
|
224
|
+
c -= l * this.options.speedMultiplier;
|
|
225
|
+
let d = this.__maxScrollLeft;
|
|
226
|
+
(c > d || c < 0) && (this.options.bouncing ? c += l / 2 * this.options.speedMultiplier : c = c > d ? d : 0);
|
|
227
|
+
}
|
|
228
|
+
if (this.__enableScrollY) {
|
|
229
|
+
h -= a * this.options.speedMultiplier;
|
|
230
|
+
const d = this.__maxScrollTop;
|
|
231
|
+
(h > d || h < 0) && (this.options.bouncing ? h += a / 2 * this.options.speedMultiplier : h = h > d ? d : 0);
|
|
232
|
+
}
|
|
233
|
+
s.length > 60 && s.splice(0, 30), s.push(c, h, t), this.__publish(c, h, u);
|
|
234
|
+
} else {
|
|
235
|
+
let l = this.options.locking ? 3 : 0, a = 5, c = Math.abs(o - this.__initialTouchLeft), h = Math.abs(r - this.__initialTouchTop);
|
|
236
|
+
this.__enableScrollX = this.options.scrollingX && c >= l, this.__enableScrollY = this.options.scrollingY && h >= l, s.push(this.__scrollLeft, this.__scrollTop, t), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (c >= a || h >= a), this.__isDragging && (this.__interruptedAnimation = !1);
|
|
237
|
+
}
|
|
238
|
+
this.__lastTouchLeft = o, this.__lastTouchTop = r, this.__lastTouchMove = t, this.__lastScale = n;
|
|
239
|
+
}
|
|
240
|
+
doTouchEnd(e) {
|
|
241
|
+
if (e instanceof Date && (e = e.valueOf()), typeof e != "number") throw new Error("Invalid timestamp value: " + e);
|
|
242
|
+
if (this.__isTracking) {
|
|
243
|
+
if (this.__isTracking = !1, this.__isDragging) if (this.__isDragging = !1, this.__isSingleTouch && this.options.animating && e - this.__lastTouchMove <= 100) {
|
|
244
|
+
let t = this.__positions, n = t.length - 1, o = n;
|
|
245
|
+
for (let r = n; r > 0 && t[r] > this.__lastTouchMove - 100; r -= 3) o = r;
|
|
246
|
+
if (o !== n) {
|
|
247
|
+
const r = t[n] - t[o], s = this.__scrollLeft - t[o - 2], l = this.__scrollTop - t[o - 1];
|
|
248
|
+
this.__decelerationVelocityX = s / r * (1e3 / 60), this.__decelerationVelocityY = l / r * (1e3 / 60);
|
|
249
|
+
const a = this.options.paging || this.options.snapping ? 4 : 1;
|
|
250
|
+
(Math.abs(this.__decelerationVelocityX) > a || Math.abs(this.__decelerationVelocityY) > a) && this.__startDeceleration(e);
|
|
251
|
+
} else this.options.scrollingComplete?.();
|
|
252
|
+
} else e - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
|
|
253
|
+
this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0, this.__zoomLevel)), this.__positions.length = 0;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
__publish(e, t, n, o = !1) {
|
|
257
|
+
const r = this.__isAnimating;
|
|
258
|
+
if (r && (Ee(r), this.__isAnimating = 0), o && this.options.animating) {
|
|
259
|
+
this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n;
|
|
260
|
+
const s = this.__scrollLeft, l = this.__scrollTop, a = this.__zoomLevel, c = e - s, h = t - l, u = n - a, d = function(x, S, P) {
|
|
261
|
+
P && (this.__scrollLeft = s + c * x, this.__scrollTop = l + h * x, this.__zoomLevel = a + u * x, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
|
|
262
|
+
}.bind(this), w = function(x) {
|
|
263
|
+
return this.__isAnimating === x;
|
|
264
|
+
}.bind(this), b = function(x, S, P) {
|
|
265
|
+
S === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || P) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
266
|
+
}.bind(this);
|
|
267
|
+
this.__isAnimating = _t(d, w, b, this.options.animationDuration, r ? pn : _n);
|
|
268
|
+
} else this.__scheduledLeft = this.__scrollLeft = e, this.__scheduledTop = this.__scrollTop = t, this.__scheduledZoom = this.__zoomLevel = n, this.__callback && this.__callback(e, t, n), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
269
|
+
}
|
|
270
|
+
__computeScrollMax(e = this.__zoomLevel) {
|
|
271
|
+
this.__maxScrollLeft = Math.max(this.__contentWidth * e - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * e - this.__clientHeight, 0);
|
|
272
|
+
}
|
|
273
|
+
__startDeceleration(e) {
|
|
274
|
+
if (this.options.paging) {
|
|
275
|
+
const s = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), l = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), a = this.__clientWidth, c = this.__clientHeight;
|
|
276
|
+
this.__minDecelerationScrollLeft = Math.floor(s / a) * a, this.__minDecelerationScrollTop = Math.floor(l / c) * c, this.__maxDecelerationScrollLeft = Math.ceil(s / a) * a, this.__maxDecelerationScrollTop = Math.ceil(l / c) * c;
|
|
277
|
+
} else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
|
|
278
|
+
const t = function(s, l, a) {
|
|
279
|
+
this.__stepThroughDeceleration(a);
|
|
280
|
+
}.bind(this), n = this.options.snapping ? 4 : 0.1, o = function() {
|
|
281
|
+
const s = Math.abs(this.__decelerationVelocityX) >= n || Math.abs(this.__decelerationVelocityY) >= n;
|
|
282
|
+
return s || (this.__didDecelerationComplete = !0), s;
|
|
283
|
+
}.bind(this), r = function(s, l, a) {
|
|
284
|
+
this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
|
|
285
|
+
}.bind(this);
|
|
286
|
+
this.__isDecelerating = _t(t, o, r);
|
|
287
|
+
}
|
|
288
|
+
__stepThroughDeceleration(e) {
|
|
289
|
+
let t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY;
|
|
290
|
+
if (!this.options.bouncing) {
|
|
291
|
+
const o = Math.max(Math.min(this.__maxDecelerationScrollLeft, t), this.__minDecelerationScrollLeft);
|
|
292
|
+
o !== t && (t = o, this.__decelerationVelocityX = 0);
|
|
293
|
+
const r = Math.max(Math.min(this.__maxDecelerationScrollTop, n), this.__minDecelerationScrollTop);
|
|
294
|
+
r !== n && (n = r, this.__decelerationVelocityY = 0);
|
|
295
|
+
}
|
|
296
|
+
if (e ? this.__publish(t, n, this.__zoomLevel) : (this.__scrollLeft = t, this.__scrollTop = n), !this.options.paging && (this.__decelerationVelocityX *= 0.95, this.__decelerationVelocityY *= 0.95), this.options.bouncing) {
|
|
297
|
+
let o = 0, r = 0, s = this.options.penetrationDeceleration, l = this.options.penetrationAcceleration;
|
|
298
|
+
t < this.__minDecelerationScrollLeft ? o = this.__minDecelerationScrollLeft - t : t > this.__maxDecelerationScrollLeft && (o = this.__maxDecelerationScrollLeft - t), n < this.__minDecelerationScrollTop ? r = this.__minDecelerationScrollTop - n : n > this.__maxDecelerationScrollTop && (r = this.__maxDecelerationScrollTop - n), o !== 0 && (o * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += o * s : this.__decelerationVelocityX = o * l), r !== 0 && (r * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += r * s : this.__decelerationVelocityY = r * l);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
var J = typeof window < "u" ? window : { screen: {}, navigator: {} }, we = (J.matchMedia || function() {
|
|
303
|
+
return { matches: !1 };
|
|
304
|
+
}).bind(J), Et = !1, fn = { get passive() {
|
|
305
|
+
return Et = !0;
|
|
306
|
+
} }, mt = function() {
|
|
307
|
+
};
|
|
308
|
+
J.addEventListener && J.addEventListener("p", mt, fn), J.removeEventListener && J.removeEventListener("p", mt, !1);
|
|
309
|
+
var gn = Et, yn = "PointerEvent" in J, tt = "ontouchstart" in J, Tt = tt || "TouchEvent" in J && we("(any-pointer: coarse)").matches, ft = (J.navigator.maxTouchPoints || 0) > 0 || Tt, Mt = J.navigator.userAgent || "", vn = we("(pointer: coarse)").matches && /iPad|Macintosh/.test(Mt) && Math.min(J.screen.width || 0, J.screen.height || 0) >= 768, Dt = (we("(pointer: coarse)").matches || !we("(pointer: fine)").matches && tt) && !/Windows.*Firefox/.test(Mt), xn = we("(any-pointer: fine)").matches || we("(any-hover: hover)").matches || vn || !tt, Ze = !ft || !xn && Dt ? ft ? "touchOnly" : "mouseOnly" : "hybrid", bn = Ze === "mouseOnly" ? "mouse" : Ze === "touchOnly" || Dt ? "touch" : "mouse";
|
|
310
|
+
const wn = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Ze, primaryInput: bn, supportsPassiveEvents: gn, supportsPointerEvents: yn, supportsTouchEvents: Tt }, Symbol.toStringTag, { value: "Module" })), Sn = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), Pt = {};
|
|
311
|
+
function Ge() {
|
|
312
|
+
return wn;
|
|
313
|
+
}
|
|
314
|
+
const zt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i), io = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: Pt, boundPixel: function(i, e = !1, t = 0) {
|
|
315
|
+
return i;
|
|
316
|
+
}, createSyntheticEvent: (i) => {
|
|
317
|
+
let e = !1, t = !1;
|
|
318
|
+
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: () => {
|
|
319
|
+
e = !0, i.preventDefault();
|
|
320
|
+
}, isDefaultPrevented: () => e, stopPropagation: () => {
|
|
321
|
+
t = !0, i.stopPropagation();
|
|
322
|
+
}, isPropagationStopped: () => t, persist: () => {
|
|
323
|
+
}, timeStamp: i.timeStamp, type: i.type };
|
|
324
|
+
}, detectIt: Ge, focusableNodeNames: Sn, toPrettyKeyCode: zt }, Symbol.toStringTag, { value: "Module" })), Ln = [];
|
|
325
|
+
function kt(i, e, t = Ln) {
|
|
326
|
+
const n = A(null);
|
|
327
|
+
return en(i, () => {
|
|
328
|
+
if (!n.current) return;
|
|
329
|
+
const o = n.current, r = e?.();
|
|
330
|
+
if (!r || typeof r != "object") throw new Error("attributes must return a plain object of values");
|
|
331
|
+
const s = Object.keys(r), l = s.length;
|
|
332
|
+
for (let a = 0; a < l; a++) {
|
|
333
|
+
const c = s[a], h = r[c];
|
|
334
|
+
Object.defineProperty(o, c, { value: h, writable: !0, configurable: !0, enumerable: !0 });
|
|
335
|
+
}
|
|
336
|
+
return o;
|
|
337
|
+
}, t), n;
|
|
338
|
+
}
|
|
339
|
+
const gt = (i) => L(et, { ...i }), Cn = ({ width: i, height: e }) => L("div", { className: "corner", style: { minWidth: `${i}px`, width: `${i}px`, minHeight: `${e}px`, height: `${e}px` } }), En = Se(Le((i, e) => {
|
|
340
|
+
const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar: s = !0, createScrollCorner: l = Cn, createHorizontalScrollbar: a = gt, createVerticalScrollbar: c = gt, style: h, touchElement: u, disableTouch: d, ...w } = i, b = T(o, [o]), x = kt(e, () => ({ isScrollPane: () => !0 }), []), S = A(null);
|
|
341
|
+
V(() => {
|
|
342
|
+
S.current && (S.current.__scrollTop === n?.top && S.current.__scrollLeft === n?.left || S.current.__isDecelerating || S.current?.scrollTo(n?.left, n?.top, !1));
|
|
343
|
+
}, [n?.left, n?.top, u]);
|
|
344
|
+
const P = R((p, C) => {
|
|
345
|
+
b?.({ left: p, top: C });
|
|
346
|
+
}, []), _ = R((p) => {
|
|
347
|
+
S.current?.doTouchStart(p.touches, p.timeStamp);
|
|
348
|
+
}, []), y = R((p) => {
|
|
349
|
+
p.preventDefault(), S.current?.doTouchMove(p.touches, p.timeStamp);
|
|
350
|
+
}, []), f = R((p) => {
|
|
351
|
+
S.current?.doTouchEnd(p.timeStamp);
|
|
352
|
+
}, []), k = R(({ containerWidth: p, containerHeight: C, totalWidth: m, totalHeight: E }) => {
|
|
353
|
+
S.current.setDimensions(p, C, m, E);
|
|
354
|
+
}, []);
|
|
355
|
+
V(() => {
|
|
356
|
+
const p = u ?? x.current;
|
|
357
|
+
if (!d && Ge().supportsTouchEvents && p && n) {
|
|
358
|
+
if (!S.current) {
|
|
359
|
+
const C = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
|
|
360
|
+
S.current = new mn(P, C);
|
|
361
|
+
}
|
|
362
|
+
Ge().supportsTouchEvents && (p.addEventListener("touchstart", _), p.addEventListener("touchend", f), p.addEventListener("touchmove", y)), k({ containerWidth: n?.width, containerHeight: n?.height, totalWidth: n?.totalWidth, totalHeight: n?.totalHeight });
|
|
363
|
+
}
|
|
364
|
+
return () => {
|
|
365
|
+
p?.removeEventListener("touchstart", _), p?.removeEventListener("touchend", f), p?.removeEventListener("touchmove", y);
|
|
366
|
+
};
|
|
367
|
+
}, [n?.width, n?.height, n?.totalWidth, n?.totalHeight, d, u]);
|
|
368
|
+
const [z, { width: O }] = fe(), [F, { height: g }] = fe(), v = N(() => {
|
|
369
|
+
const p = c({ orientation: re.Vertical, offset: n?.top, viewportSize: n?.height, totalSize: n?.totalHeight, onScrollOffset: (C) => {
|
|
370
|
+
b?.({ top: C });
|
|
371
|
+
} });
|
|
372
|
+
return L("div", { style: { display: "flex", flex: "0" }, ref: z, children: p });
|
|
373
|
+
}, [c, n?.top, n?.height, n?.totalHeight]), B = N(() => {
|
|
374
|
+
const p = a({ orientation: re.Horizontal, offset: n?.left, viewportSize: n?.width, totalSize: n?.totalWidth, onScrollOffset: (C) => b?.({ left: C }) });
|
|
375
|
+
return be("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${O}px)` }, children: L("div", { ref: F, className: "sizer", children: p }) }), s ? l({ width: O, height: g }) : L(Me, {})] });
|
|
376
|
+
}, [a, n?.left, n?.width, n?.totalWidth, s, l, O, g]);
|
|
377
|
+
return L("div", { style: { position: "relative", display: "flex", minWidth: s ? `${O}px` : void 0, minHeight: r ? `${g}px` : void 0, ...h }, ...w, ref: x, children: be("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [be("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: t }), s ? v : L(Me, {})] }), r ? B : L(Me, {})] }) });
|
|
378
|
+
}));
|
|
379
|
+
En.displayName = "ScrollPane";
|
|
380
|
+
const yt = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" }, vt = /* @__PURE__ */ new Set(), At = { showMessage: (i, e) => {
|
|
381
|
+
if (e?.onceKey) {
|
|
382
|
+
if (vt.has(e.onceKey)) return;
|
|
383
|
+
vt.add(e.onceKey);
|
|
384
|
+
}
|
|
385
|
+
let t = console.log;
|
|
386
|
+
e?.type !== yt.Warning && e?.type !== yt.Error || (t = console.warn), t(i);
|
|
387
|
+
}, showBusy: (i, e) => new Promise((t) => {
|
|
388
|
+
t(() => {
|
|
389
|
+
});
|
|
390
|
+
}), showError: (i) => {
|
|
391
|
+
console.error(i);
|
|
392
|
+
} }, Tn = () => {
|
|
393
|
+
const i = document.fullscreenElement;
|
|
394
|
+
return i ? i.querySelector(".fullscreen-portal-root") || i : document.body;
|
|
395
|
+
};
|
|
396
|
+
let ke = 0;
|
|
397
|
+
function ro() {
|
|
398
|
+
return V(() => {
|
|
399
|
+
function i() {
|
|
400
|
+
const e = document.fullscreenElement;
|
|
401
|
+
if (!e) return;
|
|
402
|
+
let t = e.querySelector(".fullscreen-portal-root");
|
|
403
|
+
t || (t = document.createElement("div"), t.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", e.appendChild(t));
|
|
404
|
+
}
|
|
405
|
+
return ke++, i(), document.addEventListener("fullscreenchange", i), () => {
|
|
406
|
+
document.removeEventListener("fullscreenchange", i), ke--, ke <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e) => {
|
|
407
|
+
e.parentNode && e.parentNode.removeChild(e);
|
|
408
|
+
}), ke = 0);
|
|
409
|
+
};
|
|
410
|
+
}, []), { getPortalContainer: Tn };
|
|
411
|
+
}
|
|
412
|
+
const Mn = 100, Dn = 100, Pn = 1e6, zn = 100, kn = 50, An = Se(Le((i, e) => {
|
|
413
|
+
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s = Mn, endScrollIncrement: l = Dn, style: a = Pt, onMouseDown: c, onScrollOffset: h, onScroll: u, scaleLimit: d = Pn, scaleFactor: w = zn, precisionFactor: b = kn, ...x } = i;
|
|
414
|
+
u && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
415
|
+
const S = T(c, [c]), P = () => ({ offset: t, totalSize: d === 0 ? o : Math.min(o ?? 0, Math.max(r ?? 0, (t ?? 0) + (n ?? 0)) + (s ?? 0)) }), [_, y] = Q(P), f = d !== 0 && _.totalSize > d ? w : 1, k = f / b, z = Math.ceil(_.totalSize / f), O = Math.ceil(_.offset / f), F = Math.ceil(n / f), g = R((D) => {
|
|
416
|
+
}, []), [v, B] = Q(!1), p = A(null);
|
|
417
|
+
Ve(() => {
|
|
418
|
+
if (!v) {
|
|
419
|
+
p.current = { propTotalSize: o, propViewportSize: n, propOffset: t };
|
|
420
|
+
const D = P();
|
|
421
|
+
y(D);
|
|
422
|
+
}
|
|
423
|
+
}, [o, n, t, v, r, s, l]);
|
|
424
|
+
const C = T((D, G, W) => {
|
|
425
|
+
const Y = p.current;
|
|
426
|
+
p.current = null, Y && Y.propTotalSize === o && Y.propViewportSize === n && Y.propOffset === t || (Math.abs(D - O) < k && (D = O), h?.(D * f, O, F));
|
|
427
|
+
}, [h, f, k, O, F]), m = R((D) => {
|
|
428
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", m), B(!1);
|
|
429
|
+
}, []), E = R((D) => {
|
|
430
|
+
S?.(D), B(!0), document.addEventListener("mousemove", g, { passive: !0 }), document.addEventListener("mouseup", m, { passive: !0 });
|
|
431
|
+
}, [g, m]);
|
|
432
|
+
return L(et, { ref: e, style: { ...a }, ...x, offset: O, totalSize: z, viewportSize: F, onMouseDown: E, onScrollOffset: C });
|
|
433
|
+
}));
|
|
434
|
+
An.displayName = "VirtualScrollbar";
|
|
435
|
+
const so = { 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" };
|
|
436
|
+
function We(i, e) {
|
|
437
|
+
if (typeof i == "function") return i(e);
|
|
438
|
+
i && (i.current = e);
|
|
439
|
+
}
|
|
440
|
+
var He = parseInt(tn.split(".")[0], 10) >= 19 ? function(i) {
|
|
441
|
+
return (e) => {
|
|
442
|
+
const t = [];
|
|
443
|
+
for (const n of i) {
|
|
444
|
+
const o = We(n, e), r = typeof o == "function";
|
|
445
|
+
t.push(r ? o : () => We(n, null));
|
|
446
|
+
}
|
|
447
|
+
return () => {
|
|
448
|
+
for (const n of t) n();
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
} : function(i) {
|
|
452
|
+
return (e) => {
|
|
453
|
+
for (const t of i) We(t, e);
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
const lo = Se(Le((i, e) => {
|
|
457
|
+
const { refFocusStart: t, ...n } = i, o = A(null), r = R(() => {
|
|
458
|
+
if (t) return void t?.current?.focus();
|
|
459
|
+
const s = o.current.parentElement.children;
|
|
460
|
+
let l = [];
|
|
461
|
+
for (let a = 0; a < s.length && s[a] !== o.current; a++) {
|
|
462
|
+
const c = s[a].getAttribute("tabindex");
|
|
463
|
+
if (c == null || c === "-1" || s[a].getAttribute("disabled") === "true") continue;
|
|
464
|
+
const h = s[a];
|
|
465
|
+
h.focus && l.push({ tabindex: parseInt(c), child: h });
|
|
466
|
+
}
|
|
467
|
+
l.length !== 0 && (l.sort(function(a, c) {
|
|
468
|
+
return a.tabindex - c.tabindex;
|
|
469
|
+
}), l[0].child.focus());
|
|
470
|
+
}, [t]);
|
|
471
|
+
return L("div", { tabIndex: 0, ref: He([o, e]), onFocus: r, ...n });
|
|
472
|
+
})), ao = Se(Le((i, e) => {
|
|
473
|
+
const { className: t, style: n, children: o, radius: r = 4, strokeWidth: s = 1, strokeColor: l = "grey", ...a } = i, [c, { width: h, height: u }] = fe(), d = A(null), w = (P, _ = 0) => {
|
|
474
|
+
const y = P / 2, f = u - y + _;
|
|
475
|
+
return function(k, z, O = !1) {
|
|
476
|
+
if (z === 0) return k;
|
|
477
|
+
function F(m, E, D) {
|
|
478
|
+
let G = E.x - m.x, W = E.y - m.y, Y = Math.sqrt(G * G + W * W);
|
|
479
|
+
return g(m, E, Math.min(1, D / Y));
|
|
480
|
+
}
|
|
481
|
+
function g(m, E, D) {
|
|
482
|
+
return { x: m.x + (E.x - m.x) * D, y: m.y + (E.y - m.y) * D };
|
|
483
|
+
}
|
|
484
|
+
function v(m, E) {
|
|
485
|
+
m.length > 2 && (m[m.length - 2] = E.x, m[m.length - 1] = E.y);
|
|
486
|
+
}
|
|
487
|
+
function B(m) {
|
|
488
|
+
return { x: parseFloat(m[m.length - 2]), y: parseFloat(m[m.length - 1]) };
|
|
489
|
+
}
|
|
490
|
+
let p = k.split(/[,\s]/).reduce(function(m, E) {
|
|
491
|
+
let D = E.match("([a-zA-Z])(.+)");
|
|
492
|
+
return D ? (m.push(D[1]), m.push(D[2])) : m.push(E), m;
|
|
493
|
+
}, []).reduce(function(m, E) {
|
|
494
|
+
return parseFloat(E) == E && m.length ? m[m.length - 1].push(E) : m.push([E]), m;
|
|
495
|
+
}, []), C = [];
|
|
496
|
+
if (p.length > 1) {
|
|
497
|
+
let m = B(p[0]), E = null;
|
|
498
|
+
p[p.length - 1][0] === "Z" && p[0].length > 2 && (E = ["L", m.x, m.y], p[p.length - 1] = E), C.push(p[0]);
|
|
499
|
+
for (let D = 1; D < p.length; D++) {
|
|
500
|
+
let G = C[C.length - 1], W = p[D], Y = W === E ? p[1] : p[D + 1];
|
|
501
|
+
if (Y && G && G.length > 2 && W[0] === "L" && Y.length > 2 && Y[0] === "L") {
|
|
502
|
+
let X, $, I = B(G), j = B(W), ne = B(Y);
|
|
503
|
+
O ? (X = g(j, G.origPoint || I, z), $ = g(j, Y.origPoint || ne, z)) : (X = F(j, I, z), $ = F(j, ne, z)), v(W, X), W.origPoint = j, C.push(W);
|
|
504
|
+
let ge = g(X, j, 0.5), ye = g(j, $, 0.5), K = ["C", ge.x, ge.y, ye.x, ye.y, $.x, $.y];
|
|
505
|
+
K.origPoint = j, C.push(K);
|
|
506
|
+
} else C.push(W);
|
|
507
|
+
}
|
|
508
|
+
if (E) {
|
|
509
|
+
let D = B(C[C.length - 1]);
|
|
510
|
+
C.push(["Z"]), v(C[0], D);
|
|
511
|
+
}
|
|
512
|
+
} else C = p;
|
|
513
|
+
return C.reduce(function(m, E) {
|
|
514
|
+
return m + E.join(" ") + " ";
|
|
515
|
+
}, "");
|
|
516
|
+
}(`${`M 0 ${y} L ${r - 0.5} ${y} L ${r - 0.5} ${f} L ${2 * r} ${f}`} ${`L ${h - 2 * r} ${f}`} ${`M ${h - 2 * r} ${f} L ${h - r} ${f} L ${h - r} ${y} L ${h} ${y}`}`, r);
|
|
517
|
+
}, b = N(() => w(s), [h, u, r, s]), x = N(() => {
|
|
518
|
+
if (r === 0) return;
|
|
519
|
+
const P = r / 2;
|
|
520
|
+
return w(r) + `L ${h} 0 L 0 0 L 0 ${P}`;
|
|
521
|
+
}, [b, r, s]), S = N(() => ({ style: { clipPath: `path('${x}')` } }), [x]);
|
|
522
|
+
return be("div", { className: t, style: { display: "flex", flexDirection: "row", ...n }, ...a, ref: He([d, c, e]), children: [me.isValidElement(o) ? me.cloneElement(o, S) : L(Me, {}), L("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: h, height: u, viewBox: `0 0 ${h} ${u}`, children: L("path", { d: b, stroke: l, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: s }) })] });
|
|
523
|
+
})), Bn = {}, $n = (i) => {
|
|
524
|
+
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a = Bn, ...c } = i, h = n === "row", { style: u, className: d, ...w } = a;
|
|
525
|
+
return L("div", { style: { ...t, position: "relative" }, ...c, children: L("div", { className: ve("hit-box", d), style: { left: (h ? -o : 0) + "px", width: `calc(100% + ${h ? o + r : 0}px)`, top: (h ? 0 : -o) + "px", height: `calc(100% + ${h ? 0 : o + r}px)`, position: "absolute", ...u }, onPointerDown: s ? void 0 : e, ...w }) }, l);
|
|
526
|
+
}, Ae = {}, _e = (i, e, t = !0) => i === null ? null : i.pixels !== null ? t ? i.pixels : e - i.pixels : (t ? i.percent : 100 - i.percent) / 100 * e, Be = (i, e = !0) => i?.percent ? `${e ? i.percent : 100 - i.percent}%` : i?.pixels ? `${i.pixels}px` : void 0, ue = (i, e) => {
|
|
527
|
+
if (i == null) return null;
|
|
528
|
+
const t = { percent: null, pixels: null };
|
|
529
|
+
let n = e;
|
|
530
|
+
return typeof i == "string" && ((i = i.trim().toLowerCase()).endsWith("px") ? (i = i.substring(0, i.length - 2), n = !1) : i.endsWith("%") && (i = i.substring(0, i.length - 1), n = !0), i = parseFloat(i)), n ? t.percent = i : t.pixels = i, Object.freeze(t);
|
|
531
|
+
}, co = Se(Le((i, e) => {
|
|
532
|
+
const { elementBefore: t, elementAfter: n, splitDirection: o = "row", fixedPane: r = null, position: s, onPositionChange: l, minBefore: a, maxBefore: c, minAfter: h, maxAfter: u, children: d, className: w, style: b, disabled: x = !1, onDragStart: S, onDragResize: P, onDragFinish: _, resizerProps: y = Ae, paneProps: f = Ae, paneBeforeProps: k = Ae, paneAfterProps: z = Ae, createResizer: O = $n } = i;
|
|
533
|
+
if (d) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
534
|
+
const F = N(() => me.isValidElement(n) && me.isValidElement(t), [n, t]), g = N(() => {
|
|
535
|
+
let M = null;
|
|
536
|
+
r && (r === "before" ? M = 0 : r === "after" && (M = 1));
|
|
537
|
+
const H = M === null;
|
|
538
|
+
return { fixedPaneOffset: M, isPercent: H, minBefore: ue(a, H), maxBefore: ue(c, H), minAfter: ue(h, H), maxAfter: ue(u, H) };
|
|
539
|
+
}, [a, c, h, u]), v = T(l, [l]), [B, p] = Q(() => ue(s, r === null));
|
|
540
|
+
V(() => {
|
|
541
|
+
p(ue(s, r === null));
|
|
542
|
+
}, [s, r]);
|
|
543
|
+
const [C, { width: m, height: E }] = fe(), [D, { width: G, height: W }] = fe(), Y = o === "row" ? G : W, X = o === "row" ? m : E, $ = N(() => ((M, H, q, U) => {
|
|
544
|
+
const ae = [null, null], oe = [null, null];
|
|
545
|
+
if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), H === 0) return M?.pixels != null ? U.fixedPaneOffset !== 1 ? (ae[0] = M?.pixels, oe[1] = 100) : (ae[1] = M?.pixels - q, oe[0] = 100) : M?.percent != null && (U.fixedPaneOffset !== 1 ? (oe[0] = M?.percent, oe[1] = 100 - M?.percent) : (oe[1] = M?.percent, oe[0] = 100 - M?.percent)), { percents: oe, pixels: ae, minBefore: Be(U.minBefore, !0), maxBefore: Be(U.maxBefore, !0), minAfter: Be(U.minAfter), maxAfter: Be(U.maxAfter) };
|
|
546
|
+
let he = _e(M, H, U.fixedPaneOffset !== 1), ee = H - q, at = _e(U.minBefore, ee, !0) ?? 0, Jt = _e(U.maxBefore, ee, !0) ?? ee, ze = 0, Fe = 0, ct = 0, ht = ee;
|
|
547
|
+
ze = (_e(U.maxAfter, H, !1) ?? q) - q, Fe = _e(U.minAfter, H, !1) ?? H, ct = Math.max(at, ze), ht = Math.min(Jt, Fe), he = Math.max(ct, Math.min(he, ht)), Fe = Math.min(ee - he, _e(U.maxAfter, ee - he, !0) ?? ee), ze = Math.min(ee - he, _e(U.minAfter, ee - he, !0) ?? ee), ae[0] = he, ae[1] = ee - ae[0];
|
|
548
|
+
const Qt = Math.max(0, Math.min(100, he / ee * 100));
|
|
549
|
+
return oe[0] = Qt, oe[1] = 100 - oe[0], { percents: oe, pixels: ae, minBefore: `${at}px`, minAfter: `${ze}px`, maxBefore: `${ae[0]}px`, maxAfter: `${ae[1]}px` };
|
|
550
|
+
})(B, X, Y, g), [g, B, X, Y, o]), [I, j] = Q(!1), ne = T(S, [S]), ge = T(P, [P]), ye = T(_, [_]), K = A(null), se = A(null), ie = A(null), { style: pe, className: le, ...ce } = f, Ce = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pe }, { className: Ht, style: Rt, ...Vt } = k, { className: Ft, style: It, ...Nt } = z, Wt = { flex: "1 1 100%", width: "100%", ...b, flexDirection: o, display: "flex" }, { className: nt, style: ot, onPointerDown: it, ...rt } = y, Yt = T((M) => {
|
|
551
|
+
const H = ue(M, r === null);
|
|
552
|
+
p(H);
|
|
553
|
+
}, [r]), De = T((M) => {
|
|
554
|
+
if (x || !I) return;
|
|
555
|
+
const H = lt.current?.getBoundingClientRect();
|
|
556
|
+
let q = 0;
|
|
557
|
+
q = o === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) - H.x : (M.clientY ?? M.touches?.[0]?.clientY) - H.y, q = Math.max(0, Math.min(X, q)), g.fixedPaneOffset === 1 && (q = X - q), s && B.pixels === q || p({ pixels: q, percent: null }), ge?.(q), M.stopPropagation(), M.preventDefault();
|
|
558
|
+
}, [g, o, x, I, B, X]), st = T((M) => {
|
|
559
|
+
if (document.removeEventListener("pointermove", De), document.removeEventListener("touchmove", De), document.removeEventListener("pointerup", st), !!I && (j(!1), !!B)) {
|
|
560
|
+
if (ye(B.pixels), !ue(s, r === null) || B.pixels !== s) {
|
|
561
|
+
const H = { ...B };
|
|
562
|
+
H.percent === null && (H.percent = H.pixels / X * 100), v(H);
|
|
563
|
+
}
|
|
564
|
+
M.stopPropagation(), M.preventDefault();
|
|
565
|
+
}
|
|
566
|
+
}, [B, I, s, r, X]), Xt = T((M) => {
|
|
567
|
+
it?.(M), M.defaultPrevented || x || I || (j(!0), ne(), document.addEventListener("pointermove", De, { passive: !1 }), document.addEventListener("touchmove", De, { passive: !1 }), document.addEventListener("pointerup", st, { passive: !1 }));
|
|
568
|
+
}, [it]), lt = kt(e, () => ({ setPosition: Yt, isSplitPane: () => !0 }), []), jt = N(() => F ? O?.({ key: "resizer", ref: He([D, se]), className: ve("resizer", nt), onPointerDownCapture: Xt, style: { cursor: x ? void 0 : o === "row" ? "ew-resize" : "ns-resize", minWidth: o === "row" ? "2px" : void 0, minHeight: o !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...ot }, splitDirection: o, disabled: x, ...rt }) : null, [F, nt, rt, o, ot, x]), Pe = o === "row" ? "Width" : "Height", Ut = { ...Ce, ...Rt, flex: g.fixedPaneOffset === 0 && $?.pixels[0] !== null ? `0 0 ${Math.round($?.pixels[0])}px` : `1 1 ${Math.round($?.percents[0] ?? 100)}%`, [`min${Pe}`]: $?.minBefore, [`max${Pe}`]: n ? $?.maxBefore : "100%" }, Zt = { ...Ce, ...It, flex: g.fixedPaneOffset === 1 && $?.pixels[1] !== null ? `0 0 ${Math.round($?.pixels[1])}px` : `1 1 ${Math.round($?.percents[1] ?? 100)}%`, [`min${Pe}`]: $?.minAfter, [`max${Pe}`]: t ? $?.maxAfter : "100%" }, Gt = N(() => t ? L("div", { ref: K, className: ve("before", le, Ht), style: Ut, ...ce, ...Vt, children: t }, "before") : null, [t, f, k, g, $]), qt = N(() => n ? L("div", { ref: ie, className: ve("after", le, Ft), style: Zt, ...ce, ...Nt, children: n }, "after") : null, [n, f, z, g, $]);
|
|
569
|
+
return be("div", { ref: He([C, lt]), className: ve("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: I }, w), style: Wt, children: [Gt, jt, qt] });
|
|
570
|
+
}));
|
|
571
|
+
function ho(i) {
|
|
572
|
+
const [e, t] = Q(typeof window < "u" ? window.devicePixelRatio : 1), n = A(null);
|
|
573
|
+
return V(() => {
|
|
574
|
+
if (!(typeof window < "u" && "matchMedia" in window)) return;
|
|
575
|
+
const o = () => {
|
|
576
|
+
const r = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);
|
|
577
|
+
r.addEventListener("change", o, { once: !0, passive: !0 }), t(window.devicePixelRatio), n.current = { mediaMatcher: r, listener: o };
|
|
578
|
+
};
|
|
579
|
+
return o(), () => {
|
|
580
|
+
n.current && n.current.mediaMatcher.removeEventListener("change", n.current.listener);
|
|
581
|
+
};
|
|
582
|
+
}, [i]), e;
|
|
583
|
+
}
|
|
584
|
+
function uo(i) {
|
|
585
|
+
if (typeof window > "u") return 1;
|
|
586
|
+
const { defaultDpr: e = 1, maxDpr: t = 3, round: n = !0 } = i || {}, o = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : e;
|
|
587
|
+
return Math.min(Math.max(1, n ? Math.floor(o) : o), t);
|
|
588
|
+
}
|
|
589
|
+
function po(i, e, t) {
|
|
590
|
+
const n = T(e, [e]);
|
|
591
|
+
V(() => {
|
|
592
|
+
const o = (r) => {
|
|
593
|
+
i.current && !i.current.contains(r.target) && n(r);
|
|
594
|
+
};
|
|
595
|
+
return t && t.mouseEvents === !1 || (document.addEventListener("mousedown", o), document.addEventListener("touchstart", o)), t && t.focusEvents === !1 || document.addEventListener("focus", o), () => {
|
|
596
|
+
document.removeEventListener("mousedown", o), document.removeEventListener("touchstart", o), document.removeEventListener("focus", o);
|
|
597
|
+
};
|
|
598
|
+
}, [i]);
|
|
599
|
+
}
|
|
600
|
+
function On(i) {
|
|
601
|
+
if (!i) throw new Error("must have a PointerHandlerOptions");
|
|
602
|
+
const { onPointerDown: e, onPointerUp: t, onPointerMoveOrWait: n, processTouch: o = !1, consumeTouch: r = !0 } = i, s = T(e, [e]), l = T(t, [t]), a = T(n, [n]), c = A(!1), h = i?.timerInitial ?? 230, u = i?.timerContinuous ?? h / 2, d = A(null), w = A(null), b = A(null), x = A(null), S = R(() => {
|
|
603
|
+
x.current && (clearTimeout(x.current), x.current = null);
|
|
604
|
+
}, []), P = R((v) => {
|
|
605
|
+
x.current = setTimeout(() => {
|
|
606
|
+
window.requestAnimationFrame(() => {
|
|
607
|
+
c.current !== !1 && a?.(w.current, b.current, d.current);
|
|
608
|
+
}), P(u);
|
|
609
|
+
}, v ?? h);
|
|
610
|
+
}, []);
|
|
611
|
+
V(() => () => S(), []);
|
|
612
|
+
const _ = o ? "pointer" : "mouse", y = R((v) => {
|
|
613
|
+
v.stopPropagation(), v.stopImmediatePropagation(), v.preventDefault();
|
|
614
|
+
}, []), f = T((v) => {
|
|
615
|
+
document.removeEventListener(`${_}move`, O), document.removeEventListener(`${_}up`, f), document.removeEventListener("keydown", F), document.removeEventListener("keyup", g), document.removeEventListener("touchstart", y, { capture: !0 }), document.removeEventListener("touchmove", y, { capture: !0 }), window.removeEventListener("blur", k), S(), window.requestAnimationFrame(() => {
|
|
616
|
+
c.current !== !1 && (c.current = !1, l?.(v, b.current, d.current), b.current = null);
|
|
617
|
+
});
|
|
618
|
+
}, []), k = R(() => {
|
|
619
|
+
c.current !== !1 && (c.current = !1, f(w.current));
|
|
620
|
+
}, []), z = T(() => {
|
|
621
|
+
S(), P(u), window.requestAnimationFrame(() => {
|
|
622
|
+
c.current !== !1 && a?.(w.current, b.current, d.current);
|
|
623
|
+
});
|
|
624
|
+
}, [u]), O = T((v) => {
|
|
625
|
+
w.current = v, z();
|
|
626
|
+
}, []), F = T((v) => {
|
|
627
|
+
b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z();
|
|
628
|
+
}, []), g = T((v) => {
|
|
629
|
+
b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z();
|
|
630
|
+
}, [u]);
|
|
631
|
+
return T((v) => {
|
|
632
|
+
v.isDefaultPrevented() || (b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, s(v, b.current) !== !1 && (d.current = v, w.current = v.nativeEvent, document.addEventListener(`${_}up`, f, { passive: !1 }), document.addEventListener(`${_}move`, O, { passive: !1 }), document.addEventListener("keydown", F, { passive: !1 }), document.addEventListener("keyup", g, { passive: !1 }), window.addEventListener("blur", k, { passive: !0 }), o && r && (document.addEventListener("touchstart", y, { passive: !1, capture: !0 }), document.addEventListener("touchmove", y, { passive: !1, capture: !0 })), c.current = !0, P(h)));
|
|
633
|
+
}, [h, o]);
|
|
634
|
+
}
|
|
635
|
+
function _o(i, e) {
|
|
636
|
+
return On({ onPointerDown: i, onPointerMoveOrWait: (t, n, o) => {
|
|
637
|
+
i?.(o);
|
|
638
|
+
}, ...e });
|
|
639
|
+
}
|
|
640
|
+
const Kn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
|
|
641
|
+
const n = A(i);
|
|
642
|
+
if (typeof e != "function") throw new Error("function expected as hook body parameter. got " + typeof e);
|
|
643
|
+
const o = e();
|
|
644
|
+
return Ve(() => {
|
|
645
|
+
n.current !== o && (n.current = o, t(o));
|
|
646
|
+
}, [t, o]), null;
|
|
647
|
+
}, qe = (i) => {
|
|
648
|
+
console && console.warn && console.warn(i);
|
|
649
|
+
}, Ye = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
|
|
650
|
+
let Hn = 1, Je = !1, Bt = !1;
|
|
651
|
+
const Oe = [], xe = [], Re = () => {
|
|
652
|
+
xe.forEach((i) => i());
|
|
653
|
+
}, Rn = ({ automaticContainerInternalUseOnly: i }) => {
|
|
654
|
+
const [e, t] = Q([]), n = A([]);
|
|
655
|
+
return n.current = e, i || Je !== !1 || (Bt = !0), V(() => {
|
|
656
|
+
let o = !0;
|
|
657
|
+
function r() {
|
|
658
|
+
if (o) return xe[0] !== r ? (i || Je !== !0 || qe("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([...Oe]);
|
|
659
|
+
}
|
|
660
|
+
return xe.push(r), Re(), () => {
|
|
661
|
+
o = !1, n.current?.length > 0 && qe("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), xe.splice(xe.indexOf(r), 1), Re();
|
|
662
|
+
};
|
|
663
|
+
}, [i]), L(Me, { children: e.map(({ hook: o, key: r }) => nn(Kn, { ...o, key: r })) });
|
|
664
|
+
}, Vn = (i) => {
|
|
665
|
+
const e = Hn++;
|
|
666
|
+
return Oe.push({ hook: i, key: e }), xe.length === 0 && Bt === !1 && (Je = !0, ((t) => {
|
|
667
|
+
if (Ye.document && Ye.document.createElement) {
|
|
668
|
+
const n = Ye.document.createElement("div");
|
|
669
|
+
rn(n).render(L(t, { automaticContainerInternalUseOnly: !0 }));
|
|
670
|
+
} else qe("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
|
|
671
|
+
})(Rn)), Re(), () => {
|
|
672
|
+
Oe.splice(Oe.findIndex((t) => t.key === e), 1), Re();
|
|
673
|
+
};
|
|
674
|
+
}, $t = (i, e, t = {}) => {
|
|
675
|
+
let n, o, r = !1, s = !1, l = [], { unmountIfNoConsumers: a = !1 } = t;
|
|
676
|
+
const c = (u) => {
|
|
677
|
+
o = u, sn(() => l.forEach((d) => d(u)));
|
|
678
|
+
}, h = () => (s || (o = typeof i == "function" ? i() : i, s = !0), o);
|
|
679
|
+
return () => {
|
|
680
|
+
const [u, d] = Q(h);
|
|
681
|
+
return V(() => (r || (r = !0, n = Vn({ initValue: i, useHookBody: e, applyStateChange: c })), l.push(d), o !== u && d(o), () => {
|
|
682
|
+
l.splice(l.indexOf(d), 1), l.length === 0 && a && (n(), r = !1);
|
|
683
|
+
}), []), u;
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
let Ot = () => {
|
|
687
|
+
console.warn("You must call useEditMode before setting its state.");
|
|
688
|
+
};
|
|
689
|
+
const Fn = $t(null, () => {
|
|
690
|
+
const [i, e] = Q(null);
|
|
691
|
+
return Ot = e, i;
|
|
692
|
+
}), mo = () => {
|
|
693
|
+
const i = Fn();
|
|
694
|
+
return N(() => ({ setMode: (e) => {
|
|
695
|
+
Ot((t) => (typeof e == "function" && (e = e(t)), e?.onModeChange?.(e ?? null), e));
|
|
696
|
+
}, getMode: () => i }), [i]);
|
|
697
|
+
};
|
|
698
|
+
class Qe {
|
|
699
|
+
constructor(e, t, n, o) {
|
|
700
|
+
this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = e, this._target = t, this._applyProps(n || {}), this._callback = o, o === void 0 && (this._callback = () => {
|
|
701
|
+
console.log(`implement: ${this.label()} : ${this.description()}`);
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
key() {
|
|
705
|
+
return this._key;
|
|
706
|
+
}
|
|
707
|
+
_resolve(e, t) {
|
|
708
|
+
if (typeof e == "function") {
|
|
709
|
+
const n = t ?? this._context;
|
|
710
|
+
return e(typeof n == "function" ? n() : n);
|
|
711
|
+
}
|
|
712
|
+
return e;
|
|
713
|
+
}
|
|
714
|
+
target() {
|
|
715
|
+
return typeof this._target == "function" ? this._target() : this._target;
|
|
716
|
+
}
|
|
717
|
+
label(e, t) {
|
|
718
|
+
const n = this._scopedLabels?.[e] || this._label;
|
|
719
|
+
let o = null;
|
|
720
|
+
if (typeof n == "function") {
|
|
721
|
+
const r = t ?? this._context;
|
|
722
|
+
o = n(typeof r == "function" ? r() : r);
|
|
723
|
+
} else o = n;
|
|
724
|
+
return o;
|
|
725
|
+
}
|
|
726
|
+
description(e) {
|
|
727
|
+
return this._resolve(this._description, e);
|
|
728
|
+
}
|
|
729
|
+
tags(e) {
|
|
730
|
+
return this._resolve(this._tags, e);
|
|
731
|
+
}
|
|
732
|
+
icon(e) {
|
|
733
|
+
return this._resolve(this._icon, e);
|
|
734
|
+
}
|
|
735
|
+
shortcut() {
|
|
736
|
+
return this._resolve(this._shortcut);
|
|
737
|
+
}
|
|
738
|
+
disabled() {
|
|
739
|
+
return this._resolve(this._disabled) || !this._callback;
|
|
740
|
+
}
|
|
741
|
+
state() {
|
|
742
|
+
return this._resolve(this._state);
|
|
743
|
+
}
|
|
744
|
+
context() {
|
|
745
|
+
return typeof this._context == "function" ? this._context() : this._context;
|
|
746
|
+
}
|
|
747
|
+
async execute(e, t) {
|
|
748
|
+
if (!this.disabled() && this._callback) {
|
|
749
|
+
try {
|
|
750
|
+
let n = !0;
|
|
751
|
+
if (t?.beforeExecute && (n = t?.beforeExecute(this, e)), await Promise.resolve(n) === !1) return !1;
|
|
752
|
+
const o = this._callback.bind(this)(e, this);
|
|
753
|
+
if (await Promise.resolve(o) === !1) return !1;
|
|
754
|
+
t?.onExecute?.(this, e), this._notifyExecute(e);
|
|
755
|
+
} catch (n) {
|
|
756
|
+
return console.warn(n), t?.onError(this, n, e), this._notifyError(e, n), !1;
|
|
757
|
+
}
|
|
758
|
+
return !0;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
addPropertyListener(e, t = !1) {
|
|
762
|
+
if (!e) throw new Error("listener must be specified");
|
|
763
|
+
const n = this._listenersProperties;
|
|
764
|
+
return n.add(e), t && e({}, this), () => {
|
|
765
|
+
n.delete(e);
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
addExecuteListener(e) {
|
|
769
|
+
if (!e) throw new Error("listener must be specified");
|
|
770
|
+
const t = this._listenersExecute;
|
|
771
|
+
return t.add(e), function() {
|
|
772
|
+
t.delete(e);
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
_notifyExecute(e) {
|
|
776
|
+
const t = this;
|
|
777
|
+
this._listenersExecute.forEach((n) => {
|
|
778
|
+
n.onExecute(t, e);
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
_notifyError(e, t) {
|
|
782
|
+
const n = this;
|
|
783
|
+
this._listenersExecute.forEach((o) => {
|
|
784
|
+
o.onError?.(n, e, t);
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
updateCallback(e) {
|
|
788
|
+
return this._callback = e || null, this;
|
|
789
|
+
}
|
|
790
|
+
update(e) {
|
|
791
|
+
if (!e) return;
|
|
792
|
+
const t = this._applyProps(e);
|
|
793
|
+
return Object.keys(t).length > 0 && this._notifyPropertyChange(t), this;
|
|
794
|
+
}
|
|
795
|
+
_notifyPropertyChange(e) {
|
|
796
|
+
const t = this;
|
|
797
|
+
this._listenersProperties.forEach((n) => {
|
|
798
|
+
n(e, t);
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
_applyProps(e) {
|
|
802
|
+
let t = {}, n = this;
|
|
803
|
+
return Object.keys(e).forEach((o) => {
|
|
804
|
+
let r = e[o];
|
|
805
|
+
n["_" + o] !== r && (n["_" + o] = t[o] = r);
|
|
806
|
+
}), t;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
class Xe extends Qe {
|
|
810
|
+
}
|
|
811
|
+
class Kt {
|
|
812
|
+
constructor(e, t) {
|
|
813
|
+
this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = te.uuidV4(), this._target = e, this._groupKey = t ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(t, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
|
|
814
|
+
const n = this;
|
|
815
|
+
this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (o, r) => {
|
|
816
|
+
const s = n._root._listenersByKey, l = r.key(), a = s.get(l);
|
|
817
|
+
a && n._notifyCommands(a, "onCommandChange", r);
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
_getCommand(e) {
|
|
821
|
+
return this._commandsByKey.get(e) || (this._parent?._getCommand(e) ?? null);
|
|
822
|
+
}
|
|
823
|
+
getCommand(e, t = !1) {
|
|
824
|
+
const n = this._root._focused;
|
|
825
|
+
let o = n, r = n === this;
|
|
826
|
+
for (; !r && o; ) o === this && (r = !0), o = o._parent;
|
|
827
|
+
return (r ? n : this)._getCommand(e);
|
|
828
|
+
}
|
|
829
|
+
createChildGroup(e, t, n) {
|
|
830
|
+
let o;
|
|
831
|
+
if (!n) {
|
|
832
|
+
let l = this;
|
|
833
|
+
for (; l && !o; ) {
|
|
834
|
+
let a = l._nodes.get(t);
|
|
835
|
+
a && (o = a), l = l._parent;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
o || (o = new Kt(e, t), o._parent = this, o._root = this._root, o._unListenersByCommand = null, o._listenersByKey = null, o._commandsPropertyListener = null);
|
|
839
|
+
const r = (l, a) => {
|
|
840
|
+
!l.has(t) || n ? l.set(t, a) : n === void 0 && console.warn("commandGroup already registered", t);
|
|
841
|
+
};
|
|
842
|
+
r(this._root._nodes, o);
|
|
843
|
+
let s = this._parent;
|
|
844
|
+
for (; s; ) r(this._nodes, o), s = s._parent;
|
|
845
|
+
return this._children.set(t, o), this._notify("onGroupChange"), o;
|
|
846
|
+
}
|
|
847
|
+
getKey() {
|
|
848
|
+
return this._groupKey;
|
|
849
|
+
}
|
|
850
|
+
getGroup(e) {
|
|
851
|
+
return this._nodes.get(e);
|
|
852
|
+
}
|
|
853
|
+
_addCommands(e, t = void 0) {
|
|
854
|
+
const n = this._commandsByKey, o = this._commandsByShortcut, r = this._root._commandsPropertyListener, s = this._root._unListenersByCommand;
|
|
855
|
+
for (let l = 0; l < e.length; l++) {
|
|
856
|
+
const a = e[l], c = a.key();
|
|
857
|
+
if (n.has(c) && !t) {
|
|
858
|
+
t === void 0 && console.warn("command already registered", c);
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
n.set(c, a);
|
|
862
|
+
let h = s.get(a);
|
|
863
|
+
h && (h(), s.delete(a));
|
|
864
|
+
const u = a.addPropertyListener(r);
|
|
865
|
+
s.set(a, u);
|
|
866
|
+
const d = a.shortcut();
|
|
867
|
+
if (!d) continue;
|
|
868
|
+
const w = Array.isArray(d) ? d : [d];
|
|
869
|
+
for (let b = 0; b < w.length; b++) {
|
|
870
|
+
const x = Te(w[b]), S = o.get(x);
|
|
871
|
+
S && !t && t === void 0 && console.warn(`Shortcut already registered: ${x}, ${c}, ${S}.`), o.set(x, c);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
removeFromParent() {
|
|
876
|
+
if (!this._parent) return;
|
|
877
|
+
let e = this._parent, t = [];
|
|
878
|
+
const n = this._groupKey;
|
|
879
|
+
for (; e; ) t.push(e._nodes), e._nodes.delete(n), e = e._parent;
|
|
880
|
+
e = this._parent;
|
|
881
|
+
const o = (r) => {
|
|
882
|
+
r._children.forEach((s) => {
|
|
883
|
+
for (let l = 0; l < t.length; l++) s._nodes.delete(t[l]);
|
|
884
|
+
o(s);
|
|
885
|
+
});
|
|
886
|
+
};
|
|
887
|
+
o(this), this._parent = null, this._notify("onGroupChange");
|
|
888
|
+
}
|
|
889
|
+
addCommands(e, t) {
|
|
890
|
+
this._addCommands(e, t), this._notify("onGroupChange");
|
|
891
|
+
}
|
|
892
|
+
getActive() {
|
|
893
|
+
return this._root._focused ?? this._root;
|
|
894
|
+
}
|
|
895
|
+
activate(e) {
|
|
896
|
+
let t = this;
|
|
897
|
+
if (e && (t = this._nodes.get(e), !t)) return void console.warn("group not found", e);
|
|
898
|
+
let n = this._root._focused ?? this._root;
|
|
899
|
+
for (; n; ) n = n._parent;
|
|
900
|
+
this._root._focused !== t && (this._root._focused = t, this._notify("onGroupChange"), this._notify("onActiveChange"));
|
|
901
|
+
}
|
|
902
|
+
findCommandByEvent(e) {
|
|
903
|
+
const t = [];
|
|
904
|
+
e.altKey && t.push(Z.Alt), e.shiftKey && t.push(Z.Shift), e.ctrlKey && t.push(Z.Ctrl), e.metaKey && t.push(Z.Meta);
|
|
905
|
+
let n = Te({ key: e.code, modifiers: t });
|
|
906
|
+
const o = this._commandsByShortcut;
|
|
907
|
+
let r = o.get(n);
|
|
908
|
+
r || (n = Te({ key: e.key, modifiers: t }), r = o.get(n)), !r && e.code.startsWith("Digit") && (n = Te({ key: e.code.substring(5, e.code.length), modifiers: t }), r = this._commandsByShortcut.get(n)), !r && e.code.startsWith("Key") && (r = Te({ key: e.code.substring(3, e.code.length), modifiers: t }), r = o.get(n));
|
|
909
|
+
let s = null;
|
|
910
|
+
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);
|
|
911
|
+
}
|
|
912
|
+
dispatchToFocusedCommand(e) {
|
|
913
|
+
const t = this.getActive();
|
|
914
|
+
if (!t || e.isDefaultPrevented()) return !1;
|
|
915
|
+
const n = t.findCommandByEvent?.(e);
|
|
916
|
+
return !!n && (n.execute(), e.preventDefault(), !0);
|
|
917
|
+
}
|
|
918
|
+
getRoot() {
|
|
919
|
+
return this._parent ? this._parent.getRoot() : this;
|
|
920
|
+
}
|
|
921
|
+
getParent() {
|
|
922
|
+
return this._parent;
|
|
923
|
+
}
|
|
924
|
+
addListener(e, t) {
|
|
925
|
+
const n = this._listeners, o = t?.keys, r = this._root._listenersByKey;
|
|
926
|
+
if (o && !e.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
|
|
927
|
+
let s = null;
|
|
928
|
+
if (o) for (let l = 0; l < o.length; l++) {
|
|
929
|
+
const a = o[l];
|
|
930
|
+
if (!a) continue;
|
|
931
|
+
let c = r.get(a);
|
|
932
|
+
c || (c = /* @__PURE__ */ new Set(), r.set(a, c)), s || (s = []), s.push(c), c.add(e);
|
|
933
|
+
}
|
|
934
|
+
return n.add(e), () => {
|
|
935
|
+
if (s) for (let l = 0; l < s.length; l++)
|
|
936
|
+
s[l].delete(e);
|
|
937
|
+
n.delete(e);
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
_notifyCommands(e, t, n) {
|
|
941
|
+
const o = this;
|
|
942
|
+
setTimeout(() => {
|
|
943
|
+
e.forEach((r) => {
|
|
944
|
+
r[t]?.(o, n);
|
|
945
|
+
});
|
|
946
|
+
}, 0);
|
|
947
|
+
}
|
|
948
|
+
_notify(e, t) {
|
|
949
|
+
const n = this;
|
|
950
|
+
setTimeout(() => {
|
|
951
|
+
n._listeners.forEach((o) => {
|
|
952
|
+
o[e]?.(n, t);
|
|
953
|
+
}), n._parent && n._parent._notify(e, t);
|
|
954
|
+
}, 0);
|
|
955
|
+
}
|
|
956
|
+
getAllCommands() {
|
|
957
|
+
const e = [], t = this._groupKey;
|
|
958
|
+
return this._commandsByKey.forEach((n) => {
|
|
959
|
+
e.push({ command: n, groupKey: t });
|
|
960
|
+
}), this._children.forEach((n) => {
|
|
961
|
+
e.push(...n.getAllCommands());
|
|
962
|
+
}), e;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
const In = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "Cmd" : "Ctrl", Nn = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "⌘" : "^", Te = (i, e = !1) => {
|
|
966
|
+
const t = {};
|
|
967
|
+
for (let o = 0; i.modifiers && o < i.modifiers.length; o++) t[i.modifiers[o]] = !0;
|
|
968
|
+
let n = "";
|
|
969
|
+
return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ? Nn : In)), t?.[Z.Alt] && (n += e ? "⌥" : "Alt"), t?.[Z.Shift] && (n += (n.length > 0 ? "+" : "") + (e ? "⇧" : "Shift")), n += (n.length > 0 ? "+" : "") + zt(i.key), n;
|
|
970
|
+
};
|
|
971
|
+
function fo(i, e = null) {
|
|
972
|
+
const t = A(e);
|
|
973
|
+
t.current = e;
|
|
974
|
+
const [n, o] = on((s) => s + 1, 0), r = N(() => Array.isArray(i) ? i : [i], [i]);
|
|
975
|
+
return V(() => {
|
|
976
|
+
if (!r || r.length === 0) return;
|
|
977
|
+
const s = (c, h) => {
|
|
978
|
+
t.current?.onChange?.(h), o();
|
|
979
|
+
};
|
|
980
|
+
let l = null;
|
|
981
|
+
e && (l = { onExecute(c, h) {
|
|
982
|
+
t.current?.onExecute?.(c, h);
|
|
983
|
+
}, onError(c, h, u) {
|
|
984
|
+
t.current?.onError?.(c, h, u);
|
|
985
|
+
} });
|
|
986
|
+
const a = /* @__PURE__ */ new Set();
|
|
987
|
+
for (let c = 0; c < r.length; c++) a.add(r[c]?.addPropertyListener(te.debounce(s, 0), !0)), e && a.add(r[c]?.addExecuteListener(l));
|
|
988
|
+
return () => {
|
|
989
|
+
a.forEach((c) => {
|
|
990
|
+
c?.();
|
|
991
|
+
});
|
|
992
|
+
};
|
|
993
|
+
}, [i]), n;
|
|
994
|
+
}
|
|
995
|
+
const $e = (i, e) => {
|
|
996
|
+
const t = [];
|
|
997
|
+
if (e) for (let n = 0; n < e.length; n++) {
|
|
998
|
+
const o = e[n], r = o ? i?.getCommand(o) : null;
|
|
999
|
+
t.push(r);
|
|
1000
|
+
}
|
|
1001
|
+
return t;
|
|
1002
|
+
};
|
|
1003
|
+
function go(i, e = null, t = null, n) {
|
|
1004
|
+
const o = A(t);
|
|
1005
|
+
o.current = t, e && !Array.isArray(e) && (e = [e]);
|
|
1006
|
+
const [r, s] = Q($e(i, e)), l = n ? [...n, i] : [i];
|
|
1007
|
+
return V(() => {
|
|
1008
|
+
const a = { onGroupChange: () => {
|
|
1009
|
+
const d = $e(i, e);
|
|
1010
|
+
s(d), o.current?.onChange?.(this);
|
|
1011
|
+
} };
|
|
1012
|
+
let c;
|
|
1013
|
+
e && e.length > 0 && (c = { keys: e }, a.onCommandChange = (d, w) => {
|
|
1014
|
+
o.current?.onChange?.(i), s($e(i, e));
|
|
1015
|
+
});
|
|
1016
|
+
const h = i?.addListener(a, c), u = $e(i, e);
|
|
1017
|
+
return s(u), o.current?.onChange && o.current?.onChange(i), () => {
|
|
1018
|
+
h?.();
|
|
1019
|
+
};
|
|
1020
|
+
}, l), r;
|
|
1021
|
+
}
|
|
1022
|
+
const yo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Wn = $t({ setClipboard: (i) => {
|
|
1023
|
+
throw new Error("This is only available via the useClipboard.");
|
|
1024
|
+
}, getClipboard: () => Ke.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
1025
|
+
const [i, e] = Q(Ke.Global);
|
|
1026
|
+
return { setClipboard: (t) => e(t), getClipboard: () => i, refNativeCopy: A(null), refNativeLastKey: A(null) };
|
|
1027
|
+
}), vo = (i) => {
|
|
1028
|
+
const { source: e, target: t, onPaste: n, onClipboardUpdate: o, notifier: r = At, commands: s } = i, l = T(o, [o]), a = T(n, [n]), { getClipboard: c, refNativeCopy: h } = Wn(), u = c();
|
|
1029
|
+
N(() => {
|
|
1030
|
+
const _ = e?.element, y = t?.element ?? e?.element;
|
|
1031
|
+
if (!s) return;
|
|
1032
|
+
const f = [new Xe("cut", _, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", shortcut: { key: "X", modifiers: [Z.Ctrl] } }), new Xe("copy", _, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", shortcut: { key: "C", modifiers: [Z.Ctrl] } }), new Xe("paste", y, { label: "Paste", description: "Add content on the clipboard to your document.", shortcut: [{ key: "V", modifiers: [Z.Ctrl] }, { key: "F8", modifiers: [Z.Ctrl] }] })];
|
|
1033
|
+
s?.addCommands(f, !0);
|
|
1034
|
+
}, [s]);
|
|
1035
|
+
const d = T(async (_) => {
|
|
1036
|
+
if (!e?.element) return;
|
|
1037
|
+
let y = null;
|
|
1038
|
+
try {
|
|
1039
|
+
y = e.doCopy?.(_), typeof y == "string" ? await u.writeText(y) : await u.writeReference(y);
|
|
1040
|
+
} catch (f) {
|
|
1041
|
+
throw f;
|
|
1042
|
+
}
|
|
1043
|
+
}, [e, r]), w = T(async (_) => {
|
|
1044
|
+
const y = e?.element?.();
|
|
1045
|
+
if (y) {
|
|
1046
|
+
h.current = { sourceElement: y, args: _ };
|
|
1047
|
+
try {
|
|
1048
|
+
await d(_);
|
|
1049
|
+
} catch (f) {
|
|
1050
|
+
r?.showError?.(f);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}, [e?.element, r]), b = R(() => {
|
|
1054
|
+
w({ isCut: !0 });
|
|
1055
|
+
}, []), x = T(async (_, y, f) => {
|
|
1056
|
+
try {
|
|
1057
|
+
if (await _.doPaste(y, f) === !1) return;
|
|
1058
|
+
a?.(y, f);
|
|
1059
|
+
} catch (k) {
|
|
1060
|
+
r?.showError?.(k);
|
|
1061
|
+
}
|
|
1062
|
+
}, [a]), S = T(async (_, y, f) => {
|
|
1063
|
+
const k = t?.element?.();
|
|
1064
|
+
if (k && await te.whenFocus(k), !_ && !y) return;
|
|
1065
|
+
const z = await r?.showBusy?.("Pasting...");
|
|
1066
|
+
if (y) try {
|
|
1067
|
+
return await x(t, y, f), void z?.();
|
|
1068
|
+
} catch (g) {
|
|
1069
|
+
z?.(), r?.showError?.(g);
|
|
1070
|
+
}
|
|
1071
|
+
let O, F = t.importFromExternal;
|
|
1072
|
+
F || (F = (g, v) => ({ getItemType: () => "text", toText: () => _.text, isClipboardItem: !0 }));
|
|
1073
|
+
try {
|
|
1074
|
+
O = await F(_, { isCut: !1 });
|
|
1075
|
+
} catch (g) {
|
|
1076
|
+
z?.(), r?.showError?.(g);
|
|
1077
|
+
}
|
|
1078
|
+
if (O) try {
|
|
1079
|
+
const g = await Promise.resolve(O);
|
|
1080
|
+
await x(t, g, f), z?.();
|
|
1081
|
+
} catch (g) {
|
|
1082
|
+
z?.(), r?.showError?.(g);
|
|
1083
|
+
}
|
|
1084
|
+
else z?.();
|
|
1085
|
+
}, [x, t, r]), P = T(async (_) => {
|
|
1086
|
+
if (t?.element) try {
|
|
1087
|
+
const y = await u.readReference();
|
|
1088
|
+
if (y) return void await S(null, y, _);
|
|
1089
|
+
const f = [];
|
|
1090
|
+
f[0] = await Ie.readStringFromClipboard(u, Ne.plain), f[1] = await Ie.readHTMLFromClipboard(u, Ne.html), f[2] = await Ie.readBlobFromClipboard(u, Ne.png);
|
|
1091
|
+
const k = { text: f[0] ?? null, html: f[1] ?? null, image: f[2] ?? null };
|
|
1092
|
+
await S(k, null, _);
|
|
1093
|
+
} catch (y) {
|
|
1094
|
+
if (y?.message === "Document is not focused.") return;
|
|
1095
|
+
r?.showError?.(y);
|
|
1096
|
+
}
|
|
1097
|
+
}, [S, t?.element, r]);
|
|
1098
|
+
return T(async (_) => {
|
|
1099
|
+
}, [e?.element]), T(async (_) => {
|
|
1100
|
+
}, [t?.element, S, r]), V(() => {
|
|
1101
|
+
if (!u) return;
|
|
1102
|
+
const _ = async (k) => {
|
|
1103
|
+
const z = await u.readReference();
|
|
1104
|
+
l?.(z);
|
|
1105
|
+
}, y = (k) => {
|
|
1106
|
+
r?.showMessage?.(Ke.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
|
|
1107
|
+
}, f = (k) => {
|
|
1108
|
+
r?.showMessage?.(Ke.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
|
|
1109
|
+
};
|
|
1110
|
+
return u.addEventListener("clipboardchange", _), u.addEventListener("clipboarderrorread", y), u.addEventListener("clipboarderrorwrite", f), () => {
|
|
1111
|
+
u.removeEventListener("clipboardchange", _), u.removeEventListener("clipboarderrorread", y), u.removeEventListener("clipboarderrorwrite", f);
|
|
1112
|
+
};
|
|
1113
|
+
}, [u, r]), V(() => {
|
|
1114
|
+
}, [d, S, e, t]), V(() => {
|
|
1115
|
+
s?.getCommand("cut")?.updateCallback(b).update({ disabled: !e || !t }), s?.getCommand("copy")?.updateCallback(w).update({ disabled: !e }), s?.getCommand("paste")?.updateCallback(P).update({ disabled: !t });
|
|
1116
|
+
}, [e, t, s]), { paste: P, copy: w, clipboard: u };
|
|
1117
|
+
};
|
|
1118
|
+
function xo(i, e = !0) {
|
|
1119
|
+
const t = A(i);
|
|
1120
|
+
V(() => {
|
|
1121
|
+
if (e) {
|
|
1122
|
+
const n = Object.entries(i).reduce((o, [r, s]) => (t.current[r] !== s && (o[r] = [t.current[r], s]), o), {});
|
|
1123
|
+
Object.keys(n).length > 0 && console.log("Changed props:", n);
|
|
1124
|
+
}
|
|
1125
|
+
t.current = i;
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
let je = !1, Yn = 0;
|
|
1129
|
+
var Xn = typeof document < "u" ? Ve : V;
|
|
1130
|
+
const xt = () => "sheetxl-ui-" + Yn++, bt = me.useId, bo = bt ?? function() {
|
|
1131
|
+
const [i, e] = me.useState(() => je ? xt() : void 0);
|
|
1132
|
+
return Xn(() => {
|
|
1133
|
+
i == null && e(xt());
|
|
1134
|
+
}, []), me.useEffect(() => {
|
|
1135
|
+
je || (je = !0);
|
|
1136
|
+
}, []), i;
|
|
1137
|
+
}, wt = "Undo the last action.", St = "Repeat the last action or undo the redo.", jn = (i) => `Redo ${i}`, wo = ({ manager: i, commands: e, disabled: t, notifier: n = At }) => {
|
|
1138
|
+
const o = T((s) => {
|
|
1139
|
+
try {
|
|
1140
|
+
i?.undo(s);
|
|
1141
|
+
} catch (l) {
|
|
1142
|
+
n.showError?.(l);
|
|
1143
|
+
}
|
|
1144
|
+
}, [i]), r = T((s) => {
|
|
1145
|
+
try {
|
|
1146
|
+
i?.redo(s);
|
|
1147
|
+
} catch (l) {
|
|
1148
|
+
n.showError?.(l);
|
|
1149
|
+
}
|
|
1150
|
+
}, [i]);
|
|
1151
|
+
return N(() => {
|
|
1152
|
+
if (!e) return;
|
|
1153
|
+
const s = { contains: (a) => !0, focus() {
|
|
1154
|
+
} }, l = [new Qe("undo", s, { label: "Undo", description: wt, shortcut: { key: "z", modifiers: [Z.Ctrl] }, disabled: !0 }, o), new Qe("redo", s, { label: "Redo", description: St, shortcut: [{ key: "y", modifiers: [Z.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [Z.Alt] }], disabled: !0 }, r)];
|
|
1155
|
+
e?.addCommands(l, !0);
|
|
1156
|
+
}, [e]), V(() => {
|
|
1157
|
+
if (!e) return;
|
|
1158
|
+
const s = () => {
|
|
1159
|
+
const a = i?.getTopUndoDescription(), c = {};
|
|
1160
|
+
var h;
|
|
1161
|
+
e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description: a ? (h = a, `Undo ${h}`) : wt, state: c, context: { undoManager: i } });
|
|
1162
|
+
const u = i?.getTopRedoDescription();
|
|
1163
|
+
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ? jn(u) : St, state: c, context: { undoManager: i } });
|
|
1164
|
+
};
|
|
1165
|
+
if (s(), !i) return;
|
|
1166
|
+
const l = i.addListener({ onStackChange() {
|
|
1167
|
+
s();
|
|
1168
|
+
} });
|
|
1169
|
+
return () => l?.();
|
|
1170
|
+
}, [i, e, t]), { undo: o, redo: r };
|
|
1171
|
+
};
|
|
1172
|
+
export {
|
|
1173
|
+
Qe as Command,
|
|
1174
|
+
yo as CommandButtonType,
|
|
1175
|
+
Kt as CommandGroup,
|
|
1176
|
+
At as DefaultNotifier,
|
|
1177
|
+
lo as FocusKeyNavigation,
|
|
1178
|
+
Qn as HorizontalAlignment,
|
|
1179
|
+
eo as KeyCodes,
|
|
1180
|
+
Z as KeyModifiers,
|
|
1181
|
+
to as MouseButtonCodes,
|
|
1182
|
+
yt as NotificationType,
|
|
1183
|
+
io as ReactUtils,
|
|
1184
|
+
ao as RoundedTab,
|
|
1185
|
+
En as ScrollPane,
|
|
1186
|
+
oo as ScrollUtils,
|
|
1187
|
+
et as Scrollbar,
|
|
1188
|
+
re as ScrollbarOrientation,
|
|
1189
|
+
Xe as SimpleCommand,
|
|
1190
|
+
co as SplitPane,
|
|
1191
|
+
$n as SplitPaneResizer,
|
|
1192
|
+
so as ToolTipPlacement,
|
|
1193
|
+
An as VirtualScrollbar,
|
|
1194
|
+
Cn as defaultCreateScrollCorner,
|
|
1195
|
+
no as defaultCreateScrollEdgeButton,
|
|
1196
|
+
hn as defaultCreateScrollEndButton,
|
|
1197
|
+
cn as defaultCreateScrollStartButton,
|
|
1198
|
+
gt as defaultCreateScrollbar,
|
|
1199
|
+
uo as getDevicePixelRatio,
|
|
1200
|
+
Tn as getPortalContainer,
|
|
1201
|
+
Te as toShortcutString,
|
|
1202
|
+
T as useCallbackRef,
|
|
1203
|
+
fo as useCommand,
|
|
1204
|
+
go as useCommands,
|
|
1205
|
+
vo as useCopyPaste,
|
|
1206
|
+
ho as useDevicePixelRatio,
|
|
1207
|
+
mo as useEditMode,
|
|
1208
|
+
ro as useFullscreenPortal,
|
|
1209
|
+
Wn as useGlobalClipboard,
|
|
1210
|
+
bo as useId,
|
|
1211
|
+
kt as useImperativeElement,
|
|
1212
|
+
_o as useMouseDownAndHoldListener,
|
|
1213
|
+
po as useOnClickOrFocusAway,
|
|
1214
|
+
On as useSynchronizedPointerHandler,
|
|
1215
|
+
xo as useTraceUpdate,
|
|
1216
|
+
wo as useUndoManager
|
|
1217
|
+
};
|