UNPKG

visual-grid

Version:
1 lines 63.6 kB
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VisualJS={})}(this,(function(e){var t,n;class s{}class i extends s{}class o extends s{isPopup(){return!1}}class r{}var l,a,u,h,c,d,p,f={},_=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function v(e){var t=e.parentNode;t&&t.removeChild(e)}function y(e,t,n){var s,i,o,r={};for(o in t)"key"==o?s=t[o]:"ref"==o?i=t[o]:r[o]=t[o];if(arguments.length>2&&(r.children=arguments.length>3?l.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===r[o]&&(r[o]=e.defaultProps[o]);return C(e,r,s,i,null)}function C(e,t,n,s,i){var o={type:e,props:t,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==i?++u:i};return null!=a.vnode&&a.vnode(o),o}function w(e){return e.children}function b(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?x(e):null}function R(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return R(e)}}function E(e){(!e.__d&&(e.__d=!0)&&h.push(e)&&!M.__r++||d!==a.debounceRendering)&&((d=a.debounceRendering)||c)(M)}function M(){for(var e;M.__r=h.length;)e=h.sort((function(e,t){return e.__v.__b-t.__v.__b})),h=[],e.some((function(e){var t,n,s,i,o,r;e.__d&&(o=(i=(t=e).__v).__e,(r=t.__P)&&(n=[],(s=g({},i)).__v=i.__v+1,D(r,i,s,t.__n,void 0!==r.ownerSVGElement,null!=i.__h?[o]:null,n,null==o?x(i):o,i.__h),z(n,i),i.__e!=o&&R(i)))}))}function k(e,t,n,s,i,o,r,l,a,u){var h,c,d,p,m,g,v,y=s&&s.__k||_,b=y.length;for(n.__k=[],h=0;h<t.length;h++)if(null!=(p=n.__k[h]=null==(p=t[h])||"boolean"==typeof p?null:"string"==typeof p||"number"==typeof p||"bigint"==typeof p?C(null,p,null,null,p):Array.isArray(p)?C(w,{children:p},null,null,null):p.__b>0?C(p.type,p.props,p.key,null,p.__v):p)){if(p.__=n,p.__b=n.__b+1,null===(d=y[h])||d&&p.key==d.key&&p.type===d.type)y[h]=void 0;else for(c=0;c<b;c++){if((d=y[c])&&p.key==d.key&&p.type===d.type){y[c]=void 0;break}d=null}D(e,p,d=d||f,i,o,r,l,a,u),m=p.__e,(c=p.ref)&&d.ref!=c&&(v||(v=[]),d.ref&&v.push(d.ref,null,p),v.push(c,p.__c||m,p)),null!=m?(null==g&&(g=m),"function"==typeof p.type&&null!=p.__k&&p.__k===d.__k?p.__d=a=S(p,a,e):a=L(e,p,d,y,m,a),u||"option"!==n.type?"function"==typeof n.type&&(n.__d=a):e.value=""):a&&d.__e==a&&a.parentNode!=e&&(a=x(d))}for(n.__e=g,h=b;h--;)null!=y[h]&&("function"==typeof n.type&&null!=y[h].__e&&y[h].__e==n.__d&&(n.__d=x(s,h+1)),H(y[h],y[h]));if(v)for(h=0;h<v.length;h++)$(v[h],v[++h],v[++h])}function S(e,t,n){var s,i;for(s=0;s<e.__k.length;s++)(i=e.__k[s])&&(i.__=e,t="function"==typeof i.type?S(i,t,n):L(n,i,i,e.__k,i.__e,t));return t}function O(e,t){return t=t||[],null==e||"boolean"==typeof e||(Array.isArray(e)?e.some((function(e){O(e,t)})):t.push(e)),t}function L(e,t,n,s,i,o){var r,l,a;if(void 0!==t.__d)r=t.__d,t.__d=void 0;else if(null==n||i!=o||null==i.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(i),r=null;else{for(l=o,a=0;(l=l.nextSibling)&&a<s.length;a+=2)if(l==i)break e;e.insertBefore(i,o),r=o}return void 0!==r?r:i.nextSibling}function N(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function I(e,t,n,s,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof s&&(e.style.cssText=s=""),s)for(t in s)n&&t in n||N(e.style,t,"");if(n)for(t in n)s&&n[t]===s[t]||N(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?s||e.addEventListener(t,o?V:P,o):e.removeEventListener(t,o?V:P,o);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(r){}"function"==typeof n||(null!=n&&(!1!==n||"a"===t[0]&&"r"===t[1])?e.setAttribute(t,n):e.removeAttribute(t))}}function P(e){this.l[e.type+!1](a.event?a.event(e):e)}function V(e){this.l[e.type+!0](a.event?a.event(e):e)}function D(e,t,n,s,i,o,r,u,h){var c,d,p,_,m,y,C,R,E,M,S,O=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(h=n.__h,u=t.__e=n.__e,t.__h=null,o=[u]),(c=a.__b)&&c(t);try{e:if("function"==typeof O){if(R=t.props,E=(c=O.contextType)&&s[c.__c],M=c?E?E.props.value:c.__:s,n.__c?C=(d=t.__c=n.__c).__=d.__E:("prototype"in O&&O.prototype.render?t.__c=d=new O(R,M):(t.__c=d=new b(R,M),d.constructor=O,d.render=j),E&&E.sub(d),d.props=R,d.state||(d.state={}),d.context=M,d.__n=s,p=d.__d=!0,d.__h=[]),null==d.__s&&(d.__s=d.state),null!=O.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=g({},d.__s)),g(d.__s,O.getDerivedStateFromProps(R,d.__s))),_=d.props,m=d.state,p)null==O.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==O.getDerivedStateFromProps&&R!==_&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(R,M),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(R,d.__s,M)||t.__v===n.__v){d.props=R,d.state=d.__s,t.__v!==n.__v&&(d.__d=!1),d.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),d.__h.length&&r.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(R,d.__s,M),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(_,m,y)}))}d.context=M,d.props=R,d.state=d.__s,(c=a.__r)&&c(t),d.__d=!1,d.__v=t,d.__P=e,c=d.render(d.props,d.state,d.context),d.state=d.__s,null!=d.getChildContext&&(s=g(g({},s),d.getChildContext())),p||null==d.getSnapshotBeforeUpdate||(y=d.getSnapshotBeforeUpdate(_,m)),S=null!=c&&c.type===w&&null==c.key?c.props.children:c,k(e,Array.isArray(S)?S:[S],t,n,s,i,o,r,u,h),d.base=t.__e,t.__h=null,d.__h.length&&r.push(d),C&&(d.__E=d.__=null),d.__e=!1}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,s,i,o,r,a){var u,h,c,d=n.props,p=t.props,_=t.type,m=0;if("svg"===_&&(i=!0),null!=o)for(;m<o.length;m++)if((u=o[m])&&(u===e||(_?u.localName==_:3==u.nodeType))){e=u,o[m]=null;break}if(null==e){if(null===_)return document.createTextNode(p);e=i?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,p.is&&p),o=null,a=!1}if(null===_)d===p||a&&e.data===p||(e.data=p);else{if(o=o&&l.call(e.childNodes),h=(d=n.props||f).dangerouslySetInnerHTML,c=p.dangerouslySetInnerHTML,!a){if(null!=o)for(d={},m=0;m<e.attributes.length;m++)d[e.attributes[m].name]=e.attributes[m].value;(c||h)&&(c&&(h&&c.__html==h.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,s,i){var o;for(o in n)"children"===o||"key"===o||o in t||I(e,o,null,n[o],s);for(o in t)i&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||I(e,o,t[o],n[o],s)}(e,p,d,i,a),c)t.__k=[];else if(m=t.props.children,k(e,Array.isArray(m)?m:[m],t,n,s,i&&"foreignObject"!==_,o,r,o?o[0]:n.__k&&x(n,0),a),null!=o)for(m=o.length;m--;)null!=o[m]&&v(o[m]);a||("value"in p&&void 0!==(m=p.value)&&(m!==e.value||"progress"===_&&!m)&&I(e,"value",m,d.value,!1),"checked"in p&&void 0!==(m=p.checked)&&m!==e.checked&&I(e,"checked",m,d.checked,!1))}return e}(n.__e,t,n,s,i,o,r,h);(c=a.diffed)&&c(t)}catch(L){t.__v=null,(h||null!=o)&&(t.__e=u,t.__h=!!h,o[o.indexOf(u)]=null),a.__e(L,t,n)}}function z(e,t){a.__c&&a.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(n){a.__e(n,t.__v)}}))}function $(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(s){a.__e(s,n)}}function H(e,t,n){var s,i;if(a.unmount&&a.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||$(s,null,t)),null!=(s=e.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(o){a.__e(o,t)}s.base=s.__P=null}if(s=e.__k)for(i=0;i<s.length;i++)s[i]&&H(s[i],t,"function"!=typeof e.type);n||null==e.__e||v(e.__e),e.__e=e.__d=void 0}function j(e,t,n){return this.constructor(e,n)}function B(e,t){var n,s,i,o,r,u;n=e,s=t,i=B,a.__&&a.__(n,s),r=(o="function"==typeof i)?null:i&&i.__k||s.__k,u=[],D(s,n=(!o&&i||s).__k=y(w,null,[n]),r||f,f,void 0!==s.ownerSVGElement,!o&&i?[i]:r?null:s.firstChild?l.call(s.childNodes):null,u,!o&&i?i:r?r.__e:s.firstChild,o),z(u,n)}l=_.slice,a={__e:function(e,t){for(var n,s,i;t=t.__;)if((n=t.__c)&&!n.__)try{if((s=n.constructor)&&null!=s.getDerivedStateFromError&&(n.setState(s.getDerivedStateFromError(e)),i=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),i=n.__d),i)return n.__E=n}catch(o){e=o}throw e}},u=0,b.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),E(this))},b.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),E(this))},b.prototype.render=w,h=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,M.__r=0,p=0;const A=(T={__c:F="__cC"+p++,__:void 0,Consumer:function(e,t){return e.children(t)},Provider:function(e){var t,n;return this.getChildContext||(t=[],(n={})[F]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&t.some(E)},this.sub=function(e){t.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){t.splice(t.indexOf(e),1),n&&n.call(e)}}),e.children}}).Provider.__=T.Consumer.contextType=T;var F,T;function U(e){return y(A.Provider,{value:e.grid},e.children)}var W,X,Y,q=0,G=[],K=a.__b,Z=a.__r,J=a.diffed,Q=a.__c,ee=a.unmount;function te(e,t){a.__h&&a.__h(X,e,q||t),q=0;var n=X.__H||(X.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ne(e){return q=1,function(e,t,n){var s=te(W++,2);return s.t=e,s.__c||(s.__=[n?n(t):pe(void 0,t),function(e){var t=s.t(s.__[0],e);s.__[0]!==t&&(s.__=[t,s.__[1]],s.__c.setState({}))}],s.__c=X),s.__}(pe,e)}function se(e,t){var n=te(W++,4);!a.__s&&function(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}(n.__H,t)&&(n.__=e,n.__H=t,X.__h.push(n))}function ie(e){var t=X.context[e.__c],n=te(W++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(X)),t.props.value):e.__}function oe(){G.forEach((function(e){if(e.__P)try{e.__H.__h.forEach(ce),e.__H.__h.forEach(de),e.__H.__h=[]}catch(T){e.__H.__h=[],a.__e(T,e.__v)}})),G=[]}a.__b=function(e){X=null,K&&K(e)},a.__r=function(e){Z&&Z(e),W=0;var t=(X=e.__c).__H;t&&(t.__h.forEach(ce),t.__h.forEach(de),t.__h=[])},a.diffed=function(e){J&&J(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==G.push(t)&&Y===a.requestAnimationFrame||((Y=a.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(s),he&&cancelAnimationFrame(t),setTimeout(e)},s=setTimeout(n,100);he&&(t=requestAnimationFrame(n))})(oe)),X=void 0},a.__c=function(e,t){t.some((function(e){try{e.__h.forEach(ce),e.__h=e.__h.filter((function(e){return!e.__||de(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],a.__e(n,e.__v)}})),Q&&Q(e,t)},a.unmount=function(e){ee&&ee(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(ce)}catch(n){a.__e(n,t.__v)}};var re,le,ae,ue,he="function"==typeof requestAnimationFrame;function ce(e){var t=X;"function"==typeof e.__c&&e.__c(),X=t}function de(e){var t=X;e.__c=e.__(),X=t}function pe(e,t){return"function"==typeof t?t(e):t}(le=re||(re={}))[le.Left=0]="Left",le[le.Middle=1]="Middle",le[le.Right=2]="Right",(ue=ae||(ae={})).clean=function(e){e.innerHTML=""},ue.appendClassName=function(e,t){const n=e.className.split(" ");-1===n.findIndex((e=>e===t))&&(n.push(t),e.className=n.join(" "))},ue.removeClassName=function(e,t){const n=e.className.split(" "),s=n.findIndex((e=>e===t));-1!==s&&(n.splice(s,1),e.className=n.join(" "))},ue.setClassNames=function(e,t){e.className=ye(t)},ue.isInViewport=function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)};const fe="undefined"==typeof navigator?void 0:navigator,_e=null==fe?void 0:fe.clipboard,me=null==(t=null==_e?void 0:_e.readText)?void 0:t.bind(_e),ge=null==(n=null==_e?void 0:_e.writeText)?void 0:n.bind(_e);function ve(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function ye(e){if(Array.isArray(e))return e.join(" ");if("object"==typeof e){const t=[];for(let n in e)!0===e[n]&&t.push(n);return t.join(" ")}return e}function Ce(e,t,n,s){const i={state:t(e.getState(),s),getState:()=>i.state,cancel:()=>{}};return i.cancel=e.subscribeAny((()=>{const o=t(e.getState(),s);(function(e,t){if(ve(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(let i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(t,n[i])||!ve(e[n[i]],t[n[i]]))return!1;return!0})(o,i.state)||(i.state=o,n(i.state))})),i}function we(e,t){return function(n){return function(s){const i=ie(A),[o,r]=ne(e(i.getState(),{grid:i,props:s})),l=t?t(i):void 0;return se((()=>Ce(i.api(),e,(e=>{r(e)}),{grid:i,props:s}).cancel),[]),y(n,__spreadValues(__spreadValues(__spreadValues({},o),s),l))}}}function be(e){return function(t){const n=ie(A);return y(e,__spreadValues({grid:n},t))}}class xe extends b{constructor(){super(...arguments),this.refs={}}createRef(e){const t={current:null};return this.refs[e]=t,t}}var Re="v-grid-list-container",Ee="v-grid-list-view";class Me extends xe{constructor(e){super(e),this.timer=null,this.componentDidMount=()=>{this.update(),this.io.observe(this.refs.start.current),this.io.observe(this.refs.end.current)},this.componentWillUnmount=()=>{this.io.disconnect()},this.update=()=>{this.setState({})},this.handleScroll=()=>{clearTimeout(this.timer),setTimeout(this.update,100)},this.io=new IntersectionObserver((e=>{this.update()}))}render(){var e,t;const n=this.props.items.length*this.props.itemHeight,s=null==(e=this.refs.container)?void 0:e.current.clientHeight,i=null==(t=this.refs.container)?void 0:t.current.scrollTop,o=this.props.itemHeight,r=Math.ceil(s/o),l=Math.floor(i/o),a=l+r,u=Math.max(0,l-this.props.preLoadCount),h=Math.min(this.props.items.length,a+this.props.preLoadCount),c=u*o;return y("div",{ref:this.createRef("container"),className:Re,onScroll:this.handleScroll},y("div",{style:{height:n}}),y("div",{style:{top:c},className:Ee},y("div",{ref:this.createRef("start")}),this.props.render(this.props.items.slice(u,h)),y("div",{ref:this.createRef("end")})))}}function ke(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var s in t)if("__source"!==s&&e[s]!==t[s])return!0;return!1}function Se(e){this.props=e}(Se.prototype=new b).isPureReactComponent=!0,Se.prototype.shouldComponentUpdate=function(e,t){return ke(this.props,e)||ke(this.state,t)};var Oe=a.__b;a.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Oe&&Oe(e)};var Le=a.__e;a.__e=function(e,t,n){if(e.then)for(var s,i=t;i=i.__;)if((s=i.__c)&&s.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),s.__c(e,t);Le(e,t,n)};var Ne=a.unmount;function Ie(){this.__u=0,this.t=null,this.__b=null}function Pe(e){var t=e.__.__c;return t&&t.__e&&t.__e(e)}function Ve(){this.u=null,this.o=null}a.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&!0===e.__h&&(e.type=null),Ne&&Ne(e)},(Ie.prototype=new b).__c=function(e,t){var n=t.__c,s=this;null==s.t&&(s.t=[]),s.t.push(n);var i=Pe(s.__v),o=!1,r=function(){o||(o=!0,n.__R=null,i?i(l):l())};n.__R=r;var l=function(){if(!--s.__u){if(s.state.__e){var e=s.state.__e;s.__v.__k[0]=function e(t,n,s){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return e(t,n,s)})),t.__c&&t.__c.__P===n&&(t.__e&&s.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=s)),t}(e,e.__c.__P,e.__c.__O)}var t;for(s.setState({__e:s.__b=null});t=s.t.pop();)t.forceUpdate()}},a=!0===t.__h;s.__u++||a||s.setState({__e:s.__b=s.__v.__k[0]}),e.then(r,r)},Ie.prototype.componentWillUnmount=function(){this.t=[]},Ie.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),s=this.__v.__k[0].__c;this.__v.__k[0]=function e(t,n,s){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),t.__c.__H=null),null!=(t=function(e,t){for(var n in t)e[n]=t[n];return e}({},t)).__c&&(t.__c.__P===s&&(t.__c.__P=n),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return e(t,n,s)}))),t}(this.__b,n,s.__O=s.__P)}this.__b=null}var i=t.__e&&y(w,null,e.fallback);return i&&(i.__h=null),[y(w,null,t.__e?null:e.children),i]};var De=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};(Ve.prototype=new b).__e=function(e){var t=this,n=Pe(t.__v),s=t.o.get(e);return s[0]++,function(i){var o=function(){t.props.revealOrder?(s.push(i),De(t,e,s)):i()};n?n(o):o()}},Ve.prototype.render=function(e){this.u=null,this.o=new Map;var t=O(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Ve.prototype.componentDidUpdate=Ve.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){De(e,n,t)}))};var ze="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,$e=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,He=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(e)};b.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(b.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var je=a.event;function Be(){}function Ae(){return this.cancelBubble}function Fe(){return this.defaultPrevented}a.event=function(e){return je&&(e=je(e)),e.persist=Be,e.isPropagationStopped=Ae,e.isDefaultPrevented=Fe,e.nativeEvent=e};var Te={configurable:!0,get:function(){return this.class}},Ue=a.vnode;a.vnode=function(e){var t=e.type,n=e.props,s=n;if("string"==typeof t){for(var i in s={},n){var o=n[i];"value"===i&&"defaultValue"in n&&null==o||("defaultValue"===i&&"value"in n&&null==n.value?i="value":"download"===i&&!0===o?o="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!He(n.type)?i="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(i)?i=i.toLowerCase():$e.test(i)?i=i.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===o&&(o=void 0),s[i]=o)}"select"==t&&s.multiple&&Array.isArray(s.value)&&(s.value=O(n.children).forEach((function(e){e.props.selected=-1!=s.value.indexOf(e.props.value)}))),"select"==t&&null!=s.defaultValue&&(s.value=O(n.children).forEach((function(e){e.props.selected=s.multiple?-1!=s.defaultValue.indexOf(e.props.value):s.defaultValue==e.props.value}))),e.props=s}t&&n.class!=n.className&&(Te.enumerable="className"in n,null!=n.className&&(s.class=n.className),Object.defineProperty(s,"className",Te)),e.$$typeof=ze,Ue&&Ue(e)};var We=a.__r;a.__r=function(e){We&&We(e)};class Xe extends Se{constructor(){super(...arguments),this.refs={}}createRef(e){const t={current:null};return this.refs[e]=t,t}}var Ye="v-grid-header-column",qe="v-grid-column-resize-holder";var Ge=we(((e,{props:t})=>({options:e.column.columns[t.value]})))(class extends Xe{constructor(){super(...arguments),this.handleMouseDown=e=>{this.props.onResize&&this.props.onResize(this.options.field,this.refs.column.current.offsetWidth,e)}}get options(){return this.props.options}render(){const e={width:this.options.width};return this.options.flex&&(e.flexGrow=this.options.flex),y("div",{ref:this.createRef("column"),className:Ye,style:e},y("span",null,this.options.headerName),void 0===this.options.flex&&this.options.resizable&&y("div",{ref:this.createRef("resizer"),onMouseDown:this.handleMouseDown,className:qe}))}});var Ke="v-grid-cell",Ze="v-grid-cell-content",Je="v-grid-cell-editing",Qe="v-grid-cell-selected",et="v-grid-cell-filling",tt="v-grid-cell-filling-left-boundary",nt="v-grid-cell-filling-right-boundary",st="v-grid-cell-filling-top-boundary",it="v-grid-cell-filling-bottom-boundary",ot="v-grid-cell-left-boundary",rt="v-grid-cell-right-boundary",lt="v-grid-cell-top-boundary",at="v-grid-cell-bottom-boundary",ut="v-grid-cell-editing-wrapper",ht="v-grid-cell-editing-popup",ct="v-grid-cell-fill-handler";var dt=we(((e,{grid:t,props:n})=>{const s=e.column.columns[n.column],i=null==s?void 0:s.readonly,o=i?void 0:t.getSelectBoundary(n.row,n.column),r=i?void 0:t.getFillingBoundary(n.row,n.column);return{rawValue:t.getRawCellValue(n.row,n.column),isSelected:void 0!==o,isLeftSelected:o&&o.left,isRightSelected:o&&o.right,isTopSelected:o&&o.top,isBottomSelected:o&&o.bottom,isFilling:void 0!==r,isLeftFilling:r&&r.left,isRightFilling:r&&r.right,isTopFilling:r&&r.top,isBottomFilling:r&&r.bottom,options:s,fillable:e.grid.fillable}}))(be(class extends Xe{constructor(e){super(e),this.cell={current:null},this.cellContent={current:null},this.isEditing=!1,this.timer=null,this.componentDidMount=()=>{this.io.observe(this.cell.current),this.options.cellEditor&&!this.options.readonly&&(this.unsubscribeEditing=this.props.grid.store("cell").subscribeAny((()=>{const e=this.props.grid.state("cell").editing,t=Boolean(e&&e.row===this.props.row&&e.column===this.props.column);this.isEditing!==t&&(this.isEditing=t,this.handleCellEditing())})))},this.componentWillUnmount=()=>{this.unsubscribeEditing&&this.unsubscribeEditing(),this.io.disconnect(),this.timer&&(clearTimeout(this.timer),this.timer=null)},this.componentDidUpdate=()=>{this.doRender()},this.handleMouseDown=e=>{this.isEditing||this.props.onMouseDown&&this.props.onMouseDown(e,this.props.row,this.props.column)},this.handleMouseMove=e=>{this.isEditing||this.props.onMouseMove&&this.props.onMouseMove(e,this.props.row,this.props.column)},this.handleMouseUp=e=>{this.isEditing||this.props.onMouseUp&&this.props.onMouseUp(e,this.props.row,this.props.column)},this.handleDbClick=e=>{this.props.onDbClick&&this.props.onDbClick(e,this.props.row,this.props.column)},this.handleFillerMouseDown=e=>{e.stopPropagation(),this.props.onFillerMouseDown&&this.props.onFillerMouseDown(e,this.props.row,this.props.column)},this.handleCellEditing=()=>{if(!this.isEditing)return void(this.editor&&(ae.setClassNames(this.cellContent.current,[Ze]),this.setValue(this.editor.getValue()),this.doRender()));const e=document.createElement("div");ae.clean(this.cellContent.current),ae.appendClassName(this.cellContent.current,Je),this.editor||(this.editor=new this.options.cellEditor),this.editor.isPopup()?e.className=`${ut} ${ht}`:e.className=ut,this.editor.init&&this.editor.init({props:this.options.cellParams,value:this.getValue(!0),column:this.options,row:this.props.row,gird:this.props.grid}),e.appendChild(this.editor.gui()),this.cellContent.current.appendChild(e),this.editor.afterAttached&&this.editor.afterAttached()},this.io=new IntersectionObserver((e=>{e[0].isIntersecting&&(this.doRender(),this.io.disconnect())}),{threshold:1e-6})}get options(){return this.props.options}getValue(e=!1){return e?this.props.rawValue:this.props.grid.getCellValue(this.props.row,this.props.column)}setValue(e){this.props.grid.setCellValue(this.props.row,this.props.column,e)}doRender(){this.isEditing||(this.timer=setTimeout((()=>{if(this.props.options.cellRender){const e=new this.props.options.cellRender;if(e.init&&e.init({props:this.props.options.cellParams,value:this.getValue(!0),column:this.props.options,row:this.props.row,gird:this.props.grid}),this.timer=null,!this.cellContent.current)return;ae.clean(this.cellContent.current),this.cellContent.current.appendChild(e.gui()),e.afterAttached&&e.afterAttached()}else this.cellContent.current&&(this.cellContent.current.textContent=this.getValue())}),0))}render(){const e=ye({[Ke]:!0,[Qe]:this.props.isSelected,[ot]:this.props.isLeftSelected,[rt]:this.props.isRightSelected,[lt]:this.props.isTopSelected,[at]:this.props.isBottomSelected,[et]:this.props.isFilling,[tt]:this.props.isLeftFilling,[nt]:this.props.isRightFilling,[st]:this.props.isTopFilling,[it]:this.props.isBottomFilling}),t={width:this.options.width};this.options.flex&&(t.flexGrow=this.options.flex);const n=void 0!==this.props.fillable&&this.props.isBottomSelected&&this.props.isRightSelected;return y("div",{ref:this.cell,className:e,style:t,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,onDblClick:this.handleDbClick},y("div",{ref:this.cellContent,className:Ze}),n&&y("div",{onMouseDown:this.handleFillerMouseDown,className:ct}))}}));var pt="v-grid-row-cells",ft="v-grid-row-stripe-cells",_t="v-grid-row-cells-hover",mt="v-grid-row-cells-select";var gt=be(class extends Xe{constructor(){super(...arguments),this.self={current:null}}componentDidMount(){this.unsubscribe=this.props.grid.store("row").subscribeAny((()=>{if(!this.self.current)return;const e=this.props.grid.state("row").hoveredRow===this.props.value,t=-1!==this.props.grid.state("row").selectedRows.indexOf(this.props.value);e?ae.appendClassName(this.self.current,_t):ae.removeClassName(this.self.current,_t),t?ae.appendClassName(this.self.current,mt):ae.removeClassName(this.self.current,mt)}))}componentWillUnmount(){this.unsubscribe()}render(){const e={height:this.props.baseHeight,minHeight:this.props.baseHeight},t=this.props.grid.state("row").rowIndexes[this.props.value],n=ye({[pt]:!0,[ft]:t%2==0});return y("div",{ref:this.self,className:n,style:e},this.props.columns.map((e=>y(dt,{key:e,row:this.props.value,column:e,onDbClick:this.props.onCellDbClick,onMouseDown:this.props.onCellMouseDown,onMouseMove:this.props.onCellMouseMove,onMouseUp:this.props.onCellMouseUp,onFillerMouseDown:this.props.onCellFillerMouseDown}))))}});class vt{each(e){for(let t=this.minY;t<=this.maxY;t++)for(let n=this.minX;n<=this.maxX;n++)if(!1===e({x:n,y:t},{x:n-this.minX,y:t-this.minY}))return}eachRow(e){for(let t=this.minY;t<=this.maxY;t++)if(!1===e(t,t-this.minY))return}getStartCoord(){return{x:this.minX,y:this.minY}}getEndCoord(){return{x:this.maxX,y:this.maxY}}getGlobalCoord(e){return{x:this.minX+e.x,y:this.minY+e.y}}contains(e){return!this.isEmpty()&&(e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY)}isLeft(e){return!this.isEmpty()&&e.x==this.minX}isRight(e){return!this.isEmpty()&&e.x==this.maxX}isTop(e){return!this.isEmpty()&&e.y==this.minY}isBottom(e){return!this.isEmpty()&&e.y==this.maxY}}class yt extends vt{constructor(e,t){super(),this.start=e,this.end=t,e&&t&&(this.minX=Math.min(e.x,t.x),this.minY=Math.min(e.y,t.y),this.maxX=Math.max(e.x,t.x),this.maxY=Math.max(e.y,t.y))}isEmpty(){return!this.start||!this.end}}class Ct extends vt{constructor(e,t,n){super(),this.ref=e,this.current=t,this.limit=n,void 0!==this.limit&&e&&t&&!e.contains(t)&&("xy"===this.limit&&(this.limit=Math.abs(t.x-e.end.x)>Math.abs(t.y-e.end.y)?"x":"y"),this.start=e.getStartCoord(),this.end=t,"x"===this.limit?(this.end.y=e.end.y,this.start.x=t.x<e.start.x?e.start.x-1:e.end.x+1):(this.end.x=e.end.x,this.start.y=t.y<e.start.y?e.start.y-1:e.end.y+1),this.minX=Math.min(this.start.x,this.end.x),this.minY=Math.min(this.start.y,this.end.y),this.maxX=Math.max(this.start.x,this.end.x),this.maxY=Math.max(this.start.y,this.end.y))}isEmpty(){return!this.start||!this.end}getReference(){return this.ref}chunk(e){if(this.isEmpty())return;const t=this.ref.getStartCoord(),n=this.ref.getEndCoord(),s=this.minX<t.x||this.minY<t.y;let i=[],o=n.y-t.y,r=s?this.minY:this.maxY,l=s?this.maxY:this.minY;for("x"===this.limit&&(o=n.x-t.x,r=s?this.minX:this.maxX,l=s?this.maxX:this.minX);;){const e="x"===this.limit?{x:l,y:this.minY}:{x:this.minX,y:l};l=s?Math.max(l-o,r):Math.min(l+o,r);const t="x"===this.limit?{x:l,y:this.maxY}:{x:this.maxX,y:l};if(i.push(new yt(e,t)),l==r)break;l+=s?-1:1}i.forEach((t=>{e(t)}))}}var wt="v-grid-menu",bt="v-grid-menu-separator",xt="v-grid-menu-item",Rt="v-grid-menu-disabled-item",Et="v-grid-menu-item-icon",Mt="v-grid-menu-item-title";class kt extends xe{constructor(){super(...arguments),this.handleClick=e=>{this.props.disabled||this.props.subMenus||(this.props.action&&this.props.action(),this.props.onClick&&this.props.onClick(e))},this.showSubMenus=()=>{const e=this.refs.self.current,t=e.getBoundingClientRect(),n={x:t.x+e.offsetWidth-2,y:t.y};this.setState({subMenuCoord:n,subMenuVisible:!0})},this.hideSubMenus=()=>{this.setState({subMenuVisible:!1})}}get hasSubMenus(){return this.props.subMenus&&!this.props.disabled}render(){return this.props.separator?y("div",{className:bt}):y("div",{className:this.props.disabled?Rt:xt,onClick:this.handleClick,onMouseOver:this.hasSubMenus?this.showSubMenus:void 0,onMouseLeave:this.hasSubMenus?this.hideSubMenus:void 0,ref:this.createRef("self")},y("span",{className:Et},y("span",{className:this.props.icon})),y("span",{className:Mt},this.props.name),this.hasSubMenus&&y("span",{className:"vg-cheveron-right"}),this.state.subMenuVisible&&y(St,{onMenuItemClicked:this.props.onClick,coord:this.state.subMenuCoord,items:this.props.subMenus}))}}class St extends xe{constructor(){super(...arguments),this.componentDidMount=()=>{document.addEventListener("click",this.handleClickoutside),this.edgeCheck()},this.componentWillUnmount=()=>{document.removeEventListener("click",this.handleClickoutside)},this.componentDidUpdate=()=>{this.edgeCheck()},this.handleClickoutside=e=>{this.props.onClickOutside&&!this.refs.self.current.contains(e.target)&&this.props.onClickOutside()}}get coord(){return this.props.coord?this.props.coord:{x:0,y:0}}edgeCheck(){if(!ae.isInViewport(this.refs.self.current)){const e=this.coord.x-this.refs.self.current.offsetWidth+"px";this.refs.self.current.style.left=e}if(!ae.isInViewport(this.refs.self.current)){const e=this.coord.y-this.refs.self.current.offsetHeight+"px";this.refs.self.current.style.top=e}}render(){return y("div",{ref:this.createRef("self"),style:{left:this.coord.x,top:this.coord.y},className:wt},this.props.items.map((e=>y(kt,__spreadValues({onClick:this.props.onMenuItemClicked},e)))))}}var Ot={root:"v-grid-root",header:"v-grid-header",headerColumns:"v-grid-header-columns",headerContainer:"v-grid-header-container",normalCells:"v-grid-normal-cells",normalCellsViewPort:"v-grid-normal-cells-view-port",normalColumns:"v-grid-normal-columns",pinnedRightCells:"v-grid-pinned-right-cells",pinnedRightColumns:"v-grid-pinned-right-columns",pinnedLeftCells:"v-grid-pinned-left-cells",pinnedLeftColumns:"v-grid-pinned-left-columns",normalCellsContainer:"v-grid-normal-cells-container",body:"v-grid-body",horizontalScroll:"v-grid-horizontal-scroll",horizontalRightSpacer:"v-grid-horizontal-right-spacer",horizontalLeftSpacer:"v-grid-horizontal-left-spacer",horizontalScrollView:"v-grid-horizontal-scroll-view",horizontalScrollContainer:"v-grid-horizontal-scroll-container",columnResizer:"v-grid-column-resizer",loading:"v-grid-loading",dot:"v-grid-dot",slide:"v-grid-slide"};var Lt=we((e=>({pinnedLeftColumns:e.column.pinnedLeftColumns,pinnedRightColumns:e.column.pinnedRightColumns,normalColumns:e.column.normalColumns,rowHeight:e.row.height})),(e=>({getCoordinate:(t,n)=>e.getCoordinate(t,n),getCoordLocatedRange:t=>e.getCoordLocatedRange(t),hoverRow:t=>e.store("row").dispatch("setHoveredRow",t),selectRows:t=>e.store("row").dispatch("selectRows",t),selectCells:(t,n)=>e.store("cell").dispatch("selectCells",{start:t,end:n}),setEditing:t=>e.setEditing(t),setFilling:t=>e.store("cell").dispatch("setFilling",t)})))(be(class extends xe{constructor(){super(...arguments),this.componentDidMount=()=>{document.addEventListener("mouseup",this.handleMouseUp)},this.componentWillUnmount=()=>{document.removeEventListener("mouseup",this.handleMouseUp)},this.componentDidUpdate=()=>{this.refs.normalCellsWrapper.current.style.height=this.props.normalCellsRef.current.clientHeight+"px"},this.handleKeyDown=e=>"c"===e.key&&(e.ctrlKey||e.metaKey)?this.props.grid.copySelection():"v"===e.key&&(e.ctrlKey||e.metaKey)?this.props.grid.pasteFromClipboard():void 0,this.handleCellDbClick=(e,t,n)=>{this.props.setEditing({row:t,column:n})},this.handleCellMouseDown=(e,t,n)=>{e.stopPropagation(),this.props.setEditing();const s=this.props.getCoordinate(t,n);if(e.button===re.Right){const i=this.props.grid.getContextMenuItems({row:t,column:n});if(0===i.length)return;if(this.setState({isMenuVisible:!0,contextMenuItems:i,contextMenuCoord:{x:e.clientX,y:e.clientY}}),this.props.grid.getCoordLocatedRange(s))return}else this.hideContextMenu();e.button!==re.Left&&e.button!==re.Right||(this.props.selectRows([t]),this.selectionStart=this.selectionEnd=s,this.isSelecting=!0,this.handleSelectionChanged())},this.handleCellMouseMove=(e,t,n)=>{this.props.hoverRow(t);const s=this.props.getCoordinate(t,n);if(this.isSelecting){if(this.selectionEnd&&this.selectionEnd.x==s.x&&this.selectionEnd.y==s.y)return;this.selectionEnd=s,this.handleSelectionChanged()}if(this.isFilling){if(this.fillingEnd&&this.fillingEnd.x==s.x&&this.fillingEnd.y==s.y)return;this.fillingEnd=s,this.handleFillRangeChanged()}},this.handleMouseUp=()=>{this.isSelecting&&(this.isSelecting=!1),this.isFilling&&(this.isFilling=!1,this.handleFill(new Ct(this.fillingRef,this.fillingEnd,this.props.grid.state("grid").fillable)),this.fillingRef=this.fillingEnd=null,this.handleFillRangeChanged())},this.handleCellFillerMouseDown=(e,t,n)=>{if(e.button!==re.Left)return;const s=this.props.getCoordinate(t,n),i=this.props.getCoordLocatedRange(s);i&&(this.fillingRef=i,this.fillingEnd=s,this.isFilling=!0,this.handleFillRangeChanged())},this.handleBlur=()=>{this.props.selectRows([]),this.selectionStart=this.selectionEnd=null,this.handleSelectionChanged()},this.handleSelectionChanged=()=>{this.props.selectCells(this.selectionStart,this.selectionEnd)},this.handleFillRangeChanged=()=>{this.props.setFilling(new Ct(this.fillingRef,this.fillingEnd,this.props.grid.state("grid").fillable))},this.hideContextMenu=()=>{this.state.isMenuVisible&&this.setState({isMenuVisible:!1})},this.handleFill=e=>{const t=e.getReference();e.chunk((e=>{e.each(((e,n)=>{const s=t.getGlobalCoord(n);this.props.grid.setCellValueByCoord(e,this.props.grid.getCellValueByCoord(s))}))}))},this.renderRows=e=>this.props.items.map((t=>y(gt,{key:t,value:t,baseHeight:this.props.rowHeight,columns:e,onCellDbClick:this.handleCellDbClick,onCellMouseDown:this.handleCellMouseDown,onCellMouseMove:this.handleCellMouseMove,onCellFillerMouseDown:this.handleCellFillerMouseDown})))}render(){const e=this.props.grid.state("grid").getContextMenuItems?e=>{e.preventDefault()}:void 0;return y("div",{onKeyDown:this.handleKeyDown,onBlur:this.handleBlur,tabIndex:0,style:{display:"flex",outline:"none",position:"relative",minHeight:"100%"},onMouseLeave:()=>this.props.hoverRow(void 0),onContextMenu:e},this.state.isMenuVisible&&y(St,{onMenuItemClicked:this.hideContextMenu,onClickOutside:this.hideContextMenu,coord:this.state.contextMenuCoord,items:this.state.contextMenuItems}),this.props.pinnedLeftColumns.length>0&&y("div",{className:Ot.pinnedLeftCells},this.renderRows(this.props.pinnedLeftColumns)),y("div",{ref:this.createRef("normalCellsWrapper"),className:Ot.normalCells},y("div",{ref:this.props.normalCellsRef,className:Ot.normalCellsViewPort,onScroll:this.props.handleHorizontalScroll},y("div",{ref:this.props.normalCellsContainerRef,className:Ot.normalCellsContainer},this.renderRows(this.props.normalColumns)))),this.props.pinnedRightColumns.length>0&&y("div",{className:Ot.pinnedRightCells},this.renderRows(this.props.pinnedRightColumns)))}}));var Nt=we((e=>({loading:e.grid.loading,width:e.grid.width,height:e.grid.height,preloadRowCount:e.grid.preloadRowCount,headerHeight:e.column.height,pinnedLeftColumns:e.column.pinnedLeftColumns,pinnedRightColumns:e.column.pinnedRightColumns,normalColumns:e.column.normalColumns,rowHeight:e.row.height,rows:e.row.rowIndexes})))(be(class extends xe{constructor(){super(...arguments),this.unsubscribes=[],this.ignoreScrollEvents=!1,this.componentDidMount=()=>{this.unsubscribes.push(this.props.grid.store("grid").subscribeAny((()=>{const e=this.props.grid.state("grid").horizontalScrollLeft;this.refs.headerContainer.current.style.transform=`translateX(-${e}px)`}))),this.unsubscribes.push(this.props.grid.subscribe((()=>{this.resize()}))),this.resize()},this.componentWillUnmount=()=>{this.unsubscribes.forEach((e=>e()))},this.getColumnOptions=e=>this.props.grid.getColumnOptions(e),this.handleColumnResizeStart=(e,t,n)=>{document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("mousemove",this.handleMouseMove);const s=n.pageX-this.refs.root.current.offsetLeft;this.refs.columnResizer.current.style.left=s+"px",this.refs.columnResizer.current.style.width="2px",this.resizingColumn={field:e,width:t,pos:n.clientX}},this.handleMouseUp=e=>{if(document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("mousemove",this.handleMouseMove),this.refs.columnResizer.current.style.left="0px",this.refs.columnResizer.current.style.width="0px",this.resizingColumn){const t=e.clientX-this.resizingColumn.pos+this.resizingColumn.width,n=this.getColumnOptions(this.resizingColumn.field).minWidth;this.props.grid.store("column").dispatch("updateColumnWidth",{field:this.resizingColumn.field,width:Math.max(t,n)})}},this.handleMouseMove=e=>{const t=e.pageX-this.refs.root.current.offsetLeft;this.refs.columnResizer.current.style.left=t+"px"},this.handleHorizontalScroll=e=>{if(this.ignoreScrollEvents)return void(this.ignoreScrollEvents=!1);this.ignoreScrollEvents=!0;const t=e.target.scrollLeft;e.target!=this.refs.normalCells.current&&(this.refs.normalCells.current.scrollLeft=t),e.target!=this.refs.horizontalScroll.current&&(this.refs.horizontalScroll.current.scrollLeft=t),this.props.grid.store("grid").dispatch("setHorizontalScrollLeft",t)},this.listRender=e=>y(Lt,{items:e,handleHorizontalScroll:this.handleHorizontalScroll,normalCellsRef:this.createRef("normalCells"),normalCellsContainerRef:this.createRef("normalCellsContainer")}),this.renderColumns=e=>e.map((e=>y(Ge,{key:e,value:e,onResize:this.handleColumnResizeStart})))}resize(){var e,t,n,s,i,o;const r=this.refs.list.current.base,l=r.offsetWidth-r.clientWidth;let a=0;this.refs.headerContainer.current.scrollWidth>this.refs.normalColumns.current.clientWidth&&(a=this.refs.horizontalScrollContainer.current.offsetHeight);const u=(null==(t=null==(e=this.refs.headerContainer)?void 0:e.current)?void 0:t.scrollWidth)||0;this.refs.header.current.style.paddingRight=l+"px",this.refs.horizontalScrollWrapper.current.style.height=a+"px",this.refs.normalCellsContainer.current.style.width=u+"px",this.refs.horizontalScrollContainer.current.style.width=u+"px",this.refs.horizontalLeftSpacer.current.style.width=((null==(s=null==(n=this.refs.pinnedLeftColumns)?void 0:n.current)?void 0:s.scrollWidth)||0)+"px",this.refs.horizontalRightSpacer.current.style.width=((null==(o=null==(i=this.refs.pinnedRightColumns)?void 0:i.current)?void 0:o.offsetWidth)||0)+l+"px"}render(){const e={width:this.props.width,height:this.props.height},t={height:this.props.headerHeight,minHeight:this.props.headerHeight};return y("div",{ref:this.createRef("root"),className:Ot.root,style:e},y("div",{ref:this.createRef("header"),className:Ot.header,style:t},this.props.pinnedLeftColumns.length>0&&y("div",{ref:this.createRef("pinnedLeftColumns"),className:ye([Ot.pinnedLeftColumns,Ot.headerColumns])},this.renderColumns(this.props.pinnedLeftColumns)),y("div",{ref:this.createRef("normalColumns"),className:Ot.normalColumns},y("div",{ref:this.createRef("headerContainer"),className:ye([Ot.headerContainer,Ot.headerColumns])},this.renderColumns(this.props.normalColumns))),this.props.pinnedRightColumns.length>0&&y("div",{ref:this.createRef("pinnedRightColumns"),className:ye([Ot.pinnedRightColumns,Ot.headerColumns])},this.renderColumns(this.props.pinnedRightColumns))),y("div",{className:Ot.body},y(Me,{ref:this.createRef("list"),items:this.props.grid.store("row").getRowIds(),itemHeight:this.props.rowHeight,preLoadCount:this.props.preloadRowCount,render:this.listRender})),y("div",{ref:this.createRef("horizontalScrollWrapper"),className:Ot.horizontalScroll},y("div",{ref:this.createRef("horizontalLeftSpacer"),className:Ot.horizontalLeftSpacer}),y("div",{ref:this.createRef("horizontalScroll"),className:Ot.horizontalScrollView,onScroll:this.handleHorizontalScroll},y("div",{ref:this.createRef("horizontalScrollContainer"),className:Ot.horizontalScrollContainer})),y("div",{ref:this.createRef("horizontalRightSpacer"),className:Ot.horizontalRightSpacer})),y("div",{ref:this.createRef("columnResizer"),className:Ot.columnResizer}),this.props.loading&&y("div",{className:Ot.loading},y("div",{className:Ot.spinner},y("div",{className:Ot.dot}),y("div",{className:Ot.dot}),y("div",{className:Ot.dot}),y("div",{className:Ot.dot}),y("div",{className:Ot.dot}))))}}));function It(e){const[t,n]=ne({destroyed:!1});return se((()=>e.grid.store("grid").subscribe("destroy",(()=>{n({destroyed:!0})}))),[]),!t.destroyed&&y(U,{grid:e.grid},y(Nt,null))}function Pt(e,t){B(y(It,{grid:e}),t)}class Vt{constructor(e,t){this._listeners=e,this._actions={},this._anyListeners=[],this._state=t||{}}getState(){return this._state}subscribeAny(e){return this._anyListeners.push(e),()=>{this._anyListeners.splice(this._anyListeners.indexOf(e),1)}}subscribe(e,t){return this._listeners[e].push(t),()=>{this._listeners[e].splice(this._listeners[e].indexOf(t),1)}}handle(e,t){return this._actions[e]=t,this}dispatch(e,t){const n=this._actions[e];if(!n)return;const s=n(this._state,t);if(s!==this._state){const n=this._state;this._state=s,this._listeners[e].forEach((e=>e(t,s,n))),this._anyListeners.forEach((e=>e(t,s,n)))}}}class Dt extends Vt{constructor(e){super(Object.keys(e).reduce(((e,t)=>(e[t]=[],e)),{}),Object.keys(e).reduce(((t,n)=>(t[n]=e[n].getState(),t)),{})),this.stores=e,Object.keys(e).forEach((t=>{e[t].subscribeAny((()=>{this.dispatch(t,void 0)})),this.handle(t,(n=>(n[t]=e[t].getState(),__spreadValues({},n))))}))}store(e){return this.stores[e]}state(e){return this._state[e]}}function zt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $t={exports:{}};!function(e,t){function n(e){return"object"!=typeof e||"toString"in e?e:Object.prototype.toString.call(e).slice(8,-1)}Object.defineProperty(t,"__esModule",{value:!0});var s="object"==typeof process&&!0;function i(e,t){if(!e){if(s)throw new Error("Invariant failed");throw new Error(t())}}t.invariant=i;var o=Object.prototype.hasOwnProperty,r=Array.prototype.splice,l=Object.prototype.toString;function a(e){return l.call(e).slice(8,-1)}var u=Object.assign||function(e,t){return h(t).forEach((function(n){o.call(t,n)&&(e[n]=t[n])})),e},h="function"==typeof Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.keys(e)};function c(e){return Array.isArray(e)?u(e.constructor(e.length),e):"Map"===a(e)?new Map(e):"Set"===a(e)?new Set(e):e&&"object"==typeof e?u(Object.create(Object.getPrototypeOf(e)),e):e}var d=function(){function e(){this.commands=u({},p),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,t){return e===t},this.update.newContext=function(){return(new e).update}}return Object.defineProperty(e.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e},enumerable:!0,configurable:!0}),e.prototype.extend=function(e,t){this.commands[e]=t},e.prototype.update=function(e,t){var n=this,s="function"==typeof t?{$apply:t}:t;Array.isArray(e)&&Array.isArray(s)||i(!Array.isArray(s),(function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."})),i("object"==typeof s&&null!==s,(function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the following commands: "+Object.keys(n.commands).join(", ")+"."}));var r=e;return h(s).forEach((function(t){if(o.call(n.commands,t)){var i=e===r;r=n.commands[t](s[t],r,s,e),i&&n.isEquals(r,e)&&(r=e)}else{var l="Map"===a(e)?n.update(e.get(t),s[t]):n.update(e[t],s[t]),u="Map"===a(r)?r.get(t):r[t];n.isEquals(l,u)&&(void 0!==l||o.call(e,t))||(r===e&&(r=c(e)),"Map"===a(r)?r.set(t,l):r[t]=l)}})),r},e}();t.Context=d;var p={$push:function(e,t,n){return _(t,n,"$push"),e.length?t.concat(e):t},$unshift:function(e,t,n){return _(t,n,"$unshift"),e.length?e.concat(t):t},$splice:function(e,t,s,o){return function(e,t){i(Array.isArray(e),(function(){return"Expected $splice target to be an array; got "+n(e)})),g(t.$splice)}(t,s),e.forEach((function(e){g(e),t===o&&e.length&&(t=c(o)),r.apply(t,e)})),t},$set:function(e,t,n){return function(e){i(1===Object.keys(e).length,(function(){return"Cannot have more than one key in an object with $set"}))}(n),e},$toggle:function(e,t){m(e,"$toggle");var n=e.length?c(t):t;return e.forEach((function(e){n[e]=!t[e]})),n},$unset:function(e,t,n,s){return m(e,"$unset"),e.forEach((function(e){Object.hasOwnProperty.call(t,e)&&(t===s&&(t=c(s)),delete t[e])})),t},$add:function(e,t,n,s){return v(t,"$add"),m(e,"$add"),"Map"===a(t)?e.forEach((function(e){var n=e[0],i=e[1];t===s&&t.get(n)!==i&&(t=c(s)),t.set(n,i)})):e.forEach((function(e){t!==s||t.has(e)||(t=c(s)),t.add(e)})),t},$remove:function(e,t,n,s){return v(t,"$remove"),m(e,"$remove"),e.forEach((function(e){t===s&&t.has(e)&&(t=c(s)),t.delete(e)})),t},$merge:function(e,t,s,o){var r,l;return r=t,i((l=e)&&"object"==typeof l,(function(){return"update(): $merge expects a spec of type 'object'; got "+n(l)})),i(r&&"object"==typeof r,(function(){return"update(): $merge expects a target of type 'object'; got "+n(r)})),h(e).forEach((function(n){e[n]!==t[n]&&(t===o&&(t=c(o)),t[n]=e[n])})),t},$apply:function(e,t){var s;return i("function"==typeof(s=e),(function(){return"update(): expected spec of $apply to be a function; got "+n(s)+"."})),e(t)}},f=new d;function _(e,t,s){i(Array.isArray(e),(function(){return"update(): expected target of "+n(s)+" to be an array; got "+n(e)+"."})),m(t[s],s)}function m(e,t){i(Array.isArray(e),(function(){return"update(): expected spec of "+n(t)+" to be an array; got "+n(e)+". Did you forget to wrap your parameter in an array?"}))}function g(e){i(Array.isArray(e),(function(){return"update(): expected spec of $splice to be an array of arrays; got "+n(e)+". Did you forget to wrap your parameters in an array?"}))}function v(e,t){var s=a(e);i("Map"===s||"Set"===s,(function(){return"update(): "+n(t)+" expects a target of type Set or Map; got "+n(s)}))}t.isEquals=f.update.isEquals,t.extend=f.extend,t.default=f.update,t.default.default=e.exports=u(t.default,t)}($t,$t.exports);var Ht=zt($t.exports);const jt={width:"100%",height:"100%",preloadRowCount:20};class Bt extends Vt{constructor(e){super({setHorizontalScrollLeft:[],setLoading:[],destroy:[]},Object.assign({},jt,e)),this.handle("setHorizontalScrollLeft",((e,t)=>__spreadProps(__spreadValues({},e),{horizontalScrollLeft:t}))),this.handle("setLoading",((e,t)=>Ht(e,{loading:{$set:t}}))),this.handle("destroy",(e=>Ht(e,{destroyed:{$set:!0}})))}destroy(){this.dispatch("destroy",void 0)}}const At={rows:[],rowIndexes:{},selectedRows:[],height:28};class Ft extends Vt{constructor(e){super({setCellValue:[],setHoveredRow:[],selectRows:[],appendRowsBefore:[],takeRows:[],clear:[],setBaseHeight:[]},Object.assign({},At,e)),this.handle("setCellValue",((e,{row:t,column:n,value:s})=>{const i=e.rowIndexes[t];return void 0===i?e:Ht(e,{rows:{[i]:{[n]:{$set:s}}}})})),this.handle("appendRowsBefore",((e,{index:t,rows:n})=>{n=n.filter((t=>{const n=e.rowIndexes[t.id];return void 0===n||(e.rows[n]=t,!1)})),t=Math.max(t,0),n=[...e.rows.slice(0,t),...n,...e.rows.slice(t,e.rows.length)];const s={};return n.forEach(((e,t)=>{s[e.id]=t})),__spreadProps(__spreadValues({},e),{rows:n,rowIndexes:s})})),this.handle("takeRows",((e,t)=>{t=t.filter((t=>void 0!==e.rowIndexes[t]));const n=e.rows.filter((e=>-1===t.indexOf(e.id))),s={};return n.forEach(((e,t)=>{s[e.id]=t})),Ht(e,{rowIndexes:{$set:s},rows:{$set:n}})})),this.handle("setHoveredRow",((e,t)=>void 0===t||void 0!==e.rowIndexes[t]?Ht(e,{hoveredRow:{$set:t}}):e)),this.handle("selectRows",((e,t)=>(t=t.filter(((n,s)=>void 0!==e.rowIndexes[n]&&t.indexOf(n,0)===s)),Ht(e,{selectedRows:{$set:t}})))),this.handle("clear",(e=>Ht(e,{rowIndexes:{$set:{}},rows:{$set:[]},hoveredRow:{$set:void 0},selectedRows:{$set:[]}}))),this.handle("setBaseHeight",((e,t)=>Ht(e,{height:{$set:t}})))}appendRowsBefore(e,t){return this.dispatch("appendRowsBefore",{index:e,rows:t})}appendRows(e){return this.dispatch("appendRowsBefore",{index:this._state.rows.length,rows:e})}selectRows(e){return th