@mhmdaljefri/revogrid
Version:
Virtual reactive data grid component - RevoGrid.
1 lines • 304 kB
JavaScript
import{g as t,f as r,h as e,r as n,c as i,H as o,e as s}from"./index-a7f99799.js";import{i as u,F as a,a as c}from"./filter.button-1509c206.js";class l{constructor(){this.defaultRowSize=32}}class h{constructor(){this.defaultRowSize=27}}class f{constructor(){this.defaultRowSize=42}}const d=["default","material","compact","darkMaterial","darkCompact"];class g{constructor(t){this.customRowSize=0,this.customRowSize=t.rowSize,this.register("default")}get theme(){return this.currentTheme}get rowSize(){return this.customRowSize||this.currentTheme.defaultRowSize}set rowSize(t){this.customRowSize=t}register(t){switch(g.getTheme(t)){case"material":case"darkMaterial":this.currentTheme=new f;break;case"compact":case"darkCompact":this.currentTheme=new l;break;default:this.currentTheme=new h}}static getTheme(t){return d.indexOf(t)>-1?t:"default"}}var v=function(t,r,e,n){var i=-1,o=null==t?0:t.length;for(n&&o&&(e=t[++i]);++i<o;)e=r(e,t[i],i,t);return e},p=function(t,r,e){for(var n=-1,i=Object(t),o=e(t),s=o.length;s--;){var u=o[++n];if(!1===r(i[u],u,i))break}return t},C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function w(t,r,e){return t(e={path:r,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},e.exports),e.exports}var L="object"==typeof C&&C&&C.Object===Object&&C,m="object"==typeof self&&self&&self.Object===Object&&self,b=L||m||Function("return this")(),x=b.Symbol,y=Object.prototype,k=y.hasOwnProperty,E=y.toString,S=x?x.toStringTag:void 0,j=Object.prototype.toString,R=x?x.toStringTag:void 0,z=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":R&&R in Object(t)?function(t){var r=k.call(t,S),e=t[S];try{t[S]=void 0;var n=!0}catch(t){}var i=E.call(t);return n&&(r?t[S]=e:delete t[S]),i}(t):function(t){return j.call(t)}(t)},O=function(t){return null!=t&&"object"==typeof t},M=function(t){return O(t)&&"[object Arguments]"==z(t)},F=Object.prototype,_=F.hasOwnProperty,A=F.propertyIsEnumerable,T=M(function(){return arguments}())?M:function(t){return O(t)&&_.call(t,"callee")&&!A.call(t,"callee")},D=Array.isArray,I=function(){return!1},P=w((function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,i=n&&n.exports===e?b.Buffer:void 0;t.exports=(i?i.isBuffer:void 0)||I})),$=/^(?:0|[1-9]\d*)$/,U=function(t,r){var e=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==e||"symbol"!=e&&$.test(t))&&t>-1&&t%1==0&&t<r},H=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Z={};Z["[object Float32Array]"]=Z["[object Float64Array]"]=Z["[object Int8Array]"]=Z["[object Int16Array]"]=Z["[object Int32Array]"]=Z["[object Uint8Array]"]=Z["[object Uint8ClampedArray]"]=Z["[object Uint16Array]"]=Z["[object Uint32Array]"]=!0,Z["[object Arguments]"]=Z["[object Array]"]=Z["[object ArrayBuffer]"]=Z["[object Boolean]"]=Z["[object DataView]"]=Z["[object Date]"]=Z["[object Error]"]=Z["[object Function]"]=Z["[object Map]"]=Z["[object Number]"]=Z["[object Object]"]=Z["[object RegExp]"]=Z["[object Set]"]=Z["[object String]"]=Z["[object WeakMap]"]=!1;var B,N=w((function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,i=n&&n.exports===e&&L.process,o=function(){try{return n&&n.require&&n.require("util").types||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o})),W=N&&N.isTypedArray,V=W?(B=W,function(t){return B(t)}):function(t){return O(t)&&H(t.length)&&!!Z[z(t)]},G=Object.prototype.hasOwnProperty,q=function(t,r){var e=D(t),n=!e&&T(t),i=!e&&!n&&P(t),o=!e&&!n&&!i&&V(t),s=e||n||i||o,u=s?function(t,r){for(var e=-1,n=Array(t);++e<t;)n[e]=r(e);return n}(t.length,String):[],a=u.length;for(var c in t)!r&&!G.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||U(c,a))||u.push(c);return u},K=Object.prototype,X=function(t,r){return function(e){return t(r(e))}}(Object.keys,Object),J=Object.prototype.hasOwnProperty,Y=function(t){if((r=t)!==("function"==typeof(e=r&&r.constructor)&&e.prototype||K))return X(t);var r,e,n=[];for(var i in Object(t))J.call(t,i)&&"constructor"!=i&&n.push(i);return n},Q=function(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)},tt=function(t){if(!Q(t))return!1;var r=z(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r},rt=function(t){return null!=t&&H(t.length)&&!tt(t)},et=function(t){return rt(t)?q(t):Y(t)},nt=function(t,r){if(null==t)return t;if(!rt(t))return function(t,r){return t&&p(t,r,et)}(t,r);for(var e=t.length,n=-1,i=Object(t);++n<e&&!1!==r(i[n],n,i););return t},it=function(t,r){return t===r||t!=t&&r!=r},ot=function(t,r){for(var e=t.length;e--;)if(it(t[e][0],r))return e;return-1},st=Array.prototype.splice;function ut(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}ut.prototype.clear=function(){this.__data__=[],this.size=0},ut.prototype.delete=function(t){var r=this.__data__,e=ot(r,t);return!(e<0||(e==r.length-1?r.pop():st.call(r,e,1),--this.size,0))},ut.prototype.get=function(t){var r=this.__data__,e=ot(r,t);return e<0?void 0:r[e][1]},ut.prototype.has=function(t){return ot(this.__data__,t)>-1},ut.prototype.set=function(t,r){var e=this.__data__,n=ot(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};var at,ct=ut,lt=b["__core-js_shared__"],ht=(at=/[^.]+$/.exec(lt&<.keys&<.keys.IE_PROTO||""))?"Symbol(src)_1."+at:"",ft=Function.prototype.toString,dt=function(t){if(null!=t){try{return ft.call(t)}catch(t){}try{return t+""}catch(t){}}return""},gt=/^\[object .+?Constructor\]$/,vt=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pt=function(t){return!(!Q(t)||function(t){return!!ht&&ht in t}(t))&&(tt(t)?vt:gt).test(dt(t))},Ct=function(t,r){var e=function(t,r){return null==t?void 0:t[r]}(t,r);return pt(e)?e:void 0},wt=Ct(b,"Map"),Lt=Ct(Object,"create"),mt=Object.prototype.hasOwnProperty,bt=Object.prototype.hasOwnProperty;function xt(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}xt.prototype.clear=function(){this.__data__=Lt?Lt(null):{},this.size=0},xt.prototype.delete=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r},xt.prototype.get=function(t){var r=this.__data__;if(Lt){var e=r[t];return"__lodash_hash_undefined__"===e?void 0:e}return mt.call(r,t)?r[t]:void 0},xt.prototype.has=function(t){var r=this.__data__;return Lt?void 0!==r[t]:bt.call(r,t)},xt.prototype.set=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=Lt&&void 0===r?"__lodash_hash_undefined__":r,this};var yt=xt,kt=function(t,r){var e,n,i=t.__data__;return("string"==(n=typeof(e=r))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e)?i["string"==typeof r?"string":"hash"]:i.map};function Et(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}Et.prototype.clear=function(){this.size=0,this.__data__={hash:new yt,map:new(wt||ct),string:new yt}},Et.prototype.delete=function(t){var r=kt(this,t).delete(t);return this.size-=r?1:0,r},Et.prototype.get=function(t){return kt(this,t).get(t)},Et.prototype.has=function(t){return kt(this,t).has(t)},Et.prototype.set=function(t,r){var e=kt(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this};var St=Et;function jt(t){var r=this.__data__=new ct(t);this.size=r.size}jt.prototype.clear=function(){this.__data__=new ct,this.size=0},jt.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},jt.prototype.get=function(t){return this.__data__.get(t)},jt.prototype.has=function(t){return this.__data__.has(t)},jt.prototype.set=function(t,r){var e=this.__data__;if(e instanceof ct){var n=e.__data__;if(!wt||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new St(n)}return e.set(t,r),this.size=e.size,this};var Rt=jt;function zt(t){var r=-1,e=null==t?0:t.length;for(this.__data__=new St;++r<e;)this.add(t[r])}zt.prototype.add=zt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},zt.prototype.has=function(t){return this.__data__.has(t)};var Ot=zt,Mt=function(t,r){for(var e=-1,n=null==t?0:t.length;++e<n;)if(r(t[e],e,t))return!0;return!1},Ft=function(t,r,e,n,i,o){var s=1&e,u=t.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var c=o.get(t),l=o.get(r);if(c&&l)return c==r&&l==t;var h=-1,f=!0,d=2&e?new Ot:void 0;for(o.set(t,r),o.set(r,t);++h<u;){var g=t[h],v=r[h];if(n)var p=s?n(v,g,h,r,t,o):n(g,v,h,t,r,o);if(void 0!==p){if(p)continue;f=!1;break}if(d){if(!Mt(r,(function(t,r){if(!d.has(r)&&(g===t||i(g,t,e,n,o)))return d.push(r)}))){f=!1;break}}else if(g!==v&&!i(g,v,e,n,o)){f=!1;break}}return o.delete(t),o.delete(r),f},_t=b.Uint8Array,At=function(t){var r=-1,e=Array(t.size);return t.forEach((function(t,n){e[++r]=[n,t]})),e},Tt=function(t){var r=-1,e=Array(t.size);return t.forEach((function(t){e[++r]=t})),e},Dt=x?x.prototype:void 0,It=Dt?Dt.valueOf:void 0,Pt=Object.prototype.propertyIsEnumerable,$t=Object.getOwnPropertySymbols,Ut=$t?function(t){return null==t?[]:(t=Object(t),function(t,r){for(var e=-1,n=null==t?0:t.length,i=0,o=[];++e<n;){var s=t[e];r(s,e,t)&&(o[i++]=s)}return o}($t(t),(function(r){return Pt.call(t,r)})))}:function(){return[]},Ht=function(t){return function(t,r,e){var n=r(t);return D(t)?n:function(t,r){for(var e=-1,n=r.length,i=t.length;++e<n;)t[i+e]=r[e];return t}(n,e(t))}(t,et,Ut)},Zt=Object.prototype.hasOwnProperty,Bt=Ct(b,"DataView"),Nt=Ct(b,"Promise"),Wt=Ct(b,"Set"),Vt=Ct(b,"WeakMap"),Gt=dt(Bt),qt=dt(wt),Kt=dt(Nt),Xt=dt(Wt),Jt=dt(Vt),Yt=z;(Bt&&"[object DataView]"!=Yt(new Bt(new ArrayBuffer(1)))||wt&&"[object Map]"!=Yt(new wt)||Nt&&"[object Promise]"!=Yt(Nt.resolve())||Wt&&"[object Set]"!=Yt(new Wt)||Vt&&"[object WeakMap]"!=Yt(new Vt))&&(Yt=function(t){var r=z(t),e="[object Object]"==r?t.constructor:void 0,n=e?dt(e):"";if(n)switch(n){case Gt:return"[object DataView]";case qt:return"[object Map]";case Kt:return"[object Promise]";case Xt:return"[object Set]";case Jt:return"[object WeakMap]"}return r});var Qt=Yt,tr="[object Object]",rr=Object.prototype.hasOwnProperty,er=function(t,r,e,n,i,o){var s=D(t),u=D(r),a=s?"[object Array]":Qt(t),c=u?"[object Array]":Qt(r),l=(a="[object Arguments]"==a?tr:a)==tr,h=(c="[object Arguments]"==c?tr:c)==tr,f=a==c;if(f&&P(t)){if(!P(r))return!1;s=!0,l=!1}if(f&&!l)return o||(o=new Rt),s||V(t)?Ft(t,r,e,n,i,o):function(t,r,e,n,i,o,s){switch(e){case"[object DataView]":if(t.byteLength!=r.byteLength||t.byteOffset!=r.byteOffset)return!1;t=t.buffer,r=r.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=r.byteLength||!o(new _t(t),new _t(r)));case"[object Boolean]":case"[object Date]":case"[object Number]":return it(+t,+r);case"[object Error]":return t.name==r.name&&t.message==r.message;case"[object RegExp]":case"[object String]":return t==r+"";case"[object Map]":var u=At;case"[object Set]":if(u||(u=Tt),t.size!=r.size&&!(1&n))return!1;var a=s.get(t);if(a)return a==r;n|=2,s.set(t,r);var c=Ft(u(t),u(r),n,i,o,s);return s.delete(t),c;case"[object Symbol]":if(It)return It.call(t)==It.call(r)}return!1}(t,r,a,e,n,i,o);if(!(1&e)){var d=l&&rr.call(t,"__wrapped__"),g=h&&rr.call(r,"__wrapped__");if(d||g){var v=d?t.value():t,p=g?r.value():r;return o||(o=new Rt),i(v,p,e,n,o)}}return!!f&&(o||(o=new Rt),function(t,r,e,n,i,o){var s=1&e,u=Ht(t),a=u.length;if(a!=Ht(r).length&&!s)return!1;for(var c=a;c--;){var l=u[c];if(!(s?l in r:Zt.call(r,l)))return!1}var h=o.get(t),f=o.get(r);if(h&&f)return h==r&&f==t;var d=!0;o.set(t,r),o.set(r,t);for(var g=s;++c<a;){var v=t[l=u[c]],p=r[l];if(n)var C=s?n(p,v,l,r,t,o):n(v,p,l,t,r,o);if(!(void 0===C?v===p||i(v,p,e,n,o):C)){d=!1;break}g||(g="constructor"==l)}if(d&&!g){var w=t.constructor,L=r.constructor;w==L||!("constructor"in t)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof L&&L instanceof L||(d=!1)}return o.delete(t),o.delete(r),d}(t,r,e,n,i,o))},nr=function t(r,e,n,i,o){return r===e||(null==r||null==e||!O(r)&&!O(e)?r!=r&&e!=e:er(r,e,n,i,t,o))},ir=function(t){return t==t&&!Q(t)},or=function(t,r){return function(e){return null!=e&&e[t]===r&&(void 0!==r||t in Object(e))}},sr=function(t){var r=function(t){for(var r=et(t),e=r.length;e--;){var n=r[e],i=t[n];r[e]=[n,i,ir(i)]}return r}(t);return 1==r.length&&r[0][2]?or(r[0][0],r[0][1]):function(e){return e===t||function(t,r,e,n){var i=e.length,o=i,s=!n;if(null==t)return!o;for(t=Object(t);i--;){var u=e[i];if(s&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++i<o;){var a=(u=e[i])[0],c=t[a],l=u[1];if(s&&u[2]){if(void 0===c&&!(a in t))return!1}else{var h=new Rt;if(n)var f=n(c,l,a,t,r,h);if(!(void 0===f?nr(l,c,3,n,h):f))return!1}}return!0}(e,t,r)}},ur=function(t){return"symbol"==typeof t||O(t)&&"[object Symbol]"==z(t)},ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cr=/^\w*$/,lr=function(t,r){if(D(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!ur(t))||cr.test(t)||!ar.test(t)||null!=r&&t in Object(r)};function hr(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var e=function(){var n=arguments,i=r?r.apply(this,n):n[0],o=e.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return e.cache=o.set(i,s)||o,s};return e.cache=new(hr.Cache||St),e}hr.Cache=St;var fr,dr,gr,vr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pr=/\\(\\)?/g,Cr=(fr=hr((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(vr,(function(t,e,n,i){r.push(n?i.replace(pr,"$1"):e||t)})),r}),(function(t){return 500===dr.size&&dr.clear(),t})),dr=fr.cache,fr),wr=function(t,r){for(var e=-1,n=null==t?0:t.length,i=Array(n);++e<n;)i[e]=r(t[e],e,t);return i},Lr=x?x.prototype:void 0,mr=Lr?Lr.toString:void 0,br=function t(r){if("string"==typeof r)return r;if(D(r))return wr(r,t)+"";if(ur(r))return mr?mr.call(r):"";var e=r+"";return"0"==e&&1/r==-1/0?"-0":e},xr=function(t){return null==t?"":br(t)},yr=function(t,r){return D(t)?t:lr(t,r)?[t]:Cr(xr(t))},kr=function(t){if("string"==typeof t||ur(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},Er=function(t,r){for(var e=0,n=(r=yr(r,t)).length;null!=t&&e<n;)t=t[kr(r[e++])];return e&&e==n?t:void 0},Sr=function(t,r){return null!=t&&r in Object(t)},jr=function(t,r){return null!=t&&function(t,r,e){for(var n=-1,i=(r=yr(r,t)).length,o=!1;++n<i;){var s=kr(r[n]);if(!(o=null!=t&&e(t,s)))break;t=t[s]}return o||++n!=i?o:!!(i=null==t?0:t.length)&&H(i)&&U(s,i)&&(D(t)||T(t))}(t,r,Sr)},Rr=function(t,r){return lr(t)&&ir(r)?or(kr(t),r):function(e){var n=function(t,r,e){var n=null==t?void 0:Er(t,r);return void 0===n?e:n}(e,t);return void 0===n&&n===r?jr(e,t):nr(r,n,3)}},zr=function(t){return t},Or=function(t){return function(r){return null==r?void 0:r[t]}},Mr=function(t){return lr(t)?Or(kr(t)):function(t){return function(r){return Er(r,t)}}(t)},Fr=function(t){return"function"==typeof t?t:null==t?zr:"object"==typeof t?D(t)?Rr(t[0],t[1]):sr(t):Mr(t)},_r=function(t,r,e,n,i){return i(t,(function(t,i,o){e=n?(n=!1,t):r(e,t,i,o)})),e},Ar=function(t,r,e){var n=D(t)?v:_r,i=arguments.length<3;return n(t,Fr(r),e,i,nt)},Tr=function(t,r){for(var e=-1,n=null==t?0:t.length;++e<n&&!1!==r(t[e],e,t););return t},Dr=function(t,r){return(D(t)?Tr:nt)(t,"function"==typeof(e=r)?e:zr);var e},Ir=function(t,r,e,n){for(var i=t.length,o=e+(n?1:-1);n?o--:++o<i;)if(r(t[o],o,t))return o;return-1},Pr=/\s/,$r=/^\s+/,Ur=function(t){return t?t.slice(0,function(t){for(var r=t.length;r--&&Pr.test(t.charAt(r)););return r}(t)+1).replace($r,""):t},Hr=/^[-+]0x[0-9a-f]+$/i,Zr=/^0b[01]+$/i,Br=/^0o[0-7]+$/i,Nr=parseInt,Wr=function(t){if("number"==typeof t)return t;if(ur(t))return NaN;if(Q(t)){var r="function"==typeof t.valueOf?t.valueOf():t;t=Q(r)?r+"":r}if("string"!=typeof t)return 0===t?t:+t;t=Ur(t);var e=Zr.test(t);return e||Br.test(t)?Nr(t.slice(2),e?2:8):Hr.test(t)?NaN:+t},Vr=function(t){return t?1/0===(t=Wr(t))||-1/0===t?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},Gr=function(t){var r=Vr(t),e=r%1;return r==r?e?r-e:r:0},qr=Math.max,Kr=function(t,r,e){var n=null==t?0:t.length;if(!n)return-1;var i=null==e?0:Gr(e);return i<0&&(i=qr(n+i,0)),Ir(t,Fr(r),i)},Xr=(gr=Kr,function(t,r,e){var n=Object(t);if(!rt(t)){var i=Fr(r);t=et(t),r=function(t){return i(n[t],t,n)}}var o=gr(t,r,e);return o>-1?n[i?t[o]:o]:void 0});const Jr=t=>!("isConnected"in t)||t.isConnected,Yr=(()=>{let t;return(...r)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let r of t.keys())t.set(r,t.get(r).filter(Jr))})(...r)}),2e3)}})(),Qr=(e,n)=>{const i=((t,r=((t,r)=>t!==r))=>{let e=new Map(Object.entries(null!=t?t:{}));const n={dispose:[],get:[],set:[],reset:[]},i=()=>{e=new Map(Object.entries(null!=t?t:{})),n.reset.forEach((t=>t()))},o=t=>(n.get.forEach((r=>r(t))),e.get(t)),s=(t,i)=>{const o=e.get(t);r(i,o,t)&&(e.set(t,i),n.set.forEach((r=>r(t,i,o))))},u="undefined"==typeof Proxy?{}:new Proxy(t,{get:(t,r)=>o(r),ownKeys:()=>Array.from(e.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,r)=>e.has(r),set:(t,r,e)=>(s(r,e),!0)}),a=(t,r)=>(n[t].push(r),()=>{((t,r)=>{const e=t.indexOf(r);e>=0&&(t[e]=t[t.length-1],t.length--)})(n[t],r)});return{state:u,get:o,set:s,on:a,onChange:(r,e)=>{const n=a("set",((t,n)=>{t===r&&e(n)})),i=a("reset",(()=>e(t[r])));return()=>{n(),i()}},use:(...t)=>t.forEach((t=>{t.set&&a("set",t.set),t.get&&a("get",t.get),t.reset&&a("reset",t.reset)})),dispose:()=>{n.dispose.forEach((t=>t())),i()},reset:i}})(e,n);return(({on:e})=>{const n=new Map;"function"==typeof t&&(e("dispose",(()=>{n.clear()})),e("get",(r=>{const e=t();e&&((t,r,e)=>{const n=t.get(r);n?n.includes(e)||n.push(e):t.set(r,[e])})(n,r,e)})),e("set",(t=>{const e=n.get(t);e&&n.set(t,e.filter(r)),Yr(n)})),e("reset",(()=>{n.forEach((t=>t.forEach(r))),Yr(n)})))})(i),i};var te=Math.ceil,re=Math.max,ee=function(t,r,e){if(!Q(e))return!1;var n=typeof r;return!!("number"==n?rt(e)&&U(r,e.length):"string"==n&&r in e)&&it(e[r],t)},ne=function(t,r,e){return e&&"number"!=typeof e&&ee(t,r,e)&&(r=e=void 0),t=Vr(t),void 0===r?(r=t,t=0):r=Vr(r),function(t,r,e,n){for(var i=-1,o=re(te((r-t)/(e||1)),0),s=Array(o);o--;)s[n?o:++i]=t,t+=e;return s}(t,r,e=void 0===e?t<r?1:-1:Vr(e),void 0)};function ie(t,r){for(let e in r)t.set(e,r[e])}class oe{constructor(t){const r=this.dataStore=Qr({items:[],proxyItems:[],source:[],groupingDepth:0,groups:{},type:t,trimmed:{}});r.use((t=>({set(r,e){if(!function(t){return"proxyItems"===t}(r))return;const n=t.get("items").reduce(((t,r)=>(t[r]=!0,t)),{}),i=e.reduce(((t,r)=>(n[r]&&t.push(r),t)),[]);t.set("items",i)}}))(r)),r.use((t=>({set(r,e){switch(r){case"trimmed":const r=t.get("proxyItems"),n=function(t){const r={};for(let e in t)for(let n in t[e])r[n]=r[n]||t[e][n];return r}(e),i=r.reduce(((t,r)=>(n[r]||t.push(r),t)),[]);t.set("items",i)}}}))(r))}get store(){return this.dataStore}updateData(t,r,e=!1){e||this.store.set("trimmed",{}),this.store.set("items",[]);const n=ne(0,(null==t?void 0:t.length)||0);ie(this.store,{source:t,proxyItems:[...n]}),this.store.set("items",n),r&&ie(this.store,{groupingDepth:r.depth,groups:r.groups})}addTrimmed(t){let r=this.store.get("trimmed");r=Object.assign(Object.assign({},r),t),ie(this.store,{trimmed:r})}setData(t){const r=Object.assign({},t);ie(this.store,r)}refresh(){const t=this.store.get("source");this.store.set("source",[...t])}}function se(t){const r=t.get("source");return t.get("items").map((t=>r[t]))}function ue(t,r){const e=t.get("items");return t.get("source")[e[r]]}function ae(t,r){const e=t.get("items"),n=t.get("source");for(let t in r)n[e[t]]=r[t];t.set("source",[...n])}function ce(t,r){t.set("items",r)}const le=["rowPinStart","rgRow","rowPinEnd"],he=["colPinStart","rgCol","colPinEnd"];var fe=function(t,r){var e=-1,n=rt(t)?Array(t.length):[];return nt(t,(function(t,i,o){n[++e]=r(t,i,o)})),n},de=function(t,r){return(D(t)?wr:fe)(t,Fr(r))};class ge{constructor(t){this.revogrid=t,this.subscriptions={}}addEventListener(t,r){this.revogrid.addEventListener(t,r),this.subscriptions[t]=r}removeEventListener(t){this.revogrid.removeEventListener(t,this.subscriptions[t]),delete this.subscriptions[t]}emit(t,r){const e=new CustomEvent(t,{detail:r,cancelable:!0});return this.revogrid.dispatchEvent(e),e}clearSubscriptions(){for(let t in this.subscriptions)this.removeEventListener(t)}destroy(){this.clearSubscriptions()}}class ve extends ge{static gatherGroup(t,r,e,n=0){const i=Object.assign(Object.assign({},r),{level:n,ids:[]});for(let r in e.columns){const n=r,o=t.columns[n],s=e.columns[n];D(o)&&D(s)&&(o.push(...s),s.length&&t.columnGrouping[n].push(Object.assign(Object.assign({},i),{ids:de(s,"prop")})))}for(let r in e.columnGrouping)t.columnGrouping[r].push(...e.columnGrouping[r]);return t.maxLevel=Math.max(t.maxLevel,e.maxLevel),t}static isColGrouping(t){return!!t.children}}class pe{constructor(){this.sorting=null,this.dataSources=Ar(he,((t,r)=>(t[r]=new oe(r),t)),{})}get order(){return Ar(this.sorting,((t,r,e)=>(t[e]=r.order,t)),{})}get stores(){return this.dataSources}column(t,r){return this.getColumn(t,r||"rgCol")}getColumn(t,r){return ue(this.dataSources[r].store,t)}getRawColumns(){return Ar(this.dataSources,((t,r,e)=>(t[e]=r.store.get("source"),t)),{rgCol:[],colPinStart:[],colPinEnd:[]})}getColumns(t="all"){return"all"!==t?this.dataSources[t].store.get("source"):he.reduce(((t,r)=>(t.push(...this.dataSources[r].store.get("source")),t)),[])}getColumnIndexByProp(t,r){return function(t,r){const e=t.get("items"),n=t.get("source"),i=Kr(n,{prop:r});return e.indexOf(i)}(this.dataSources[r].store,t)}getColumnByProp(t,r){const e=this.dataSources[r].store.get("source");return Xr(e,{prop:t})}refreshByType(t){this.dataSources[t].refresh()}setColumns(t){return Dr(he,(r=>{this.dataSources[r].updateData(t.columns[r],{depth:t.maxLevel,groups:Ar(t.columnGrouping[r],((t,r)=>(t[r.level]||(t[r.level]=[]),t[r.level].push(r),t)),{})})})),this.sorting=t.sort,t}updateColumns(t){const r=t.reduce(((t,r)=>{const e=pe.getColumnType(r);return t[e]||(t[e]={}),t[e][r.prop]=r,t}),{}),e={};Dr(r,((t,r)=>{const n=this.dataSources[r].store.get("source");e[r]=n.reduce(((r,e,n)=>{const i=t[e.prop];return i&&(r[n]=i),r}),{})})),Dr(e,((t,r)=>ae(this.dataSources[r].store,t)))}updateColumn(t,r){const e=pe.getColumnType(t);ae(this.dataSources[e].store,{[r]:t})}updateColumnSorting(t,r,e,n){return n||this.clearSorting(),t.order=e,this.sorting[t.prop]=t,this.updateColumn(t,r),t}clearSorting(){const t=Ar(this.sorting,((t,r)=>(t[pe.getColumnType(r)]=!0,t)),{});Dr(t,((t,r)=>{const e=this.dataSources[r].store.get("source");Dr(e,(t=>t.order=void 0)),this.dataSources[r].setData({source:[...e]})})),this.sorting={}}static getSizes(t){return Ar(t,((t,r,e)=>(r.size&&(t[e]=r.size),t)),{})}static getColumnByProp(t,r){return Xr(t,(t=>ve.isColGrouping(t)?pe.getColumnByProp(t.children,r):t.prop===r))}static getColumns(t,r=0,e){return Ar(t,((t,n)=>{if(ve.isColGrouping(n))return ve.gatherGroup(t,n,pe.getColumns(n.children,r+1,e),r);const i=Object.assign(Object.assign({},n.columnType&&e&&e[n.columnType]),n);return i.pin?t.columns[i.pin].push(i):t.columns.rgCol.push(i),i.order&&(t.sort[i.prop]=i),i.beforeSetup&&i.beforeSetup(i),t}),{columns:{rgCol:[],colPinStart:[],colPinEnd:[]},columnGrouping:{rgCol:[],colPinStart:[],colPinEnd:[]},maxLevel:r,sort:{}})}static getColumnType(t){return t.pin?t.pin:"rgCol"}}class Ce{constructor(t){this.dimensionProvider=t,this.stores=Ar(le,((t,r)=>(t[r]=new oe(r),t)),{})}setData(t,r="rgRow",e,n=!1){return this.stores[r].updateData([...t],e,n),this.dimensionProvider.setData(t,r,"rgRow"!==r),t}getModel(t,r="rgRow"){return ue(this.stores[r].store,t)}setCellData({type:t,rowIndex:r,prop:e,val:n}){const i=this.getModel(r,t);i[e]=n,ae(this.stores[t].store,{[r]:i})}refresh(t="all"){(function(t){return le.indexOf(t)>-1})(t)&&this.refreshItems(t),le.forEach((t=>this.refreshItems(t)))}refreshItems(t="rgRow"){const r=this.stores[t].store.get("items");this.stores[t].setData({items:[...r]})}setGrouping({depth:t},r="rgRow"){this.stores[r].setData({groupingDepth:t})}setTrimmed(t,r="rgRow"){const e=this.stores[r];e.addTrimmed(t),"rgRow"===r&&this.dimensionProvider.setData(se(e.store),r)}}var we,Le=Math.floor,me=Math.min,be=function(t,r,e){var n=0,i=null==t?n:t.length;if("number"==typeof r&&r==r&&i<=2147483647){for(;n<i;){var o=n+i>>>1,s=t[o];null!==s&&!ur(s)&&(e?s<=r:s<r)?n=o+1:i=o}return i}return function(t,r,e,n){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var s=(r=e(r))!=r,u=null===r,a=ur(r),c=void 0===r;i<o;){var l=Le((i+o)/2),h=e(t[l]),f=void 0!==h,d=null===h,g=h==h,v=ur(h);if(s)var p=n||g;else p=c?g&&(n||f):u?g&&f&&(n||!d):a?g&&f&&!d&&(n||!v):!d&&!v&&(n?h<=r:h<r);p?i=l+1:o=l}return me(o,4294967294)}(t,r,zr,e)},xe=function(t,r){return be(t,r)};function ye(t,r){return t<r}function ke(t){const r=t.createElement("div"),e=r.style;e.visibility="hidden",e.overflow="scroll",e.msOverflowStyle="scrollbar",t.body.appendChild(r);const n=t.createElement("div");r.appendChild(n);const i=r.offsetWidth-n.offsetWidth;return r.parentNode.removeChild(r),i}function Ee(t,r,e){return(e[1]-e[0])*(t-r[0])/(r[1]-r[0])+e[0]}async function Se(t=0){await new Promise((r=>{setTimeout((()=>r()),t)}))}function je({indexes:t,positionIndexes:r,originItemSize:e,positionIndexToItem:n},i){const o={itemIndex:0,start:0,end:0},s=t.length?xe(r,i):0;if(!s)return o.itemIndex=Math.floor(i/e),o.start=o.itemIndex*e,o.end=o.start+e,o;const u=n[s-1];if(u.end>i)return u;const a=Math.floor((i-u.end)/e);return o.itemIndex=u.itemIndex+1+a,o.start=u.end+a*e,o.end=o.start+e,o}function Re(t,r){let e={itemIndex:r,start:0,end:0};if(t.indexToItem[r])return t.indexToItem[r];const n=t.indexes.length?xe(t.indexes,r):0;if(!n)return e.start=e.itemIndex*t.originItemSize,e.end=e.start+t.originItemSize,e;const i=t.indexToItem[t.indexes[n-1]];return e.start=i.end+(r-i.itemIndex-1)*t.originItemSize,e.end=e.start+t.originItemSize,e}function ze(){return Object.assign(Object.assign({},{indexes:[],sizes:{},positionIndexToItem:{},indexToItem:{},positionIndexes:[]}),{realSize:0,originItemSize:0,frameOffset:0})}class Oe{constructor(){this.store=Qr(ze())}getCurrentState(){const t=ze(),r=Object.keys(t);return Ar(r,((t,r)=>{const e=this.store.get(r);return t[r]=e,t}),t)}setRealSize(t){let r=0;for(let e=0;e<t;e++)r+=this.store.get("sizes")[e]||this.store.get("originItemSize");ie(this.store,{realSize:r})}setStore(t){ie(this.store,t)}drop(){ie(this.store,{indexes:[],sizes:{},positionIndexToItem:{},indexToItem:{},positionIndexes:[]})}setDimensionSize(t){const r=function(t,r){let e=[];const n={},i={};let o=0;const s=Object.assign(Object.assign({},t.sizes),r);let u=[];Dr(r,((r,e)=>{t.sizes[e]?o+=r-t.sizes[e]:(o+=r-(t.realSize?t.originItemSize:0),u.splice(xe(u,parseInt(e,10)),0,parseInt(e,10)))}));const a=function(t,r,e=ye){const n=[];let i=0,o=0,s=0;for(;s<t.length+r.length;){let u=o>=r.length;i>=t.length||!u&&!e(t[i],r[o])?(n[s]=r[o],o++):(n[s]=t[i],i++),s++}return n}(t.indexes,u);return Ar(a,((r,o,u)=>{const a={itemIndex:o,start:0,end:0};return a.start=r?(o-r.itemIndex-1)*t.originItemSize+r.end:o*t.originItemSize,a.end=a.start+s[o],e.push(a.start),i[o]=n[u]=a,a}),void 0),{indexes:a,positionIndexes:[...e],positionIndexToItem:Object.assign({},n),indexToItem:i,realSize:t.realSize+o,sizes:s}}(this.getCurrentState(),t);return ie(this.store,r),r}}class Me{constructor(t){this.viewports=t,this.stores=Ar([...le,...he],((t,r)=>(t[r]=new Oe,t)),{})}setDimensionSize(t,r){this.stores[t].setDimensionSize(r),this.viewports.stores[t].setViewPortDimension(r)}setRealSize(t,r){this.viewports.stores[r].setViewport({realCount:t}),this.stores[r].setRealSize(t)}setData(t,r,e=!1){this.setRealSize(t.length,r),e&&this.setNoVirtual(r),this.setViewPortCoordinate({coordinate:this.viewports.stores[r].store.get("lastCoordinate"),type:r})}setNoVirtual(t){const r=this.stores[t].getCurrentState();this.viewports.stores[t].setViewport({virtualSize:r.realSize})}drop(){for(let t of he)this.stores[t].drop()}setColumns(t,r,e=!1){this.stores[t].setDimensionSize(r),e&&this.setNoVirtual(t),this.setViewPortCoordinate({coordinate:this.viewports.stores[t].store.get("lastCoordinate"),type:t})}setViewPortCoordinate({coordinate:t,type:r}){const e=this.stores[r].getCurrentState();this.viewports.stores[r].setViewPortCoordinate(t,e)}getViewPortPos(t){return Re(this.stores[t.dimension].getCurrentState(),t.coordinate).start}setSettings(t,r){let e=[];switch(r){case"rgCol":e=he;break;case"rgRow":e=le}for(let r of e)this.stores[r].setStore(t)}}function Fe(t,r,e){t.splice(e.end+1,0,...r),e.start>=e.end&&(e.start!==e.end||0!==e.start)&&(e.start+=r.length),e.end+=r.length}function _e(t,r,e,n,i){const o=Ie(n);return Ae({sizes:i.sizes,start:o.end,startIndex:o.itemIndex+1,origSize:i.originItemSize,maxSize:e-(o.end-t.start),maxCount:r})}function Ae(t,r=0){const e=[];let n=t.startIndex,i=r;for(;i<=t.maxSize&&n<t.maxCount;){const r=Te(n,t.sizes,t.origSize);e.push({start:t.start+i,end:t.start+i+r,itemIndex:n,size:r}),i+=r,n++}return e}function Te(t,r,e=0){return r&&r[t]?r[t]:e}function De(t){return t.items[t.start]}function Ie(t){return t.items[t.end]}class Pe{constructor(){this.store=Qr({items:[],start:0,end:0,virtualSize:0,realCount:0,lastCoordinate:0}),this.store.onChange("realCount",(()=>this.clear()))}setViewPortCoordinate(t,r){let e=this.store.get("virtualSize");if(!e)return;const n=r.frameOffset;e+=2*n*r.originItemSize;let i=e;r.realSize>e&&(i=r.realSize-e);let o={lastCoordinate:t},s=t;s-=n*r.originItemSize,s=s<0?0:s<i?s:i;const u=De(this.getItems()),a=Ie(this.getItems());if(function(t,r){return r&&t>=r.start&&t<=r.end}(s,u)){if(u&&this.store.get("virtualSize")+s>(null==a?void 0:a.end)){const t=_e(u,this.store.get("realCount"),e+s-u.start,this.getItems(),r);if(t.length){const r=[...this.store.get("items")],e={start:this.store.get("start"),end:this.store.get("end")};Fe(r,t,e),o=Object.assign(Object.assign(Object.assign({},o),{items:[...r]}),e),ie(this.store,Object.assign({},o))}}}else o=Object.assign(Object.assign({},o),function(t,r,e,n,i){const o=je(i,t),s=De(r);let u;if(s){let t=o.itemIndex-(s.itemIndex||0);if(t){const s=function(t,r){const e=[...r.items],n=e.length;let i={start:r.start,end:r.end};if(t>n)return null;if(r.positiveDirection){let o=Ie(r),s=i.start;const u=s+t;for(;s<u;s++){const t=o.itemIndex+1,u=Te(t,r.sizes,r.originItemSize);if(o.end+u>r.realSize)break;let a=s%n;if(!e[a])throw new Error("incorrect index");e[a]=o={start:o.end,end:o.end+u,itemIndex:t,size:u},i.start++,i.end=a}}else{let o=De(r);const s=i.end;for(let u=0;u<t;u++){const t=o.itemIndex-1,a=Te(t,r.sizes,r.originItemSize);let c=s-u;if(c=(c<0?n+c:c)%n,!e[c])throw new Error("incorrect index");e[c]=o={start:o.start-a,end:o.start,itemIndex:t,size:a},i.start=c,i.end--}}return Object.assign({items:e},{start:(i.start<0?n+i.start:i.start)%n,end:(i.end<0?n+i.end:i.end)%n})}(Math.abs(t),Object.assign(Object.assign({positiveDirection:t>-1},i),r));if(s&&(u=s),u){const t=_e(o,e,n,u,i);t.length&&Fe(u.items,t,u)}}}if(!u){const t=Ae({start:o.start,startIndex:o.itemIndex,origSize:i.originItemSize,maxSize:n,maxCount:e,sizes:i.sizes});u={items:t,start:0,end:t.length-1}}return u}(s,this.getItems(),this.store.get("realCount"),e,r)),ie(this.store,Object.assign({},o))}setViewPortDimension(t){const r=this.store.get("items"),e=r.length;if(!e)return;let n=0,i=0,o=this.store.get("start");for(;i<e;){const s=r[o];n&&(s.start+=n,s.end+=n);const u=t[s.itemIndex];u&&(n+=u-s.size,s.size=u,s.end=s.start+u),o++,i++,o===e&&(o=0)}ie(this.store,{items:[...r]})}getItems(){return{items:this.store.get("items"),start:this.store.get("start"),end:this.store.get("end")}}setViewport(t){ie(this.store,t)}clear(){this.store.set("items",[])}}class $e{constructor(){this.stores=Ar([...le,...he],((t,r)=>(t[r]=new Pe,t)),{})}setViewport(t,r){this.stores[t].setViewport(r)}}!function(t){t.headerClickAutosize="headerClickAutoSize",t.autoSizeOnTextOverlap="autoSizeOnTextOverlap",t.autoSizeAll="autoSizeAll"}(we||(we={}));class Ue extends ge{constructor(t,r,e){super(t),this.providers=r,this.config=e,this.autoSizeColumns=null,this.dataResolve=null,this.dataReject=null,this.letterBlockSize=(null==e?void 0:e.letterBlockSize)||7,(null==e?void 0:e.preciseSize)&&(this.precsizeCalculationArea=this.initiatePresizeElement(),t.appendChild(this.precsizeCalculationArea));const n=({detail:{source:t}})=>{this.setSource(t)},i=({detail:t})=>{this.afteredit(t)},o=({detail:t})=>{this.afterEditAll(t)},s=({detail:t})=>{const r=pe.getColumnType(t),e=this.getColumnSize(t.index,r);e&&this.providers.dimensionProvider.setDimensionSize(r,{[t.index]:e})};switch(this.addEventListener("beforecolumnsset",(({detail:{columns:t}})=>{this.columnSet(t)})),null==e?void 0:e.mode){case we.autoSizeOnTextOverlap:this.addEventListener("aftersourceset",n),this.addEventListener("afteredit",i);break;case we.autoSizeAll:this.addEventListener("aftersourceset",n),this.addEventListener("afteredit",o);break;default:this.addEventListener("headerdblClick",s)}}async setSource(t){let r=this.autoSizeColumns;if(this.dataReject&&(this.dataReject(),this.clearPromise()),!r){const t=new Promise(((t,r)=>{this.dataResolve=t,this.dataReject=r}));try{r=await t}catch(t){return}}Dr(r,((e,n)=>{const i={};Dr(r[n],(r=>{r.size=i[r.index]=t.reduce(((t,e)=>Math.max(t,this.getLength(e[r.prop]))),0)})),this.providers.dimensionProvider.setDimensionSize(n,i)}))}getLength(t){var r;if(!t)return 0;try{const e=t.toString();return(null===(r=this.config)||void 0===r?void 0:r.preciseSize)?(this.precsizeCalculationArea.innerText=e,this.precsizeCalculationArea.scrollWidth+30):e.length*this.letterBlockSize+30}catch(t){return 0}}afteredit(t){let r;r=this.isRangeEdit(t)?t.data:{0:{[t.prop]:t.val}},Dr(this.autoSizeColumns,((t,e)=>{const n={};Dr(t,(t=>{const e=Ar(r,((r,e)=>void 0===e[t.prop]?r:Math.max(r||0,this.getLength(e[t.prop]))),void 0);e&&t.size<e&&(t.size=n[t.index]=e)})),this.providers.dimensionProvider.setDimensionSize(e,n)}))}afterEditAll(t){const r={};this.isRangeEdit(t)?Dr(t.data,(t=>Dr(t,((t,e)=>r[e]=!0)))):r[t.prop]=!0,Dr(this.autoSizeColumns,((t,e)=>{const n={};Dr(t,(t=>{if(r[t.prop]){const r=this.getColumnSize(t.index,e);r&&(n[t.index]=r)}})),this.providers.dimensionProvider.setDimensionSize(e,n)}))}getColumnSize(t,r){const e=this.autoSizeColumns[r][t];return e?Ar(this.providers.dataProvider.stores,((t,r)=>{const n=Ar(r.store.get("items"),((t,n,i)=>{const o=ue(r.store,i);return Math.max(t||0,this.getLength(o[e.prop]))}),0);return Math.max(t,n)}),e.size||0):0}columnSet(t){var r;for(let e of he){const n=e,i=t[n];for(let t in i)(i[t].autoSize||(null===(r=this.config)||void 0===r?void 0:r.allColumns))&&(this.autoSizeColumns||(this.autoSizeColumns={}),this.autoSizeColumns[n]||(this.autoSizeColumns[n]={}),this.autoSizeColumns[n][t]=Object.assign(Object.assign({},i[t]),{index:parseInt(t,10)}))}this.dataResolve&&(this.dataResolve(this.autoSizeColumns),this.clearPromise())}clearPromise(){this.dataResolve=null,this.dataReject=null}isRangeEdit(t){return!!t.data}initiatePresizeElement(){const t={position:"absolute",fontSize:"14px",height:"0",width:"0",whiteSpace:"nowrap",top:"0",overflowX:"scroll"},r=document.createElement("div");for(let e in t)r.style[e]=t[e];return r.classList.add("revo-test-container"),r}destroy(){var t;super.destroy(),null===(t=this.precsizeCalculationArea)||void 0===t||t.remove()}}const He=(t,r)=>void 0===t||null===t&&!r||("string"!=typeof t&&(t=JSON.stringify(t)),t.toLocaleLowerCase()===r),Ze=(t,r)=>!He(t,r);Ze.extra="input",He.extra="input";const Be=function(t,r){let e;return"number"==typeof t&&(e=parseFloat(null==r?void 0:r.toString()),t>e)};Be.extra="input";const Ne=function(t,r){return He(t,r)||Be(t,r)};Ne.extra="input";const We=function(t,r){let e;return"number"==typeof t&&(e=parseFloat(null==r?void 0:r.toString()),t<e)};We.extra="input";const Ve=function(t,r){return He(t,r)||We(t,r)};Ve.extra="input";const Ge=t=>!(""===t||null==t),qe=(t,r)=>!(!t||r&&("string"!=typeof t&&(t=JSON.stringify(t)),"string"!=typeof r&&(r=JSON.stringify(r)),0!==t.toLocaleLowerCase().indexOf(r.toLocaleLowerCase())));qe.extra="input";const Ke=(t,r)=>!!t&&(!r||("string"!=typeof t&&(t=JSON.stringify(t)),t.toLocaleLowerCase().indexOf(r.toString().toLowerCase())>-1)),Xe=(t,r)=>!Ke(t,r);Xe.extra="input",Ke.extra="input";const Je={none:"None",empty:"Not set",notEmpty:"Set",eq:"Equal",notEq:"Not equal",begins:"Begins with",contains:"Contains",notContains:"Does not contain",eqN:"=",neqN:"!=",gt:">",gte:">=",lt:"<",lte:"<="},Ye={none:()=>!0,empty:t=>!Ge(t),notEmpty:Ge,eq:He,notEq:Ze,begins:qe,contains:Ke,notContains:Xe,eqN:He,neqN:Ze,gt:Be,gte:Ne,lt:We,lte:Ve},Qe={string:["notEmpty","empty","eq","notEq","begins","contains","notContains"],number:["notEmpty","empty","eqN","neqN","gt","gte","lt","lte"]};class tn extends ge{constructor(t,r,n){super(t),this.revogrid=t,this.filterCollection={},this.possibleFilters=Object.assign({},Qe),this.possibleFilterNames=Object.assign({},Je),this.possibleFilterEntities=Object.assign({},Ye),n&&this.initConfig(n),this.addEventListener("headerclick",(t=>this.headerclick(t))),this.addEventListener("aftersourceset",(()=>{Object.keys(this.filterCollection).length&&this.filterByProps(this.filterCollection)})),this.revogrid.registerVNode([e("revogr-filter-panel",{uuid:`filter-${r}`,filterNames:this.possibleFilterNames,filterEntities:this.possibleFilterEntities,onFilterChange:t=>this.onFilterChange(t.detail),ref:t=>this.pop=t})])}initConfig(t){if(t.collection&&(this.filterCollection=Object.assign({},t.collection)),t.customFilters)for(let r in t.customFilters){const e=t.customFilters[r];this.possibleFilters[e.columnFilterType]||(this.possibleFilters[e.columnFilterType]=[]),this.possibleFilters[e.columnFilterType].push(r),this.possibleFilterEntities[r]=e.func,this.possibleFilterNames[r]=e.name}if(t.include){const r={};for(let e in this.possibleFilters){const n=this.possibleFilters[e].filter((r=>t.include.indexOf(r)>-1));n.length&&(r[e]=n)}Object.keys(r).length>0&&(this.possibleFilters=r)}}async headerclick(t){var r;const e=null===(r=t.detail.originalEvent)||void 0===r?void 0:r.target;if(!u(e))return;t.preventDefault();const n=await this.pop.getChanges();if(n&&(null==n?void 0:n.prop)===t.detail.prop)return void this.pop.show();const i=this.revogrid.getBoundingClientRect(),o=e.getBoundingClientRect(),s=t.detail.prop;this.pop.filterTypes=this.getColumnFilter(t.detail.filter),this.pop.show(Object.assign(Object.assign({},this.filterCollection[s]),{x:o.x-i.x,y:o.y-i.y+o.height,prop:s}))}getColumnFilter(t){let r="string";if(!t)return{[r]:this.possibleFilters[r]};if(this.isValidType(t))r=t;else if("object"==typeof t&&t.length)return t.reduce(((t,r)=>(this.isValidType(r)&&(t[r]=this.possibleFilters[r]),t)),{});return{[r]:this.possibleFilters[r]}}isValidType(t){return!("string"!=typeof t||!this.possibleFilters[t])}async onFilterChange(t){this.filterByProps({[t.prop]:t})}async filterByProps(t,r=!1){r&&(this.filterCollection={});for(const r in t){const{type:e,value:n}=t[r];"none"===e?delete this.filterCollection[r]:this.filterCollection[r]={filter:this.possibleFilterEntities[e],value:n,type:e}}await this.runFiltering()}async doFiltering(t,r,e){const n=[];e.forEach((r=>{const e=Object.assign({},r),i=t[e.prop];e[a]&&!i&&(delete e[a],n.push(e)),!e[a]&&i&&(n.push(e),e[a]=!0)}));const i=this.getRowFilter(r,t),{defaultPrevented:o,detail:s}=this.emit("beforefiltertrimmed",{collection:t,itemsToFilter:i,source:r});o||(await this.revogrid.addTrimmed(s.itemsToFilter,"filter")).defaultPrevented||(await this.revogrid.updateColumns(n),this.emit("afterFilterApply"))}async clearFiltering(){this.filterCollection={},await this.runFiltering()}async runFiltering(){const{source:t,columns:r}=await this.getData(),{defaultPrevented:e,detail:n}=this.emit("beforefilterapply",{collection:this.filterCollection,source:t,columns:r});e||this.doFiltering(n.collection,n.source,n.columns)}async getData(){return{source:await this.revogrid.getSource(),columns:await this.revogrid.getColumns()}}getRowFilter(t,r){const e={};return t.forEach(((t,n)=>{for(const i in r){const o=r[i];(0,o.filter)(t[i],o.value)||(e[n]=!0)}})),e}}var rn=function(t){return"string"==typeof t||!D(t)&&O(t)&&"[object String]"==z(t)},en=Or("length"),nn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),on="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",sn="\\ud83c[\\udffb-\\udfff]",un="[^\\ud800-\\udfff]",an="(?:\\ud83c[\\udde6-\\uddff]){2}",cn="[\\ud800-\\udbff][\\udc00-\\udfff]",ln="(?:"+on+"|"+sn+")?",hn="[\\ufe0e\\ufe0f]?"+ln+"(?:\\u200d(?:"+[un,an,cn].join("|")+")[\\ufe0e\\ufe0f]?"+ln+")*",fn="(?:"+[un+on+"?",on,an,cn,"[\\ud800-\\udfff]"].join("|")+")",dn=RegExp(sn+"(?="+sn+")|"+fn+hn,"g"),gn=function(t){return function(t){return nn.test(t)}(t)?function(t){for(var r=dn.lastIndex=0;dn.test(t);)++r;return r}(t):en(t)},vn=function(t){if(null==t)return 0;if(rt(t))return rn(t)?gn(t):t.length;var r=Qt(t);return"[object Map]"==r||"[object Set]"==r?t.size:Y(t).length};class pn extends ge{constructor(t){super(t),this.revogrid=t,this.sorting=null,this.sortingFunc=null,this.addEventListener("beforesourceset",(({detail:t})=>{if(this.hasSorting&&this.emit("beforesourcesortingapply").defaultPrevented)return;const r=this.setData(t.source,t.type);r&&(t.source=r)})),this.addEventListener("aftercolumnsset",(async({detail:{order:t}})=>{const r=await this.revogrid.getColumns(),e={};for(let n in t){const i=pe.getColumnByProp(r,n),o=(null==i?void 0:i.cellCompare)||this.defaultCellCompare;e[n]="desc"==t[n]?this.descCellCompare(o):o}this.sort(t,e)})),this.addEventListener("initialHeaderClick",(async t=>{var r,e;t.defaultPrevented||t.detail.column.sortable&&this.headerclick(t.detail.column,t.detail.index,null===(e=null===(r=t.detail)||void 0===r?void 0:r.originalEvent)||void 0===e?void 0:e.shiftKey)}))}get hasSorting(){return!!this.sorting}async headerclick(t,r,e){let n=this.getNextOrder(t.order);const i=this.emit("beforesorting",{column:t,order:n,additive:e});if(i.defaultPrevented)return;n=i.detail.order;const o=await this.revogrid.updateColumnSorting(i.detail.column,r,n,e),s=this.emit("beforesortingapply",{column:o,order:n,additive:e});if(s.defaultPrevented)return;n=s.detail.order;const u=(null==t?void 0:t.cellCompare)||this.defaultCellCompare,a="asc"==n?u:"desc"==n?this.descCellCompare(u):void 0;if(e&&this.sorting){const r={},e={};Object.assign(r,this.sorting),Object.assign(e,this.sortingFunc),t.prop in r&&vn(r)>1&&void 0===n?(delete r[t.prop],delete e[t.prop]):(r[t.prop]=n,e[t.prop]=a),this.sort(r,e)}else this.sort({[t.prop]:n},{[t.prop]:a})}setData(t,r){if("rgRow"===r&&this.sortingFunc)return this.sortItems(t,this.sortingFunc)}async sort(t,r){if(!vn(t))return this.sorting=null,void(this.sortingFunc=null);this.sorting=t,this.sortingFunc=r;const e=await this.revogrid.getSourceStore(),n=e.get("source"),i=this.sortIndexByItems([...e.get("proxyItems")],n,this.sortingFunc);ie(e,{proxyItems:i,source:[...n]}),this.emit("afterSortingApply")}defaultCellCompare(t,r,e){var n,i;const o=null===(n=r[t])||void 0===n?void 0:n.toString().toLowerCase(),s=null===(i=e[t])||void 0===i?void 0:i.toString().toLowerCase();return o==s?0:o>s?1:-1}descCellCompare(t){return(r,e,n)=>-1*t(r,e,n)}sortIndexByItems(t,r,e){for(let r in e)if(void 0===e[r])return[...Array(t.length).keys()];return t.sort(((t,n)=>{let i=0;for(let o in e)if(i=(0,e[o])(o,r[t],r[n]),i)break;return i}))}sortItems(t,r){return t.sort(((t,e)=>{let n=0;for(let i in r)if(n=(0,r[i])(i,t,e),n)break;return n}))}getNextOrder(t){switch(t){case void 0:return"asc";case"asc":return"desc";case"desc":return}}}var Cn=function(t,r,e,n){var i=t.length;for((e=Gr(e))<0&&(e=-e>i?0:i+e),(n=void 0===n||n>i?i:Gr(n))<0&&(n+=i),n=e>n?0:function(t){return t?(r=Gr(t),e=0,n=4294967295,r==r&&(void 0!==n&&(r=r<=n?r:n),void 0!==e&&(r=r>=e?r:e)),r):0;var r,e,n}(n);e<n;)t[e++]=r;return t};const wn="grid-uuid";function Ln(t,r,{prevExpanded:e,expandedAll:n}){const i=function(t,r){const e=[],n={};return t.forEach(((t,i)=>{const o=JSON.stringify(r(t));n[o]||(n[o]=new Map,e.push({children:n[o],id:o})),n[o].set(i,t)})),e}(t,r),o=[],s={};let u=0,a=0;const c={},l={};return i.forEach((t=>{const r=xn(t.id);if(!r)return;let i=0,h=!!n,f=h;const d=[];r.reduce(((r,l)=>{r.push(l);const g=r.join(",");if(!s[g]){if(f=n||e&&e[g],o.push(function(t,r,e,n,i=!1){return{"__rvgr-name":t,"__rvgr-depth":e,"__rvgr-id":n,"__rvgr-value":r,"__rvgr-expanded":i}}(l,g,i,t.id,f)),i&&!f&&!h){const t=r.slice(0,r.length-1);e&&t.length&&e[t.join(",")]||(c[u]=!0)}u++,s[g]=d}return i++,a=i,r}),[]),t.children.forEach(((t,r)=>{f||h||(c[u]=!0),o.push(t),l[r]=u,d.push(u),u++}))})),{sourceWithGroups:o,depth:a,trimmed:c,oldNewIndexMap:l,childrenByGroup:s}}function mn(t){return t&&void 0!==t["__rvgr-name"]}function bn(t){return t&&void 0!==t["__rvgr-column"]}function xn(t){const r=JSON.parse(t);return void 0===r.push?null:r}function yn(t,r,e){const n=xn(e["__rvgr-id"]);if(!n)return!1;const i=function(t,r){const e=t.length;let n=0;for(;n<e;n++)if(t[n]!==r[n])return n;return n}(t,n);return r["__rvgr-depth"]<i}const kn={mime:"text/csv",fileKind:"csv",bom:!0,columnDelimiter:",",rowDelimiter:"\r\n",encoding:""},En=String.fromCharCode(13),Sn=String.fromCharCode(10),jn=String.fromCharCode(34),Rn=String.fromCharCode(65279),zn=new RegExp('"',"g");class On{constructor(t={}){this.options=Object.assign(Object.assign({},kn),t)}doExport({data:t,headers:r,props:e}){let n=this.options.bom?Rn:"";return(null==r?void 0:r.length)>0&&r.forEach((t=>{t.length&&(n+=this.prepareHeader(t,this.options.columnDelimiter),n+=this.options.rowDelimiter)})),t.forEach(((t,r)=>{r>0&&(n+=this.options.rowDelimiter),mn(t)?n+=this.parseCell(function(t){return t&&t["__rvgr-name"]}(t),this.options.columnDelimiter):n+=e.map((r=>this.parseCell(t[r],this.options.columnDelimiter))).join(this.options.columnDelimiter)})),n}prepareHeader(t,r){let e="";return e+=t.map((t=>this.parseCell(t,r,!0))).join(r),e}parseCell(t,r,e=!1){let n=t;return"string"!=typeof t&&(n=JSON.stringify(t)),void 0===n?"":""!==n&&(e||[En,jn,Sn,r].some((t=>n.indexOf(t)>=0)))?`"${n.replace(zn,'""')}"`:n}}var Mn;!function(t){t.csv="csv"}(Mn||(Mn={}));class Fn extends ge{async exportString(t={},r=Mn.csv){const e=await this.beforeexport();return e?this.formatter(r,t).doExport(e):null}async exportBlob(t={},r=Mn.csv){return await this.getBlob(this.formatter(r,t))}async exportFile(t={},r=Mn.csv){const e=this.formatter(r,t),n=await this.getBlob(e),i=window.URL||window.webkitURL,o=document.createElement("a"),{filename:s,fileKind:u}=e.options,a=`${s}.${u}`,c=i.createObjectURL(n);o.style.display="none",o.setAttribute("href",c),o.setAttribute("download",a),this.revogrid.appendChild(o),o.dispatchEvent(new MouseEvent("click")),this.revogrid.removeChild(o),await Se(120),i.revokeObjectURL(c)}async getBlob(t){const r=`${t.options.mime};charset=${t.options.encoding}`;if("undefined"!=typeof Blob){const e=await this.beforeexport();return e?new Blob([t.doExport(e)],{type:r}):null}return null}async beforeexport(){let t=await this.getData();const r=this.emit("beforeexport",{data:t});return r.defaultPrevented?null:r.detail.data}async getData(){const t=await this.getSource(),r=[],e=[];he.forEach(((t,n)=>{e.push(this.getColPerSource(t).then((t=>r[n]=t)))})),await Promise.all(e);const n={headers:[],props:[]};for(let t of r)t.headers.forEach(((t,r)=>{n.headers[r]||(n.headers[r]=[]),n.headers[r].push(...t)})),n.props.push(...t.props);return Object.assign({data:t},n)}async getColPerSource(t){const r=await this.revogrid.getColumnStore(t),e=r.get("source"),n=r.get("items"),i=r.get("groupingDepth"),o=r.get("groups"),s=[],u=[],a=n.reduce(((t,r,n)=>{const i=e[r].prop;return s.push(e[r].name||""),u.push(i),t[i]=n,t}),{}),c=this.getGroupHeaders(i,o,n,a);return c.push(s),{headers:c,props:u}}getGroupHeaders(t,r,e,n){const i=[],o=(s=new Array(e.length),u="",(l=null==s?0:s.length)?(a&&"number"!=typeof a&&ee(s,u,a)&&(a=0,c=l),Cn(s,u,a,c)):[]);var s,u,a,c,l;for(let e=0;e<t;e++){const t=[...o];(i.push(t),r[e])&&r[e].forEach((r=>{const e=this.findGroupStartIndex(r.ids,n);"number"==typeof e&&(t[e]=r.name)}))}return i}findGroupStartIndex(t,r){let e;return t.forEach((t=>{const n=r[t];"number"==typeof n&&("number"!=typeof e||e>n)&&(e=n)})),e}async getSource(){const t=[],r=[];return le.forEach((e=>{const n=[];t.push(n);const i=this.revogrid.getVisibleSource(e).then((t=>n.push(...t)));r.push(i)})),await Promise.all(r),t.reduce(((t,r)=>(t.push(...r),t)),[])}formatter(t,r={}){switch(t){case Mn.csv:return new On(r);default:throw new Error("Unknown format")}}}class _n extends ge{constructor(t,r){super(t),this.revogrid=t,this.providers=r}get hasProps(){var t,r,e;return(null===(t=this.options)||void 0===t?void 0:t.props)&&(null===(e=null===(r=this.options)||void 0===r?void 0:r.props)||void 0===e?void 0:e.length)}get store(){return this.providers.dataProvider.stores.rgRow.store}get rowItems(){return this.store.get("items")}get trimmed(){return this.store.get("trimmed")}onFocus(t){mn(t.detail.model)&&t.preventDefault()}onExpand({virtualIndex:t}){const{source:r}=this.getSource();let e=this.trimmed.grouping,n=function(t,r){return t.get("items")[r]}(this.store,t);if(r[n]["__rvgr-expanded"]){const{trimmed:t}=function(t,r){const e=r[t],n=e["__rvgr-id"],i={};let o=t+1;const s=r.length;for(;o<s;){const t=r[o];if(mn(t)){if(n!==t["__rvgr-id"])break;t["__rvgr-expanded"]=!1}i[o++]=!0}return e["__rvgr-expanded"]=!1,{trimmed:i}}(n,r);e=Object.assign(Object.assign({},e),t),this.revogrid.clearFocus()}else{const{trimmed:n,items:i}=function(t,r,e){const n=e[t],i=r[n],o=xn(i["__rvgr-id"]),s={};if(!o)return{trimmed:s};const u=[];i["__rvgr-expanded"]=!0;let a=n+1;const c=r.length;let l=0;for(;a<c;){const t=r[a],e=mn(t);if(e){if(!yn(o,i,t))break;l||(l=t["__rvgr-depth"])}(!l||e&&l===t["__rvgr-depth"])&&(s[a]=!1,u.push(a)),a++}const h={trimmed:s};if(u.length){const r=[...e];r.splice(t+1,0,..