e&&(z.width=e-z.x)}}else if(d&&a===v-1){let s=typeof p=="number"?p:p(a);z.y=r-s,z.height=s}else{let s=o>a?-1:1;if(typeof p=="number"){let f=a-o;z.y+=f*p}else for(let f=o;f!==a;f+=s)z.y+=p(f)*s;z.height=(typeof p=="number"?p:p(a))+1}return z}var Dt='',Zk=t=>{let a=t.fgColor,e=t.bgColor;return`
${Dt} `},Jk=t=>{let a=t.fgColor,e=t.bgColor;return`
${Dt} `},tb=t=>{let a=t.fgColor,e=t.bgColor;return`${Dt}
@@ -173,19 +173,19 @@ Please report this to https://github.com/markedjs/marked.`,a.silent)return"An
-`},yb={headerRowID:Zk,headerNumber:tb,headerCode:Jk,headerString:ab,headerBoolean:eb,headerAudioUri:nb,headerVideoUri:ib,headerEmoji:lb,headerImage:ob,headerUri:yz,headerPhone:hb,headerMarkdown:cb,headerDate:vb,headerTime:gb,headerEmail:db,headerReference:sb,headerIfThenElse:ub,headerSingleValue:fb,headerLookup:pb,headerTextTemplate:zb,headerMath:mb,headerRollup:Mb,headerJoinStrings:Hb,headerSplitString:xb,headerGeoDistance:wb,headerArray:Lb,rowOwnerOverlay:Vb,protectedColumnOverlay:Rb,renameIcon:rb};function Cb(t,a){return t==="normal"?[a.bgIconHeader,a.fgIconHeader]:t==="selected"?["white",a.accentColor]:[a.accentColor,a.bgHeader]}var Bb=class{constructor(t,a){this.spriteMap=new Map,this.inFlight=0,this.onSettled=a,this.headerIcons={...yb,...t}}drawSprite(t,a,e,r,n,i,l,o=1){let[h,c]=Cb(a,l),v=i*Math.ceil(window.devicePixelRatio),g=`${h}_${c}_${v}_${t}`,d=this.spriteMap.get(g);if(d===void 0){let u=this.headerIcons[t];if(u===void 0)return;d=document.createElement("canvas");let p=d.getContext("2d");if(p===null)return;let z=new Image;z.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u({fgColor:c,bgColor:h}))}`,this.spriteMap.set(g,d);let x=z.decode();if(x===void 0)return;this.inFlight++,x.then(()=>{p.drawImage(z,0,0,v,v)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else o<1&&(e.globalAlpha=o),e.drawImage(d,0,0,v,v,r,n,i,i),o<1&&(e.globalAlpha=1)}},H8={},de=null;function Sb(){let t=document.createElement("div");return t.style.opacity="0",t.style.pointerEvents="none",t.style.position="fixed",document.body.append(t),t}function B8(t){let a=t.toLowerCase().trim();if(H8[a]!==void 0)return H8[a];de=de||Sb(),de.style.color="#000",de.style.color=a;let e=getComputedStyle(de).color;de.style.color="#fff",de.style.color=a;let r=getComputedStyle(de).color;if(r!==e)return[0,0,0,1];let n=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return n.length<4&&n.push(1),n=n.map(i=>{let l=Number.isNaN(i);return l&&console.warn("Could not parse color",t),l?0:i}),H8[a]=n,n}function er(t,a){let[e,r,n]=B8(t);return`rgba(${e}, ${r}, ${n}, ${a})`}function fe(t,a){if(a===void 0)return t;let[e,r,n,i]=B8(t);if(i===1)return t;let[l,o,h,c]=B8(a),v=i+c*(1-i),g=(i*e+c*l*(1-i))/v,d=(i*r+c*o*(1-i))/v,u=(i*n+c*h*(1-i))/v;return`rgba(${g}, ${d}, ${u}, ${v})`}var Ab={kind:M1.Loading,allowOverlay:!1};function Sz(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s,f,m){let M,w;p!==void 0&&p[0][0]===r&&p[0][1]===a&&(M=p[1][0],w=p[1][1]);let y,R={ctx:t,theme:c,col:r,row:a,cell:e,rect:{x:n,y:i,width:l,height:o},highlighted:h,hoverAmount:u,hoverX:M,hoverY:w,imageLoader:g,spriteManager:d,hyperWrapping:z,requestAnimationFrame:()=>{L=!0}},L=!1;return(Dk(R,e.lastUpdated,x,s,()=>{var C,k;if(!(ue(e)?!1:v?.(R)===!0)){let F=m(e);if(F!==void 0){s?.renderer!==F&&((C=s?.deprep)==null||C.call(s,R),s=void 0);let _=(k=F.drawPrep)==null?void 0:k.call(F,R,s);F.draw(R,e),y={deprep:_?.deprep,fillStyle:_?.fillStyle,font:_?.font,renderer:F}}}})||L)&&f?.([r,a]),y}function Fb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x){let s=[],f=!1;t.imageSmoothingEnabled=!1;let m=Math.min(e.cellYOffset,n),M=Math.max(e.cellYOffset,n),w=0;if(typeof z=="number")w+=(M-m)*z;else for(let F=m;Fe.cellYOffset&&(w=-w),w+=l-e.translateY;let y=Math.min(e.cellXOffset,r),R=Math.max(e.cellXOffset,r),L=0;for(let F=y;Fe.cellXOffset&&(L=-L),L+=i-e.translateX;let V=ar(p);if(V>0&&V++,L!==0&&w!==0)return{regions:[],yOnly:!1};let C=o?typeof z=="number"?z:z(v-1):0,k=h-V-Math.abs(L),b=c-g-C-Math.abs(w)-1;if(k>150&&b>150){f=L===0;let F={sx:0,sy:0,sw:h*d,sh:c*d,dx:0,dy:0,dw:h*d,dh:c*d};w>0?(F.sy=(g+1)*d,F.sh=b*d,F.dy=(w+g+1)*d,F.dh=b*d,s.push({x:0,y:g,width:h,height:w+1})):w<0&&(F.sy=(-w+g+1)*d,F.sh=b*d,F.dy=(g+1)*d,F.dh=b*d,s.push({x:0,y:c+w-C,width:h,height:-w+C})),L>0?(F.sx=V*d,F.sw=k*d,F.dx=(L+V)*d,F.dw=k*d,s.push({x:V-1,y:0,width:L+2,height:c})):L<0&&(F.sx=(V-L)*d,F.sw=k*d,F.dx=V*d,F.dw=k*d,s.push({x:h+L,y:0,width:-L,height:c})),t.setTransform(1,0,0,1,0,0),V>0&&L!==0&&w===0&&x&&t.drawImage(a,0,0,V*d,c*d,0,0,V*d,c*d),t.drawImage(a,F.sx,F.sy,F.sw,F.sh,F.dx,F.dy,F.dw,F.dh),t.scale(d,d)}return t.imageSmoothingEnabled=!0,{regions:s,yOnly:f}}function kb(t,a,e,r,n,i,l,o,h,c){let v=[];return a!==t.cellXOffset||e!==t.cellYOffset||r!==t.translateX||n!==t.translateY||Je(h,e,r,n,o,(g,d,u,p)=>{if(g.sourceIndex===c){let z=Math.max(d,p)+1;return v.push({x:z,y:0,width:i-z,height:l}),!0}}),v}function Tp(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s=!1){var f,m,M;if(h!==void 0){t.beginPath(),t.save(),t.rect(0,0,i,l);for(let t1 of h)t.rect(t1.x+1,t1.y+1,t1.width-1,t1.height-1);t.clip("evenodd")}let w=(f=x.horizontalBorderColor)!=null?f:x.borderColor,y=x.borderColor,R=0,L=i,V=0,C=l;if(o!==void 0&&o.length>0){R=Number.MAX_SAFE_INTEGER,V=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,C=Number.MIN_SAFE_INTEGER;for(let t1 of o)R=Math.min(R,t1.x-1),L=Math.max(L,t1.x+t1.width+1),V=Math.min(V,t1.y-1),C=Math.max(C,t1.y+t1.height+1)}let k=[];t.beginPath();let b=.5;for(let t1=0;t1=R&&O<=L&&u(t1+1)&&k.push({x1:O,y1:Math.max(c,V),x2:O,y2:Math.min(l,C),color:y})}let F=g(z-1),_=l-F+.5,q=p==="sticky";if(q&&k.push({x1:R,y1:_,x2:L,y2:_,color:w}),s!==!0){let t1=v+.5,d1=e,O=q?l-F:l;for(;t1+n<=O;){let e1=t1+n;if(e1>=V&&e1<=C-1&&(!q||d1!==z-1||Math.abs(e1-_)>1)){let U=d?.(d1);k.push({x1:R,y1:e1,x2:L,y2:e1,color:(M=(m=U?.horizontalBorderColor)!=null?m:U?.borderColor)!=null?M:w})}t1+=g(d1),d1++}}let i1=(0,Bz.default)(k,t1=>t1.color);for(let t1 of Object.keys(i1)){t.strokeStyle=t1;for(let d1 of i1[t1])t.moveTo(d1.x1,d1.y1),t.lineTo(d1.x2,d1.y2);t.stroke(),t.beginPath()}h!==void 0&&t.restore()}function Az(t,a){let e=[],r=t.x+t.width-26*a.length,n=t.y+t.height/2-13,i=26,l=26;for(let o=0;o=t.x&&a<=t.x+t.width&&e>=t.y&&e<=t.y+t.height}function bb(t,a,e,r,n,i,l,o,h,c,v,g){var d;let[p,z]=(d=i?.[0])!=null?d:[],x=0;_z(a,e,r,n,(s,f,m,M,w,y)=>{var R,L;if(g!==void 0&&!g.some(F=>F[1]===-2&&F[0]>=s[0]&&F[0]<=s[1]))return;t.save(),t.beginPath(),t.rect(m,M,w,y),t.clip();let V=v(f),C=V?.overrideTheme===void 0?l:{...l,...V.overrideTheme},k=z===-2&&p!==void 0&&p>=s[0]&&p<=s[1],b=k?C.bgHeaderHovered:C.bgHeader;if(b!==l.bgHeader&&(t.fillStyle=b,t.fill()),t.fillStyle=(R=C.textGroupHeader)!=null?R:C.textHeader,V!==void 0){let F=m;if(V.icon!==void 0&&(o.drawSprite(V.icon,"normal",t,F+8,(n-20)/2,20,C),F+=26),t.fillText(V.name,F+8,n/2+Ea(t,`${l.headerFontStyle} ${l.fontFamily}`)),V.actions!==void 0&&k){let _=Az({x:m,y:M,width:w,height:y},V.actions);t.beginPath();let q=_[0].x-10,i1=m+w-q;t.rect(q,0,i1,n);let t1=t.createLinearGradient(q,0,q+i1,0),d1=er(b,0);t1.addColorStop(0,d1),t1.addColorStop(10/i1,b),t1.addColorStop(1,b),t.fillStyle=t1,t.fill(),t.globalAlpha=.6;let[O,e1]=(L=i?.[1])!=null?L:[-1,-1];for(let U=0;U35){let R=z?35:r-35,L=z?35*.7:r-35*.7,V=R/r,C=L/r,k=t.createLinearGradient(a,0,a+r,0),b=er(f,0);k.addColorStop(z?1:0,f),k.addColorStop(V,f),k.addColorStop(C,b),k.addColorStop(z?0:1,b),t.fillStyle=k}else t.fillStyle=f;if(z&&(t.textAlign="right"),t.fillText(i.title,w,e+n/2+Ea(t,`${o.headerFontStyle} ${o.fontFamily}`)),z&&(t.textAlign="left"),m&&i.hasMenu===!0){t.beginPath();let y=x.x+x.width/2-5.5,R=x.y+x.height/2-3;Qk(t,[{x:y,y:R},{x:y+11,y:R},{x:y+5.5,y:R+6}],1),t.fillStyle=f,t.fill()}}function Eb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s,f){var m;let M=l+o;if(M<=0)return;t.fillStyle=g.bgHeader,t.fillRect(0,0,n,M);let[w,y]=(m=r?.[0])!=null?m:[],R=`${g.headerFontStyle} ${g.fontFamily}`;t.font=R,Je(a,0,i,0,M,(L,V,C,k)=>{var b,F,_;if(x!==void 0&&!x.some(X1=>X1[1]===-1&&X1[0]===L.sourceIndex))return;let q=Math.max(0,k-V);t.save(),t.beginPath(),t.rect(V+q,o,L.width-q,l),t.clip();let i1=z((b=L.group)!=null?b:"").overrideTheme,t1=L.themeOverride===void 0&&i1===void 0?g:{...g,...i1,...L.themeOverride};t1.bgHeader!==g.bgHeader&&(t.fillStyle=t1.bgHeader,t.fill());let d1=`${t1.headerFontStyle} ${t1.fontFamily}`;R!==d1&&(t.font=d1);let O=v.columns.hasIndex(L.sourceIndex),e1=h!==void 0||c,U=!e1&&y===-1&&w===L.sourceIndex,V1=e1?0:(_=(F=u.find(X1=>X1.item[0]===L.sourceIndex&&X1.item[1]===-1))==null?void 0:F.hoverAmount)!=null?_:0,p1=v?.current!==void 0&&v.current.cell[0]===L.sourceIndex,o1=O?t1.accentColor:p1?t1.bgHeaderHasFocus:t1.bgHeader,x1=e?o:0,I1=L.sourceIndex===0?0:1;O?(t.fillStyle=o1,t.fillRect(V+I1,x1,L.width-I1,l)):(p1||V1>0)&&(t.beginPath(),t.rect(V+I1,x1,L.width-I1,l),p1&&(t.fillStyle=t1.bgHeaderHasFocus,t.fill()),V1>0&&(t.globalAlpha=V1,t.fillStyle=t1.bgHeaderHovered,t.fill(),t.globalAlpha=1)),bz(t,V,x1,L.width,l,L,O,t1,U,p1,V1,d,s,f),t.restore()}),e&&bb(t,a,n,i,o,r,g,d,u,p,z,x)}function ze(t,a,e,r,n,i,l,o){return t<=n+l&&n<=t+e&&a<=i+o&&i<=a+r}function Pp(t,a,e,r,n,i,l,o,h,c,v,g,d,u){if(d===void 0||d.length===0)return;let p=g==="sticky"?v(c-1):0;t.beginPath(),_z(a,e,l,n,(z,x,s,f,m,M)=>{for(let w=0;w=z[0]&&y[0]<=z[1]){t.rect(s,f,m,M);break}}}),Je(a,h,l,o,i,(z,x,s,f,m)=>{let M=Math.max(0,f-x),w=x+M+1,y=z.width-M-1;for(let R=0;R{let k=!1;for(let b=0;b0&&t.rect(w,b,y,_)}})}),t.clip()}function Ez(t,a,e,r,n,i,l){var o,h;let[c,v]=t,g,d,u=(h=(o=l.find(p=>!p.sticky))==null?void 0:o.sourceIndex)!=null?h:0;if(v>u){let p=Math.max(c,u),z=a,x=r;for(let s=i.sourceIndex-1;s>=p;s--)z-=l[s].width,x+=l[s].width;for(let s=i.sourceIndex+1;s<=v;s++)x+=l[s].width;d={x:z,y:e,width:x,height:n}}if(u>c){let p=Math.min(v,u-1),z=a,x=r;for(let s=i.sourceIndex-1;s>=c;s--)z-=l[s].width,x+=l[s].width;for(let s=i.sourceIndex+1;s<=p;s++)x+=l[s].width;g={x:z,y:e,width:x,height:n}}return[g,d]}function Ip(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s,f,m,M,w,y,R,L,V,C,k,b,F,_){var q;let i1=(q=f?.length)!=null?q:Number.MAX_SAFE_INTEGER,t1=performance.now(),d1=`${b.baseFontStyle} ${b.fontFamily}`;t.font=d1;let O,e1=new Set;return Je(a,o,i,l,n,(U,V1,p1,o1,x1)=>{var I1;let X1=Math.max(0,o1-V1),W1=V1+X1,Ct=n+1,P1=U.width-X1,Y1=r-n-1;if(s.length>0){let c1=!1;for(let D=0;D{t.save(),t.beginPath(),t.rect(W1,Ct,P1,Y1),t.clip()},$=m.columns.hasIndex(U.sourceIndex),s1=g((I1=U.group)!=null?I1:"").overrideTheme,w1=U.themeOverride===void 0&&s1===void 0?b:{...b,...s1,...U.themeOverride},f1=`${w1.baseFontStyle} ${w1.fontFamily}`;f1!==d1&&(d1=f1,t.font=f1),Z();let W;return jn(x1,p1,r,h,c,x,(c1,D,I,A1,N1)=>{var nt,F1,h1,r1;if(D<0)return;if(f!==void 0){let st=!1;for(let St=0;St0){let st=!1;for(let St=0;StO1.span!==void 0&&st>=O1.span[0]&&st<=O1.span[1]);Mt&&!p&&z?B0=0:Mt&&(B0=Math.max(B0,1)),Z0&&B0++,Mt||(u1&&B0++,$&&!A1&&B0++);let S0=O1.kind===M1.Protected?at.bgCellMedium:at.bgCell,r0;if((A1||S0!==b.bgCell)&&(r0=fe(S0,r0)),B0>0||H1){H1&&(r0=fe(at.bgHeader,r0));for(let st=0;stst[0]===U.sourceIndex&&st[1]===D)===!0&&(r0=fe(at.bgSearchResult,r0));if(w!==void 0)for(let st of w){let St=st.range;St.x<=U.sourceIndex&&U.sourceIndexst.item[0]===U.sourceIndex&&st.item[1]===D);if(Bt>10&&!Ut){let st=`${at.baseFontStyle} ${at.fontFamily}`;st!==d1&&(t.font=st,d1=st),W=Sz(t,D,O1,U.sourceIndex,J1,c1,Bt,I,B0>0,at,y,R,L,(h1=ua?.hoverAmount)!=null?h1:0,C,k,t1,W,F,_)}return O1.style==="faded"&&(t.globalAlpha=1),i1--,Gt&&(t.restore(),(r1=W?.deprep)==null||r1.call(W,{ctx:t}),W=void 0,Z(),d1=f1,t.font=f1),i1<=0}),t.restore(),i1<=0}),O}function _b(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s){x!==void 0||a[a.length-1]!==e[a.length-1]||Je(a,h,l,o,i,(f,m,M,w,y)=>{if(f!==a[a.length-1])return;m+=f.width;let R=Math.max(m,w);R>r||(t.save(),t.beginPath(),t.rect(R,i+1,1e4,n-i-1),t.clip(),jn(y,M,n,c,v,p,(L,V,C,k)=>{if(!k&&z.length>0&&!z.some(i1=>ze(m,L,1e4,C,i1.x,i1.y,i1.width,i1.height)))return;let b=d.hasIndex(V),F=u.hasIndex(V);t.beginPath();let _=g?.(V),q=_===void 0?s:{...s,..._};q.bgCell!==s.bgCell&&(t.fillStyle=q.bgCell,t.fillRect(m,L,1e4,C)),F&&(t.fillStyle=q.bgHeader,t.fillRect(m,L,1e4,C)),b&&(t.fillStyle=q.accentLight,t.fillRect(m,L,1e4,C))}),t.restore())})}function Tb(t,a,e,r,n,i,l,o,h){var c;let v=!1;for(let p of a)if(!p.sticky){v=l(p.sourceIndex);break}let g=(c=h.horizontalBorderColor)!=null?c:h.borderColor,d=h.borderColor,u=v?ar(a):0;if(u!==0&&(t.beginPath(),t.moveTo(u+.5,0),t.lineTo(u+.5,r),t.strokeStyle=fe(d,h.bgCell),t.stroke()),n){let p=o(i-1);t.beginPath(),t.moveTo(0,r-p+.5),t.lineTo(e,r-p+.5),t.strokeStyle=fe(g,h.bgCell),t.stroke()}}function Pb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p){let z=p?.filter(m=>m.style!=="no-outline");if(z===void 0||z.length===0)return;let x=z.map(m=>{var M,w,y,R,L;let V=m.range,C=Pn(V.x,V.y,a,e,v,c+v,r,n,i,l,u,h,d,o,g);if(V.width===1&&V.height===1)return V.x=h){let b=Pn(h-1,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g),F=Pn(h,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g);return[{color:m.color,style:(y=m.style)!=null?y:"dashed",rect:{x:C.x,y:C.y,width:b.x+b.width-C.x,height:b.y+b.height-C.y}},{color:m.color,style:(R=m.style)!=null?R:"dashed",rect:{x:F.x,y:F.y,width:k.x+k.width-F.x,height:k.y+k.height-F.y}}]}else return[void 0,{color:m.color,style:(L=m.style)!=null?L:"dashed",rect:{x:C.x,y:C.y,width:k.x+k.width-C.x,height:k.y+k.height-C.y}}]}),s=ar(o),f=()=>{t.beginPath(),t.save();let m=!1,M=y=>{m!==y&&(t.setLineDash(y?[5,3]:[]),m=y)};t.lineWidth=1;for(let y of x){let[R]=y;R!==void 0&&ze(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(M(R.style==="dashed"),t.strokeStyle=er(R.color,1),t.strokeRect(R.rect.x+1,R.rect.y+1,R.rect.width-2,R.rect.height-2))}let w=!1;for(let y of x){let[,R]=y;R!==void 0&&ze(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(M(R.style==="dashed"),!w&&R.rect.x{var C;return V.sourceIndex===((C=v.current)==null?void 0:C.cell[0])}))return;let[s,f]=v.current.cell,m=d(v.current.cell),M=(x=m.span)!=null?x:[s,s],w=u==="sticky"&&f===z-1,y=u==="sticky"&&!w?g(z-1)-1:0,R;if(Je(l,r,n,i,c,(V,C,k,b,F)=>{if(!(V.sticky&&s>V.sourceIndex)&&!(V.sourceIndexM[1]))return jn(F,k,e,z,g,u,(_,q,i1)=>{if(q!==f)return;let t1=C,d1=V.width;if(m.span!==void 0){let O=Ez(m.span,C,_,V.width,i1,V,o),e1=V.sticky?O[0]:O[1];e1!==void 0&&(t1=e1.x,d1=e1.width)}return R=()=>{var O,e1,U,V1;b>t1&&!V.sticky&&(t.beginPath(),t.rect(b,0,a-b,e),t.clip()),t.beginPath(),t.rect(t1+.5,_+.5,d1,i1),t.strokeStyle=(e1=(O=V.themeOverride)==null?void 0:O.accentColor)!=null?e1:h.accentColor,t.lineWidth=1,t.stroke(),p&&(t.beginPath(),t.rect(t1+d1-4,_+i1-4,4,4),t.fillStyle=(V1=(U=V.themeOverride)==null?void 0:U.accentColor)!=null?V1:h.accentColor,t.fill())},!0}),!0}),R===void 0)return;let L=()=>{t.save(),t.beginPath(),t.rect(0,c,a,e-c-y),t.clip(),R?.(),t.restore()};return L(),L}function Ib(t,a,e,r,n,i,l,o,h){let c=0;return Je(t,i,r,n,e,(v,g,d,u,p)=>(jn(p,d,a,l,o,h,(z,x,s,f)=>{f||(c=Math.max(x,c))}),!0)),c}function Ob(t,a){if(a===void 0||t.width!==a.width||t.height!==a.height||t.theme!==a.theme||t.headerHeight!==a.headerHeight||t.rowHeight!==a.rowHeight||t.rows!==a.rows||t.getRowThemeOverride!==a.getRowThemeOverride||t.isFocused!==a.isFocused||t.isResizing!==a.isResizing||t.verticalBorder!==a.verticalBorder||t.getCellContent!==a.getCellContent||t.highlightRegions!==a.highlightRegions||t.selection!==a.selection||t.dragAndDropState!==a.dragAndDropState||t.prelightCells!==a.prelightCells||t.touchMode!==a.touchMode||t.scrolling!==a.scrolling)return!1;if(t.mappedColumns!==a.mappedColumns){if(t.mappedColumns.length>100||t.mappedColumns.length!==a.mappedColumns.length)return!1;let e;for(let r=0;rw:w;N1.save(),N1.beginPath(),F1.save(),F1.beginPath(),N1.textBaseline="middle",F1.textBaseline="middle",w1!==1&&(N1.scale(w1,w1),F1.scale(w1,w1));let u1=y8(d,h,l,z,v),H1=[],O1=s&&((r=L.current)==null?void 0:r.cell[1])===c&&g===0,J1=()=>{var ct,at;Eb(N1,u1,u,o1,l,v,f,m,z,R,L,x,x1,V1,y,F,$,t1,X1),Tp(N1,u1,c,v,g,l,o,void 0,void 0,m,c1,r1,_,y,C,k,x,!0),N1.beginPath(),N1.moveTo(0,D-.5),N1.lineTo(l,D-.5),N1.strokeStyle=fe((at=(ct=x.headerBottomBorderColor)!=null?ct:x.horizontalBorderColor)!=null?at:x.borderColor,x.bgHeader),N1.stroke(),O1&&x8(N1,l,o,c,v,g,u1,d,x,c1,L,r1,b,C,V,k)};if($!==void 0){let ct=!1;$=$.filter(at=>(ct=ct||at[1]<0,at[1]<0||ze(h,c,u1.length,300,at[0],at[1],1,1)||ze(0,c,p,300,at[0],at[1],1,1)||C&&ze(h,k-1,u1.length,1,at[0],at[1],1,1))),$.length>0&&(Pp(F1,u1,l,o,m,c1,v,g,c,k,r1,C,$,!0),F1.fillStyle=x.bgCell,F1.fillRect(0,c1+1,l,o-c1-1),Ip(F1,u1,d,o,c1,v,g,c,k,r1,b,F,_,M,q,s,C,H1,$,L,d1,O,i1,e1,x1,V1,o1,p1,x,W1,Ct),V&&s&&L.current!==void 0&&$.some(at=>{var e0,Mt;return at[0]===((e0=L.current)==null?void 0:e0.cell[0])&&at[1]===((Mt=L.current)==null?void 0:Mt.cell[1])})&&x8(F1,l,o,c,v,g,u1,d,x,c1,L,r1,b,C,V,k)),ct&&(Pp(N1,u1,l,c1,m,c1,v,g,c,k,r1,C,$,!1),J1()),F1.restore(),N1.restore(),A1!==null&&(A1.fillStyle=x.bgCell,A1.fillRect(0,0,l,o),A1.drawImage(F1.canvas,0,0));return}if((f1!==!0||h!==I?.cellXOffset||v!==I?.translateX||O1!==I?.mustDrawFocusOnHeader)&&J1(),f1===!0){l2(h1!==void 0&&I!==void 0);let{regions:ct}=Fb(F1,h1,I,h,c,v,g,C==="sticky",l,o,k,c1,w1,d,u1,w,s1);H1=ct}else f1!==!1&&(l2(I!==void 0),H1=kb(I,h,c,v,g,l,o,c1,u1,f1));Tb(F1,u1,l,o,C==="sticky",k,y,r1,x);let Bt=s?x8(F1,l,o,c,v,g,u1,d,x,c1,L,r1,b,C,V,k):void 0,Gt=Pb(F1,l,o,h,c,v,g,d,p,f,m,w,C==="sticky",k,O);if(F1.fillStyle=x.bgCell,H1.length>0){F1.beginPath();for(let ct of H1)F1.rect(ct.x,ct.y,ct.width,ct.height);F1.clip(),F1.fill(),F1.beginPath()}else F1.fillRect(0,0,l,o);let Ut=Ip(F1,u1,d,o,c1,v,g,c,k,r1,b,F,_,M,q,s,C,H1,$,L,d1,O,i1,e1,x1,V1,o1,p1,x,W1,Ct);_b(F1,u1,d,l,o,c1,v,g,c,k,r1,_,L.rows,M,C,H1,$,x),Tp(F1,u1,c,v,g,l,o,H1,Ut,m,c1,r1,_,y,C,k,x),Bt?.(),Gt?.(),A1!==null&&(A1.fillStyle=x.bgCell,A1.fillRect(0,0,l,o),A1.drawImage(F1.canvas,0,0));let Tt=Ib(u1,o,c1,v,g,c,k,r1,C);e1?.setWindow({x:h,y:c,width:u1.length,height:Tt-c},p),U.current={cellXOffset:h,cellYOffset:c,translateX:v,translateY:g,mustDrawFocusOnHeader:O1,lastBuffer:s1?nt===Y1?"a":"b":void 0},F1.restore(),N1.restore()}function jn(t,a,e,r,n,i,l){let o=a,h=t,c=i==="sticky";for(;o=e;v&&(c=!1,h=r-1);let g=n(h);if(v&&(o=e-g),!(c&&h===r-1)&&l(o,h,g,v,i!=="none"&&h===r-1)===!0||v)break;o+=g,h++}}function Je(t,a,e,r,n,i){let l=0,o=0,h=n+r;for(let c of t){let v=c.sticky?o:l+e;if(i(c,v,h,o,a)===!0)break;l+=c.width,o+=c.sticky?c.width:0}}function _z(t,a,e,r,n){var i;let l=0,o=0;for(let h=0;ha?.[0]===e?.[0]&&a?.[1]===e?.[1],this.addToLeavingItems=a=>{this.leavingItems.some(r=>this.areSameItems(r.item,a.item))||this.leavingItems.push(a)},this.removeFromLeavingItems=a=>{var e;let r=this.leavingItems.find(n=>this.areSameItems(n.item,a));return this.leavingItems=this.leavingItems.filter(n=>n!==r),(e=r?.hoverAmount)!=null?e:0},this.cleanUpLeavingElements=()=>{this.leavingItems=this.leavingItems.filter(a=>a.hoverAmount>0)},this.shouldStep=()=>{let a=this.leavingItems.length>0,e=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return a||e},this.getAnimatingItems=()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(a=>({...a,hoverAmount:Nb(a.hoverAmount)})),this.step=a=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=a;else{let r=(a-this.lastAnimationTime)/Db;for(let i of this.leavingItems)i.hoverAmount=(0,S8.default)(i.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=(0,S8.default)(this.currentHoveredItem.hoverAmount+r,0,1));let n=this.getAnimatingItems();this.callback(n),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=a,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0},this.setHovered=a=>{var e;if(!this.areSameItems((e=this.currentHoveredItem)==null?void 0:e.item,a)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),a!==void 0){let r=this.removeFromLeavingItems(a);this.currentHoveredItem={item:a,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}},this.callback=t}},Wb=class{constructor(t){this.fn=t}get value(){var t;return(t=this.val)!=null?t:this.val=this.fn()}};function D8(t){return new Wb(t)}var Ub=D8(()=>window.navigator.userAgent.includes("Firefox")),Tz=D8(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),V5=D8(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function jb(t,a){for(let e of t)if(e[0]===a[0]&&e[1]===a[1])return!0;return!1}function qb(t){let a=Qe.useRef([]),e=Qe.useRef(0),r=Qe.useRef(t);r.current=t;let n=Qe.useCallback(()=>{let i=()=>window.requestAnimationFrame(l),l=()=>{let o=a.current;a.current=[],r.current(o),a.current.length>0?e.current++:e.current=0};window.requestAnimationFrame(e.current>600?i:l)},[]);return Qe.useCallback(i=>{jb(a.current,i)||(a.current.length===0&&n(),a.current.push(i))},[n])}var Gb=(t,a)=>{var e;if(t.kind===M1.Custom)return t.copyData;let r=a?.(t);return(e=r?.getAccessibilityString(t))!=null?e:""},Kb=(t,a)=>{var e,r,n,i,l,o,h,c;let{width:v,height:g,accessibilityHeight:d,columns:u,cellXOffset:p,cellYOffset:z,headerHeight:x,fillHandle:s=!1,groupHeaderHeight:f,rowHeight:m,rows:M,getCellContent:w,getRowThemeOverride:y,onHeaderMenuClick:R,enableGroups:L,isFilling:V,onCanvasFocused:C,onCanvasBlur:k,isFocused:b,selection:F,freezeColumns:_,onContextMenu:q,trailingRowType:i1,fixedShadowX:t1=!0,fixedShadowY:d1=!0,drawFocusRing:O=!0,onMouseDown:e1,onMouseUp:U,onMouseMoveRaw:V1,onMouseMove:p1,onItemHovered:o1,dragAndDropState:x1,firstColAccessible:I1,onKeyDown:X1,onKeyUp:W1,highlightRegions:Ct,canvasRef:P1,onDragStart:Y1,onDragEnd:Z,eventTargetRef:$,isResizing:s1,isDragging:w1,isDraggable:f1=!1,allowResize:W,disabledRows:c1,getGroupDetails:D,theme:I,prelightCells:A1,headerIcons:N1,verticalBorder:nt,drawHeader:F1,drawCustomCell:h1,onCellFocused:r1,onDragOverCell:u1,onDrop:H1,onDragLeave:O1,imageWindowLoader:J1,smoothScrollX:Bt=!1,smoothScrollY:Gt=!1,experimental:Ut,getCellRenderer:Tt}=t,ct=(e=t.translateX)!=null?e:0,at=(r=t.translateY)!=null?r:0,e0=Math.max(_,Math.min(u.length-1,p)),Mt=n1.useRef(null),B0=n1.useMemo(()=>new Vk,[]),Z0=J1??B0,S0=n1.useRef(),[r0,ua]=n1.useState(!1),st=n1.useRef([]),St=n1.useRef(),[c0,wt]=n1.useState(),[kt,Kt]=n1.useState(),c2=n1.useRef(null),[v2,_a]=n1.useState(!1),T2=n1.useRef(v2);T2.current=v2;let q0=n1.useMemo(()=>new Bb(N1,()=>{na.current=void 0,Le.current()}),[N1]),g2=L?f+x:x,P2=n1.useRef(-1),Gn=Ut?.enableFirefoxRescaling!==!0;n1.useLayoutEffect(()=>{!Ub.value||window.devicePixelRatio===1||Gn||(P2.current!==-1&&ua(!0),window.clearTimeout(P2.current),P2.current=window.setTimeout(()=>{ua(!1),P2.current=-1},200))},[z,e0,ct,at,Gn]);let p0=Fk(u,_),Ht=n1.useCallback((S,X,b1)=>{let z1=S.getBoundingClientRect();if(X>=p0.length||b1>=M)return;let E1=z1.width/v,l1=Pn(X,b1,v,g,f,g2,e0,z,ct,at,M,_,i1==="sticky",p0,m);return E1!==1&&(l1.x*=E1,l1.y*=E1,l1.width*=E1,l1.height*=E1),l1.x+=z1.x,l1.y+=z1.y,l1},[v,g,f,g2,e0,z,ct,at,M,_,i1,p0,m]),M0=n1.useCallback((S,X,b1,z1)=>{var E1,l1;let q1=S.getBoundingClientRect(),ut=q1.width/v,C1=(X-q1.left)/ut,B1=(b1-q1.top)/ut,d0=5,vt=y8(p0,e0,v,void 0,ct),xt=0;z1 instanceof MouseEvent&&(xt=z1.button);let mt=Ek(C1,vt,ct),lt=_k(B1,g,L,x,f,M,m,z,at,i1==="sticky"),bt=z1?.shiftKey===!0,t2=z1?.ctrlKey===!0,jt=z1?.metaKey===!0,R2=z1!==void 0&&!(z1 instanceof MouseEvent)||z1?.pointerType==="touch",I2=20,y2=[Math.abs(C1)v||B1>g){let G1=C1>v?-1:C1<0?1:0,Xt=B1>g?1:B1<0?-1:0,Yt=!1;if(mt===-1&<===-1){let ur=Ht(S,p0.length-1,-1);l2(ur!==void 0),Yt=Xv&&C1g&&B1=0?(Xt=!0,G1=Ht(S,Yt,lt),l2(G1!==void 0),s2={kind:L&<===-2?x2:se,location:[Yt,lt],bounds:G1,group:(E1=p0[Yt].group)!=null?E1:"",isEdge:Xt,shiftKey:bt,ctrlKey:t2,metaKey:jt,isTouch:R2,localEventX:X-G1.x,localEventY:b1-G1.y,button:xt,scrollEdge:y2}):s2={kind:L&<===-2?x2:se,group:(l1=p0[mt].group)!=null?l1:"",location:[mt,lt],bounds:G1,isEdge:Xt,shiftKey:bt,ctrlKey:t2,metaKey:jt,isTouch:R2,localEventX:X-G1.x,localEventY:b1-G1.y,button:xt,scrollEdge:y2}}else{let G1=Ht(S,mt,lt);l2(G1!==void 0);let Xt=G1!==void 0&&G1.x+G1.width-X{}),hr=n1.useRef(c0);hr.current=c0;let[xe,we]=n1.useMemo(()=>{let S=document.createElement("canvas"),X=document.createElement("canvas");return S.style.display="none",S.style.opacity="0",S.style.position="fixed",X.style.display="none",X.style.opacity="0",X.style.position="fixed",[S,X]},[]);n1.useLayoutEffect(()=>(document.documentElement.append(xe),document.documentElement.append(we),()=>{xe.remove(),we.remove()}),[xe,we]);let na=n1.useRef(),t4=n1.useCallback(()=>{var S,X;let b1=Mt.current,z1=c2.current;if(b1===null||z1===null)return;let E1=na.current,l1={canvas:b1,bufferA:xe,bufferB:we,headerCanvas:z1,width:v,height:g,cellXOffset:e0,cellYOffset:z,translateX:Math.round(ct),translateY:Math.round(at),mappedColumns:p0,enableGroups:L,freezeColumns:_,dragAndDropState:x1,theme:I,headerHeight:x,groupHeaderHeight:f,disabledRows:c1??Lt.empty(),rowHeight:m,verticalBorder:nt,isResizing:s1,isFocused:b,selection:F,fillHandle:s,lastRowSticky:i1,rows:M,drawFocus:O,getCellContent:w,getGroupDetails:D??(q1=>({name:q1})),getRowThemeOverride:y,drawCustomCell:h1,drawHeaderCallback:F1,prelightCells:A1,highlightRegions:Ct,imageLoader:Z0,lastBlitData:St,damage:S0.current,hoverValues:st.current,hoverInfo:hr.current,spriteManager:q0,scrolling:r0,hyperWrapping:(S=Ut?.hyperWrapping)!=null?S:!1,touchMode:v2,enqueue:Kn.current,renderStrategy:(X=Ut?.renderStrategy)!=null?X:Tz.value?"double-buffer":"single-buffer",getCellRenderer:Tt};l1.damage===void 0?(na.current=l1,Op(l1,E1)):Op(l1,void 0)},[xe,we,v,g,e0,z,ct,at,p0,L,_,x1,I,x,f,c1,m,nt,s1,b,F,s,i1,M,O,w,D,y,h1,F1,A1,Ct,Z0,q0,r0,Ut?.hyperWrapping,Ut?.renderStrategy,v2,Tt]),Le=n1.useRef(t4);n1.useLayoutEffect(()=>{t4(),Le.current=t4},[t4]),n1.useLayoutEffect(()=>{(async()=>{var X;((X=document?.fonts)==null?void 0:X.ready)!==void 0&&(await document.fonts.ready,na.current=void 0,Le.current())})()},[]);let fa=n1.useCallback(S=>{S0.current=S,Le.current(),S0.current=void 0},[]),P5=qb(fa);Kn.current=P5;let Xn=n1.useCallback(S=>{fa(S.map(X=>X.cell))},[fa]);Z0.setCallback(fa);let[I5,Yn]=n1.useState(!1),[a4,Ve]=ra??[],O5=a4!==void 0&&Ve===-1,D5=a4!==void 0&&Ve===-2,cr=!1,Qn=!1,vr;if(a4!==void 0&&Ve!==void 0&&Ve>-1){let S=w([a4,Ve],!0);cr=S.kind===ta.NewRow||S.kind===ta.Marker&&S.markerKind!=="number",Qn=S.kind===M1.Boolean&&V8(S),vr=S.cursor}let pa=w1?"grabbing":(kt??!1)||s1?"col-resize":I5||V?"crosshair":vr!==void 0?vr:O5||cr||Qn||D5?"pointer":"default",Ta=n1.useMemo(()=>({contain:"strict",display:"block",cursor:pa}),[pa]),Zn=n1.useRef("default"),Jn=$?.current;Jn!=null&&Zn.current!==Ta.cursor&&(Jn.style.cursor=Zn.current=Ta.cursor);let za=n1.useCallback((S,X,b1,z1)=>{if(D===void 0)return;let E1=D(S);if(E1.actions!==void 0){let l1=Az(X,E1.actions);for(let[q1,ut]of l1.entries())if(Fz(ut,b1+X.x,z1+ut.y))return E1.actions[q1]}},[D]),Pa=n1.useCallback((S,X,b1,z1)=>{let E1=u[X];if(!w1&&!s1&&E1.hasMenu===!0&&!(kt??!1)){let l1=Ht(S,X,-1);l2(l1!==void 0);let q1=kz(l1.x,l1.y,l1.width,l1.height,P8(E1.title)==="rtl");if(b1>q1.x&&b1q1.y&&z1{let X=Mt.current,b1=$?.current;if(X===null||S.target!==X&&S.target!==b1)return;e4.current=!0;let z1,E1;if(S instanceof MouseEvent?(z1=S.clientX,E1=S.clientY):(z1=S.touches[0].clientX,E1=S.touches[0].clientY),S.target===b1&&b1!==null){let q1=b1.getBoundingClientRect();if(z1>q1.right||E1>q1.bottom)return}let l1=M0(X,z1,E1,S);ma.current=l1.location,l1.isTouch&&(H0.current=Date.now()),T2.current!==l1.isTouch&&_a(l1.isTouch),!(l1.kind===se&&Pa(X,l1.location[0],z1,E1)!==void 0)&&(l1.kind===x2&&za(l1.group,l1.bounds,l1.localEventX,l1.localEventY)!==void 0||(e1?.(l1),!l1.isTouch&&f1!==!0&&f1!==l1.kind&&S.preventDefault()))},[$,f1,M0,za,Pa,e1]);P0("touchstart",gr,window,!1),P0("mousedown",gr,window,!1);let ti=n1.useCallback(S=>{var X,b1;let z1=Mt.current;if(e4.current=!1,U===void 0||z1===null)return;let E1=$?.current,l1=S.target!==z1&&S.target!==E1,q1,ut;if(S instanceof MouseEvent){if(q1=S.clientX,ut=S.clientY,S.pointerType==="touch")return}else q1=S.changedTouches[0].clientX,ut=S.changedTouches[0].clientY;let C1=M0(z1,q1,ut,S);C1.isTouch&&H0.current!==0&&Date.now()-H0.current>500&&(C1={...C1,isLongTouch:!0}),T2.current!==C1.isTouch&&_a(C1.isTouch),!l1&&S.cancelable&&S.preventDefault();let[B1]=C1.location,d0=Pa(z1,B1,q1,ut);if(C1.kind===se&&d0!==void 0){(C1.button!==0||((X=ma.current)==null?void 0:X[0])!==B1||((b1=ma.current)==null?void 0:b1[1])!==-1)&&U(C1,!0);return}else if(C1.kind===x2){let vt=za(C1.group,C1.bounds,C1.localEventX,C1.localEventY);if(vt!==void 0){C1.button===0&&vt.onClick(C1);return}}U(C1,l1)},[U,$,M0,Pa,za]);P0("mouseup",ti,window,!1),P0("touchend",ti,window,!1);let N5=n1.useCallback(S=>{var X,b1;let z1=Mt.current;if(z1===null)return;let E1=$?.current,l1=S.target!==z1&&S.target!==E1,q1,ut;S instanceof MouseEvent?(q1=S.clientX,ut=S.clientY):(q1=S.changedTouches[0].clientX,ut=S.changedTouches[0].clientY);let C1=M0(z1,q1,ut,S);T2.current!==C1.isTouch&&_a(C1.isTouch),!l1&&S.cancelable&&S.preventDefault();let[B1]=C1.location,d0=Pa(z1,B1,q1,ut);if(C1.kind===se&&d0!==void 0)C1.button===0&&((X=ma.current)==null?void 0:X[0])===B1&&((b1=ma.current)==null?void 0:b1[1])===-1&&R?.(B1,d0);else if(C1.kind===x2){let vt=za(C1.group,C1.bounds,C1.localEventX,C1.localEventY);vt!==void 0&&C1.button===0&&vt.onClick(C1)}},[$,M0,Pa,R,za]);P0("click",N5,window,!1);let zt=n1.useCallback(S=>{let X=Mt.current;if(X===null||q===void 0)return;let b1=M0(X,S.clientX,S.clientY,S);q(b1,()=>{S.cancelable&&S.preventDefault()})},[M0,q]);P0("contextmenu",zt,(n=$?.current)!=null?n:null,!1);let Ia=n1.useCallback(S=>{S0.current=S.map(X=>X.item),st.current=S,Le.current(),S0.current=void 0},[]),d2=n1.useMemo(()=>new $b(Ia),[Ia]),T=n1.useRef(d2);T.current=d2,n1.useLayoutEffect(()=>{let S=T.current;if(ra===void 0||ra[1]<0){S.setHovered(ra);return}let X=w(ra),b1=Tt(X);S.setHovered(b1===void 0&&X.kind===M1.Custom||b1?.needsHover===!0?ra:void 0)},[w,Tt,ra]);let x0=n1.useRef(),L2=n1.useCallback(S=>{var X;let b1=Mt.current;if(b1===null)return;let z1=$?.current,E1=S.target!==b1&&S.target!==z1,l1=M0(b1,S.clientX,S.clientY,S);if(l1.kind!=="out-of-bounds"&&E1&&!e4.current&&!l1.isTouch)return;if(!T5(l1,x0.current))o1?.(l1),wt(l1.kind===A5?void 0:[l1.location,[l1.localEventX,l1.localEventY]]),x0.current=l1;else if(l1.kind==="cell"||l1.kind===se||l1.kind===x2){let ut=[l1.location,[l1.localEventX,l1.localEventY]];if(wt(ut),hr.current=ut,l1.kind==="cell"){let C1=w(l1.location);(C1.kind===M1.Custom||((X=Tt(C1))==null?void 0:X.needsHoverPosition)===!0)&&fa([l1.location])}else l1.kind===x2&&fa([l1.location])}let q1=l1.location[0]>=(I1?0:1);if(Kt(l1.kind===se&&l1.isEdge&&q1&&W===!0),s&&F.current!==void 0){let[ut,C1]=F.current.cell,B1=Ht(b1,ut,C1),d0=S.clientX,vt=S.clientY;l2(B1!==void 0),Yn(d0>=B1.x+B1.width-6&&d0<=B1.x+B1.width&&vt>=B1.y+B1.height-6&&vt<=B1.y+B1.height)}else Yn(!1);V1?.(S),p1(l1)},[$,M0,I1,W,s,F,V1,p1,o1,w,Tt,fa,Ht]);P0("mousemove",L2,window,!0);let $5=n1.useCallback(S=>{let X=Mt.current;if(X===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(X,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),X1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[X1,F,Ht]),ai=n1.useCallback(S=>{let X=Mt.current;if(X===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(X,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),W1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[W1,F,Ht]),W5=n1.useCallback(S=>{Mt.current=S,P1!==void 0&&(P1.current=S)},[P1]),U5=n1.useCallback(S=>{var X;let b1=Mt.current;if(b1===null||f1===!1||s1){S.preventDefault();return}let z1,E1,l1=M0(b1,S.clientX,S.clientY);if(f1!==!0&&l1.kind!==f1){S.preventDefault();return}let q1=(xt,mt)=>{z1=xt,E1=mt},ut,C1,B1,d0=(xt,mt,lt)=>{ut=xt,C1=mt,B1=lt},vt=!1;if(Y1?.({...l1,setData:q1,setDragImage:d0,preventDefault:()=>vt=!0,defaultPrevented:()=>vt}),!vt&&z1!==void 0&&E1!==void 0&&S.dataTransfer!==null)if(S.dataTransfer.setData(z1,E1),S.dataTransfer.effectAllowed="copyLink",ut!==void 0&&C1!==void 0&&B1!==void 0)S.dataTransfer.setDragImage(ut,C1,B1);else{let[xt,mt]=l1.location;if(mt!==void 0){let lt=document.createElement("canvas"),bt=Ht(b1,xt,mt);l2(bt!==void 0);let t2=Math.ceil((X=window.devicePixelRatio)!=null?X:1);lt.width=bt.width*t2,lt.height=bt.height*t2;let jt=lt.getContext("2d");jt!==null&&(jt.scale(t2,t2),jt.textBaseline="middle",mt===-1?(jt.font=`${I.headerFontStyle} ${I.fontFamily}`,jt.fillStyle=I.bgHeader,jt.fillRect(0,0,lt.width,lt.height),bz(jt,0,0,bt.width,bt.height,p0[xt],!1,I,!1,!1,0,q0,F1,!1)):(jt.font=`${I.baseFontStyle} ${I.fontFamily}`,jt.fillStyle=I.bgCell,jt.fillRect(0,0,lt.width,lt.height),Sz(jt,mt,w([xt,mt]),0,0,0,bt.width,bt.height,!1,I,h1,Z0,q0,1,void 0,!1,0,void 0,void 0,Tt))),lt.style.left="-100%",lt.style.position="absolute",lt.style.width=`${bt.width}px`,lt.style.height=`${bt.height}px`,document.body.append(lt),S.dataTransfer.setDragImage(lt,bt.width/2,bt.height/2),window.setTimeout(()=>{lt.remove()},0)}}else S.preventDefault()},[f1,s1,M0,Y1,Ht,I,p0,q0,F1,w,h1,Z0,Tt]);P0("dragstart",U5,(i=$?.current)!=null?i:null,!1,!1);let r4=n1.useRef(),G=n1.useCallback(S=>{var X;let b1=Mt.current;if(H1!==void 0&&S.preventDefault(),b1===null||u1===void 0)return;let z1=M0(b1,S.clientX,S.clientY),[E1,l1]=z1.location,q1=E1-(I1?0:1),[ut,C1]=(X=r4.current)!=null?X:[];(ut!==q1||C1!==l1)&&(r4.current=[q1,l1],u1([q1,l1],S.dataTransfer))},[I1,M0,u1,H1]);P0("dragover",G,(l=$?.current)!=null?l:null,!1,!1);let V2=n1.useCallback(()=>{r4.current=void 0,Z?.()},[Z]);P0("dragend",V2,(o=$?.current)!=null?o:null,!1,!1);let I0=n1.useCallback(S=>{let X=Mt.current;if(X===null||H1===void 0)return;S.preventDefault();let b1=M0(X,S.clientX,S.clientY),[z1,E1]=b1.location,l1=z1-(I1?0:1);H1([l1,E1],S.dataTransfer)},[I1,M0,H1]);P0("drop",I0,(h=$?.current)!=null?h:null,!1,!1);let j5=n1.useCallback(()=>{O1?.()},[O1]);P0("dragleave",j5,(c=$?.current)!=null?c:null,!1,!1);let ei=n1.useRef(F);ei.current=F;let Ma=n1.useRef(null),J0=n1.useCallback(S=>{var X;Mt.current===null||!Mt.current.contains(document.activeElement)||(S===null&&ei.current.current!==void 0?(X=P1?.current)==null||X.focus({preventScroll:!0}):S!==null&&S.focus({preventScroll:!0}),Ma.current=S)},[P1]);n1.useImperativeHandle(a,()=>({focus:()=>{var S;let X=Ma.current;X===null||!document.contains(X)?(S=P1?.current)==null||S.focus({preventScroll:!0}):X.focus({preventScroll:!0})},getBounds:(S,X)=>{if(!(P1===void 0||P1.current===null))return Ht(P1.current,S??0,X??-1)},damage:Xn}),[P1,Xn,Ht]);let Ha=n1.useRef(),q5=Ck(()=>{var S,X,b1,z1;if(v<50)return null;let E1=y8(p0,e0,v,x1,ct),l1=I1?0:-1;!I1&&((S=E1[0])==null?void 0:S.sourceIndex)===0&&(E1=E1.slice(1));let[q1,ut]=(b1=(X=F.current)==null?void 0:X.cell)!=null?b1:[],C1=(z1=F.current)==null?void 0:z1.range,B1=E1.map(vt=>vt.sourceIndex),d0=(0,Cz.default)(z,Math.min(M,z+d));return q1!==void 0&&ut!==void 0&&!(B1.includes(q1)&&d0.includes(ut))&&J0(null),n1.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":M+1,"aria-multiselectable":"true","aria-colcount":p0.length+l1},n1.createElement("thead",{role:"rowgroup"},n1.createElement("tr",{role:"row","aria-rowindex":1},E1.map(vt=>n1.createElement("th",{role:"columnheader","aria-selected":F.columns.hasIndex(vt.sourceIndex),"aria-colindex":vt.sourceIndex+1+l1,tabIndex:-1,onFocus:xt=>{if(xt.target!==Ma.current)return r1?.([vt.sourceIndex,-1])},key:vt.sourceIndex},vt.title)))),n1.createElement("tbody",{role:"rowgroup"},d0.map(vt=>n1.createElement("tr",{role:"row","aria-selected":F.rows.hasIndex(vt),key:vt,"aria-rowindex":vt+2},E1.map(xt=>{let mt=xt.sourceIndex,lt=`${mt},${vt}`,bt=q1===mt&&ut===vt,t2=C1!==void 0&&mt>=C1.x&&mt=C1.y&&vt{let y2=P1?.current;if(y2!=null)return X1?.({bounds:Ht(y2,mt,vt),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:R2})},onFocusCapture:y2=>{var s2,G1;if(!(y2.target===Ma.current||((s2=Ha.current)==null?void 0:s2[0])===mt&&((G1=Ha.current)==null?void 0:G1[1])===vt))return Ha.current=R2,r1?.(R2)},ref:bt?J0:void 0,tabIndex:-1},Gb(I2,Tt))})))))},[v,p0,e0,x1,ct,M,z,d,F,J0,w,P1,X1,Ht,r1],200),dr=t1?ar(p0,x1):0,n4=_===0||!t1?0:e0>_?1:(0,C8.default)(-ct/100,0,1),sr=-z*32+at,v0=d1?(0,C8.default)(-sr/100,0,1):0,A0=n1.useMemo(()=>{if(!n4&&!v0)return null;let S={position:"absolute",top:0,left:dr,width:v-dr,height:g,opacity:n4,pointerEvents:"none",transition:Bt?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},X={position:"absolute",top:g2,left:0,width:v,height:g,opacity:v0,pointerEvents:"none",transition:Gt?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return n1.createElement(n1.Fragment,null,n4>0&&n1.createElement("div",{id:"shadow-x",style:S}),v0>0&&n1.createElement("div",{id:"shadow-y",style:X}))},[n4,v0,dr,v,Bt,g2,g,Gt]),g0=n1.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return n1.createElement(n1.Fragment,null,n1.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:$5,onKeyUp:ai,onFocus:C,onBlur:k,ref:W5,style:Ta},q5),n1.createElement("canvas",{ref:c2,style:g0}),A0)},Xb=n1.memo(n1.forwardRef(Kb));function _n(t,a,e,r){var n;return(0,gz.default)(Math.round(a-((n=t.growOffset)!=null?n:0)),Math.ceil(e),Math.floor(r))}var Yb=t=>{var a;let[e,r]=Ot.useState(),[n,i]=Ot.useState(),[l,o]=Ot.useState(),[h,c]=Ot.useState(),[v,g]=Ot.useState(!1),[d,u]=Ot.useState(),[p,z]=Ot.useState(),[x,s]=Ot.useState(),[f,m]=Ot.useState(!1),[M,w]=Ot.useState(),{onHeaderMenuClick:y,getCellContent:R,onColumnMoved:L,onColumnResize:V,onColumnResizeStart:C,onColumnResizeEnd:k,gridRef:b,maxColumnWidth:F,minColumnWidth:_,onRowMoved:q,lockColumns:i1,onMouseDown:t1,onMouseUp:d1,onItemHovered:O,onDragStart:e1,canvasRef:U}=t,V1=((a=V??k)!=null?a:C)!==void 0,{columns:p1,selection:o1}=t,x1=o1.columns,I1=Ot.useCallback(W=>{let[c1,D]=W.location;l!==void 0&&h!==c1&&c1>=i1?(g(!0),c(c1)):p!==void 0&&D!==void 0?(m(!0),s(Math.max(0,D))):O?.(W)},[l,p,h,O,i1]),X1=L!==void 0,W1=Ot.useCallback(W=>{var c1,D;if(W.button===0){let[I,A1]=W.location;if(W.kind==="out-of-bounds"&&W.isEdge&&V1){let N1=(c1=b?.current)==null?void 0:c1.getBounds(p1.length-1,-1);N1!==void 0&&(r(N1.x),i(p1.length-1))}else if(W.kind==="header"&&I>=i1){let N1=U?.current;if(W.isEdge&&V1&&N1){r(W.bounds.x),i(I);let F1=N1.getBoundingClientRect().width/N1.offsetWidth,h1=W.bounds.width/F1;C?.(p1[I],h1,I,h1+((D=p1[I].growOffset)!=null?D:0))}else W.kind==="header"&&X1&&(u(W.bounds.x),o(I))}else W.kind==="cell"&&i1>0&&I===0&&A1!==void 0&&q!==void 0&&(w(W.bounds.y),z(A1))}t1?.(W)},[t1,V1,i1,q,b,p1,X1,C,U]),Ct=Ot.useCallback((W,c1)=>{v||f||y?.(W,c1)},[v,f,y]),P1=Ot.useRef(-1),Y1=Ot.useCallback(()=>{P1.current=-1,z(void 0),s(void 0),w(void 0),m(!1),o(void 0),c(void 0),u(void 0),g(!1),i(void 0),r(void 0)},[]),Z=Ot.useCallback((W,c1)=>{var D,I,A1;if(W.button===0){if(n!==void 0){if(x1?.hasIndex(n)===!0)for(let nt of x1){if(nt===n)continue;let F1=p1[nt],h1=_n(F1,P1.current,_,F);V?.(F1,h1,nt,h1+((D=F1.growOffset)!=null?D:0))}let N1=_n(p1[n],P1.current,_,F);if(k?.(p1[n],N1,n,N1+((I=p1[n].growOffset)!=null?I:0)),x1.hasIndex(n))for(let nt of x1){if(nt===n)continue;let F1=p1[nt],h1=_n(F1,P1.current,_,F);k?.(F1,h1,nt,h1+((A1=F1.growOffset)!=null?A1:0))}}Y1(),l!==void 0&&h!==void 0&&L?.(l,h),p!==void 0&&x!==void 0&&q?.(p,x)}d1?.(W,c1)},[d1,n,l,h,p,x,x1,k,p1,_,F,V,L,q,Y1]),$=Ot.useMemo(()=>{if(!(l===void 0||h===void 0)&&l!==h)return{src:l,dest:h}},[l,h]),s1=Ot.useCallback(W=>{var c1,D;let I=U?.current;if(l!==void 0&&d!==void 0)Math.abs(W.clientX-d)>20&&g(!0);else if(p!==void 0&&M!==void 0)Math.abs(W.clientY-M)>20&&m(!0);else if(n!==void 0&&e!==void 0&&I){let N1=I.getBoundingClientRect().width/I.offsetWidth,nt=(W.clientX-e)/N1,F1=p1[n],h1=_n(F1,nt,_,F);if(V?.(F1,h1,n,h1+((c1=F1.growOffset)!=null?c1:0)),P1.current=nt,x1?.first()===n)for(let r1 of x1){if(r1===n)continue;let u1=p1[r1],H1=_n(u1,P1.current,_,F);V?.(u1,H1,r1,H1+((D=u1.growOffset)!=null?D:0))}}},[l,d,p,M,n,e,p1,_,F,V,x1,U]),w1=Ot.useCallback((W,c1)=>{if(p===void 0||x===void 0)return R(W,c1);let[D,I]=W;return I===x?I=p:(I>x&&(I-=1),I>=p&&(I+=1)),R([D,I],c1)},[p,x,R]),f1=Ot.useCallback(W=>{e1?.(W),W.defaultPrevented()||Y1()},[Y1,e1]);return Ot.createElement(Xb,{accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,enableGroups:t.enableGroups,eventTargetRef:t.eventTargetRef,experimental:t.experimental,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,headerIcons:t.headerIcons,height:t.height,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isDraggable:t.isDraggable,isFilling:t.isFilling,isFocused:t.isFocused,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDrop:t.onDrop,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,width:t.width,getCellContent:w1,isResizing:n!==void 0,onHeaderMenuClick:Ct,isDragging:v,onItemHovered:I1,onDragStart:f1,onMouseDown:W1,allowResize:V1,onMouseUp:Z,dragAndDropState:$,onMouseMoveRaw:s1,ref:b})},Qb=Yb;function Zb(t){let a=(0,nr.useRef)(null),[e,r]=(0,nr.useState)({width:t?.[0],height:t?.[1]});return(0,nr.useLayoutEffect)(()=>{let n=l=>{for(let o of l){let{width:h,height:c}=o&&o.contentRect||{};r(v=>v.width===h&&v.height===c?v:{width:h,height:c})}},i=new window.ResizeObserver(n);return a.current&&i.observe(a.current,void 0),()=>{i.disconnect()}},[a.current]),{ref:a,...e}}var Jb=()=>t=>t.isSafari?"scroll":"auto",tE=V0("div")({name:"ScrollRegionStyle",class:"s1jz82f8",propsAsIs:!1,vars:{"s1jz82f8-0":[Jb()]}});function aE(t){let[a,e]=ht.useState(!1),r=ht.useRef(0);return P0("touchstart",ht.useCallback(()=>{window.clearTimeout(r.current),e(!0)},[]),window,!0,!1),P0("touchend",ht.useCallback(n=>{n.touches.length===0&&(r.current=window.setTimeout(()=>e(!1),t))},[t]),window,!0,!1),a}var eE=t=>{var a,e,r,n;let{children:i,clientHeight:l,scrollHeight:o,scrollWidth:h,update:c,draggable:v,className:g,preventDiagonalScrolling:d=!1,paddingBottom:u=0,paddingRight:p=0,rightElement:z,rightElementProps:x,scrollRef:s,scrollToEnd:f,initialSize:m,minimap:M}=t,w=[],y=(a=x?.sticky)!=null?a:!1,R=(e=x?.fill)!=null?e:!1,L=ht.useRef(0),V=ht.useRef(0),C=ht.useRef(null),k=window.devicePixelRatio;ht.useEffect(()=>{let W1=C.current;W1===null||f!==!0||(W1.scrollLeft=W1.scrollWidth-W1.clientWidth)},[f]);let b=ht.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),F=ht.useRef(null),_=aE(200),[q,i1]=ht.useState(!0),t1=ht.useRef(0);ht.useEffect(()=>{if(!q||_||b.current.lockDirection===void 0)return;let W1=C.current;if(W1===null)return;let[Ct,P1]=b.current.lockDirection;Ct!==void 0?W1.scrollLeft=Ct:P1!==void 0&&(W1.scrollTop=P1),b.current.lockDirection=void 0},[_,q]);let d1=ht.useCallback(()=>{var W1,Ct,P1,Y1;let Z=C.current;if(Z===null)return;let $=Z.scrollTop,s1=Z.scrollLeft,w1=b.current.scrollTop,f1=b.current.scrollLeft,W=s1-f1,c1=$-w1;_&&W!==0&&c1!==0&&(Math.abs(W)>3||Math.abs(c1)>3)&&d&&b.current.lockDirection===void 0&&(b.current.lockDirection=Math.abs(W)0&&(Math.abs(A1)>2e3||I===0||I===N1)&&o>Z.scrollHeight+5){let nt=I/N1,F1=(o-Z.clientHeight)*nt;L.current=F1-I}D!==void 0&&(window.clearTimeout(t1.current),i1(!1),t1.current=window.setTimeout(()=>i1(!0),200)),c({x:s1,y:I+L.current,width:Z.clientWidth-p,height:Z.clientHeight-u,paddingRight:(Y1=(P1=F.current)==null?void 0:P1.clientWidth)!=null?Y1:0})},[u,p,o,c,d,_]),O=ht.useRef(d1);O.current=d1;let e1=ht.useRef(),U=ht.useRef(!1);ht.useEffect(()=>{U.current?d1():U.current=!0},[d1,u,p]);let V1=ht.useCallback(W1=>{C.current=W1,s!==void 0&&(s.current=W1)},[s]),p1=0,o1=0;for(w.push(ht.createElement("div",{key:p1++,style:{width:h,height:0}}));o1O.current(),0),e1.current={width:I1,height:X1}),(I1??0)===0||(X1??0)===0?ht.createElement("div",{ref:x1}):ht.createElement("div",{ref:x1},ht.createElement(tE,{isSafari:Tz.value},M,ht.createElement("div",{className:"dvn-underlay"},i),ht.createElement("div",{ref:V1,style:e1.current,draggable:v,onDragStart:W1=>{v||(W1.stopPropagation(),W1.preventDefault())},className:"dvn-scroller "+(g??""),onScroll:d1},ht.createElement("div",{className:"dvn-scroll-inner"+(z===void 0?" hidden":"")},ht.createElement("div",{className:"dvn-stack"},w),z!==void 0&&ht.createElement(ht.Fragment,null,!R&&ht.createElement("div",{className:"dvn-spacer"}),ht.createElement("div",{ref:F,style:{height:X1,maxHeight:l-Math.ceil(k%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:p,flexGrow:R?1:void 0,right:y?p??0:void 0,pointerEvents:"auto"}},z))))))},rE=V0("div")({name:"MinimapStyle",class:"m15w2ly5",propsAsIs:!1}),nE=t=>{var a,e,r;let{columns:n,rows:i,rowHeight:l,headerHeight:o,groupHeaderHeight:h,enableGroups:c,freezeColumns:v,experimental:g,clientSize:d,className:u,onVisibleRegionChanged:p,scrollToEnd:z,scrollRef:x,preventDiagonalScrolling:s,rightElement:f,rightElementProps:m,overscrollX:M,overscrollY:w,showMinimap:y=!1,initialSize:R,smoothScrollX:L=!1,smoothScrollY:V=!1,isDraggable:C}=t,{paddingRight:k,paddingBottom:b}=g??{},[F,_]=d,q=u0.useRef(),i1=u0.useRef(),t1=u0.useRef(),d1=u0.useRef(),O=u0.useMemo(()=>{let f1=Math.max(0,M??0);for(let W of n)f1+=W.width;return f1},[n,M]),e1=c?o+h:o;if(typeof l=="number")e1+=i*l;else for(let f1=0;f1{var f1,W,c1;if(U.current===void 0)return;let D={...U.current},I=0,A1=D.x<0?-D.x:0,N1=0,nt=0;D.x=D.x<0?0:D.x;let F1=0;for(let J1=0;J1=Bt+J1.width)I+=J1.width,nt++,N1++;else if(D.x>Bt)I+=J1.width,L?A1+=Bt-D.x:nt++,N1++;else if(D.x+D.width>Bt)I+=J1.width,N1++;else break}let h1=0,r1=0,u1=0;if(typeof l=="number")V?(r1=Math.floor(D.y/l),h1=r1*l-D.y):r1=Math.ceil(D.y/l),u1=Math.ceil(D.height/l)+r1,h1<0&&u1++;else{let J1=0;for(let Bt=0;Bt=J1+Gt)J1+=Gt,r1++,u1++;else if(D.y>Ut)J1+=Gt,V?h1+=Ut-D.y:r1++,u1++;else if(D.y+D.height>Gt/2+J1)J1+=Gt,u1++;else break}}let H1={x:nt,y:r1,width:N1-nt,height:u1-r1},O1=q.current;(O1===void 0||O1.y!==H1.y||O1.x!==H1.x||O1.height!==H1.height||O1.width!==H1.width||i1.current!==A1||t1.current!==h1||D.width!==((f1=d1.current)==null?void 0:f1[0])||D.height!==((W=d1.current)==null?void 0:W[1]))&&(p?.({x:nt,y:r1,width:N1-nt,height:u1-r1},D.width,D.height,(c1=D.paddingRight)!=null?c1:0,A1,h1),q.current=H1,i1.current=A1,t1.current=h1,d1.current=[D.width,D.height])},[n,l,i,p,v,L,V]),p1=u0.useCallback(f1=>{U.current=f1,V1()},[V1]);u0.useEffect(()=>{V1()},[V1]);let o1=(a=x?.current)!=null?a:void 0,x1=(0,Pz.default)(O/e1,2/3,1.5),I1=200,X1=x1>1?I1:Math.ceil(I1*x1),W1=x1>1?Math.ceil(I1/x1):I1,Ct=X1/O,P1=W1/e1,Y1=Math.min(F*Math.max(Ct,.01),X1),Z=Math.min(_*Math.max(P1,.01),W1),$=((e=o1?.scrollLeft)!=null?e:0)/(O-F)*(X1-Y1),s1=((r=o1?.scrollTop)!=null?r:0)/(e1-_)*(W1-Z),w1=u0.useMemo(()=>{if(!y||Y1===0||Z===0)return;let f1=W=>{if(o1===void 0)return;let c1=W.currentTarget.getBoundingClientRect(),D=W.clientX-c1.x-Y1/2,I=W.clientY-c1.y-Z/2,A1=(O-o1.clientWidth)*(D/(X1-Y1)),N1=(e1-o1.clientHeight)*(I/(W1-Z));o1.scrollTo({left:A1,top:N1,behavior:W.type==="mousemove"?"auto":"smooth"})};return u0.createElement(rE,{style:{width:X1,height:W1},"data-testid":"minimap-container",onMouseMove:W=>{W.buttons===1&&f1(W)},onClick:f1},u0.createElement("div",{className:"header"}),u0.createElement("div",{className:"locationMarker",onDragStart:W=>W.preventDefault(),style:{left:$,top:s1,width:Y1,height:Z,borderRadius:Math.min(Y1,Z*.2,9)}}))},[W1,e1,$,o1,y,s1,Z,Y1,X1,O]);return u0.createElement(eE,{scrollRef:x,minimap:w1,className:u,preventDiagonalScrolling:s,draggable:C===!0||typeof C=="string",scrollWidth:O+(k??0),scrollHeight:e1+(b??0),clientHeight:_,rightElement:f,paddingBottom:b,paddingRight:k,rightElementProps:m,update:p1,initialSize:R,scrollToEnd:z},u0.createElement(Qb,{eventTargetRef:x,width:F,height:_,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}))},iE=nE,lE=()=>t=>t.showSearch?0:400,oE=V0("div")({name:"SearchWrapper",class:"sxep88s",propsAsIs:!1,vars:{"sxep88s-0":[lE(),"px"]}}),hE=j1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},j1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),cE=j1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},j1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),vE=j1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},j1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),gE=10,dE=t=>{let{canvasRef:a,cellYOffset:e,rows:r,columns:n,searchInputRef:i,searchValue:l,searchResults:o,onSearchValueChange:h,getCellsForSelection:c,onSearchResultsChanged:v,showSearch:g=!1,onSearchClose:d}=t,[u]=j1.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[p,z]=j1.useState(""),x=l??p,s=j1.useCallback(O=>{z(O),h?.(O)},[h]),[f,m]=j1.useState(),M=j1.useRef(f);M.current=f,j1.useEffect(()=>{o!==void 0&&(o.length>0?m(O=>{var e1;return{rowsSearched:r,results:o.length,selectedIndex:(e1=O?.selectedIndex)!=null?e1:-1}}):m(void 0))},[r,o]);let w=j1.useRef(new AbortController),y=j1.useRef(),[R,L]=j1.useState([]),V=o??R,C=j1.useCallback(()=>{y.current!==void 0&&(window.cancelAnimationFrame(y.current),y.current=void 0,w.current.abort())},[]),k=j1.useRef(e);k.current=e;let b=j1.useCallback(O=>{let e1=new RegExp(O.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i"),U=k.current,V1=Math.min(10,r),p1=0;m(void 0),L([]);let o1=[],x1=async()=>{var I1,X1;if(c===void 0)return;let W1=performance.now(),Ct=r-p1,P1=c({x:0,y:U,width:n.length,height:Math.min(V1,Ct,r-U)},w.current.signal);typeof P1=="function"&&(P1=await P1());let Y1=!1;for(let[W,c1]of P1.entries())for(let[D,I]of c1.entries()){let A1;switch(I.kind){case M1.Text:case M1.Number:A1=I.displayData;break;case M1.Uri:case M1.Markdown:A1=I.data;break;case M1.Boolean:A1=typeof I.data=="boolean"?I.data.toString():void 0;break;case M1.Image:case M1.Bubble:A1=I.data.join("\u{1F433}");break;case M1.Custom:A1=I.copyData;break}A1!==void 0&&e1.test(A1)&&(o1.push([D,W+U]),Y1=!0)}let Z=performance.now();Y1&&L([...o1]),p1+=P1.length,l2(p1<=r);let $=(X1=(I1=M.current)==null?void 0:I1.selectedIndex)!=null?X1:-1;m({results:o1.length,rowsSearched:p1,selectedIndex:$}),v?.(o1,$),U+V1>=r?U=0:U+=V1;let s1=Z-W1,w1=Math.max(s1,1),f1=gE/w1;V1=Math.ceil(V1*f1),p1{var O;d?.(),m(void 0),L([]),v?.([],-1),C(),(O=a?.current)==null||O.focus()},[C,a,d,v]),_=j1.useCallback(O=>{s(O.target.value),o===void 0&&(O.target.value===""?(m(void 0),L([]),C()):b(O.target.value))},[b,C,s,o]);j1.useEffect(()=>{g&&i.current!==null&&(s(""),i.current.focus({preventScroll:!0}))},[g,i,s]);let q=j1.useCallback(O=>{var e1;if((e1=O?.stopPropagation)==null||e1.call(O),f===void 0)return;let U=(f.selectedIndex+1)%f.results;m({...f,selectedIndex:U}),v?.(V,U)},[f,v,V]),i1=j1.useCallback(O=>{var e1;if((e1=O?.stopPropagation)==null||e1.call(O),f===void 0)return;let U=(f.selectedIndex-1)%f.results;U<0&&(U+=f.results),m({...f,selectedIndex:U}),v?.(V,U)},[v,V,f]),t1=j1.useCallback(O=>{(O.ctrlKey||O.metaKey)&&O.nativeEvent.code==="KeyF"||O.key==="Escape"?(F(),O.stopPropagation(),O.preventDefault()):O.key==="Enter"&&(O.shiftKey?i1():q())},[F,q,i1]);j1.useEffect(()=>()=>{C()},[C]);let d1=j1.useMemo(()=>{var O,e1,U;let V1;f!==void 0&&(V1=f.results>=1e3?"over 1000":`${f.results} result${f.results!==1?"s":""}`,f.selectedIndex>=0&&(V1=`${f.selectedIndex+1} of ${V1}`));let p1=I1=>{I1.stopPropagation()},x1={width:`${Math.floor(((O=f?.rowsSearched)!=null?O:0)/r*100)}%`};return j1.createElement(oE,{showSearch:g,onMouseDown:p1,onMouseMove:p1,onMouseUp:p1,onClick:p1},j1.createElement("div",{className:"search-bar-inner"},j1.createElement("input",{id:u,"aria-hidden":!g,"data-testid":"search-input",ref:i,onChange:_,value:x,tabIndex:g?void 0:-1,onKeyDownCapture:t1}),j1.createElement("button",{"aria-label":"Previous Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:i1,disabled:((e1=f?.results)!=null?e1:0)===0},hE),j1.createElement("button",{"aria-label":"Next Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:q,disabled:((U=f?.results)!=null?U:0)===0},cE),d!==void 0&&j1.createElement("button",{"aria-label":"Close Search","aria-hidden":!g,"data-testid":"search-close-button",tabIndex:g?void 0:-1,onClick:F},vE)),f!==void 0?j1.createElement(j1.Fragment,null,j1.createElement("div",{className:"search-status"},j1.createElement("div",{"data-testid":"search-result-area"},V1)),j1.createElement("div",{className:"search-progress",style:x1})):j1.createElement("div",{className:"search-status"},j1.createElement("label",{htmlFor:u},"Type to search")))},[F,q,i1,_,d,t1,r,f,x,g,u,i]);return j1.createElement(j1.Fragment,null,j1.createElement(iE,{prelightCells:V,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,className:t.className,clientSize:t.clientSize,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,initialSize:t.initialSize,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,onVisibleRegionChanged:t.onVisibleRegionChanged,overscrollX:t.overscrollX,overscrollY:t.overscrollY,preventDiagonalScrolling:t.preventDiagonalScrolling,rightElement:t.rightElement,rightElementProps:t.rightElementProps,rowHeight:t.rowHeight,rows:t.rows,scrollRef:t.scrollRef,selection:t.selection,showMinimap:t.showMinimap,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,scrollToEnd:t.scrollToEnd}),d1)},sE=dE,uE=()=>t=>Math.max(16,t.targetHeight-10),fE=V0("input")({name:"RenameInput",class:"r1kzy40b",propsAsIs:!1,vars:{"r1kzy40b-0":[uE(),"px"]}}),pE=t=>{let{bounds:a,group:e,onClose:r,canvasBounds:n,onFinish:i}=t,[l,o]=R5.default.useState(e);return R5.default.createElement(az,{style:{position:"absolute",left:a.x-n.left+1,top:a.y-n.top,width:a.width-2,height:a.height},className:"c1sqdbw3",onClickOutside:r},R5.default.createElement(fE,{targetHeight:a.height,"data-testid":"group-rename-input",value:l,onBlur:r,onFocus:h=>h.target.setSelectionRange(0,l.length),onChange:h=>o(h.target.value),onKeyDown:h=>{h.key==="Enter"?i(l):h.key==="Escape"&&r()},autoFocus:!0}))},A8=150;function zE(t,a,e,r){var n,i;let l=r(a);return(i=(n=l?.measure)==null?void 0:n.call(l,t,a,e))!=null?i:A8}function Iz(t,a,e,r,n,i,l,o,h){let c=[];if(n!==void 0&&c.push(...n.map(d=>d[r]).map(d=>zE(t,d,a,h))),c.length>5&&o){let d=c.reduce((u,p)=>u+p)/c.length;c=c.filter(u=>u{if(typeof window>"u")return[null,null];let f=document.createElement("canvas");return f.style.display="none",f.style.opacity="0",f.style.position="fixed",[f,f.getContext("2d",{alpha:!1})]},[]);o2.useLayoutEffect(()=>(d&&document.documentElement.append(d),()=>{d?.remove()}),[d]);let p=o2.useRef({}),z=o2.useRef(),[x,s]=o2.useState();return o2.useLayoutEffect(()=>{let f=v.current;if(f===void 0||t.every(z5))return;let m=Math.max(1,10-Math.floor(t.length/1e4)),M=0;m1&&(m--,M=1);let w={x:0,y:0,width:t.length,height:Math.min(c.current,m)},y={x:0,y:c.current-1,width:t.length,height:1};(async()=>{let L=f(w,h.signal),V=M>0?f(y,h.signal):void 0,C;typeof L=="object"?C=L:C=await Sp(L),V!==void 0&&(typeof V=="object"?C=[...C,...V]:C=[...C,...await Sp(V)]),z.current=t,s(C)})()},[h.signal,t]),o2.useMemo(()=>{var f;let M=(()=>t.every(z5)?t:u===null?t.map(L=>z5(L)?L:{...L,width:A8}):(u.font=`${g.current.baseFontStyle} ${g.current.fontFamily}`,t.map((L,V)=>{if(z5(L))return L;if(p.current[L.id]!==void 0)return{...L,width:p.current[L.id]};if(x===void 0||z.current!==t||L.id===void 0)return{...L,width:A8};let C=Iz(u,l,L,V,x,n,i,!0,o);return p.current[L.id]=C.width,C})))(),w=0,y=0,R=[];for(let[L,V]of M.entries())w+=V.width,V.grow!==void 0&&V.grow>0&&(y+=V.grow,R.push(L));if(w0){let L=[...M],V=r-w,C=V;for(let k=0;k1&&t.startsWith("_")){if(Number.parseInt(t.slice(1))!==a.keyCode)return!1}else if(t!==a.key)return!1;return!0}function T0(t,a){if(t.length===0)return!1;let e=!1,r=!1,n=!1,i=!1,l=t.split("+"),o=l.pop();if(!ME(o,a))return!1;for(let h of l)switch(h){case"ctrl":e=!0;break;case"shift":r=!0;break;case"alt":n=!0;break;case"meta":i=!0;break;case"primary":V5.value?i=!0:e=!0;break}return a.altKey===n&&a.ctrlKey===e&&a.shiftKey===r&&a.metaKey===i}function HE(t,a,e,r,n,i){let l=y5.default.useCallback((c,v,g,d)=>{var u,p;(i==="cell"||i==="multi-cell")&&c!==void 0&&(c={...c,range:{x:c.cell[0],y:c.cell[1],width:1,height:1}});let z=e==="mixed"&&(g||d==="drag"),x=r==="mixed"&&z,s=n==="mixed"&&z,f={current:c===void 0?void 0:{...c,rangeStack:d==="drag"?(p=(u=t.current)==null?void 0:u.rangeStack)!=null?p:[]:[]},columns:x?t.columns:Lt.empty(),rows:s?t.rows:Lt.empty()};g&&(i==="multi-rect"||i==="multi-cell")&&f.current!==void 0&&t.current!==void 0&&(f={...f,current:{...f.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),a(f,v)},[r,t,e,i,n,a]),o=y5.default.useCallback((c,v,g)=>{c=c??t.rows,v!==void 0&&(c=c.add(v));let d;if(n==="exclusive"&&c.length>0)d={current:void 0,columns:Lt.empty(),rows:c};else{let u=g&&e==="mixed",p=g&&r==="mixed";d={current:u?t.current:void 0,columns:p?t.columns:Lt.empty(),rows:c}}a(d,!1)},[r,t,e,n,a]),h=y5.default.useCallback((c,v,g)=>{c=c??t.columns,v!==void 0&&(c=c.add(v));let d;if(r==="exclusive"&&c.length>0)d={current:void 0,rows:Lt.empty(),columns:c};else{let u=g&&e==="mixed",p=g&&n==="mixed";d={current:u?t.current:void 0,rows:p?t.rows:Lt.empty(),columns:c}}a(d,!1)},[r,t,e,n,a]);return[l,o,h]}function xE(t,a,e,r,n){let i=F8.useCallback(c=>{var v;if(t===!0){let g=[];for(let d=c.y;d=n?u.push({kind:M1.Loading,allowOverlay:!1}):u.push(a([p,d]));g.push(u)}return g}return(v=t?.(c,r.signal))!=null?v:[]},[r.signal,a,t,n]),l=t!==void 0?i:void 0,o=F8.useCallback(c=>{if(l===void 0)return[];let v={...c,x:c.x-e};if(v.x<0){v.x=0,v.width--;let g=l(v,r.signal);return typeof g=="function"?async()=>(await g()).map(d=>[{kind:M1.Loading,allowOverlay:!1},...d]):g.map(d=>[{kind:M1.Loading,allowOverlay:!1},...d])}return l(v,r.signal)},[r.signal,l,e]);return[t!==void 0?o:void 0,l]}function wE(t){var a,e;if(t.copyData!==void 0)return{formatted:t.copyData,rawValue:t.copyData,format:"string"};switch(t.kind){case M1.Boolean:return{formatted:t.data===!0?"TRUE":t.data===!1?"FALSE":t.data===E8?"INDETERMINATE":"",rawValue:t.data,format:"boolean"};case M1.Custom:return{formatted:t.copyData,rawValue:t.copyData,format:"string"};case M1.Image:case M1.Bubble:return{formatted:t.data,rawValue:t.data,format:"string-array"};case M1.Drilldown:return{formatted:t.data.map(r=>r.text),rawValue:t.data.map(r=>r.text),format:"string-array"};case M1.Text:return{formatted:(a=t.displayData)!=null?a:t.data,rawValue:t.data,format:"string"};case M1.Uri:return{formatted:(e=t.displayData)!=null?e:t.data,rawValue:t.data,format:"url"};case M1.Markdown:case M1.RowID:return{formatted:t.data,rawValue:t.data,format:"string"};case M1.Number:return{formatted:t.displayData,rawValue:t.data,format:"number"};case M1.Loading:return{formatted:"#LOADING",rawValue:"",format:"string"};case M1.Protected:return{formatted:"************",rawValue:"",format:"string"};default:Dn(t)}}function LE(t,a){return t.map((r,n)=>{let i=a[n];return r.map(l=>l.span!==void 0&&l.span[0]!==i?{formatted:"",rawValue:"",format:"string"}:wE(l))})}function Dp(t,a){return(a?/[\t\n",]/:/[\t\n"]/).test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}function VE(t){var a,e;let r=[];for(let n of t){let i=[];for(let l of n)l.format==="url"?i.push((e=(a=l.rawValue)==null?void 0:a.toString())!=null?e:""):l.format==="string-array"?i.push(l.formatted.map(o=>Dp(o,!0)).join(",")):i.push(Dp(l.formatted,!1));r.push(i.join(" "))}return r.join(`
+`},yb={headerRowID:Zk,headerNumber:tb,headerCode:Jk,headerString:ab,headerBoolean:eb,headerAudioUri:nb,headerVideoUri:ib,headerEmoji:lb,headerImage:ob,headerUri:yz,headerPhone:hb,headerMarkdown:cb,headerDate:vb,headerTime:gb,headerEmail:db,headerReference:sb,headerIfThenElse:ub,headerSingleValue:fb,headerLookup:pb,headerTextTemplate:zb,headerMath:mb,headerRollup:Mb,headerJoinStrings:Hb,headerSplitString:xb,headerGeoDistance:wb,headerArray:Lb,rowOwnerOverlay:Vb,protectedColumnOverlay:Rb,renameIcon:rb};function Cb(t,a){return t==="normal"?[a.bgIconHeader,a.fgIconHeader]:t==="selected"?["white",a.accentColor]:[a.accentColor,a.bgHeader]}var Bb=class{constructor(t,a){this.spriteMap=new Map,this.inFlight=0,this.onSettled=a,this.headerIcons={...yb,...t}}drawSprite(t,a,e,r,n,i,l,o=1){let[h,c]=Cb(a,l),v=i*Math.ceil(window.devicePixelRatio),g=`${h}_${c}_${v}_${t}`,d=this.spriteMap.get(g);if(d===void 0){let u=this.headerIcons[t];if(u===void 0)return;d=document.createElement("canvas");let p=d.getContext("2d");if(p===null)return;let z=new Image;z.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u({fgColor:c,bgColor:h}))}`,this.spriteMap.set(g,d);let x=z.decode();if(x===void 0)return;this.inFlight++,x.then(()=>{p.drawImage(z,0,0,v,v)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else o<1&&(e.globalAlpha=o),e.drawImage(d,0,0,v,v,r,n,i,i),o<1&&(e.globalAlpha=1)}},H8={},de=null;function Sb(){let t=document.createElement("div");return t.style.opacity="0",t.style.pointerEvents="none",t.style.position="fixed",document.body.append(t),t}function B8(t){let a=t.toLowerCase().trim();if(H8[a]!==void 0)return H8[a];de=de||Sb(),de.style.color="#000",de.style.color=a;let e=getComputedStyle(de).color;de.style.color="#fff",de.style.color=a;let r=getComputedStyle(de).color;if(r!==e)return[0,0,0,1];let n=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return n.length<4&&n.push(1),n=n.map(i=>{let l=Number.isNaN(i);return l&&console.warn("Could not parse color",t),l?0:i}),H8[a]=n,n}function er(t,a){let[e,r,n]=B8(t);return`rgba(${e}, ${r}, ${n}, ${a})`}function fe(t,a){if(a===void 0)return t;let[e,r,n,i]=B8(t);if(i===1)return t;let[l,o,h,c]=B8(a),v=i+c*(1-i),g=(i*e+c*l*(1-i))/v,d=(i*r+c*o*(1-i))/v,u=(i*n+c*h*(1-i))/v;return`rgba(${g}, ${d}, ${u}, ${v})`}var Ab={kind:m1.Loading,allowOverlay:!1};function Sz(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s,f,m){let M,w;p!==void 0&&p[0][0]===r&&p[0][1]===a&&(M=p[1][0],w=p[1][1]);let y,R={ctx:t,theme:c,col:r,row:a,cell:e,rect:{x:n,y:i,width:l,height:o},highlighted:h,hoverAmount:u,hoverX:M,hoverY:w,imageLoader:g,spriteManager:d,hyperWrapping:z,requestAnimationFrame:()=>{L=!0}},L=!1;return(Dk(R,e.lastUpdated,x,s,()=>{var C,k;if(!(ue(e)?!1:v?.(R)===!0)){let F=m(e);if(F!==void 0){s?.renderer!==F&&((C=s?.deprep)==null||C.call(s,R),s=void 0);let _=(k=F.drawPrep)==null?void 0:k.call(F,R,s);F.draw(R,e),y={deprep:_?.deprep,fillStyle:_?.fillStyle,font:_?.font,renderer:F}}}})||L)&&f?.([r,a]),y}function Fb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x){let s=[],f=!1;t.imageSmoothingEnabled=!1;let m=Math.min(e.cellYOffset,n),M=Math.max(e.cellYOffset,n),w=0;if(typeof z=="number")w+=(M-m)*z;else for(let F=m;Fe.cellYOffset&&(w=-w),w+=l-e.translateY;let y=Math.min(e.cellXOffset,r),R=Math.max(e.cellXOffset,r),L=0;for(let F=y;Fe.cellXOffset&&(L=-L),L+=i-e.translateX;let V=ar(p);if(V>0&&V++,L!==0&&w!==0)return{regions:[],yOnly:!1};let C=o?typeof z=="number"?z:z(v-1):0,k=h-V-Math.abs(L),b=c-g-C-Math.abs(w)-1;if(k>150&&b>150){f=L===0;let F={sx:0,sy:0,sw:h*d,sh:c*d,dx:0,dy:0,dw:h*d,dh:c*d};w>0?(F.sy=(g+1)*d,F.sh=b*d,F.dy=(w+g+1)*d,F.dh=b*d,s.push({x:0,y:g,width:h,height:w+1})):w<0&&(F.sy=(-w+g+1)*d,F.sh=b*d,F.dy=(g+1)*d,F.dh=b*d,s.push({x:0,y:c+w-C,width:h,height:-w+C})),L>0?(F.sx=V*d,F.sw=k*d,F.dx=(L+V)*d,F.dw=k*d,s.push({x:V-1,y:0,width:L+2,height:c})):L<0&&(F.sx=(V-L)*d,F.sw=k*d,F.dx=V*d,F.dw=k*d,s.push({x:h+L,y:0,width:-L,height:c})),t.setTransform(1,0,0,1,0,0),V>0&&L!==0&&w===0&&x&&t.drawImage(a,0,0,V*d,c*d,0,0,V*d,c*d),t.drawImage(a,F.sx,F.sy,F.sw,F.sh,F.dx,F.dy,F.dw,F.dh),t.scale(d,d)}return t.imageSmoothingEnabled=!0,{regions:s,yOnly:f}}function kb(t,a,e,r,n,i,l,o,h,c){let v=[];return a!==t.cellXOffset||e!==t.cellYOffset||r!==t.translateX||n!==t.translateY||Je(h,e,r,n,o,(g,d,u,p)=>{if(g.sourceIndex===c){let z=Math.max(d,p)+1;return v.push({x:z,y:0,width:i-z,height:l}),!0}}),v}function Tp(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s=!1){var f,m,M;if(h!==void 0){t.beginPath(),t.save(),t.rect(0,0,i,l);for(let t1 of h)t.rect(t1.x+1,t1.y+1,t1.width-1,t1.height-1);t.clip("evenodd")}let w=(f=x.horizontalBorderColor)!=null?f:x.borderColor,y=x.borderColor,R=0,L=i,V=0,C=l;if(o!==void 0&&o.length>0){R=Number.MAX_SAFE_INTEGER,V=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,C=Number.MIN_SAFE_INTEGER;for(let t1 of o)R=Math.min(R,t1.x-1),L=Math.max(L,t1.x+t1.width+1),V=Math.min(V,t1.y-1),C=Math.max(C,t1.y+t1.height+1)}let k=[];t.beginPath();let b=.5;for(let t1=0;t1=R&&O<=L&&u(t1+1)&&k.push({x1:O,y1:Math.max(c,V),x2:O,y2:Math.min(l,C),color:y})}let F=g(z-1),_=l-F+.5,q=p==="sticky";if(q&&k.push({x1:R,y1:_,x2:L,y2:_,color:w}),s!==!0){let t1=v+.5,d1=e,O=q?l-F:l;for(;t1+n<=O;){let e1=t1+n;if(e1>=V&&e1<=C-1&&(!q||d1!==z-1||Math.abs(e1-_)>1)){let U=d?.(d1);k.push({x1:R,y1:e1,x2:L,y2:e1,color:(M=(m=U?.horizontalBorderColor)!=null?m:U?.borderColor)!=null?M:w})}t1+=g(d1),d1++}}let i1=(0,Bz.default)(k,t1=>t1.color);for(let t1 of Object.keys(i1)){t.strokeStyle=t1;for(let d1 of i1[t1])t.moveTo(d1.x1,d1.y1),t.lineTo(d1.x2,d1.y2);t.stroke(),t.beginPath()}h!==void 0&&t.restore()}function Az(t,a){let e=[],r=t.x+t.width-26*a.length,n=t.y+t.height/2-13,i=26,l=26;for(let o=0;o=t.x&&a<=t.x+t.width&&e>=t.y&&e<=t.y+t.height}function bb(t,a,e,r,n,i,l,o,h,c,v,g){var d;let[p,z]=(d=i?.[0])!=null?d:[],x=0;_z(a,e,r,n,(s,f,m,M,w,y)=>{var R,L;if(g!==void 0&&!g.some(F=>F[1]===-2&&F[0]>=s[0]&&F[0]<=s[1]))return;t.save(),t.beginPath(),t.rect(m,M,w,y),t.clip();let V=v(f),C=V?.overrideTheme===void 0?l:{...l,...V.overrideTheme},k=z===-2&&p!==void 0&&p>=s[0]&&p<=s[1],b=k?C.bgHeaderHovered:C.bgHeader;if(b!==l.bgHeader&&(t.fillStyle=b,t.fill()),t.fillStyle=(R=C.textGroupHeader)!=null?R:C.textHeader,V!==void 0){let F=m;if(V.icon!==void 0&&(o.drawSprite(V.icon,"normal",t,F+8,(n-20)/2,20,C),F+=26),t.fillText(V.name,F+8,n/2+Ea(t,`${l.headerFontStyle} ${l.fontFamily}`)),V.actions!==void 0&&k){let _=Az({x:m,y:M,width:w,height:y},V.actions);t.beginPath();let q=_[0].x-10,i1=m+w-q;t.rect(q,0,i1,n);let t1=t.createLinearGradient(q,0,q+i1,0),d1=er(b,0);t1.addColorStop(0,d1),t1.addColorStop(10/i1,b),t1.addColorStop(1,b),t.fillStyle=t1,t.fill(),t.globalAlpha=.6;let[O,e1]=(L=i?.[1])!=null?L:[-1,-1];for(let U=0;U35){let R=z?35:r-35,L=z?35*.7:r-35*.7,V=R/r,C=L/r,k=t.createLinearGradient(a,0,a+r,0),b=er(f,0);k.addColorStop(z?1:0,f),k.addColorStop(V,f),k.addColorStop(C,b),k.addColorStop(z?0:1,b),t.fillStyle=k}else t.fillStyle=f;if(z&&(t.textAlign="right"),t.fillText(i.title,w,e+n/2+Ea(t,`${o.headerFontStyle} ${o.fontFamily}`)),z&&(t.textAlign="left"),m&&i.hasMenu===!0){t.beginPath();let y=x.x+x.width/2-5.5,R=x.y+x.height/2-3;Qk(t,[{x:y,y:R},{x:y+11,y:R},{x:y+5.5,y:R+6}],1),t.fillStyle=f,t.fill()}}function Eb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s,f){var m;let M=l+o;if(M<=0)return;t.fillStyle=g.bgHeader,t.fillRect(0,0,n,M);let[w,y]=(m=r?.[0])!=null?m:[],R=`${g.headerFontStyle} ${g.fontFamily}`;t.font=R,Je(a,0,i,0,M,(L,V,C,k)=>{var b,F,_;if(x!==void 0&&!x.some(X1=>X1[1]===-1&&X1[0]===L.sourceIndex))return;let q=Math.max(0,k-V);t.save(),t.beginPath(),t.rect(V+q,o,L.width-q,l),t.clip();let i1=z((b=L.group)!=null?b:"").overrideTheme,t1=L.themeOverride===void 0&&i1===void 0?g:{...g,...i1,...L.themeOverride};t1.bgHeader!==g.bgHeader&&(t.fillStyle=t1.bgHeader,t.fill());let d1=`${t1.headerFontStyle} ${t1.fontFamily}`;R!==d1&&(t.font=d1);let O=v.columns.hasIndex(L.sourceIndex),e1=h!==void 0||c,U=!e1&&y===-1&&w===L.sourceIndex,V1=e1?0:(_=(F=u.find(X1=>X1.item[0]===L.sourceIndex&&X1.item[1]===-1))==null?void 0:F.hoverAmount)!=null?_:0,p1=v?.current!==void 0&&v.current.cell[0]===L.sourceIndex,o1=O?t1.accentColor:p1?t1.bgHeaderHasFocus:t1.bgHeader,x1=e?o:0,I1=L.sourceIndex===0?0:1;O?(t.fillStyle=o1,t.fillRect(V+I1,x1,L.width-I1,l)):(p1||V1>0)&&(t.beginPath(),t.rect(V+I1,x1,L.width-I1,l),p1&&(t.fillStyle=t1.bgHeaderHasFocus,t.fill()),V1>0&&(t.globalAlpha=V1,t.fillStyle=t1.bgHeaderHovered,t.fill(),t.globalAlpha=1)),bz(t,V,x1,L.width,l,L,O,t1,U,p1,V1,d,s,f),t.restore()}),e&&bb(t,a,n,i,o,r,g,d,u,p,z,x)}function ze(t,a,e,r,n,i,l,o){return t<=n+l&&n<=t+e&&a<=i+o&&i<=a+r}function Pp(t,a,e,r,n,i,l,o,h,c,v,g,d,u){if(d===void 0||d.length===0)return;let p=g==="sticky"?v(c-1):0;t.beginPath(),_z(a,e,l,n,(z,x,s,f,m,M)=>{for(let w=0;w=z[0]&&y[0]<=z[1]){t.rect(s,f,m,M);break}}}),Je(a,h,l,o,i,(z,x,s,f,m)=>{let M=Math.max(0,f-x),w=x+M+1,y=z.width-M-1;for(let R=0;R{let k=!1;for(let b=0;b0&&t.rect(w,b,y,_)}})}),t.clip()}function Ez(t,a,e,r,n,i,l){var o,h;let[c,v]=t,g,d,u=(h=(o=l.find(p=>!p.sticky))==null?void 0:o.sourceIndex)!=null?h:0;if(v>u){let p=Math.max(c,u),z=a,x=r;for(let s=i.sourceIndex-1;s>=p;s--)z-=l[s].width,x+=l[s].width;for(let s=i.sourceIndex+1;s<=v;s++)x+=l[s].width;d={x:z,y:e,width:x,height:n}}if(u>c){let p=Math.min(v,u-1),z=a,x=r;for(let s=i.sourceIndex-1;s>=c;s--)z-=l[s].width,x+=l[s].width;for(let s=i.sourceIndex+1;s<=p;s++)x+=l[s].width;g={x:z,y:e,width:x,height:n}}return[g,d]}function Ip(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s,f,m,M,w,y,R,L,V,C,k,b,F,_){var q;let i1=(q=f?.length)!=null?q:Number.MAX_SAFE_INTEGER,t1=performance.now(),d1=`${b.baseFontStyle} ${b.fontFamily}`;t.font=d1;let O,e1=new Set;return Je(a,o,i,l,n,(U,V1,p1,o1,x1)=>{var I1;let X1=Math.max(0,o1-V1),W1=V1+X1,Ct=n+1,P1=U.width-X1,Y1=r-n-1;if(s.length>0){let c1=!1;for(let D=0;D{t.save(),t.beginPath(),t.rect(W1,Ct,P1,Y1),t.clip()},$=m.columns.hasIndex(U.sourceIndex),s1=g((I1=U.group)!=null?I1:"").overrideTheme,w1=U.themeOverride===void 0&&s1===void 0?b:{...b,...s1,...U.themeOverride},f1=`${w1.baseFontStyle} ${w1.fontFamily}`;f1!==d1&&(d1=f1,t.font=f1),Z();let W;return jn(x1,p1,r,h,c,x,(c1,D,I,A1,N1)=>{var nt,F1,h1,r1;if(D<0)return;if(f!==void 0){let st=!1;for(let St=0;St0){let st=!1;for(let St=0;StO1.span!==void 0&&st>=O1.span[0]&&st<=O1.span[1]);Mt&&!p&&z?B0=0:Mt&&(B0=Math.max(B0,1)),Z0&&B0++,Mt||(u1&&B0++,$&&!A1&&B0++);let S0=O1.kind===m1.Protected?at.bgCellMedium:at.bgCell,r0;if((A1||S0!==b.bgCell)&&(r0=fe(S0,r0)),B0>0||H1){H1&&(r0=fe(at.bgHeader,r0));for(let st=0;stst[0]===U.sourceIndex&&st[1]===D)===!0&&(r0=fe(at.bgSearchResult,r0));if(w!==void 0)for(let st of w){let St=st.range;St.x<=U.sourceIndex&&U.sourceIndexst.item[0]===U.sourceIndex&&st.item[1]===D);if(Bt>10&&!Ut){let st=`${at.baseFontStyle} ${at.fontFamily}`;st!==d1&&(t.font=st,d1=st),W=Sz(t,D,O1,U.sourceIndex,J1,c1,Bt,I,B0>0,at,y,R,L,(h1=ua?.hoverAmount)!=null?h1:0,C,k,t1,W,F,_)}return O1.style==="faded"&&(t.globalAlpha=1),i1--,Gt&&(t.restore(),(r1=W?.deprep)==null||r1.call(W,{ctx:t}),W=void 0,Z(),d1=f1,t.font=f1),i1<=0}),t.restore(),i1<=0}),O}function _b(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,x,s){x!==void 0||a[a.length-1]!==e[a.length-1]||Je(a,h,l,o,i,(f,m,M,w,y)=>{if(f!==a[a.length-1])return;m+=f.width;let R=Math.max(m,w);R>r||(t.save(),t.beginPath(),t.rect(R,i+1,1e4,n-i-1),t.clip(),jn(y,M,n,c,v,p,(L,V,C,k)=>{if(!k&&z.length>0&&!z.some(i1=>ze(m,L,1e4,C,i1.x,i1.y,i1.width,i1.height)))return;let b=d.hasIndex(V),F=u.hasIndex(V);t.beginPath();let _=g?.(V),q=_===void 0?s:{...s,..._};q.bgCell!==s.bgCell&&(t.fillStyle=q.bgCell,t.fillRect(m,L,1e4,C)),F&&(t.fillStyle=q.bgHeader,t.fillRect(m,L,1e4,C)),b&&(t.fillStyle=q.accentLight,t.fillRect(m,L,1e4,C))}),t.restore())})}function Tb(t,a,e,r,n,i,l,o,h){var c;let v=!1;for(let p of a)if(!p.sticky){v=l(p.sourceIndex);break}let g=(c=h.horizontalBorderColor)!=null?c:h.borderColor,d=h.borderColor,u=v?ar(a):0;if(u!==0&&(t.beginPath(),t.moveTo(u+.5,0),t.lineTo(u+.5,r),t.strokeStyle=fe(d,h.bgCell),t.stroke()),n){let p=o(i-1);t.beginPath(),t.moveTo(0,r-p+.5),t.lineTo(e,r-p+.5),t.strokeStyle=fe(g,h.bgCell),t.stroke()}}function Pb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p){let z=p?.filter(m=>m.style!=="no-outline");if(z===void 0||z.length===0)return;let x=z.map(m=>{var M,w,y,R,L;let V=m.range,C=Pn(V.x,V.y,a,e,v,c+v,r,n,i,l,u,h,d,o,g);if(V.width===1&&V.height===1)return V.x=h){let b=Pn(h-1,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g),F=Pn(h,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g);return[{color:m.color,style:(y=m.style)!=null?y:"dashed",rect:{x:C.x,y:C.y,width:b.x+b.width-C.x,height:b.y+b.height-C.y}},{color:m.color,style:(R=m.style)!=null?R:"dashed",rect:{x:F.x,y:F.y,width:k.x+k.width-F.x,height:k.y+k.height-F.y}}]}else return[void 0,{color:m.color,style:(L=m.style)!=null?L:"dashed",rect:{x:C.x,y:C.y,width:k.x+k.width-C.x,height:k.y+k.height-C.y}}]}),s=ar(o),f=()=>{t.beginPath(),t.save();let m=!1,M=y=>{m!==y&&(t.setLineDash(y?[5,3]:[]),m=y)};t.lineWidth=1;for(let y of x){let[R]=y;R!==void 0&&ze(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(M(R.style==="dashed"),t.strokeStyle=er(R.color,1),t.strokeRect(R.rect.x+1,R.rect.y+1,R.rect.width-2,R.rect.height-2))}let w=!1;for(let y of x){let[,R]=y;R!==void 0&&ze(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(M(R.style==="dashed"),!w&&R.rect.x{var C;return V.sourceIndex===((C=v.current)==null?void 0:C.cell[0])}))return;let[s,f]=v.current.cell,m=d(v.current.cell),M=(x=m.span)!=null?x:[s,s],w=u==="sticky"&&f===z-1,y=u==="sticky"&&!w?g(z-1)-1:0,R;if(Je(l,r,n,i,c,(V,C,k,b,F)=>{if(!(V.sticky&&s>V.sourceIndex)&&!(V.sourceIndexM[1]))return jn(F,k,e,z,g,u,(_,q,i1)=>{if(q!==f)return;let t1=C,d1=V.width;if(m.span!==void 0){let O=Ez(m.span,C,_,V.width,i1,V,o),e1=V.sticky?O[0]:O[1];e1!==void 0&&(t1=e1.x,d1=e1.width)}return R=()=>{var O,e1,U,V1;b>t1&&!V.sticky&&(t.beginPath(),t.rect(b,0,a-b,e),t.clip()),t.beginPath(),t.rect(t1+.5,_+.5,d1,i1),t.strokeStyle=(e1=(O=V.themeOverride)==null?void 0:O.accentColor)!=null?e1:h.accentColor,t.lineWidth=1,t.stroke(),p&&(t.beginPath(),t.rect(t1+d1-4,_+i1-4,4,4),t.fillStyle=(V1=(U=V.themeOverride)==null?void 0:U.accentColor)!=null?V1:h.accentColor,t.fill())},!0}),!0}),R===void 0)return;let L=()=>{t.save(),t.beginPath(),t.rect(0,c,a,e-c-y),t.clip(),R?.(),t.restore()};return L(),L}function Ib(t,a,e,r,n,i,l,o,h){let c=0;return Je(t,i,r,n,e,(v,g,d,u,p)=>(jn(p,d,a,l,o,h,(z,x,s,f)=>{f||(c=Math.max(x,c))}),!0)),c}function Ob(t,a){if(a===void 0||t.width!==a.width||t.height!==a.height||t.theme!==a.theme||t.headerHeight!==a.headerHeight||t.rowHeight!==a.rowHeight||t.rows!==a.rows||t.getRowThemeOverride!==a.getRowThemeOverride||t.isFocused!==a.isFocused||t.isResizing!==a.isResizing||t.verticalBorder!==a.verticalBorder||t.getCellContent!==a.getCellContent||t.highlightRegions!==a.highlightRegions||t.selection!==a.selection||t.dragAndDropState!==a.dragAndDropState||t.prelightCells!==a.prelightCells||t.touchMode!==a.touchMode||t.scrolling!==a.scrolling)return!1;if(t.mappedColumns!==a.mappedColumns){if(t.mappedColumns.length>100||t.mappedColumns.length!==a.mappedColumns.length)return!1;let e;for(let r=0;rw:w;N1.save(),N1.beginPath(),F1.save(),F1.beginPath(),N1.textBaseline="middle",F1.textBaseline="middle",w1!==1&&(N1.scale(w1,w1),F1.scale(w1,w1));let u1=y8(d,h,l,z,v),H1=[],O1=s&&((r=L.current)==null?void 0:r.cell[1])===c&&g===0,J1=()=>{var ct,at;Eb(N1,u1,u,o1,l,v,f,m,z,R,L,x,x1,V1,y,F,$,t1,X1),Tp(N1,u1,c,v,g,l,o,void 0,void 0,m,c1,r1,_,y,C,k,x,!0),N1.beginPath(),N1.moveTo(0,D-.5),N1.lineTo(l,D-.5),N1.strokeStyle=fe((at=(ct=x.headerBottomBorderColor)!=null?ct:x.horizontalBorderColor)!=null?at:x.borderColor,x.bgHeader),N1.stroke(),O1&&x8(N1,l,o,c,v,g,u1,d,x,c1,L,r1,b,C,V,k)};if($!==void 0){let ct=!1;$=$.filter(at=>(ct=ct||at[1]<0,at[1]<0||ze(h,c,u1.length,300,at[0],at[1],1,1)||ze(0,c,p,300,at[0],at[1],1,1)||C&&ze(h,k-1,u1.length,1,at[0],at[1],1,1))),$.length>0&&(Pp(F1,u1,l,o,m,c1,v,g,c,k,r1,C,$,!0),F1.fillStyle=x.bgCell,F1.fillRect(0,c1+1,l,o-c1-1),Ip(F1,u1,d,o,c1,v,g,c,k,r1,b,F,_,M,q,s,C,H1,$,L,d1,O,i1,e1,x1,V1,o1,p1,x,W1,Ct),V&&s&&L.current!==void 0&&$.some(at=>{var e0,Mt;return at[0]===((e0=L.current)==null?void 0:e0.cell[0])&&at[1]===((Mt=L.current)==null?void 0:Mt.cell[1])})&&x8(F1,l,o,c,v,g,u1,d,x,c1,L,r1,b,C,V,k)),ct&&(Pp(N1,u1,l,c1,m,c1,v,g,c,k,r1,C,$,!1),J1()),F1.restore(),N1.restore(),A1!==null&&(A1.fillStyle=x.bgCell,A1.fillRect(0,0,l,o),A1.drawImage(F1.canvas,0,0));return}if((f1!==!0||h!==I?.cellXOffset||v!==I?.translateX||O1!==I?.mustDrawFocusOnHeader)&&J1(),f1===!0){l2(h1!==void 0&&I!==void 0);let{regions:ct}=Fb(F1,h1,I,h,c,v,g,C==="sticky",l,o,k,c1,w1,d,u1,w,s1);H1=ct}else f1!==!1&&(l2(I!==void 0),H1=kb(I,h,c,v,g,l,o,c1,u1,f1));Tb(F1,u1,l,o,C==="sticky",k,y,r1,x);let Bt=s?x8(F1,l,o,c,v,g,u1,d,x,c1,L,r1,b,C,V,k):void 0,Gt=Pb(F1,l,o,h,c,v,g,d,p,f,m,w,C==="sticky",k,O);if(F1.fillStyle=x.bgCell,H1.length>0){F1.beginPath();for(let ct of H1)F1.rect(ct.x,ct.y,ct.width,ct.height);F1.clip(),F1.fill(),F1.beginPath()}else F1.fillRect(0,0,l,o);let Ut=Ip(F1,u1,d,o,c1,v,g,c,k,r1,b,F,_,M,q,s,C,H1,$,L,d1,O,i1,e1,x1,V1,o1,p1,x,W1,Ct);_b(F1,u1,d,l,o,c1,v,g,c,k,r1,_,L.rows,M,C,H1,$,x),Tp(F1,u1,c,v,g,l,o,H1,Ut,m,c1,r1,_,y,C,k,x),Bt?.(),Gt?.(),A1!==null&&(A1.fillStyle=x.bgCell,A1.fillRect(0,0,l,o),A1.drawImage(F1.canvas,0,0));let Tt=Ib(u1,o,c1,v,g,c,k,r1,C);e1?.setWindow({x:h,y:c,width:u1.length,height:Tt-c},p),U.current={cellXOffset:h,cellYOffset:c,translateX:v,translateY:g,mustDrawFocusOnHeader:O1,lastBuffer:s1?nt===Y1?"a":"b":void 0},F1.restore(),N1.restore()}function jn(t,a,e,r,n,i,l){let o=a,h=t,c=i==="sticky";for(;o=e;v&&(c=!1,h=r-1);let g=n(h);if(v&&(o=e-g),!(c&&h===r-1)&&l(o,h,g,v,i!=="none"&&h===r-1)===!0||v)break;o+=g,h++}}function Je(t,a,e,r,n,i){let l=0,o=0,h=n+r;for(let c of t){let v=c.sticky?o:l+e;if(i(c,v,h,o,a)===!0)break;l+=c.width,o+=c.sticky?c.width:0}}function _z(t,a,e,r,n){var i;let l=0,o=0;for(let h=0;ha?.[0]===e?.[0]&&a?.[1]===e?.[1],this.addToLeavingItems=a=>{this.leavingItems.some(r=>this.areSameItems(r.item,a.item))||this.leavingItems.push(a)},this.removeFromLeavingItems=a=>{var e;let r=this.leavingItems.find(n=>this.areSameItems(n.item,a));return this.leavingItems=this.leavingItems.filter(n=>n!==r),(e=r?.hoverAmount)!=null?e:0},this.cleanUpLeavingElements=()=>{this.leavingItems=this.leavingItems.filter(a=>a.hoverAmount>0)},this.shouldStep=()=>{let a=this.leavingItems.length>0,e=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return a||e},this.getAnimatingItems=()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(a=>({...a,hoverAmount:Nb(a.hoverAmount)})),this.step=a=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=a;else{let r=(a-this.lastAnimationTime)/Db;for(let i of this.leavingItems)i.hoverAmount=(0,S8.default)(i.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=(0,S8.default)(this.currentHoveredItem.hoverAmount+r,0,1));let n=this.getAnimatingItems();this.callback(n),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=a,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0},this.setHovered=a=>{var e;if(!this.areSameItems((e=this.currentHoveredItem)==null?void 0:e.item,a)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),a!==void 0){let r=this.removeFromLeavingItems(a);this.currentHoveredItem={item:a,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}},this.callback=t}},Wb=class{constructor(t){this.fn=t}get value(){var t;return(t=this.val)!=null?t:this.val=this.fn()}};function D8(t){return new Wb(t)}var Ub=D8(()=>window.navigator.userAgent.includes("Firefox")),Tz=D8(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),V5=D8(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function jb(t,a){for(let e of t)if(e[0]===a[0]&&e[1]===a[1])return!0;return!1}function qb(t){let a=Qe.useRef([]),e=Qe.useRef(0),r=Qe.useRef(t);r.current=t;let n=Qe.useCallback(()=>{let i=()=>window.requestAnimationFrame(l),l=()=>{let o=a.current;a.current=[],r.current(o),a.current.length>0?e.current++:e.current=0};window.requestAnimationFrame(e.current>600?i:l)},[]);return Qe.useCallback(i=>{jb(a.current,i)||(a.current.length===0&&n(),a.current.push(i))},[n])}var Gb=(t,a)=>{var e;if(t.kind===m1.Custom)return t.copyData;let r=a?.(t);return(e=r?.getAccessibilityString(t))!=null?e:""},Kb=(t,a)=>{var e,r,n,i,l,o,h,c;let{width:v,height:g,accessibilityHeight:d,columns:u,cellXOffset:p,cellYOffset:z,headerHeight:x,fillHandle:s=!1,groupHeaderHeight:f,rowHeight:m,rows:M,getCellContent:w,getRowThemeOverride:y,onHeaderMenuClick:R,enableGroups:L,isFilling:V,onCanvasFocused:C,onCanvasBlur:k,isFocused:b,selection:F,freezeColumns:_,onContextMenu:q,trailingRowType:i1,fixedShadowX:t1=!0,fixedShadowY:d1=!0,drawFocusRing:O=!0,onMouseDown:e1,onMouseUp:U,onMouseMoveRaw:V1,onMouseMove:p1,onItemHovered:o1,dragAndDropState:x1,firstColAccessible:I1,onKeyDown:X1,onKeyUp:W1,highlightRegions:Ct,canvasRef:P1,onDragStart:Y1,onDragEnd:Z,eventTargetRef:$,isResizing:s1,isDragging:w1,isDraggable:f1=!1,allowResize:W,disabledRows:c1,getGroupDetails:D,theme:I,prelightCells:A1,headerIcons:N1,verticalBorder:nt,drawHeader:F1,drawCustomCell:h1,onCellFocused:r1,onDragOverCell:u1,onDrop:H1,onDragLeave:O1,imageWindowLoader:J1,smoothScrollX:Bt=!1,smoothScrollY:Gt=!1,experimental:Ut,getCellRenderer:Tt}=t,ct=(e=t.translateX)!=null?e:0,at=(r=t.translateY)!=null?r:0,e0=Math.max(_,Math.min(u.length-1,p)),Mt=n1.useRef(null),B0=n1.useMemo(()=>new Vk,[]),Z0=J1??B0,S0=n1.useRef(),[r0,ua]=n1.useState(!1),st=n1.useRef([]),St=n1.useRef(),[c0,wt]=n1.useState(),[kt,Kt]=n1.useState(),c2=n1.useRef(null),[v2,_a]=n1.useState(!1),T2=n1.useRef(v2);T2.current=v2;let q0=n1.useMemo(()=>new Bb(N1,()=>{na.current=void 0,Le.current()}),[N1]),g2=L?f+x:x,P2=n1.useRef(-1),Gn=Ut?.enableFirefoxRescaling!==!0;n1.useLayoutEffect(()=>{!Ub.value||window.devicePixelRatio===1||Gn||(P2.current!==-1&&ua(!0),window.clearTimeout(P2.current),P2.current=window.setTimeout(()=>{ua(!1),P2.current=-1},200))},[z,e0,ct,at,Gn]);let p0=Fk(u,_),Ht=n1.useCallback((S,X,b1)=>{let z1=S.getBoundingClientRect();if(X>=p0.length||b1>=M)return;let E1=z1.width/v,l1=Pn(X,b1,v,g,f,g2,e0,z,ct,at,M,_,i1==="sticky",p0,m);return E1!==1&&(l1.x*=E1,l1.y*=E1,l1.width*=E1,l1.height*=E1),l1.x+=z1.x,l1.y+=z1.y,l1},[v,g,f,g2,e0,z,ct,at,M,_,i1,p0,m]),M0=n1.useCallback((S,X,b1,z1)=>{var E1,l1;let q1=S.getBoundingClientRect(),ut=q1.width/v,C1=(X-q1.left)/ut,B1=(b1-q1.top)/ut,d0=5,vt=y8(p0,e0,v,void 0,ct),xt=0;z1 instanceof MouseEvent&&(xt=z1.button);let mt=Ek(C1,vt,ct),lt=_k(B1,g,L,x,f,M,m,z,at,i1==="sticky"),bt=z1?.shiftKey===!0,t2=z1?.ctrlKey===!0,jt=z1?.metaKey===!0,R2=z1!==void 0&&!(z1 instanceof MouseEvent)||z1?.pointerType==="touch",I2=20,y2=[Math.abs(C1)v||B1>g){let G1=C1>v?-1:C1<0?1:0,Xt=B1>g?1:B1<0?-1:0,Yt=!1;if(mt===-1&<===-1){let ur=Ht(S,p0.length-1,-1);l2(ur!==void 0),Yt=Xv&&C1g&&B1=0?(Xt=!0,G1=Ht(S,Yt,lt),l2(G1!==void 0),s2={kind:L&<===-2?x2:se,location:[Yt,lt],bounds:G1,group:(E1=p0[Yt].group)!=null?E1:"",isEdge:Xt,shiftKey:bt,ctrlKey:t2,metaKey:jt,isTouch:R2,localEventX:X-G1.x,localEventY:b1-G1.y,button:xt,scrollEdge:y2}):s2={kind:L&<===-2?x2:se,group:(l1=p0[mt].group)!=null?l1:"",location:[mt,lt],bounds:G1,isEdge:Xt,shiftKey:bt,ctrlKey:t2,metaKey:jt,isTouch:R2,localEventX:X-G1.x,localEventY:b1-G1.y,button:xt,scrollEdge:y2}}else{let G1=Ht(S,mt,lt);l2(G1!==void 0);let Xt=G1!==void 0&&G1.x+G1.width-X{}),hr=n1.useRef(c0);hr.current=c0;let[xe,we]=n1.useMemo(()=>{let S=document.createElement("canvas"),X=document.createElement("canvas");return S.style.display="none",S.style.opacity="0",S.style.position="fixed",X.style.display="none",X.style.opacity="0",X.style.position="fixed",[S,X]},[]);n1.useLayoutEffect(()=>(document.documentElement.append(xe),document.documentElement.append(we),()=>{xe.remove(),we.remove()}),[xe,we]);let na=n1.useRef(),t4=n1.useCallback(()=>{var S,X;let b1=Mt.current,z1=c2.current;if(b1===null||z1===null)return;let E1=na.current,l1={canvas:b1,bufferA:xe,bufferB:we,headerCanvas:z1,width:v,height:g,cellXOffset:e0,cellYOffset:z,translateX:Math.round(ct),translateY:Math.round(at),mappedColumns:p0,enableGroups:L,freezeColumns:_,dragAndDropState:x1,theme:I,headerHeight:x,groupHeaderHeight:f,disabledRows:c1??Lt.empty(),rowHeight:m,verticalBorder:nt,isResizing:s1,isFocused:b,selection:F,fillHandle:s,lastRowSticky:i1,rows:M,drawFocus:O,getCellContent:w,getGroupDetails:D??(q1=>({name:q1})),getRowThemeOverride:y,drawCustomCell:h1,drawHeaderCallback:F1,prelightCells:A1,highlightRegions:Ct,imageLoader:Z0,lastBlitData:St,damage:S0.current,hoverValues:st.current,hoverInfo:hr.current,spriteManager:q0,scrolling:r0,hyperWrapping:(S=Ut?.hyperWrapping)!=null?S:!1,touchMode:v2,enqueue:Kn.current,renderStrategy:(X=Ut?.renderStrategy)!=null?X:Tz.value?"double-buffer":"single-buffer",getCellRenderer:Tt};l1.damage===void 0?(na.current=l1,Op(l1,E1)):Op(l1,void 0)},[xe,we,v,g,e0,z,ct,at,p0,L,_,x1,I,x,f,c1,m,nt,s1,b,F,s,i1,M,O,w,D,y,h1,F1,A1,Ct,Z0,q0,r0,Ut?.hyperWrapping,Ut?.renderStrategy,v2,Tt]),Le=n1.useRef(t4);n1.useLayoutEffect(()=>{t4(),Le.current=t4},[t4]),n1.useLayoutEffect(()=>{(async()=>{var X;((X=document?.fonts)==null?void 0:X.ready)!==void 0&&(await document.fonts.ready,na.current=void 0,Le.current())})()},[]);let fa=n1.useCallback(S=>{S0.current=S,Le.current(),S0.current=void 0},[]),P5=qb(fa);Kn.current=P5;let Xn=n1.useCallback(S=>{fa(S.map(X=>X.cell))},[fa]);Z0.setCallback(fa);let[I5,Yn]=n1.useState(!1),[a4,Ve]=ra??[],O5=a4!==void 0&&Ve===-1,D5=a4!==void 0&&Ve===-2,cr=!1,Qn=!1,vr;if(a4!==void 0&&Ve!==void 0&&Ve>-1){let S=w([a4,Ve],!0);cr=S.kind===ta.NewRow||S.kind===ta.Marker&&S.markerKind!=="number",Qn=S.kind===m1.Boolean&&V8(S),vr=S.cursor}let pa=w1?"grabbing":(kt??!1)||s1?"col-resize":I5||V?"crosshair":vr!==void 0?vr:O5||cr||Qn||D5?"pointer":"default",Ta=n1.useMemo(()=>({contain:"strict",display:"block",cursor:pa}),[pa]),Zn=n1.useRef("default"),Jn=$?.current;Jn!=null&&Zn.current!==Ta.cursor&&(Jn.style.cursor=Zn.current=Ta.cursor);let za=n1.useCallback((S,X,b1,z1)=>{if(D===void 0)return;let E1=D(S);if(E1.actions!==void 0){let l1=Az(X,E1.actions);for(let[q1,ut]of l1.entries())if(Fz(ut,b1+X.x,z1+ut.y))return E1.actions[q1]}},[D]),Pa=n1.useCallback((S,X,b1,z1)=>{let E1=u[X];if(!w1&&!s1&&E1.hasMenu===!0&&!(kt??!1)){let l1=Ht(S,X,-1);l2(l1!==void 0);let q1=kz(l1.x,l1.y,l1.width,l1.height,P8(E1.title)==="rtl");if(b1>q1.x&&b1q1.y&&z1{let X=Mt.current,b1=$?.current;if(X===null||S.target!==X&&S.target!==b1)return;e4.current=!0;let z1,E1;if(S instanceof MouseEvent?(z1=S.clientX,E1=S.clientY):(z1=S.touches[0].clientX,E1=S.touches[0].clientY),S.target===b1&&b1!==null){let q1=b1.getBoundingClientRect();if(z1>q1.right||E1>q1.bottom)return}let l1=M0(X,z1,E1,S);ma.current=l1.location,l1.isTouch&&(H0.current=Date.now()),T2.current!==l1.isTouch&&_a(l1.isTouch),!(l1.kind===se&&Pa(X,l1.location[0],z1,E1)!==void 0)&&(l1.kind===x2&&za(l1.group,l1.bounds,l1.localEventX,l1.localEventY)!==void 0||(e1?.(l1),!l1.isTouch&&f1!==!0&&f1!==l1.kind&&S.preventDefault()))},[$,f1,M0,za,Pa,e1]);P0("touchstart",gr,window,!1),P0("mousedown",gr,window,!1);let ti=n1.useCallback(S=>{var X,b1;let z1=Mt.current;if(e4.current=!1,U===void 0||z1===null)return;let E1=$?.current,l1=S.target!==z1&&S.target!==E1,q1,ut;if(S instanceof MouseEvent){if(q1=S.clientX,ut=S.clientY,S.pointerType==="touch")return}else q1=S.changedTouches[0].clientX,ut=S.changedTouches[0].clientY;let C1=M0(z1,q1,ut,S);C1.isTouch&&H0.current!==0&&Date.now()-H0.current>500&&(C1={...C1,isLongTouch:!0}),T2.current!==C1.isTouch&&_a(C1.isTouch),!l1&&S.cancelable&&S.preventDefault();let[B1]=C1.location,d0=Pa(z1,B1,q1,ut);if(C1.kind===se&&d0!==void 0){(C1.button!==0||((X=ma.current)==null?void 0:X[0])!==B1||((b1=ma.current)==null?void 0:b1[1])!==-1)&&U(C1,!0);return}else if(C1.kind===x2){let vt=za(C1.group,C1.bounds,C1.localEventX,C1.localEventY);if(vt!==void 0){C1.button===0&&vt.onClick(C1);return}}U(C1,l1)},[U,$,M0,Pa,za]);P0("mouseup",ti,window,!1),P0("touchend",ti,window,!1);let N5=n1.useCallback(S=>{var X,b1;let z1=Mt.current;if(z1===null)return;let E1=$?.current,l1=S.target!==z1&&S.target!==E1,q1,ut;S instanceof MouseEvent?(q1=S.clientX,ut=S.clientY):(q1=S.changedTouches[0].clientX,ut=S.changedTouches[0].clientY);let C1=M0(z1,q1,ut,S);T2.current!==C1.isTouch&&_a(C1.isTouch),!l1&&S.cancelable&&S.preventDefault();let[B1]=C1.location,d0=Pa(z1,B1,q1,ut);if(C1.kind===se&&d0!==void 0)C1.button===0&&((X=ma.current)==null?void 0:X[0])===B1&&((b1=ma.current)==null?void 0:b1[1])===-1&&R?.(B1,d0);else if(C1.kind===x2){let vt=za(C1.group,C1.bounds,C1.localEventX,C1.localEventY);vt!==void 0&&C1.button===0&&vt.onClick(C1)}},[$,M0,Pa,R,za]);P0("click",N5,window,!1);let zt=n1.useCallback(S=>{let X=Mt.current;if(X===null||q===void 0)return;let b1=M0(X,S.clientX,S.clientY,S);q(b1,()=>{S.cancelable&&S.preventDefault()})},[M0,q]);P0("contextmenu",zt,(n=$?.current)!=null?n:null,!1);let Ia=n1.useCallback(S=>{S0.current=S.map(X=>X.item),st.current=S,Le.current(),S0.current=void 0},[]),d2=n1.useMemo(()=>new $b(Ia),[Ia]),T=n1.useRef(d2);T.current=d2,n1.useLayoutEffect(()=>{let S=T.current;if(ra===void 0||ra[1]<0){S.setHovered(ra);return}let X=w(ra),b1=Tt(X);S.setHovered(b1===void 0&&X.kind===m1.Custom||b1?.needsHover===!0?ra:void 0)},[w,Tt,ra]);let x0=n1.useRef(),L2=n1.useCallback(S=>{var X;let b1=Mt.current;if(b1===null)return;let z1=$?.current,E1=S.target!==b1&&S.target!==z1,l1=M0(b1,S.clientX,S.clientY,S);if(l1.kind!=="out-of-bounds"&&E1&&!e4.current&&!l1.isTouch)return;if(!T5(l1,x0.current))o1?.(l1),wt(l1.kind===A5?void 0:[l1.location,[l1.localEventX,l1.localEventY]]),x0.current=l1;else if(l1.kind==="cell"||l1.kind===se||l1.kind===x2){let ut=[l1.location,[l1.localEventX,l1.localEventY]];if(wt(ut),hr.current=ut,l1.kind==="cell"){let C1=w(l1.location);(C1.kind===m1.Custom||((X=Tt(C1))==null?void 0:X.needsHoverPosition)===!0)&&fa([l1.location])}else l1.kind===x2&&fa([l1.location])}let q1=l1.location[0]>=(I1?0:1);if(Kt(l1.kind===se&&l1.isEdge&&q1&&W===!0),s&&F.current!==void 0){let[ut,C1]=F.current.cell,B1=Ht(b1,ut,C1),d0=S.clientX,vt=S.clientY;l2(B1!==void 0),Yn(d0>=B1.x+B1.width-6&&d0<=B1.x+B1.width&&vt>=B1.y+B1.height-6&&vt<=B1.y+B1.height)}else Yn(!1);V1?.(S),p1(l1)},[$,M0,I1,W,s,F,V1,p1,o1,w,Tt,fa,Ht]);P0("mousemove",L2,window,!0);let $5=n1.useCallback(S=>{let X=Mt.current;if(X===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(X,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),X1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[X1,F,Ht]),ai=n1.useCallback(S=>{let X=Mt.current;if(X===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(X,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),W1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[W1,F,Ht]),W5=n1.useCallback(S=>{Mt.current=S,P1!==void 0&&(P1.current=S)},[P1]),U5=n1.useCallback(S=>{var X;let b1=Mt.current;if(b1===null||f1===!1||s1){S.preventDefault();return}let z1,E1,l1=M0(b1,S.clientX,S.clientY);if(f1!==!0&&l1.kind!==f1){S.preventDefault();return}let q1=(xt,mt)=>{z1=xt,E1=mt},ut,C1,B1,d0=(xt,mt,lt)=>{ut=xt,C1=mt,B1=lt},vt=!1;if(Y1?.({...l1,setData:q1,setDragImage:d0,preventDefault:()=>vt=!0,defaultPrevented:()=>vt}),!vt&&z1!==void 0&&E1!==void 0&&S.dataTransfer!==null)if(S.dataTransfer.setData(z1,E1),S.dataTransfer.effectAllowed="copyLink",ut!==void 0&&C1!==void 0&&B1!==void 0)S.dataTransfer.setDragImage(ut,C1,B1);else{let[xt,mt]=l1.location;if(mt!==void 0){let lt=document.createElement("canvas"),bt=Ht(b1,xt,mt);l2(bt!==void 0);let t2=Math.ceil((X=window.devicePixelRatio)!=null?X:1);lt.width=bt.width*t2,lt.height=bt.height*t2;let jt=lt.getContext("2d");jt!==null&&(jt.scale(t2,t2),jt.textBaseline="middle",mt===-1?(jt.font=`${I.headerFontStyle} ${I.fontFamily}`,jt.fillStyle=I.bgHeader,jt.fillRect(0,0,lt.width,lt.height),bz(jt,0,0,bt.width,bt.height,p0[xt],!1,I,!1,!1,0,q0,F1,!1)):(jt.font=`${I.baseFontStyle} ${I.fontFamily}`,jt.fillStyle=I.bgCell,jt.fillRect(0,0,lt.width,lt.height),Sz(jt,mt,w([xt,mt]),0,0,0,bt.width,bt.height,!1,I,h1,Z0,q0,1,void 0,!1,0,void 0,void 0,Tt))),lt.style.left="-100%",lt.style.position="absolute",lt.style.width=`${bt.width}px`,lt.style.height=`${bt.height}px`,document.body.append(lt),S.dataTransfer.setDragImage(lt,bt.width/2,bt.height/2),window.setTimeout(()=>{lt.remove()},0)}}else S.preventDefault()},[f1,s1,M0,Y1,Ht,I,p0,q0,F1,w,h1,Z0,Tt]);P0("dragstart",U5,(i=$?.current)!=null?i:null,!1,!1);let r4=n1.useRef(),G=n1.useCallback(S=>{var X;let b1=Mt.current;if(H1!==void 0&&S.preventDefault(),b1===null||u1===void 0)return;let z1=M0(b1,S.clientX,S.clientY),[E1,l1]=z1.location,q1=E1-(I1?0:1),[ut,C1]=(X=r4.current)!=null?X:[];(ut!==q1||C1!==l1)&&(r4.current=[q1,l1],u1([q1,l1],S.dataTransfer))},[I1,M0,u1,H1]);P0("dragover",G,(l=$?.current)!=null?l:null,!1,!1);let V2=n1.useCallback(()=>{r4.current=void 0,Z?.()},[Z]);P0("dragend",V2,(o=$?.current)!=null?o:null,!1,!1);let I0=n1.useCallback(S=>{let X=Mt.current;if(X===null||H1===void 0)return;S.preventDefault();let b1=M0(X,S.clientX,S.clientY),[z1,E1]=b1.location,l1=z1-(I1?0:1);H1([l1,E1],S.dataTransfer)},[I1,M0,H1]);P0("drop",I0,(h=$?.current)!=null?h:null,!1,!1);let j5=n1.useCallback(()=>{O1?.()},[O1]);P0("dragleave",j5,(c=$?.current)!=null?c:null,!1,!1);let ei=n1.useRef(F);ei.current=F;let Ma=n1.useRef(null),J0=n1.useCallback(S=>{var X;Mt.current===null||!Mt.current.contains(document.activeElement)||(S===null&&ei.current.current!==void 0?(X=P1?.current)==null||X.focus({preventScroll:!0}):S!==null&&S.focus({preventScroll:!0}),Ma.current=S)},[P1]);n1.useImperativeHandle(a,()=>({focus:()=>{var S;let X=Ma.current;X===null||!document.contains(X)?(S=P1?.current)==null||S.focus({preventScroll:!0}):X.focus({preventScroll:!0})},getBounds:(S,X)=>{if(!(P1===void 0||P1.current===null))return Ht(P1.current,S??0,X??-1)},damage:Xn}),[P1,Xn,Ht]);let Ha=n1.useRef(),q5=Ck(()=>{var S,X,b1,z1;if(v<50)return null;let E1=y8(p0,e0,v,x1,ct),l1=I1?0:-1;!I1&&((S=E1[0])==null?void 0:S.sourceIndex)===0&&(E1=E1.slice(1));let[q1,ut]=(b1=(X=F.current)==null?void 0:X.cell)!=null?b1:[],C1=(z1=F.current)==null?void 0:z1.range,B1=E1.map(vt=>vt.sourceIndex),d0=(0,Cz.default)(z,Math.min(M,z+d));return q1!==void 0&&ut!==void 0&&!(B1.includes(q1)&&d0.includes(ut))&&J0(null),n1.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":M+1,"aria-multiselectable":"true","aria-colcount":p0.length+l1},n1.createElement("thead",{role:"rowgroup"},n1.createElement("tr",{role:"row","aria-rowindex":1},E1.map(vt=>n1.createElement("th",{role:"columnheader","aria-selected":F.columns.hasIndex(vt.sourceIndex),"aria-colindex":vt.sourceIndex+1+l1,tabIndex:-1,onFocus:xt=>{if(xt.target!==Ma.current)return r1?.([vt.sourceIndex,-1])},key:vt.sourceIndex},vt.title)))),n1.createElement("tbody",{role:"rowgroup"},d0.map(vt=>n1.createElement("tr",{role:"row","aria-selected":F.rows.hasIndex(vt),key:vt,"aria-rowindex":vt+2},E1.map(xt=>{let mt=xt.sourceIndex,lt=`${mt},${vt}`,bt=q1===mt&&ut===vt,t2=C1!==void 0&&mt>=C1.x&&mt=C1.y&&vt{let y2=P1?.current;if(y2!=null)return X1?.({bounds:Ht(y2,mt,vt),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:R2})},onFocusCapture:y2=>{var s2,G1;if(!(y2.target===Ma.current||((s2=Ha.current)==null?void 0:s2[0])===mt&&((G1=Ha.current)==null?void 0:G1[1])===vt))return Ha.current=R2,r1?.(R2)},ref:bt?J0:void 0,tabIndex:-1},Gb(I2,Tt))})))))},[v,p0,e0,x1,ct,M,z,d,F,J0,w,P1,X1,Ht,r1],200),dr=t1?ar(p0,x1):0,n4=_===0||!t1?0:e0>_?1:(0,C8.default)(-ct/100,0,1),sr=-z*32+at,v0=d1?(0,C8.default)(-sr/100,0,1):0,A0=n1.useMemo(()=>{if(!n4&&!v0)return null;let S={position:"absolute",top:0,left:dr,width:v-dr,height:g,opacity:n4,pointerEvents:"none",transition:Bt?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},X={position:"absolute",top:g2,left:0,width:v,height:g,opacity:v0,pointerEvents:"none",transition:Gt?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return n1.createElement(n1.Fragment,null,n4>0&&n1.createElement("div",{id:"shadow-x",style:S}),v0>0&&n1.createElement("div",{id:"shadow-y",style:X}))},[n4,v0,dr,v,Bt,g2,g,Gt]),g0=n1.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return n1.createElement(n1.Fragment,null,n1.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:$5,onKeyUp:ai,onFocus:C,onBlur:k,ref:W5,style:Ta},q5),n1.createElement("canvas",{ref:c2,style:g0}),A0)},Xb=n1.memo(n1.forwardRef(Kb));function _n(t,a,e,r){var n;return(0,gz.default)(Math.round(a-((n=t.growOffset)!=null?n:0)),Math.ceil(e),Math.floor(r))}var Yb=t=>{var a;let[e,r]=Ot.useState(),[n,i]=Ot.useState(),[l,o]=Ot.useState(),[h,c]=Ot.useState(),[v,g]=Ot.useState(!1),[d,u]=Ot.useState(),[p,z]=Ot.useState(),[x,s]=Ot.useState(),[f,m]=Ot.useState(!1),[M,w]=Ot.useState(),{onHeaderMenuClick:y,getCellContent:R,onColumnMoved:L,onColumnResize:V,onColumnResizeStart:C,onColumnResizeEnd:k,gridRef:b,maxColumnWidth:F,minColumnWidth:_,onRowMoved:q,lockColumns:i1,onMouseDown:t1,onMouseUp:d1,onItemHovered:O,onDragStart:e1,canvasRef:U}=t,V1=((a=V??k)!=null?a:C)!==void 0,{columns:p1,selection:o1}=t,x1=o1.columns,I1=Ot.useCallback(W=>{let[c1,D]=W.location;l!==void 0&&h!==c1&&c1>=i1?(g(!0),c(c1)):p!==void 0&&D!==void 0?(m(!0),s(Math.max(0,D))):O?.(W)},[l,p,h,O,i1]),X1=L!==void 0,W1=Ot.useCallback(W=>{var c1,D;if(W.button===0){let[I,A1]=W.location;if(W.kind==="out-of-bounds"&&W.isEdge&&V1){let N1=(c1=b?.current)==null?void 0:c1.getBounds(p1.length-1,-1);N1!==void 0&&(r(N1.x),i(p1.length-1))}else if(W.kind==="header"&&I>=i1){let N1=U?.current;if(W.isEdge&&V1&&N1){r(W.bounds.x),i(I);let F1=N1.getBoundingClientRect().width/N1.offsetWidth,h1=W.bounds.width/F1;C?.(p1[I],h1,I,h1+((D=p1[I].growOffset)!=null?D:0))}else W.kind==="header"&&X1&&(u(W.bounds.x),o(I))}else W.kind==="cell"&&i1>0&&I===0&&A1!==void 0&&q!==void 0&&(w(W.bounds.y),z(A1))}t1?.(W)},[t1,V1,i1,q,b,p1,X1,C,U]),Ct=Ot.useCallback((W,c1)=>{v||f||y?.(W,c1)},[v,f,y]),P1=Ot.useRef(-1),Y1=Ot.useCallback(()=>{P1.current=-1,z(void 0),s(void 0),w(void 0),m(!1),o(void 0),c(void 0),u(void 0),g(!1),i(void 0),r(void 0)},[]),Z=Ot.useCallback((W,c1)=>{var D,I,A1;if(W.button===0){if(n!==void 0){if(x1?.hasIndex(n)===!0)for(let nt of x1){if(nt===n)continue;let F1=p1[nt],h1=_n(F1,P1.current,_,F);V?.(F1,h1,nt,h1+((D=F1.growOffset)!=null?D:0))}let N1=_n(p1[n],P1.current,_,F);if(k?.(p1[n],N1,n,N1+((I=p1[n].growOffset)!=null?I:0)),x1.hasIndex(n))for(let nt of x1){if(nt===n)continue;let F1=p1[nt],h1=_n(F1,P1.current,_,F);k?.(F1,h1,nt,h1+((A1=F1.growOffset)!=null?A1:0))}}Y1(),l!==void 0&&h!==void 0&&L?.(l,h),p!==void 0&&x!==void 0&&q?.(p,x)}d1?.(W,c1)},[d1,n,l,h,p,x,x1,k,p1,_,F,V,L,q,Y1]),$=Ot.useMemo(()=>{if(!(l===void 0||h===void 0)&&l!==h)return{src:l,dest:h}},[l,h]),s1=Ot.useCallback(W=>{var c1,D;let I=U?.current;if(l!==void 0&&d!==void 0)Math.abs(W.clientX-d)>20&&g(!0);else if(p!==void 0&&M!==void 0)Math.abs(W.clientY-M)>20&&m(!0);else if(n!==void 0&&e!==void 0&&I){let N1=I.getBoundingClientRect().width/I.offsetWidth,nt=(W.clientX-e)/N1,F1=p1[n],h1=_n(F1,nt,_,F);if(V?.(F1,h1,n,h1+((c1=F1.growOffset)!=null?c1:0)),P1.current=nt,x1?.first()===n)for(let r1 of x1){if(r1===n)continue;let u1=p1[r1],H1=_n(u1,P1.current,_,F);V?.(u1,H1,r1,H1+((D=u1.growOffset)!=null?D:0))}}},[l,d,p,M,n,e,p1,_,F,V,x1,U]),w1=Ot.useCallback((W,c1)=>{if(p===void 0||x===void 0)return R(W,c1);let[D,I]=W;return I===x?I=p:(I>x&&(I-=1),I>=p&&(I+=1)),R([D,I],c1)},[p,x,R]),f1=Ot.useCallback(W=>{e1?.(W),W.defaultPrevented()||Y1()},[Y1,e1]);return Ot.createElement(Xb,{accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,enableGroups:t.enableGroups,eventTargetRef:t.eventTargetRef,experimental:t.experimental,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,headerIcons:t.headerIcons,height:t.height,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isDraggable:t.isDraggable,isFilling:t.isFilling,isFocused:t.isFocused,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDrop:t.onDrop,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,width:t.width,getCellContent:w1,isResizing:n!==void 0,onHeaderMenuClick:Ct,isDragging:v,onItemHovered:I1,onDragStart:f1,onMouseDown:W1,allowResize:V1,onMouseUp:Z,dragAndDropState:$,onMouseMoveRaw:s1,ref:b})},Qb=Yb;function Zb(t){let a=(0,nr.useRef)(null),[e,r]=(0,nr.useState)({width:t?.[0],height:t?.[1]});return(0,nr.useLayoutEffect)(()=>{let n=l=>{for(let o of l){let{width:h,height:c}=o&&o.contentRect||{};r(v=>v.width===h&&v.height===c?v:{width:h,height:c})}},i=new window.ResizeObserver(n);return a.current&&i.observe(a.current,void 0),()=>{i.disconnect()}},[a.current]),{ref:a,...e}}var Jb=()=>t=>t.isSafari?"scroll":"auto",tE=V0("div")({name:"ScrollRegionStyle",class:"s1jz82f8",propsAsIs:!1,vars:{"s1jz82f8-0":[Jb()]}});function aE(t){let[a,e]=ht.useState(!1),r=ht.useRef(0);return P0("touchstart",ht.useCallback(()=>{window.clearTimeout(r.current),e(!0)},[]),window,!0,!1),P0("touchend",ht.useCallback(n=>{n.touches.length===0&&(r.current=window.setTimeout(()=>e(!1),t))},[t]),window,!0,!1),a}var eE=t=>{var a,e,r,n;let{children:i,clientHeight:l,scrollHeight:o,scrollWidth:h,update:c,draggable:v,className:g,preventDiagonalScrolling:d=!1,paddingBottom:u=0,paddingRight:p=0,rightElement:z,rightElementProps:x,scrollRef:s,scrollToEnd:f,initialSize:m,minimap:M}=t,w=[],y=(a=x?.sticky)!=null?a:!1,R=(e=x?.fill)!=null?e:!1,L=ht.useRef(0),V=ht.useRef(0),C=ht.useRef(null),k=window.devicePixelRatio;ht.useEffect(()=>{let W1=C.current;W1===null||f!==!0||(W1.scrollLeft=W1.scrollWidth-W1.clientWidth)},[f]);let b=ht.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),F=ht.useRef(null),_=aE(200),[q,i1]=ht.useState(!0),t1=ht.useRef(0);ht.useEffect(()=>{if(!q||_||b.current.lockDirection===void 0)return;let W1=C.current;if(W1===null)return;let[Ct,P1]=b.current.lockDirection;Ct!==void 0?W1.scrollLeft=Ct:P1!==void 0&&(W1.scrollTop=P1),b.current.lockDirection=void 0},[_,q]);let d1=ht.useCallback(()=>{var W1,Ct,P1,Y1;let Z=C.current;if(Z===null)return;let $=Z.scrollTop,s1=Z.scrollLeft,w1=b.current.scrollTop,f1=b.current.scrollLeft,W=s1-f1,c1=$-w1;_&&W!==0&&c1!==0&&(Math.abs(W)>3||Math.abs(c1)>3)&&d&&b.current.lockDirection===void 0&&(b.current.lockDirection=Math.abs(W)0&&(Math.abs(A1)>2e3||I===0||I===N1)&&o>Z.scrollHeight+5){let nt=I/N1,F1=(o-Z.clientHeight)*nt;L.current=F1-I}D!==void 0&&(window.clearTimeout(t1.current),i1(!1),t1.current=window.setTimeout(()=>i1(!0),200)),c({x:s1,y:I+L.current,width:Z.clientWidth-p,height:Z.clientHeight-u,paddingRight:(Y1=(P1=F.current)==null?void 0:P1.clientWidth)!=null?Y1:0})},[u,p,o,c,d,_]),O=ht.useRef(d1);O.current=d1;let e1=ht.useRef(),U=ht.useRef(!1);ht.useEffect(()=>{U.current?d1():U.current=!0},[d1,u,p]);let V1=ht.useCallback(W1=>{C.current=W1,s!==void 0&&(s.current=W1)},[s]),p1=0,o1=0;for(w.push(ht.createElement("div",{key:p1++,style:{width:h,height:0}}));o1O.current(),0),e1.current={width:I1,height:X1}),(I1??0)===0||(X1??0)===0?ht.createElement("div",{ref:x1}):ht.createElement("div",{ref:x1},ht.createElement(tE,{isSafari:Tz.value},M,ht.createElement("div",{className:"dvn-underlay"},i),ht.createElement("div",{ref:V1,style:e1.current,draggable:v,onDragStart:W1=>{v||(W1.stopPropagation(),W1.preventDefault())},className:"dvn-scroller "+(g??""),onScroll:d1},ht.createElement("div",{className:"dvn-scroll-inner"+(z===void 0?" hidden":"")},ht.createElement("div",{className:"dvn-stack"},w),z!==void 0&&ht.createElement(ht.Fragment,null,!R&&ht.createElement("div",{className:"dvn-spacer"}),ht.createElement("div",{ref:F,style:{height:X1,maxHeight:l-Math.ceil(k%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:p,flexGrow:R?1:void 0,right:y?p??0:void 0,pointerEvents:"auto"}},z))))))},rE=V0("div")({name:"MinimapStyle",class:"m15w2ly5",propsAsIs:!1}),nE=t=>{var a,e,r;let{columns:n,rows:i,rowHeight:l,headerHeight:o,groupHeaderHeight:h,enableGroups:c,freezeColumns:v,experimental:g,clientSize:d,className:u,onVisibleRegionChanged:p,scrollToEnd:z,scrollRef:x,preventDiagonalScrolling:s,rightElement:f,rightElementProps:m,overscrollX:M,overscrollY:w,showMinimap:y=!1,initialSize:R,smoothScrollX:L=!1,smoothScrollY:V=!1,isDraggable:C}=t,{paddingRight:k,paddingBottom:b}=g??{},[F,_]=d,q=u0.useRef(),i1=u0.useRef(),t1=u0.useRef(),d1=u0.useRef(),O=u0.useMemo(()=>{let f1=Math.max(0,M??0);for(let W of n)f1+=W.width;return f1},[n,M]),e1=c?o+h:o;if(typeof l=="number")e1+=i*l;else for(let f1=0;f1{var f1,W,c1;if(U.current===void 0)return;let D={...U.current},I=0,A1=D.x<0?-D.x:0,N1=0,nt=0;D.x=D.x<0?0:D.x;let F1=0;for(let J1=0;J1=Bt+J1.width)I+=J1.width,nt++,N1++;else if(D.x>Bt)I+=J1.width,L?A1+=Bt-D.x:nt++,N1++;else if(D.x+D.width>Bt)I+=J1.width,N1++;else break}let h1=0,r1=0,u1=0;if(typeof l=="number")V?(r1=Math.floor(D.y/l),h1=r1*l-D.y):r1=Math.ceil(D.y/l),u1=Math.ceil(D.height/l)+r1,h1<0&&u1++;else{let J1=0;for(let Bt=0;Bt=J1+Gt)J1+=Gt,r1++,u1++;else if(D.y>Ut)J1+=Gt,V?h1+=Ut-D.y:r1++,u1++;else if(D.y+D.height>Gt/2+J1)J1+=Gt,u1++;else break}}let H1={x:nt,y:r1,width:N1-nt,height:u1-r1},O1=q.current;(O1===void 0||O1.y!==H1.y||O1.x!==H1.x||O1.height!==H1.height||O1.width!==H1.width||i1.current!==A1||t1.current!==h1||D.width!==((f1=d1.current)==null?void 0:f1[0])||D.height!==((W=d1.current)==null?void 0:W[1]))&&(p?.({x:nt,y:r1,width:N1-nt,height:u1-r1},D.width,D.height,(c1=D.paddingRight)!=null?c1:0,A1,h1),q.current=H1,i1.current=A1,t1.current=h1,d1.current=[D.width,D.height])},[n,l,i,p,v,L,V]),p1=u0.useCallback(f1=>{U.current=f1,V1()},[V1]);u0.useEffect(()=>{V1()},[V1]);let o1=(a=x?.current)!=null?a:void 0,x1=(0,Pz.default)(O/e1,2/3,1.5),I1=200,X1=x1>1?I1:Math.ceil(I1*x1),W1=x1>1?Math.ceil(I1/x1):I1,Ct=X1/O,P1=W1/e1,Y1=Math.min(F*Math.max(Ct,.01),X1),Z=Math.min(_*Math.max(P1,.01),W1),$=((e=o1?.scrollLeft)!=null?e:0)/(O-F)*(X1-Y1),s1=((r=o1?.scrollTop)!=null?r:0)/(e1-_)*(W1-Z),w1=u0.useMemo(()=>{if(!y||Y1===0||Z===0)return;let f1=W=>{if(o1===void 0)return;let c1=W.currentTarget.getBoundingClientRect(),D=W.clientX-c1.x-Y1/2,I=W.clientY-c1.y-Z/2,A1=(O-o1.clientWidth)*(D/(X1-Y1)),N1=(e1-o1.clientHeight)*(I/(W1-Z));o1.scrollTo({left:A1,top:N1,behavior:W.type==="mousemove"?"auto":"smooth"})};return u0.createElement(rE,{style:{width:X1,height:W1},"data-testid":"minimap-container",onMouseMove:W=>{W.buttons===1&&f1(W)},onClick:f1},u0.createElement("div",{className:"header"}),u0.createElement("div",{className:"locationMarker",onDragStart:W=>W.preventDefault(),style:{left:$,top:s1,width:Y1,height:Z,borderRadius:Math.min(Y1,Z*.2,9)}}))},[W1,e1,$,o1,y,s1,Z,Y1,X1,O]);return u0.createElement(eE,{scrollRef:x,minimap:w1,className:u,preventDiagonalScrolling:s,draggable:C===!0||typeof C=="string",scrollWidth:O+(k??0),scrollHeight:e1+(b??0),clientHeight:_,rightElement:f,paddingBottom:b,paddingRight:k,rightElementProps:m,update:p1,initialSize:R,scrollToEnd:z},u0.createElement(Qb,{eventTargetRef:x,width:F,height:_,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}))},iE=nE,lE=()=>t=>t.showSearch?0:400,oE=V0("div")({name:"SearchWrapper",class:"sxep88s",propsAsIs:!1,vars:{"sxep88s-0":[lE(),"px"]}}),hE=j1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},j1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),cE=j1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},j1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),vE=j1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},j1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),gE=10,dE=t=>{let{canvasRef:a,cellYOffset:e,rows:r,columns:n,searchInputRef:i,searchValue:l,searchResults:o,onSearchValueChange:h,getCellsForSelection:c,onSearchResultsChanged:v,showSearch:g=!1,onSearchClose:d}=t,[u]=j1.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[p,z]=j1.useState(""),x=l??p,s=j1.useCallback(O=>{z(O),h?.(O)},[h]),[f,m]=j1.useState(),M=j1.useRef(f);M.current=f,j1.useEffect(()=>{o!==void 0&&(o.length>0?m(O=>{var e1;return{rowsSearched:r,results:o.length,selectedIndex:(e1=O?.selectedIndex)!=null?e1:-1}}):m(void 0))},[r,o]);let w=j1.useRef(new AbortController),y=j1.useRef(),[R,L]=j1.useState([]),V=o??R,C=j1.useCallback(()=>{y.current!==void 0&&(window.cancelAnimationFrame(y.current),y.current=void 0,w.current.abort())},[]),k=j1.useRef(e);k.current=e;let b=j1.useCallback(O=>{let e1=new RegExp(O.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i"),U=k.current,V1=Math.min(10,r),p1=0;m(void 0),L([]);let o1=[],x1=async()=>{var I1,X1;if(c===void 0)return;let W1=performance.now(),Ct=r-p1,P1=c({x:0,y:U,width:n.length,height:Math.min(V1,Ct,r-U)},w.current.signal);typeof P1=="function"&&(P1=await P1());let Y1=!1;for(let[W,c1]of P1.entries())for(let[D,I]of c1.entries()){let A1;switch(I.kind){case m1.Text:case m1.Number:A1=I.displayData;break;case m1.Uri:case m1.Markdown:A1=I.data;break;case m1.Boolean:A1=typeof I.data=="boolean"?I.data.toString():void 0;break;case m1.Image:case m1.Bubble:A1=I.data.join("\u{1F433}");break;case m1.Custom:A1=I.copyData;break}A1!==void 0&&e1.test(A1)&&(o1.push([D,W+U]),Y1=!0)}let Z=performance.now();Y1&&L([...o1]),p1+=P1.length,l2(p1<=r);let $=(X1=(I1=M.current)==null?void 0:I1.selectedIndex)!=null?X1:-1;m({results:o1.length,rowsSearched:p1,selectedIndex:$}),v?.(o1,$),U+V1>=r?U=0:U+=V1;let s1=Z-W1,w1=Math.max(s1,1),f1=gE/w1;V1=Math.ceil(V1*f1),p1{var O;d?.(),m(void 0),L([]),v?.([],-1),C(),(O=a?.current)==null||O.focus()},[C,a,d,v]),_=j1.useCallback(O=>{s(O.target.value),o===void 0&&(O.target.value===""?(m(void 0),L([]),C()):b(O.target.value))},[b,C,s,o]);j1.useEffect(()=>{g&&i.current!==null&&(s(""),i.current.focus({preventScroll:!0}))},[g,i,s]);let q=j1.useCallback(O=>{var e1;if((e1=O?.stopPropagation)==null||e1.call(O),f===void 0)return;let U=(f.selectedIndex+1)%f.results;m({...f,selectedIndex:U}),v?.(V,U)},[f,v,V]),i1=j1.useCallback(O=>{var e1;if((e1=O?.stopPropagation)==null||e1.call(O),f===void 0)return;let U=(f.selectedIndex-1)%f.results;U<0&&(U+=f.results),m({...f,selectedIndex:U}),v?.(V,U)},[v,V,f]),t1=j1.useCallback(O=>{(O.ctrlKey||O.metaKey)&&O.nativeEvent.code==="KeyF"||O.key==="Escape"?(F(),O.stopPropagation(),O.preventDefault()):O.key==="Enter"&&(O.shiftKey?i1():q())},[F,q,i1]);j1.useEffect(()=>()=>{C()},[C]);let d1=j1.useMemo(()=>{var O,e1,U;let V1;f!==void 0&&(V1=f.results>=1e3?"over 1000":`${f.results} result${f.results!==1?"s":""}`,f.selectedIndex>=0&&(V1=`${f.selectedIndex+1} of ${V1}`));let p1=I1=>{I1.stopPropagation()},x1={width:`${Math.floor(((O=f?.rowsSearched)!=null?O:0)/r*100)}%`};return j1.createElement(oE,{showSearch:g,onMouseDown:p1,onMouseMove:p1,onMouseUp:p1,onClick:p1},j1.createElement("div",{className:"search-bar-inner"},j1.createElement("input",{id:u,"aria-hidden":!g,"data-testid":"search-input",ref:i,onChange:_,value:x,tabIndex:g?void 0:-1,onKeyDownCapture:t1}),j1.createElement("button",{"aria-label":"Previous Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:i1,disabled:((e1=f?.results)!=null?e1:0)===0},hE),j1.createElement("button",{"aria-label":"Next Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:q,disabled:((U=f?.results)!=null?U:0)===0},cE),d!==void 0&&j1.createElement("button",{"aria-label":"Close Search","aria-hidden":!g,"data-testid":"search-close-button",tabIndex:g?void 0:-1,onClick:F},vE)),f!==void 0?j1.createElement(j1.Fragment,null,j1.createElement("div",{className:"search-status"},j1.createElement("div",{"data-testid":"search-result-area"},V1)),j1.createElement("div",{className:"search-progress",style:x1})):j1.createElement("div",{className:"search-status"},j1.createElement("label",{htmlFor:u},"Type to search")))},[F,q,i1,_,d,t1,r,f,x,g,u,i]);return j1.createElement(j1.Fragment,null,j1.createElement(iE,{prelightCells:V,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,className:t.className,clientSize:t.clientSize,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,initialSize:t.initialSize,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,onVisibleRegionChanged:t.onVisibleRegionChanged,overscrollX:t.overscrollX,overscrollY:t.overscrollY,preventDiagonalScrolling:t.preventDiagonalScrolling,rightElement:t.rightElement,rightElementProps:t.rightElementProps,rowHeight:t.rowHeight,rows:t.rows,scrollRef:t.scrollRef,selection:t.selection,showMinimap:t.showMinimap,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,scrollToEnd:t.scrollToEnd}),d1)},sE=dE,uE=()=>t=>Math.max(16,t.targetHeight-10),fE=V0("input")({name:"RenameInput",class:"r1kzy40b",propsAsIs:!1,vars:{"r1kzy40b-0":[uE(),"px"]}}),pE=t=>{let{bounds:a,group:e,onClose:r,canvasBounds:n,onFinish:i}=t,[l,o]=R5.default.useState(e);return R5.default.createElement(az,{style:{position:"absolute",left:a.x-n.left+1,top:a.y-n.top,width:a.width-2,height:a.height},className:"c1sqdbw3",onClickOutside:r},R5.default.createElement(fE,{targetHeight:a.height,"data-testid":"group-rename-input",value:l,onBlur:r,onFocus:h=>h.target.setSelectionRange(0,l.length),onChange:h=>o(h.target.value),onKeyDown:h=>{h.key==="Enter"?i(l):h.key==="Escape"&&r()},autoFocus:!0}))},A8=150;function zE(t,a,e,r){var n,i;let l=r(a);return(i=(n=l?.measure)==null?void 0:n.call(l,t,a,e))!=null?i:A8}function Iz(t,a,e,r,n,i,l,o,h){let c=[];if(n!==void 0&&c.push(...n.map(d=>d[r]).map(d=>zE(t,d,a,h))),c.length>5&&o){let d=c.reduce((u,p)=>u+p)/c.length;c=c.filter(u=>u{if(typeof window>"u")return[null,null];let f=document.createElement("canvas");return f.style.display="none",f.style.opacity="0",f.style.position="fixed",[f,f.getContext("2d",{alpha:!1})]},[]);o2.useLayoutEffect(()=>(d&&document.documentElement.append(d),()=>{d?.remove()}),[d]);let p=o2.useRef({}),z=o2.useRef(),[x,s]=o2.useState();return o2.useLayoutEffect(()=>{let f=v.current;if(f===void 0||t.every(z5))return;let m=Math.max(1,10-Math.floor(t.length/1e4)),M=0;m1&&(m--,M=1);let w={x:0,y:0,width:t.length,height:Math.min(c.current,m)},y={x:0,y:c.current-1,width:t.length,height:1};(async()=>{let L=f(w,h.signal),V=M>0?f(y,h.signal):void 0,C;typeof L=="object"?C=L:C=await Sp(L),V!==void 0&&(typeof V=="object"?C=[...C,...V]:C=[...C,...await Sp(V)]),z.current=t,s(C)})()},[h.signal,t]),o2.useMemo(()=>{var f;let M=(()=>t.every(z5)?t:u===null?t.map(L=>z5(L)?L:{...L,width:A8}):(u.font=`${g.current.baseFontStyle} ${g.current.fontFamily}`,t.map((L,V)=>{if(z5(L))return L;if(p.current[L.id]!==void 0)return{...L,width:p.current[L.id]};if(x===void 0||z.current!==t||L.id===void 0)return{...L,width:A8};let C=Iz(u,l,L,V,x,n,i,!0,o);return p.current[L.id]=C.width,C})))(),w=0,y=0,R=[];for(let[L,V]of M.entries())w+=V.width,V.grow!==void 0&&V.grow>0&&(y+=V.grow,R.push(L));if(w0){let L=[...M],V=r-w,C=V;for(let k=0;k1&&t.startsWith("_")){if(Number.parseInt(t.slice(1))!==a.keyCode)return!1}else if(t!==a.key)return!1;return!0}function T0(t,a){if(t.length===0)return!1;let e=!1,r=!1,n=!1,i=!1,l=t.split("+"),o=l.pop();if(!ME(o,a))return!1;for(let h of l)switch(h){case"ctrl":e=!0;break;case"shift":r=!0;break;case"alt":n=!0;break;case"meta":i=!0;break;case"primary":V5.value?i=!0:e=!0;break}return a.altKey===n&&a.ctrlKey===e&&a.shiftKey===r&&a.metaKey===i}function HE(t,a,e,r,n,i){let l=y5.default.useCallback((c,v,g,d)=>{var u,p;(i==="cell"||i==="multi-cell")&&c!==void 0&&(c={...c,range:{x:c.cell[0],y:c.cell[1],width:1,height:1}});let z=e==="mixed"&&(g||d==="drag"),x=r==="mixed"&&z,s=n==="mixed"&&z,f={current:c===void 0?void 0:{...c,rangeStack:d==="drag"?(p=(u=t.current)==null?void 0:u.rangeStack)!=null?p:[]:[]},columns:x?t.columns:Lt.empty(),rows:s?t.rows:Lt.empty()};g&&(i==="multi-rect"||i==="multi-cell")&&f.current!==void 0&&t.current!==void 0&&(f={...f,current:{...f.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),a(f,v)},[r,t,e,i,n,a]),o=y5.default.useCallback((c,v,g)=>{c=c??t.rows,v!==void 0&&(c=c.add(v));let d;if(n==="exclusive"&&c.length>0)d={current:void 0,columns:Lt.empty(),rows:c};else{let u=g&&e==="mixed",p=g&&r==="mixed";d={current:u?t.current:void 0,columns:p?t.columns:Lt.empty(),rows:c}}a(d,!1)},[r,t,e,n,a]),h=y5.default.useCallback((c,v,g)=>{c=c??t.columns,v!==void 0&&(c=c.add(v));let d;if(r==="exclusive"&&c.length>0)d={current:void 0,rows:Lt.empty(),columns:c};else{let u=g&&e==="mixed",p=g&&n==="mixed";d={current:u?t.current:void 0,rows:p?t.rows:Lt.empty(),columns:c}}a(d,!1)},[r,t,e,n,a]);return[l,o,h]}function xE(t,a,e,r,n){let i=F8.useCallback(c=>{var v;if(t===!0){let g=[];for(let d=c.y;d=n?u.push({kind:m1.Loading,allowOverlay:!1}):u.push(a([p,d]));g.push(u)}return g}return(v=t?.(c,r.signal))!=null?v:[]},[r.signal,a,t,n]),l=t!==void 0?i:void 0,o=F8.useCallback(c=>{if(l===void 0)return[];let v={...c,x:c.x-e};if(v.x<0){v.x=0,v.width--;let g=l(v,r.signal);return typeof g=="function"?async()=>(await g()).map(d=>[{kind:m1.Loading,allowOverlay:!1},...d]):g.map(d=>[{kind:m1.Loading,allowOverlay:!1},...d])}return l(v,r.signal)},[r.signal,l,e]);return[t!==void 0?o:void 0,l]}function wE(t){var a,e;if(t.copyData!==void 0)return{formatted:t.copyData,rawValue:t.copyData,format:"string"};switch(t.kind){case m1.Boolean:return{formatted:t.data===!0?"TRUE":t.data===!1?"FALSE":t.data===E8?"INDETERMINATE":"",rawValue:t.data,format:"boolean"};case m1.Custom:return{formatted:t.copyData,rawValue:t.copyData,format:"string"};case m1.Image:case m1.Bubble:return{formatted:t.data,rawValue:t.data,format:"string-array"};case m1.Drilldown:return{formatted:t.data.map(r=>r.text),rawValue:t.data.map(r=>r.text),format:"string-array"};case m1.Text:return{formatted:(a=t.displayData)!=null?a:t.data,rawValue:t.data,format:"string"};case m1.Uri:return{formatted:(e=t.displayData)!=null?e:t.data,rawValue:t.data,format:"url"};case m1.Markdown:case m1.RowID:return{formatted:t.data,rawValue:t.data,format:"string"};case m1.Number:return{formatted:t.displayData,rawValue:t.data,format:"number"};case m1.Loading:return{formatted:"#LOADING",rawValue:"",format:"string"};case m1.Protected:return{formatted:"************",rawValue:"",format:"string"};default:Dn(t)}}function LE(t,a){return t.map((r,n)=>{let i=a[n];return r.map(l=>l.span!==void 0&&l.span[0]!==i?{formatted:"",rawValue:"",format:"string"}:wE(l))})}function Dp(t,a){return(a?/[\t\n",]/:/[\t\n"]/).test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}function VE(t){var a,e;let r=[];for(let n of t){let i=[];for(let l of n)l.format==="url"?i.push((e=(a=l.rawValue)==null?void 0:a.toString())!=null?e:""):l.format==="string-array"?i.push(l.formatted.map(o=>Dp(o,!0)).join(",")):i.push(Dp(l.formatted,!1));r.push(i.join(" "))}return r.join(`
`)}function w8(t){return t.replace(/\t/g," ").replace(/ {2,}/g,a=>" ".repeat(a.length))}function Np(t){return'"'+t.replace(/&/g,"&").replace(/"/g,""").replace(/ /g,">")+'"'}function RE(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function yE(t){var a,e;let r=[];r.push('',"");for(let n of t){r.push("");for(let i of n){let l=`gdg-format="${i.format}"`;i.format==="url"?r.push(`${w8(i.formatted)} `):i.format==="string-array"?r.push(`${i.formatted.map((o,h)=>``+w8(o)+" ").join("")} `):r.push(`${w8(i.formatted)} `)}r.push(" ")}return r.push("
"),r.join("")}function CE(t,a){let e=LE(t,a),r=VE(e),n=yE(e);return{textPlain:r,textHtml:n}}function $p(t){var a,e,r,n,i,l;let o=document.createElement("html");o.innerHTML=t.replace(/ /g," ");let h=o.querySelector("table");if(h===null)return;let c=[h],v=[],g;for(;c.length>0;){let d=c.pop();if(d===void 0)break;if(d instanceof HTMLTableElement||d.nodeName==="TBODY")c.push(...[...d.children].reverse());else if(d instanceof HTMLTableRowElement)g!==void 0&&v.push(g),g=[],c.push(...[...d.children].reverse());else if(d instanceof HTMLTableCellElement){let u=d.cloneNode(!0),z=u.children.length===1&&u.children[0].nodeName==="P"?u.children[0]:null,x=z?.children.length===1&&z.children[0].nodeName==="FONT",s=u.querySelectorAll("br");for(let M of s)M.replaceWith(`
`);let f=u.getAttribute("gdg-raw-value"),m=(a=u.getAttribute("gdg-format"))!=null?a:"string";if(u.querySelector("a")!==null)g?.push({rawValue:(r=(e=u.querySelector("a"))==null?void 0:e.getAttribute("href"))!=null?r:"",formatted:(n=u.textContent)!=null?n:"",format:m});else if(u.querySelector("ol")!==null){let M=u.querySelectorAll("li");g?.push({rawValue:[...M].map(w=>{var y;return(y=w.getAttribute("gdg-raw-value"))!=null?y:""}),formatted:[...M].map(w=>{var y;return(y=w.textContent)!=null?y:""}),format:"string-array"})}else if(f!==null)g?.push({rawValue:RE(f),formatted:(i=u.textContent)!=null?i:"",format:m});else{let M=(l=u.textContent)!=null?l:"";x&&(M=M.replace(/\n(?!\n)/g,"")),g?.push({rawValue:M??"",formatted:M??"",format:m})}}}return g!==void 0&&v.push(g),v}function BE(t,a,e,r,n){var i,l;let o=t;if(r==="allowPartial"||t.current===void 0||a===void 0)return t;let h=!1;do{if(t?.current===void 0)break;let c=(i=t.current)==null?void 0:i.range,v=[];if(c.width>2){let u=a({x:c.x,y:c.y,width:1,height:c.height},n.signal);if(typeof u=="function")return o;v.push(...u);let p=a({x:c.x+c.width-1,y:c.y,width:1,height:c.height},n.signal);if(typeof p=="function")return o;v.push(...p)}else{let u=a({x:c.x,y:c.y,width:c.width,height:c.height},n.signal);if(typeof u=="function")return o;v.push(...u)}let g=c.x-e,d=c.x+c.width-1-e;for(let u of v)for(let p of u)p.span!==void 0&&(g=Math.min(p.span[0],g),d=Math.max(p.span[1],d));g===c.x-e&&d===c.x+c.width-1-e?h=!0:t={current:{cell:(l=t.current.cell)!=null?l:[0,0],range:{x:g+e,y:c.y,width:d-g+1,height:c.height},rangeStack:t.current.rangeStack},columns:t.columns,rows:t.rows}}while(!h);return t}function Wp(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function SE(t){let a;(o=>{o[o.None=0]="None",o[o.inString=1]="inString",o[o.inStringPostQuote=2]="inStringPostQuote"})(a||(a={}));let e=[],r=[],n=0,i=0;t=t.replace(/\r\n/g,`
`);let l=0;for(let o of t){switch(i){case 0:o===" "||o===`
`?(r.push(t.slice(n,l)),n=l+1,o===`
`&&(e.push(r),r=[])):o==='"'&&(i=1);break;case 1:o==='"'&&(i=2);break;case 2:o==='"'?i=1:((o===" "||o===`
`)&&(r.push(Wp(t.slice(n,l))),n=l+1,o===`
-`&&(e.push(r),r=[])),i=0);break}l++}return no.map(h=>({rawValue:h,formatted:h,format:"string"})))}function Up(t,a,e){var r;let n=CE(t,a),i=h=>{var c;(c=window.navigator.clipboard)==null||c.writeText(h)},l=(h,c)=>{var v;return((v=window.navigator.clipboard)==null?void 0:v.write)===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([h],{type:"text/plain"}),"text/html":new Blob([c],{type:"text/html"})})]),!0)},o=(h,c)=>{var v,g;try{if(e===void 0||e.clipboardData===null)throw new Error("No clipboard data");(v=e?.clipboardData)==null||v.setData("text/plain",h),(g=e?.clipboardData)==null||g.setData("text/html",c)}catch{l(h,c)||i(h)}};((r=window.navigator.clipboard)==null?void 0:r.write)!==void 0||e?.clipboardData!==void 0?o(n.textPlain,n.textHtml):i(n.textPlain),e?.preventDefault()}function jp(t){return typeof t=="string"?t:`${t}px`}var AE=()=>t=>t.innerWidth,FE=()=>t=>t.innerHeight,kE=V0("div")({name:"Wrapper",class:"wzg2m5k",propsAsIs:!1,vars:{"wzg2m5k-0":[AE()],"wzg2m5k-1":[FE()]}}),bE=t=>{let{inWidth:a,inHeight:e,children:r,...n}=t;return Oz.createElement(kE,{innerHeight:jp(e),innerWidth:jp(a),...n},r)};function Dz(t){return t!==!0}var qp=20,EE={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:"false"},kind:M1.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:t=>{var a;return qk(t,t.cell.data,V8(t.cell),(a=t.cell.maxSize)!=null?a:qp)},onDelete:t=>({...t,data:!1}),onClick:t=>{var a,e;let{cell:r,posX:n,posY:i,bounds:l,theme:o}=t,{width:h,height:c,x:v,y:g}=l,d=(a=r.maxSize)!=null?a:qp,u=Math.floor(l.y+c/2),p=mz(d,c,o.cellVerticalPadding),z=zz((e=r.contentAlign)!=null?e:"center",v,h,o.cellHorizontalPadding,p),x=pz(z,u,p),s=Mz(v+n,g+i,x);if(V8(r)&&s)return{...r,data:Dz(r.data)}},onPaste:(t,a)=>{let e=S5;return t.toLowerCase()==="true"?e=!0:t.toLowerCase()==="false"?e=!1:t.toLowerCase()==="indeterminate"&&(e=E8),e===a.data?void 0:{...a,data:e}}},_E=2,TE=1300;function PE(t,a){let e=k8.default.useRef(0),[r,n]=t??[0,0];k8.default.useEffect(()=>{if(r===0&&n===0){e.current=0;return}let i=0,l=h=>{var c;if(i===0)i=h;else{let v=h-i;e.current=Math.min(1,e.current+v/TE);let g=e.current**1.618*v*_E;(c=a.current)==null||c.scrollBy(r*g,n*g),i=h}o=window.requestAnimationFrame(l)},o=window.requestAnimationFrame(l);return()=>window.cancelAnimationFrame(o)},[a,r,n])}var IE=V0("div")({name:"BubblesOverlayEditorStyle",class:"b1bqsp5z",propsAsIs:!1}),OE=t=>{let{bubbles:a}=t;return C5.createElement(IE,null,a.map((e,r)=>C5.createElement("div",{key:r,className:"boe-bubble"},e)),C5.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},DE=OE,NE={getAccessibilityString:t=>wz(t.data),kind:M1.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n).width+r+20,0)+2*e.cellHorizontalPadding-4,draw:t=>Gk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return Nz.createElement(DE,{bubbles:a.data})},onPaste:()=>{}},$E=V0("div")({name:"DrilldownOverlayEditorStyle",class:"df2kt4a",propsAsIs:!1}),WE=t=>{let{drilldowns:a}=t;return In.createElement($E,null,a.map((e,r)=>In.createElement("div",{key:r,className:"doe-bubble"},e.img!==void 0&&In.createElement("img",{src:e.img}),In.createElement("div",null,e.text))))},UE=WE,jE={getAccessibilityString:t=>wz(t.data.map(a=>a.text)),kind:M1.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n.text).width+r+20+(n.img!==void 0?18:0),0)+2*e.cellHorizontalPadding-4,draw:t=>Xk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return $z.createElement(UE,{drilldowns:a.data})},onPaste:()=>{}},qE=V0("div")({name:"ImageOverlayEditorStyle",class:"i1eozt10",propsAsIs:!1}),GE=t=>{let{urls:a,canWrite:e,onEditClick:r,renderImage:n}=t,i=a.filter(o=>o!=="");if(i.length===0)return null;let l=i.length>1;return Xe.createElement(qE,{"data-testid":"GDG-default-image-overlay-editor"},Xe.createElement(Uz.Carousel,{showArrows:l,showThumbs:!1,swipeable:l,emulateTouch:l,infiniteLoop:l},i.map(o=>{var h;let c=(h=n?.(o))!=null?h:Xe.createElement("img",{draggable:!1,src:o});return Xe.createElement("div",{className:"centering-container",key:o},c)})),e&&r&&Xe.createElement("button",{className:"edit-icon",onClick:r},Xe.createElement(T8,null)))},KE={getAccessibilityString:t=>t.data.join(", "),kind:M1.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>{var a;return Yk(t,(a=t.cell.displayData)!=null?a:t.cell.data,t.cell.rounding,t.cell.contentAlign)},measure:(t,a)=>a.data.length*50,onDelete:t=>({...t,data:[]}),provideEditor:()=>t=>{let{value:a,onFinishedEditing:e,imageEditorOverride:r}=t;return Wz.createElement(r??GE,{urls:a.data,canWrite:a.allowAdd,onCancel:e,onChange:i=>{e({...a,data:[i]})}})},onPaste:(t,a)=>{t=t.trim();let r=t.split(",").map(n=>{try{return new URL(n),n}catch{return}}).filter(n=>n!==void 0);if(!(r.length===a.data.length&&r.every((n,i)=>n===a.data[i])))return{...a,data:r}}},XE={getAccessibilityString:()=>"",kind:M1.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:()=>{},onPaste:()=>{}},YE=V0("div")({name:"MarkdownContainer",class:"mlbeo71",propsAsIs:!1}),QE=class extends b8.default.PureComponent{constructor(){super(...arguments),this.targetElement=null,this.containerRefHook=t=>{this.targetElement=t,this.renderMarkdownIntoDiv()}}renderMarkdownIntoDiv(){let{targetElement:t,props:a}=this;if(t===null)return;let{contents:e,createNode:r}=a,n=U1(e),i=document.createRange();i.selectNodeContents(t),i.deleteContents();let l=r?.(n);if(l===void 0){let h=document.createElement("template");h.innerHTML=n,l=h.content}t.append(l);let o=t.getElementsByTagName("a");for(let h of o)h.target="_blank",h.rel="noreferrer noopener"}render(){return this.renderMarkdownIntoDiv(),b8.default.createElement(YE,{ref:this.containerRefHook})}},ZE=V0("textarea")({name:"InputBox",class:"ijuk0po",propsAsIs:!1}),JE=V0("div")({name:"ShadowBox",class:"saq3p5l",propsAsIs:!1}),t_=V0("div")({name:"GrowingEntryStyle",class:"gf8vzix",propsAsIs:!1}),Gp=0,k5=t=>{let{placeholder:a,value:e,onKeyDown:r,highlight:n,altNewline:i,validatedSelection:l,...o}=t,{onChange:h,className:c}=o,v=h2.useRef(null),g=e??"";l2(h!==void 0,"GrowingEntry must be a controlled input area");let[d]=h2.useState(()=>"input-box-"+(Gp=(Gp+1)%1e7));h2.useEffect(()=>{let p=v.current;if(p===null||p.disabled)return;let z=g.toString().length;p.focus(),p.setSelectionRange(n?0:z,z)},[]),h2.useLayoutEffect(()=>{var p;if(l!==void 0){let z=typeof l=="number"?[l,null]:l;(p=v.current)==null||p.setSelectionRange(z[0],z[1])}},[l]);let u=h2.useCallback(p=>{p.key==="Enter"&&p.shiftKey&&i===!0||r?.(p)},[i,r]);return h2.createElement(t_,{className:"gdg-growing-entry"},h2.createElement(JE,{className:c},g+`
-`),h2.createElement(ZE,{...o,className:(c??"")+" gdg-input",id:d,ref:v,onKeyDown:u,value:g,placeholder:a,dir:"auto"}))},a_=()=>t=>t.targetWidth,Kp=V0("div")({name:"MarkdownOverlayEditorStyle",class:"mdwzdl1",propsAsIs:!1,vars:{"mdwzdl1-0":[a_(),"px"]}}),e_=t=>{let{value:a,onChange:e,forceEditMode:r,createNode:n,targetRect:i,onFinish:l,validatedSelection:o}=t,h=a.data,c=a.readonly===!0,[v,g]=y0.useState(h===""||r),d=y0.useCallback(()=>{g(p=>!p)},[]),u=h?"ml-6":"";return v?y0.createElement(Kp,{targetWidth:i.width-20},y0.createElement(k5,{autoFocus:!0,highlight:!1,validatedSelection:o,value:h,onKeyDown:p=>{p.key==="Enter"&&p.stopPropagation()},onChange:e}),y0.createElement("div",{className:`edit-icon checkmark-hover ${u}`,onClick:()=>l(a)},y0.createElement(yk,null))):y0.createElement(Kp,{targetWidth:i.width},y0.createElement(QE,{contents:h,createNode:n}),!c&&y0.createElement(y0.Fragment,null,y0.createElement("div",{className:"spacer"}),y0.createElement("div",{className:`edit-icon edit-hover ${u}`,onClick:d},y0.createElement(T8,null))),y0.createElement("textarea",{className:"md-edit-textarea gdg-input",autoFocus:!0}))},r_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:M1.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:Wn,measure:(t,a,e)=>{let r=a.data.split(`
-`)[0];return t.measureText(r).width+2*e.cellHorizontalPadding},draw:t=>Un(t,t.cell.data,t.cell.contentAlign),onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{let{onChange:a,value:e,target:r,onFinishedEditing:n,markdownDivCreateNode:i,forceEditMode:l,validatedSelection:o}=t;return jz.createElement(e_,{onFinish:n,targetRect:r,value:e,validatedSelection:o,onChange:h=>a({...e,data:h.target.value}),forceEditMode:l,createNode:i})},onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},n_={getAccessibilityString:t=>t.row.toString(),kind:ta.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:$k,measure:()=>44,draw:t=>Uk(t,t.cell.row,t.cell.checked,t.cell.markerKind,t.cell.drawHandle),onClick:t=>{let{bounds:a,cell:e,posX:r,posY:n}=t,{width:i,height:l}=a,o=e.drawHandle?7+(i-7)/2:i/2,h=l/2;if(Math.abs(r-o)<=10&&Math.abs(n-h)<=10)return{...e,checked:!e.checked}},onPaste:()=>{}},i_={getAccessibilityString:()=>"",kind:ta.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>Nk(t,t.cell.hint,t.cell.icon),onPaste:()=>{}},l_=Ze.lazy(async()=>await Promise.resolve().then(()=>(Cp(),yp))),o_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:M1.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Wn,draw:t=>Un(t,t.cell.displayData,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.displayData).width+16,onDelete:t=>({...t,data:void 0}),provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return Ze.createElement(Ze.Suspense,{fallback:null},Ze.createElement(l_,{highlight:a,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:n,onChange:i=>{var l;return e({...r,data:Number.isNaN((l=i.floatValue)!=null?l:0)?0:i.floatValue})}}))},onPaste:(t,a,e)=>{var r;let n=typeof e.rawValue=="number"?e.rawValue:Number.parseFloat(typeof e.rawValue=="string"?e.rawValue:t);if(!(Number.isNaN(n)||a.data===n))return{...a,data:n,displayData:(r=e.formattedString)!=null?r:a.displayData}}},h_={getAccessibilityString:()=>"",measure:()=>108,kind:M1.Protected,needsHover:!1,needsHoverPosition:!1,draw:jk,onPaste:()=>{}},c_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:M1.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(t,a)=>Wn(t,a,t.theme.textLight),draw:t=>Un(t,t.cell.data,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.data).width+16,provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return qz.default.createElement(k5,{highlight:a,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:n,onChange:i=>e({...r,data:i.target.value})})},onPaste:()=>{}},v_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:M1.Text,needsHover:!1,needsHoverPosition:!1,drawPrep:Wn,useLabel:!0,draw:t=>(Un(t,t.cell.displayData,t.cell.contentAlign,t.cell.allowWrapping,t.hyperWrapping),!0),measure:(t,a,e)=>{let r=a.displayData.split(`
-`).slice(0,a.allowWrapping===!0?void 0:1);return Math.max(...r.map(n=>t.measureText(n).width+2*e.cellHorizontalPadding))},onDelete:t=>({...t,data:""}),provideEditor:t=>({disablePadding:t.allowWrapping===!0,editor:a=>{let{isHighlighted:e,onChange:r,value:n,validatedSelection:i}=a;return Gz.createElement(k5,{style:t.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:e,autoFocus:n.readonly!==!0,disabled:n.readonly===!0,altNewline:!0,value:n.data,validatedSelection:i,onChange:l=>r({...n,data:l.target.value})})}}),onPaste:(t,a,e)=>{var r;return t===a.data?void 0:{...a,data:t,displayData:(r=e.formattedString)!=null?r:a.displayData}}},g_=V0("div")({name:"UriOverlayEditorStyle",class:"uf0sjo8",propsAsIs:!1}),d_=t=>{let{uri:a,onChange:e,forceEditMode:r,readonly:n,validatedSelection:i,preview:l}=t,[o,h]=J2.useState(a===""||r),c=J2.useCallback(()=>{h(!0)},[]);return o?J2.createElement(k5,{validatedSelection:i,highlight:!0,autoFocus:!0,value:a,onChange:e}):J2.createElement(g_,null,J2.createElement("a",{className:"link-area",href:a,target:"_blank",rel:"noopener noreferrer"},l),!n&&J2.createElement("div",{className:"edit-icon",onClick:c},J2.createElement(T8,null)),J2.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},s_=d_,u_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:M1.Uri,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Wn,draw:t=>Un(t,t.cell.data,t.cell.contentAlign),measure:(t,a,e)=>t.measureText(a.data).width+e.cellHorizontalPadding*2,onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{var a;let{onChange:e,value:r,forceEditMode:n,validatedSelection:i}=t;return Kz.createElement(s_,{forceEditMode:n,uri:r.data,preview:(a=r.displayData)!=null?a:r.data,validatedSelection:i,readonly:r.readonly===!0,onChange:l=>e({...r,data:l.target.value})})},onPaste:(t,a,e)=>{var r;return t===a.data?void 0:{...a,data:t,displayData:(r=e.formattedString)!=null?r:a.displayData}}},f_={[ta.Marker]:n_,[ta.NewRow]:i_,[M1.Boolean]:EE,[M1.Bubble]:NE,[M1.Drilldown]:jE,[M1.Image]:KE,[M1.Loading]:XE,[M1.Markdown]:r_,[M1.Number]:o_,[M1.Protected]:h_,[M1.RowID]:c_,[M1.Text]:v_,[M1.Uri]:u_};function p_({rowHeight:t,headerHeight:a,groupHeaderHeight:e,theme:r,overscrollX:n,overscrollY:i,scaleToRem:l,remSize:o}){let[h,c,v,g,d,u]=Xz.default.useMemo(()=>{var p,z,x;if(!l||o===16)return[t,a,e,r,n,i];let s=o/16,f=t,m=iz();return[typeof f=="number"?f*s:M=>Math.ceil(f(M)*s),Math.ceil(a*s),Math.ceil(e*s),{...r,headerIconSize:((p=r?.headerIconSize)!=null?p:m.headerIconSize)*s,cellHorizontalPadding:((z=r?.cellHorizontalPadding)!=null?z:m.cellHorizontalPadding)*s,cellVerticalPadding:((x=r?.cellVerticalPadding)!=null?x:m.cellVerticalPadding)*s},Math.ceil((n??0)*s),Math.ceil((i??0)*s)]},[e,a,n,i,o,t,l,r]);return{rowHeight:h,headerHeight:c,groupHeaderHeight:v,theme:g,overscrollX:d,overscrollY:u}}var z_=0;function m_(t){return(0,Zp.default)((0,L8.default)((0,L8.default)(t).filter(a=>a.span!==void 0).map(a=>{var e,r,n,i;return(0,Ye.default)(((r=(e=a.span)==null?void 0:e[0])!=null?r:0)+1,((i=(n=a.span)==null?void 0:n[1])!=null?i:0)+1)})))}function M5(t,a){return t===void 0||a===0||t.columns.length===0&&t.current===void 0?t:{current:t.current===void 0?void 0:{cell:[t.current.cell[0]+a,t.current.cell[1]],range:{...t.current.range,x:t.current.range.x+a},rangeStack:t.current.rangeStack.map(e=>({...e,x:e.x+a}))},rows:t.rows,columns:t.columns.offset(a)}}var Xp={selectAll:!0,selectRow:!0,selectColumn:!0,downFill:!1,rightFill:!1,pageUp:!1,pageDown:!1,clear:!0,copy:!0,paste:!0,cut:!0,search:!1,first:!0,last:!0},Yp={kind:M1.Loading,allowOverlay:!1},H5={columns:Lt.empty(),rows:Lt.empty(),current:void 0},M_=(t,a)=>{var e,r,n,i,l;let[o,h]=N.useState(H5),[c,v]=N.useState(),g=N.useRef(null),d=N.useRef(null),[u,p]=N.useState(),z=N.useRef(null),x=N.useRef(),{rowMarkers:s="none",rowMarkerWidth:f,imageEditorOverride:m,getRowThemeOverride:M,markdownDivCreateNode:w,width:y,height:R,columns:L,rows:V,getCellContent:C,onCellClicked:k,onCellActivated:b,onFinishedEditing:F,coercePasteValue:_,drawHeader:q,onHeaderClicked:i1,spanRangeBehavior:t1="default",onGroupHeaderClicked:d1,onCellContextMenu:O,className:e1,onHeaderContextMenu:U,getCellsForSelection:V1,onGroupHeaderContextMenu:p1,onGroupHeaderRenamed:o1,onCellEdited:x1,onCellsEdited:I1,onSearchResultsChanged:X1,searchResults:W1,onSearchValueChange:Ct,searchValue:P1,onKeyDown:Y1,onKeyUp:Z,keybindings:$,onRowAppended:s1,onColumnMoved:w1,validateCell:f1,highlightRegions:W,drawCell:c1,rangeSelect:D="rect",columnSelect:I="multi",rowSelect:A1="multi",rangeSelectionBlending:N1="exclusive",columnSelectionBlending:nt="exclusive",rowSelectionBlending:F1="exclusive",onDelete:h1,onDragStart:r1,onMouseMove:u1,onPaste:H1,copyHeaders:O1=!1,freezeColumns:J1=0,rowSelectionMode:Bt="auto",rowMarkerStartIndex:Gt=1,rowMarkerTheme:Ut,onHeaderMenuClick:Tt,getGroupDetails:ct,onSearchClose:at,onItemHovered:e0,onSelectionCleared:Mt,showSearch:B0,onVisibleRegionChanged:Z0,gridSelection:S0,onGridSelectionChange:r0,minColumnWidth:ua=50,maxColumnWidth:st=500,maxColumnAutoWidth:St,provideEditor:c0,trailingRowOptions:wt,scrollOffsetX:kt,scrollOffsetY:Kt,verticalBorder:c2,onDragOverCell:v2,onDrop:_a,onColumnResize:T2,onColumnResizeEnd:q0,onColumnResizeStart:g2,customRenderers:P2,fillHandle:Gn,drawFocusRing:p0,experimental:Ht,fixedShadowX:M0,fixedShadowY:T5,headerIcons:ra,imageWindowLoader:Kn,initialSize:hr,isDraggable:xe,onDragLeave:we,onRowMoved:na,overscrollX:t4,overscrollY:Le,preventDiagonalScrolling:fa,rightElement:P5,rightElementProps:Xn,showMinimap:I5,smoothScrollX:Yn,smoothScrollY:a4,scrollToEnd:Ve,scaleToRem:O5=!1,rowHeight:D5=34,headerHeight:cr=36,groupHeaderHeight:Qn=cr,theme:vr,isOutsideClick:X8}=t,pa=Math.max(ua,20),Ta=Math.max(st,pa),Zn=Math.max(St??Ta,pa),za=N.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]).fontSize,Pa=N.useMemo(()=>Number.parseFloat(za),[za]),{rowHeight:H0,headerHeight:ma,groupHeaderHeight:e4,theme:gr,overscrollX:ti,overscrollY:N5}=p_({groupHeaderHeight:Qn,headerHeight:cr,overscrollX:t4,overscrollY:Le,remSize:Pa,rowHeight:D5,scaleToRem:O5,theme:vr}),zt=N.useMemo(()=>$===void 0?Xp:{...Xp,...$},[$]),Ia=f??(V>1e4?48:V>1e3?44:V>100?36:32),d2=s!=="none",T=d2?1:0,x0=s1!==void 0,L2=wt?.sticky===!0,[$5,ai]=N.useState(!1),W5=B0??$5,U5=N.useCallback(()=>{at!==void 0?at():ai(!1)},[at]),r4=N.useMemo(()=>S0===void 0?void 0:M5(S0,T),[S0,T]),G=r4??o,V2=N.useRef(new AbortController);N.useEffect(()=>()=>{V2?.current.abort()},[]);let[I0,j5]=xE(V1,C,T,V2.current,V),ei=N.useCallback((H,A,E)=>{if(f1===void 0)return!0;let P=[H[0]-T,H[1]];return f1?.(P,A,E)},[T,f1]),Ma=N.useRef(S0),J0=N.useCallback((H,A)=>{A&&(H=BE(H,I0,T,t1,V2.current)),r0!==void 0?(Ma.current=M5(H,-T),r0(Ma.current)):h(H)},[r0,I0,T,t1]),Ha=En(T2,N.useCallback((H,A,E,P)=>{T2?.(L[E-T],A,E-T,P)},[T2,T,L])),q5=En(q0,N.useCallback((H,A,E,P)=>{q0?.(L[E-T],A,E-T,P)},[q0,T,L])),dr=En(g2,N.useCallback((H,A,E,P)=>{g2?.(L[E-T],A,E-T,P)},[g2,T,L])),n4=En(q,N.useCallback(H=>{var A;return(A=q?.({...H,columnIndex:H.columnIndex-T}))!=null?A:!1},[q,T])),sr=N.useCallback(H=>{if(h1!==void 0){let A=h1(M5(H,-T));return typeof A=="boolean"?A:M5(A,T)}return!0},[h1,T]),[v0,A0,g0]=HE(G,J0,N1,nt,F1,D),S=N.useMemo(()=>({...iz(),...gr}),[gr]),[X,b1]=N.useState([10,10,0]),z1=N.useCallback(H=>H.kind!==M1.Custom?f_[H.kind]:P2?.find(A=>A.isMatch(H)),[P2]),E1=mE(L,V,j5,X[0]-(T===0?0:Ia)-X[2],pa,Zn,S,z1,V2.current),l1=N.useMemo(()=>E1.some(H=>H.group!==void 0),[E1]),q1=l1?ma+e4:ma,ut=G.rows.length,C1=s==="none"?"":ut===0?cz:ut===V?hz:hk,B1=N.useMemo(()=>s==="none"?E1:[{title:C1,width:Ia,icon:void 0,hasMenu:!1,style:"normal",themeOverride:Ut},...E1],[E1,Ia,s,C1,Ut]),[d0,vt]=N.useMemo(()=>[Kt!==void 0&&typeof H0=="number"?Math.floor(Kt/H0):0,Kt!==void 0&&typeof H0=="number"?-(Kt%H0):0],[Kt,H0]),xt=N.useRef({height:1,width:1,x:0,y:0}),mt=N.useMemo(()=>{var H,A;return{x:xt.current.x,y:d0,width:(H=xt.current.width)!=null?H:1,height:(A=xt.current.height)!=null?A:1,ty:vt}},[vt,d0]),lt=N.useRef(!1),[bt,t2,jt]=Ak(mt),R2=((e=bt.height)!=null?e:1)>1;N.useLayoutEffect(()=>{if(Kt!==void 0&&z.current!==null&&R2){if(z.current.scrollTop===Kt)return;z.current.scrollTop=Kt,z.current.scrollTop!==Kt&&jt(),lt.current=!0}},[Kt,R2,jt]);let I2=((r=bt.width)!=null?r:1)>1;N.useLayoutEffect(()=>{if(kt!==void 0&&z.current!==null&&I2){if(z.current.scrollLeft===kt)return;z.current.scrollLeft=kt,z.current.scrollLeft!==kt&&jt(),lt.current=!0}},[kt,I2,jt]);let y2=bt.x+T,s2=bt.y,G1=N.useRef(null),Xt=N.useCallback(H=>{var A;H===!0?(A=G1.current)==null||A.focus():window.requestAnimationFrame(()=>{var E;(E=G1.current)==null||E.focus()})},[]),Yt=x0?V+1:V,O0=N.useCallback(H=>{let A=T===0?H:H.map(P=>({...P,location:[P.location[0]-T,P.location[1]]})),E=I1?.(A);if(E!==!0)for(let P of A)x1?.(P.location,P.value);return E},[x1,I1,T]),ur=N.useMemo(()=>{if(W!==void 0)return T===0?W:W.map(H=>{let A=B1.length-H.range.x-T;if(!(A<=0))return{color:H.color,range:{...H.range,x:H.range.x+T,width:Math.min(A,H.range.width)},style:H.style}}).filter(H=>H!==void 0)},[W,B1.length,T]),Y8=N.useRef(B1);Y8.current=B1;let F0=N.useCallback(([H,A],E=!1)=>{var P,Y,Q,K,a1,j,v1,m1,T1,Q1;let L1=x0&&A===Yt-1;if(H===0&&d2)return L1?Yp:{kind:ta.Marker,allowOverlay:!1,checked:G?.rows.hasIndex(A)===!0,markerKind:s==="clickable-number"?"number":s,row:Gt+A,drawHandle:na!==void 0,cursor:s==="clickable-number"?"pointer":void 0};if(L1){let et=H===T&&(P=wt?.hint)!=null?P:"",_1=Y8.current[H];if(((Y=_1?.trailingRowOptions)==null?void 0:Y.disabled)===!0)return Yp;{let gt=(K=(Q=_1?.trailingRowOptions)==null?void 0:Q.hint)!=null?K:et,Et=(j=(a1=_1?.trailingRowOptions)==null?void 0:a1.addIcon)!=null?j:wt?.addIcon;return{kind:ta.NewRow,hint:gt,allowOverlay:!1,icon:Et}}}else{let Z1=H-T;if(E||Ht?.strict===!0){let _1=xt.current,gt=_1.x>Z1||Z1>_1.x+_1.width||_1.y>A||A>_1.y+_1.height,Et=Z1===((m1=(v1=_1.extras)==null?void 0:v1.selected)==null?void 0:m1[0])&&A===((T1=_1.extras)==null?void 0:T1.selected[1]),ft=((Q1=_1.extras)==null?void 0:Q1.freezeRegion)===void 0||_1.extras.freezeRegion.x>Z1||Z1>_1.extras.freezeRegion.x+_1.extras.freezeRegion.width||_1.extras.freezeRegion.y>A||A>_1.extras.freezeRegion.y+_1.extras.freezeRegion.height;if(gt&&!Et&&ft)return{kind:M1.Loading,allowOverlay:!1}}let et=C([Z1,A]);return T!==0&&et.span!==void 0&&(et={...et,span:[et.span[0]+T,et.span[1]+T]}),et}},[x0,Yt,d2,G?.rows,na,s,T,wt?.hint,wt?.addIcon,Ht?.strict,C,Gt]),G5=N.useCallback(H=>{var A,E;let P=(A=ct?.(H))!=null?A:{name:H};return o1!==void 0&&H!==""&&(P={icon:P.icon,name:P.name,overrideTheme:P.overrideTheme,actions:[...(E=P.actions)!=null?E:[],{title:"Rename",icon:"renameIcon",onClick:Y=>Y5({group:P.name,bounds:Y.bounds})}]}),P},[ct,o1]),ri=N.useCallback(H=>{var A;let[E,P]=H.cell,Y=B1[E],Q=Y?.group!==void 0?(A=G5(Y.group))==null?void 0:A.overrideTheme:void 0,K=Y?.themeOverride,a1=M?.(P);v({...H,theme:{...S,...Q,...K,...a1,...H.content.themeOverride}})},[M,B1,G5,S]),fr=N.useCallback((H,A,E)=>{var P;if(G.current===void 0)return;let[Y,Q]=G.current.cell,K=F0([Y,Q]);if(K.kind!==M1.Boolean&&K.allowOverlay){let a1=K;if(E!==void 0)switch(a1.kind){case M1.Number:{let j=lk(()=>E==="-"?-0:Number.parseFloat(E),0);a1={...a1,data:Number.isNaN(j)?0:j};break}case M1.Text:case M1.Markdown:case M1.Uri:a1={...a1,data:E};break}ri({target:H,content:a1,initialValue:E,cell:[Y,Q],highlight:E===void 0,forceEditMode:E!==void 0})}else K.kind===M1.Boolean&&A&&K.readonly!==!0&&(O0([{location:G.current.cell,value:{...K,data:Dz(K.data)}}]),(P=G1.current)==null||P.damage([{cell:G.current.cell}]))},[F0,G,O0,ri]),Q8=N.useCallback((H,A)=>{var E;let P=(E=G1.current)==null?void 0:E.getBounds(H,A);if(P===void 0||z.current===null)return;let Y=F0([H,A]);!Y.allowOverlay||ri({target:P,content:Y,initialValue:void 0,highlight:!0,cell:[H,A],forceEditMode:!0})},[F0,ri]),Qt=N.useCallback((H,A,E="both",P=0,Y=0,Q=void 0)=>{var K;if(z.current!==null){let a1=G1.current,j=d.current,v1=typeof H!="number"?H.unit==="cell"?H.amount:void 0:H,m1=typeof A!="number"?A.unit==="cell"?A.amount:void 0:A,T1=typeof H!="number"&&H.unit==="px"?H.amount:void 0,Q1=typeof A!="number"&&A.unit==="px"?A.amount:void 0;if(a1!==null&&j!==null){let L1={x:0,y:0,width:0,height:0},k1=0,Z1=0;if((v1!==void 0||m1!==void 0)&&(L1=(K=a1.getBounds((v1??0)+T,m1??0))!=null?K:L1,L1.width===0||L1.height===0))return;let et=j.getBoundingClientRect(),_1=et.width/j.offsetWidth;if(T1!==void 0&&(L1={...L1,x:T1-et.left-z.current.scrollLeft,width:1}),Q1!==void 0&&(L1={...L1,y:Q1+et.top-z.current.scrollTop,height:1}),L1!==void 0){let gt={x:L1.x-P,y:L1.y-Y,width:L1.width+2*P,height:L1.height+2*Y},Et=0;for(let n0=0;n0gt.x?k1=gt.x-Vt:rtgt.y?Z1=gt.y-K1:At{var E;let P=B1[H];if(((E=P?.trailingRowOptions)==null?void 0:E.disabled)===!0)return;let Y=s1?.(),Q,K=!0;Y!==void 0&&(Q=await Y,Q==="top"&&(K=!1),typeof Q=="number"&&(K=!1));let a1=0,j=()=>{if(t6.current<=V){a1<500&&window.setTimeout(j,a1),a1=50+a1*2;return}let v1=typeof Q=="number"?Q:K?V:0;Qt(H-T,v1),v0({cell:[H,v1],range:{x:H,y:v1,width:1,height:1}},!1,!1,"edit");let m1=J8.current([H-T,v1]);m1.allowOverlay&&tr(m1)&&m1.readonly!==!0&&A&&window.setTimeout(()=>{Z8.current(H,v1)},0)};j()},[B1,s1,T,V,Qt,v0]),ni=N.useCallback(H=>{var A,E,P;let Y=(P=(E=(A=E1[H])==null?void 0:A.trailingRowOptions)==null?void 0:E.targetColumn)!=null?P:wt?.targetColumn;if(typeof Y=="number")return Y+(d2?1:0);if(typeof Y=="object"){let Q=L.indexOf(Y);if(Q>=0)return Q+(d2?1:0)}},[E1,L,d2,wt?.targetColumn]),Oa=N.useRef(),l4=N.useRef(),pr=N.useCallback((H,A)=>{var E;let[P,Y]=A;return{...S,...(E=B1[P])==null?void 0:E.themeOverride,...M?.(Y),...H.themeOverride}},[M,B1,S]),zr=N.useCallback(H=>{var A,E,P,Y;let Q=V5.value?H.metaKey:H.ctrlKey,K=Q&&A1==="multi",a1=Q&&I==="multi",[j,v1]=H.location,m1=G.columns,T1=G.rows,[Q1,L1]=(E=(A=G.current)==null?void 0:A.cell)!=null?E:[];if(H.kind==="cell"){if(l4.current=void 0,Re.current=[j,v1],j===0&&d2){if(x0===!0&&v1===V||s==="number"||A1==="none")return;let k1=F0(H.location);if(k1.kind!==ta.Marker)return;if(na!==void 0){let _1=z1(k1);l2(_1?.kind===ta.Marker);let gt=(P=_1?.onClick)==null?void 0:P.call(_1,{...H,cell:k1,posX:H.localEventX,posY:H.localEventY,bounds:H.bounds,theme:pr(k1,H.location),preventDefault:()=>{}});if(gt===void 0||gt.checked===k1.checked)return}v(void 0),Xt();let Z1=T1.hasIndex(v1),et=Oa.current;if(A1==="multi"&&(H.shiftKey||H.isLongTouch===!0)&&et!==void 0&&T1.hasIndex(et)){let _1=[Math.min(et,v1),Math.max(et,v1)+1];K||Bt==="multi"?A0(void 0,_1,!0):A0(Lt.fromSingleSelection(_1),void 0,K)}else K||H.isTouch||Bt==="multi"?Z1?A0(T1.remove(v1),void 0,!0):(A0(void 0,v1,!0),Oa.current=v1):Z1&&T1.length===1?A0(Lt.empty(),void 0,Q):(A0(Lt.fromSingleSelection(v1),void 0,Q),Oa.current=v1)}else if(j>=T&&x0&&v1===V){let k1=ni(j);i4(k1??j)}else if(Q1!==j||L1!==v1){let k1=F0(H.location),Z1=z1(k1);if(Z1?.onSelect!==void 0){let gt=!1;if(Z1.onSelect({...H,cell:k1,posX:H.localEventX,posY:H.localEventY,bounds:H.bounds,preventDefault:()=>gt=!0,theme:pr(k1,H.location)}),gt)return}let et=L2&&v1===V,_1=L2&&G!==void 0&&((Y=G.current)==null?void 0:Y.cell[1])===V;if((H.shiftKey||H.isLongTouch===!0)&&Q1!==void 0&&L1!==void 0&&G.current!==void 0&&!_1){if(et)return;let gt=Math.min(j,Q1),Et=Math.max(j,Q1),ft=Math.min(v1,L1),Vt=Math.max(v1,L1);v0({...G.current,range:{x:gt,y:ft,width:Et-gt+1,height:Vt-ft+1}},!0,Q,"click"),Oa.current=void 0,Xt()}else v0({cell:[j,v1],range:{x:j,y:v1,width:1,height:1}},!0,Q,"click"),Oa.current=void 0,v(void 0),Xt()}}else if(H.kind==="header")if(Re.current=[j,v1],v(void 0),d2&&j===0)Oa.current=void 0,l4.current=void 0,A1==="multi"&&(T1.length!==V?A0(Lt.fromSingleSelection([0,V]),void 0,Q):A0(Lt.empty(),void 0,Q),Xt());else{let k1=l4.current;if(I==="multi"&&(H.shiftKey||H.isLongTouch===!0)&&k1!==void 0&&m1.hasIndex(k1)){let Z1=[Math.min(k1,j),Math.max(k1,j)+1];a1?g0(void 0,Z1,Q):g0(Lt.fromSingleSelection(Z1),void 0,Q)}else a1?(m1.hasIndex(j)?g0(m1.remove(j),void 0,Q):g0(void 0,j,Q),l4.current=j):I!=="none"&&(g0(Lt.fromSingleSelection(j),void 0,Q),l4.current=j);Oa.current=void 0,Xt()}else H.kind===x2?Re.current=[j,v1]:H.kind===A5&&!H.isMaybeScrollbar&&(J0(H5,!1),v(void 0),Xt(),Mt?.(),Oa.current=void 0,l4.current=void 0)},[i4,I,Xt,z1,ni,F0,G,d2,L2,Mt,na,T,s,A1,Bt,V,v0,J0,g0,A0,x0,pr]),K5=N.useRef(!1),Re=N.useRef(),a6=N.useRef(bt),u2=N.useRef(),Vm=N.useCallback(H=>{var A,E;if(o4.current=!1,a6.current=xt.current,H.button!==0&&H.button!==1){u2.current=void 0;return}let P=performance.now(),Y=P-((E=(A=u2.current)==null?void 0:A.time)!=null?E:-1e3)<250;u2.current={wasDoubleClick:Y,button:H.button,time:P,location:H.location},H?.kind==="header"&&(K5.current=!0);let Q=H.kind==="cell"&&H.isFillHandle;!Q&&H.kind!=="cell"&&H.isEdge||(p({previousSelection:G,fillHandle:Q}),Re.current=void 0,!H.isTouch&&H.button===0?zr(H):!H.isTouch&&H.button===1&&(Re.current=H.location))},[G,zr]),[X5,Y5]=N.useState(),e6=N.useCallback(H=>{if(H.kind!==x2||I!=="multi")return;let A=V5.value?H.metaKey:H.ctrlKey,[E]=H.location,P=G.columns;if(E=T&&$n(Y.group,B1[a1].group);a1--)Q--;for(let a1=E+1;a1{var A;if(G.current===void 0)return;let E=[],P=G.current.range;for(let Y=0;Y({cell:Y.location})))},[F0,G,O0]),o4=N.useRef(!1),li=N.useCallback(async(H,A=!1)=>{var E;if((((E=u2.current)==null?void 0:E.wasDoubleClick)===!0||A)&&I0!==void 0&&Ha!==void 0){let P=xt.current.y,Y=xt.current.height,Q=I0({x:H,y:P,width:1,height:Math.min(Y,V-P)},V2.current.signal);typeof Q!="object"&&(Q=await Q());let K=E1[H-T],j=document.createElement("canvas").getContext("2d",{alpha:!1});if(j!==null){j.font=`${S.baseFontStyle} ${S.fontFamily}`;let v1=Iz(j,S,K,0,Q,pa,Ta,!1,z1);Ha?.(K,v1.width,H,v1.width)}}},[E1,I0,Ta,S,pa,Ha,T,V,z1]),[Rm,r6]=N.useState(),ym=N.useCallback((H,A)=>{var E,P,Y;let Q=u;if(p(void 0),r6(void 0),K5.current=!1,A)return;if(Q?.fillHandle===!0&&G.current!==void 0){ii(G.current.cell[1]!==G.current.range.y);return}let[K,a1]=H.location,[j,v1]=(E=Re.current)!=null?E:[],m1=()=>{o4.current=!0},T1=L1=>{var k1,Z1,et;let _1=L1.isTouch||j===K&&v1===a1;if(_1&&k?.([K-T,a1],{...L1,preventDefault:m1}),L1.button===1)return!o4.current;if(!o4.current){let gt=F0(H.location),Et=z1(gt);if(Et!==void 0&&Et.onClick!==void 0&&_1){let ft=Et.onClick({...L1,cell:gt,posX:L1.localEventX,posY:L1.localEventY,bounds:L1.bounds,theme:pr(gt,H.location),preventDefault:m1});ft!==void 0&&!ue(ft)&&ba(ft)&&(O0([{location:L1.location,value:ft}]),(k1=G1.current)==null||k1.damage([{cell:L1.location}]))}if(!o4.current&&((et=(Z1=Q?.previousSelection)==null?void 0:Z1.current)==null?void 0:et.cell)!==void 0&&G.current!==void 0){let[ft,Vt]=G.current.cell,[rt,K1]=Q.previousSelection.current.cell;if(K===ft&&K===rt&&a1===Vt&&a1===K1)return b?.([K-T,a1]),fr(L1.bounds,!1),!0}}return!1},Q1=H.location[0]-T;if(H.isTouch){let L1=xt.current,k1=a6.current;if(L1.x!==k1.x||L1.y!==k1.y)return;if(H.isLongTouch===!0){if(H.kind==="cell"&&((P=G?.current)==null?void 0:P.cell[0])===K&&((Y=G?.current)==null?void 0:Y.cell[1])===a1){O?.([Q1,H.location[1]],{...H,preventDefault:m1});return}else if(H.kind==="header"&&G.columns.hasIndex(K)){U?.(Q1,{...H,preventDefault:m1});return}else if(H.kind===x2){if(Q1<0)return;p1?.(Q1,{...H,preventDefault:m1});return}}H.kind==="cell"?T1(H)||zr(H):H.kind===x2?d1?.(Q1,{...H,preventDefault:m1}):(H.kind===se&&i1?.(Q1,{...H,preventDefault:m1}),zr(H));return}if(H.kind==="header"){if(Q1<0)return;H.isEdge?li(K):H.button===0&&K===j&&a1===v1&&i1?.(Q1,{...H,preventDefault:m1})}if(H.kind===x2){if(Q1<0)return;H.button===0&&K===j&&a1===v1&&(d1?.(Q1,{...H,preventDefault:m1}),o4.current||e6(H))}H.kind==="cell"&&(H.button===0||H.button===1)&&T1(H),Re.current=void 0},[u,T,G,k,ii,F0,z1,pr,O0,b,fr,O,U,p1,zr,d1,li,i1,e6]),Cm=N.useCallback(H=>{let A={...H,location:[H.location[0]-T,H.location[1]]};u1?.(A),r6(E=>{var P,Y;return K5.current?[H.scrollEdge[0],0]:H.scrollEdge[0]===E?.[0]&&H.scrollEdge[1]===E[1]?E:u===void 0||((Y=(P=u2.current)==null?void 0:P.location[0])!=null?Y:0){Tt?.(H-T,A)},[Tt,T]),xa=(n=G?.current)==null?void 0:n.cell,Sm=N.useCallback((H,A,E,P,Y,Q)=>{lt.current=!1;let K=xa;K!==void 0&&(K=[K[0]-T,K[1]]);let a1={x:H.x-T,y:H.y,width:H.width,height:x0&&H.y+H.height>=V?H.height-1:H.height,tx:Y,ty:Q,extras:{selected:K,freezeRegion:J1===0?void 0:{x:0,y:H.y,width:J1,height:H.height}}};xt.current=a1,t2(a1),b1([A,E,P]),Z0?.(a1,a1.tx,a1.ty,a1.extras)},[xa,T,x0,V,J1,t2,Z0]),Am=En(w1,N.useCallback((H,A)=>{w1?.(H-T,A-T),I!=="none"&&g0(Lt.fromSingleSelection(A),void 0,!0)},[I,w1,T,g0])),Q5=N.useRef(!1),Fm=N.useCallback(H=>{if(H.location[0]===0&&T>0){H.preventDefault();return}r1?.({...H,location:[H.location[0]-T,H.location[1]]}),H.defaultPrevented()||(Q5.current=!0),p(void 0)},[r1,T]),km=N.useCallback(()=>{Q5.current=!1},[]),bm=N.useCallback(H=>{var A,E;if(!(((A=u2?.current)==null?void 0:A.button)!==void 0&&u2.current.button>=1)){if(u!==void 0&&((E=u2.current)==null?void 0:E.location[0])===0&&H.location[0]===0&&T===1&&A1==="multi"&&u.previousSelection&&!u.previousSelection.rows.hasIndex(u2.current.location[1])&&G.rows.hasIndex(u2.current.location[1])){let P=Math.min(u2.current.location[1],H.location[1]),Y=Math.max(u2.current.location[1],H.location[1])+1;A0(Lt.fromSingleSelection([P,Y]),void 0,!1)}if(u!==void 0&&G.current!==void 0&&!Q5.current&&(D==="rect"||D==="multi-rect")){let[P,Y]=G.current.cell,[Q,K]=H.location;if(K<0&&(K=xt.current.y),L2&&Y===V)return;if(L2&&K===V)if(H.kind===A5)K--;else return;Q=Math.max(Q,T);let v1=Q-P,m1=K-Y,T1={x:v1>=0?P:Q,y:m1>=0?Y:K,width:Math.abs(v1)+1,height:Math.abs(m1)+1};v0({...G.current,range:T1},!0,!1,"drag")}e0?.({...H,location:[H.location[0]-T,H.location[1]]})}},[u,T,A1,G,D,e0,A0,L2,V,v0]),ye=N.useCallback(H=>{if(G.current===void 0)return;let[A,E]=H,[P,Y]=G.current.cell,Q=G.current.range,K=Q.x,a1=Q.x+Q.width,j=Q.y,v1=Q.y+Q.height;if(E!==0)switch(E){case 2:{v1=V,j=Y,Qt(0,v1,"vertical");break}case-2:{j=0,v1=Y+1,Qt(0,j,"vertical");break}case 1:{jY+1?(v1--,Qt(0,v1,"vertical")):(j=Math.max(0,j-1),Qt(0,j,"vertical"));break}default:Dn(E)}if(A!==0)if(A===2)a1=B1.length,K=P,Qt(a1-1-T,0,"horizontal");else if(A===-2)K=T,a1=P+1,Qt(K-T,0,"horizontal");else{let m1=[];if(I0!==void 0){let T1=I0({x:K,y:j,width:a1-K-T,height:v1-j},V2.current.signal);typeof T1=="object"&&(m1=m_(T1))}if(A===1){let T1=!1;if(K0){let Q1=(0,Ye.default)(K+1,P+1).find(L1=>!m1.includes(L1-T));Q1!==void 0&&(K=Q1,T1=!0)}else K++,T1=!0;T1&&Qt(K,0,"horizontal")}T1||(a1=Math.min(B1.length,a1+1),Qt(a1-1-T,0,"horizontal"))}else if(A===-1){let T1=!1;if(a1>P+1){if(m1.length>0){let Q1=(0,Ye.default)(a1-1,P,-1).find(L1=>!m1.includes(L1-T));Q1!==void 0&&(a1=Q1,T1=!0)}else a1--,T1=!0;T1&&Qt(a1-T,0,"horizontal")}T1||(K=Math.max(T,K-1),Qt(K-T,0,"horizontal"))}else Dn(A)}v0({cell:G.current.cell,range:{x:K,y:j,width:a1-K,height:v1-j}},!0,!1,"keyboard-select")},[I0,G,B1.length,T,V,Qt,v0]),Da=N.useCallback((H,A,E,P)=>{let Y=Yt-(E?0:1);if(H=(0,Tn.default)(H,T,E1.length-1+T),A=(0,Tn.default)(A,0,Y),H===xa?.[0]&&A===xa?.[1])return!1;if(P&&G.current!==void 0){let Q=[...G.current.rangeStack];(G.current.range.width>1||G.current.range.height>1)&&Q.push(G.current.range),J0({...G,current:{cell:[H,A],range:{x:H,y:A,width:1,height:1},rangeStack:Q}},!0)}else v0({cell:[H,A],range:{x:H,y:A,width:1,height:1}},!0,!1,"keyboard-nav");return x.current!==void 0&&x.current[0]===H&&x.current[1]===A&&(x.current=void 0),Qt(H-T,A),!0},[Yt,T,E1.length,xa,G,Qt,J0,v0]),Em=N.useCallback((H,A)=>{c?.cell!==void 0&&H!==void 0&&ba(H)&&(O0([{location:c.cell,value:H}]),window.requestAnimationFrame(()=>{var Y;(Y=G1.current)==null||Y.damage([{cell:c.cell}])})),Xt(!0),v(void 0);let[E,P]=A;if(G.current!==void 0&&(E!==0||P!==0)){let Y=G.current.cell[1]===Yt-1&&H!==void 0;Da((0,Tn.default)(G.current.cell[0]+E,0,B1.length-1),(0,Tn.default)(G.current.cell[1]+P,0,Yt-1),Y,!1)}F?.(H,A)},[c?.cell,Xt,G,F,O0,Yt,Da,B1.length]),Z5=N.useMemo(()=>`gdg-overlay-${z_++}`,[]),Ce=N.useCallback(H=>{var A,E,P,Y;Xt();let Q=[];for(let K=H.x;K({cell:K.location})))},[Xt,C,z1,O0,T]),mr=N.useCallback(H=>{(async()=>{var E,P,Y,Q,K;let a1=!1;if(Y1!==void 0&&Y1({...H,cancel:()=>{a1=!0}}),a1)return;let j=()=>{H.stopPropagation(),H.preventDefault()},v1=c!==void 0,{altKey:m1,shiftKey:T1,metaKey:Q1,ctrlKey:L1,key:k1,bounds:Z1}=H,et=V5.value,_1=et?Q1:L1,gt=k1==="Delete"||et&&k1==="Backspace",Et=xt.current,ft=G.columns,Vt=G.rows;if(k1==="Escape"){v1?v(void 0):zt.clear&&(J0(H5,!1),Mt?.());return}else if(T0("primary+a",H)&&zt.selectAll){if(!v1)J0({columns:Lt.empty(),rows:Lt.empty(),current:{cell:(P=(E=G.current)==null?void 0:E.cell)!=null?P:[T,0],range:{x:T,y:0,width:L.length,height:V},rangeStack:[]}},!1);else{let Ft=document.getElementById(Z5);if(Ft!==null){let n0=window.getSelection(),k0=document.createRange();k0.selectNodeContents(Ft),n0?.removeAllRanges(),n0?.addRange(k0)}}j();return}else T0("primary+f",H)&&zt.search&&(j(),(Y=g?.current)==null||Y.focus({preventScroll:!0}),ai(!0));if(gt){let Ft=(Q=sr?.(G))!=null?Q:!0;if(j(),Ft!==!1){let n0=Ft===!0?G:Ft;if(n0.current!==void 0){Ce(n0.current.range);for(let k0 of n0.current.rangeStack)Ce(k0)}for(let k0 of n0.rows)Ce({x:T,y:k0,width:B1.length-T,height:1});for(let k0 of n0.columns)Ce({x:k0,y:0,width:1,height:V})}return}if(G.current===void 0)return;let[rt,K1]=G.current.cell,At=!1;if(zt.selectColumn&&T0("ctrl+ ",H)&&I!=="none")ft.hasIndex(rt)?g0(ft.remove(rt),void 0,!0):I==="single"?g0(Lt.fromSingleSelection(rt),void 0,!0):g0(void 0,rt,!0);else if(zt.selectRow&&T0("shift+ ",H)&&A1!=="none")Vt.hasIndex(K1)?A0(Vt.remove(K1),void 0,!0):A1==="single"?A0(Lt.fromSingleSelection(K1),void 0,!0):A0(void 0,K1,!0);else if((T0("Enter",H)||T0(" ",H)||T0("shift+Enter",H))&&Z1!==void 0)v1?(v(void 0),T0("Enter",H)?K1++:T0("shift+Enter",H)&&K1--):K1===V&&x0?window.setTimeout(()=>{let Ft=ni(rt);i4(Ft??rt)},0):(b?.([rt-T,K1]),fr(Z1,!0),j());else if(zt.downFill&&T0("primary+_68",H)&&G.current.range.height>1)ii(!1),j();else if(zt.rightFill&&T0("primary+_82",H)&&G.current.range.width>1){let Ft=[],n0=G.current.range;for(let k0=0;k0({cell:k0.location}))),j()}else if(zt.pageDown&&T0("PageDown",H))K1+=Math.max(1,xt.current.height-4),j();else if(zt.pageUp&&T0("PageUp",H))K1-=Math.max(1,xt.current.height-4),j();else if(zt.first&&T0("primary+Home",H))v(void 0),K1=0,rt=0;else if(zt.last&&T0("primary+End",H))v(void 0),K1=Number.MAX_SAFE_INTEGER,rt=Number.MAX_SAFE_INTEGER;else if(zt.first&&T0("primary+shift+Home",H))v(void 0),ye([-2,-2]);else if(zt.last&&T0("primary+shift+End",H))v(void 0),ye([2,2]);else if(k1==="ArrowDown"){if(L1&&m1)return;v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([0,_1&&!m1?2:1]):(m1&&!_1&&(At=!0),_1&&!m1?K1=V-1:K1+=1)}else if(k1==="ArrowUp"||k1==="Home"){let Ft=k1==="Home"||_1;v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([0,Ft&&!m1?-2:-1]):(m1&&!Ft&&(At=!0),K1+=Ft&&!m1?Number.MIN_SAFE_INTEGER:-1)}else if(k1==="ArrowRight"||k1==="End"){let Ft=k1==="End"||_1;v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([Ft&&!m1?2:1,0]):(m1&&!Ft&&(At=!0),rt+=Ft&&!m1?Number.MAX_SAFE_INTEGER:1)}else if(k1==="ArrowLeft")v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([_1&&!m1?-2:-1,0]):(m1&&!_1&&(At=!0),rt+=_1&&!m1?Number.MIN_SAFE_INTEGER:-1);else if(k1==="Tab")v(void 0),T1?rt--:rt++;else if(!Q1&&!L1&&G.current!==void 0&&k1.length===1&&/[ -~]/g.test(k1)&&Z1!==void 0&&tr(C([rt-T,Math.max(0,Math.min(K1,V-1))]))){if((!L2||K1!==V)&&(Et.y>K1||K1>Et.y+Et.height||Et.x>rt||rt>Et.x+Et.width))return;fr(Z1,!0,k1),j()}Da(rt,K1,!1,At)&&j()})()},[Y1,Ce,c,G,zt.selectAll,zt.search,zt.selectColumn,zt.selectRow,zt.downFill,zt.rightFill,zt.pageDown,zt.pageUp,zt.first,zt.last,zt.clear,I,A1,C,T,Da,J0,Mt,L.length,V,Z5,O0,sr,B1.length,g0,A0,x0,ni,i4,b,fr,ii,F0,ye,D,L2]),_m=N.useCallback((H,A)=>{let E=H.location[0]-T;if(H.kind==="header"&&U?.(E,{...H,preventDefault:A}),H.kind===x2){if(E<0)return;p1?.(E,{...H,preventDefault:A})}if(H.kind==="cell"){let[P,Y]=H.location;O?.([E,Y],{...H,preventDefault:A}),ok(G,H.location)||Da(P,Y,!1,!1)}},[G,O,p1,U,T,Da]),J5=N.useCallback(async H=>{var A,E,P,Y,Q,K,a1;if(!zt.paste)return;function j(L1,k1,Z1,et){var _1,gt,Et,ft;let Vt=typeof Z1=="object"?(_1=Z1?.join(`
-`))!=null?_1:"":(gt=Z1?.toString())!=null?gt:"";if(!ue(L1)&&tr(L1)&&L1.readonly!==!0){let rt=_?.(Vt,L1);if(rt!==void 0&&ba(rt))return rt.kind!==L1.kind&&console.warn("Coercion should not change cell kind."),{location:k1,value:rt};let K1=z1(L1);if(K1===void 0)return;if(K1.kind===M1.Custom){l2(L1.kind===M1.Custom);let At=(Et=K1.onPaste)==null?void 0:Et.call(K1,Vt,L1.data);return At===void 0?void 0:{location:k1,value:{...L1,data:At}}}else{let At=(ft=K1.onPaste)==null?void 0:ft.call(K1,Vt,L1,{formatted:et,formattedString:typeof et=="string"?et:et?.join(`
-`),rawValue:Z1});return At===void 0?void 0:(l2(At.kind===L1.kind),{location:k1,value:At})}}}let v1=G.columns,m1=G.rows,T1=((A=z.current)==null?void 0:A.contains(document.activeElement))===!0||((E=d.current)==null?void 0:E.contains(document.activeElement))===!0,Q1=(P=G.current)==null?void 0:P.cell;if(Q1===void 0&&v1.length===1&&(Q1=[(Y=v1.first())!=null?Y:0,0]),Q1===void 0&&m1.length===1&&(Q1=[T,(Q=m1.first())!=null?Q:0]),T1&&Q1!==void 0){let L1,k1,Z1="text/plain",et="text/html";if(navigator.clipboard.read!==void 0){let ft=await navigator.clipboard.read();for(let Vt of ft){if(Vt.types.includes(et)){let K1=await(await Vt.getType(et)).text(),At=$p(K1);if(At!==void 0){L1=At;break}}Vt.types.includes(Z1)&&(k1=await(await Vt.getType(Z1)).text())}}else if(navigator.clipboard.readText!==void 0)k1=await navigator.clipboard.readText();else if(H!==void 0&&H?.clipboardData!==null){if(H.clipboardData.types.includes(et)){let ft=H.clipboardData.getData(et);L1=$p(ft)}L1===void 0&&H.clipboardData.types.includes(Z1)&&(k1=H.clipboardData.getData(Z1))}else return;let[_1,gt]=Q1,Et=[];do{if(H1===void 0){let ft=F0(Q1),Vt=(K=k1??L1?.map(K1=>K1.map(At=>At.rawValue).join(" ")).join(" "))!=null?K:"",rt=j(ft,Q1,Vt,void 0);rt!==void 0&&Et.push(rt);break}if(L1===void 0){if(k1===void 0)return;L1=SE(k1)}if(H1===!1||typeof H1=="function"&&H1?.([Q1[0]-T,Q1[1]],L1.map(ft=>ft.map(Vt=>{var rt,K1;return(K1=(rt=Vt.rawValue)==null?void 0:rt.toString())!=null?K1:""})))!==!0)return;for(let[ft,Vt]of L1.entries()){if(ft+gt>=V)break;for(let[rt,K1]of Vt.entries()){let At=[rt+_1,ft+gt],[Be,Ft]=At;if(Be>=B1.length||Ft>=Yt)continue;let n0=F0(At),k0=j(n0,At,K1.rawValue,K1.formatted);k0!==void 0&&Et.push(k0)}}}while(!1);O0(Et),(a1=G1.current)==null||a1.damage(Et.map(ft=>({cell:ft.location})))}},[_,z1,F0,G,zt.paste,B1.length,O0,Yt,H1,T,V]);P0("paste",J5,window,!1,!0);let Mr=N.useCallback(async(H,A)=>{var E,P;if(!zt.copy)return;let Y=A===!0||((E=z.current)==null?void 0:E.contains(document.activeElement))===!0||((P=d.current)==null?void 0:P.contains(document.activeElement))===!0,Q=G.columns,K=G.rows,a1=(j,v1)=>{if(!O1)Up(j,v1,H);else{let m1=v1.map(T1=>({kind:M1.Text,data:L[T1].title,displayData:L[T1].title,allowOverlay:!1}));Up([m1,...j],v1,H)}};if(Y&&I0!==void 0){if(G.current!==void 0){let j=I0(G.current.range,V2.current.signal);typeof j!="object"&&(j=await j()),a1(j,(0,Ye.default)(G.current.range.x-T,G.current.range.x+G.current.range.width-T))}else if(K!==void 0&&K.length>0){let v1=[...K].map(m1=>{let T1=I0({x:T,y:m1,width:L.length,height:1},V2.current.signal);return typeof T1=="object"?T1[0]:T1().then(Q1=>Q1[0])});if(v1.some(m1=>m1 instanceof Promise)){let m1=await Promise.all(v1);a1(m1,(0,Ye.default)(L.length))}else a1(v1,(0,Ye.default)(L.length))}else if(Q.length>0){let j=[],v1=[];for(let m1 of Q){let T1=I0({x:m1,y:0,width:1,height:V},V2.current.signal);typeof T1!="object"&&(T1=await T1()),j.push(T1),v1.push(m1-T)}if(j.length===1)a1(j[0],v1);else{let m1=j.reduce((T1,Q1)=>T1.map((L1,k1)=>[...L1,...Q1[k1]]));a1(m1,v1)}}}},[L,I0,G,zt.copy,T,V,O1]);P0("copy",Mr,window,!1,!1);let Tm=N.useCallback(async H=>{var A,E;!zt.cut||!(((A=z.current)==null?void 0:A.contains(document.activeElement))===!0||((E=d.current)==null?void 0:E.contains(document.activeElement))===!0)||(await Mr(H),G.current!==void 0&&Ce(G.current.range))},[Ce,G,zt.cut,Mr]);P0("cut",Tm,window,!1,!1);let Pm=N.useCallback((H,A)=>{if(X1!==void 0){T!==0&&(H=H.map(Y=>[Y[0]-T,Y[1]])),X1(H,A);return}if(H.length===0||A===-1)return;let[E,P]=H[A];x.current!==void 0&&x.current[0]===E&&x.current[1]===P||(x.current=[E,P],Da(E,P,!1,!1))},[X1,T,Da]),[oi,hi]=(l=(i=S0?.current)==null?void 0:i.cell)!=null?l:[],n6=N.useRef(Qt);n6.current=Qt,N.useLayoutEffect(()=>{var H,A,E,P;!lt.current&&oi!==void 0&&hi!==void 0&&(oi!==((A=(H=Ma.current)==null?void 0:H.current)==null?void 0:A.cell[0])||hi!==((P=(E=Ma.current)==null?void 0:E.current)==null?void 0:P.cell[1]))&&n6.current(oi,hi),lt.current=!1},[oi,hi]);let i6=G.current!==void 0&&(G.current.cell[0]>=B1.length||G.current.cell[1]>=Yt);N.useLayoutEffect(()=>{i6&&J0(H5,!1)},[i6,J0]);let Im=N.useMemo(()=>x0===!0&&wt?.tint===!0?Lt.fromSingleSelection(Yt-1):Lt.empty(),[Yt,x0,wt?.tint]),Om=N.useCallback(H=>{var A;return typeof c2=="boolean"?c2:(A=c2?.(H-T))!=null?A:!0},[T,c2]),Dm=N.useMemo(()=>{if(X5===void 0||d.current===null)return null;let{bounds:H,group:A}=X5,E=d.current.getBoundingClientRect();return N.createElement(pE,{bounds:H,group:A,canvasBounds:E,onClose:()=>Y5(void 0),onFinish:P=>{Y5(void 0),o1?.(A,P)}})},[o1,X5]),Nm=Math.min(B1.length,J1+(d2?1:0));N.useImperativeHandle(a,()=>({appendRow:(H,A)=>i4(H+T,A),updateCells:H=>{var A;return T!==0&&(H=H.map(E=>({cell:[E.cell[0]+T,E.cell[1]]}))),(A=G1.current)==null?void 0:A.damage(H)},getBounds:(H,A)=>{var E;if(!(d?.current===null||z?.current===null)){if(H===void 0&&A===void 0){let P=d.current.getBoundingClientRect(),Y=P.width/z.current.clientWidth;return{x:P.x-z.current.scrollLeft*Y,y:P.y-z.current.scrollTop*Y,width:z.current.scrollWidth*Y,height:z.current.scrollHeight*Y}}return(E=G1.current)==null?void 0:E.getBounds(H??0+T,A)}},focus:()=>{var H;return(H=G1.current)==null?void 0:H.focus()},emit:async H=>{switch(H){case"delete":mr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!1,key:"Delete",keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-right":mr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"r",keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-down":mr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"d",keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"copy":await Mr(void 0,!0);break;case"paste":await J5();break}},scrollTo:Qt,remeasureColumns:H=>{for(let A of H)li(A+T,!0)}}),[i4,li,Mr,mr,J5,T,Qt]);let[l6,o6]=xa??[],$m=N.useCallback(H=>{let[A,E]=H;if(E===-1){I!=="none"&&(g0(Lt.fromSingleSelection(A),void 0,!1),Xt());return}l6===A&&o6===E||(v0({cell:H,range:{x:A,y:E,width:1,height:1}},!0,!1,"keyboard-nav"),Qt(A,E))},[I,Xt,Qt,l6,o6,v0,g0]),[Wm,Um]=N.useState(!1),h6=N.useRef((0,Jp.default)(H=>{Um(H)},5)),jm=N.useCallback(()=>{h6.current(!0),G.current===void 0&&G.columns.length===0&&G.rows.length===0&&u===void 0&&v0({cell:[T,s2],range:{x:T,y:s2,width:1,height:1}},!0,!1,"keyboard-select")},[s2,G,u,T,v0]),qm=N.useCallback(()=>{h6.current(!1)},[]),[Gm,Km]=N.useMemo(()=>{var H;let A,E=(H=Ht?.scrollbarWidthOverride)!=null?H:R8(),P=V+(x0?1:0);if(typeof H0=="number")A=q1+P*H0;else{let Q=0,K=Math.min(P,10);for(let a1=0;a1K.width+Q,0)+E;return[`${Math.min(1e5,Y)}px`,`${Math.min(1e5,A)}px`]},[B1,Ht?.scrollbarWidthOverride,H0,V,x0,q1]);return N.createElement(lz.Provider,{value:S},N.createElement(bE,{style:rz(S),className:e1,inWidth:y??Gm,inHeight:R??Km},N.createElement(sE,{fillHandle:Gn,drawFocusRing:p0,experimental:Ht,fixedShadowX:M0,fixedShadowY:T5,getRowThemeOverride:M,headerIcons:ra,imageWindowLoader:Kn,initialSize:hr,isDraggable:xe,onDragLeave:we,onRowMoved:na,overscrollX:ti,overscrollY:N5,preventDiagonalScrolling:fa,rightElement:P5,rightElementProps:Xn,showMinimap:I5,smoothScrollX:Yn,smoothScrollY:a4,className:e1,enableGroups:l1,onCanvasFocused:jm,onCanvasBlur:qm,canvasRef:d,onContextMenu:_m,theme:S,cellXOffset:y2,cellYOffset:s2,accessibilityHeight:bt.height,onDragEnd:km,columns:B1,drawCustomCell:c1,drawHeader:n4,disabledRows:Im,freezeColumns:Nm,lockColumns:T,firstColAccessible:T===0,getCellContent:F0,minColumnWidth:pa,maxColumnWidth:Ta,searchInputRef:g,showSearch:W5,onSearchClose:U5,highlightRegions:ur,getCellsForSelection:I0,getGroupDetails:G5,headerHeight:ma,isFocused:Wm,groupHeaderHeight:l1?e4:0,trailingRowType:x0?wt?.sticky===!0?"sticky":"appended":"none",onColumnResize:Ha,onColumnResizeEnd:q5,onColumnResizeStart:dr,onCellFocused:$m,onColumnMoved:Am,onDragStart:Fm,onHeaderMenuClick:Bm,onItemHovered:bm,isFilling:u?.fillHandle===!0,onMouseMove:Cm,onKeyDown:mr,onKeyUp:Z,onMouseDown:Vm,onMouseUp:ym,onDragOverCell:v2,onDrop:_a,onSearchResultsChanged:Pm,onVisibleRegionChanged:Sm,clientSize:[X[0],X[1]],rowHeight:H0,searchResults:W1,searchValue:P1,onSearchValueChange:Ct,rows:Yt,scrollRef:z,selection:G,translateX:bt.tx,translateY:bt.ty,verticalBorder:Om,gridRef:G1,getCellRenderer:z1,scrollToEnd:Ve}),Dm,c!==void 0&&N.createElement(xk,{...c,validateCell:ei,id:Z5,getCellRenderer:z1,className:Ht?.isSubGrid===!0?"click-outside-ignore":void 0,provideEditor:c0,imageEditorOverride:m,onFinishEditing:Em,markdownDivCreateNode:w,isOutsideClick:X8})))},Yz=N.forwardRef(M_);var ir=S1($1());var N8=S1($1()),$8={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},W8=N8.default.createContext&&N8.default.createContext($8);var Me=function(){return Me=Object.assign||function(t){for(var a,e=1,r=arguments.length;et.length)&&(a=t.length);for(var e=0,r=new Array(a);e=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
+`&&(e.push(r),r=[])),i=0);break}l++}return no.map(h=>({rawValue:h,formatted:h,format:"string"})))}function Up(t,a,e){var r;let n=CE(t,a),i=h=>{var c;(c=window.navigator.clipboard)==null||c.writeText(h)},l=(h,c)=>{var v;return((v=window.navigator.clipboard)==null?void 0:v.write)===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([h],{type:"text/plain"}),"text/html":new Blob([c],{type:"text/html"})})]),!0)},o=(h,c)=>{var v,g;try{if(e===void 0||e.clipboardData===null)throw new Error("No clipboard data");(v=e?.clipboardData)==null||v.setData("text/plain",h),(g=e?.clipboardData)==null||g.setData("text/html",c)}catch{l(h,c)||i(h)}};((r=window.navigator.clipboard)==null?void 0:r.write)!==void 0||e?.clipboardData!==void 0?o(n.textPlain,n.textHtml):i(n.textPlain),e?.preventDefault()}function jp(t){return typeof t=="string"?t:`${t}px`}var AE=()=>t=>t.innerWidth,FE=()=>t=>t.innerHeight,kE=V0("div")({name:"Wrapper",class:"wzg2m5k",propsAsIs:!1,vars:{"wzg2m5k-0":[AE()],"wzg2m5k-1":[FE()]}}),bE=t=>{let{inWidth:a,inHeight:e,children:r,...n}=t;return Oz.createElement(kE,{innerHeight:jp(e),innerWidth:jp(a),...n},r)};function Dz(t){return t!==!0}var qp=20,EE={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:"false"},kind:m1.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:t=>{var a;return qk(t,t.cell.data,V8(t.cell),(a=t.cell.maxSize)!=null?a:qp)},onDelete:t=>({...t,data:!1}),onClick:t=>{var a,e;let{cell:r,posX:n,posY:i,bounds:l,theme:o}=t,{width:h,height:c,x:v,y:g}=l,d=(a=r.maxSize)!=null?a:qp,u=Math.floor(l.y+c/2),p=mz(d,c,o.cellVerticalPadding),z=zz((e=r.contentAlign)!=null?e:"center",v,h,o.cellHorizontalPadding,p),x=pz(z,u,p),s=Mz(v+n,g+i,x);if(V8(r)&&s)return{...r,data:Dz(r.data)}},onPaste:(t,a)=>{let e=S5;return t.toLowerCase()==="true"?e=!0:t.toLowerCase()==="false"?e=!1:t.toLowerCase()==="indeterminate"&&(e=E8),e===a.data?void 0:{...a,data:e}}},_E=2,TE=1300;function PE(t,a){let e=k8.default.useRef(0),[r,n]=t??[0,0];k8.default.useEffect(()=>{if(r===0&&n===0){e.current=0;return}let i=0,l=h=>{var c;if(i===0)i=h;else{let v=h-i;e.current=Math.min(1,e.current+v/TE);let g=e.current**1.618*v*_E;(c=a.current)==null||c.scrollBy(r*g,n*g),i=h}o=window.requestAnimationFrame(l)},o=window.requestAnimationFrame(l);return()=>window.cancelAnimationFrame(o)},[a,r,n])}var IE=V0("div")({name:"BubblesOverlayEditorStyle",class:"b1bqsp5z",propsAsIs:!1}),OE=t=>{let{bubbles:a}=t;return C5.createElement(IE,null,a.map((e,r)=>C5.createElement("div",{key:r,className:"boe-bubble"},e)),C5.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},DE=OE,NE={getAccessibilityString:t=>wz(t.data),kind:m1.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n).width+r+20,0)+2*e.cellHorizontalPadding-4,draw:t=>Gk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return Nz.createElement(DE,{bubbles:a.data})},onPaste:()=>{}},$E=V0("div")({name:"DrilldownOverlayEditorStyle",class:"df2kt4a",propsAsIs:!1}),WE=t=>{let{drilldowns:a}=t;return In.createElement($E,null,a.map((e,r)=>In.createElement("div",{key:r,className:"doe-bubble"},e.img!==void 0&&In.createElement("img",{src:e.img}),In.createElement("div",null,e.text))))},UE=WE,jE={getAccessibilityString:t=>wz(t.data.map(a=>a.text)),kind:m1.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n.text).width+r+20+(n.img!==void 0?18:0),0)+2*e.cellHorizontalPadding-4,draw:t=>Xk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return $z.createElement(UE,{drilldowns:a.data})},onPaste:()=>{}},qE=V0("div")({name:"ImageOverlayEditorStyle",class:"i1eozt10",propsAsIs:!1}),GE=t=>{let{urls:a,canWrite:e,onEditClick:r,renderImage:n}=t,i=a.filter(o=>o!=="");if(i.length===0)return null;let l=i.length>1;return Xe.createElement(qE,{"data-testid":"GDG-default-image-overlay-editor"},Xe.createElement(Uz.Carousel,{showArrows:l,showThumbs:!1,swipeable:l,emulateTouch:l,infiniteLoop:l},i.map(o=>{var h;let c=(h=n?.(o))!=null?h:Xe.createElement("img",{draggable:!1,src:o});return Xe.createElement("div",{className:"centering-container",key:o},c)})),e&&r&&Xe.createElement("button",{className:"edit-icon",onClick:r},Xe.createElement(T8,null)))},KE={getAccessibilityString:t=>t.data.join(", "),kind:m1.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>{var a;return Yk(t,(a=t.cell.displayData)!=null?a:t.cell.data,t.cell.rounding,t.cell.contentAlign)},measure:(t,a)=>a.data.length*50,onDelete:t=>({...t,data:[]}),provideEditor:()=>t=>{let{value:a,onFinishedEditing:e,imageEditorOverride:r}=t;return Wz.createElement(r??GE,{urls:a.data,canWrite:a.allowAdd,onCancel:e,onChange:i=>{e({...a,data:[i]})}})},onPaste:(t,a)=>{t=t.trim();let r=t.split(",").map(n=>{try{return new URL(n),n}catch{return}}).filter(n=>n!==void 0);if(!(r.length===a.data.length&&r.every((n,i)=>n===a.data[i])))return{...a,data:r}}},XE={getAccessibilityString:()=>"",kind:m1.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:()=>{},onPaste:()=>{}},YE=V0("div")({name:"MarkdownContainer",class:"mlbeo71",propsAsIs:!1}),QE=class extends b8.default.PureComponent{constructor(){super(...arguments),this.targetElement=null,this.containerRefHook=t=>{this.targetElement=t,this.renderMarkdownIntoDiv()}}renderMarkdownIntoDiv(){let{targetElement:t,props:a}=this;if(t===null)return;let{contents:e,createNode:r}=a,n=U1(e),i=document.createRange();i.selectNodeContents(t),i.deleteContents();let l=r?.(n);if(l===void 0){let h=document.createElement("template");h.innerHTML=n,l=h.content}t.append(l);let o=t.getElementsByTagName("a");for(let h of o)h.target="_blank",h.rel="noreferrer noopener"}render(){return this.renderMarkdownIntoDiv(),b8.default.createElement(YE,{ref:this.containerRefHook})}},ZE=V0("textarea")({name:"InputBox",class:"ijuk0po",propsAsIs:!1}),JE=V0("div")({name:"ShadowBox",class:"saq3p5l",propsAsIs:!1}),t_=V0("div")({name:"GrowingEntryStyle",class:"gf8vzix",propsAsIs:!1}),Gp=0,k5=t=>{let{placeholder:a,value:e,onKeyDown:r,highlight:n,altNewline:i,validatedSelection:l,...o}=t,{onChange:h,className:c}=o,v=h2.useRef(null),g=e??"";l2(h!==void 0,"GrowingEntry must be a controlled input area");let[d]=h2.useState(()=>"input-box-"+(Gp=(Gp+1)%1e7));h2.useEffect(()=>{let p=v.current;if(p===null||p.disabled)return;let z=g.toString().length;p.focus(),p.setSelectionRange(n?0:z,z)},[]),h2.useLayoutEffect(()=>{var p;if(l!==void 0){let z=typeof l=="number"?[l,null]:l;(p=v.current)==null||p.setSelectionRange(z[0],z[1])}},[l]);let u=h2.useCallback(p=>{p.key==="Enter"&&p.shiftKey&&i===!0||r?.(p)},[i,r]);return h2.createElement(t_,{className:"gdg-growing-entry"},h2.createElement(JE,{className:c},g+`
+`),h2.createElement(ZE,{...o,className:(c??"")+" gdg-input",id:d,ref:v,onKeyDown:u,value:g,placeholder:a,dir:"auto"}))},a_=()=>t=>t.targetWidth,Kp=V0("div")({name:"MarkdownOverlayEditorStyle",class:"mdwzdl1",propsAsIs:!1,vars:{"mdwzdl1-0":[a_(),"px"]}}),e_=t=>{let{value:a,onChange:e,forceEditMode:r,createNode:n,targetRect:i,onFinish:l,validatedSelection:o}=t,h=a.data,c=a.readonly===!0,[v,g]=y0.useState(h===""||r),d=y0.useCallback(()=>{g(p=>!p)},[]),u=h?"ml-6":"";return v?y0.createElement(Kp,{targetWidth:i.width-20},y0.createElement(k5,{autoFocus:!0,highlight:!1,validatedSelection:o,value:h,onKeyDown:p=>{p.key==="Enter"&&p.stopPropagation()},onChange:e}),y0.createElement("div",{className:`edit-icon checkmark-hover ${u}`,onClick:()=>l(a)},y0.createElement(yk,null))):y0.createElement(Kp,{targetWidth:i.width},y0.createElement(QE,{contents:h,createNode:n}),!c&&y0.createElement(y0.Fragment,null,y0.createElement("div",{className:"spacer"}),y0.createElement("div",{className:`edit-icon edit-hover ${u}`,onClick:d},y0.createElement(T8,null))),y0.createElement("textarea",{className:"md-edit-textarea gdg-input",autoFocus:!0}))},r_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:m1.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:Wn,measure:(t,a,e)=>{let r=a.data.split(`
+`)[0];return t.measureText(r).width+2*e.cellHorizontalPadding},draw:t=>Un(t,t.cell.data,t.cell.contentAlign),onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{let{onChange:a,value:e,target:r,onFinishedEditing:n,markdownDivCreateNode:i,forceEditMode:l,validatedSelection:o}=t;return jz.createElement(e_,{onFinish:n,targetRect:r,value:e,validatedSelection:o,onChange:h=>a({...e,data:h.target.value}),forceEditMode:l,createNode:i})},onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},n_={getAccessibilityString:t=>t.row.toString(),kind:ta.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:$k,measure:()=>44,draw:t=>Uk(t,t.cell.row,t.cell.checked,t.cell.markerKind,t.cell.drawHandle),onClick:t=>{let{bounds:a,cell:e,posX:r,posY:n}=t,{width:i,height:l}=a,o=e.drawHandle?7+(i-7)/2:i/2,h=l/2;if(Math.abs(r-o)<=10&&Math.abs(n-h)<=10)return{...e,checked:!e.checked}},onPaste:()=>{}},i_={getAccessibilityString:()=>"",kind:ta.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>Nk(t,t.cell.hint,t.cell.icon),onPaste:()=>{}},l_=Ze.lazy(async()=>await Promise.resolve().then(()=>(Cp(),yp))),o_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:m1.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Wn,draw:t=>Un(t,t.cell.displayData,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.displayData).width+16,onDelete:t=>({...t,data:void 0}),provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return Ze.createElement(Ze.Suspense,{fallback:null},Ze.createElement(l_,{highlight:a,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:n,onChange:i=>{var l;return e({...r,data:Number.isNaN((l=i.floatValue)!=null?l:0)?0:i.floatValue})}}))},onPaste:(t,a,e)=>{var r;let n=typeof e.rawValue=="number"?e.rawValue:Number.parseFloat(typeof e.rawValue=="string"?e.rawValue:t);if(!(Number.isNaN(n)||a.data===n))return{...a,data:n,displayData:(r=e.formattedString)!=null?r:a.displayData}}},h_={getAccessibilityString:()=>"",measure:()=>108,kind:m1.Protected,needsHover:!1,needsHoverPosition:!1,draw:jk,onPaste:()=>{}},c_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:m1.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(t,a)=>Wn(t,a,t.theme.textLight),draw:t=>Un(t,t.cell.data,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.data).width+16,provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return qz.default.createElement(k5,{highlight:a,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:n,onChange:i=>e({...r,data:i.target.value})})},onPaste:()=>{}},v_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:m1.Text,needsHover:!1,needsHoverPosition:!1,drawPrep:Wn,useLabel:!0,draw:t=>(Un(t,t.cell.displayData,t.cell.contentAlign,t.cell.allowWrapping,t.hyperWrapping),!0),measure:(t,a,e)=>{let r=a.displayData.split(`
+`).slice(0,a.allowWrapping===!0?void 0:1);return Math.max(...r.map(n=>t.measureText(n).width+2*e.cellHorizontalPadding))},onDelete:t=>({...t,data:""}),provideEditor:t=>({disablePadding:t.allowWrapping===!0,editor:a=>{let{isHighlighted:e,onChange:r,value:n,validatedSelection:i}=a;return Gz.createElement(k5,{style:t.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:e,autoFocus:n.readonly!==!0,disabled:n.readonly===!0,altNewline:!0,value:n.data,validatedSelection:i,onChange:l=>r({...n,data:l.target.value})})}}),onPaste:(t,a,e)=>{var r;return t===a.data?void 0:{...a,data:t,displayData:(r=e.formattedString)!=null?r:a.displayData}}},g_=V0("div")({name:"UriOverlayEditorStyle",class:"uf0sjo8",propsAsIs:!1}),d_=t=>{let{uri:a,onChange:e,forceEditMode:r,readonly:n,validatedSelection:i,preview:l}=t,[o,h]=J2.useState(a===""||r),c=J2.useCallback(()=>{h(!0)},[]);return o?J2.createElement(k5,{validatedSelection:i,highlight:!0,autoFocus:!0,value:a,onChange:e}):J2.createElement(g_,null,J2.createElement("a",{className:"link-area",href:a,target:"_blank",rel:"noopener noreferrer"},l),!n&&J2.createElement("div",{className:"edit-icon",onClick:c},J2.createElement(T8,null)),J2.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},s_=d_,u_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:m1.Uri,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Wn,draw:t=>Un(t,t.cell.data,t.cell.contentAlign),measure:(t,a,e)=>t.measureText(a.data).width+e.cellHorizontalPadding*2,onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{var a;let{onChange:e,value:r,forceEditMode:n,validatedSelection:i}=t;return Kz.createElement(s_,{forceEditMode:n,uri:r.data,preview:(a=r.displayData)!=null?a:r.data,validatedSelection:i,readonly:r.readonly===!0,onChange:l=>e({...r,data:l.target.value})})},onPaste:(t,a,e)=>{var r;return t===a.data?void 0:{...a,data:t,displayData:(r=e.formattedString)!=null?r:a.displayData}}},f_={[ta.Marker]:n_,[ta.NewRow]:i_,[m1.Boolean]:EE,[m1.Bubble]:NE,[m1.Drilldown]:jE,[m1.Image]:KE,[m1.Loading]:XE,[m1.Markdown]:r_,[m1.Number]:o_,[m1.Protected]:h_,[m1.RowID]:c_,[m1.Text]:v_,[m1.Uri]:u_};function p_({rowHeight:t,headerHeight:a,groupHeaderHeight:e,theme:r,overscrollX:n,overscrollY:i,scaleToRem:l,remSize:o}){let[h,c,v,g,d,u]=Xz.default.useMemo(()=>{var p,z,x;if(!l||o===16)return[t,a,e,r,n,i];let s=o/16,f=t,m=iz();return[typeof f=="number"?f*s:M=>Math.ceil(f(M)*s),Math.ceil(a*s),Math.ceil(e*s),{...r,headerIconSize:((p=r?.headerIconSize)!=null?p:m.headerIconSize)*s,cellHorizontalPadding:((z=r?.cellHorizontalPadding)!=null?z:m.cellHorizontalPadding)*s,cellVerticalPadding:((x=r?.cellVerticalPadding)!=null?x:m.cellVerticalPadding)*s},Math.ceil((n??0)*s),Math.ceil((i??0)*s)]},[e,a,n,i,o,t,l,r]);return{rowHeight:h,headerHeight:c,groupHeaderHeight:v,theme:g,overscrollX:d,overscrollY:u}}var z_=0;function m_(t){return(0,Zp.default)((0,L8.default)((0,L8.default)(t).filter(a=>a.span!==void 0).map(a=>{var e,r,n,i;return(0,Ye.default)(((r=(e=a.span)==null?void 0:e[0])!=null?r:0)+1,((i=(n=a.span)==null?void 0:n[1])!=null?i:0)+1)})))}function M5(t,a){return t===void 0||a===0||t.columns.length===0&&t.current===void 0?t:{current:t.current===void 0?void 0:{cell:[t.current.cell[0]+a,t.current.cell[1]],range:{...t.current.range,x:t.current.range.x+a},rangeStack:t.current.rangeStack.map(e=>({...e,x:e.x+a}))},rows:t.rows,columns:t.columns.offset(a)}}var Xp={selectAll:!0,selectRow:!0,selectColumn:!0,downFill:!1,rightFill:!1,pageUp:!1,pageDown:!1,clear:!0,copy:!0,paste:!0,cut:!0,search:!1,first:!0,last:!0},Yp={kind:m1.Loading,allowOverlay:!1},H5={columns:Lt.empty(),rows:Lt.empty(),current:void 0},M_=(t,a)=>{var e,r,n,i,l;let[o,h]=N.useState(H5),[c,v]=N.useState(),g=N.useRef(null),d=N.useRef(null),[u,p]=N.useState(),z=N.useRef(null),x=N.useRef(),{rowMarkers:s="none",rowMarkerWidth:f,imageEditorOverride:m,getRowThemeOverride:M,markdownDivCreateNode:w,width:y,height:R,columns:L,rows:V,getCellContent:C,onCellClicked:k,onCellActivated:b,onFinishedEditing:F,coercePasteValue:_,drawHeader:q,onHeaderClicked:i1,spanRangeBehavior:t1="default",onGroupHeaderClicked:d1,onCellContextMenu:O,className:e1,onHeaderContextMenu:U,getCellsForSelection:V1,onGroupHeaderContextMenu:p1,onGroupHeaderRenamed:o1,onCellEdited:x1,onCellsEdited:I1,onSearchResultsChanged:X1,searchResults:W1,onSearchValueChange:Ct,searchValue:P1,onKeyDown:Y1,onKeyUp:Z,keybindings:$,onRowAppended:s1,onColumnMoved:w1,validateCell:f1,highlightRegions:W,drawCell:c1,rangeSelect:D="rect",columnSelect:I="multi",rowSelect:A1="multi",rangeSelectionBlending:N1="exclusive",columnSelectionBlending:nt="exclusive",rowSelectionBlending:F1="exclusive",onDelete:h1,onDragStart:r1,onMouseMove:u1,onPaste:H1,copyHeaders:O1=!1,freezeColumns:J1=0,rowSelectionMode:Bt="auto",rowMarkerStartIndex:Gt=1,rowMarkerTheme:Ut,onHeaderMenuClick:Tt,getGroupDetails:ct,onSearchClose:at,onItemHovered:e0,onSelectionCleared:Mt,showSearch:B0,onVisibleRegionChanged:Z0,gridSelection:S0,onGridSelectionChange:r0,minColumnWidth:ua=50,maxColumnWidth:st=500,maxColumnAutoWidth:St,provideEditor:c0,trailingRowOptions:wt,scrollOffsetX:kt,scrollOffsetY:Kt,verticalBorder:c2,onDragOverCell:v2,onDrop:_a,onColumnResize:T2,onColumnResizeEnd:q0,onColumnResizeStart:g2,customRenderers:P2,fillHandle:Gn,drawFocusRing:p0,experimental:Ht,fixedShadowX:M0,fixedShadowY:T5,headerIcons:ra,imageWindowLoader:Kn,initialSize:hr,isDraggable:xe,onDragLeave:we,onRowMoved:na,overscrollX:t4,overscrollY:Le,preventDiagonalScrolling:fa,rightElement:P5,rightElementProps:Xn,showMinimap:I5,smoothScrollX:Yn,smoothScrollY:a4,scrollToEnd:Ve,scaleToRem:O5=!1,rowHeight:D5=34,headerHeight:cr=36,groupHeaderHeight:Qn=cr,theme:vr,isOutsideClick:X8}=t,pa=Math.max(ua,20),Ta=Math.max(st,pa),Zn=Math.max(St??Ta,pa),za=N.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]).fontSize,Pa=N.useMemo(()=>Number.parseFloat(za),[za]),{rowHeight:H0,headerHeight:ma,groupHeaderHeight:e4,theme:gr,overscrollX:ti,overscrollY:N5}=p_({groupHeaderHeight:Qn,headerHeight:cr,overscrollX:t4,overscrollY:Le,remSize:Pa,rowHeight:D5,scaleToRem:O5,theme:vr}),zt=N.useMemo(()=>$===void 0?Xp:{...Xp,...$},[$]),Ia=f??(V>1e4?48:V>1e3?44:V>100?36:32),d2=s!=="none",T=d2?1:0,x0=s1!==void 0,L2=wt?.sticky===!0,[$5,ai]=N.useState(!1),W5=B0??$5,U5=N.useCallback(()=>{at!==void 0?at():ai(!1)},[at]),r4=N.useMemo(()=>S0===void 0?void 0:M5(S0,T),[S0,T]),G=r4??o,V2=N.useRef(new AbortController);N.useEffect(()=>()=>{V2?.current.abort()},[]);let[I0,j5]=xE(V1,C,T,V2.current,V),ei=N.useCallback((H,A,E)=>{if(f1===void 0)return!0;let P=[H[0]-T,H[1]];return f1?.(P,A,E)},[T,f1]),Ma=N.useRef(S0),J0=N.useCallback((H,A)=>{A&&(H=BE(H,I0,T,t1,V2.current)),r0!==void 0?(Ma.current=M5(H,-T),r0(Ma.current)):h(H)},[r0,I0,T,t1]),Ha=En(T2,N.useCallback((H,A,E,P)=>{T2?.(L[E-T],A,E-T,P)},[T2,T,L])),q5=En(q0,N.useCallback((H,A,E,P)=>{q0?.(L[E-T],A,E-T,P)},[q0,T,L])),dr=En(g2,N.useCallback((H,A,E,P)=>{g2?.(L[E-T],A,E-T,P)},[g2,T,L])),n4=En(q,N.useCallback(H=>{var A;return(A=q?.({...H,columnIndex:H.columnIndex-T}))!=null?A:!1},[q,T])),sr=N.useCallback(H=>{if(h1!==void 0){let A=h1(M5(H,-T));return typeof A=="boolean"?A:M5(A,T)}return!0},[h1,T]),[v0,A0,g0]=HE(G,J0,N1,nt,F1,D),S=N.useMemo(()=>({...iz(),...gr}),[gr]),[X,b1]=N.useState([10,10,0]),z1=N.useCallback(H=>H.kind!==m1.Custom?f_[H.kind]:P2?.find(A=>A.isMatch(H)),[P2]),E1=mE(L,V,j5,X[0]-(T===0?0:Ia)-X[2],pa,Zn,S,z1,V2.current),l1=N.useMemo(()=>E1.some(H=>H.group!==void 0),[E1]),q1=l1?ma+e4:ma,ut=G.rows.length,C1=s==="none"?"":ut===0?cz:ut===V?hz:hk,B1=N.useMemo(()=>s==="none"?E1:[{title:C1,width:Ia,icon:void 0,hasMenu:!1,style:"normal",themeOverride:Ut},...E1],[E1,Ia,s,C1,Ut]),[d0,vt]=N.useMemo(()=>[Kt!==void 0&&typeof H0=="number"?Math.floor(Kt/H0):0,Kt!==void 0&&typeof H0=="number"?-(Kt%H0):0],[Kt,H0]),xt=N.useRef({height:1,width:1,x:0,y:0}),mt=N.useMemo(()=>{var H,A;return{x:xt.current.x,y:d0,width:(H=xt.current.width)!=null?H:1,height:(A=xt.current.height)!=null?A:1,ty:vt}},[vt,d0]),lt=N.useRef(!1),[bt,t2,jt]=Ak(mt),R2=((e=bt.height)!=null?e:1)>1;N.useLayoutEffect(()=>{if(Kt!==void 0&&z.current!==null&&R2){if(z.current.scrollTop===Kt)return;z.current.scrollTop=Kt,z.current.scrollTop!==Kt&&jt(),lt.current=!0}},[Kt,R2,jt]);let I2=((r=bt.width)!=null?r:1)>1;N.useLayoutEffect(()=>{if(kt!==void 0&&z.current!==null&&I2){if(z.current.scrollLeft===kt)return;z.current.scrollLeft=kt,z.current.scrollLeft!==kt&&jt(),lt.current=!0}},[kt,I2,jt]);let y2=bt.x+T,s2=bt.y,G1=N.useRef(null),Xt=N.useCallback(H=>{var A;H===!0?(A=G1.current)==null||A.focus():window.requestAnimationFrame(()=>{var E;(E=G1.current)==null||E.focus()})},[]),Yt=x0?V+1:V,O0=N.useCallback(H=>{let A=T===0?H:H.map(P=>({...P,location:[P.location[0]-T,P.location[1]]})),E=I1?.(A);if(E!==!0)for(let P of A)x1?.(P.location,P.value);return E},[x1,I1,T]),ur=N.useMemo(()=>{if(W!==void 0)return T===0?W:W.map(H=>{let A=B1.length-H.range.x-T;if(!(A<=0))return{color:H.color,range:{...H.range,x:H.range.x+T,width:Math.min(A,H.range.width)},style:H.style}}).filter(H=>H!==void 0)},[W,B1.length,T]),Y8=N.useRef(B1);Y8.current=B1;let F0=N.useCallback(([H,A],E=!1)=>{var P,Y,Q,K,a1,j,v1,M1,T1,Q1;let L1=x0&&A===Yt-1;if(H===0&&d2)return L1?Yp:{kind:ta.Marker,allowOverlay:!1,checked:G?.rows.hasIndex(A)===!0,markerKind:s==="clickable-number"?"number":s,row:Gt+A,drawHandle:na!==void 0,cursor:s==="clickable-number"?"pointer":void 0};if(L1){let et=H===T&&(P=wt?.hint)!=null?P:"",_1=Y8.current[H];if(((Y=_1?.trailingRowOptions)==null?void 0:Y.disabled)===!0)return Yp;{let gt=(K=(Q=_1?.trailingRowOptions)==null?void 0:Q.hint)!=null?K:et,Et=(j=(a1=_1?.trailingRowOptions)==null?void 0:a1.addIcon)!=null?j:wt?.addIcon;return{kind:ta.NewRow,hint:gt,allowOverlay:!1,icon:Et}}}else{let Z1=H-T;if(E||Ht?.strict===!0){let _1=xt.current,gt=_1.x>Z1||Z1>_1.x+_1.width||_1.y>A||A>_1.y+_1.height,Et=Z1===((M1=(v1=_1.extras)==null?void 0:v1.selected)==null?void 0:M1[0])&&A===((T1=_1.extras)==null?void 0:T1.selected[1]),ft=((Q1=_1.extras)==null?void 0:Q1.freezeRegion)===void 0||_1.extras.freezeRegion.x>Z1||Z1>_1.extras.freezeRegion.x+_1.extras.freezeRegion.width||_1.extras.freezeRegion.y>A||A>_1.extras.freezeRegion.y+_1.extras.freezeRegion.height;if(gt&&!Et&&ft)return{kind:m1.Loading,allowOverlay:!1}}let et=C([Z1,A]);return T!==0&&et.span!==void 0&&(et={...et,span:[et.span[0]+T,et.span[1]+T]}),et}},[x0,Yt,d2,G?.rows,na,s,T,wt?.hint,wt?.addIcon,Ht?.strict,C,Gt]),G5=N.useCallback(H=>{var A,E;let P=(A=ct?.(H))!=null?A:{name:H};return o1!==void 0&&H!==""&&(P={icon:P.icon,name:P.name,overrideTheme:P.overrideTheme,actions:[...(E=P.actions)!=null?E:[],{title:"Rename",icon:"renameIcon",onClick:Y=>Y5({group:P.name,bounds:Y.bounds})}]}),P},[ct,o1]),ri=N.useCallback(H=>{var A;let[E,P]=H.cell,Y=B1[E],Q=Y?.group!==void 0?(A=G5(Y.group))==null?void 0:A.overrideTheme:void 0,K=Y?.themeOverride,a1=M?.(P);v({...H,theme:{...S,...Q,...K,...a1,...H.content.themeOverride}})},[M,B1,G5,S]),fr=N.useCallback((H,A,E)=>{var P;if(G.current===void 0)return;let[Y,Q]=G.current.cell,K=F0([Y,Q]);if(K.kind!==m1.Boolean&&K.allowOverlay){let a1=K;if(E!==void 0)switch(a1.kind){case m1.Number:{let j=lk(()=>E==="-"?-0:Number.parseFloat(E),0);a1={...a1,data:Number.isNaN(j)?0:j};break}case m1.Text:case m1.Markdown:case m1.Uri:a1={...a1,data:E};break}ri({target:H,content:a1,initialValue:E,cell:[Y,Q],highlight:E===void 0,forceEditMode:E!==void 0})}else K.kind===m1.Boolean&&A&&K.readonly!==!0&&(O0([{location:G.current.cell,value:{...K,data:Dz(K.data)}}]),(P=G1.current)==null||P.damage([{cell:G.current.cell}]))},[F0,G,O0,ri]),Q8=N.useCallback((H,A)=>{var E;let P=(E=G1.current)==null?void 0:E.getBounds(H,A);if(P===void 0||z.current===null)return;let Y=F0([H,A]);!Y.allowOverlay||ri({target:P,content:Y,initialValue:void 0,highlight:!0,cell:[H,A],forceEditMode:!0})},[F0,ri]),Qt=N.useCallback((H,A,E="both",P=0,Y=0,Q=void 0)=>{var K;if(z.current!==null){let a1=G1.current,j=d.current,v1=typeof H!="number"?H.unit==="cell"?H.amount:void 0:H,M1=typeof A!="number"?A.unit==="cell"?A.amount:void 0:A,T1=typeof H!="number"&&H.unit==="px"?H.amount:void 0,Q1=typeof A!="number"&&A.unit==="px"?A.amount:void 0;if(a1!==null&&j!==null){let L1={x:0,y:0,width:0,height:0},k1=0,Z1=0;if((v1!==void 0||M1!==void 0)&&(L1=(K=a1.getBounds((v1??0)+T,M1??0))!=null?K:L1,L1.width===0||L1.height===0))return;let et=j.getBoundingClientRect(),_1=et.width/j.offsetWidth;if(T1!==void 0&&(L1={...L1,x:T1-et.left-z.current.scrollLeft,width:1}),Q1!==void 0&&(L1={...L1,y:Q1+et.top-z.current.scrollTop,height:1}),L1!==void 0){let gt={x:L1.x-P,y:L1.y-Y,width:L1.width+2*P,height:L1.height+2*Y},Et=0;for(let n0=0;n0gt.x?k1=gt.x-Vt:rtgt.y?Z1=gt.y-K1:At{var E;let P=B1[H];if(((E=P?.trailingRowOptions)==null?void 0:E.disabled)===!0)return;let Y=s1?.(),Q,K=!0;Y!==void 0&&(Q=await Y,Q==="top"&&(K=!1),typeof Q=="number"&&(K=!1));let a1=0,j=()=>{if(t6.current<=V){a1<500&&window.setTimeout(j,a1),a1=50+a1*2;return}let v1=typeof Q=="number"?Q:K?V:0;Qt(H-T,v1),v0({cell:[H,v1],range:{x:H,y:v1,width:1,height:1}},!1,!1,"edit");let M1=J8.current([H-T,v1]);M1.allowOverlay&&tr(M1)&&M1.readonly!==!0&&A&&window.setTimeout(()=>{Z8.current(H,v1)},0)};j()},[B1,s1,T,V,Qt,v0]),ni=N.useCallback(H=>{var A,E,P;let Y=(P=(E=(A=E1[H])==null?void 0:A.trailingRowOptions)==null?void 0:E.targetColumn)!=null?P:wt?.targetColumn;if(typeof Y=="number")return Y+(d2?1:0);if(typeof Y=="object"){let Q=L.indexOf(Y);if(Q>=0)return Q+(d2?1:0)}},[E1,L,d2,wt?.targetColumn]),Oa=N.useRef(),l4=N.useRef(),pr=N.useCallback((H,A)=>{var E;let[P,Y]=A;return{...S,...(E=B1[P])==null?void 0:E.themeOverride,...M?.(Y),...H.themeOverride}},[M,B1,S]),zr=N.useCallback(H=>{var A,E,P,Y;let Q=V5.value?H.metaKey:H.ctrlKey,K=Q&&A1==="multi",a1=Q&&I==="multi",[j,v1]=H.location,M1=G.columns,T1=G.rows,[Q1,L1]=(E=(A=G.current)==null?void 0:A.cell)!=null?E:[];if(H.kind==="cell"){if(l4.current=void 0,Re.current=[j,v1],j===0&&d2){if(x0===!0&&v1===V||s==="number"||A1==="none")return;let k1=F0(H.location);if(k1.kind!==ta.Marker)return;if(na!==void 0){let _1=z1(k1);l2(_1?.kind===ta.Marker);let gt=(P=_1?.onClick)==null?void 0:P.call(_1,{...H,cell:k1,posX:H.localEventX,posY:H.localEventY,bounds:H.bounds,theme:pr(k1,H.location),preventDefault:()=>{}});if(gt===void 0||gt.checked===k1.checked)return}v(void 0),Xt();let Z1=T1.hasIndex(v1),et=Oa.current;if(A1==="multi"&&(H.shiftKey||H.isLongTouch===!0)&&et!==void 0&&T1.hasIndex(et)){let _1=[Math.min(et,v1),Math.max(et,v1)+1];K||Bt==="multi"?A0(void 0,_1,!0):A0(Lt.fromSingleSelection(_1),void 0,K)}else K||H.isTouch||Bt==="multi"?Z1?A0(T1.remove(v1),void 0,!0):(A0(void 0,v1,!0),Oa.current=v1):Z1&&T1.length===1?A0(Lt.empty(),void 0,Q):(A0(Lt.fromSingleSelection(v1),void 0,Q),Oa.current=v1)}else if(j>=T&&x0&&v1===V){let k1=ni(j);i4(k1??j)}else if(Q1!==j||L1!==v1){let k1=F0(H.location),Z1=z1(k1);if(Z1?.onSelect!==void 0){let gt=!1;if(Z1.onSelect({...H,cell:k1,posX:H.localEventX,posY:H.localEventY,bounds:H.bounds,preventDefault:()=>gt=!0,theme:pr(k1,H.location)}),gt)return}let et=L2&&v1===V,_1=L2&&G!==void 0&&((Y=G.current)==null?void 0:Y.cell[1])===V;if((H.shiftKey||H.isLongTouch===!0)&&Q1!==void 0&&L1!==void 0&&G.current!==void 0&&!_1){if(et)return;let gt=Math.min(j,Q1),Et=Math.max(j,Q1),ft=Math.min(v1,L1),Vt=Math.max(v1,L1);v0({...G.current,range:{x:gt,y:ft,width:Et-gt+1,height:Vt-ft+1}},!0,Q,"click"),Oa.current=void 0,Xt()}else v0({cell:[j,v1],range:{x:j,y:v1,width:1,height:1}},!0,Q,"click"),Oa.current=void 0,v(void 0),Xt()}}else if(H.kind==="header")if(Re.current=[j,v1],v(void 0),d2&&j===0)Oa.current=void 0,l4.current=void 0,A1==="multi"&&(T1.length!==V?A0(Lt.fromSingleSelection([0,V]),void 0,Q):A0(Lt.empty(),void 0,Q),Xt());else{let k1=l4.current;if(I==="multi"&&(H.shiftKey||H.isLongTouch===!0)&&k1!==void 0&&M1.hasIndex(k1)){let Z1=[Math.min(k1,j),Math.max(k1,j)+1];a1?g0(void 0,Z1,Q):g0(Lt.fromSingleSelection(Z1),void 0,Q)}else a1?(M1.hasIndex(j)?g0(M1.remove(j),void 0,Q):g0(void 0,j,Q),l4.current=j):I!=="none"&&(g0(Lt.fromSingleSelection(j),void 0,Q),l4.current=j);Oa.current=void 0,Xt()}else H.kind===x2?Re.current=[j,v1]:H.kind===A5&&!H.isMaybeScrollbar&&(J0(H5,!1),v(void 0),Xt(),Mt?.(),Oa.current=void 0,l4.current=void 0)},[i4,I,Xt,z1,ni,F0,G,d2,L2,Mt,na,T,s,A1,Bt,V,v0,J0,g0,A0,x0,pr]),K5=N.useRef(!1),Re=N.useRef(),a6=N.useRef(bt),u2=N.useRef(),Vm=N.useCallback(H=>{var A,E;if(o4.current=!1,a6.current=xt.current,H.button!==0&&H.button!==1){u2.current=void 0;return}let P=performance.now(),Y=P-((E=(A=u2.current)==null?void 0:A.time)!=null?E:-1e3)<250;u2.current={wasDoubleClick:Y,button:H.button,time:P,location:H.location},H?.kind==="header"&&(K5.current=!0);let Q=H.kind==="cell"&&H.isFillHandle;!Q&&H.kind!=="cell"&&H.isEdge||(p({previousSelection:G,fillHandle:Q}),Re.current=void 0,!H.isTouch&&H.button===0?zr(H):!H.isTouch&&H.button===1&&(Re.current=H.location))},[G,zr]),[X5,Y5]=N.useState(),e6=N.useCallback(H=>{if(H.kind!==x2||I!=="multi")return;let A=V5.value?H.metaKey:H.ctrlKey,[E]=H.location,P=G.columns;if(E=T&&$n(Y.group,B1[a1].group);a1--)Q--;for(let a1=E+1;a1{var A;if(G.current===void 0)return;let E=[],P=G.current.range;for(let Y=0;Y({cell:Y.location})))},[F0,G,O0]),o4=N.useRef(!1),li=N.useCallback(async(H,A=!1)=>{var E;if((((E=u2.current)==null?void 0:E.wasDoubleClick)===!0||A)&&I0!==void 0&&Ha!==void 0){let P=xt.current.y,Y=xt.current.height,Q=I0({x:H,y:P,width:1,height:Math.min(Y,V-P)},V2.current.signal);typeof Q!="object"&&(Q=await Q());let K=E1[H-T],j=document.createElement("canvas").getContext("2d",{alpha:!1});if(j!==null){j.font=`${S.baseFontStyle} ${S.fontFamily}`;let v1=Iz(j,S,K,0,Q,pa,Ta,!1,z1);Ha?.(K,v1.width,H,v1.width)}}},[E1,I0,Ta,S,pa,Ha,T,V,z1]),[Rm,r6]=N.useState(),ym=N.useCallback((H,A)=>{var E,P,Y;let Q=u;if(p(void 0),r6(void 0),K5.current=!1,A)return;if(Q?.fillHandle===!0&&G.current!==void 0){ii(G.current.cell[1]!==G.current.range.y);return}let[K,a1]=H.location,[j,v1]=(E=Re.current)!=null?E:[],M1=()=>{o4.current=!0},T1=L1=>{var k1,Z1,et;let _1=L1.isTouch||j===K&&v1===a1;if(_1&&k?.([K-T,a1],{...L1,preventDefault:M1}),L1.button===1)return!o4.current;if(!o4.current){let gt=F0(H.location),Et=z1(gt);if(Et!==void 0&&Et.onClick!==void 0&&_1){let ft=Et.onClick({...L1,cell:gt,posX:L1.localEventX,posY:L1.localEventY,bounds:L1.bounds,theme:pr(gt,H.location),preventDefault:M1});ft!==void 0&&!ue(ft)&&ba(ft)&&(O0([{location:L1.location,value:ft}]),(k1=G1.current)==null||k1.damage([{cell:L1.location}]))}if(!o4.current&&((et=(Z1=Q?.previousSelection)==null?void 0:Z1.current)==null?void 0:et.cell)!==void 0&&G.current!==void 0){let[ft,Vt]=G.current.cell,[rt,K1]=Q.previousSelection.current.cell;if(K===ft&&K===rt&&a1===Vt&&a1===K1)return b?.([K-T,a1]),fr(L1.bounds,!1),!0}}return!1},Q1=H.location[0]-T;if(H.isTouch){let L1=xt.current,k1=a6.current;if(L1.x!==k1.x||L1.y!==k1.y)return;if(H.isLongTouch===!0){if(H.kind==="cell"&&((P=G?.current)==null?void 0:P.cell[0])===K&&((Y=G?.current)==null?void 0:Y.cell[1])===a1){O?.([Q1,H.location[1]],{...H,preventDefault:M1});return}else if(H.kind==="header"&&G.columns.hasIndex(K)){U?.(Q1,{...H,preventDefault:M1});return}else if(H.kind===x2){if(Q1<0)return;p1?.(Q1,{...H,preventDefault:M1});return}}H.kind==="cell"?T1(H)||zr(H):H.kind===x2?d1?.(Q1,{...H,preventDefault:M1}):(H.kind===se&&i1?.(Q1,{...H,preventDefault:M1}),zr(H));return}if(H.kind==="header"){if(Q1<0)return;H.isEdge?li(K):H.button===0&&K===j&&a1===v1&&i1?.(Q1,{...H,preventDefault:M1})}if(H.kind===x2){if(Q1<0)return;H.button===0&&K===j&&a1===v1&&(d1?.(Q1,{...H,preventDefault:M1}),o4.current||e6(H))}H.kind==="cell"&&(H.button===0||H.button===1)&&T1(H),Re.current=void 0},[u,T,G,k,ii,F0,z1,pr,O0,b,fr,O,U,p1,zr,d1,li,i1,e6]),Cm=N.useCallback(H=>{let A={...H,location:[H.location[0]-T,H.location[1]]};u1?.(A),r6(E=>{var P,Y;return K5.current?[H.scrollEdge[0],0]:H.scrollEdge[0]===E?.[0]&&H.scrollEdge[1]===E[1]?E:u===void 0||((Y=(P=u2.current)==null?void 0:P.location[0])!=null?Y:0){Tt?.(H-T,A)},[Tt,T]),xa=(n=G?.current)==null?void 0:n.cell,Sm=N.useCallback((H,A,E,P,Y,Q)=>{lt.current=!1;let K=xa;K!==void 0&&(K=[K[0]-T,K[1]]);let a1={x:H.x-T,y:H.y,width:H.width,height:x0&&H.y+H.height>=V?H.height-1:H.height,tx:Y,ty:Q,extras:{selected:K,freezeRegion:J1===0?void 0:{x:0,y:H.y,width:J1,height:H.height}}};xt.current=a1,t2(a1),b1([A,E,P]),Z0?.(a1,a1.tx,a1.ty,a1.extras)},[xa,T,x0,V,J1,t2,Z0]),Am=En(w1,N.useCallback((H,A)=>{w1?.(H-T,A-T),I!=="none"&&g0(Lt.fromSingleSelection(A),void 0,!0)},[I,w1,T,g0])),Q5=N.useRef(!1),Fm=N.useCallback(H=>{if(H.location[0]===0&&T>0){H.preventDefault();return}r1?.({...H,location:[H.location[0]-T,H.location[1]]}),H.defaultPrevented()||(Q5.current=!0),p(void 0)},[r1,T]),km=N.useCallback(()=>{Q5.current=!1},[]),bm=N.useCallback(H=>{var A,E;if(!(((A=u2?.current)==null?void 0:A.button)!==void 0&&u2.current.button>=1)){if(u!==void 0&&((E=u2.current)==null?void 0:E.location[0])===0&&H.location[0]===0&&T===1&&A1==="multi"&&u.previousSelection&&!u.previousSelection.rows.hasIndex(u2.current.location[1])&&G.rows.hasIndex(u2.current.location[1])){let P=Math.min(u2.current.location[1],H.location[1]),Y=Math.max(u2.current.location[1],H.location[1])+1;A0(Lt.fromSingleSelection([P,Y]),void 0,!1)}if(u!==void 0&&G.current!==void 0&&!Q5.current&&(D==="rect"||D==="multi-rect")){let[P,Y]=G.current.cell,[Q,K]=H.location;if(K<0&&(K=xt.current.y),L2&&Y===V)return;if(L2&&K===V)if(H.kind===A5)K--;else return;Q=Math.max(Q,T);let v1=Q-P,M1=K-Y,T1={x:v1>=0?P:Q,y:M1>=0?Y:K,width:Math.abs(v1)+1,height:Math.abs(M1)+1};v0({...G.current,range:T1},!0,!1,"drag")}e0?.({...H,location:[H.location[0]-T,H.location[1]]})}},[u,T,A1,G,D,e0,A0,L2,V,v0]),ye=N.useCallback(H=>{if(G.current===void 0)return;let[A,E]=H,[P,Y]=G.current.cell,Q=G.current.range,K=Q.x,a1=Q.x+Q.width,j=Q.y,v1=Q.y+Q.height;if(E!==0)switch(E){case 2:{v1=V,j=Y,Qt(0,v1,"vertical");break}case-2:{j=0,v1=Y+1,Qt(0,j,"vertical");break}case 1:{jY+1?(v1--,Qt(0,v1,"vertical")):(j=Math.max(0,j-1),Qt(0,j,"vertical"));break}default:Dn(E)}if(A!==0)if(A===2)a1=B1.length,K=P,Qt(a1-1-T,0,"horizontal");else if(A===-2)K=T,a1=P+1,Qt(K-T,0,"horizontal");else{let M1=[];if(I0!==void 0){let T1=I0({x:K,y:j,width:a1-K-T,height:v1-j},V2.current.signal);typeof T1=="object"&&(M1=m_(T1))}if(A===1){let T1=!1;if(K0){let Q1=(0,Ye.default)(K+1,P+1).find(L1=>!M1.includes(L1-T));Q1!==void 0&&(K=Q1,T1=!0)}else K++,T1=!0;T1&&Qt(K,0,"horizontal")}T1||(a1=Math.min(B1.length,a1+1),Qt(a1-1-T,0,"horizontal"))}else if(A===-1){let T1=!1;if(a1>P+1){if(M1.length>0){let Q1=(0,Ye.default)(a1-1,P,-1).find(L1=>!M1.includes(L1-T));Q1!==void 0&&(a1=Q1,T1=!0)}else a1--,T1=!0;T1&&Qt(a1-T,0,"horizontal")}T1||(K=Math.max(T,K-1),Qt(K-T,0,"horizontal"))}else Dn(A)}v0({cell:G.current.cell,range:{x:K,y:j,width:a1-K,height:v1-j}},!0,!1,"keyboard-select")},[I0,G,B1.length,T,V,Qt,v0]),Da=N.useCallback((H,A,E,P)=>{let Y=Yt-(E?0:1);if(H=(0,Tn.default)(H,T,E1.length-1+T),A=(0,Tn.default)(A,0,Y),H===xa?.[0]&&A===xa?.[1])return!1;if(P&&G.current!==void 0){let Q=[...G.current.rangeStack];(G.current.range.width>1||G.current.range.height>1)&&Q.push(G.current.range),J0({...G,current:{cell:[H,A],range:{x:H,y:A,width:1,height:1},rangeStack:Q}},!0)}else v0({cell:[H,A],range:{x:H,y:A,width:1,height:1}},!0,!1,"keyboard-nav");return x.current!==void 0&&x.current[0]===H&&x.current[1]===A&&(x.current=void 0),Qt(H-T,A),!0},[Yt,T,E1.length,xa,G,Qt,J0,v0]),Em=N.useCallback((H,A)=>{c?.cell!==void 0&&H!==void 0&&ba(H)&&(O0([{location:c.cell,value:H}]),window.requestAnimationFrame(()=>{var Y;(Y=G1.current)==null||Y.damage([{cell:c.cell}])})),Xt(!0),v(void 0);let[E,P]=A;if(G.current!==void 0&&(E!==0||P!==0)){let Y=G.current.cell[1]===Yt-1&&H!==void 0;Da((0,Tn.default)(G.current.cell[0]+E,0,B1.length-1),(0,Tn.default)(G.current.cell[1]+P,0,Yt-1),Y,!1)}F?.(H,A)},[c?.cell,Xt,G,F,O0,Yt,Da,B1.length]),Z5=N.useMemo(()=>`gdg-overlay-${z_++}`,[]),Ce=N.useCallback(H=>{var A,E,P,Y;Xt();let Q=[];for(let K=H.x;K({cell:K.location})))},[Xt,C,z1,O0,T]),mr=N.useCallback(H=>{(async()=>{var E,P,Y,Q,K;let a1=!1;if(Y1!==void 0&&Y1({...H,cancel:()=>{a1=!0}}),a1)return;let j=()=>{H.stopPropagation(),H.preventDefault()},v1=c!==void 0,{altKey:M1,shiftKey:T1,metaKey:Q1,ctrlKey:L1,key:k1,bounds:Z1}=H,et=V5.value,_1=et?Q1:L1,gt=k1==="Delete"||et&&k1==="Backspace",Et=xt.current,ft=G.columns,Vt=G.rows;if(k1==="Escape"){v1?v(void 0):zt.clear&&(J0(H5,!1),Mt?.());return}else if(T0("primary+a",H)&&zt.selectAll){if(!v1)J0({columns:Lt.empty(),rows:Lt.empty(),current:{cell:(P=(E=G.current)==null?void 0:E.cell)!=null?P:[T,0],range:{x:T,y:0,width:L.length,height:V},rangeStack:[]}},!1);else{let Ft=document.getElementById(Z5);if(Ft!==null){let n0=window.getSelection(),k0=document.createRange();k0.selectNodeContents(Ft),n0?.removeAllRanges(),n0?.addRange(k0)}}j();return}else T0("primary+f",H)&&zt.search&&(j(),(Y=g?.current)==null||Y.focus({preventScroll:!0}),ai(!0));if(gt){let Ft=(Q=sr?.(G))!=null?Q:!0;if(j(),Ft!==!1){let n0=Ft===!0?G:Ft;if(n0.current!==void 0){Ce(n0.current.range);for(let k0 of n0.current.rangeStack)Ce(k0)}for(let k0 of n0.rows)Ce({x:T,y:k0,width:B1.length-T,height:1});for(let k0 of n0.columns)Ce({x:k0,y:0,width:1,height:V})}return}if(G.current===void 0)return;let[rt,K1]=G.current.cell,At=!1;if(zt.selectColumn&&T0("ctrl+ ",H)&&I!=="none")ft.hasIndex(rt)?g0(ft.remove(rt),void 0,!0):I==="single"?g0(Lt.fromSingleSelection(rt),void 0,!0):g0(void 0,rt,!0);else if(zt.selectRow&&T0("shift+ ",H)&&A1!=="none")Vt.hasIndex(K1)?A0(Vt.remove(K1),void 0,!0):A1==="single"?A0(Lt.fromSingleSelection(K1),void 0,!0):A0(void 0,K1,!0);else if((T0("Enter",H)||T0(" ",H)||T0("shift+Enter",H))&&Z1!==void 0)v1?(v(void 0),T0("Enter",H)?K1++:T0("shift+Enter",H)&&K1--):K1===V&&x0?window.setTimeout(()=>{let Ft=ni(rt);i4(Ft??rt)},0):(b?.([rt-T,K1]),fr(Z1,!0),j());else if(zt.downFill&&T0("primary+_68",H)&&G.current.range.height>1)ii(!1),j();else if(zt.rightFill&&T0("primary+_82",H)&&G.current.range.width>1){let Ft=[],n0=G.current.range;for(let k0=0;k0({cell:k0.location}))),j()}else if(zt.pageDown&&T0("PageDown",H))K1+=Math.max(1,xt.current.height-4),j();else if(zt.pageUp&&T0("PageUp",H))K1-=Math.max(1,xt.current.height-4),j();else if(zt.first&&T0("primary+Home",H))v(void 0),K1=0,rt=0;else if(zt.last&&T0("primary+End",H))v(void 0),K1=Number.MAX_SAFE_INTEGER,rt=Number.MAX_SAFE_INTEGER;else if(zt.first&&T0("primary+shift+Home",H))v(void 0),ye([-2,-2]);else if(zt.last&&T0("primary+shift+End",H))v(void 0),ye([2,2]);else if(k1==="ArrowDown"){if(L1&&M1)return;v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([0,_1&&!M1?2:1]):(M1&&!_1&&(At=!0),_1&&!M1?K1=V-1:K1+=1)}else if(k1==="ArrowUp"||k1==="Home"){let Ft=k1==="Home"||_1;v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([0,Ft&&!M1?-2:-1]):(M1&&!Ft&&(At=!0),K1+=Ft&&!M1?Number.MIN_SAFE_INTEGER:-1)}else if(k1==="ArrowRight"||k1==="End"){let Ft=k1==="End"||_1;v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([Ft&&!M1?2:1,0]):(M1&&!Ft&&(At=!0),rt+=Ft&&!M1?Number.MAX_SAFE_INTEGER:1)}else if(k1==="ArrowLeft")v(void 0),T1&&(D==="rect"||D==="multi-rect")?ye([_1&&!M1?-2:-1,0]):(M1&&!_1&&(At=!0),rt+=_1&&!M1?Number.MIN_SAFE_INTEGER:-1);else if(k1==="Tab")v(void 0),T1?rt--:rt++;else if(!Q1&&!L1&&G.current!==void 0&&k1.length===1&&/[ -~]/g.test(k1)&&Z1!==void 0&&tr(C([rt-T,Math.max(0,Math.min(K1,V-1))]))){if((!L2||K1!==V)&&(Et.y>K1||K1>Et.y+Et.height||Et.x>rt||rt>Et.x+Et.width))return;fr(Z1,!0,k1),j()}Da(rt,K1,!1,At)&&j()})()},[Y1,Ce,c,G,zt.selectAll,zt.search,zt.selectColumn,zt.selectRow,zt.downFill,zt.rightFill,zt.pageDown,zt.pageUp,zt.first,zt.last,zt.clear,I,A1,C,T,Da,J0,Mt,L.length,V,Z5,O0,sr,B1.length,g0,A0,x0,ni,i4,b,fr,ii,F0,ye,D,L2]),_m=N.useCallback((H,A)=>{let E=H.location[0]-T;if(H.kind==="header"&&U?.(E,{...H,preventDefault:A}),H.kind===x2){if(E<0)return;p1?.(E,{...H,preventDefault:A})}if(H.kind==="cell"){let[P,Y]=H.location;O?.([E,Y],{...H,preventDefault:A}),ok(G,H.location)||Da(P,Y,!1,!1)}},[G,O,p1,U,T,Da]),J5=N.useCallback(async H=>{var A,E,P,Y,Q,K,a1;if(!zt.paste)return;function j(L1,k1,Z1,et){var _1,gt,Et,ft;let Vt=typeof Z1=="object"?(_1=Z1?.join(`
+`))!=null?_1:"":(gt=Z1?.toString())!=null?gt:"";if(!ue(L1)&&tr(L1)&&L1.readonly!==!0){let rt=_?.(Vt,L1);if(rt!==void 0&&ba(rt))return rt.kind!==L1.kind&&console.warn("Coercion should not change cell kind."),{location:k1,value:rt};let K1=z1(L1);if(K1===void 0)return;if(K1.kind===m1.Custom){l2(L1.kind===m1.Custom);let At=(Et=K1.onPaste)==null?void 0:Et.call(K1,Vt,L1.data);return At===void 0?void 0:{location:k1,value:{...L1,data:At}}}else{let At=(ft=K1.onPaste)==null?void 0:ft.call(K1,Vt,L1,{formatted:et,formattedString:typeof et=="string"?et:et?.join(`
+`),rawValue:Z1});return At===void 0?void 0:(l2(At.kind===L1.kind),{location:k1,value:At})}}}let v1=G.columns,M1=G.rows,T1=((A=z.current)==null?void 0:A.contains(document.activeElement))===!0||((E=d.current)==null?void 0:E.contains(document.activeElement))===!0,Q1=(P=G.current)==null?void 0:P.cell;if(Q1===void 0&&v1.length===1&&(Q1=[(Y=v1.first())!=null?Y:0,0]),Q1===void 0&&M1.length===1&&(Q1=[T,(Q=M1.first())!=null?Q:0]),T1&&Q1!==void 0){let L1,k1,Z1="text/plain",et="text/html";if(navigator.clipboard.read!==void 0){let ft=await navigator.clipboard.read();for(let Vt of ft){if(Vt.types.includes(et)){let K1=await(await Vt.getType(et)).text(),At=$p(K1);if(At!==void 0){L1=At;break}}Vt.types.includes(Z1)&&(k1=await(await Vt.getType(Z1)).text())}}else if(navigator.clipboard.readText!==void 0)k1=await navigator.clipboard.readText();else if(H!==void 0&&H?.clipboardData!==null){if(H.clipboardData.types.includes(et)){let ft=H.clipboardData.getData(et);L1=$p(ft)}L1===void 0&&H.clipboardData.types.includes(Z1)&&(k1=H.clipboardData.getData(Z1))}else return;let[_1,gt]=Q1,Et=[];do{if(H1===void 0){let ft=F0(Q1),Vt=(K=k1??L1?.map(K1=>K1.map(At=>At.rawValue).join(" ")).join(" "))!=null?K:"",rt=j(ft,Q1,Vt,void 0);rt!==void 0&&Et.push(rt);break}if(L1===void 0){if(k1===void 0)return;L1=SE(k1)}if(H1===!1||typeof H1=="function"&&H1?.([Q1[0]-T,Q1[1]],L1.map(ft=>ft.map(Vt=>{var rt,K1;return(K1=(rt=Vt.rawValue)==null?void 0:rt.toString())!=null?K1:""})))!==!0)return;for(let[ft,Vt]of L1.entries()){if(ft+gt>=V)break;for(let[rt,K1]of Vt.entries()){let At=[rt+_1,ft+gt],[Be,Ft]=At;if(Be>=B1.length||Ft>=Yt)continue;let n0=F0(At),k0=j(n0,At,K1.rawValue,K1.formatted);k0!==void 0&&Et.push(k0)}}}while(!1);O0(Et),(a1=G1.current)==null||a1.damage(Et.map(ft=>({cell:ft.location})))}},[_,z1,F0,G,zt.paste,B1.length,O0,Yt,H1,T,V]);P0("paste",J5,window,!1,!0);let Mr=N.useCallback(async(H,A)=>{var E,P;if(!zt.copy)return;let Y=A===!0||((E=z.current)==null?void 0:E.contains(document.activeElement))===!0||((P=d.current)==null?void 0:P.contains(document.activeElement))===!0,Q=G.columns,K=G.rows,a1=(j,v1)=>{if(!O1)Up(j,v1,H);else{let M1=v1.map(T1=>({kind:m1.Text,data:L[T1].title,displayData:L[T1].title,allowOverlay:!1}));Up([M1,...j],v1,H)}};if(Y&&I0!==void 0){if(G.current!==void 0){let j=I0(G.current.range,V2.current.signal);typeof j!="object"&&(j=await j()),a1(j,(0,Ye.default)(G.current.range.x-T,G.current.range.x+G.current.range.width-T))}else if(K!==void 0&&K.length>0){let v1=[...K].map(M1=>{let T1=I0({x:T,y:M1,width:L.length,height:1},V2.current.signal);return typeof T1=="object"?T1[0]:T1().then(Q1=>Q1[0])});if(v1.some(M1=>M1 instanceof Promise)){let M1=await Promise.all(v1);a1(M1,(0,Ye.default)(L.length))}else a1(v1,(0,Ye.default)(L.length))}else if(Q.length>0){let j=[],v1=[];for(let M1 of Q){let T1=I0({x:M1,y:0,width:1,height:V},V2.current.signal);typeof T1!="object"&&(T1=await T1()),j.push(T1),v1.push(M1-T)}if(j.length===1)a1(j[0],v1);else{let M1=j.reduce((T1,Q1)=>T1.map((L1,k1)=>[...L1,...Q1[k1]]));a1(M1,v1)}}}},[L,I0,G,zt.copy,T,V,O1]);P0("copy",Mr,window,!1,!1);let Tm=N.useCallback(async H=>{var A,E;!zt.cut||!(((A=z.current)==null?void 0:A.contains(document.activeElement))===!0||((E=d.current)==null?void 0:E.contains(document.activeElement))===!0)||(await Mr(H),G.current!==void 0&&Ce(G.current.range))},[Ce,G,zt.cut,Mr]);P0("cut",Tm,window,!1,!1);let Pm=N.useCallback((H,A)=>{if(X1!==void 0){T!==0&&(H=H.map(Y=>[Y[0]-T,Y[1]])),X1(H,A);return}if(H.length===0||A===-1)return;let[E,P]=H[A];x.current!==void 0&&x.current[0]===E&&x.current[1]===P||(x.current=[E,P],Da(E,P,!1,!1))},[X1,T,Da]),[oi,hi]=(l=(i=S0?.current)==null?void 0:i.cell)!=null?l:[],n6=N.useRef(Qt);n6.current=Qt,N.useLayoutEffect(()=>{var H,A,E,P;!lt.current&&oi!==void 0&&hi!==void 0&&(oi!==((A=(H=Ma.current)==null?void 0:H.current)==null?void 0:A.cell[0])||hi!==((P=(E=Ma.current)==null?void 0:E.current)==null?void 0:P.cell[1]))&&n6.current(oi,hi),lt.current=!1},[oi,hi]);let i6=G.current!==void 0&&(G.current.cell[0]>=B1.length||G.current.cell[1]>=Yt);N.useLayoutEffect(()=>{i6&&J0(H5,!1)},[i6,J0]);let Im=N.useMemo(()=>x0===!0&&wt?.tint===!0?Lt.fromSingleSelection(Yt-1):Lt.empty(),[Yt,x0,wt?.tint]),Om=N.useCallback(H=>{var A;return typeof c2=="boolean"?c2:(A=c2?.(H-T))!=null?A:!0},[T,c2]),Dm=N.useMemo(()=>{if(X5===void 0||d.current===null)return null;let{bounds:H,group:A}=X5,E=d.current.getBoundingClientRect();return N.createElement(pE,{bounds:H,group:A,canvasBounds:E,onClose:()=>Y5(void 0),onFinish:P=>{Y5(void 0),o1?.(A,P)}})},[o1,X5]),Nm=Math.min(B1.length,J1+(d2?1:0));N.useImperativeHandle(a,()=>({appendRow:(H,A)=>i4(H+T,A),updateCells:H=>{var A;return T!==0&&(H=H.map(E=>({cell:[E.cell[0]+T,E.cell[1]]}))),(A=G1.current)==null?void 0:A.damage(H)},getBounds:(H,A)=>{var E;if(!(d?.current===null||z?.current===null)){if(H===void 0&&A===void 0){let P=d.current.getBoundingClientRect(),Y=P.width/z.current.clientWidth;return{x:P.x-z.current.scrollLeft*Y,y:P.y-z.current.scrollTop*Y,width:z.current.scrollWidth*Y,height:z.current.scrollHeight*Y}}return(E=G1.current)==null?void 0:E.getBounds(H??0+T,A)}},focus:()=>{var H;return(H=G1.current)==null?void 0:H.focus()},emit:async H=>{switch(H){case"delete":mr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!1,key:"Delete",keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-right":mr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"r",keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-down":mr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"d",keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"copy":await Mr(void 0,!0);break;case"paste":await J5();break}},scrollTo:Qt,remeasureColumns:H=>{for(let A of H)li(A+T,!0)}}),[i4,li,Mr,mr,J5,T,Qt]);let[l6,o6]=xa??[],$m=N.useCallback(H=>{let[A,E]=H;if(E===-1){I!=="none"&&(g0(Lt.fromSingleSelection(A),void 0,!1),Xt());return}l6===A&&o6===E||(v0({cell:H,range:{x:A,y:E,width:1,height:1}},!0,!1,"keyboard-nav"),Qt(A,E))},[I,Xt,Qt,l6,o6,v0,g0]),[Wm,Um]=N.useState(!1),h6=N.useRef((0,Jp.default)(H=>{Um(H)},5)),jm=N.useCallback(()=>{h6.current(!0),G.current===void 0&&G.columns.length===0&&G.rows.length===0&&u===void 0&&v0({cell:[T,s2],range:{x:T,y:s2,width:1,height:1}},!0,!1,"keyboard-select")},[s2,G,u,T,v0]),qm=N.useCallback(()=>{h6.current(!1)},[]),[Gm,Km]=N.useMemo(()=>{var H;let A,E=(H=Ht?.scrollbarWidthOverride)!=null?H:R8(),P=V+(x0?1:0);if(typeof H0=="number")A=q1+P*H0;else{let Q=0,K=Math.min(P,10);for(let a1=0;a1K.width+Q,0)+E;return[`${Math.min(1e5,Y)}px`,`${Math.min(1e5,A)}px`]},[B1,Ht?.scrollbarWidthOverride,H0,V,x0,q1]);return N.createElement(lz.Provider,{value:S},N.createElement(bE,{style:rz(S),className:e1,inWidth:y??Gm,inHeight:R??Km},N.createElement(sE,{fillHandle:Gn,drawFocusRing:p0,experimental:Ht,fixedShadowX:M0,fixedShadowY:T5,getRowThemeOverride:M,headerIcons:ra,imageWindowLoader:Kn,initialSize:hr,isDraggable:xe,onDragLeave:we,onRowMoved:na,overscrollX:ti,overscrollY:N5,preventDiagonalScrolling:fa,rightElement:P5,rightElementProps:Xn,showMinimap:I5,smoothScrollX:Yn,smoothScrollY:a4,className:e1,enableGroups:l1,onCanvasFocused:jm,onCanvasBlur:qm,canvasRef:d,onContextMenu:_m,theme:S,cellXOffset:y2,cellYOffset:s2,accessibilityHeight:bt.height,onDragEnd:km,columns:B1,drawCustomCell:c1,drawHeader:n4,disabledRows:Im,freezeColumns:Nm,lockColumns:T,firstColAccessible:T===0,getCellContent:F0,minColumnWidth:pa,maxColumnWidth:Ta,searchInputRef:g,showSearch:W5,onSearchClose:U5,highlightRegions:ur,getCellsForSelection:I0,getGroupDetails:G5,headerHeight:ma,isFocused:Wm,groupHeaderHeight:l1?e4:0,trailingRowType:x0?wt?.sticky===!0?"sticky":"appended":"none",onColumnResize:Ha,onColumnResizeEnd:q5,onColumnResizeStart:dr,onCellFocused:$m,onColumnMoved:Am,onDragStart:Fm,onHeaderMenuClick:Bm,onItemHovered:bm,isFilling:u?.fillHandle===!0,onMouseMove:Cm,onKeyDown:mr,onKeyUp:Z,onMouseDown:Vm,onMouseUp:ym,onDragOverCell:v2,onDrop:_a,onSearchResultsChanged:Pm,onVisibleRegionChanged:Sm,clientSize:[X[0],X[1]],rowHeight:H0,searchResults:W1,searchValue:P1,onSearchValueChange:Ct,rows:Yt,scrollRef:z,selection:G,translateX:bt.tx,translateY:bt.ty,verticalBorder:Om,gridRef:G1,getCellRenderer:z1,scrollToEnd:Ve}),Dm,c!==void 0&&N.createElement(xk,{...c,validateCell:ei,id:Z5,getCellRenderer:z1,className:Ht?.isSubGrid===!0?"click-outside-ignore":void 0,provideEditor:c0,imageEditorOverride:m,onFinishEditing:Em,markdownDivCreateNode:w,isOutsideClick:X8})))},Yz=N.forwardRef(M_);var ir=S1($1());var N8=S1($1()),$8={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},W8=N8.default.createContext&&N8.default.createContext($8);var Me=function(){return Me=Object.assign||function(t){for(var a,e=1,r=arguments.length;et.length)&&(a=t.length);for(var e=0,r=new Array(a);e=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function om(t){var a=(0,tt.useRef)(null);function e(r){!r||r===a.current||(a.current=r,t(r))}return e}function R_(t){var a=(0,tt.useRef)(t);return(0,tt.useMemo)(function(){function e(n){typeof n=="function"?a.current=n(a.current):a.current=n}function r(){return a.current}return[r,e]},[])}function y_(){var t=(0,tt.useRef)([]);return(0,tt.useMemo)(function(){function a(){return t.current.length>0}function e(){for(var n=or(t.current),i;!(i=n()).done;){var l=i.value;l()}t.current=[]}function r(n){t.current.push(n)}return{hasEventSubscriptions:a,removeAllEventSubscriptions:e,addEventSubscription:r}},[])}var U8=typeof window<"u"?tt.useLayoutEffect:tt.useEffect;function C_(t,a){var e=(0,tt.useRef)(t);return a?(e.current=t,e):(e.current=null,e)}function qn(t){return parseFloat(t.replace("px",""))}function q8(t,a,e){return t e?e:t}function hm(t){return t!=null}function cm(){for(var t=arguments.length,a=new Array(t),e=0;e"u"))return a||t.ResizeObserver}function mm(t,a){var e=[];if(!t||!a||t===document.body)return e;var r=a.getComputedStyle(t),n=r.overflow,i=r.overflowX,l=r.overflowY;return[n,i,l].some(function(o){return["auto","scroll"].includes(o)})&&e.push(t),[].concat(e,mm(t.parentElement,a))}function b5(t){return"react-laag: Could not find a valid reference for the "+t+` element. There might be 2 causes:
- Make sure that the 'ref' is set correctly on the `+t+` element when isOpen: true. Also make sure your component forwards the ref with "forwardRef()".
- Make sure that you are actually rendering the `+t+" when the isOpen prop is set to true"}function S_(t){var a=t.enabled,e=t.onChange,r=t.environment,n=t.ResizeObserverPolyfill,i=t.overflowContainer,l=t.triggerOption,o=B_(r,n);(0,tt.useEffect)(function(){},[o]);var h=(0,tt.useRef)(null),c=Boolean(l),v=R_({scrollContainers:[],trigger:null,layer:null}),g=v[0],d=v[1],u=y_(),p=u.hasEventSubscriptions,z=u.addEventSubscription,x=u.removeAllEventSubscriptions,s=(0,tt.useCallback)(function(){var V=g(),C=V.layer,k=V.trigger,b=V.scrollContainers,F=b[0];if(!C)throw new Error(b5("layer"));if(!k&&!c)throw new Error(b5("trigger"));var _={top:0,left:0};if(F){var q=F.scrollLeft,i1=F.scrollTop;_={top:i1,left:q}}else{var t1=r.scrollX,d1=r.scrollY;_={top:d1,left:t1}}var O={left:0,top:0};if(F){var e1=r.getComputedStyle(F),U=e1.borderLeftWidth,V1=e1.borderTopWidth;O={left:qn(U)||0,top:qn(V1)||0}}e({layer:C,trigger:k,scrollContainers:b,arrow:h.current},_,O)},[g,e,r,h,c]),f=(0,tt.useCallback)(function(){var V=g(),C=V.trigger,k=V.layer,b=V.scrollContainers;if(!k)throw new Error(b5("layer"));if(!C&&!c)throw new Error(b5("trigger"));if(o){for(var F=!1,_=function(){if(!F){F=!0;return}s()},q=new o(_),i1=0,t1=[C,k,document.body];i1=0})}},{key:"negativeSides",get:function(){var e=this;return Object.fromEntries(E5.filter(function(r){return e[r]<0}).map(function(r){return[r,e[r]]}))}}]),t}();function vm(){for(var t=arguments.length,a=new Array(t),e=0;ef?f-y:0;z[w.prop]=q8(y+r+R,s,f),z[w.opposite.prop]=z[w.prop]+i.factor(h[d])}z.width=z.right-z.left,z.height=z.bottom-z.top;var L=ea.create(z);return r===0&&(this._cachedLayerBounds=L),L},a.getLayerCollisionBounds=function(){var r=this.offsets.container;return this.getLayerBounds().mapSides(function(n,i){return i-=n.factor(r)}).merge(function(n){var i=n.width,l=n.height;return{width:i+r*2,height:l+r*2}})},a.getContainerOffsets=function(r){if(this._cachedContainerOffsets&&!r)return this._cachedContainerOffsets;var n=this.subjectsBounds.merge({layer:r||this.getLayerCollisionBounds()}),i=K8.mergeSmallestSides(n.layerOffsetsToScrollContainers);return r||(this._cachedContainerOffsets=i),i},_5(t,[{key:"type",get:function(){return this.primary.prop+"-"+(this.secondary.prop==="center"?"center":["bottom","right"].includes(this.secondary.prop)?"end":"start")}},{key:"triggerIsBigger",get:function(){var r=this.secondary.isHorizontal,n=this.subjectsBounds,i=n.triggerHasBiggerWidth,l=n.triggerHasBiggerHeight;return r&&i||!r&&l}},{key:"fitsContainer",get:function(){return this.getContainerOffsets().allSidesArePositive}},{key:"visibleSurface",get:function(){var r=this.getLayerBounds(),n=this.getContainerOffsets(r),i=n.negativeSides;for(var l in i)i[l]=-i[l];return r.substract(i).surface}},{key:"secondaryOffsetSide",get:function(){var r,n,i=this,l=this.getContainerOffsets(),o=(r=(n=Object.entries(l.negativeSides).map(function(c){var v=c[0],g=c[1];return[C0[v],g]}).filter(function(c){var v=c[0];return i.primary.isOppositeDirection(v)}).sort(function(c,v){var g=c[1],d=v[1];return d-g}))==null?void 0:n[0])!=null?r:[],h=o[0];return h||null}}]),t}(),gm=function(t){L_(a,t);function a(){return t.apply(this,arguments)||this}var e=a.prototype;return e.getLayerBounds=function(){var n=this.subjectsBounds,i=n.trigger,l=n.layer,o=ea.empty();return o.top=i.top+i.height/2-l.height/2,o.bottom=o.top+l.height,o.left=i.left+i.width/2-l.width/2,o.right=o.left+l.width,o.width=o.right-o.left,o.height=o.bottom-o.top,o},a}(Hm);function P_(t,a,e){var r=t.layer,n=t.trigger,i=t.arrow,l=a.primary.oppositeSizeProp,o=a.primary.isHorizontal?["top","bottom"]:["left","right"],h=o[0],c=o[1],v=r[h]+r[l]/2-n[h]-i[l]/2-e,g=r[c]-r[l]/2-n[c]+i[l]/2+e;return(v<0?-v:0)+(g>0?-g:0)}var dm={position:"absolute",willChange:"top, left",left:null,right:null,top:null,bottom:null};function I_(t,a,e){var r;if(a.primary.isCenter)return dm;var n=t.layer,i=t.trigger,l=t.arrow,o=a.primary.oppositeSizeProp,h=i[o]>n[o],c=e+l[o]/2,v=n[o]-l[o]/2-e,g=P_(t,a,e),d=a.primary.prop,u=a.primary.oppositeCssProp,p=h?n[o]/2+g:i[u]+i[o]/2-n[u];return w2({},dm,(r={},r[d]="100%",r[u]=q8(p,c,v),r))}var sm=function(){function t(e,r,n){this.placements=void 0,this.config=void 0,this.subjectsBounds=void 0,this.placements=e,this.config=r,this.subjectsBounds=n}t.getSidesFromPlacementType=function(r){var n=r.split("-"),i=n[0],l=n[1],o=C0[i],h;return l==="center"?h=f0.center:o.isHorizontal?h=l==="start"?f0.top:f0.bottom:h=l==="start"?f0.left:f0.right,[o,h]},t.create=function(r,n){var i={arrow:n.arrowOffset,container:n.containerOffset,trigger:n.triggerOffset};function l(o){o===void 0&&(o=n.placement);var h=t.getSidesFromPlacementType(o),c=h[0],v=h[1],g=C0[c.isHorizontal?n.preferY:n.preferX],d=!c.isHorizontal&&r.triggerHasBiggerWidth||c.isHorizontal&&r.triggerHasBiggerHeight;function u(z,x){return new Hm(z,x,r,n.layerDimensions,i)}var p=[];return p[0]=u(c,v),p[1]=u(c,v.isCenter?g:f0.center),p[2]=u(c,f0[(v.opposite.isCenter?g.opposite:v.opposite).prop]),p[3]=u(g,d?c:f0[c.opposite.prop]),p[4]=u(g,f0.center),p[5]=u(g,d?f0[c.opposite.prop]:c),p[6]=u(C0[g.opposite.prop],d?c:f0[c.opposite.prop]),p[7]=u(C0[g.opposite.prop],f0.center),p[8]=u(C0[g.opposite.prop],d?f0[c.opposite.prop]:c),p[9]=u(C0[c.opposite.prop],v),p[10]=u(C0[c.opposite.prop],v.isCenter?g:f0.center),p[11]=u(C0[c.opposite.prop],f0[(v.opposite.isCenter?g.opposite:v.opposite).prop]),p=p.filter(function(z){return z.type===n.placement||n.possiblePlacements.includes(z.type)}),p}return n.placement==="center"?new t([new gm(f0.center,f0.center,r,n.layerDimensions,i)].concat(l(n.preferY+"-"+n.preferX)),n,r):new t(l(),n,r)};var a=t.prototype;return a.filterPlacementsBySide=function(r){return this.placements.filter(function(n){return n.primary===r})},a.findFirstPlacementThatFits=function(){return this.placements.find(function(r){return r.fitsContainer})},a.placementWithBiggestVisibleSurface=function(){var r=this.placements.map(function(i){return{placement:i,surface:i.visibleSurface}}).sort(function(i,l){return l.surface-i.surface}),n=r[0].placement;return n},a.findSuitablePlacement=function(){return this.config.auto?this.findFirstPlacementThatFits()||this.placementWithBiggestVisibleSurface():this.placements[0]},a.getSecondaryOffset=function(r){var n=this.config,i=n.auto,l=n.snap;if(!i||l||r instanceof gm)return 0;var o=this.filterPlacementsBySide(r.primary),h=o.indexOf(r)===0;if(h&&r.fitsContainer)return 0;var c=o.find(function(z){return!z.fitsContainer});if(!c)return 0;var v=c.secondaryOffsetSide;if(!v)return 0;var g=r.getContainerOffsets(),d=r.secondary,u;r.triggerIsBigger||c===r?u=v.isPush?-1:1:u=d===f0.left||[f0.top,f0.center].includes(d)&&v.isPush?-1:1;var p=g[v.prop];return p*u},a.getStyles=function(r,n,i,l){var o={willChange:"top, left, width, height"},h=I_(this.subjectsBounds.merge({layer:r}),n,this.config.arrowOffset),c=this.config.overflowContainer?w2({},o,{position:"fixed",top:r.top,left:r.left}):w2({},o,{position:"absolute",top:r.top-this.subjectsBounds.parent.top+i.top-l.top,left:r.left-this.subjectsBounds.parent.left+i.left-l.left});return{arrow:h,layer:c}},a.getHasDisappeared=function(r){var n=this.config.overflowContainer?this.subjectsBounds.trigger:r,i=K8.mergeSmallestSides(this.subjectsBounds.offsetsToScrollContainers(n,!0)),l=Object.entries(i.negativeSides),o=l.some(function(h){var c=h[0],v=h[1],g=C0[c];return v<=-n[g.sizeProp]});return o?"full":i.allSidesArePositive?null:"partial"},a.result=function(r,n){var i=this.findSuitablePlacement(),l=this.getSecondaryOffset(i),o=i.getLayerBounds(l),h=this.getStyles(o,i,r,n),c=i.primary.prop;return{styles:h,layerSide:c,placement:i,layerBounds:o,hasDisappeared:this.getHasDisappeared(o)}},t}(),O_=function(){function t(e,r){this.overflowContainer=void 0,this.trigger=void 0,this.layer=void 0,this.arrow=void 0,this.parent=void 0,this.window=void 0,this.scrollContainers=void 0,this.overflowContainer=r,Object.assign(this,e)}t.create=function(r,n,i,l,o,h,c,v){var g=ea.fromWindow(r);return new t({layer:ea.fromElement(n,{environment:r,withTransform:!1}),trigger:v?ea.create(G8(v())):ea.fromElement(i),arrow:o?ea.fromElement(o):ea.empty(),parent:l?ea.fromElement(l):g,window:g,scrollContainers:[g].concat(h.map(function(d){return ea.fromElement(d,{withScrollbars:!1})}))},c)};var a=t.prototype;return a.merge=function(r){return new t(w2({},this,r),this.overflowContainer)},a.offsetsToScrollContainers=function(r,n){n===void 0&&(n=!1);var i=this.overflowContainer&&!n?[this.window]:this.scrollContainers;return i.map(function(l){return l.offsetsTo(r)})},_5(t,[{key:"layerOffsetsToScrollContainers",get:function(){return this.offsetsToScrollContainers(this.layer)}},{key:"triggerHasBiggerWidth",get:function(){return this.trigger.width>this.layer.width}},{key:"triggerHasBiggerHeight",get:function(){return this.trigger.height>this.layer.height}}]),t}(),um=null;var aa={auto:!1,arrowOffset:0,containerOffset:10,triggerOffset:0,overflowContainer:!0,placement:"top-center",possiblePlacements:b_,preferX:"right",preferY:"bottom",snap:!1,container:void 0,trigger:void 0};function xm(t){var a,e=t.isOpen,r=e===void 0?!1:e,n=t.overflowContainer,i=n===void 0?aa.overflowContainer:n,l=t.environment,o=l===void 0?typeof window<"u"?window:void 0:l,h=t.ResizeObserver,c=t.placement,v=c===void 0?aa.placement:c,g=t.possiblePlacements,d=g===void 0?aa.possiblePlacements:g,u=t.preferX,p=u===void 0?aa.preferX:u,z=t.preferY,x=z===void 0?aa.preferY:z,s=t.auto,f=s===void 0?aa.auto:s,m=t.snap,M=m===void 0?aa.snap:m,w=t.triggerOffset,y=w===void 0?aa.triggerOffset:w,R=t.containerOffset,L=R===void 0?aa.containerOffset:R,V=t.arrowOffset,C=V===void 0?aa.arrowOffset:V,k=t.container,b=k===void 0?aa.container:k,F=t.layerDimensions,_=F===void 0?null:F,q=t.onDisappear,i1=t.onOutsideClick,t1=t.onParentClose,d1=t.trigger,O=(0,tt.useState)(function(){return{layerSide:v==="center"?"center":sm.getSidesFromPlacementType(v)[0].prop,styles:{layer:{position:i?"fixed":"absolute",top:0,left:0},arrow:{position:"absolute",top:0,left:0}}}}),e1=O[0],U=O[1],V1=(0,tt.useRef)(null),p1=C_(e1,r),o1=(0,tt.useRef)({cancelled:!1});(0,tt.useEffect)(function(){return function(){o1.current.cancelled=!0}},[]);var x1=(0,tt.useCallback)(function(f1,W,c1){var D=f1.arrow,I=f1.layer,A1=f1.scrollContainers,N1=f1.trigger,nt=A1[0],F1=O_.create(o,I,N1,nt,D,A1,i,d1?.getBounds),h1={placement:v,possiblePlacements:d,auto:f,layerDimensions:_,arrowOffset:C,containerOffset:L,triggerOffset:y,preferX:p,preferY:x,snap:M,overflowContainer:i},r1=sm.create(F1,h1).result(W,c1),u1=r1.hasDisappeared,H1=r1.layerSide,O1=r1.styles,J1={layerSide:H1,styles:O1};if(!p1.current||D_(p1.current,J1)){p1.current=J1,o1.current.cancelled=!0;var Bt={cancelled:!1};o1.current=Bt,Promise.resolve().then(function(){Bt.cancelled||U(J1)})}hm(u1)&&hm(q)&&q(u1)},[C,f,L,o,_,q,i,v,d,p,x,M,y,p1,d1]),I1=S_({ResizeObserverPolyfill:h,environment:o,enabled:r,overflowContainer:i,onChange:x1,triggerOption:d1}),X1=I1.triggerRef,W1=I1.layerRef,Ct=I1.arrowRef,P1=I1.closestScrollContainer,Y1=k_({isOpen:r,onOutsideClick:i1,onParentClose:t1}),Z=Y1.closeOnOutsideClickRefs,$=Y1.registrations,s1={triggerProps:Boolean(d1)?{}:{ref:cm(X1,Z.trigger,V1)},layerProps:{ref:cm(W1,Z.layer),style:e1.styles.layer},arrowProps:{ref:Ct,style:e1.styles.arrow,layerSide:e1.layerSide},layerSide:e1.layerSide,triggerBounds:r?d1?d1.getBounds():(a=V1.current)==null?void 0:a.getBoundingClientRect():null,renderLayer:function(f1){return typeof document<"u"?(0,zm.createPortal)((0,tt.createElement)(A_,{registrations:$,children:f1}),i||!P1?N_(b):P1):null}};return s1}function D_(t,a){if(t.layerSide!==a.layerSide)return!0;for(var e=["position","top","left","right","bottom"],r=0,n=e;r`,arrowDown:t=>`
- `},W_={text:me.HeaderString,number:me.HeaderNumber,uri:me.HeaderUri,date:me.HeaderDate,list:me.HeaderArray},U_={text:M1.Text,number:M1.Number,uri:M1.Uri,date:M1.Text,list:M1.Text},wm={fontFamily:"JetBrains Mono",bgHeader:"white",textDark:"#61758a",textHeader:"#304254",headerFontStyle:"bold 14px",baseFontStyle:"14px",borderColor:"#E1E8F0",horizontalBorderColor:"#E1E8F0",accentColor:"#3E64FF",accentLight:"#ECF0FF",bgHeaderHovered:"#F0F5F9",bgHeaderHasFocus:"#E1E8F0",bgSearchResult:"#FFF7EC",headerIconSize:22};function lD(t,a){t.importCSS("main.css"),t.importCSS("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap"),t.importCSS("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap"),(0,Lm.createRoot)(t.root).render(g1.default.createElement(j_,{ctx:t,data:a}))}function j_({ctx:t,data:a}){let e=[],r=[],n=a.content.columns.map(h1=>{let r1=h1.summary,u1=h1.label,H1=h1.key;return r.push({[u1]:250}),r1&&e.push(r1.keys.length),{title:u1,id:H1,type:h1.type,icon:W_[h1.type]||me.HeaderString,hasMenu:h1.type!=="list",summary:r1}}),i=a.features.includes("refetch"),l=a.features.includes("export"),o=a.content.columns.length!==0,h=e.length>0,c=a.features.includes("sorting"),v=l?a.export?.formats:null,g=l&&v,d={rows:Lt.empty(),columns:Lt.empty()},[u,p]=(0,g1.useState)(a.content),[z,x]=(0,g1.useState)(!1),[s,f]=(0,g1.useState)(n),[m,M]=(0,g1.useState)(r),[w,y]=(0,g1.useState)(null),[R,L]=(0,g1.useState)(!1),[V,C]=(0,g1.useState)(d),[k,b]=(0,g1.useState)(0),[F,_]=(0,g1.useState)(null),q=u.total_rows,i1=o&&q>0,t1=a.features.includes("pagination")&&(q===null||q>0),d1=u.limit===q,O=44,e1=h&&i1?Math.max(...e):0,U=O+e1*22,V1=c?140:70,p1=440+U,x1=q&&q<(c?3:2)&&w?V1+U:null,I1=q>=10&&d1?p1:x1,X1=(u.page-1)*u.limit+1,W1=h?150:50,Ct=a.content.columns.length===1?800:350,P1=u.page_length,Y1=(0,g1.useCallback)(h1=>{let{ctx:r1,theme:u1,rect:H1,column:O1,menuBounds:J1,isHovered:Bt,isSelected:Gt,spriteManager:Ut}=h1;if(O1.sourceIndex===0)return!0;if(!i1)return!1;r1.rect(H1.x,H1.y,H1.width,H1.height);let Tt=10,ct=19,at=Gt?u1.textHeaderSelected:u1.textHeader,e0=Gt?u1.accentLight:u1.textDark,Mt=O1.hasMenu===!0&&Bt,B0=!!O1.summary,Z0=35,S0=H1.width-Z0,r0=H1.width-Z0*.7,ua=S0/H1.width,st=r0/H1.width,St=r1.createLinearGradient(H1.x,0,H1.x+H1.width,0),c0=er(at,0),wt=Ea(r1,`${u1.headerFontStyle} ${u1.fontFamily}`);if(St.addColorStop(0,at),St.addColorStop(ua,at),St.addColorStop(st,c0),St.addColorStop(1,c0),r1.fillStyle=Mt?St:at,O1.icon){let kt=Gt?"selected":O1.style==="highlight"?"special":"normal",Kt=u1.headerIconSize;Ut.drawSprite(O1.icon,kt,r1,H1.x+Tt,H1.y+Tt,Kt,u1),O1.overlayIcon&&Ut.drawSprite(O1.overlayIcon,Gt?"selected":"special",r1,H1.x+Tt+ct/2,H1.y+Tt+ct/2,ct,u1)}if(r1.fillText(O1.title,J1.x-H1.width+u1.headerIconSize*2.5+14,B0?H1.y+Tt+u1.headerIconSize/2+wt:J1.y+J1.height/2+wt),B0){let kt=u.columns[O1.sourceIndex-1].summary,Kt=Object.fromEntries(kt.keys.map((q0,g2)=>[q0,kt.values[g2]])),c2=13,v2=c2+Tt,_a=`${c2}px ${u1.fontFamily}`,T2=`bold ${_a}`;r1.fillStyle=e0,Object.entries(Kt).forEach(([q0,g2],P2)=>{r1.font=T2,r1.fillText(`${q0}:`,H1.x+v2/2,H1.y+v2*(P2+1)+v2),r1.font=_a,r1.fillText(g2,H1.x+r1.measureText(q0).width+v2,H1.y+v2*(P2+1)+v2)})}if(Mt){r1.fillStyle=St;let kt=J1.x+J1.width/2-Tt*1.5,Kt=u1.headerIconSize/2-2,c2=new Path2D("M12 16l-6-6h12z");r1.translate(kt,Kt),r1.fill(c2)}return!0},[u]),Z=(0,g1.useCallback)(([h1,r1])=>{let u1=U_[u.columns[h1].type]||M1.Text,O1=u.data_orientation==="columns"?u.data[h1][r1]:u.data[r1][h1];return{kind:u1,data:O1,displayData:O1,allowOverlay:!0,allowWrapping:!1,readonly:!0}},[u]),$=()=>{x(!z)},s1=h1=>{let r1=h1!=="none"?w.columnKey:null;t.pushEvent("order_by",{key:r1,direction:h1??"asc"}),y(null)},w1=()=>{t.pushEvent("show_page",{page:u.page-1}),C({...d,columns:V.columns})},f1=()=>{t.pushEvent("show_page",{page:u.page+1}),C({...d,columns:V.columns})},W=()=>{let h1={...d,columns:Lt.fromSingleSelection(w.column)};C(h1),y(null)},{layerProps:c1,renderLayer:D}=xm({isOpen:R,auto:!0,placement:"bottom-end",possiblePlacements:["bottom-end","bottom-center","bottom-start"],triggerOffset:0,onOutsideClick:()=>y(null),trigger:{getBounds:()=>({left:w?.bounds.x??0,top:w?.bounds.y??0,width:w?.bounds.width??0,height:w?.bounds.height??0,right:(w?.bounds.x??0)+(w?.bounds.width??0),bottom:(w?.bounds.y??0)+(w?.bounds.height??0)})}}),I=(0,g1.useCallback)((h1,r1)=>{M(u1=>({...u1,[h1.title]:r1}))},[]),A1=(0,g1.useCallback)((h1,r1)=>{let{summary:u1,id:H1,type:O1}=s[h1];u1||y({column:h1,bounds:r1,columnKey:H1,columnType:O1})},[]),N1=(0,g1.useCallback)((h1,{bounds:r1})=>{let{id:u1,type:H1}=s[h1];y({column:h1,bounds:r1,columnKey:u1,columnType:H1})},[]),nt=(0,g1.useCallback)(h1=>{let[r1,u1]=h1.location;u1===-1&&r1===-1&&h1.kind==="header"?_([...Array.from({length:P1},(H1,O1)=>O1)]):r1===-1&&h1.kind==="cell"?_([u1]):_(null)},[P1]),F1=(0,g1.useCallback)(h1=>F?.includes(h1)?{bgCell:wm.bgHeaderHovered}:null,[F]);return(0,g1.useEffect)(()=>{V.rows?.items.length>0?b(1):b(0)},[V]),(0,g1.useEffect)(()=>{t.handleEvent("update_content",h1=>{p(h1)}),t.handleEvent("download_content",([h1,r1])=>{let u1=new Blob([r1],{type:h1.type}),H1=document.createElement("a");H1.href=window.URL.createObjectURL(u1),H1.download=`${h1.filename}-${+new Date}${h1.format}`,H1.click()})},[]),(0,g1.useEffect)(()=>{let h1=u.order?.direction==="asc"?"arrowUp":"arrowDown",r1=s.map(u1=>({...u1,overlayIcon:u1.id===u.order?.key?h1:null}));f(r1)},[u.order?.direction,u.order?.key]),(0,g1.useEffect)(()=>{let h1=s.map(r1=>({...r1,width:m[r1.title]}));f(h1)},[m]),(0,g1.useEffect)(()=>{let h1=w?.columnKey,r1={bgHeader:"#F0F5F9"},u1=s.map(H1=>({...H1,themeOverride:H1.id===h1?r1:null}));f(u1),L(!!w)},[w]),g1.default.createElement("div",{className:"app"},g1.default.createElement("div",{className:"navigation"},g1.default.createElement("div",{className:"navigation__info"},g1.default.createElement("h2",{className:"navigation__name"},a.name),g1.default.createElement("span",{className:"navigation__details"},q||"?"," ",q===1?"entry":"entries"),qt.pushEvent("download",{format:h1})}),g1.default.createElement("div",{className:"navigation__space"}),i&&g1.default.createElement(G_,{onRefetch:()=>t.pushEvent("refetch")}),g1.default.createElement(K_,{toggleSearch:$}),g1.default.createElement(X_,{limit:u.limit,totalRows:q,onChange:h1=>t.pushEvent("limit",{limit:h1})}),t1&&g1.default.createElement(Y_,{page:u.page,maxPage:u.max_page,onPrev:w1,onNext:f1,rows:P1})),o&&g1.default.createElement(Yz,{className:"table-container",theme:wm,getCellContent:Z,columns:s,rows:P1,width:"100%",height:I1,rowHeight:44,headerHeight:U,drawHeader:Y1,verticalBorder:!1,rowMarkers:"clickable-number",rowMarkerWidth:32,onHeaderMenuClick:A1,onHeaderClicked:N1,showSearch:z,getCellsForSelection:!0,onSearchClose:$,headerIcons:$_,overscrollX:100,isDraggable:!1,smoothScrollX:!0,smoothScrollY:!0,onColumnResize:I,columnSelect:"none",gridSelection:V,onGridSelectionChange:h1=>C(h1),rowMarkerStartIndex:X1,minColumnWidth:W1,maxColumnAutoWidth:Ct,fillHandle:!0,onItemHovered:nt,getRowThemeOverride:F1}),R&&D(g1.default.createElement(Q_,{layerProps:c1,menu:w,orderBy:s1,selectAllCurrent:W,hasSorting:c})),!o&&g1.default.createElement("p",{className:"no-data"},"No data"),g1.default.createElement("div",{id:"portal"}))}function q_({supportedFormats:t,onDownload:a}){let e=t.map(r=>g1.default.createElement("option",null,r));return g1.default.createElement("div",{className:"download"},g1.default.createElement("span",{className:"tooltip right","data-tooltip":"Export to"},g1.default.createElement("form",null,g1.default.createElement("select",{className:"input__icon",value:"",onChange:r=>a(r.target.value)},g1.default.createElement("option",{selected:!0,disabled:!0,value:""},"Export to"),e))))}function G_({onRefetch:t}){return g1.default.createElement("button",{className:"icon-button","aria-label":"refresh",onClick:t},g1.default.createElement(rm,null))}function K_({toggleSearch:t}){return g1.default.createElement("span",{className:"tooltip right","data-tooltip":"Current page search"},g1.default.createElement("button",{className:"icon-button search","aria-label":"search",onClick:t},g1.default.createElement(nm,{className:"search-icon"})))}function X_({limit:t,totalRows:a,onChange:e}){return g1.default.createElement("div",null,g1.default.createElement("form",null,g1.default.createElement("label",{className:"input-label"},"Show"),g1.default.createElement("select",{className:"input",value:t,onChange:r=>e(parseInt(r.target.value))},g1.default.createElement("option",{value:"10"},"10"),g1.default.createElement("option",{value:"20"},"20"),g1.default.createElement("option",{value:"50"},"50"),g1.default.createElement("option",{value:"100"},"100"),a?g1.default.createElement("option",{value:a},"All"):null)))}function Y_({page:t,maxPage:a,onPrev:e,onNext:r,rows:n}){return g1.default.createElement("div",{className:"pagination"},g1.default.createElement("button",{className:"pagination__button",onClick:e,disabled:t===1},g1.default.createElement(am,null),g1.default.createElement("span",null,"Prev")),g1.default.createElement("div",{className:"pagination__info"},g1.default.createElement("span",null,t," of ",a||"?")),g1.default.createElement("button",{className:"pagination__button",onClick:r,disabled:t===a||n===0},g1.default.createElement("span",null,"Next"),g1.default.createElement(em,null)))}function Q_({layerProps:t,selectAllCurrent:a,hasSorting:e,orderBy:r}){return g1.default.createElement("div",{className:"header-menu",...t},g1.default.createElement("button",{className:"header-menu-item button",onClick:a},"Select this column"),e&&g1.default.createElement(g1.default.Fragment,null,g1.default.createElement("div",{className:"header-menu-item",onClick:()=>r("asc")},g1.default.createElement(Jz,null),g1.default.createElement("span",null,"Sort: ascending")),g1.default.createElement("div",{className:"header-menu-item",onClick:()=>r("desc")},g1.default.createElement(tm,null),g1.default.createElement("span",null,"Sort: descending")),g1.default.createElement("div",{className:"header-menu-item",onClick:()=>r("none")},g1.default.createElement(Zz,null),g1.default.createElement("span",null,"Sort: none"))))}export{lD as init};
+ `,curlyBraces:t=>`
+ `},W_={text:me.HeaderString,number:me.HeaderNumber,uri:me.HeaderUri,date:me.HeaderDate,list:me.HeaderArray,struct:"curlyBraces"},U_={text:m1.Text,number:m1.Number,uri:m1.Uri,date:m1.Text,list:m1.Text,struct:m1.Text},wm={fontFamily:"JetBrains Mono",bgHeader:"white",textDark:"#61758a",textHeader:"#304254",headerFontStyle:"bold 14px",baseFontStyle:"14px",borderColor:"#E1E8F0",horizontalBorderColor:"#E1E8F0",accentColor:"#3E64FF",accentLight:"#ECF0FF",bgHeaderHovered:"#F0F5F9",bgHeaderHasFocus:"#E1E8F0",bgSearchResult:"#FFF7EC",headerIconSize:22};function lD(t,a){t.importCSS("main.css"),t.importCSS("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap"),t.importCSS("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap"),(0,Lm.createRoot)(t.root).render(g1.default.createElement(j_,{ctx:t,data:a}))}function j_({ctx:t,data:a}){let e=[],r=[],n=a.content.columns.map(h1=>{let r1=h1.summary,u1=h1.label,H1=h1.key;return r.push({[u1]:250}),r1&&e.push(r1.keys.length),{title:u1,id:H1,type:h1.type,icon:W_[h1.type]||me.HeaderString,hasMenu:h1.type!=="list",summary:r1}}),i=a.features.includes("refetch"),l=a.features.includes("export"),o=a.content.columns.length!==0,h=e.length>0,c=a.features.includes("sorting"),v=l?a.export?.formats:null,g=l&&v,d={rows:Lt.empty(),columns:Lt.empty()},[u,p]=(0,g1.useState)(a.content),[z,x]=(0,g1.useState)(!1),[s,f]=(0,g1.useState)(n),[m,M]=(0,g1.useState)(r),[w,y]=(0,g1.useState)(null),[R,L]=(0,g1.useState)(!1),[V,C]=(0,g1.useState)(d),[k,b]=(0,g1.useState)(0),[F,_]=(0,g1.useState)(null),q=u.total_rows,i1=o&&q>0,t1=a.features.includes("pagination")&&(q===null||q>0),d1=u.limit===q,O=44,e1=h&&i1?Math.max(...e):0,U=O+e1*22,V1=c?140:70,p1=440+U,x1=q&&q<(c?3:2)&&w?V1+U:null,I1=q>=10&&d1?p1:x1,X1=(u.page-1)*u.limit+1,W1=h?150:50,Ct=a.content.columns.length===1?800:350,P1=u.page_length,Y1=(0,g1.useCallback)(h1=>{let{ctx:r1,theme:u1,rect:H1,column:O1,menuBounds:J1,isHovered:Bt,isSelected:Gt,spriteManager:Ut}=h1;if(O1.sourceIndex===0)return!0;if(!i1)return!1;r1.rect(H1.x,H1.y,H1.width,H1.height);let Tt=10,ct=19,at=Gt?u1.textHeaderSelected:u1.textHeader,e0=Gt?u1.accentLight:u1.textDark,Mt=O1.hasMenu===!0&&Bt,B0=!!O1.summary,Z0=35,S0=H1.width-Z0,r0=H1.width-Z0*.7,ua=S0/H1.width,st=r0/H1.width,St=r1.createLinearGradient(H1.x,0,H1.x+H1.width,0),c0=er(at,0),wt=Ea(r1,`${u1.headerFontStyle} ${u1.fontFamily}`);if(St.addColorStop(0,at),St.addColorStop(ua,at),St.addColorStop(st,c0),St.addColorStop(1,c0),r1.fillStyle=Mt?St:at,O1.icon){let kt=Gt?"selected":O1.style==="highlight"?"special":"normal",Kt=u1.headerIconSize;Ut.drawSprite(O1.icon,kt,r1,H1.x+Tt,H1.y+Tt,Kt,u1),O1.overlayIcon&&Ut.drawSprite(O1.overlayIcon,Gt?"selected":"special",r1,H1.x+Tt+ct/2,H1.y+Tt+ct/2,ct,u1)}if(r1.fillText(O1.title,J1.x-H1.width+u1.headerIconSize*2.5+14,B0?H1.y+Tt+u1.headerIconSize/2+wt:J1.y+J1.height/2+wt),B0){let kt=u.columns[O1.sourceIndex-1].summary,Kt=Object.fromEntries(kt.keys.map((q0,g2)=>[q0,kt.values[g2]])),c2=13,v2=c2+Tt,_a=`${c2}px ${u1.fontFamily}`,T2=`bold ${_a}`;r1.fillStyle=e0,Object.entries(Kt).forEach(([q0,g2],P2)=>{r1.font=T2,r1.fillText(`${q0}:`,H1.x+v2/2,H1.y+v2*(P2+1)+v2),r1.font=_a,r1.fillText(g2,H1.x+r1.measureText(q0).width+v2,H1.y+v2*(P2+1)+v2)})}if(Mt){r1.fillStyle=St;let kt=J1.x+J1.width/2-Tt*1.5,Kt=u1.headerIconSize/2-2,c2=new Path2D("M12 16l-6-6h12z");r1.translate(kt,Kt),r1.fill(c2)}return!0},[u]),Z=(0,g1.useCallback)(([h1,r1])=>{let u1=U_[u.columns[h1].type]||m1.Text,O1=u.data_orientation==="columns"?u.data[h1][r1]:u.data[r1][h1];return{kind:u1,data:O1,displayData:O1,allowOverlay:!0,allowWrapping:!1,readonly:!0}},[u]),$=()=>{x(!z)},s1=h1=>{let r1=h1!=="none"?w.columnKey:null;t.pushEvent("order_by",{key:r1,direction:h1??"asc"}),y(null)},w1=()=>{t.pushEvent("show_page",{page:u.page-1}),C({...d,columns:V.columns})},f1=()=>{t.pushEvent("show_page",{page:u.page+1}),C({...d,columns:V.columns})},W=()=>{let h1={...d,columns:Lt.fromSingleSelection(w.column)};C(h1),y(null)},{layerProps:c1,renderLayer:D}=xm({isOpen:R,auto:!0,placement:"bottom-end",possiblePlacements:["bottom-end","bottom-center","bottom-start"],triggerOffset:0,onOutsideClick:()=>y(null),trigger:{getBounds:()=>({left:w?.bounds.x??0,top:w?.bounds.y??0,width:w?.bounds.width??0,height:w?.bounds.height??0,right:(w?.bounds.x??0)+(w?.bounds.width??0),bottom:(w?.bounds.y??0)+(w?.bounds.height??0)})}}),I=(0,g1.useCallback)((h1,r1)=>{M(u1=>({...u1,[h1.title]:r1}))},[]),A1=(0,g1.useCallback)((h1,r1)=>{let{summary:u1,id:H1,type:O1}=s[h1];u1||y({column:h1,bounds:r1,columnKey:H1,columnType:O1})},[]),N1=(0,g1.useCallback)((h1,{bounds:r1})=>{let{id:u1,type:H1}=s[h1];y({column:h1,bounds:r1,columnKey:u1,columnType:H1})},[]),nt=(0,g1.useCallback)(h1=>{let[r1,u1]=h1.location;u1===-1&&r1===-1&&h1.kind==="header"?_([...Array.from({length:P1},(H1,O1)=>O1)]):r1===-1&&h1.kind==="cell"?_([u1]):_(null)},[P1]),F1=(0,g1.useCallback)(h1=>F?.includes(h1)?{bgCell:wm.bgHeaderHovered}:null,[F]);return(0,g1.useEffect)(()=>{V.rows?.items.length>0?b(1):b(0)},[V]),(0,g1.useEffect)(()=>{t.handleEvent("update_content",h1=>{p(h1)}),t.handleEvent("download_content",([h1,r1])=>{let u1=new Blob([r1],{type:h1.type}),H1=document.createElement("a");H1.href=window.URL.createObjectURL(u1),H1.download=`${h1.filename}-${+new Date}${h1.format}`,H1.click()})},[]),(0,g1.useEffect)(()=>{let h1=u.order?.direction==="asc"?"arrowUp":"arrowDown",r1=s.map(u1=>({...u1,overlayIcon:u1.id===u.order?.key?h1:null}));f(r1)},[u.order?.direction,u.order?.key]),(0,g1.useEffect)(()=>{let h1=s.map(r1=>({...r1,width:m[r1.title]}));f(h1)},[m]),(0,g1.useEffect)(()=>{let h1=w?.columnKey,r1={bgHeader:"#F0F5F9"},u1=s.map(H1=>({...H1,themeOverride:H1.id===h1?r1:null}));f(u1),L(!!w)},[w]),g1.default.createElement("div",{className:"app"},g1.default.createElement("div",{className:"navigation"},g1.default.createElement("div",{className:"navigation__info"},g1.default.createElement("h2",{className:"navigation__name"},a.name),g1.default.createElement("span",{className:"navigation__details"},q||"?"," ",q===1?"entry":"entries"),qt.pushEvent("download",{format:h1})}),g1.default.createElement("div",{className:"navigation__space"}),i&&g1.default.createElement(G_,{onRefetch:()=>t.pushEvent("refetch")}),g1.default.createElement(K_,{toggleSearch:$}),g1.default.createElement(X_,{limit:u.limit,totalRows:q,onChange:h1=>t.pushEvent("limit",{limit:h1})}),t1&&g1.default.createElement(Y_,{page:u.page,maxPage:u.max_page,onPrev:w1,onNext:f1,rows:P1})),o&&g1.default.createElement(Yz,{className:"table-container",theme:wm,getCellContent:Z,columns:s,rows:P1,width:"100%",height:I1,rowHeight:44,headerHeight:U,drawHeader:Y1,verticalBorder:!1,rowMarkers:"clickable-number",rowMarkerWidth:32,onHeaderMenuClick:A1,onHeaderClicked:N1,showSearch:z,getCellsForSelection:!0,onSearchClose:$,headerIcons:$_,overscrollX:100,isDraggable:!1,smoothScrollX:!0,smoothScrollY:!0,onColumnResize:I,columnSelect:"none",gridSelection:V,onGridSelectionChange:h1=>C(h1),rowMarkerStartIndex:X1,minColumnWidth:W1,maxColumnAutoWidth:Ct,fillHandle:!0,onItemHovered:nt,getRowThemeOverride:F1}),R&&D(g1.default.createElement(Q_,{layerProps:c1,menu:w,orderBy:s1,selectAllCurrent:W,hasSorting:c})),!o&&g1.default.createElement("p",{className:"no-data"},"No data"),g1.default.createElement("div",{id:"portal"}))}function q_({supportedFormats:t,onDownload:a}){let e=t.map(r=>g1.default.createElement("option",null,r));return g1.default.createElement("div",{className:"download"},g1.default.createElement("span",{className:"tooltip right","data-tooltip":"Export to"},g1.default.createElement("form",null,g1.default.createElement("select",{className:"input__icon",value:"",onChange:r=>a(r.target.value)},g1.default.createElement("option",{selected:!0,disabled:!0,value:""},"Export to"),e))))}function G_({onRefetch:t}){return g1.default.createElement("button",{className:"icon-button","aria-label":"refresh",onClick:t},g1.default.createElement(rm,null))}function K_({toggleSearch:t}){return g1.default.createElement("span",{className:"tooltip right","data-tooltip":"Current page search"},g1.default.createElement("button",{className:"icon-button search","aria-label":"search",onClick:t},g1.default.createElement(nm,{className:"search-icon"})))}function X_({limit:t,totalRows:a,onChange:e}){return g1.default.createElement("div",null,g1.default.createElement("form",null,g1.default.createElement("label",{className:"input-label"},"Show"),g1.default.createElement("select",{className:"input",value:t,onChange:r=>e(parseInt(r.target.value))},g1.default.createElement("option",{value:"10"},"10"),g1.default.createElement("option",{value:"20"},"20"),g1.default.createElement("option",{value:"50"},"50"),g1.default.createElement("option",{value:"100"},"100"),a?g1.default.createElement("option",{value:a},"All"):null)))}function Y_({page:t,maxPage:a,onPrev:e,onNext:r,rows:n}){return g1.default.createElement("div",{className:"pagination"},g1.default.createElement("button",{className:"pagination__button",onClick:e,disabled:t===1},g1.default.createElement(am,null),g1.default.createElement("span",null,"Prev")),g1.default.createElement("div",{className:"pagination__info"},g1.default.createElement("span",null,t," of ",a||"?")),g1.default.createElement("button",{className:"pagination__button",onClick:r,disabled:t===a||n===0},g1.default.createElement("span",null,"Next"),g1.default.createElement(em,null)))}function Q_({layerProps:t,selectAllCurrent:a,hasSorting:e,orderBy:r}){return g1.default.createElement("div",{className:"header-menu",...t},g1.default.createElement("button",{className:"header-menu-item button",onClick:a},"Select this column"),e&&g1.default.createElement(g1.default.Fragment,null,g1.default.createElement("div",{className:"header-menu-item",onClick:()=>r("asc")},g1.default.createElement(Jz,null),g1.default.createElement("span",null,"Sort: ascending")),g1.default.createElement("div",{className:"header-menu-item",onClick:()=>r("desc")},g1.default.createElement(tm,null),g1.default.createElement("span",null,"Sort: descending")),g1.default.createElement("div",{className:"header-menu-item",onClick:()=>r("none")},g1.default.createElement(Zz,null),g1.default.createElement("span",null,"Sort: none"))))}export{lD as init};
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see