react-base-data-table 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -38,7 +38,7 @@ object-assign
38
38
  (c) Sindre Sorhus
39
39
  @license MIT
40
40
  */var eo,zl;function Dp(){if(zl)return eo;zl=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function i(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(o).map(function(u){return o[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return eo=i()?Object.assign:function(s,o){for(var a,l=r(s),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)t.call(a,d)&&(l[d]=a[d]);if(e){c=e(a);for(var h=0;h<c.length;h++)n.call(a,c[h])&&(l[c[h]]=a[c[h]])}}return l},eo}var to,Vl;function ga(){if(Vl)return to;Vl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return to=e,to}var no,Wl;function vh(){return Wl||(Wl=1,no=Function.call.bind(Object.prototype.hasOwnProperty)),no}var ro,Ul;function kp(){if(Ul)return ro;Ul=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ga(),n={},r=vh();e=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function i(s,o,a,l,c){if(process.env.NODE_ENV!=="production"){for(var u in s)if(r(s,u)){var d;try{if(typeof s[u]!="function"){var h=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}d=s[u](o,u,l,a,null,t)}catch(p){d=p}if(d&&!(d instanceof Error)&&e((l||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var g=c?c():"";e("Failed "+a+" type: "+d.message+(g??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ro=i,ro}var io,Gl;function Ip(){if(Gl)return io;Gl=1;var e=bh(),t=Dp(),n=ga(),r=vh(),i=kp(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return io=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(E){var T=E&&(c&&E[c]||E[u]);if(typeof T=="function")return T}var h="<<anonymous>>",g={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:y(),arrayOf:S,element:w(),elementType:x(),instanceOf:C,node:$(),objectOf:M,oneOf:A,oneOfType:R,shape:j,exact:q};function p(E,T){return E===T?E!==0||1/E===1/T:E!==E&&T!==T}function m(E,T){this.message=E,this.data=T&&typeof T=="object"?T:{},this.stack=""}m.prototype=Error.prototype;function b(E){if(process.env.NODE_ENV!=="production")var T={},P=0;function L(U,H,G,Y,D,O,B){if(Y=Y||h,O=O||G,B!==n){if(l){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var K=Y+":"+G;!T[K]&&P<3&&(s("You are manually calling a React.PropTypes validation function for the `"+O+"` prop on `"+Y+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),T[K]=!0,P++)}}return H[G]==null?U?H[G]===null?new m("The "+D+" `"+O+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new m("The "+D+" `"+O+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:E(H,G,Y,D,O)}var N=L.bind(null,!1);return N.isRequired=L.bind(null,!0),N}function v(E){function T(P,L,N,U,H,G){var Y=P[L],D=X(Y);if(D!==E){var O=F(Y);return new m("Invalid "+U+" `"+H+"` of type "+("`"+O+"` supplied to `"+N+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return b(T)}function y(){return b(o)}function S(E){function T(P,L,N,U,H){if(typeof E!="function")return new m("Property `"+H+"` of component `"+N+"` has invalid PropType notation inside arrayOf.");var G=P[L];if(!Array.isArray(G)){var Y=X(G);return new m("Invalid "+U+" `"+H+"` of type "+("`"+Y+"` supplied to `"+N+"`, expected an array."))}for(var D=0;D<G.length;D++){var O=E(G,D,N,U,H+"["+D+"]",n);if(O instanceof Error)return O}return null}return b(T)}function w(){function E(T,P,L,N,U){var H=T[P];if(!a(H)){var G=X(H);return new m("Invalid "+N+" `"+U+"` of type "+("`"+G+"` supplied to `"+L+"`, expected a single ReactElement."))}return null}return b(E)}function x(){function E(T,P,L,N,U){var H=T[P];if(!e.isValidElementType(H)){var G=X(H);return new m("Invalid "+N+" `"+U+"` of type "+("`"+G+"` supplied to `"+L+"`, expected a single ReactElement type."))}return null}return b(E)}function C(E){function T(P,L,N,U,H){if(!(P[L]instanceof E)){var G=E.name||h,Y=J(P[L]);return new m("Invalid "+U+" `"+H+"` of type "+("`"+Y+"` supplied to `"+N+"`, expected ")+("instance of `"+G+"`."))}return null}return b(T)}function A(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function T(P,L,N,U,H){for(var G=P[L],Y=0;Y<E.length;Y++)if(p(G,E[Y]))return null;var D=JSON.stringify(E,function(B,k){var K=F(k);return K==="symbol"?String(k):k});return new m("Invalid "+U+" `"+H+"` of value `"+String(G)+"` "+("supplied to `"+N+"`, expected one of "+D+"."))}return b(T)}function M(E){function T(P,L,N,U,H){if(typeof E!="function")return new m("Property `"+H+"` of component `"+N+"` has invalid PropType notation inside objectOf.");var G=P[L],Y=X(G);if(Y!=="object")return new m("Invalid "+U+" `"+H+"` of type "+("`"+Y+"` supplied to `"+N+"`, expected an object."));for(var D in G)if(r(G,D)){var O=E(G,D,N,U,H+"."+D,n);if(O instanceof Error)return O}return null}return b(T)}function R(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var T=0;T<E.length;T++){var P=E[T];if(typeof P!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+re(P)+" at index "+T+"."),o}function L(N,U,H,G,Y){for(var D=[],O=0;O<E.length;O++){var B=E[O],k=B(N,U,H,G,Y,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&D.push(k.data.expectedType)}var K=D.length>0?", expected one of type ["+D.join(", ")+"]":"";return new m("Invalid "+G+" `"+Y+"` supplied to "+("`"+H+"`"+K+"."))}return b(L)}function $(){function E(T,P,L,N,U){return Z(T[P])?null:new m("Invalid "+N+" `"+U+"` supplied to "+("`"+L+"`, expected a ReactNode."))}return b(E)}function I(E,T,P,L,N){return new m((E||"React class")+": "+T+" type `"+P+"."+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+N+"`.")}function j(E){function T(P,L,N,U,H){var G=P[L],Y=X(G);if(Y!=="object")return new m("Invalid "+U+" `"+H+"` of type `"+Y+"` "+("supplied to `"+N+"`, expected `object`."));for(var D in E){var O=E[D];if(typeof O!="function")return I(N,U,H,D,F(O));var B=O(G,D,N,U,H+"."+D,n);if(B)return B}return null}return b(T)}function q(E){function T(P,L,N,U,H){var G=P[L],Y=X(G);if(Y!=="object")return new m("Invalid "+U+" `"+H+"` of type `"+Y+"` "+("supplied to `"+N+"`, expected `object`."));var D=t({},P[L],E);for(var O in D){var B=E[O];if(r(E,O)&&typeof B!="function")return I(N,U,H,O,F(B));if(!B)return new m("Invalid "+U+" `"+H+"` key `"+O+"` supplied to `"+N+"`.\nBad object: "+JSON.stringify(P[L],null," ")+`
41
- Valid keys: `+JSON.stringify(Object.keys(E),null," "));var k=B(G,O,N,U,H+"."+O,n);if(k)return k}return null}return b(T)}function Z(E){switch(typeof E){case"number":case"string":case"undefined":return!0;case"boolean":return!E;case"object":if(Array.isArray(E))return E.every(Z);if(E===null||a(E))return!0;var T=d(E);if(T){var P=T.call(E),L;if(T!==E.entries){for(;!(L=P.next()).done;)if(!Z(L.value))return!1}else for(;!(L=P.next()).done;){var N=L.value;if(N&&!Z(N[1]))return!1}}else return!1;return!0;default:return!1}}function W(E,T){return E==="symbol"?!0:T?T["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&T instanceof Symbol:!1}function X(E){var T=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":W(T,E)?"symbol":T}function F(E){if(typeof E>"u"||E===null)return""+E;var T=X(E);if(T==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return T}function re(E){var T=F(E);switch(T){case"array":case"object":return"an "+T;case"boolean":case"date":case"regexp":return"a "+T;default:return T}}function J(E){return!E.constructor||!E.constructor.name?h:E.constructor.name}return g.checkPropTypes=i,g.resetWarningCache=i.resetWarningCache,g.PropTypes=g,g},io}var so,Yl;function $p(){if(Yl)return so;Yl=1;var e=ga();function t(){}function n(){}return n.resetWarningCache=t,so=function(){function r(o,a,l,c,u,d){if(d!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},so}var ql;function xh(){if(ql)return Mi.exports;if(ql=1,process.env.NODE_ENV!=="production"){var e=bh(),t=!0;Mi.exports=Ip()(e.isElement,t)}else Mi.exports=$p()();return Mi.exports}var Pp=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(r,i,s){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:s})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var o in r)n.d(s,o,(function(a){return r[a]}).bind(null,o));return s},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=2)}([function(e,t){e.exports=xh()},function(e,t){e.exports=f},function(e,t,n){n.r(t);var r=n(1),i=n(0),s=function(){return(s=Object.assign||function(p){for(var m,b=1,v=arguments.length;b<v;b++)for(var y in m=arguments[b])Object.prototype.hasOwnProperty.call(m,y)&&(p[y]=m[y]);return p}).apply(this,arguments)},o=function(p,m){var b={};for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&m.indexOf(v)<0&&(b[v]=p[v]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(v=Object.getOwnPropertySymbols(p);y<v.length;y++)m.indexOf(v[y])<0&&Object.prototype.propertyIsEnumerable.call(p,v[y])&&(b[v[y]]=p[v[y]])}return b},a=0,l=r.forwardRef(function(p,m){var b=p.title,v=b===void 0?null:b,y=p.description,S=y===void 0?null:y,w=p.size,x=w===void 0?null:w,C=p.color,A=C===void 0?"currentColor":C,M=p.horizontal,R=M===void 0?null:M,$=p.vertical,I=$===void 0?null:$,j=p.rotate,q=j===void 0?null:j,Z=p.spin,W=Z===void 0?null:Z,X=p.style,F=X===void 0?{}:X,re=p.children,J=o(p,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var E,T=W!==null&&W,P=r.Children.map(re,function(H){var G=H;T!==!0&&(T=(W===null?G.props.spin:W)===!0);var Y=G.props.size;typeof x=="number"&&typeof G.props.size=="number"&&(Y=G.props.size/x);var D={size:Y,color:A===null?G.props.color:A,horizontal:R===null?G.props.horizontal:R,vertical:I===null?G.props.vertical:I,rotate:q===null?G.props.rotate:q,spin:W===null?G.props.spin:W,inStack:!0};return r.cloneElement(G,D)});x!==null&&(F.width=typeof x=="string"?x:1.5*x+"rem");var L,N="stack_labelledby_"+a,U="stack_describedby_"+a;if(v)E=S?N+" "+U:N;else if(L="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:m,viewBox:"0 0 24 24",style:F,role:L,"aria-labelledby":E},J),v&&r.createElement("title",{id:N},v),S&&r.createElement("desc",{id:U},S),T&&r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),P)});l.displayName="Stack",l.propTypes={size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),children:i.oneOfType([i.arrayOf(i.node),i.node]).isRequired,className:i.string,style:i.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var c=l;n.d(t,"Icon",function(){return g}),n.d(t,"Stack",function(){return c});var u=function(){return(u=Object.assign||function(p){for(var m,b=1,v=arguments.length;b<v;b++)for(var y in m=arguments[b])Object.prototype.hasOwnProperty.call(m,y)&&(p[y]=m[y]);return p}).apply(this,arguments)},d=function(p,m){var b={};for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&m.indexOf(v)<0&&(b[v]=p[v]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(v=Object.getOwnPropertySymbols(p);y<v.length;y++)m.indexOf(v[y])<0&&Object.prototype.propertyIsEnumerable.call(p,v[y])&&(b[v[y]]=p[v[y]])}return b},h=0,g=r.forwardRef(function(p,m){var b=p.path,v=p.id,y=v===void 0?++h:v,S=p.title,w=S===void 0?null:S,x=p.description,C=x===void 0?null:x,A=p.size,M=A===void 0?null:A,R=p.color,$=R===void 0?"currentColor":R,I=p.horizontal,j=I!==void 0&&I,q=p.vertical,Z=q!==void 0&&q,W=p.rotate,X=W===void 0?0:W,F=p.spin,re=F!==void 0&&F,J=p.style,E=J===void 0?{}:J,T=p.inStack,P=T!==void 0&&T,L=d(p,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),N={},U=[];M!==null&&(P?U.push("scale("+M+")"):(E.width=typeof M=="string"?M:1.5*M+"rem",E.height=E.width)),j&&U.push("scaleX(-1)"),Z&&U.push("scaleY(-1)"),X!==0&&U.push("rotate("+X+"deg)"),$!==null&&(N.fill=$);var H=r.createElement("path",u({d:b,style:N},P?L:{})),G=H;U.length>0&&(E.transform=U.join(" "),E.transformOrigin="center",P&&(G=r.createElement("g",{style:E},H,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var Y,D=G,O=re===!0||typeof re!="number"?2:re,B=!P&&(j||Z);if(O<0&&(B=!B),re&&(D=r.createElement("g",{style:{animation:"spin"+(B?"-inverse":"")+" linear "+Math.abs(O)+"s infinite",transformOrigin:"center"}},G,!(j||Z||X!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),P)return D;var k,K="icon_labelledby_"+y,ne="icon_describedby_"+y;if(w)Y=C?K+" "+ne:K;else if(k="presentation",C)throw new Error("title attribute required when description is set");return r.createElement("svg",u({ref:m,viewBox:"0 0 24 24",style:E,role:k,"aria-labelledby":Y},L),w&&r.createElement("title",{id:K},w),C&&r.createElement("desc",{id:ne},C),!P&&re&&(B?r.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),D)});g.displayName="Icon",g.propTypes={path:i.string.isRequired,size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),style:i.object,inStack:i.bool,className:i.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const ft=mh(Pp);var Lp="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",jp="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",Xl="M22,21H2V3H4V19H6V10H10V19H12V6H16V19H18V14H22V21Z",Fp="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",yh="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",wh="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",_h="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",Np="M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z",Hp="M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12L20 6.91Z",Bp="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22H9M11,6V9H8V11H11V14H13V11H16V9H13V6H11Z",zp="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",Sh="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z",Vp="M14,12V19.88C14.04,20.18 13.94,20.5 13.71,20.71C13.32,21.1 12.69,21.1 12.3,20.71L10.29,18.7C10.06,18.47 9.96,18.16 10,17.87V12H9.97L4.21,4.62C3.87,4.19 3.95,3.56 4.38,3.22C4.57,3.08 4.78,3 5,3V3H19V3C19.22,3 19.43,3.08 19.62,3.22C20.05,3.56 20.13,4.19 19.79,4.62L14.03,12H14Z",Wp="M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z",Up="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",Gp="M23 16V15.5A2.5 2.5 0 0 0 18 15.5V16A1 1 0 0 0 17 17V21A1 1 0 0 0 18 22H23A1 1 0 0 0 24 21V17A1 1 0 0 0 23 16M22 16H19V15.5A1.5 1.5 0 0 1 22 15.5M7 8.9H11V7H7A5 5 0 0 0 7 17H11V15.1H7A3.1 3.1 0 0 1 7 8.9M8 11V13H16V11M13 15.1V17H15V15.1M17 7H13V8.9H17A3.09 3.09 0 0 1 19.94 11A5.12 5.12 0 0 1 20.5 11H21.9A5 5 0 0 0 17 7Z",Yp="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",qp="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",Xp="M18 21L14 17H17V7H14L18 3L22 7H19V17H22M2 19V17H12V19M2 13V11H9V13M2 7V5H6V7H2Z",Kp="M4,3H20A2,2 0 0,1 22,5V20A2,2 0 0,1 20,22H4A2,2 0 0,1 2,20V5A2,2 0 0,1 4,3M4,7V10H8V7H4M10,7V10H14V7H10M20,10V7H16V10H20M4,12V15H8V12H4M4,20H8V17H4V20M10,12V15H14V12H10M10,20H14V17H10V20M20,20V17H16V20H20M20,12H16V15H20V12Z",Kl="M12.35 20H10V17H12.09C12.21 16.28 12.46 15.61 12.81 15H10V12H14V13.54C14.58 13 15.25 12.61 16 12.35V12H20V12.35C20.75 12.61 21.42 13 22 13.54V5C22 3.9 21.1 3 20 3H4C2.9 3 2 3.9 2 5V20C2 21.1 2.9 22 4 22H13.54C13 21.42 12.61 20.75 12.35 20M16 7H20V10H16V7M10 7H14V10H10V7M8 20H4V17H8V20M8 15H4V12H8V15M8 10H4V7H8V10M17 14H19V17H22V19H19V22H17V19H14V17H17V14",Zp="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z",Jp="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z";function Qp(e,t){f.useEffect(()=>{function n(r){Array.isArray(e)?e.every(s=>{var o;return!((o=s.current)!=null&&o.contains(r.target))})&&r.target&&t():e.current&&r.target&&!e.current.contains(r.target)&&t()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t])}var Lt=(e=>(e.STRING="string",e.NUMBER="number",e))(Lt||{});function st(e){const t=f.useMemo(()=>e.iconSize?e.iconSize:e.small?.8:1,[e.iconSize,e.small]),n=_.jsxs("button",{type:e.type??"button",id:e.id,className:`btn ${e.className??""} ${e.ghost?" btn-ghost":""} ${e.small?"btn-xs":"btn-sm"} content-center ${e.circle?"btn-circle":""}`,onClick:e.onClick,disabled:e.disabled===!0,children:[e.icon&&_.jsx(ft,{path:e.icon??"",color:e.disabled?e.iconColorDisabled??"lightgrey":e.iconColor,size:t}),e.text&&_.jsx("div",{className:`text-${e.small?"xs":"sm"}`,children:e.text})]});return _.jsx(_.Fragment,{children:e.tooltip?_.jsx("div",{className:`tooltip ${e.tooltipRight?"tooltip-right":"tooltip-top"} tooltip-top before:whitespace-pre-wrap text-left`,"data-tip":`${e.tooltip}`,children:n}):n})}const Zl=e=>{let t;const n=new Set,r=(c,u)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,i,a);return a},em=e=>e?Zl(e):Zl,tm=e=>e;function nm(e,t=tm){const n=f.useSyncExternalStore(e.subscribe,f.useCallback(()=>t(e.getState()),[e,t]),f.useCallback(()=>t(e.getInitialState()),[e,t]));return f.useDebugValue(n),n}const Jl=e=>{const t=em(e),n=r=>nm(t,r);return Object.assign(n,t),n},rn=e=>e?Jl(e):Jl,rm=e=>e.every(t=>typeof t=="number"),Ch=(e,t)=>e<t?-1:e>t?1:0,im=(e,t)=>e>t?-1:e<t?1:0,Eh=" ",sm=(e,t)=>{const n=JSON.parse(JSON.stringify(e));return e.length===0?[]:t.length===0?n:n.filter(r=>{for(const i of t){let s=r[i.headerId],o=!1;if(rm(i.itemsToHide)?(s=typeof s=="string"?s.split(Eh).join(""):s,o=i.itemsToHide.includes(Number(s))):i.itemsToHide.includes(s)&&(o=!0),o)return!1}return!0})},om=(e,t,n,r)=>{const i=[...e];if(!r)return i;const s=t.find(a=>a.id===r);if(s!=null&&s.customSort)return i.sort((a,l)=>s.customSort(a,l,n==="asc")),i;let o=!0;return i.forEach(a=>{var d;const l=(d=a[r])==null?void 0:d.toString();if(!l)return;const c=oo(l),u=["NaN"];isNaN(c)&&!u.includes(l)&&(o=!1)}),o?(i.sort((a,l)=>{const c=oo(a[r]),u=oo(l[r]),d=typeof c=="number"&&!isNaN(c),h=typeof u=="number"&&!isNaN(u);return d&&!h?-1:!d&&h?1:n==="desc"?u-c:c-u}),i):(n==="desc"?i.sort((a,l)=>Ch(l[r],a[r])):i.sort((a,l)=>im(l[r],a[r])),i)},oo=e=>typeof e=="number"?e:typeof e=="string"?Number(e.split(Eh).join("")):e,Pe=rn((e,t)=>({items:[],headers:[],hiddenHeadersId:[],processedHeaders:[],leafHeaders:[],processedLeafHeaders:[],processedItems:[],activeFilters:[],filterItemsCache:{},ascendingOrder:!0,comments:[],highlightConditions:[],advancedSetting:void 0,groupBy:void 0,linkedGroups:void 0,collapsedGroups:[],actions:{setItems:n=>{e({items:n})},setHeaders:n=>{const r=No(n);e({headers:n,leafHeaders:r})},setHiddenHeadersId:n=>{e({hiddenHeadersId:n})},setActiveFilter:(n,r,i)=>{const{activeFilters:s}=t(),o=[...s],a=o.findIndex(l=>l.headerId===n);a!==-1?r.length>0?o[a]={headerId:n,itemsToHide:r,numberConditions:i}:o.splice(a,1):r.length>0&&o.push({headerId:n,itemsToHide:r,numberConditions:i}),e({activeFilters:o})},clearActiveFilters:()=>{e({activeFilters:[]})},onResetSort:()=>{e({currentSortId:void 0,ascendingOrder:!0})},onSortByColumn:n=>{const{currentSortId:r,ascendingOrder:i}=t();if(!(n!=null&&n.sortable))return;let s;r===n.id?s=!i:s=!0,e({currentSortId:n.id,ascendingOrder:s})},processItems:()=>{const{items:n,activeFilters:r,headers:i,currentSortId:s,ascendingOrder:o}=t();let a=[...n];r.length>0&&(a=am(a,r)),s&&(a=lm(a,i,o,s)),e({processedItems:a})},processHeaders:()=>{const{headers:n,hiddenHeadersId:r}=t(),i=new Map,s=(u,d)=>{for(const h of u)d&&i.set(h.id,d),h.children&&h.children.length>0&&s(h.children,h.id)};s(n);const o=u=>{if(r.includes(u))return!0;let d=u;for(;i.has(d);)if(d=i.get(d),r.includes(d))return!0;return!1},a=u=>u.filter(d=>!o(d.id)).map(d=>d.children&&d.children.length>0?{...d,children:a(d.children)}:d),l=a(n),c=No(l);e({processedHeaders:l,processedLeafHeaders:c})},processFilterItemsCache:()=>{const{processedItems:n,activeFilters:r,leafHeaders:i}=t(),s={};i.forEach(o=>{let a=n.map(c=>c[o.id]);const l=r.find(c=>c.headerId===o.id);l&&(a=a.concat(l.itemsToHide)),s[o.id]=[...new Set(a)].filter(c=>typeof c=="string"||typeof c=="number")}),e({filterItemsCache:s})},setGroupBy:n=>{e({groupBy:n})},setLinkedGroups:n=>{e({linkedGroups:n})},collapseGroup:n=>{const{collapsedGroups:r}=t(),s=r.includes(n)?r.filter(o=>o!==n):[...r,n];e({collapsedGroups:s})},setCollapsedGroups:n=>{e({collapsedGroups:n})},setComments:n=>{e({comments:n})},setHighlightConditions:n=>{e({highlightConditions:n})},setAdvancedSettings:n=>{e({advancedSetting:n})}}}));function No(e){return e.flatMap(t=>t.children&&t.children.length>0?No(t.children):[t])}function am(e,t){return sm(e,t)}function lm(e,t,n,r){return om(e,t,n?"asc":"desc",r)}const Ah=()=>Pe(e=>e.headers),Mh=()=>Pe(e=>e.hiddenHeadersId),cm=()=>Pe(e=>e.processedHeaders),ui=()=>Pe(e=>e.processedLeafHeaders),Oh=()=>Pe(e=>e.items),Th=()=>Pe(e=>e.filterItemsCache),di=()=>Pe(e=>e.processedItems),Rh=()=>Pe(e=>e.currentSortId),pa=()=>Pe(e=>e.ascendingOrder),hi=()=>Pe(e=>e.activeFilters),xn=()=>Pe(e=>e.advancedSetting),Dh=()=>Pe(e=>e.comments),kh=()=>Pe(e=>e.highlightConditions),As=()=>Pe(e=>e.groupBy),um=()=>Pe(e=>e.linkedGroups),Ih=()=>Pe(e=>e.collapsedGroups),yn=()=>Pe(e=>e.actions);function dm(e){const{setActiveFilter:t}=yn(),n=hi(),r=f.useMemo(()=>n.find(p=>p.headerId===e.headerId),[n,e.headerId]),[i,s]=f.useState(""),[o,a]=f.useState([]);f.useEffect(()=>{a((r==null?void 0:r.itemsToHide)??[])},[r==null?void 0:r.itemsToHide]);const l=f.useMemo(()=>{let p=[];return i?(p=[...e.items].filter(m=>m==null?void 0:m.toString().toLocaleLowerCase().includes(i==null?void 0:i.toString().toLocaleLowerCase())),e.filterType===Lt.STRING&&(p=p.sort(Ch))):p=[...e.items],p},[i,e.items]),c=p=>{p.preventDefault(),i&&t(e.headerId,[i])},u=()=>{a([...e.items])},d=()=>{a([])},h=p=>{const m=o.findIndex(v=>v===p);let b=[...o];m!==void 0&&(m===-1?b=[...b,p]:b.splice(m,1),a(b))},g=()=>{const p=l.filter(b=>!o.includes(b)),m=[...e.items].filter(b=>!p.includes(b));t(e.headerId,m.map(b=>b))};return _.jsxs("div",{children:[_.jsx("div",{className:"font-semibold text-sm mb-1",children:"Filter by value:"}),_.jsxs("form",{onSubmit:c,children:[_.jsx("input",{type:"text",value:i,onChange:p=>s(p==null?void 0:p.target.value),placeholder:"Search...",className:"input input-bordered input-xs w-full max-w-xs"}),_.jsx("input",{type:"submit",value:""})]}),_.jsxs("div",{className:"flex text-xs mt-1 font-semibold text-primary",children:[_.jsx("button",{onClick:d,onFocus:()=>{},className:"mr-4 cursor-pointer hover:border-none! border-none! focus:outline-hidden! bg-transparent btn-sm",children:"Select All"}),_.jsx("button",{onClick:u,onFocus:()=>{},className:"cursor-pointer hover:border-none! border-none! focus:outline-hidden! bg-transparent btn-sm",children:"Clear"})]}),_.jsx("div",{className:"overflow-auto max-h-44 mt-2",style:{scrollbarWidth:"thin"},children:l.map((p,m)=>_.jsxs("div",{className:"flex mt-2",children:[_.jsx("input",{type:"checkbox",onClick:()=>h(p),readOnly:!0,checked:!o.includes(p),className:"mr-2 "}),_.jsx("p",{className:"text-xs",children:(p==null?void 0:p.toString())||_.jsx("span",{className:"italic",children:"(Blanks)"})})]},`filter-item-${p}-${m}`))}),_.jsxs("div",{className:"flex float-end mt-2",children:[_.jsx(st,{onClick:()=>{g(),e.onShowOrHide(!1)},text:"OK",iconColor:"#6161bb",small:!0}),_.jsx(st,{className:"ml-1",onClick:()=>e.onShowOrHide(!1),text:"Cancel",iconColor:"#6161bb",small:!0})]})]})}function Ql(e){const[t,n]=f.useState(e.numberCondition.value1),[r,i]=f.useState(e.numberCondition.value2??0),s=f.useCallback((a,l)=>{e.updateCondition({id:e.numberCondition.id,operator:e.numberCondition.operator,value1:a==="value1"?l:e.numberCondition.value1,value2:a==="value2"?l:e.numberCondition.value2})},[e.numberCondition.id,e.numberCondition.operator]),o=(a,l)=>{a==null||a.preventDefault(),a==null||a.stopPropagation(),e.deleteCondition&&e.deleteCondition(l)};return _.jsxs("div",{className:"flex items-center gap-1 group",children:[_.jsxs("select",{value:e.numberCondition.operator,onChange:a=>e.updateCondition({id:e.numberCondition.id,operator:a.target.value,value1:e.numberCondition.value1,value2:e.numberCondition.value2}),className:" select select-xs px-1 grow",children:[_.jsx("option",{value:"=",children:"Equal"}),_.jsx("option",{value:">",children:"Greater than"}),_.jsx("option",{value:"<",children:"Less than"}),_.jsx("option",{value:">=",children:">="}),_.jsx("option",{value:"<=",children:"<="}),_.jsx("option",{value:"between",children:"Between"})]}),_.jsx("input",{type:"number",value:t,onChange:a=>{n(parseFloat(a.target.value)||0),e.immediatApply&&s("value1",parseFloat(a.target.value)||0)},onBlur:a=>s("value1",parseFloat(a.target.value)||0),className:"input input-xs w-12",step:"any"}),e.numberCondition.operator==="between"&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"text-xs font-semibold",children:"-"}),_.jsx("input",{type:"number",value:r,onChange:a=>{i(parseFloat(a.target.value)),e.immediatApply&&s("value2",parseFloat(a.target.value))},onBlur:a=>s("value2",parseFloat(a.target.value)),className:"input input-xs w-12",step:"any"})]}),e.isNew?_.jsx(_.Fragment,{}):_.jsx("button",{onClick:a=>o(a,e.numberCondition),className:"rounded bg-gray-200 p-0.5 cursor-pointer hover:bg-gray-300",children:_.jsx(ft,{path:zp,color:"#d11f1f",size:.7})})]},e.numberCondition.id)}function hm(e){var p,m;const{setActiveFilter:t}=yn(),n=hi(),r=f.useMemo(()=>n.find(b=>b.headerId===e.headerId),[n,e.headerId]),[i,s]=f.useState([]);f.useEffect(()=>{r!=null&&r.numberConditions&&s(r==null?void 0:r.numberConditions)},[r]),f.useEffect(()=>{c()},[i]);const[o,a]=f.useState({id:Date.now().toString()+Math.random().toString(36).substring(2),operator:"=",value1:0}),l=f.useMemo(()=>e.items.map(b=>typeof b=="string"?parseFloat(b):b).filter(b=>!isNaN(b)),[e.items]),c=f.useCallback(()=>{const b=e.items.filter((v,y)=>{const S=l[y];return typeof S!="number"?!0:i.some(w=>{switch(w.operator){case"=":return S!==w.value1;case">":return S<=w.value1;case"<":return S>=w.value1;case">=":return S<w.value1;case"<=":return S>w.value1;case"between":return w.value2===void 0?!0:S<w.value1||S>w.value2}})});e.items.length>0&&e.items[0],t(e.headerId,b,i)},[e.items,e.headerId,i,l,t]),u=b=>{b==null||b.preventDefault(),b==null||b.stopPropagation(),s(v=>[...v,o]),a({id:Date.now().toString(),operator:"=",value1:0})},d=(b,v)=>{s(y=>y.map(S=>S.id===b?{...S,...v}:S))},h=b=>{const v=i.filter(y=>y.id!==b);s(v)},g=()=>{s([]),t(e.headerId,[],[])};return _.jsxs("form",{onSubmit:u,className:"space-y-4",children:[_.jsxs("div",{className:"bg-blue-50/70 p-2 rounded-md",children:[_.jsx(Ql,{numberCondition:o,updateCondition:b=>a(b),isNew:!0,immediatApply:!0}),_.jsx("div",{className:"flex items-center gap-2 mt-2",children:_.jsx(st,{text:"Add Condition",type:"button",onClick:u,small:!0,className:"rounded-lg p-2 py-0",icon:qp,iconColor:"var(--comment-color)",iconSize:.7})})]}),_.jsx("div",{className:"mt-4",children:(p=r==null?void 0:r.numberConditions)==null?void 0:p.map((b,v)=>_.jsx("div",{className:"mb-1",children:_.jsx(Ql,{numberCondition:b,updateCondition:y=>d(y.id,y),deleteCondition:()=>h(b.id),isNew:!1})},"condition-"+v))}),_.jsx("div",{className:"flex justify-end gap-2 mt-8",children:_.jsx(st,{text:"Clear filter",disabled:!(r!=null&&r.numberConditions)||((m=r==null?void 0:r.numberConditions)==null?void 0:m.length)===0,onClick:g,small:!0})})]})}function fm(e){const[t,n]=f.useState(!1),r=f.useRef(null);f.useEffect(()=>{var c,u;if(e.show&&r.current){const d=r.current.getBoundingClientRect(),h=(u=(c=e.tableRef)==null?void 0:c.current)==null?void 0:u.getBoundingClientRect(),g=(h==null?void 0:h.width)??0,p=d.width+d.x>g;n(p)}else n(!1)},[e.show]),Qp([e.wrapperRef,r],()=>{e.show&&e.onShowOrHide(!1)});const[i,s]=f.useState();f.useEffect(()=>{if(e.show&&e.filterButtonRef.current){const c=e.filterButtonRef.current.getBoundingClientRect();s({top:c.bottom+window.scrollY,left:c.left+window.scrollX})}},[e.show]);const a=(c=>{switch(c){case Lt.NUMBER:return hm;case Lt.STRING:default:return dm}})(e.filterType),l=e.show&&i?hn.createPortal(_.jsx("div",{ref:r,className:`fixed mt-1 bg-white shadow p-3 w-60 z-300 rounded-md font-normal border border-gray-300 ${t?"right-0":""}`,style:{top:`${i.top}px`,left:`${i.left}px`},children:_.jsx(a,{headerId:e.headerId,filterType:e.filterType,items:e.items,onShowOrHide:e.onShowOrHide})}),document.body):null;return _.jsx("div",{children:e.show?l:""})}function gm(e){const t=f.useRef(null),n=f.useRef(null);return _.jsxs("div",{ref:t,className:"relative",children:[_.jsx("button",{ref:n,onClick:()=>e.onShowOrHide(!e.show),className:`border-solid border hover:!border-primary cursor-pointer border-gray-300 rounded focus:outline-hidden! ${e.currentFilter?"bg-purple-800":"bg-white"} `,children:_.jsx(ft,{path:Vp,color:e.currentFilter?"white":"grey",size:.6})}),_.jsx(fm,{...e,filterButtonRef:n,wrapperRef:t})]})}const $h=rn(e=>({contextMenu:void 0,actions:{setContextMenu:t=>e({contextMenu:t})}})),pm=()=>$h(e=>e.contextMenu),ma=()=>$h(e=>e.actions),Ir={LIST:"list",NUMBER:"number"},Le=rn(e=>({selectedHeaderIds:[],selectedCell:void 0,expandedSelection:[],actions:{setSelectedHeaderIds:t=>e({selectedHeaderIds:t}),setSelectedCell:t=>e({selectedCell:t}),setExpandedSelection:t=>e({expandedSelection:t}),clearSelection:()=>e({selectedCell:void 0,expandedSelection:[]})}})),Ph=()=>Le(e=>e.selectedHeaderIds),Ms=()=>Le(e=>e.expandedSelection),Lh=()=>Le(e=>e.actions),Jt=(e,t,n)=>`cell-${e}-${t}${n?`-fromArray-${n.index}`:""}`,mm=(e,t,n,r,i,s,o)=>{e.stopPropagation();let a=t,l=[...n];if(e.key==="Tab"){let c=(t==null?void 0:t.rowIndex)??0,u=(t==null?void 0:t.columnIndex)??0;if(n.length>1){const d=[...n].sort((m,b)=>m.rowIndex!==b.rowIndex?m.rowIndex-b.rowIndex:m.columnIndex-b.columnIndex),h=d.findIndex(m=>{var b,v;return m.rowIndex===(t==null?void 0:t.rowIndex)&&m.columnIndex===(t==null?void 0:t.columnIndex)&&((b=m.fromArrayData)==null?void 0:b.index)===((v=t==null?void 0:t.fromArrayData)==null?void 0:v.index)});let g;e.shiftKey?(g=h-1,g<0&&(g=d.length-1)):(g=h+1,g>=d.length&&(g=0)),a=d[g]}else{const d=bm(e,s,t,o);if(d)return{newSelectedCell:d,newExpandedSelection:[]};u=((t==null?void 0:t.columnIndex)??0)+(e.shiftKey?-1:1),u>=r?(u=0,c++):u<0&&(u=r-1,c--),c>=i&&(c=0),c<0&&(c=i-1),l=[],a={rowIndex:c,columnIndex:u}}}return{newSelectedCell:a,newExpandedSelection:l}},bm=(e,t,n,r)=>{const i=n==null?void 0:n.fromArrayData;if(!i||!r)return;const s=r[i.fromArray];if(!((s==null?void 0:s.length)??0))return;let a=document.getElementById(Jt(n.rowIndex,n.columnIndex+(e.shiftKey?-1:1),{index:i.index}));if(a)return{rowIndex:n.rowIndex,columnIndex:n.columnIndex+(e.shiftKey?-1:1),fromArrayData:{fromArray:n.fromArrayData.fromArray,index:i.index}};if(r&&r[n.fromArrayData.fromArray].length>0){const l=t.findIndex(u=>u.fromArray===n.fromArrayData.fromArray);let c;if(t.forEach(u=>{u.fromArray===n.fromArrayData.fromArray&&(c=t.indexOf(u))}),e.shiftKey){if(a=document.getElementById(Jt(n.rowIndex,c,{index:n.fromArrayData.index-1})),a)return{rowIndex:n.rowIndex,columnIndex:c,fromArrayData:{fromArray:n.fromArrayData.fromArray,index:n.fromArrayData.index-1}}}else if(a=document.getElementById(Jt(n.rowIndex,l,{index:n.fromArrayData.index+1})),a)return{rowIndex:n.rowIndex,columnIndex:l,fromArrayData:{fromArray:n.fromArrayData.fromArray,index:n.fromArrayData.index+1}}}},$n=rn(e=>({dragStartCell:void 0,isDragging:!1,actions:{setDragStartCell:t=>e({dragStartCell:t}),setIsDragging:t=>e({isDragging:t})}})),vm=()=>$n(e=>e.isDragging),xm=(e,t,n,r,i)=>{const s=t.filter(a=>{var l,c;return e.rowIndex===a.rowIndex&&((l=e.fromArrayData)==null?void 0:l.index)===((c=a.fromArrayData)==null?void 0:c.index)});return s.length>0?s.map(a=>{const l=n[a.columnIndex];let c;return a.fromArrayData?c=r[l.fromArray][a.fromArrayData.index][l.id]:c=r[l.id],{value:c,headerId:l.id}}):[{value:i,headerId:n[e.columnIndex].id}]},ym=(e,t)=>e.map(n=>t[n.columnIndex]),wm=(e,t,n,r)=>{var s,o,a,l,c;const i=r.find(u=>u.id===t);return!(!i||((s=i.editOptions)==null?void 0:s.type)!==((o=n.editOptions)==null?void 0:o.type)||((a=n.editOptions)==null?void 0:a.type)==="list"&&!((c=(l=n.editOptions)==null?void 0:l.options)==null?void 0:c.includes(e)))},_m=(e,t)=>{const n=e.getBoundingClientRect(),r=Math.max(0,Math.min(t.right,n.right)-Math.max(t.left,n.left)),i=Math.max(0,Math.min(t.bottom,n.bottom)-Math.max(t.top,n.top)),s=n.width*n.height;return r*i>=s*.3},ba=rn(e=>({clipboardData:[],actions:{setClipboardData:t=>e(()=>({clipboardData:t}))}})),Sm=()=>ba(e=>e.clipboardData),Cm=()=>ba(e=>e.actions),ao=(e,t)=>{var n,r;return e.rowIndex===(t==null?void 0:t.rowIndex)&&e.columnIndex===(t==null?void 0:t.columnIndex)&&((n=e.fromArrayData)==null?void 0:n.index)===((r=t==null?void 0:t.fromArrayData)==null?void 0:r.index)},ec=e=>{var t;return`${e.rowIndex}:${e.columnIndex}:${((t=e.fromArrayData)==null?void 0:t.index)??""}`},Em=(e,t)=>{const n=new Set(e.map(ec)),r=[...e];for(const i of t){const s=ec(i);n.has(s)||(n.add(s),r.push(i))}return r};function Am({items:e,groupedItemsEntries:t,onChange:n,onBulkChange:r,onBulkFieldChange:i,onRowDoubleClick:s,onSaveComment:o,onDeleteComment:a,onSetHighlightCondition:l,onRemoveHighlightCondition:c,onAddListOption:u}){const d=Ms(),{setSelectedCell:h,setExpandedSelection:g,setSelectedHeaderIds:p}=Lh(),m=Ph(),b=ui(),v=Ah(),{setDragStartCell:y,setIsDragging:S}=$n(D=>D.actions),w=f.useCallback(D=>{if(D)if(t){const O=t.flatMap(([B,k])=>k.filter(K=>K.rowIndex===D.rowIndex))[0];if(O)return O.item}else return e[D.rowIndex]},[t,e]),x=f.useCallback(D=>{const O=[];return D.forEach(B=>{const k=w(B);k&&O.push(k)}),O},[w]),C=f.useCallback((D,O,B,k)=>{const K=e.findIndex(ie=>ie===O);let ne;if(k){const ie=O[B.fromArray];ie[k.index]={...ie[k.index],[B.id]:D},ne={...O,[B.fromArray]:ie}}else ne={...O,[B.id]:D};return{itemUpdated:ne,originalIndex:K}},[e]),A=f.useCallback(async(D,O,B,k)=>{var ie;const{itemUpdated:K,originalIndex:ne}=C(D,O,B,k.fromArrayData);if(n){const he=(ie=k.fromArrayData)==null?void 0:ie.index;(he===void 0?O[B.id]!==D:O[B.fromArray][he]!==D)&&await n(K,ne,he?{fromArrayIndex:he,headerId:B.id}:void 0)}},[n,C]),M=f.useCallback((D,O)=>{O.preventDefault();const k=Le.getState().expandedSelection.some(K=>{var ne,ie,he,oe;return K.rowIndex===D.rowIndex&&K.columnIndex===D.columnIndex&&((ne=K.fromArrayData)==null?void 0:ne.index)===((ie=D.fromArrayData)==null?void 0:ie.index)&&((he=K.fromArrayData)==null?void 0:he.fromArray)===((oe=D.fromArrayData)==null?void 0:oe.fromArray)});h(D),k||g([])},[]),R=f.useCallback(async(D,O,B,k)=>{var he;const K=Le.getState().selectedCell,ne=Le.getState().expandedSelection;let ie=[...ne];if(K&&!ne.some(oe=>oe.rowIndex===K.rowIndex&&oe.columnIndex===K.columnIndex)&&(ie=[...ne,K]),(ne==null?void 0:ne.length)>1){const oe=ie.map(ye=>{const ce=w(ye);return ce?{itemUpdated:{...ce,[B.id]:D},originalIndex:e.findIndex(we=>we===ce)}:null}).filter(Boolean);r&&oe.length>0&&await r(oe,B.id)}else{const{itemUpdated:oe,originalIndex:ye}=C(D,O,B,k.fromArrayData);if(n){const ce=(he=k.fromArrayData)==null?void 0:he.index;(ce===void 0?O[B.id]!==D:O[B.fromArray][ce]!==D)&&(console.log("onCellEnter calling onChange",ce),await n(oe,ye,ce!==void 0?{fromArrayIndex:ce,headerId:B.id}:void 0))}}},[w,e,i,n,C]),$=f.useCallback(D=>{var B,k;const O=Le.getState().selectedCell;((O==null?void 0:O.rowIndex)!==D.rowIndex||(O==null?void 0:O.columnIndex)!==D.columnIndex||((B=O==null?void 0:O.fromArrayData)==null?void 0:B.index)!==((k=D.fromArrayData)==null?void 0:k.index))&&(h(D),g([]),p([]))},[]),I=f.useCallback((D,O)=>{m.includes(O)||j(D,O)},[m]),j=f.useCallback((D,O)=>{console.log("Header clicked:",O);const B=[];if(e.forEach((K,ne)=>{const ie=b.findIndex(he=>he.id===O);ie>=0&&B.push({rowIndex:ne,columnIndex:ie})}),D.ctrlKey||D.metaKey){console.log("Ctrl or Cmd pressed, adding to selection");const K=[...m];K.includes(O)||K.push(O),console.log("New selected header ids:",K),p(K);const ne=Em(d,B);g(ne)}else p([O]),h(void 0),g(B)},[e,d,b,m]),q=f.useCallback(D=>{const O=Le.getState().selectedCell,B=Le.getState().expandedSelection,k=O?{...O}:void 0,K=O?w(O):void 0,{newSelectedCell:ne,newExpandedSelection:ie}=mm(D,O,B,b.length,e.length,b,K);k&&ao(k,ne)||(h(ne),g(ie),p([]),Z(ne))},[v.length,e.length,e]),Z=D=>{if(D){const O=document.getElementById(Jt(D.rowIndex,D.columnIndex,D.fromArrayData));O&&O.focus()}},W=f.useCallback(async D=>{s&&await s(D)},[s]),X=f.useRef(!1),F=f.useCallback((D,O)=>{const B=Le.getState().selectedCell;if(D.ctrlKey||D.metaKey)if(!B)h(O),g([O]);else{const K=[...Le.getState().expandedSelection];K.findIndex(ne=>ao(ne,O))===-1&&K.push(O),g(K),h(O)}else ao(O,B)||(h(O),p([]),g([O]));X.current=!0,y(O)},[]),re=f.useCallback((D,O)=>{D.stopPropagation();const B=$n.getState().dragStartCell;if(!$n.getState().isDragging||!B)return;const K=[],ne=document.getElementById(Jt(B.rowIndex,B.columnIndex,B.fromArrayData)),ie=D.currentTarget;if(!ne||!ie)return;const he=ne.getBoundingClientRect(),oe=ie.getBoundingClientRect(),ye=Math.min(he.left,oe.left),ce=Math.min(he.top,oe.top),we=Math.max(he.right,oe.right),_e=Math.max(he.bottom,oe.bottom),We=ie.closest("table");if(!We)return;const Tt=We.getElementsByTagName("td"),Bt=new Set;Array.from(Tt).forEach(vt=>{if(_m(vt,{left:ye,right:we,top:ce,bottom:_e})){const z=parseInt(vt.getAttribute("data-row-index")||"-1"),te=parseInt(vt.getAttribute("data-col-index")||"-1"),le=vt.getAttribute("data-from-array"),fe=vt.getAttribute("data-array-index");if(z>=0&&te>=0){const De=le&&fe!==null?`${z}-${te}-${le}-${fe}`:`${z}-${te}`;if(Bt.has(De))return;Bt.add(De);const Fe={rowIndex:z,columnIndex:te};le&&fe!==null&&(Fe.fromArrayData={fromArray:le,index:parseInt(fe)}),K.push(Fe)}}}),g(K)},[e,b]),J=f.useCallback(D=>{D.preventDefault();const O=Le.getState().selectedCell,B=$n.getState().dragStartCell,k=$n.getState().isDragging;X.current&&!k&&S(!0),k&&B!==O&&(h(B),p([]))},[]),E=f.useCallback(()=>{X.current=!1,S(!1)},[]),T=f.useCallback(async()=>{var ye;const D=ba.getState().clipboardData,O=Le.getState().selectedCell,B=Le.getState().expandedSelection,k=Pe.getState().processedLeafHeaders;if(!n||!O||D.length===0)return;const K=w(O);if(!K)return;const ne=e.findIndex(ce=>ce===K),ie=(ye=O.fromArrayData)==null?void 0:ye.index,he=k[O.columnIndex],oe={...K};if(D.length===1){const{value:ce,headerId:we}=D[0],_e=k[O.columnIndex];wm(ce,we,_e,k)&&(L(oe,_e,ce,ie?{index:ie}:void 0),await n(oe,ne,ie!==void 0?{fromArrayIndex:ie,headerId:_e.id}:void 0))}else{const ce=ym(B,k);let we=!1;D.forEach(_e=>{const We=ce.find(Tt=>Tt.id===_e.headerId);We&&(L(oe,We,_e.value,ie?{index:ie}:void 0),we=!0)}),we&&await n(oe,ne,ie!==void 0?{fromArrayIndex:ie,headerId:he.id}:void 0)}},[e]),P=f.useCallback(async()=>{var ie,he;const D=Le.getState().selectedCell,O=Le.getState().expandedSelection,B=Pe.getState().processedLeafHeaders,k=void 0;if(!n||!D)return;if(O.length===0){const oe=w(D);if(!oe)return;const ye={...oe},ce=B[D.columnIndex];L(ye,ce,k,D.fromArrayData?{index:(ie=D.fromArrayData)==null?void 0:ie.index,headerId:ce.id}:void 0),await n(ye,e.findIndex(we=>we===oe),D.fromArrayData?{fromArrayIndex:(he=D.fromArrayData)==null?void 0:he.index,headerId:ce.id}:void 0);return}const K=new Map;console.log("expandedSelection",O),O.forEach(oe=>{const ye=w(oe);if(!ye)return;const ce=B[oe.columnIndex],we=e.findIndex(_e=>_e===ye);K.has(ye)||K.set(ye,{headers:new Set,itemIndex:we}),oe.fromArrayData?(K.get(ye).fromArray||(K.get(ye).fromArray=[]),K.get(ye).fromArray.push({index:oe.fromArrayData.index,headerId:ce.id})):K.get(ye).headers.add(ce)});const ne=[];K.forEach((oe,ye)=>{var we;const ce={...ye};oe.headers.forEach(_e=>{L(ce,_e,k)}),(we=oe.fromArray)==null||we.forEach(_e=>{L(ce,B.find(We=>We.id===_e.headerId),k,{index:_e.index,headerId:_e.headerId})}),ne.push({itemUpdated:ce,originalIndex:oe.itemIndex,fromArrayItemsAffected:oe.fromArray?oe.fromArray.map(_e=>({fromArrayIndex:_e.index,headerId:_e.headerId})):[]})}),await(r==null?void 0:r(ne))},[e]),L=(D,O,B,k)=>{k!==void 0?k.headerId?D[O.fromArray][k.index][k.headerId]=B:D[O.fromArray][k.index]=B:D[O.id]=B},N=f.useCallback(async(D,O)=>{a&&await a(D,O)},[o,e]),U=f.useCallback(async(D,O)=>{o&&await o(D,O)},[o,e]);return f.useEffect(()=>(window.addEventListener("mouseup",E),()=>{window.removeEventListener("mouseup",E)}),[E]),{setExpandedSelection:g,onHeaderClick:j,onHeaderRightClick:I,onCellBlur:A,onCellEnter:R,onCellClick:$,handleCellKeyDown:q,handleRowDoubleClick:W,resetDefaultValueForSelectedCells:P,saveCommentHandler:U,deleteCommentHandler:N,setHighlightCondition:async(D,O,B)=>{const k={propertyId:O,value:D[O],columnId:O,style:B};await(l==null?void 0:l(k,D))},removeHighlightCondition:(D,O,B)=>{const k={propertyId:O,value:D[O],columnId:O,style:{}};c==null||c(k,B,D)},onCellMouseDown:F,onCellMouseEnter:re,onMouseMove:J,pasteClipboardData:T,onRightClick:M,addListOption:async(D,O)=>{u&&await u(D,O)},getItemFromCellCoordinates:w,getItemsFromCellCoordinates:x}}const Mm=({items:e,onRowsReordered:t,groupBy:n})=>{const[r,i]=f.useState(null),[s,o]=f.useState(null),[a,l]=f.useState(null),[c,u]=f.useState(!1),d=f.useCallback(()=>{console.log(e),i(null),l(null),u(!1),o(null)},[]),h=f.useCallback((m,b)=>{i(m),u(!0),o(b)},[]),g=f.useCallback(m=>{if(r!==null&&a!==null&&r!==a){if(n&&m[n]!==(s==null?void 0:s[n])){console.warn("Cannot reorder items across different groups");return}t==null||t(r,a,s,m)}i(null),l(null),u(!1),o(null)},[r,a,t]),p=f.useCallback(m=>{r!==null&&r!==m&&l(m)},[r]);return{draggedRowIndex:r,dropTargetIndex:a,isDraggingRow:c,handleRowDragStart:h,handleDrop:g,handleDragEnd:d,handleRowDragOver:p}},jh=f.createContext(void 0),Om=({children:e,groupedItemsEntries:t,onChange:n,onBulkChange:r,onBulkFieldChange:i,onRowDoubleClick:s,onRowsReordered:o,onSaveComment:a,onDeleteComment:l,onSetHighlightCondition:c,onRemoveHighlightCondition:u,onAddListOption:d})=>{const h=di(),g=Oh(),p=As(),m=Am({items:g,groupedItemsEntries:t,onChange:n,onBulkFieldChange:i,onBulkChange:r,onRowDoubleClick:s,onAddListOption:d,onSaveComment:a,onDeleteComment:l,onSetHighlightCondition:c,onRemoveHighlightCondition:u}),b=Mm({items:h,onRowsReordered:o,groupBy:p}),v=f.useMemo(()=>({...m,...b}),[m,b]);return _.jsx(jh.Provider,{value:v,children:e})};function wn(){const e=f.useContext(jh);if(e===void 0)throw new Error("useTableInteractionContext must be used within a TableInteractionProvider");return e}const Tm=f.memo(e=>{var v;const t=Rh(),n=hi(),r=Th(),i=xn(),s=pa(),{setContextMenu:o}=ma(),{setActiveFilter:a,onResetSort:l,onSortByColumn:c}=yn(),{onHeaderClick:u,onHeaderRightClick:d}=wn(),h=Ph(),g=f.useMemo(()=>h.includes(e.header.id),[h,e.header.id]),p=y=>r[y]??[],m=y=>{if(n)return n.find(S=>S.headerId===y)},b=(y,S)=>{var A;if((A=y.editOptions)!=null&&A.type)switch(y.editOptions.type){case Ir.NUMBER:return Lt.NUMBER;default:return Lt.STRING}const w=[];let x=0;for(;w.length<10&&x<S.length;){const M=S[x];M!=null&&w.push(M),x++}return w.length===0?Lt.STRING:w.every(M=>typeof M=="number"?!0:typeof M=="string"?!isNaN(Number(M))&&M.trim()!=="":!1)?Lt.NUMBER:Lt.STRING};return _.jsx("th",{id:e.header.id,colSpan:e.colSpan,rowSpan:e.rowSpan,className:`${i!=null&&i.noBorder?"":"border-solid border-b border-r border-gray-300! bg-gray-50"} ${g?"!bg-blue-200 !outline-1 !outline-blue-500 -outline-offset-1":""} `,style:{...e.style},onClick:y=>{u(y,e.header.id)},onMouseEnter:()=>{},onContextMenu:y=>{y.preventDefault(),d(y,e.header.id),o({x:y.clientX,y:y.clientY,header:e.header})},children:_.jsxs("div",{style:{width:e.header.width?`${e.header.width}px`:"auto"},className:"flex justify-between",children:[_.jsxs("div",{className:"flex",children:[e.header.customHeader?e.header.customHeader(e.header):_.jsx("button",{onClick:()=>c==null?void 0:c(e.header),className:`font-semibold bg-transparent text-left text-slate-600 text-xs border-none outline-hidden! whitespace-pre ${e.header.sortable?"cursor-pointer hover:underline":"cursor-default"}`,children:e.header.text}),t===e.header.id&&_.jsxs(_.Fragment,{children:[_.jsx(ft,{path:s?jp:Lp,color:"grey",size:.6}),_.jsx("button",{onClick:l,className:`border-solid border bg-slate-300 hover:bg-slate-400! hover:border-transparent cursor-pointer rounded-lg h-min focus:outline-hidden!
41
+ Valid keys: `+JSON.stringify(Object.keys(E),null," "));var k=B(G,O,N,U,H+"."+O,n);if(k)return k}return null}return b(T)}function Z(E){switch(typeof E){case"number":case"string":case"undefined":return!0;case"boolean":return!E;case"object":if(Array.isArray(E))return E.every(Z);if(E===null||a(E))return!0;var T=d(E);if(T){var P=T.call(E),L;if(T!==E.entries){for(;!(L=P.next()).done;)if(!Z(L.value))return!1}else for(;!(L=P.next()).done;){var N=L.value;if(N&&!Z(N[1]))return!1}}else return!1;return!0;default:return!1}}function W(E,T){return E==="symbol"?!0:T?T["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&T instanceof Symbol:!1}function X(E){var T=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":W(T,E)?"symbol":T}function F(E){if(typeof E>"u"||E===null)return""+E;var T=X(E);if(T==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return T}function re(E){var T=F(E);switch(T){case"array":case"object":return"an "+T;case"boolean":case"date":case"regexp":return"a "+T;default:return T}}function J(E){return!E.constructor||!E.constructor.name?h:E.constructor.name}return g.checkPropTypes=i,g.resetWarningCache=i.resetWarningCache,g.PropTypes=g,g},io}var so,Yl;function $p(){if(Yl)return so;Yl=1;var e=ga();function t(){}function n(){}return n.resetWarningCache=t,so=function(){function r(o,a,l,c,u,d){if(d!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},so}var ql;function xh(){if(ql)return Mi.exports;if(ql=1,process.env.NODE_ENV!=="production"){var e=bh(),t=!0;Mi.exports=Ip()(e.isElement,t)}else Mi.exports=$p()();return Mi.exports}var Pp=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(r,i,s){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:s})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var o in r)n.d(s,o,(function(a){return r[a]}).bind(null,o));return s},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=2)}([function(e,t){e.exports=xh()},function(e,t){e.exports=f},function(e,t,n){n.r(t);var r=n(1),i=n(0),s=function(){return(s=Object.assign||function(p){for(var m,b=1,v=arguments.length;b<v;b++)for(var y in m=arguments[b])Object.prototype.hasOwnProperty.call(m,y)&&(p[y]=m[y]);return p}).apply(this,arguments)},o=function(p,m){var b={};for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&m.indexOf(v)<0&&(b[v]=p[v]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(v=Object.getOwnPropertySymbols(p);y<v.length;y++)m.indexOf(v[y])<0&&Object.prototype.propertyIsEnumerable.call(p,v[y])&&(b[v[y]]=p[v[y]])}return b},a=0,l=r.forwardRef(function(p,m){var b=p.title,v=b===void 0?null:b,y=p.description,S=y===void 0?null:y,w=p.size,x=w===void 0?null:w,C=p.color,A=C===void 0?"currentColor":C,M=p.horizontal,R=M===void 0?null:M,$=p.vertical,I=$===void 0?null:$,j=p.rotate,q=j===void 0?null:j,Z=p.spin,W=Z===void 0?null:Z,X=p.style,F=X===void 0?{}:X,re=p.children,J=o(p,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var E,T=W!==null&&W,P=r.Children.map(re,function(H){var G=H;T!==!0&&(T=(W===null?G.props.spin:W)===!0);var Y=G.props.size;typeof x=="number"&&typeof G.props.size=="number"&&(Y=G.props.size/x);var D={size:Y,color:A===null?G.props.color:A,horizontal:R===null?G.props.horizontal:R,vertical:I===null?G.props.vertical:I,rotate:q===null?G.props.rotate:q,spin:W===null?G.props.spin:W,inStack:!0};return r.cloneElement(G,D)});x!==null&&(F.width=typeof x=="string"?x:1.5*x+"rem");var L,N="stack_labelledby_"+a,U="stack_describedby_"+a;if(v)E=S?N+" "+U:N;else if(L="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:m,viewBox:"0 0 24 24",style:F,role:L,"aria-labelledby":E},J),v&&r.createElement("title",{id:N},v),S&&r.createElement("desc",{id:U},S),T&&r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),P)});l.displayName="Stack",l.propTypes={size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),children:i.oneOfType([i.arrayOf(i.node),i.node]).isRequired,className:i.string,style:i.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var c=l;n.d(t,"Icon",function(){return g}),n.d(t,"Stack",function(){return c});var u=function(){return(u=Object.assign||function(p){for(var m,b=1,v=arguments.length;b<v;b++)for(var y in m=arguments[b])Object.prototype.hasOwnProperty.call(m,y)&&(p[y]=m[y]);return p}).apply(this,arguments)},d=function(p,m){var b={};for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&m.indexOf(v)<0&&(b[v]=p[v]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(v=Object.getOwnPropertySymbols(p);y<v.length;y++)m.indexOf(v[y])<0&&Object.prototype.propertyIsEnumerable.call(p,v[y])&&(b[v[y]]=p[v[y]])}return b},h=0,g=r.forwardRef(function(p,m){var b=p.path,v=p.id,y=v===void 0?++h:v,S=p.title,w=S===void 0?null:S,x=p.description,C=x===void 0?null:x,A=p.size,M=A===void 0?null:A,R=p.color,$=R===void 0?"currentColor":R,I=p.horizontal,j=I!==void 0&&I,q=p.vertical,Z=q!==void 0&&q,W=p.rotate,X=W===void 0?0:W,F=p.spin,re=F!==void 0&&F,J=p.style,E=J===void 0?{}:J,T=p.inStack,P=T!==void 0&&T,L=d(p,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),N={},U=[];M!==null&&(P?U.push("scale("+M+")"):(E.width=typeof M=="string"?M:1.5*M+"rem",E.height=E.width)),j&&U.push("scaleX(-1)"),Z&&U.push("scaleY(-1)"),X!==0&&U.push("rotate("+X+"deg)"),$!==null&&(N.fill=$);var H=r.createElement("path",u({d:b,style:N},P?L:{})),G=H;U.length>0&&(E.transform=U.join(" "),E.transformOrigin="center",P&&(G=r.createElement("g",{style:E},H,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var Y,D=G,O=re===!0||typeof re!="number"?2:re,B=!P&&(j||Z);if(O<0&&(B=!B),re&&(D=r.createElement("g",{style:{animation:"spin"+(B?"-inverse":"")+" linear "+Math.abs(O)+"s infinite",transformOrigin:"center"}},G,!(j||Z||X!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),P)return D;var k,K="icon_labelledby_"+y,ne="icon_describedby_"+y;if(w)Y=C?K+" "+ne:K;else if(k="presentation",C)throw new Error("title attribute required when description is set");return r.createElement("svg",u({ref:m,viewBox:"0 0 24 24",style:E,role:k,"aria-labelledby":Y},L),w&&r.createElement("title",{id:K},w),C&&r.createElement("desc",{id:ne},C),!P&&re&&(B?r.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),D)});g.displayName="Icon",g.propTypes={path:i.string.isRequired,size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),style:i.object,inStack:i.bool,className:i.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const ft=mh(Pp);var Lp="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",jp="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",Xl="M22,21H2V3H4V19H6V10H10V19H12V6H16V19H18V14H22V21Z",Fp="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",yh="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",wh="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",_h="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",Np="M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z",Hp="M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12L20 6.91Z",Bp="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22H9M11,6V9H8V11H11V14H13V11H16V9H13V6H11Z",zp="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",Sh="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z",Vp="M14,12V19.88C14.04,20.18 13.94,20.5 13.71,20.71C13.32,21.1 12.69,21.1 12.3,20.71L10.29,18.7C10.06,18.47 9.96,18.16 10,17.87V12H9.97L4.21,4.62C3.87,4.19 3.95,3.56 4.38,3.22C4.57,3.08 4.78,3 5,3V3H19V3C19.22,3 19.43,3.08 19.62,3.22C20.05,3.56 20.13,4.19 19.79,4.62L14.03,12H14Z",Wp="M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z",Up="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",Gp="M23 16V15.5A2.5 2.5 0 0 0 18 15.5V16A1 1 0 0 0 17 17V21A1 1 0 0 0 18 22H23A1 1 0 0 0 24 21V17A1 1 0 0 0 23 16M22 16H19V15.5A1.5 1.5 0 0 1 22 15.5M7 8.9H11V7H7A5 5 0 0 0 7 17H11V15.1H7A3.1 3.1 0 0 1 7 8.9M8 11V13H16V11M13 15.1V17H15V15.1M17 7H13V8.9H17A3.09 3.09 0 0 1 19.94 11A5.12 5.12 0 0 1 20.5 11H21.9A5 5 0 0 0 17 7Z",Yp="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",qp="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",Xp="M18 21L14 17H17V7H14L18 3L22 7H19V17H22M2 19V17H12V19M2 13V11H9V13M2 7V5H6V7H2Z",Kp="M4,3H20A2,2 0 0,1 22,5V20A2,2 0 0,1 20,22H4A2,2 0 0,1 2,20V5A2,2 0 0,1 4,3M4,7V10H8V7H4M10,7V10H14V7H10M20,10V7H16V10H20M4,12V15H8V12H4M4,20H8V17H4V20M10,12V15H14V12H10M10,20H14V17H10V20M20,20V17H16V20H20M20,12H16V15H20V12Z",Kl="M12.35 20H10V17H12.09C12.21 16.28 12.46 15.61 12.81 15H10V12H14V13.54C14.58 13 15.25 12.61 16 12.35V12H20V12.35C20.75 12.61 21.42 13 22 13.54V5C22 3.9 21.1 3 20 3H4C2.9 3 2 3.9 2 5V20C2 21.1 2.9 22 4 22H13.54C13 21.42 12.61 20.75 12.35 20M16 7H20V10H16V7M10 7H14V10H10V7M8 20H4V17H8V20M8 15H4V12H8V15M8 10H4V7H8V10M17 14H19V17H22V19H19V22H17V19H14V17H17V14",Zp="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z",Jp="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z";function Qp(e,t){f.useEffect(()=>{function n(r){Array.isArray(e)?e.every(s=>{var o;return!((o=s.current)!=null&&o.contains(r.target))})&&r.target&&t():e.current&&r.target&&!e.current.contains(r.target)&&t()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t])}var Lt=(e=>(e.STRING="string",e.NUMBER="number",e))(Lt||{});function st(e){const t=f.useMemo(()=>e.iconSize?e.iconSize:e.small?.8:1,[e.iconSize,e.small]),n=_.jsxs("button",{type:e.type??"button",id:e.id,className:`btn ${e.className??""} ${e.ghost?" btn-ghost":""} ${e.small?"btn-xs":"btn-sm"} content-center ${e.circle?"btn-circle":""}`,onClick:e.onClick,disabled:e.disabled===!0,children:[e.icon&&_.jsx(ft,{path:e.icon??"",color:e.disabled?e.iconColorDisabled??"lightgrey":e.iconColor,size:t}),e.text&&_.jsx("div",{className:`text-${e.small?"xs":"sm"}`,children:e.text})]});return _.jsx(_.Fragment,{children:e.tooltip?_.jsx("div",{className:`tooltip ${e.tooltipRight?"tooltip-right":"tooltip-top"} tooltip-top before:whitespace-pre-wrap text-left`,"data-tip":`${e.tooltip}`,children:n}):n})}const Zl=e=>{let t;const n=new Set,r=(c,u)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,i,a);return a},em=e=>e?Zl(e):Zl,tm=e=>e;function nm(e,t=tm){const n=f.useSyncExternalStore(e.subscribe,f.useCallback(()=>t(e.getState()),[e,t]),f.useCallback(()=>t(e.getInitialState()),[e,t]));return f.useDebugValue(n),n}const Jl=e=>{const t=em(e),n=r=>nm(t,r);return Object.assign(n,t),n},rn=e=>e?Jl(e):Jl,rm=e=>e.every(t=>typeof t=="number"),Ch=(e,t)=>e<t?-1:e>t?1:0,im=(e,t)=>e>t?-1:e<t?1:0,Eh=" ",sm=(e,t)=>{const n=JSON.parse(JSON.stringify(e));return e.length===0?[]:t.length===0?n:n.filter(r=>{for(const i of t){let s=r[i.headerId],o=!1;if(rm(i.itemsToHide)?(s=typeof s=="string"?s.split(Eh).join(""):s,o=i.itemsToHide.includes(Number(s))):i.itemsToHide.includes(s)&&(o=!0),o)return!1}return!0})},om=(e,t,n,r)=>{const i=[...e];if(!r)return i;const s=t.find(a=>a.id===r);if(s!=null&&s.customSort)return i.sort((a,l)=>s.customSort(a,l,n==="asc")),i;let o=!0;return i.forEach(a=>{var d;const l=(d=a[r])==null?void 0:d.toString();if(!l)return;const c=oo(l),u=["NaN"];isNaN(c)&&!u.includes(l)&&(o=!1)}),o?(i.sort((a,l)=>{const c=oo(a[r]),u=oo(l[r]),d=typeof c=="number"&&!isNaN(c),h=typeof u=="number"&&!isNaN(u);return d&&!h?-1:!d&&h?1:n==="desc"?u-c:c-u}),i):(n==="desc"?i.sort((a,l)=>Ch(l[r],a[r])):i.sort((a,l)=>im(l[r],a[r])),i)},oo=e=>typeof e=="number"?e:typeof e=="string"?Number(e.split(Eh).join("")):e,Pe=rn((e,t)=>({items:[],headers:[],hiddenHeadersId:[],processedHeaders:[],leafHeaders:[],processedLeafHeaders:[],processedItems:[],activeFilters:[],filterItemsCache:{},ascendingOrder:!0,comments:[],highlightConditions:[],advancedSetting:void 0,groupBy:void 0,linkedGroups:void 0,collapsedGroups:[],actions:{setItems:n=>{e({items:n})},setHeaders:n=>{const r=No(n);e({headers:n,leafHeaders:r})},setHiddenHeadersId:n=>{e({hiddenHeadersId:n})},setActiveFilter:(n,r,i)=>{const{activeFilters:s}=t(),o=[...s],a=o.findIndex(l=>l.headerId===n);a!==-1?r.length>0?o[a]={headerId:n,itemsToHide:r,numberConditions:i}:o.splice(a,1):r.length>0&&o.push({headerId:n,itemsToHide:r,numberConditions:i}),e({activeFilters:o})},clearActiveFilters:()=>{e({activeFilters:[]})},onResetSort:()=>{e({currentSortId:void 0,ascendingOrder:!0})},onSortByColumn:n=>{const{currentSortId:r,ascendingOrder:i}=t();if(!(n!=null&&n.sortable))return;let s;r===n.id?s=!i:s=!0,e({currentSortId:n.id,ascendingOrder:s})},processItems:()=>{const{items:n,activeFilters:r,headers:i,currentSortId:s,ascendingOrder:o}=t();let a=[...n];r.length>0&&(a=am(a,r)),s&&(a=lm(a,i,o,s)),e({processedItems:a})},processHeaders:()=>{const{headers:n,hiddenHeadersId:r}=t(),i=new Map,s=(u,d)=>{for(const h of u)d&&i.set(h.id,d),h.children&&h.children.length>0&&s(h.children,h.id)};s(n);const o=u=>{if(r.includes(u))return!0;let d=u;for(;i.has(d);)if(d=i.get(d),r.includes(d))return!0;return!1},a=u=>u.filter(d=>!o(d.id)).map(d=>d.children&&d.children.length>0?{...d,children:a(d.children)}:d),l=a(n),c=No(l);e({processedHeaders:l,processedLeafHeaders:c})},processFilterItemsCache:()=>{const{processedItems:n,activeFilters:r,leafHeaders:i}=t(),s={};i.forEach(o=>{let a=n.map(c=>c[o.id]);const l=r.find(c=>c.headerId===o.id);l&&(a=a.concat(l.itemsToHide)),s[o.id]=[...new Set(a)].filter(c=>typeof c=="string"||typeof c=="number")}),e({filterItemsCache:s})},setGroupBy:n=>{e({groupBy:n})},setLinkedGroups:n=>{e({linkedGroups:n})},collapseGroup:n=>{const{collapsedGroups:r}=t(),s=r.includes(n)?r.filter(o=>o!==n):[...r,n];e({collapsedGroups:s})},setCollapsedGroups:n=>{e({collapsedGroups:n})},setComments:n=>{e({comments:n})},setHighlightConditions:n=>{e({highlightConditions:n})},setAdvancedSettings:n=>{e({advancedSetting:n})}}}));function No(e){return e.flatMap(t=>t.children&&t.children.length>0?No(t.children):[t])}function am(e,t){return sm(e,t)}function lm(e,t,n,r){return om(e,t,n?"asc":"desc",r)}const Ah=()=>Pe(e=>e.headers),Mh=()=>Pe(e=>e.hiddenHeadersId),cm=()=>Pe(e=>e.processedHeaders),ui=()=>Pe(e=>e.processedLeafHeaders),Oh=()=>Pe(e=>e.items),Th=()=>Pe(e=>e.filterItemsCache),di=()=>Pe(e=>e.processedItems),Rh=()=>Pe(e=>e.currentSortId),pa=()=>Pe(e=>e.ascendingOrder),hi=()=>Pe(e=>e.activeFilters),xn=()=>Pe(e=>e.advancedSetting),Dh=()=>Pe(e=>e.comments),kh=()=>Pe(e=>e.highlightConditions),As=()=>Pe(e=>e.groupBy),um=()=>Pe(e=>e.linkedGroups),Ih=()=>Pe(e=>e.collapsedGroups),yn=()=>Pe(e=>e.actions);function dm(e){const{setActiveFilter:t}=yn(),n=hi(),r=f.useMemo(()=>n.find(p=>p.headerId===e.headerId),[n,e.headerId]),[i,s]=f.useState(""),[o,a]=f.useState([]);f.useEffect(()=>{a((r==null?void 0:r.itemsToHide)??[])},[r==null?void 0:r.itemsToHide]);const l=f.useMemo(()=>{let p=[];return i?(p=[...e.items].filter(m=>m==null?void 0:m.toString().toLocaleLowerCase().includes(i==null?void 0:i.toString().toLocaleLowerCase())),e.filterType===Lt.STRING&&(p=p.sort(Ch))):p=[...e.items],p},[i,e.items]),c=p=>{p.preventDefault(),i&&t(e.headerId,[i])},u=()=>{a([...e.items])},d=()=>{a([])},h=p=>{const m=o.findIndex(v=>v===p);let b=[...o];m!==void 0&&(m===-1?b=[...b,p]:b.splice(m,1),a(b))},g=()=>{const p=l.filter(b=>!o.includes(b)),m=[...e.items].filter(b=>!p.includes(b));t(e.headerId,m.map(b=>b))};return _.jsxs("div",{children:[_.jsx("div",{className:"font-semibold text-sm mb-1",children:"Filter by value:"}),_.jsxs("form",{onSubmit:c,children:[_.jsx("input",{type:"text",value:i,onChange:p=>s(p==null?void 0:p.target.value),placeholder:"Search...",className:"input input-bordered input-xs w-full max-w-xs"}),_.jsx("input",{type:"submit",value:""})]}),_.jsxs("div",{className:"flex text-xs mt-1 font-semibold text-primary",children:[_.jsx("button",{onClick:d,onFocus:()=>{},className:"mr-4 cursor-pointer hover:border-none! border-none! focus:outline-hidden! bg-transparent btn-sm",children:"Select All"}),_.jsx("button",{onClick:u,onFocus:()=>{},className:"cursor-pointer hover:border-none! border-none! focus:outline-hidden! bg-transparent btn-sm",children:"Clear"})]}),_.jsx("div",{className:"overflow-auto max-h-44 mt-2",style:{scrollbarWidth:"thin"},children:l.map((p,m)=>_.jsxs("div",{className:"flex mt-2",children:[_.jsx("input",{type:"checkbox",onClick:()=>h(p),readOnly:!0,checked:!o.includes(p),className:"mr-2 "}),_.jsx("p",{className:"text-xs",children:(p==null?void 0:p.toString())||_.jsx("span",{className:"italic",children:"(Blanks)"})})]},`filter-item-${p}-${m}`))}),_.jsxs("div",{className:"flex float-end mt-2",children:[_.jsx(st,{onClick:()=>{g(),e.onShowOrHide(!1)},text:"OK",iconColor:"#6161bb",small:!0}),_.jsx(st,{className:"ml-1",onClick:()=>e.onShowOrHide(!1),text:"Cancel",iconColor:"#6161bb",small:!0})]})]})}function Ql(e){const[t,n]=f.useState(e.numberCondition.value1),[r,i]=f.useState(e.numberCondition.value2??0),s=f.useCallback((a,l)=>{e.updateCondition({id:e.numberCondition.id,operator:e.numberCondition.operator,value1:a==="value1"?l:e.numberCondition.value1,value2:a==="value2"?l:e.numberCondition.value2})},[e.numberCondition.id,e.numberCondition.operator]),o=(a,l)=>{a==null||a.preventDefault(),a==null||a.stopPropagation(),e.deleteCondition&&e.deleteCondition(l)};return _.jsxs("div",{className:"flex items-center gap-1 group",children:[_.jsxs("select",{value:e.numberCondition.operator,onChange:a=>e.updateCondition({id:e.numberCondition.id,operator:a.target.value,value1:e.numberCondition.value1,value2:e.numberCondition.value2}),className:" select select-xs px-1 grow",children:[_.jsx("option",{value:"=",children:"Equal"}),_.jsx("option",{value:">",children:"Greater than"}),_.jsx("option",{value:"<",children:"Less than"}),_.jsx("option",{value:">=",children:">="}),_.jsx("option",{value:"<=",children:"<="}),_.jsx("option",{value:"between",children:"Between"})]}),_.jsx("input",{type:"number",value:t,onChange:a=>{n(parseFloat(a.target.value)||0),e.immediatApply&&s("value1",parseFloat(a.target.value)||0)},onBlur:a=>s("value1",parseFloat(a.target.value)||0),className:"input input-xs w-12",step:"any"}),e.numberCondition.operator==="between"&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"text-xs font-semibold",children:"-"}),_.jsx("input",{type:"number",value:r,onChange:a=>{i(parseFloat(a.target.value)),e.immediatApply&&s("value2",parseFloat(a.target.value))},onBlur:a=>s("value2",parseFloat(a.target.value)),className:"input input-xs w-12",step:"any"})]}),e.isNew?_.jsx(_.Fragment,{}):_.jsx("button",{onClick:a=>o(a,e.numberCondition),className:"rounded bg-gray-200 p-0.5 cursor-pointer hover:bg-gray-300",children:_.jsx(ft,{path:zp,color:"#d11f1f",size:.7})})]},e.numberCondition.id)}function hm(e){var p,m;const{setActiveFilter:t}=yn(),n=hi(),r=f.useMemo(()=>n.find(b=>b.headerId===e.headerId),[n,e.headerId]),[i,s]=f.useState([]);f.useEffect(()=>{r!=null&&r.numberConditions&&s(r==null?void 0:r.numberConditions)},[r]),f.useEffect(()=>{c()},[i]);const[o,a]=f.useState({id:Date.now().toString()+Math.random().toString(36).substring(2),operator:"=",value1:0}),l=f.useMemo(()=>e.items.map(b=>typeof b=="string"?parseFloat(b):b).filter(b=>!isNaN(b)),[e.items]),c=f.useCallback(()=>{const b=e.items.filter((v,y)=>{const S=l[y];return typeof S!="number"?!0:i.some(w=>{switch(w.operator){case"=":return S!==w.value1;case">":return S<=w.value1;case"<":return S>=w.value1;case">=":return S<w.value1;case"<=":return S>w.value1;case"between":return w.value2===void 0?!0:S<w.value1||S>w.value2}})});e.items.length>0&&e.items[0],t(e.headerId,b,i)},[e.items,e.headerId,i,l,t]),u=b=>{b==null||b.preventDefault(),b==null||b.stopPropagation(),s(v=>[...v,o]),a({id:Date.now().toString(),operator:"=",value1:0})},d=(b,v)=>{s(y=>y.map(S=>S.id===b?{...S,...v}:S))},h=b=>{const v=i.filter(y=>y.id!==b);s(v)},g=()=>{s([]),t(e.headerId,[],[])};return _.jsxs("form",{onSubmit:u,className:"space-y-4",children:[_.jsxs("div",{className:"bg-blue-50/70 p-2 rounded-md",children:[_.jsx(Ql,{numberCondition:o,updateCondition:b=>a(b),isNew:!0,immediatApply:!0}),_.jsx("div",{className:"flex items-center gap-2 mt-2",children:_.jsx(st,{text:"Add Condition",type:"button",onClick:u,small:!0,className:"rounded-lg p-2 py-0",icon:qp,iconColor:"var(--comment-color)",iconSize:.7})})]}),_.jsx("div",{className:"mt-4",children:(p=r==null?void 0:r.numberConditions)==null?void 0:p.map((b,v)=>_.jsx("div",{className:"mb-1",children:_.jsx(Ql,{numberCondition:b,updateCondition:y=>d(y.id,y),deleteCondition:()=>h(b.id),isNew:!1})},"condition-"+v))}),_.jsx("div",{className:"flex justify-end gap-2 mt-8",children:_.jsx(st,{text:"Clear filter",disabled:!(r!=null&&r.numberConditions)||((m=r==null?void 0:r.numberConditions)==null?void 0:m.length)===0,onClick:g,small:!0})})]})}function fm(e){const[t,n]=f.useState(!1),r=f.useRef(null);f.useEffect(()=>{var c,u;if(e.show&&r.current){const d=r.current.getBoundingClientRect(),h=(u=(c=e.tableRef)==null?void 0:c.current)==null?void 0:u.getBoundingClientRect(),g=(h==null?void 0:h.width)??0,p=d.width+d.x>g;n(p)}else n(!1)},[e.show]),Qp([e.wrapperRef,r],()=>{e.show&&e.onShowOrHide(!1)});const[i,s]=f.useState();f.useEffect(()=>{if(e.show&&e.filterButtonRef.current){const c=e.filterButtonRef.current.getBoundingClientRect();s({top:c.bottom+window.scrollY,left:c.left+window.scrollX})}},[e.show]);const a=(c=>{switch(c){case Lt.NUMBER:return hm;case Lt.STRING:default:return dm}})(e.filterType),l=e.show&&i?hn.createPortal(_.jsx("div",{ref:r,className:`fixed mt-1 bg-white shadow p-3 w-60 z-300 rounded-md font-normal border border-gray-300 ${t?"right-0":""}`,style:{top:`${i.top}px`,left:`${i.left}px`},children:_.jsx(a,{headerId:e.headerId,filterType:e.filterType,items:e.items,onShowOrHide:e.onShowOrHide})}),document.body):null;return _.jsx("div",{children:e.show?l:""})}function gm(e){const t=f.useRef(null),n=f.useRef(null);return _.jsxs("div",{ref:t,className:"relative",children:[_.jsx("button",{ref:n,onClick:()=>e.onShowOrHide(!e.show),className:`border-solid border hover:!border-primary cursor-pointer border-gray-300 rounded focus:outline-hidden! ${e.currentFilter?"bg-purple-800":"bg-white"} `,children:_.jsx(ft,{path:Vp,color:e.currentFilter?"white":"grey",size:.6})}),_.jsx(fm,{...e,filterButtonRef:n,wrapperRef:t})]})}const $h=rn(e=>({contextMenu:void 0,actions:{setContextMenu:t=>e({contextMenu:t})}})),pm=()=>$h(e=>e.contextMenu),ma=()=>$h(e=>e.actions),Ir={LIST:"list",NUMBER:"number"},Le=rn(e=>({selectedHeaderIds:[],selectedCell:void 0,expandedSelection:[],actions:{setSelectedHeaderIds:t=>e({selectedHeaderIds:t}),setSelectedCell:t=>e({selectedCell:t}),setExpandedSelection:t=>e({expandedSelection:t}),clearSelection:()=>e({selectedCell:void 0,expandedSelection:[]})}})),Ph=()=>Le(e=>e.selectedHeaderIds),Ms=()=>Le(e=>e.expandedSelection),Lh=()=>Le(e=>e.actions),Jt=(e,t,n)=>`cell-${e}-${t}${n?`-fromArray-${n.index}`:""}`,mm=(e,t,n,r,i,s,o)=>{e.stopPropagation();let a=t,l=[...n];if(e.key==="Tab"){let c=(t==null?void 0:t.rowIndex)??0,u=(t==null?void 0:t.columnIndex)??0;if(n.length>1){const d=[...n].sort((m,b)=>m.rowIndex!==b.rowIndex?m.rowIndex-b.rowIndex:m.columnIndex-b.columnIndex),h=d.findIndex(m=>{var b,v;return m.rowIndex===(t==null?void 0:t.rowIndex)&&m.columnIndex===(t==null?void 0:t.columnIndex)&&((b=m.fromArrayData)==null?void 0:b.index)===((v=t==null?void 0:t.fromArrayData)==null?void 0:v.index)});let g;e.shiftKey?(g=h-1,g<0&&(g=d.length-1)):(g=h+1,g>=d.length&&(g=0)),a=d[g]}else{const d=bm(e,s,t,o);if(d)return{newSelectedCell:d,newExpandedSelection:[]};u=((t==null?void 0:t.columnIndex)??0)+(e.shiftKey?-1:1),u>=r?(u=0,c++):u<0&&(u=r-1,c--),c>=i&&(c=0),c<0&&(c=i-1),l=[],a={rowIndex:c,columnIndex:u}}}return{newSelectedCell:a,newExpandedSelection:l}},bm=(e,t,n,r)=>{const i=n==null?void 0:n.fromArrayData;if(!i||!r)return;const s=r[i.fromArray];if(!((s==null?void 0:s.length)??0))return;let a=document.getElementById(Jt(n.rowIndex,n.columnIndex+(e.shiftKey?-1:1),{index:i.index}));if(a)return{rowIndex:n.rowIndex,columnIndex:n.columnIndex+(e.shiftKey?-1:1),fromArrayData:{fromArray:n.fromArrayData.fromArray,index:i.index}};if(r&&r[n.fromArrayData.fromArray].length>0){const l=t.findIndex(u=>u.fromArray===n.fromArrayData.fromArray);let c;if(t.forEach(u=>{u.fromArray===n.fromArrayData.fromArray&&(c=t.indexOf(u))}),e.shiftKey){if(a=document.getElementById(Jt(n.rowIndex,c,{index:n.fromArrayData.index-1})),a)return{rowIndex:n.rowIndex,columnIndex:c,fromArrayData:{fromArray:n.fromArrayData.fromArray,index:n.fromArrayData.index-1}}}else if(a=document.getElementById(Jt(n.rowIndex,l,{index:n.fromArrayData.index+1})),a)return{rowIndex:n.rowIndex,columnIndex:l,fromArrayData:{fromArray:n.fromArrayData.fromArray,index:n.fromArrayData.index+1}}}},$n=rn(e=>({dragStartCell:void 0,isDragging:!1,actions:{setDragStartCell:t=>e({dragStartCell:t}),setIsDragging:t=>e({isDragging:t})}})),vm=()=>$n(e=>e.isDragging),xm=(e,t,n,r,i)=>{const s=t.filter(a=>{var l,c;return e.rowIndex===a.rowIndex&&((l=e.fromArrayData)==null?void 0:l.index)===((c=a.fromArrayData)==null?void 0:c.index)});return s.length>0?s.map(a=>{const l=n[a.columnIndex];let c;return a.fromArrayData?c=r[l.fromArray][a.fromArrayData.index][l.id]:c=r[l.id],{value:c,headerId:l.id}}):[{value:i,headerId:n[e.columnIndex].id}]},ym=(e,t)=>e.map(n=>t[n.columnIndex]),wm=(e,t,n,r)=>{var s,o,a,l,c;const i=r.find(u=>u.id===t);return!(!i||((s=i.editOptions)==null?void 0:s.type)!==((o=n.editOptions)==null?void 0:o.type)||((a=n.editOptions)==null?void 0:a.type)==="list"&&!((c=(l=n.editOptions)==null?void 0:l.options)==null?void 0:c.includes(e)))},_m=(e,t)=>{const n=e.getBoundingClientRect(),r=Math.max(0,Math.min(t.right,n.right)-Math.max(t.left,n.left)),i=Math.max(0,Math.min(t.bottom,n.bottom)-Math.max(t.top,n.top)),s=n.width*n.height;return r*i>=s*.3},ba=rn(e=>({clipboardData:[],actions:{setClipboardData:t=>e(()=>({clipboardData:t}))}})),Sm=()=>ba(e=>e.clipboardData),Cm=()=>ba(e=>e.actions),ao=(e,t)=>{var n,r;return e.rowIndex===(t==null?void 0:t.rowIndex)&&e.columnIndex===(t==null?void 0:t.columnIndex)&&((n=e.fromArrayData)==null?void 0:n.index)===((r=t==null?void 0:t.fromArrayData)==null?void 0:r.index)},ec=e=>{var t;return`${e.rowIndex}:${e.columnIndex}:${((t=e.fromArrayData)==null?void 0:t.index)??""}`},Em=(e,t)=>{const n=new Set(e.map(ec)),r=[...e];for(const i of t){const s=ec(i);n.has(s)||(n.add(s),r.push(i))}return r};function Am({items:e,groupedItemsEntries:t,onChange:n,onBulkChange:r,onBulkFieldChange:i,onRowDoubleClick:s,onSaveComment:o,onDeleteComment:a,onSetHighlightCondition:l,onRemoveHighlightCondition:c,onAddListOption:u}){const d=Ms(),{setSelectedCell:h,setExpandedSelection:g,setSelectedHeaderIds:p}=Lh(),m=Ph(),b=ui(),v=Ah(),{setDragStartCell:y,setIsDragging:S}=$n(D=>D.actions),w=f.useCallback(D=>{if(D)if(t){const O=t.flatMap(([B,k])=>k.filter(K=>K.rowIndex===D.rowIndex))[0];if(O)return O.item}else return e[D.rowIndex]},[t,e]),x=f.useCallback(D=>{const O=[];return D.forEach(B=>{const k=w(B);k&&O.push(k)}),O},[w]),C=f.useCallback((D,O,B,k)=>{const K=e.findIndex(ie=>ie===O);let ne;if(k){const ie=O[B.fromArray];ie[k.index]={...ie[k.index],[B.id]:D},ne={...O,[B.fromArray]:ie}}else ne={...O,[B.id]:D};return{itemUpdated:ne,originalIndex:K}},[e]),A=f.useCallback(async(D,O,B,k)=>{var ie;const{itemUpdated:K,originalIndex:ne}=C(D,O,B,k.fromArrayData);if(n){const he=(ie=k.fromArrayData)==null?void 0:ie.index;(he===void 0?O[B.id]!==D:O[B.fromArray][he]!==D)&&await n(K,ne,he!==void 0?{fromArrayIndex:he,headerId:B.id}:void 0)}},[n,C]),M=f.useCallback((D,O)=>{O.preventDefault();const k=Le.getState().expandedSelection.some(K=>{var ne,ie,he,oe;return K.rowIndex===D.rowIndex&&K.columnIndex===D.columnIndex&&((ne=K.fromArrayData)==null?void 0:ne.index)===((ie=D.fromArrayData)==null?void 0:ie.index)&&((he=K.fromArrayData)==null?void 0:he.fromArray)===((oe=D.fromArrayData)==null?void 0:oe.fromArray)});h(D),k||(g([]),p([]))},[]),R=f.useCallback(async(D,O,B,k)=>{var he;const K=Le.getState().selectedCell,ne=Le.getState().expandedSelection;let ie=[...ne];if(K&&!ne.some(oe=>oe.rowIndex===K.rowIndex&&oe.columnIndex===K.columnIndex)&&(ie=[...ne,K]),(ne==null?void 0:ne.length)>1){const oe=ie.map(ye=>{const ce=w(ye);return ce?{itemUpdated:{...ce,[B.id]:D},originalIndex:e.findIndex(we=>we===ce)}:null}).filter(Boolean);r&&oe.length>0&&await r(oe,B.id)}else{const{itemUpdated:oe,originalIndex:ye}=C(D,O,B,k.fromArrayData);if(n){const ce=(he=k.fromArrayData)==null?void 0:he.index;(ce===void 0?O[B.id]!==D:O[B.fromArray][ce]!==D)&&(console.log("onCellEnter calling onChange",ce),await n(oe,ye,ce!==void 0?{fromArrayIndex:ce,headerId:B.id}:void 0))}}},[w,e,i,n,C]),$=f.useCallback(D=>{var B,k;const O=Le.getState().selectedCell;((O==null?void 0:O.rowIndex)!==D.rowIndex||(O==null?void 0:O.columnIndex)!==D.columnIndex||((B=O==null?void 0:O.fromArrayData)==null?void 0:B.index)!==((k=D.fromArrayData)==null?void 0:k.index))&&(h(D),g([]),p([]))},[]),I=f.useCallback((D,O)=>{m.includes(O)||j(D,O)},[m]),j=f.useCallback((D,O)=>{console.log("Header clicked:",O);const B=[];if(e.forEach((K,ne)=>{const ie=b.findIndex(he=>he.id===O);ie>=0&&B.push({rowIndex:ne,columnIndex:ie})}),D.ctrlKey||D.metaKey){console.log("Ctrl or Cmd pressed, adding to selection");const K=[...m];K.includes(O)||K.push(O),console.log("New selected header ids:",K),p(K);const ne=Em(d,B);g(ne)}else p([O]),h(void 0),g(B)},[e,d,b,m]),q=f.useCallback(D=>{const O=Le.getState().selectedCell,B=Le.getState().expandedSelection,k=O?{...O}:void 0,K=O?w(O):void 0,{newSelectedCell:ne,newExpandedSelection:ie}=mm(D,O,B,b.length,e.length,b,K);k&&ao(k,ne)||(h(ne),B.length!==ie.length&&p([]),g(ie),Z(ne))},[v.length,e.length,e]),Z=D=>{if(D){const O=document.getElementById(Jt(D.rowIndex,D.columnIndex,D.fromArrayData));O&&O.focus()}},W=f.useCallback(async D=>{s&&await s(D)},[s]),X=f.useRef(!1),F=f.useCallback((D,O)=>{const B=Le.getState().selectedCell;if(D.ctrlKey||D.metaKey)if(!B)h(O),g([O]);else{const K=[...Le.getState().expandedSelection];K.findIndex(ne=>ao(ne,O))===-1&&K.push(O),g(K),h(O)}else ao(O,B)||(h(O),p([]),g([O]));X.current=!0,y(O)},[]),re=f.useCallback((D,O)=>{D.stopPropagation();const B=$n.getState().dragStartCell;if(!$n.getState().isDragging||!B)return;const K=[],ne=document.getElementById(Jt(B.rowIndex,B.columnIndex,B.fromArrayData)),ie=D.currentTarget;if(!ne||!ie)return;const he=ne.getBoundingClientRect(),oe=ie.getBoundingClientRect(),ye=Math.min(he.left,oe.left),ce=Math.min(he.top,oe.top),we=Math.max(he.right,oe.right),_e=Math.max(he.bottom,oe.bottom),We=ie.closest("table");if(!We)return;const Tt=We.getElementsByTagName("td"),Bt=new Set;Array.from(Tt).forEach(vt=>{if(_m(vt,{left:ye,right:we,top:ce,bottom:_e})){const z=parseInt(vt.getAttribute("data-row-index")||"-1"),te=parseInt(vt.getAttribute("data-col-index")||"-1"),le=vt.getAttribute("data-from-array"),fe=vt.getAttribute("data-array-index");if(z>=0&&te>=0){const De=le&&fe!==null?`${z}-${te}-${le}-${fe}`:`${z}-${te}`;if(Bt.has(De))return;Bt.add(De);const Fe={rowIndex:z,columnIndex:te};le&&fe!==null&&(Fe.fromArrayData={fromArray:le,index:parseInt(fe)}),K.push(Fe)}}}),g(K)},[e,b]),J=f.useCallback(D=>{D.preventDefault();const O=Le.getState().selectedCell,B=$n.getState().dragStartCell,k=$n.getState().isDragging;X.current&&!k&&S(!0),k&&B!==O&&(h(B),p([]))},[]),E=f.useCallback(()=>{X.current=!1,S(!1)},[]),T=f.useCallback(async()=>{var ye;const D=ba.getState().clipboardData,O=Le.getState().selectedCell,B=Le.getState().expandedSelection,k=Pe.getState().processedLeafHeaders;if(!n||!O||D.length===0)return;const K=w(O);if(!K)return;const ne=e.findIndex(ce=>ce===K),ie=(ye=O.fromArrayData)==null?void 0:ye.index,he=k[O.columnIndex],oe={...K};if(D.length===1){const{value:ce,headerId:we}=D[0],_e=k[O.columnIndex];wm(ce,we,_e,k)&&(L(oe,_e,ce,ie?{index:ie}:void 0),await n(oe,ne,ie!==void 0?{fromArrayIndex:ie,headerId:_e.id}:void 0))}else{const ce=ym(B,k);let we=!1;D.forEach(_e=>{const We=ce.find(Tt=>Tt.id===_e.headerId);We&&(L(oe,We,_e.value,ie?{index:ie}:void 0),we=!0)}),we&&await n(oe,ne,ie!==void 0?{fromArrayIndex:ie,headerId:he.id}:void 0)}},[e]),P=f.useCallback(async()=>{var ie,he;const D=Le.getState().selectedCell,O=Le.getState().expandedSelection,B=Pe.getState().processedLeafHeaders,k=void 0;if(!n||!D)return;if(O.length===0){const oe=w(D);if(!oe)return;const ye={...oe},ce=B[D.columnIndex];L(ye,ce,k,D.fromArrayData?{index:(ie=D.fromArrayData)==null?void 0:ie.index,headerId:ce.id}:void 0),await n(ye,e.findIndex(we=>we===oe),D.fromArrayData?{fromArrayIndex:(he=D.fromArrayData)==null?void 0:he.index,headerId:ce.id}:void 0);return}const K=new Map;console.log("expandedSelection",O),O.forEach(oe=>{const ye=w(oe);if(!ye)return;const ce=B[oe.columnIndex],we=e.findIndex(_e=>_e===ye);K.has(ye)||K.set(ye,{headers:new Set,itemIndex:we}),oe.fromArrayData?(K.get(ye).fromArray||(K.get(ye).fromArray=[]),K.get(ye).fromArray.push({index:oe.fromArrayData.index,headerId:ce.id})):K.get(ye).headers.add(ce)});const ne=[];K.forEach((oe,ye)=>{var we;const ce={...ye};oe.headers.forEach(_e=>{L(ce,_e,k)}),(we=oe.fromArray)==null||we.forEach(_e=>{L(ce,B.find(We=>We.id===_e.headerId),k,{index:_e.index,headerId:_e.headerId})}),ne.push({itemUpdated:ce,originalIndex:oe.itemIndex,fromArrayItemsAffected:oe.fromArray?oe.fromArray.map(_e=>({fromArrayIndex:_e.index,headerId:_e.headerId})):[]})}),await(r==null?void 0:r(ne))},[e]),L=(D,O,B,k)=>{k!==void 0?k.headerId?D[O.fromArray][k.index][k.headerId]=B:D[O.fromArray][k.index]=B:D[O.id]=B},N=f.useCallback(async(D,O)=>{a&&await a(D,O)},[o,e]),U=f.useCallback(async(D,O)=>{o&&await o(D,O)},[o,e]);return f.useEffect(()=>(window.addEventListener("mouseup",E),()=>{window.removeEventListener("mouseup",E)}),[E]),{setExpandedSelection:g,onHeaderClick:j,onHeaderRightClick:I,onCellBlur:A,onCellEnter:R,onCellClick:$,handleCellKeyDown:q,handleRowDoubleClick:W,resetDefaultValueForSelectedCells:P,saveCommentHandler:U,deleteCommentHandler:N,setHighlightCondition:async(D,O,B)=>{const k={propertyId:O,value:D[O],columnId:O,style:B};await(l==null?void 0:l(k,D))},removeHighlightCondition:(D,O,B)=>{const k={propertyId:O,value:D[O],columnId:O,style:{}};c==null||c(k,B,D)},onCellMouseDown:F,onCellMouseEnter:re,onMouseMove:J,pasteClipboardData:T,onRightClick:M,addListOption:async(D,O)=>{u&&await u(D,O)},getItemFromCellCoordinates:w,getItemsFromCellCoordinates:x}}const Mm=({items:e,onRowsReordered:t,groupBy:n})=>{const[r,i]=f.useState(null),[s,o]=f.useState(null),[a,l]=f.useState(null),[c,u]=f.useState(!1),d=f.useCallback(()=>{console.log(e),i(null),l(null),u(!1),o(null)},[]),h=f.useCallback((m,b)=>{i(m),u(!0),o(b)},[]),g=f.useCallback(m=>{if(r!==null&&a!==null&&r!==a){if(n&&m[n]!==(s==null?void 0:s[n])){console.warn("Cannot reorder items across different groups");return}t==null||t(r,a,s,m)}i(null),l(null),u(!1),o(null)},[r,a,t]),p=f.useCallback(m=>{r!==null&&r!==m&&l(m)},[r]);return{draggedRowIndex:r,dropTargetIndex:a,isDraggingRow:c,handleRowDragStart:h,handleDrop:g,handleDragEnd:d,handleRowDragOver:p}},jh=f.createContext(void 0),Om=({children:e,groupedItemsEntries:t,onChange:n,onBulkChange:r,onBulkFieldChange:i,onRowDoubleClick:s,onRowsReordered:o,onSaveComment:a,onDeleteComment:l,onSetHighlightCondition:c,onRemoveHighlightCondition:u,onAddListOption:d})=>{const h=di(),g=Oh(),p=As(),m=Am({items:g,groupedItemsEntries:t,onChange:n,onBulkFieldChange:i,onBulkChange:r,onRowDoubleClick:s,onAddListOption:d,onSaveComment:a,onDeleteComment:l,onSetHighlightCondition:c,onRemoveHighlightCondition:u}),b=Mm({items:h,onRowsReordered:o,groupBy:p}),v=f.useMemo(()=>({...m,...b}),[m,b]);return _.jsx(jh.Provider,{value:v,children:e})};function wn(){const e=f.useContext(jh);if(e===void 0)throw new Error("useTableInteractionContext must be used within a TableInteractionProvider");return e}const Tm=f.memo(e=>{var v;const t=Rh(),n=hi(),r=Th(),i=xn(),s=pa(),{setContextMenu:o}=ma(),{setActiveFilter:a,onResetSort:l,onSortByColumn:c}=yn(),{onHeaderClick:u,onHeaderRightClick:d}=wn(),h=Ph(),g=f.useMemo(()=>h.includes(e.header.id),[h,e.header.id]),p=y=>r[y]??[],m=y=>{if(n)return n.find(S=>S.headerId===y)},b=(y,S)=>{var A;if((A=y.editOptions)!=null&&A.type)switch(y.editOptions.type){case Ir.NUMBER:return Lt.NUMBER;default:return Lt.STRING}const w=[];let x=0;for(;w.length<10&&x<S.length;){const M=S[x];M!=null&&w.push(M),x++}return w.length===0?Lt.STRING:w.every(M=>typeof M=="number"?!0:typeof M=="string"?!isNaN(Number(M))&&M.trim()!=="":!1)?Lt.NUMBER:Lt.STRING};return _.jsx("th",{id:e.header.id,colSpan:e.colSpan,rowSpan:e.rowSpan,className:`${i!=null&&i.noBorder?"":"border-solid border-b border-r border-gray-300! bg-gray-50"} ${g?"!bg-blue-200 !outline-1 !outline-blue-500 -outline-offset-1":""} `,style:{...e.style},onClick:y=>{u(y,e.header.id)},onMouseEnter:()=>{},onContextMenu:y=>{y.preventDefault(),d(y,e.header.id),o({x:y.clientX,y:y.clientY,header:e.header})},children:_.jsxs("div",{style:{width:e.header.width?`${e.header.width}px`:"auto"},className:"flex justify-between",children:[_.jsxs("div",{className:"flex",children:[e.header.customHeader?e.header.customHeader(e.header):_.jsx("button",{onClick:()=>c==null?void 0:c(e.header),className:`font-semibold bg-transparent text-left text-slate-600 text-xs border-none outline-hidden! whitespace-pre ${e.header.sortable?"cursor-pointer hover:underline":"cursor-default"}`,children:e.header.text}),t===e.header.id&&_.jsxs(_.Fragment,{children:[_.jsx(ft,{path:s?jp:Lp,color:"grey",size:.6}),_.jsx("button",{onClick:l,className:`border-solid border bg-slate-300 hover:bg-slate-400! hover:border-transparent cursor-pointer rounded-lg h-min focus:outline-hidden!
42
42
  `,children:_.jsx(ft,{path:Np,color:"grey",size:.6})})]})]}),e.header.hasFilter?_.jsx("div",{className:"ml-2",children:_.jsx(gm,{show:e.showFilter,tableRef:e.tableRef,currentFilter:m(e.header.id),filterName:e.header.text,headerId:e.header.id,filterType:b(e.header,p(e.header.id)),items:p(e.header.id),itemsToHide:((v=n==null?void 0:n.find(y=>y.headerId===e.header.id))==null?void 0:v.itemsToHide)??[],onShowOrHide:y=>e.onShowFilter(y,e.header.id),onSetFilter:a})}):_.jsx(_.Fragment,{})]})},e.header.id+`-${e.index}`)});function Rm(e){const[t,n]=f.useState(""),r=f.useRef([]),[i,s]=f.useState([]);f.useLayoutEffect(()=>{const h=r.current.map(g=>(g==null?void 0:g.getBoundingClientRect().height)||0);s(h)},[e.headers]);const o=(h,g)=>{if(!h){n("");return}n(g)},a=f.useMemo(()=>{function h(g){return g.reduce((p,m)=>m.children&&m.children.length>0?Math.max(p,1+h(m.children)):Math.max(p,1),0)}return h(e.headers)},[e.headers]),l=f.useCallback(h=>h.children&&h.children.length>0?h.children.reduce((g,p)=>g+l(p),0):1,[]);function c(h,g,p=0){const m=d(h,g,p),b=h.filter(v=>v.children&&v.children.length>0).map(v=>v.children).flat();return b.length>0?[m,...c(b,g,p+1)]:[m]}const u=f.useMemo(()=>{const h=d(e.headers,a,0),g=e.headers.filter(p=>p.children&&p.children.length>0).map(p=>p.children).flat();return g.length>0?[h,...c(g,a,1)]:[h]},[e.headers,t,i]);function d(h,g,p=0){return h.length===0?null:_.jsx("tr",{ref:m=>{r.current[p]=m},style:{zIndex:100-p},children:h.map((m,b)=>{const v=l(m),S=m.children&&m.children.length>0?1:g-p,w=i.slice(0,p).reduce((x,C)=>x+C,0);return _.jsx(f.Fragment,{children:_.jsx(Tm,{header:m,colSpan:v,rowSpan:S,index:b,showFilter:t===m.id,onShowFilter:o,style:{position:"sticky",top:`${w}px`}})},m.id+m.id)})},`header-row-${p}`)}return _.jsx("thead",{className:"relative",children:u})}function Dn(e,t,n){let r=n.initialDeps??[],i;function s(){var o,a,l,c;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((p,m)=>r[m]!==p)))return i;r=d;let g;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(g=Date.now()),i=t(...d),n.key&&((l=n.debug)!=null&&l.call(n))){const p=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-g)*100)/100,b=m/16,v=(y,S)=>{for(y=String(y);y.length<S;)y=" "+y;return y};console.info(`%c⏱ ${v(m,5)} /${v(p,5)} ms`,`
43
43
  font-size: .6rem;
44
44
  font-weight: bold;